Skip to content

Commit

Permalink
Merge pull request #1334 from indy91/RTCCFix
Browse files Browse the repository at this point in the history
Ability to calculate multiple DKI plans at once and more RTCC MFD Cleanup
  • Loading branch information
indy91 authored Jan 25, 2025
2 parents 3b874d3 + b214a12 commit 6776b73
Show file tree
Hide file tree
Showing 10 changed files with 306 additions and 422 deletions.
Binary file modified Doc/Project Apollo - NASSP/RTCC/ApolloRTCCMFD.pdf
Binary file not shown.
14 changes: 13 additions & 1 deletion Doc/Project Apollo - NASSP/RTCC/ApolloRTCCMFD.tex
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,19 @@ \subsubsection{Docking Initiation Processor (DKI)}
\textbf{DH1:} The Delta Height at the NCC maneuver point. Only required for Skylab rendezvous profile. Usually 20 NM\\
\textbf{DH2:} The Delta Height at the NSR maneuver point. A positive value indicates the chaser vehicle being below the target. Usually 10 to 20 NM.\\
\textbf{E:} Elevation angle at TPI. Typical value is 26.6 DEG for a rendezvous from below. For rendezvous from above, for example if the CSM needs to rescue the LM in lunar orbit, the value 208.3 DEG is usually used.\\

\textbf{WT:} Transfer angle from TPI to TPF, typically between 130 and 140 degrees.\\
\textbf{MIN:} Minimum allowable periapsis altitude in the rendezvous plan.\\

\paragraph{DKI Inputs}\mbox{} \\

\textbf{NC1:} Choose the maneuver line number of the NC1 maneuver. Set to a negative value if no phasing maneuver is in the maneuver plan.\\
\textbf{NH1:} Choose the maneuver line number of the NH maneuver. Set to a negative value if no height maneuver is in the maneuver plan.\\
\textbf{NSR:} Choose the maneuver line number of the NSR maneuver. If the rendezvous profile is the Skylab profile then the NCC maneuver line number is selected here and NSR happens at a specific time after NCC.\\
\textbf{MI:} The maneuver line number for the rendezvous point (TPF). This is an integer number and only has to be a rough estimate, typically this will be set so that rendezvous occurs one orbit after NSR.\\
\textbf{IDM:} Number of additional rendezvous plans that are being generated. For this the NSR and subsequent maneuvers are set to occur one orbit later and the DKI calculation is run again for the updated plan.\\
\textbf{MNH:} Location of the NH maneuver in the additional plans select with the IDM button. The NH maneuver either stays at its original maneuver line, as specified on this MFD page, or it is being moved one orbit for every additional plan, in effect keeping its place in the plan relative to NSR.\\
\textbf{NPC:} Location of the plane change maneuver in the rendezvous plan. Not available yet.\\

\paragraph{Example: Apollo 10 PDI Abort}\mbox{} \\

A simple example for a DKI targeted maneuver is the Apollo 10 PDI Abort. Similar in concept to the PDI+12 maneuvers of the lunar landing missions, Apollo 10 would have done an abort maneuver at perilune after DOI to return to the CSM one orbit earlier than in the normal rendezvous plan. The sequence of maneuvers would be the abort initiation 0.5 revolutions after DOI, targeted as a phasing (NC1) maneuver. CSI or NH would follow another half revolution later, and again the CDH or NSR maneuver would be half an orbit after that. If we assign 1.0 as the maneuver line to the DOI maneuver then we would have NC1 = 1.5, NH = 2.0, NSR = 2.5, M = 3. The maneuver line definition is using the time option with the DOI TIG as input.
Expand Down
53 changes: 40 additions & 13 deletions Orbitersdk/samples/ProjectApollo/src_launch/rtcc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1508,6 +1508,8 @@ RTCC::RendezvousEvaluationDisplay::RendezvousEvaluationDisplay()

