-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1252 from indy91/Apollo10MCC
Apollo 10 MCC Updates
- Loading branch information
Showing
12 changed files
with
566 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
Orbitersdk/samples/ProjectApollo/src_launch/MCC_Calculations.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
43
Orbitersdk/samples/ProjectApollo/src_launch/MCC_Calculations.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}; |
Oops, something went wrong.