Skip to content

Commit

Permalink
Merge branch 'Orbiter2016' into IMU_drift
Browse files Browse the repository at this point in the history
  • Loading branch information
n7275 committed Aug 6, 2023
2 parents 5edad15 + 908d8b2 commit 439d66f
Show file tree
Hide file tree
Showing 28 changed files with 920 additions and 625 deletions.
Binary file modified Doc/Project Apollo - NASSP/Checklists/Apollo 11 Checklists.xls
Binary file not shown.
Binary file not shown.
Binary file modified Doc/Project Apollo - NASSP/Checklists/Apollo 9 LM Checklists.xls
Binary file not shown.
1 change: 1 addition & 0 deletions Missions/ProjectApollo/Apollo 14.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ LGCVersion=Luminary178
AEAVersion=FP8
CMtoLMPowerConnectionVersion=1
HasRateAidedOptics=TRUE
LMCWEAVersion=1
CDRVesselName=Al Shepard
CMPVesselName=Stu Roosa
LMPVesselName=Ed Mitchell
Expand Down
2 changes: 2 additions & 0 deletions Missions/ProjectApollo/Apollo 15.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ LM_CGZ_Coefficients=6.999290756655724e-09 -7.903615464137980e-05 2.9183085320058
CMtoLMPowerConnectionVersion=2
EmptySMCG=913.9687 1.6681 1.0488
HasRateAidedOptics=TRUE
LMCWEAVersion=1
CrossPointerReversePolarity=TRUE
CDRVesselName=Dave Scott
CMPVesselName=Al Worden
LMPVesselName=Jim Irwin
Expand Down
2 changes: 2 additions & 0 deletions Missions/ProjectApollo/Apollo 16.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ LMDSKYVersion=3
CMtoLMPowerConnectionVersion=2
EmptySMCG=913.9687 1.6681 1.0488
HasRateAidedOptics=TRUE
LMCWEAVersion=1
CrossPointerReversePolarity=TRUE
CDRVesselName=John Young
CMPVesselName=Ken Mattingly
LMPVesselName=Charlie Duke
Expand Down
2 changes: 2 additions & 0 deletions Missions/ProjectApollo/Apollo 17.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ LMDSKYVersion=3
CMtoLMPowerConnectionVersion=2
EmptySMCG=913.9687 1.6681 1.0488
HasRateAidedOptics=TRUE
LMCWEAVersion=1
CrossPointerReversePolarity=TRUE
CDRVesselName=Gene Cernan
CMPVesselName=Ron Evans
LMPVesselName=Jack Schmitt
Expand Down
22 changes: 22 additions & 0 deletions Orbitersdk/samples/ProjectApollo/src_aux/Mission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,18 @@ namespace mission {
EmptySMCG = _V(914.5916, -6.6712, 12.2940); //Includes: empty SM and SLA ring, but no SM RCS
bHasRateAidedOptics = false;


CM_IMUDriftRates = _M(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
CM_PIPABias = _V(0.0, 0.0, 0.0);
CM_PIPAScale = _V(0.0, 0.0, 0.0);

LM_IMUDriftRates = _M(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
LM_PIPABias = _V(0.0, 0.0, 0.0);;
LM_PIPAScale = _V(0.0, 0.0, 0.0);

iLMCWEAVersion = 0;
bCrossPointerReversePolarity = false;

strCDRName = "CDR";
strCMPName = "CMP";
strLMPName = "LMP";
Expand Down Expand Up @@ -267,6 +272,13 @@ namespace mission {
strncpy(buffer, line + 19, 255);
bHasRateAidedOptics = !_strnicmp(buffer, "TRUE", 4);
}
else if (!_strnicmp(line, "LMCWEAVersion=", 14)) {
sscanf(line + 14, "%d", &iLMCWEAVersion);
}
else if (!_strnicmp(line, "CrossPointerReversePolarity=", 28)) {
strncpy(buffer, line + 28, 255);
bCrossPointerReversePolarity = !_strnicmp(buffer, "TRUE", 4);
}
else if (!_strnicmp(line, "CDRVesselName=", 14)) {
strncpy(buffer, line + 14, 255);
strCDRName.assign(buffer);
Expand Down Expand Up @@ -524,6 +536,16 @@ namespace mission {
return bHasRateAidedOptics;
}

int Mission::GetLMCWEAVersion() const
{
return iLMCWEAVersion;
}

bool Mission::GetCrossPointerReversePolarity() const
{
return bCrossPointerReversePolarity;
}

void Mission::ReadCueCardLine(char *line, int vehicle)
{
char buffer[128];
Expand Down
9 changes: 9 additions & 0 deletions Orbitersdk/samples/ProjectApollo/src_aux/Mission.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ namespace mission
VECTOR3 GetCGOfEmptySM() const;
//false = Optics mode switch is not bypassed for CMC to optics commands, true = optics mode switch is bypassed for CMC to optics commands (ECP 792)
bool HasRateAidedOptics() const;

//
MATRIX3 GetCM_IMU_Drift() const;
//
Expand All @@ -99,6 +100,12 @@ namespace mission
VECTOR3 GetCM_PIPA_Scale() const;
//
VECTOR3 GetLM_PIPA_Scale() const;

//0 = LM-7 and before (ASC PRESS LOW before staging, RCS for HEATER FAILURE CAUTION), 1 = LM-8 and after (both cut and capped)
int GetLMCWEAVersion() const;
//false = Normal polarity (Apollo 14 and earlier), Lateral axis for PGNS and LR input has switched polarity (Apollo 15 and later)
bool GetCrossPointerReversePolarity() const;

//Get cue cards
bool GetCSMCueCards(unsigned &counter, unsigned &loc, std::string &meshname, VECTOR3 &ofs);
//Name of CDR
Expand Down Expand Up @@ -155,6 +162,8 @@ namespace mission
int iCMtoLMPowerConnectionVersion;
VECTOR3 EmptySMCG;
bool bHasRateAidedOptics;
int iLMCWEAVersion;
bool bCrossPointerReversePolarity;
std::vector<CueCardConfig> CSMCueCards;
std::vector<CueCardConfig> LMCueCards;

Expand Down
27 changes: 15 additions & 12 deletions Orbitersdk/samples/ProjectApollo/src_launch/MCC_Mission_G.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,23 +316,26 @@ void MCC::MissionSequence_G()
case MST_G_LUNAR_ORBIT_ASCENT_DAY_6: //LM Liftoff Evaluation to CMC LM State Vector update
UpdateMacro(UTP_NONE, PT_NONE, rtcc->GETEval2(rtcc->calcParams.Insertion + 120.0), 104, MST_G_LUNAR_ORBIT_ASCENT_DAY_7, scrubbed, SubStateTime > 15.0*60.0, MST_G_LUNAR_ORBIT_ASCENT_DAY_2);
break;
case MST_G_LUNAR_ORBIT_ASCENT_DAY_7: //CMC LM State Vector update to CSM state vector update
UpdateMacro(UTP_CMCUPLINKONLY, PT_NONE, MoonRev >= 27 && MoonRevTime > 95.0*60.0, 2, MST_G_LUNAR_ORBIT_ASCENT_DAY_8);
case MST_G_LUNAR_ORBIT_ASCENT_DAY_7: //CMC LM State Vector update to CSM DAP Update
UpdateMacro(UTP_CMCUPLINKONLY, PT_NONE, (rtcc->calcParams.src->DockingStatus(0) == 1) && (MoonRev >= 27 && MoonRevTime > 38.0*60.0), 2, MST_G_LUNAR_ORBIT_ASCENT_DAY_8);
break;
case MST_G_LUNAR_ORBIT_ASCENT_DAY_8: //CSM state vector update to Preliminary TEI-30 update
UpdateMacro(UTP_CMCUPLINKONLY, PT_NONE, MoonRev >= 29 && MoonRevTime > 40.0*60.0, 1, MST_G_LUNAR_ORBIT_ASCENT_DAY_9);
case MST_G_LUNAR_ORBIT_ASCENT_DAY_8: //CSM DAP Update to CSM state vector update
UpdateMacro(UTP_PADONLY, PT_AP10DAPDATA, MoonRev >= 27 && MoonRevTime > 95.0*60.0, 39, MST_G_LUNAR_ORBIT_ASCENT_DAY_9);
break;
case MST_G_LUNAR_ORBIT_ASCENT_DAY_9: //Preliminary TEI-30 update to Final TEI-30 Update
UpdateMacro(UTP_PADONLY, PT_AP11MNV, MoonRev >= 30 && MoonRevTime > 55.0*60.0, 45, MST_G_LUNAR_ORBIT_ASCENT_DAY_10);
case MST_G_LUNAR_ORBIT_ASCENT_DAY_9: //CSM state vector update to Preliminary TEI-30 update
UpdateMacro(UTP_CMCUPLINKONLY, PT_NONE, MoonRev >= 29 && MoonRevTime > 40.0*60.0, 1, MST_G_LUNAR_ORBIT_ASCENT_DAY_10);
break;
case MST_G_LUNAR_ORBIT_ASCENT_DAY_10: //Final TEI-30 Update to TEI-31 PAD
UpdateMacro(UTP_PADWITHCMCUPLINK, PT_AP11MNV, SubStateTime > 5.0*60.0, 46, MST_G_LUNAR_ORBIT_ASCENT_DAY_11);
case MST_G_LUNAR_ORBIT_ASCENT_DAY_10: //Preliminary TEI-30 update to Final TEI-30 Update
UpdateMacro(UTP_PADONLY, PT_AP11MNV, MoonRev >= 30 && MoonRevTime > 55.0*60.0, 45, MST_G_LUNAR_ORBIT_ASCENT_DAY_11);
break;
case MST_G_LUNAR_ORBIT_ASCENT_DAY_11: //TEI-31 PAD to TEI Evaluation
UpdateMacro(UTP_PADONLY, PT_AP11MNV, rtcc->GETEval2(rtcc->calcParams.TEI + 300.0), 47, MST_G_LUNAR_ORBIT_ASCENT_DAY_12);
case MST_G_LUNAR_ORBIT_ASCENT_DAY_11: //Final TEI-30 Update to TEI-31 PAD
UpdateMacro(UTP_PADWITHCMCUPLINK, PT_AP11MNV, SubStateTime > 5.0*60.0, 46, MST_G_LUNAR_ORBIT_ASCENT_DAY_12);
break;
case MST_G_LUNAR_ORBIT_ASCENT_DAY_12: //TEI Evaluation to TEI
UpdateMacro(UTP_NONE, PT_NONE, true, 105, MST_G_TRANSEARTH_1, scrubbed, MoonRevTime > 40.0*60.0, MST_G_LUNAR_ORBIT_ASCENT_DAY_10);
case MST_G_LUNAR_ORBIT_ASCENT_DAY_12: //TEI-31 PAD to TEI Evaluation
UpdateMacro(UTP_PADONLY, PT_AP11MNV, rtcc->GETEval2(rtcc->calcParams.TEI + 300.0), 47, MST_G_LUNAR_ORBIT_ASCENT_DAY_13);
break;
case MST_G_LUNAR_ORBIT_ASCENT_DAY_13: //TEI Evaluation to TEI
UpdateMacro(UTP_NONE, PT_NONE, true, 105, MST_G_TRANSEARTH_1, scrubbed, MoonRevTime > 40.0*60.0, MST_G_LUNAR_ORBIT_ASCENT_DAY_11);
break;
case MST_G_TRANSEARTH_1: //TEI to PTC REFSMMAT
switch (SubState)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ See http://nassp.sourceforge.net/license/ for more details.
#define MST_G_LUNAR_ORBIT_ASCENT_DAY_10 169
#define MST_G_LUNAR_ORBIT_ASCENT_DAY_11 170
#define MST_G_LUNAR_ORBIT_ASCENT_DAY_12 171
#define MST_G_LUNAR_ORBIT_ASCENT_DAY_13 172
#define MST_G_TRANSEARTH_1 200
#define MST_G_TRANSEARTH_2 201
#define MST_G_TRANSEARTH_3 202
Expand Down
16 changes: 14 additions & 2 deletions Orbitersdk/samples/ProjectApollo/src_launch/RTCC_Mission_G.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,14 @@ bool RTCC::CalculationMTP_G(int fcn, LPVOID &pad, char * upString, char * upDesc
PZREAP.RRBIAS = 1285.0;
entopt.t_zmin = 145.0*3600.0;

//Temporarily set the minimum pericynthion height constraint to 40 NM. This was apparently done on the actual mission as well to make the desired solution converge
PZREAP.HMINMC = 40.0;

RTEMoonTargeting(&entopt, &res);

//Set back HMINMC to original value
PZREAP.HMINMC = 50.0;

opt.R_LLS = BZLAND.rad[RTCC_LMPOS_BEST];
opt.dV_LVLH = res.dV_LVLH;
opt.enginetype = SPSRCSDecision(SPS_THRUST / (calcParams.src->GetMass() + calcParams.tgt->GetMass()), res.dV_LVLH);
Expand Down Expand Up @@ -1169,13 +1175,20 @@ bool RTCC::CalculationMTP_G(int fcn, LPVOID &pad, char * upString, char * upDesc
}
}
break;
case 33: //CSM DAP DATA
case 33: //CSM DAP DATA (Undocked)
{
AP10DAPDATA * form = (AP10DAPDATA *)pad;

CSMDAPUpdate(calcParams.src, *form, false);
}
break;
case 39: //CSM DAP DATA (Docked)
{
AP10DAPDATA * form = (AP10DAPDATA *)pad;

CSMDAPUpdate(calcParams.src, *form, true);
}
break;
case 34: //LM DAP DATA
{
LMACTDATA * form = (LMACTDATA *)pad;
Expand Down Expand Up @@ -1416,7 +1429,6 @@ bool RTCC::CalculationMTP_G(int fcn, LPVOID &pad, char * upString, char * upDesc
sv2 = coast(sv1, 1.0*2.0*3600.0);
}

entopt.Inclination = -40.0*RAD;
entopt.returnspeed = 1;
entopt.RV_MCC = sv2;
entopt.vessel = calcParams.src;
Expand Down
2 changes: 1 addition & 1 deletion Orbitersdk/samples/ProjectApollo/src_launch/rtcc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24148,7 +24148,7 @@ void RTCC::PMMREAST(int med, EphemerisData *sv)
sv_r.RBI = BODY_EARTH;
AST.lat_SPL = rte.EntryLatcor;
AST.lng_SPL = rte.EntryLngcor;
AST.SplashdownGMT = rte.t_z;
AST.SplashdownGMT = rte.t_Landing;
AST.DV = rte.DV;
AST.h_PC = rte.FlybyPeriAlt;
}
Expand Down
2 changes: 1 addition & 1 deletion Orbitersdk/samples/ProjectApollo/src_lm/Sat5LMDSC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ void Sat5LMDSC::clbkLoadStateEx(FILEHANDLE scn, void *vstatus)
{
sscanf(line + 5, "%d", &state);
}
else if (!strnicmp(line, "APOLLONO", 8)) {
else if (!_strnicmp(line, "APOLLONO", 8)) {
sscanf(line + 8, "%d", &ApolloNo);

if (sscanf(line + 8, "%d", &ApolloNo) == 1)
Expand Down
4 changes: 2 additions & 2 deletions Orbitersdk/samples/ProjectApollo/src_lm/lemsystems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3194,7 +3194,7 @@ void CrossPointer::Timestep(double simdt)
vy = lem->LR.rate[1] * 0.3048;

//Apollo 15 and later had this inversed
if (lem->ApolloNo >= 15)
if (lem->pMission->GetCrossPointerReversePolarity())
{
vy *= -1.0;
}
Expand All @@ -3214,7 +3214,7 @@ void CrossPointer::Timestep(double simdt)
vy = lgc_lateral*0.3048;

//Apollo 15 and later had this inversed
if (lem->ApolloNo >= 15)
if (lem->pMission->GetCrossPointerReversePolarity())
{
vy *= -1.0;
}
Expand Down
11 changes: 6 additions & 5 deletions Orbitersdk/samples/ProjectApollo/src_lm/lm_cwea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ See http://nassp.sourceforge.net/license/ for more details.
#include "LEMcomputer.h"
#include "LEM.h"
#include "papi.h"
#include "Mission.h"
#include "lm_cwea.h"

// CWEA
Expand Down Expand Up @@ -134,7 +135,7 @@ void LEM_CWEA::Timestep(double simdt) {
lightlogic = true;
}
// Fuel and oxidizer pressure < 119.8 psia prior to staging, cut and capped from the CWEA on LM-8 and subsequent
if (((lem->ApolloNo < 14 || lem->ApolloNo == 1301) && lem->stage < 2) && (lem->APSPropellant.GetFuelTrimOrificeOutletPressurePSI() < 119.8 || lem->APSPropellant.GetOxidTrimOrificeOutletPressurePSI() < 119.8)) {
if ((lem->pMission->GetLMCWEAVersion() == 0 && lem->stage < 2) && (lem->APSPropellant.GetFuelTrimOrificeOutletPressurePSI() < 119.8 || lem->APSPropellant.GetOxidTrimOrificeOutletPressurePSI() < 119.8)) {
lightlogic = true;
}

Expand Down Expand Up @@ -410,19 +411,19 @@ void LEM_CWEA::Timestep(double simdt) {

// RCS Quads < 118.8F or > 190.5F, cut and capped on LM-8 and subsequent
//Quad 1
QD1HeaterCautFF.Set((lem->ApolloNo < 14 || lem->ApolloNo == 1301) && (lem->scera1.GetVoltage(20, 4) < 2.79 || lem->scera1.GetVoltage(20, 4) > 4.725));
QD1HeaterCautFF.Set(lem->pMission->GetLMCWEAVersion() == 0 && (lem->scera1.GetVoltage(20, 4) < 2.79 || lem->scera1.GetVoltage(20, 4) > 4.725));
QD1HeaterCautFF.Reset(lem->TempMonitorRotary.GetState() == 2);

//Quad 2
QD2HeaterCautFF.Set((lem->ApolloNo < 14 || lem->ApolloNo == 1301) && (lem->scera1.GetVoltage(20, 3) < 2.79 || lem->scera1.GetVoltage(20, 3) > 4.725));
QD2HeaterCautFF.Set(lem->pMission->GetLMCWEAVersion() == 0 && (lem->scera1.GetVoltage(20, 3) < 2.79 || lem->scera1.GetVoltage(20, 3) > 4.725));
QD2HeaterCautFF.Reset(lem->TempMonitorRotary.GetState() == 3);

//Quad 3
QD3HeaterCautFF.Set((lem->ApolloNo < 14 || lem->ApolloNo == 1301) && (lem->scera1.GetVoltage(20, 2) < 2.79 || lem->scera1.GetVoltage(20, 2) > 4.725));
QD3HeaterCautFF.Set(lem->pMission->GetLMCWEAVersion() == 0 && (lem->scera1.GetVoltage(20, 2) < 2.79 || lem->scera1.GetVoltage(20, 2) > 4.725));
QD3HeaterCautFF.Reset(lem->TempMonitorRotary.GetState() == 4);

//Quad 4
QD4HeaterCautFF.Set((lem->ApolloNo < 14 || lem->ApolloNo == 1301) && (lem->scera1.GetVoltage(20, 1) < 2.79 || lem->scera1.GetVoltage(20, 1) > 4.725));
QD4HeaterCautFF.Set(lem->pMission->GetLMCWEAVersion() == 0 && (lem->scera1.GetVoltage(20, 1) < 2.79 || lem->scera1.GetVoltage(20, 1) > 4.725));
QD4HeaterCautFF.Reset(lem->TempMonitorRotary.GetState() == 5);

// S-Band Antenna Electronic Drive Assembly < -64.08F or > 152.63F
Expand Down
5 changes: 5 additions & 0 deletions Orbitersdk/samples/ProjectApollo/src_rtccmfd/ARCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3726,6 +3726,11 @@ int ARCore::subThread()
break;
case 23: //Calculate TPI times
{
if (target == NULL)
{
Result = DONE;
break;
}
SV sv0 = GC->rtcc->StateVectorCalc(target);
t_TPI = GC->rtcc->CalculateTPITimes(sv0, TPI_Mode, t_TPIguess, dt_TPI_sunrise);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ void PMMAEG::CALL(AEGHeader &header, AEGDataBlock &in, AEGDataBlock &out)
CurrentBlock.Item8 = CurrentBlock.R - tempblock.R;
CurrentBlock.Item9 = CurrentBlock.TE - tempblock.TE;
dt += -theta_R / (CurrentBlock.l_dot + CurrentBlock.g_dot);
if (abs(theta_R) > 0.0001)
if (abs(theta_R) > 0.00005)
{
goto NewPMMAEG_V1000;
}
Expand Down Expand Up @@ -581,7 +581,7 @@ void PMMLAEG::CALL(AEGHeader &header, AEGDataBlock &in, AEGDataBlock &out)
CurrentBlock.Item8 = CurrentBlock.R - tempblock.R;
CurrentBlock.Item9 = CurrentBlock.TE - tempblock.TE;
dt += -theta_R / (CurrentBlock.l_dot + CurrentBlock.g_dot);
if (abs(theta_R) > 0.0001)
if (abs(theta_R) > 0.00005)
{
goto NewPMMLAEG_V1000;
}
Expand Down
Loading

0 comments on commit 439d66f

Please sign in to comment.