RTCC::RendezvousPlanningDisplayData::RendezvousPlanningDisplayData()
{
DV_CSM = 0.0;
DV_LM = 0.0;
NC1 = 0.0;
NH = 0.0;
NSR = 0.0;
Expand Down Expand Up @@ -11113,11 +11115,15 @@ bool RTCC::DockingInitiationProcessor(DKIOpt opt)
//Threshold time of TPI
double TXX;
double TSR1, TSI, P, ECF2, ESF2, TR, DNSR, mu, Elev, theta_TPI, theta_S, SONEL, RTPM, TTPF, R_E, r_per, PMIN, NHS;
int ILOOP, i, block;
int ILOOP, i, block, J;
bool failed, INH, store, recycle, end;

PZDKIT.UpdatingIndicator = true;
PZDKIT.NumSolutions = 0;
for (i = 0; i < 7; i++)
{
PZDKIT.Block[i].PlanStatus = 0; //Invalidate all solutions
}

//Convert to aeg format
aeg_init = SVToAEG(opt.sv_CSM, 0.0, 1.0, 1.0); //TBD
Expand Down Expand Up @@ -11147,6 +11153,7 @@ bool RTCC::DockingInitiationProcessor(DKIOpt opt)
DKI.NCC = opt.NCC;
DKI.NPC = opt.NPC;
DKI.MI = opt.MI;
DKI.MF = opt.MI + (double)opt.IDM;

if (opt.sv_CSM.RBI == BODY_EARTH)
{
Expand Down Expand Up @@ -11274,7 +11281,6 @@ bool RTCC::DockingInitiationProcessor(DKIOpt opt)
sv_init[I] = sv[I];

PMMDKI_2_1:

//Take maneuvering vehicle to arrival at NSR
sv[M].TIMA = 3;
sv[M].Item8 = UOCI;
Expand Down Expand Up @@ -11354,7 +11360,6 @@ bool RTCC::DockingInitiationProcessor(DKIOpt opt)
//J = 4: NH, NSR
//J = 5: NSR
//J = 10: NC1, NH, NCC, NSR (Skylab)
int J;

if (opt.I4)
{
Expand Down Expand Up @@ -11471,6 +11476,8 @@ bool RTCC::DockingInitiationProcessor(DKIOpt opt)
MATRIX3 Q_Xx;
double DH, Phase, HA, HP;

PZDKIT.Block[block].DV_CSM = PZDKIT.Block[block].DV_LM = 0.0;

for (i = 0;i < PZDKIT.Block[block].NumMan;i++)
{
PCPICK(aegh, DKI.sv_after[i], sv[I], DH, Phase, HA, HP);
Expand All @@ -11485,6 +11492,15 @@ bool RTCC::DockingInitiationProcessor(DKIOpt opt)
PZDKIT.Block[block].Display[i].dv = length(PZDKIT.Block[block].Display[i].DV_LVLH);
PZDKIT.Block[block].Display[i].Yaw = atan2(PZDKIT.Block[block].Display[i].DV_LVLH.y, PZDKIT.Block[block].Display[i].DV_LVLH.x);
PZDKIT.Block[block].Display[i].Pitch = atan2(-PZDKIT.Block[block].Display[i].DV_LVLH.z, sqrt(pow(PZDKIT.Block[block].Display[i].DV_LVLH.x, 2) + pow(PZDKIT.Block[block].Display[i].DV_LVLH.y, 2)));

if (PZDKIT.Block[block].Display[i].VEH == RTCC_MPT_CSM)
{
PZDKIT.Block[block].DV_CSM += PZDKIT.Block[block].Display[i].dv;
}
else
{
PZDKIT.Block[block].DV_LM += PZDKIT.Block[block].Display[i].dv;
}
}
block++;
}
Expand All @@ -11496,7 +11512,7 @@ bool RTCC::DockingInitiationProcessor(DKIOpt opt)
{
DKI.NH = NHS;
}
if (opt.IDM > DKI.MI)
if (DKI.MF > DKI.MI)
{
DKI.MI += 1.0;
DKI.NCC += 1.0;
Expand Down Expand Up @@ -22863,12 +22879,19 @@ int RTCC::PMMXFR(int id, void *data)
{
num_man = 1;//PZLDPELM.num_man;
}
else if (inp->Plan == 0)
{
num_man = 1;//PZDKIT.Block[0].NumMan;
}
else
{
if (inp->Plan == 0)
{
//SPQ plan is in first slot of DKI table
inp->Plan = 1;
}
//Does this plan exist?
if (PZDKIT.Block[inp->Plan - 1].PlanStatus == 0)
{
PMXSPT("PMMXFR", 38);
return 38;
}
num_man = 1;//PZDKIT.Block[inp->Plan - 1].NumMan;
}
}
Expand Down Expand Up @@ -22919,9 +22942,9 @@ int RTCC::PMMXFR(int id, void *data)
}
else
{
GMTI = PZDKIELM.Block[0].SV_before[0].GMT;
purpose = PZDKIT.Block[0].Display[0].Man_ID;
plan = PZDKIT.Block[0].Display[0].VEH;
GMTI = PZDKIELM.Block[inp->Plan - 1].SV_before[0].GMT;
purpose = PZDKIT.Block[inp->Plan - 1].Display[0].Man_ID;
plan = PZDKIT.Block[inp->Plan - 1].Display[0].VEH;
}
}
else if (id == 42)
Expand Down Expand Up @@ -23037,8 +23060,8 @@ int RTCC::PMMXFR(int id, void *data)
}
else
{
in.sv_before = PZDKIELM.Block[0].SV_before[0];
in.V_aft = PZDKIELM.Block[0].V_after[0];
in.sv_before = PZDKIELM.Block[inp->Plan - 1].SV_before[0];
in.V_aft = PZDKIELM.Block[inp->Plan - 1].V_after[0];
}
}
else
Expand Down Expand Up @@ -30899,6 +30922,7 @@ int RTCC::PMMMED(std::string med, std::vector<std::string> data)
}

