AttitudeNumericPropagator.cpp

Go to the documentation of this file.
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     // Propagate the orbit & attitude, store in the matrix of integration meshpoints
00035     m_OrbitStateMeshPoints = PropagateOrbit(_propTime, _orbitInitConditions);
00036     m_AttitudeStateMeshPoints = PropagateAttitude(_propTime, _attInitConditions);
00037     
00038     // Create temporary orbit & attitude that have the same types (copy of) the current state objects
00039         // the actual state vectors will be replaced, but we need to make sure to have the same representation & frame types
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     // Convert the meshpoints to stored objects and append them to the appropriate history.
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     // Store the new histories to the orbit & attitude objects
00058     if(m_pOrbitObject)
00059         m_pOrbitObject->GetHistory().AppendHistory(timeVector, orbitVector);
00060     if(m_pAttitudeObject)
00061         m_pAttitudeObject->GetHistory().AppendHistory(timeVector, attitudeVector);
00062         
00063     // Set the stored Attitude & Orbit
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 } // close namespace O_SESSAME
00128 
00129 // Do not change the comments below - they will be added automatically by CVS
00130 /*****************************************************************************
00131 *       $Log: NumericPropagator.cpp,v $
00132 *       Revision 1.7  2003/05/13 18:54:04  nilspace
00133 *       Fixed comments & various propagate functions.
00134 *       
00135 *       Revision 1.6  2003/04/30 14:45:35  nilspace
00136 *       Set the OrbitStateObject() and AttitudeStateObject() in the Propagate() function.
00137 *       
00138 *       Revision 1.5  2003/04/29 20:56:03  nilspace
00139 *       Updated to work.
00140 *       
00141 *       Revision 1.4  2003/04/27 22:04:33  nilspace
00142 *       Created the namespace O_SESSAME.
00143 *       
00144 *       Revision 1.3  2003/04/25 13:43:52  nilspace
00145 *       Updated to actually work. Still needs verification.
00146 *       
00147 *       Revision 1.1  2003/04/08 22:49:56  nilspace
00148 *       Initial Submission.
00149 *
00150 ******************************************************************************/

Generated on Wed Aug 6 12:58:42 2003 for Open-Sessame Framework by doxygen1.3