00001
00002
00008
00009
00010
00012
00013 #include "CombinedNumericPropagator.h"
00014 namespace O_SESSAME {
00015
00016 CombinedNumericPropagator::CombinedNumericPropagator()
00017 {
00018
00019 }
00020
00021 CombinedNumericPropagator::~CombinedNumericPropagator()
00022 {
00024 if(m_pOrbitIntegrator)
00025 delete m_pOrbitIntegrator;
00026 if(m_pAttitudeIntegrator)
00027 delete m_pAttitudeIntegrator;
00028 }
00029
00030 void CombinedNumericPropagator::Propagate(const vector<ssfTime> &_propTime, const Vector &_orbitInitConditions, const Vector &_attInitConditions)
00031 {
00034
00035
00036
00037
00038 if(m_pOrbitObject)
00039 if (m_pOrbitObject->IsIntegrateable())
00040 PropagateOrbit(_propTime, _orbitInitConditions);
00041 if(m_pAttitudeObject)
00042 if (m_pAttitudeObject->IsIntegrateable())
00043 PropagateAttitude(_propTime, _attInitConditions);
00044
00045 return;
00046 }
00047
00048 Matrix CombinedNumericPropagator::PropagateOrbit(const vector<ssfTime> &_propTime, const Vector &_initConditions)
00049 {
00050
00051
00052
00053 static OrbitState tempOrbit = m_pOrbitObject->GetStateObject();
00054 static vector<ssfTime> timeVector; timeVector.clear();
00055 static vector<OrbitState> orbitVector; orbitVector.clear();
00056
00059 m_OrbitStateMeshPoints.initialize(m_pOrbitIntegrator->Integrate(
00060 _propTime,
00061 m_pOrbitObject->GetDynamicsEq(),
00062 _initConditions,
00063 m_pOrbitObject,
00064 m_pAttitudeObject,
00065 m_pOrbitObject->GetParameters(),
00066 m_pOrbitObject->GetEnvironmentForcesFunctor()
00067 ));
00069
00070 for (int ii = MatrixIndexBase; ii < m_OrbitStateMeshPoints[MatrixRowsIndex].getIndexBound() + MatrixIndexBase; ++ii)
00071 {
00072 (m_pOrbitObject->GetStateConversion())(m_OrbitStateMeshPoints(ii,_(MatrixIndexBase+1,m_OrbitStateMeshPoints[MatrixColsIndex].getIndexBound())), tempOrbit);
00073 timeVector.push_back(ssfTime(m_OrbitStateMeshPoints(ii,MatrixIndexBase)));
00074 orbitVector.push_back(tempOrbit);
00075 }
00076
00077
00078 if(m_pOrbitObject)
00079 m_pOrbitObject->GetHistoryObject().AppendHistory(timeVector, orbitVector);
00080
00081
00083 m_pOrbitObject->SetStateObject(tempOrbit);
00084
00085 return m_OrbitStateMeshPoints;
00086 }
00087
00088 Matrix CombinedNumericPropagator::PropagateAttitude(const vector<ssfTime> &_propTime, const Vector &_initConditions)
00089 {
00090
00091
00092
00093 static AttitudeState tempAttitude = m_pAttitudeObject->GetStateObject();
00094 static vector<ssfTime> timeVector; timeVector.clear();
00095 static vector<AttitudeState> attitudeVector; attitudeVector.clear();
00096
00097 static OrbitState tempOrbit = m_pOrbitObject->GetStateObject();
00098
00099 m_AttitudeStateMeshPoints.initialize(m_pAttitudeIntegrator->Integrate(
00100 _propTime,
00101 m_pAttitudeObject->GetDynamicsEq(),
00102 _initConditions,
00103 m_pOrbitObject,
00104 m_pAttitudeObject,
00105 m_pAttitudeObject->GetParameters(),
00106 m_pAttitudeObject->GetEnvironmentForcesFunctor()
00107 ));
00108
00110
00111 for (int ii = MatrixIndexBase; ii < m_AttitudeStateMeshPoints[MatrixRowsIndex].getIndexBound() + MatrixIndexBase; ++ii)
00112 {
00113 (m_pAttitudeObject->GetStateConversion())(m_AttitudeStateMeshPoints(ii,_(MatrixIndexBase+1,m_AttitudeStateMeshPoints[MatrixColsIndex].getIndexBound())), tempAttitude);
00114 timeVector.push_back(ssfTime(m_AttitudeStateMeshPoints(ii,MatrixIndexBase)));
00115 attitudeVector.push_back(tempAttitude);
00116 }
00117
00118
00119 m_pAttitudeObject->GetHistoryObject().AppendHistory(timeVector, attitudeVector);
00120
00121
00122 m_pAttitudeObject->SetStateObject(tempAttitude);
00123
00124 return m_AttitudeStateMeshPoints;
00125 }
00126
00127 void CombinedNumericPropagator::SetOrbitIntegrator(Integrator* _pOrbitIntegrator)
00128 {
00129 m_pOrbitIntegrator = _pOrbitIntegrator;
00130 return;
00131 }
00132 void CombinedNumericPropagator::SetAttitudeIntegrator(Integrator* _pAttitudeIntegrator)
00133 {
00134 m_pAttitudeIntegrator = _pAttitudeIntegrator;
00135 return;
00136 }
00137 Integrator* CombinedNumericPropagator::GetOrbitIntegrator() const
00138 {
00139 return m_pOrbitIntegrator;
00140 }
00141 Integrator* CombinedNumericPropagator::GetAttitudeIntegrator() const
00142 {
00143 return m_pAttitudeIntegrator;
00144 }
00145 }
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166