inp.IterationFlag[0] = med_m70.Iteration;
if (med_m70.Plan > 7) return 2;
inp.Plan = med_m70.Plan;
inp.ReplaceCode = 0;
inp.Thruster[0] = med_m70.Thruster;
Expand Down Expand Up @@ -35232,6 +35256,7 @@ void RTCC::PMDRPT()
}

PZRPDT.plans = PZDKIT.NumSolutions;

for (int i = 0;i < PZDKIT.NumSolutions;i++)
{
PZRPDT.data[i].ID = i + 1;
Expand All @@ -35242,6 +35267,8 @@ void RTCC::PMDRPT()
PZRPDT.data[i].NPC = PZDKIT.Block[i].NPC;
PZRPDT.data[i].NCC = PZDKIT.Block[i].NCC;
PZRPDT.data[i].GETTPI = GETfromGMT(PZDKIT.Block[i].TTPI);
PZRPDT.data[i].DV_CSM = PZDKIT.Block[i].DV_CSM / 0.3048;
PZRPDT.data[i].DV_LM = PZDKIT.Block[i].DV_LM / 0.3048;
}
}

Expand Down
19 changes: 15 additions & 4 deletions Orbitersdk/samples/ProjectApollo/src_launch/rtcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,11 @@ struct MED_M68
//Transfer a DKI, SPQ, or a Descent Plan to the MPT
struct MED_M70
{
int Plan = 0; //-1 = Descent Plan, 0 = SPQ, 1 = DKI
int Plan = 0; //-1 = Descent Plan, 0 = SPQ, 1-7 = DKI plans 1-7
double DeleteGET = 0.0;
int Thruster = RTCC_ENGINETYPE_CSMRCSPLUS2; //Thruster for the maneuver
int Attitude = 4; //Attitude option (1 = Inertial, 2 = Manual, 3 = Lambert, 4 = PGNS External DV, 5 = AGS External DV)
double UllageDT = -1; //Delta T of Ullage
double UllageDT = 0.0; //Delta T of Ullage
bool UllageQuads = true;//false = 2 thrusters, true = 4 thrusters
bool Iteration = false; //false = do not iterate, true = iterate
double TenPercentDT = 26.0; //Delta T of 10% thrust for the DPS
Expand Down Expand Up @@ -792,7 +792,7 @@ struct DKIOpt
bool LNH = false;
//Number of additional M-lines desired
int IDM = 0;
//Flag to determine where to place in multiple plans. false = same point, 1 = relative to NSR
//Flag to determine where to place NH in multiple plans. false = same point, true = relative to NSR
bool MNH = false;

//Skylab only
Expand Down Expand Up @@ -826,6 +826,8 @@ struct DKICommon
double NPC;
//M-line of maneuver line number at which rendezvous is to take place
double MI;
//Final M-line or rendezvous number
double MF;
//Delta time of lighting condition for TPI, in minutes!
double TLIT;
//Control flag for TPI time computation. 1 = Input TPI time, 2 = input TPF time, 3 = TPI at "TLIT" minutes into night,
Expand Down Expand Up @@ -3217,6 +3219,10 @@ class RTCC {
double NPC = -1.0;
//M-line or maneuver line number at which rendezvous is to take place
double MI = 3.0;
//Number of additional M-lines desired
int IDM = 0;
//Flag to determine where to place NH in multiple plans. false = same point, true = relative to NSR
bool MNH = false;
//DT between NCC and NSR maneuver (Skylab)
double dt_NCC_NSR = 37.0*60.0;

Expand Down Expand Up @@ -3330,7 +3336,7 @@ class RTCC {
int ReplaceCode = 0; //1-15
int Thruster = RTCC_ENGINETYPE_CSMSPS; //Thruster for the maneuver
int Attitude = RTCC_ATTITUDE_PGNS_EXDV; //Attitude option
double UllageDT = -1; //Delta T of Ullage
double UllageDT = 0.0; //Delta T of Ullage
bool UllageQuads = true;//false = 2 thrusters, true = 4 thrusters
bool Iteration = false; //false = do not iterate, true = iterate
double TenPercentDT = 26.0; //Delta T of 10% thrust for the DPS
Expand Down Expand Up @@ -4445,6 +4451,9 @@ class RTCC {
double NSR = 0.0;
double NPC = 0.0;
double TTPI = 0.0;
//DVs
double DV_CSM = 0.0;
double DV_LM = 0.0;
};

struct DKIDataTable
Expand Down Expand Up @@ -4484,6 +4493,8 @@ class RTCC {
RendezvousPlanningDisplayData();
int ID;
int M;
double DV_CSM;
double DV_LM;
double NC1;
double NH;
double NSR;
Expand Down
70 changes: 25 additions & 45 deletions Orbitersdk/samples/ProjectApollo/src_rtccmfd/ARCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1064,16 +1064,11 @@ void ARCore::TransferTIToMPT()
startSubthread(38);
}

void ARCore::TransferSPQToMPT()
void ARCore::Transfer_SPQ_Or_DKI_To_MPT()
{
startSubthread(39);
}

void ARCore::TransferDKIToMPT()
{
startSubthread(40);
}

void ARCore::MPTDirectInputCalc()
{
startSubthread(41);
Expand Down Expand Up @@ -3934,6 +3929,8 @@ int ARCore::subThread()
opt.NSR = GC->rtcc->med_k00.NSR;
opt.NPC = GC->rtcc->med_k00.NPC;
opt.MI = GC->rtcc->med_k00.MI;
opt.IDM = GC->rtcc->med_k00.IDM;
opt.MNH = GC->rtcc->med_k00.MNH;
if (GC->rtcc->med_k00.ChaserVehicle == RTCC_MPT_CSM)
{
opt.MV = 1;
Expand Down Expand Up @@ -4687,7 +4684,7 @@ int ARCore::subThread()
Result = DONE;
}
break;
case 39: //Transfer SPQ to MPT
case 39: //Transfer SPQ or DKI to MPT
{
if (GC->MissionPlanningActive)
{
Expand All @@ -4696,56 +4693,34 @@ int ARCore::subThread()
}
else
{
SV sv_pre, sv_post, sv_tig;
double attachedMass = 0.0;
int plan;

//Was CSM or LM the chaser vehicle?
VESSEL *v;
if (GC->rtcc->PZDKIT.Block[0].Display[0].VEH == RTCC_MPT_CSM)
{
v = GC->rtcc->pCSM;
}
else
{
v = GC->rtcc->pLM;
}
plan = GC->rtcc->med_m70.Plan;

if (v == NULL)
if (plan > 0) plan--; //For DKI

if (plan < 0 || plan > 6)
{
//Error
Result = DONE;
break;
}

SV sv_now = GC->rtcc->StateVectorCalc(v);
sv_tig = GC->rtcc->coast(sv_now, SPQTIG - OrbMech::GETfromMJD(sv_now.MJD, GC->rtcc->CalcGETBase()));
RTCC::DKIDataBlock *block = &GC->rtcc->PZDKIT.Block[plan];

if (vesselisdocked)
{
attachedMass = GC->rtcc->GetDockedVesselMass(v);
}
else
if (block->PlanStatus == 0)
{
attachedMass = 0.0;
//Error
Result = DONE;
break;
}
GC->rtcc->PoweredFlightProcessor(sv_tig, SPQTIG, GC->rtcc->med_m70.Thruster, 0.0, SPQDeltaV, true, P30TIG, dV_LVLH, sv_pre, sv_post);
}

Result = DONE;
}
break;
case 40: //Transfer DKI to MPT
{
if (GC->MissionPlanningActive)
{
std::vector<std::string> str;
GC->rtcc->PMMMED("70", str);
}
else
{
RTCC::DKIElementsBlock *elem = &GC->rtcc->PZDKIELM.Block[plan];

PMMMPTInput in;

//Get all required data for PMMMPT and error checking
if (GetVesselParameters(GC->rtcc->PZDKIT.Block[0].Display[0].VEH == RTCC_MPT_CSM, vesselisdocked, GC->rtcc->med_m70.Thruster, in.CONFIG, in.VC, in.CSMWeight, in.LMWeight))
if (GetVesselParameters(block->Display[0].VEH == RTCC_MPT_CSM, vesselisdocked, GC->rtcc->med_m70.Thruster, in.CONFIG, in.VC, in.CSMWeight, in.LMWeight))
{
//Error
Result = DONE;
Expand All @@ -4757,8 +4732,8 @@ int ARCore::subThread()
in.IgnitionTimeOption = GC->rtcc->med_m70.TimeFlag;
in.Thruster = GC->rtcc->med_m70.Thruster;

in.sv_before = GC->rtcc->PZDKIELM.Block[0].SV_before[0];
in.V_aft = GC->rtcc->PZDKIELM.Block[0].V_after[0];
in.sv_before = elem->SV_before[0];
in.V_aft = elem->V_after[0];
if (GC->rtcc->med_m70.UllageDT < 0)
{
in.DETU = GC->rtcc->SystemParameters.MCTNDU;
Expand Down Expand Up @@ -4786,6 +4761,11 @@ int ARCore::subThread()
}

Result = DONE;
}
break;
case 40: //Spare
{

}
break;
case 41: //Direct Input to the MPT
Expand Down
3 changes: 1 addition & 2 deletions Orbitersdk/samples/ProjectApollo/src_rtccmfd/ARCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ class ARCore {
void SkylabSaturnIBLaunchCalc();
void SkylabSaturnIBLaunchUplink();
void TransferTIToMPT();
void TransferSPQToMPT();
void TransferDKIToMPT();
void Transfer_SPQ_Or_DKI_To_MPT();
void TransferDescentPlanToMPT();
void TransferPoweredDescentToMPT();
void TransferPoweredAscentToMPT();
Expand Down
Loading

0 comments on commit 6776b73

Please sign in to comment.