diff --git a/Doc/Project Apollo - NASSP/RTCC/ApolloRTCCMFD.pdf b/Doc/Project Apollo - NASSP/RTCC/ApolloRTCCMFD.pdf index 570f3dd6d..f0848945f 100644 Binary files a/Doc/Project Apollo - NASSP/RTCC/ApolloRTCCMFD.pdf and b/Doc/Project Apollo - NASSP/RTCC/ApolloRTCCMFD.pdf differ diff --git a/Doc/Project Apollo - NASSP/RTCC/ApolloRTCCMFD.tex b/Doc/Project Apollo - NASSP/RTCC/ApolloRTCCMFD.tex index 912d31f47..c52dbc367 100644 --- a/Doc/Project Apollo - NASSP/RTCC/ApolloRTCCMFD.tex +++ b/Doc/Project Apollo - NASSP/RTCC/ApolloRTCCMFD.tex @@ -2917,8 +2917,19 @@ \subsection{Mission Constants} MHVACG&LM ascent stage CG table. Format: entry in table, weight, x, y and z coordinates. Example: 0 5000.0 260.9969 0.3187 5.0043&&-, lbs, in, in, in\\ \hline MHVACG\_N&Number of entries in LM ascent stage CG table&14&\\ +\hline \end{tabular} +\newpage +\begin{tabular}{L{3cm} L{7cm} L{2.5cm} L{1.5cm}} +\hline +\textbf{Name} & \textbf{Description} & \textbf{Default Value} & \textbf{Unit}\\ +\hline +MGTESE&Number of tesseral and sectorial coefficients in Earth potential&0 (use 4 in Open Orbiter)&\\ +\hline +MMTESE&Number of tesseral and sectorial coefficients in Moon potential&0 (use 3 in Open Orbiter)&\\ +\hline +\end{tabular} \newpage \subsection{Launch Day Init Parameters} diff --git a/Orbitersdk/samples/ProjectApollo/src_launch/rtcc.cpp b/Orbitersdk/samples/ProjectApollo/src_launch/rtcc.cpp index bcbfd9427..33917cc5e 100644 --- a/Orbitersdk/samples/ProjectApollo/src_launch/rtcc.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_launch/rtcc.cpp @@ -2599,6 +2599,8 @@ bool RTCC::LoadMissionConstantsFile(std::string file) papiReadScenario_int(Buff, "MHVLCG_N", SystemParameters.MHVLCG.N); papiReadConfigFile_CGTable(Buff, "MHVACG", SystemParameters.MHVACG.Weight, SystemParameters.MHVACG.CG); papiReadScenario_int(Buff, "MHVACG_N", SystemParameters.MHVACG.N); + papiReadScenario_int(Buff, "MGTESE", SystemParameters.MGTESE); + papiReadScenario_int(Buff, "MMTESE", SystemParameters.MMTESE); } //Anything that is mission, but not launch day specific @@ -15234,9 +15236,9 @@ void RTCC::EMMDYNMC(int L, int queid, int ind, double param) AEGDataBlock sv_a, sv_p; double INFO[10]; - PIMCKC(sv_pred.R, sv_pred.V, sv_pred.RBI, aeg.Data.coe_osc.a, aeg.Data.coe_osc.e, aeg.Data.coe_osc.i, aeg.Data.coe_osc.g, aeg.Data.coe_osc.h, aeg.Data.coe_osc.l); - aeg.Header.AEGInd = sv_pred.RBI; - + //Convert state vector to AEG format + aeg = SVToAEG(sv_pred, 0.0, 1.0, mpt->KFactor); //TBD: Mass and area from PLAWDT + //Calculate apsides data PMMAPD(aeg.Header, aeg.Data, 0, 0, INFO, &sv_a, &sv_p); tab->HAR = INFO[4] / 1852.0; diff --git a/Orbitersdk/samples/ProjectApollo/src_rtccmfd/ARCore.cpp b/Orbitersdk/samples/ProjectApollo/src_rtccmfd/ARCore.cpp index 55f6f9237..11a9d8c7f 100644 --- a/Orbitersdk/samples/ProjectApollo/src_rtccmfd/ARCore.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_rtccmfd/ARCore.cpp @@ -5030,8 +5030,8 @@ int ARCore::subThread() { //Without the MPT, get the TIG and DV from the MCC or LOI table - VECTOR3 dv; - double gmt_tig; + EphemerisData sv_man_bef; + VECTOR3 V_man_after; int num = GC->rtcc->med_m78.ManeuverNumber; @@ -5043,8 +5043,9 @@ int ARCore::subThread() Result = DONE; break; } - gmt_tig = GC->rtcc->PZLRBELM.sv_man_bef[num - 1].GMT; - dv = GC->rtcc->PZLRBELM.V_man_after[num - 1] - GC->rtcc->PZLRBELM.sv_man_bef[num - 1].V; + + sv_man_bef = GC->rtcc->PZLRBELM.sv_man_bef[num - 1]; + V_man_after = GC->rtcc->PZLRBELM.V_man_after[num - 1]; } else { @@ -5054,46 +5055,52 @@ int ARCore::subThread() Result = DONE; break; } - gmt_tig = GC->rtcc->PZMCCXFR.sv_man_bef[num - 1].GMT; - dv = GC->rtcc->PZMCCXFR.V_man_after[num - 1] - GC->rtcc->PZMCCXFR.sv_man_bef[num - 1].V; - } - VESSEL *v; - EphemerisData sv_now, sv_tig; - double mass, dt, attachedMass; - int ITS; - - if (GC->rtcc->med_m78.Table == RTCC_MPT_CSM) - { - v = GC->rtcc->pCSM; - } - else - { - v = GC->rtcc->pLM; + sv_man_bef = GC->rtcc->PZMCCXFR.sv_man_bef[num - 1]; + V_man_after = GC->rtcc->PZMCCXFR.V_man_after[num - 1]; } - if (v == NULL) + PMMMPTInput in; + + //Get all required data for PMMMPT and error checking + if (GetVesselParameters(GC->rtcc->med_m78.Table == RTCC_MPT_CSM, vesselisdocked, GC->rtcc->med_m78.Thruster, in.CONFIG, in.VC, in.CSMWeight, in.LMWeight)) { + //Error Result = DONE; break; } - sv_now = GC->rtcc->StateVectorCalcEphem(v); - mass = v->GetMass(); - - //Propagate to TIG - dt = gmt_tig - sv_now.GMT; - GC->rtcc->PMMCEN(sv_now, 0.0, 0.0, 1, abs(dt), dt >= 0.0 ? 1.0 : -1.0, sv_tig, ITS); + in.VehicleArea = 129.4*pow(0.3048, 2); //TBD + in.IterationFlag = GC->rtcc->med_m78.Iteration; + in.IgnitionTimeOption = GC->rtcc->med_m78.TimeFlag; + in.Thruster = GC->rtcc->med_m78.Thruster; - if (vesselisdocked) + in.sv_before = sv_man_bef; + in.V_aft = V_man_after; + if (GC->rtcc->med_m78.UllageDT < 0) { - attachedMass = GC->rtcc->GetDockedVesselMass(v); + in.DETU = GC->rtcc->SystemParameters.MCTNDU; } else { - attachedMass = 0.0; + in.DETU = GC->rtcc->med_m78.UllageDT; + } + in.UT = GC->rtcc->med_m78.UllageQuads; + in.DT_10PCT = GC->rtcc->med_m78.TenPercentDT; + in.DPSScaleFactor = GC->rtcc->med_m78.DPSThrustFactor; + + double GMT_TIG; + VECTOR3 DV; + if (GC->rtcc->PoweredFlightProcessor(in, GMT_TIG, DV) == 0) + { + //Save for Maneuver PAD and uplink + P30TIG = GC->rtcc->GETfromGMT(GMT_TIG); + dV_LVLH = DV; + manpadenginetype = GC->rtcc->med_m78.Thruster; + HeadsUp = true; + manpad_ullage_dt = in.DETU; + manpad_ullage_opt = GC->rtcc->med_m78.UllageQuads; } - GC->rtcc->PoweredFlightProcessor(sv_tig, mass, GC->rtcc->GETfromGMT(gmt_tig), GC->rtcc->med_m78.Thruster, attachedMass, dv, false, P30TIG, dV_LVLH); } Result = DONE; diff --git a/Orbitersdk/samples/ProjectApollo/src_rtccmfd/ApolloRTCCMFD.cpp b/Orbitersdk/samples/ProjectApollo/src_rtccmfd/ApolloRTCCMFD.cpp index dd76e47b8..c9fe49196 100644 --- a/Orbitersdk/samples/ProjectApollo/src_rtccmfd/ApolloRTCCMFD.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_rtccmfd/ApolloRTCCMFD.cpp @@ -1108,12 +1108,14 @@ void ApolloRTCCMFD::menuSetOnlineMonitorPage() void ApolloRTCCMFD::menuLOITransferPage() { GC->rtcc->med_m78.Type = true; + GC->rtcc->med_m78.Iteration = true; //Make the iterate option the default SelectPage(76); } void ApolloRTCCMFD::menuMCCTransferPage() { GC->rtcc->med_m78.Type = false; + GC->rtcc->med_m78.Iteration = false; //Make the do not iterate option the default SelectPage(76); } diff --git a/Orbitersdk/samples/ProjectApollo/src_rtccmfd/ApolloRTCCMFD_Display.cpp b/Orbitersdk/samples/ProjectApollo/src_rtccmfd/ApolloRTCCMFD_Display.cpp index 4db2ed428..84fbefeeb 100644 --- a/Orbitersdk/samples/ProjectApollo/src_rtccmfd/ApolloRTCCMFD_Display.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_rtccmfd/ApolloRTCCMFD_Display.cpp @@ -6817,54 +6817,54 @@ bool ApolloRTCCMFD::Update(oapi::Sketchpad *skp) ThrusterName(Buffer, GC->rtcc->med_m78.Thruster); skp->Text(1 * W / 16, 8 * H / 14, Buffer, strlen(Buffer)); - if (GC->MissionPlanningActive) + if (GC->rtcc->med_m78.UllageDT < 0) { - MPTAttitudeName(Buffer, GC->rtcc->med_m78.Attitude); - skp->Text(1 * W / 16, 10 * H / 14, Buffer, strlen(Buffer)); - - if (GC->rtcc->med_m78.UllageDT < 0) + sprintf_s(Buffer, "Nominal ullage"); + } + else + { + if (GC->rtcc->med_m78.UllageQuads) { - sprintf_s(Buffer, "Nominal ullage"); + sprintf_s(Buffer, "4 quads, %.1f s", GC->rtcc->med_m78.UllageDT); } else { - if (GC->rtcc->med_m78.UllageQuads) - { - sprintf_s(Buffer, "4 quads, %.1f s", GC->rtcc->med_m78.UllageDT); - } - else - { - sprintf_s(Buffer, "2 quads, %.1f s", GC->rtcc->med_m78.UllageDT); - } + sprintf_s(Buffer, "2 quads, %.1f s", GC->rtcc->med_m78.UllageDT); } - skp->Text(1 * W / 16, 12 * H / 14, Buffer, strlen(Buffer)); + } + skp->Text(1 * W / 16, 12 * H / 14, Buffer, strlen(Buffer)); - if (GC->rtcc->med_m78.Iteration) - { - skp->Text(10 * W / 16, 2 * H / 14, "Iterate", 7); - } - else - { - skp->Text(10 * W / 16, 2 * H / 14, "Don't iterate", 13); - } + if (GC->rtcc->med_m78.Iteration) + { + skp->Text(10 * W / 16, 2 * H / 14, "Iterate", 7); + } + else + { + skp->Text(10 * W / 16, 2 * H / 14, "Don't iterate", 13); + } - if (GC->rtcc->med_m78.Thruster == RTCC_ENGINETYPE_LMDPS) - { - sprintf_s(Buffer, "%lf s", GC->rtcc->med_m78.TenPercentDT); - skp->Text(10 * W / 16, 4 * H / 14, Buffer, strlen(Buffer)); + if (GC->rtcc->med_m78.Thruster == RTCC_ENGINETYPE_LMDPS) + { + sprintf_s(Buffer, "%lf s", GC->rtcc->med_m78.TenPercentDT); + skp->Text(10 * W / 16, 4 * H / 14, Buffer, strlen(Buffer)); - sprintf_s(Buffer, "%lf", GC->rtcc->med_m78.DPSThrustFactor); - skp->Text(10 * W / 16, 6 * H / 14, Buffer, strlen(Buffer)); - } + sprintf_s(Buffer, "%lf", GC->rtcc->med_m78.DPSThrustFactor); + skp->Text(10 * W / 16, 6 * H / 14, Buffer, strlen(Buffer)); + } - if (GC->rtcc->med_m78.TimeFlag) - { - skp->Text(10 * W / 16, 8 * H / 14, "Impulsive TIG", 13); - } - else - { - skp->Text(10 * W / 16, 8 * H / 14, "Optimum TIG", 11); - } + if (GC->rtcc->med_m78.TimeFlag) + { + skp->Text(10 * W / 16, 8 * H / 14, "Impulsive TIG", 13); + } + else + { + skp->Text(10 * W / 16, 8 * H / 14, "Optimum TIG", 11); + } + + if (GC->MissionPlanningActive) + { + MPTAttitudeName(Buffer, GC->rtcc->med_m78.Attitude); + skp->Text(1 * W / 16, 10 * H / 14, Buffer, strlen(Buffer)); } if (GC->MissionPlanningActive == false) diff --git a/Orbitersdk/samples/ProjectApollo/src_rtccmfd/CoastNumericalIntegrator.cpp b/Orbitersdk/samples/ProjectApollo/src_rtccmfd/CoastNumericalIntegrator.cpp index 5b380f503..0655ff3a3 100644 --- a/Orbitersdk/samples/ProjectApollo/src_rtccmfd/CoastNumericalIntegrator.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_rtccmfd/CoastNumericalIntegrator.cpp @@ -494,11 +494,14 @@ void CoastIntegrator2::SetBodyParameters(int p) rect2 = 0.75*OrbMech::power(2.0, 2.0)*100.0; P = BODY_EARTH; GMD = 4; - GMO = 0; //4 to use the full tesseral data + GMO = pRTCC->SystemParameters.MGTESE; ZONAL[0] = 0.0; ZONAL[1] = OrbMech::J2_Earth; ZONAL[2] = OrbMech::J3_Earth; ZONAL[3] = OrbMech::J4_Earth; - //Use this when Orbiter simulates it - //C[0] = -1.1619e-9; C[1] = 1.5654e-6; C[2] = 2.1625e-6; C[3] = 3.18750e-7; C[4] = 9.7078e-8; C[5] = -5.1257e-7; C[6] = 7.739e-8; C[7] = 5.7700e-8; C[8] = -3.4567e-9; - //S[0] = -4.1312e-9; S[1] = -8.9613e-7; S[2] = 2.6809e-7; S[3] = -2.15567e-8; S[4] = 1.9885e-7; S[5] = -4.4095e-7; S[6] = 1.497e-7; S[7] = -1.2389e-8; S[8] = 6.4464e-9; + + for (int i = 0; i < 9; i++) + { + C[i] = pRTCC->SystemParameters.MDCMAT[i]; + S[i] = pRTCC->SystemParameters.MDSMAT[i]; + } } else { @@ -510,10 +513,14 @@ void CoastIntegrator2::SetBodyParameters(int p) rect2 = 0.75*OrbMech::power(2.0, -2.0)*100.0; P = BODY_MOON; GMD = 3; - GMO = 0; //3 with L1 model + GMO = pRTCC->SystemParameters.MMTESE; ZONAL[0] = 0.0; ZONAL[1] = OrbMech::J2_Moon; ZONAL[2] = OrbMech::J3_Moon; ZONAL[3] = 0.0; - //L1 model, use this when Orbiter simulates it - //C[0] = 0.0; C[1] = 0.20715e-4; C[2] = 0.34e-4; C[4] = 0.02583e-4; + + for (int i = 0; i < 9; i++) + { + C[i] = pRTCC->SystemParameters.MMCMAT[i]; + S[i] = pRTCC->SystemParameters.MMSMAT[i]; + } } } diff --git a/Orbitersdk/samples/ProjectApollo/src_rtccmfd/EnckeIntegrator.cpp b/Orbitersdk/samples/ProjectApollo/src_rtccmfd/EnckeIntegrator.cpp index 1fb5c1afe..794b8c969 100644 --- a/Orbitersdk/samples/ProjectApollo/src_rtccmfd/EnckeIntegrator.cpp +++ b/Orbitersdk/samples/ProjectApollo/src_rtccmfd/EnckeIntegrator.cpp @@ -691,11 +691,14 @@ void EnckeFreeFlightIntegrator::SetBodyParameters(int p) rect2 = 0.75*OrbMech::power(2.0, 2.0)*100.0; P = BODY_EARTH; GMD = 4; - GMO = 0; //4 to use the full tesseral data + GMO = pRTCC->SystemParameters.MGTESE; ZONAL[0] = 0.0; ZONAL[1] = OrbMech::J2_Earth; ZONAL[2] = OrbMech::J3_Earth; ZONAL[3] = OrbMech::J4_Earth; - //Use this when Orbiter simulates it - //C[0] = -1.1619e-9; C[1] = 1.5654e-6; C[2] = 2.1625e-6; C[3] = 3.18750e-7; C[4] = 9.7078e-8; C[5] = -5.1257e-7; C[6] = 7.739e-8; C[7] = 5.7700e-8; C[8] = -3.4567e-9; - //S[0] = -4.1312e-9; S[1] = -8.9613e-7; S[2] = 2.6809e-7; S[3] = -2.15567e-8; S[4] = 1.9885e-7; S[5] = -4.4095e-7; S[6] = 1.497e-7; S[7] = -1.2389e-8; S[8] = 6.4464e-9; + + for (int i = 0; i < 9; i++) + { + C[i] = pRTCC->SystemParameters.MDCMAT[i]; + S[i] = pRTCC->SystemParameters.MDSMAT[i]; + } } else { @@ -706,10 +709,14 @@ void EnckeFreeFlightIntegrator::SetBodyParameters(int p) rect2 = 0.75*OrbMech::power(2.0, -2.0)*100.0; P = BODY_MOON; GMD = 3; - GMO = 0; //3 with L1 model + GMO = pRTCC->SystemParameters.MMTESE; ZONAL[0] = 0.0; ZONAL[1] = OrbMech::J2_Moon; ZONAL[2] = OrbMech::J3_Moon; ZONAL[3] = 0.0; - //L1 model, use this when Orbiter simulates it - //C[0] = 0.0; C[1] = 0.20715e-4; C[2] = 0.34e-4; C[4] = 0.02583e-4; + + for (int i = 0; i < 9; i++) + { + C[i] = pRTCC->SystemParameters.MMCMAT[i]; + S[i] = pRTCC->SystemParameters.MMSMAT[i]; + } } } diff --git a/Orbitersdk/samples/ProjectApollo/src_rtccmfd/RTCCSystemParameters.h b/Orbitersdk/samples/ProjectApollo/src_rtccmfd/RTCCSystemParameters.h index c78e03133..3dd0f38fb 100644 --- a/Orbitersdk/samples/ProjectApollo/src_rtccmfd/RTCCSystemParameters.h +++ b/Orbitersdk/samples/ProjectApollo/src_rtccmfd/RTCCSystemParameters.h @@ -242,6 +242,18 @@ struct RTCCSystemParameters MCSRMU = 0.494857310015327; MCERMU = 4.461996919999204; + //Earth + MDCMAT[0] = -1.1619e-9; MDCMAT[1] = 1.5654e-6; MDCMAT[2] = 2.1625e-6; MDCMAT[3] = 3.18750e-7; MDCMAT[4] = 9.7078e-8; + MDCMAT[5] = -5.1257e-7; MDCMAT[6] = 7.739e-8; MDCMAT[7] = 5.7700e-8; MDCMAT[8] = -3.4567e-9; + MDSMAT[0] = -4.1312e-9; MDSMAT[1] = -8.9613e-7; MDSMAT[2] = 2.6809e-7; MDSMAT[3] = -2.15567e-8; MDSMAT[4] = 1.9885e-7; + MDSMAT[5] = -4.4095e-7; MDSMAT[6] = 1.497e-7; MDSMAT[7] = -1.2389e-8; MDSMAT[8] = 6.4464e-9; + MGTESE = 0; //4 to use the full tesseral data. Use 0 in Orbiter Beta and earlier, 4 in Open Orbiter + + //Moon + MMCMAT[0] = 0.0; MMCMAT[1] = 0.20715e-4; MMCMAT[2] = 0.34e-4; MMCMAT[3] = 0.0; MMCMAT[4] = 0.02583e-4; MMCMAT[5] = 0.0; MMCMAT[6] = 0.0; MMCMAT[7] = 0.0; MMCMAT[8] = 0.0; + MMSMAT[0] = 0.0; MMSMAT[1] = 0.0; MMSMAT[2] = 0.0; MMSMAT[3] = 0.0; MMSMAT[4] = 0.0; MMSMAT[5] = 0.0; MMSMAT[6] = 0.0; MMSMAT[7] = 0.0; MMSMAT[8] = 0.0; + MMTESE = 0; //3 with L1 model. Use 0 in Orbiter Beta and earlier, 3 in Open Orbiter + //Time from launch to EOI, seconds MDLIEV[0] = 0.76673814e3; MDLIEV[1] = -0.18916781e1; @@ -826,6 +838,21 @@ struct RTCCSystemParameters double MCSRMU; //Square root of gravitational constant of the Earth (Er^3/hr^2)^1/2 double MCERMU; + + //C-matrix used in Earth potential + double MDCMAT[9]; + //S-matrix used in Earth potential + double MDSMAT[9]; + //Number of tesseral and sectorial coefficients in Earth potential + int MGTESE; + + //C-matrix used in Moon potential + double MMCMAT[9]; + //S-matrix used in Moon potential + double MMSMAT[9]; + //Number of tesseral and sectorial coefficients in Moon potential + int MMTESE; + //Polynomial coefficients for insertion conditions double MDLIEV[16]; //Earth orbit insertion constants