Skip to content

Commit

Permalink
Merge pull request #1252 from indy91/Apollo10MCC
Browse files Browse the repository at this point in the history
Apollo 10 MCC Updates
  • Loading branch information
indy91 authored Jan 5, 2025
2 parents 2634ec4 + 8cf633c commit 082e59e
Show file tree
Hide file tree
Showing 12 changed files with 566 additions and 157 deletions.
2 changes: 2 additions & 0 deletions Orbitersdk/samples/ProjectApollo/Build/VC2017/MCC.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
<ItemGroup>
<ClCompile Include="..\..\src_aux\Mission.cpp" />
<ClCompile Include="..\..\src_launch\mccvessel.cpp" />
<ClCompile Include="..\..\src_launch\MCC_Calculations.cpp" />
<ClCompile Include="..\..\src_launch\MCC_Mission_B.cpp" />
<ClCompile Include="..\..\src_launch\MCC_Mission_C.cpp" />
<ClCompile Include="..\..\src_launch\MCC_Mission_C_PRIME.cpp" />
Expand Down Expand Up @@ -203,6 +204,7 @@
<ClInclude Include="..\..\src_aux\Mission.h" />
<ClInclude Include="..\..\src_aux\paCBGmessageID.h" />
<ClInclude Include="..\..\src_launch\mccvessel.h" />
<ClInclude Include="..\..\src_launch\MCC_Calculations.h" />
<ClInclude Include="..\..\src_launch\MCC_Mission_B.h" />
<ClInclude Include="..\..\src_launch\MCC_Mission_C.h" />
<ClInclude Include="..\..\src_launch\MCC_Mission_C_PRIME.h" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@
<ClCompile Include="..\..\src_aux\Mission.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src_launch\MCC_Calculations.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src_launch\mcc.h">
Expand Down Expand Up @@ -275,5 +278,8 @@
<ClInclude Include="..\..\src_aux\Mission.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src_launch\MCC_Calculations.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
3 changes: 2 additions & 1 deletion Orbitersdk/samples/ProjectApollo/src_launch/MCCPADForms.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,8 @@ struct AP10MAPUPDATE
double SSGET2; //Time of sunset for a second rev (type = 3)
double PMGET2; //Time of meridian crossing (150° or 180°W) for a second rev (type = 3)
double AOSGET2; //Time of AOS for a second rev (type = 3) or taking LOI into account (type = 2) or TEI (type = 5)
int type; //0 = Only LOS/AOS and PM, 1 = Display all parameters, 2 = LOS, AOS with and AOS without LOI, 3 = Like 1 but for two revs, 4 = Like 0 but shows 180° instead of PM, 5 = like 2 but for TEI
//0 = Only LOS/AOS and PM, 1 = Display all parameters, 2 = LOS, AOS with and AOS without LOI, 3 = Like 1 but for two revs, 4 = Like 0 but shows 180° instead of PM,
int type; //5 = like 2 but for TEI, 6 = like 0 but shows 150° instead of PM, 7 = LOS, AOS w/ TEI, AOS w/o TEI
};

// APOLLO 11 LANDMARK TRACKING PAD
Expand Down
121 changes: 121 additions & 0 deletions Orbitersdk/samples/ProjectApollo/src_launch/MCC_Calculations.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
/***************************************************************************
This file is part of Project Apollo - NASSP
MCC Calculations
Project Apollo is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Project Apollo is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Project Apollo; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
See http://nassp.sourceforge.net/license/ for more details.
**************************************************************************/

#include "MCC_Calculations.h"
#include "rtcc.h"

MCC_Calculations::MCC_Calculations(RTCC *r) : RTCCModule(r)
{

}

