00001 ////////////////////////////////////////////////////////////////////////////////////////////////// 00002 /*! \file Orbit.h 00003 * \brief Implementation of the Orbit Class. 00004 * \author $Author: jayhawk_hokie $ 00005 * \version $Revision: 1.2 $ 00006 * \date $Date: 2005/06/10 12:53:28 $ 00007 *////////////////////////////////////////////////////////////////////////////////////////////////// 00008 /* 00009 * 00010 */ 00011 ////////////////////////////////////////////////////////////////////////////////////////////////// 00012 00013 #ifndef __SSF_ORBIT_H__ 00014 #define __SSF_ORBIT_H__ 00015 00016 #include <utils/Functor.h> 00017 #include <environment/Environment.h> 00018 #include <dynamics/Propagator.h> 00019 #include <orbit/OrbitState.h> 00020 #include <datahandling/OrbitHistory.h> 00021 00022 00023 namespace O_SESSAME { 00024 class Propagator; // forward declaration 00025 00026 /*! \brief Defined function pointer to integrated orbital state conversion function. 00027 * \ingroup PropagatorToolkit 00028 * 00029 * Converts a vector of meshpoints (from integrated states) to the corresponding generalized OrbitState. 00030 * @param _meshPoint vector of values of the meshpoint to be converted 00031 * @param _convertedOrbitState Calculated Orbit state from the converted meshpoint that is returned to the caller. 00032 */ 00033 typedef void (*IntegratedOrbitStateConversionFunction)(const Matrix &_meshPoint, OrbitState &_convertedOrbitState); 00034 00035 00036 ////////////////////////////////////////////////////////////////////////////////////////////////// 00037 /*! @defgroup OrbitToolkit Orbit Toolkit 00038 * 00039 * Collection of orbit analysis and simulation tools. 00040 * @{ 00041 */ 00042 00043 /*! @defgroup OrbitEquationsOfMotion Orbit Equations of Motion 00044 * @ingroup OrbitToolkit 00045 * 00046 */ 00047 00048 /*! \brief Complete representation of a spacecraft orbt. 00049 * 00050 * The Orbit class is a composition of all the information that is part of a spacecraft orbit. This includes 00051 the dynamic equations, disturbance force functions, environmen objects, state history and control forces. 00052 */ 00053 00054 /** \example testOrbitIntegration.cpp 00055 * \example testPropagation.cpp 00056 */ 00057 class Orbit 00058 { 00059 public: 00060 /*! Default Constructor */ 00061 Orbit(); 00062 /*! Default Deconstructor */ 00063 virtual ~Orbit(); 00064 00065 public: 00066 /*! \brief Set the current orbit state object that represents the spacecraft's position in space. 00067 * @param _currentOrbitPosition Current orbital state of the spacecraft. 00068 */ 00069 void SetStateObject(const OrbitState& _currentOrbitPosition); 00070 00071 /*! \brief Return the current orbital state of the spacecraft. 00072 * @return Current stored orbital state of the spacecraft. 00073 */ 00074 OrbitState GetStateObject() const; 00075 00076 protected: 00077 /*! \brief Current stored orbital state of the spacecraft. */ 00078 OrbitState m_CurrentOrbitPosition; 00079 00080 00081 // ***************************** 00082 // ******** PROPAGATION ******** 00083 // ***************************** 00084 public: 00085 /*! \brief Set the Dynamics Equation right-hand side file 00086 * @param _orbitDynamicsEq pointer to the right-hand side dynamics equation 00087 */ 00088 void SetDynamicsEq(odeFunctor _orbitDynamicsEq); 00089 00090 /*! \brief Return the pointer to the Dynamics Equation right-hand side 00091 * @return pointer to the right-hand side dynamics equation 00092 */ 00093 odeFunctor GetDynamicsEq(); 00094 00095 /*! \brief Set the Orbit state conversion function. 00096 * @param _ConversionFunction pointer to the conversion function (takes a meshpoint and returns an object of OrbitState). 00097 */ 00098 void SetStateConversion(IntegratedOrbitStateConversionFunction _ConversionFunction); 00099 00100 /*! \brief Get the Orbit state conversion function. 00101 * @return pointer to the conversion function (takes a meshpoint and returns an object of OrbitState). 00102 */ 00103 IntegratedOrbitStateConversionFunction GetStateConversion() const; 00104 00105 /*! \brief Sets the propagator used for integrating the orbit. 00106 * @param _pPropagator Pointer to the propagator to be used. 00107 */ 00108 void SetPropagator(Propagator *_pPropagator); 00109 00110 /*! \brief Returns the pointer to the propagator being used. 00111 * @return pointer to the orbit's propagator. 00112 */ 00113 Propagator* GetPropagator(); 00114 00115 /*! \brief Propagate the orbit through the vector of times. 00116 */ 00117 void Propagate(const Vector &_propTime); 00118 00119 /*! \brief Returns whether the orbit is integrateable or not. 00120 * Determined if there is a dynamics equation present. 00121 * @return true if the orbit can be integrated, false if it can't. 00122 */ 00123 bool IsIntegrateable(); 00124 00125 private: 00126 /*! \brief Internal pointer to the current orbit propagator algorithm */ 00127 Propagator *m_pPropagator; 00128 00129 /*! Conversion function for converting from the integrated states to an Orbit State. */ 00130 IntegratedOrbitStateConversionFunction m_OrbitStateConversionFunction; 00131 00132 /*! \brief Right-hand side of the orbit dynamics equation: \f$\dot{x} = RHS(t, x)\f$ */ 00133 odeFunctor m_OrbitDynamicsEq; 00134 00135 /*! \brief Is the orbit integrateable? (true if it is, false if is not) */ 00136 bool m_Integrateable; 00137 00138 // ***************************** 00139 // ********* Physical ********** 00140 // ***************************** 00141 public: 00142 /*! \brief Set the physical parameters of the spacecraft orbit 00143 * 00144 * \todo determine what physical parameters are pertinent. 00145 */ 00146 void SetParameters(const Matrix &_Parameters); 00147 00148 /*! \brief Return a matrix of the current stored spacecraft orbital parameters. 00149 * 00150 */ 00151 Matrix GetParameters() const; 00152 00153 private: 00154 Matrix m_Parameters; 00155 00156 // ***************************** 00157 // ******** ENVIRONMENT ******** 00158 // ***************************** 00159 public: 00160 /*! \brief Sets the environment used for integrating the orbit. 00161 * @param _pEnvironment Instance of the environment to be used. 00162 */ 00163 void SetEnvironment(Environment *_pEnvironment); 00164 00165 /*! \brief Returns the environment used for integrating the orbit. 00166 * @return pointer to the instance of the environment being used. 00167 */ 00168 Environment* GetEnvironment(); 00169 00170 00171 void SetControlForces(const Vector &_controlForces); 00172 Vector GetControlForces(); 00173 00174 /*! \brief Return a reference to the environmental forces function. 00175 * @return the Functor that references the Environment force function of the orbit. Used as a 00176 * callback function for evaluating the forces on the spacecraft orbit due to 00177 * specified environmental disturbances. 00178 */ 00179 ObjectFunctor<Environment> GetEnvironmentForcesFunctor(); 00180 private: 00181 /*! \brief Internal pointer to the orbit's environment object. */ 00182 Environment *m_pEnvironment; 00183 /*! \brief Internal Vector of the current control forces being applied to the spacecraft. */ 00184 Vector m_ControlForces; 00185 00186 /*! Pointer to the Environment forces function */ 00187 ObjectFunctor<Environment> m_EnvironmentForcesFunctor; 00188 00189 // ************************* 00190 // ******** HISTORY ******** 00191 // ************************* 00192 public: 00193 /*! \brief Return a reference to the spacecraft's orbit history. 00194 * 00195 * This function is used to make evaluations on the spacecraft's orbit history. 00196 * \code 00197 * // Get the orbit state at t=30 seconds. 00198 * OrbitState OrbState30 = myOrbit.GetHistoryObject().GetState(ssfTime(30)); 00199 * \endcode 00200 * @return reference (acts as a normal object, but actually "points" to the private data member) 00201 * to the spacecraft's orbit history object. 00202 */ 00203 OrbitHistory& GetHistoryObject(); 00204 00205 private: 00206 OrbitHistory m_OrbitHistory; 00207 00208 }; 00209 /** @} */ // End of OrbitToolkit Group 00210 00211 } // close namespace O_SESSAME 00212 #endif 00213 00214 // Do not change the comments below - they will be added automatically by CVS 00215 /***************************************************************************** 00216 * $Log: Orbit.h,v $ 00217 * Revision 1.2 2005/06/10 12:53:28 jayhawk_hokie 00218 * Changed header file format to make it easier to link to the spacecraft code by only having to specify dsacss/dep/spacecraft/src (ex. "file.h" changed to <dir/file.h> where dir is a folder in src). 00219 * 00220 * Revision 1.1.1.1 2005/04/26 17:40:59 cakinli 00221 * Adding OpenSESSAME to DSACSS distrib to capture fixed version. 00222 * 00223 * Revision 1.10 2003/10/18 21:37:28 rsharo 00224 * Removed "../utils" from all qmake project paths. Prepended "utils 00225 * /" to all #include directives for utils. Removed ".h" extensions from STL header 00226 * s and referenced STL components from "std::" namespace. Overall, changed to be 00227 * more portable. 00228 * 00229 * Revision 1.9 2003/06/10 14:52:05 nilspace 00230 * Changed GetHistory to GetHistoryObject 00231 * 00232 * Revision 1.8 2003/05/20 17:47:59 nilspace 00233 * Updated comments. 00234 * 00235 * Revision 1.7 2003/05/02 16:16:46 nilspace 00236 * Documented the API. 00237 * 00238 * Revision 1.6 2003/04/28 20:13:18 nilspace 00239 * GetHistory return by reference. 00240 * 00241 * Revision 1.5 2003/04/27 22:04:33 nilspace 00242 * Created the namespace O_SESSAME. 00243 * 00244 * Revision 1.4 2003/04/27 21:17:42 nilspace 00245 * Finished moving function declarations out of the class interface. 00246 * 00247 * Revision 1.3 2003/04/27 21:14:01 nilspace 00248 * Added to the namespace O_SESSAME. 00249 * Moved function definitions outside of the class interface definition. 00250 * 00251 * Revision 1.2 2003/04/25 13:36:28 nilspace 00252 * Updated to work with current History, Environment & Propagator objects. 00253 * 00254 * Revision 1.1 2003/04/08 22:48:59 nilspace 00255 * Initial Submission. 00256 * 00257 ******************************************************************************/