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