bool MCC_Calculations::CreateEphemeris(EphemerisData sv, double EphemerisLeftLimitGMT, double EphemerisRightLimitGMT, EphemerisDataTable2 &ephem)
{
EMSMISSInputTable in;
PLAWDTOutput weights;

in.AnchorVector = sv;
in.EphemerisLeftLimitGMT = EphemerisLeftLimitGMT;
in.EphemerisRightLimitGMT = EphemerisRightLimitGMT;

in.EphemerisBuildIndicator = true;
if (sv.RBI == BODY_EARTH)
{
in.ECIEphemerisIndicator = true;
in.ECIEphemTableIndicator = &ephem;
}
else
{
in.MCIEphemerisIndicator = true;
in.MCIEphemTableIndicator = &ephem;
}
in.useInputWeights = true;

//TBD
weights.KFactor = 0.0;
weights.CC.set(0);
weights.CSMWeight = 1.0;

in.DensityMultiplier = 0.0;
in.WeightsTable = &weights;
in.VehicleCode = RTCC_MPT_CSM; //Not used

pRTCC->EMSMISS(&in);

ephem.Header.TUP = 1; //Only has to be non-zero

return (in.NIAuxOutputTable.ErrorCode != 0);
}
double MCC_Calculations::EnvironmentChange(EphemerisDataTable2 &ephem, double gmt_estimate, int option, bool present, bool terminator)
{
ManeuverTimesTable MANTIMES;
LunarStayTimesTable LUNRSTAY;
RTCC::EMMENVInputTable in;
RTCC::EMMENVOutputTable out;

in.GMT = gmt_estimate;
in.option = option;
in.present = present;
in.terminator = terminator;

pRTCC->EMMENV(ephem, MANTIMES, &LUNRSTAY, in, out);

return out.T_Change;
}

double MCC_Calculations::Sunrise(EphemerisDataTable2 &ephem, double gmt_estimate)
{
return EnvironmentChange(ephem, gmt_estimate, 0, true, false);
}

double MCC_Calculations::TerminatorRise(EphemerisDataTable2 &ephem, double gmt_estimate)
{
return EnvironmentChange(ephem, gmt_estimate, 0, true, true);
}

bool MCC_Calculations::LongitudeCrossing(EphemerisDataTable2 &ephem, double lng, double gmt_estimate, double &gmt_cross)
{
ManeuverTimesTable MANTIMES;
EphemerisDataTable2 ephem_true;
EphemerisData2 sv;
double dErr;
int in, out, iErr;

gmt_cross = 0.0;

//Convert to ECT or MCT table
ephem_true = ephem;

in = ephem.Header.CSI;
out = in + 1;

iErr = pRTCC->ELVCNV(ephem.table, in, out, ephem_true.table);
if (iErr) return true;

ephem_true.Header.CSI = out;

//Longitude crossing
dErr = pRTCC->RLMTLC(ephem_true, MANTIMES, lng, gmt_estimate, gmt_cross, sv);

return (dErr < 0.0);
}
43 changes: 43 additions & 0 deletions Orbitersdk/samples/ProjectApollo/src_launch/MCC_Calculations.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/***************************************************************************
This file is part of Project Apollo - NASSP
MCC Calculations (Header)
Project Apollo is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Project Apollo is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Project Apollo; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
See http://nassp.sourceforge.net/license/ for more details.
**************************************************************************/

#pragma once

#include "../src_rtccmfd/RTCCModule.h"
#include "../src_rtccmfd/RTCCTables.h"

// A class with utility calculations for the MCC class, with access to the RTCC class
// Anything that does not belong in the RTCC class, because it does not correspond to real RTCC code
// The main purpose of this class is to reduce the complexity of the code required for the mission specific MCC calculations

class MCC_Calculations : public RTCCModule
{
public:
MCC_Calculations(RTCC *r);

bool CreateEphemeris(EphemerisData sv, double EphemerisLeftLimitGMT, double EphemerisRightLimitGMT, EphemerisDataTable2 &ephem);
double EnvironmentChange(EphemerisDataTable2 &ephem, double gmt_estimate, int option, bool present, bool terminator);
double Sunrise(EphemerisDataTable2 &ephem, double gmt_estimate);
double TerminatorRise(EphemerisDataTable2 &ephem, double gmt_estimate);
bool LongitudeCrossing(EphemerisDataTable2 &ephem, double lng, double gmt_estimate, double &gmt_cross);
};
Loading

0 comments on commit 082e59e

Please sign in to comment.