00001 ////////////////////////////////////////////////////////////////////////////////////////////////// 00002 /*! \file OrbitState.h 00003 * \brief Interface to the OrbitState 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_STATE_H__ 00014 #define __SSF_ORBIT_STATE_H__ 00015 00016 #include <orbit/orbitframes/OrbitFrame.h> 00017 #include <orbit/orbitstaterep/OrbitStateRepresentation.h> 00018 00019 namespace O_SESSAME { 00020 00021 /*! \brief Encapsulation of an Orbit State, including its coordinate type and reference frame. 00022 * \ingroup OrbitToolkit 00023 * 00024 * \detail The OrbitState class is an abstract representation of a current orbital state, including 00025 * its position and velocity (in some OrbitStateRepresentation) and respective frame (OrbitFrame). 00026 * Each instance of OrbitState is a snapshot of the spacecraft at an instant in time. 00027 * 00028 * \par Example: 00029 \code 00030 OrbitState myOrbitState; 00031 myOrbitState.SetStateRepresentation(new PositionVelocity); 00032 myOrbitState.SetOrbitFrame(new OrbitFrameIJK); 00033 Vector initPV(6); 00034 // Space station 00035 initPV(VectorIndexBase+0) = -5776.6; // km 00036 initPV(VectorIndexBase+1) = -157; // km 00037 initPV(VectorIndexBase+2) = 3496.9; // km 00038 initPV(VectorIndexBase+3) = -2.595; // km/s 00039 initPV(VectorIndexBase+4) = -5.651; // km/s 00040 initPV(VectorIndexBase+5) = -4.513; // km/s 00041 myOrbitState.SetState(initPV); 00042 \endcode 00043 * 00044 * \todo should OrbitState contain an ssfTime object? 00045 * \todo change to be a template class of the Representation Types 00046 */ 00047 class OrbitState 00048 { 00049 public: 00050 /*! \brief Create an initially empty orbit state object */ 00051 OrbitState(); 00052 /*! \brief Default deconstructor. Deletes any unused variables. */ 00053 virtual ~OrbitState(); 00054 /*! \brief Create an orbit state from a copy of another orbit state. */ 00055 OrbitState(const OrbitState &_OrbStateCopy); 00056 00057 /*! \brief Create an orbit state object from a pointer to an orbit representation (positionVelocity, keplerian, etc), and orbit frame (IJK, PQW, etc.) 00058 * @param _pOrbRep the orbit representation (positionVelocity vector, keplerian elements, etc.) to store in the state. 00059 * @param _pOrbFrame the orbit frame (IJK, SEZ, PQW, etc) that is the reference frame of the representation. 00060 */ 00061 OrbitState(OrbitStateRepresentation* _pOrbRep, OrbitFrame* _pOrbFrame = NULL); 00062 00063 /*! \brief Set (or Change) the stored orbit frame that is the reference for the represenation. 00064 * 00065 * \detail In the future, this will convert the orbit representation from the previous frame (if defined) to the new frame. 00066 * \todo Implement the orbit representation conversion due to an orbit frame change. 00067 * @param _pnewOrbitFrame pointer to the orbit frame to set or convert the orbit representation to. 00068 */ 00069 void SetOrbitFrame(OrbitFrame* _pnewOrbitFrame); 00070 00071 /*! \brief Returns the pointer to the current reference frame of the orbit state. 00072 * @return pointer to the current reference frame 00073 */ 00074 OrbitFrame* GetOrbitFrame() const; 00075 00076 /*! \brief Set (or change) the orbit state's representation. 00077 * @param _pStateRep pointer to the new orbit state representation. 00078 */ 00079 void SetStateRepresentation(OrbitStateRepresentation* _pStateRep); 00080 00081 /*! \brief Set (or change) the orbit state's representation and reference frame. 00082 * @param _pStateRep pointer to the new orbit state representation. 00083 * @param _pOrbFrame pointer to the orbit frame to set or convert the orbit representation to. 00084 */ 00085 void SetStateRepresentation(OrbitStateRepresentation* _pStateRep, OrbitFrame* _pOrbFrame); 00086 00087 /*! \brief Return a pointer to the orbit state's current state representation. 00088 * @return pointer to the current representation (positionVelocity vector, keplerian elements, etc.) 00089 */ 00090 OrbitStateRepresentation* GetStateRepresentation() const; 00091 00092 /*! \brief Calculates the orbit angular momentum at the current orbit state. 00093 * 00094 * \f[ {\bf} h = |{\bf r} \times {\bf v}| \f] 00095 * @return the orbit angular momentum. 00096 */ 00097 double GetOrbitAngularMomentum() const; 00098 00099 /*! \brief internally set the orbit representation's state. 00100 * \warning Depracated - do not use - will be moving to private. 00101 * @param _state Vector of the state components that are the same type of the orbit state representation. 00102 */ 00103 void SetState(const Vector& _state); 00104 00105 /*! \brief internally set the orbit representation's state and reference frame. 00106 * \warning Depracated - do not use - will be moving to private. 00107 * @param _state Vector of the state components that are the same type of the orbit state representation. 00108 * @param _pOrbFrame pointer to the orbit frame to set or convert the orbit representation to. 00109 */ 00110 void SetState(const Vector& _state, OrbitFrame* _pOrbFrame); 00111 00112 /*! \brief internally return the orbit representation's state Vector. 00113 * \warning Depracated - do not use - will be moving to private. 00114 * @return Vector of the state components that are the same type of the orbit state representation. 00115 */ 00116 Vector GetState() const; 00117 00118 /*! \brief Copy an instance of OrbitState. 00119 * @param _OrbStateCopy right operand that is the original orbit state to be copied. 00120 * @return a copy of the orbit state. 00121 */ 00122 OrbitState operator= (const OrbitState& _OrbStateCopy); 00123 private: 00124 /*! \brief internal pointer to the current orbit state representation */ 00125 OrbitStateRepresentation* m_pOrbitStateRepresentation; 00126 /*! \brief internal pointer to the current orbit state reference frame */ 00127 OrbitFrame* m_pOrbitFrame; 00128 }; 00129 00130 /* Possibility of turning into a template class 00131 OrbitState<PositionVelocity, OrbFrameIJK> initialOrbit1; 00132 OrbitState<Keplerian, OrbFrameSEZ> initialOrbit1.ChangeType(); 00133 vs. 00134 OrbitState initOrb1(POSITION_VELOCITY, ORBFRAME_IJK); 00135 initOrb1.ChangeType(KEPLERIAN); 00136 initOrb1.GetKeplerianElements(); 00137 00138 template <TOrbRep, TOrbFrame> 00139 class OrbitState 00140 { 00141 public: 00142 OrbitState(); 00143 virtual ~OrbitState(); 00144 OrbitState(const Vector& _State); 00145 00146 // void SetOrbitFrame(const TOrbFrame &_newOrbitFrame); 00147 const TOrbFrame& GetOrbitFrame() const; 00148 00149 // void SetStateRepresentation(const TOrbRep &_StateRep); 00150 // void SetStateRepresentation(const TOrbRep &_StateRep, const TOrbFrame &_orbFrame); 00151 const TOrbRep& GetStateRepresentation() const; 00152 00153 void SetState(const Vector &_state); 00154 const Vector& GetState() const; 00155 00156 private: 00157 TOrbRep m_OrbitStateRepresentation; 00158 TOrbFrame m_OrbitFrame; 00159 00160 }; 00161 */ 00162 } // close namespace O_SESSAME 00163 00164 #endif 00165 00166 // Do not change the comments below - they will be added automatically by CVS 00167 /***************************************************************************** 00168 * $Log: OrbitState.h,v $ 00169 * Revision 1.2 2005/06/10 12:53:28 jayhawk_hokie 00170 * 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). 00171 * 00172 * Revision 1.1.1.1 2005/04/26 17:40:59 cakinli 00173 * Adding OpenSESSAME to DSACSS distrib to capture fixed version. 00174 * 00175 * Revision 1.10 2003/10/18 21:37:28 rsharo 00176 * Removed "../utils" from all qmake project paths. Prepended "utils 00177 * /" to all #include directives for utils. Removed ".h" extensions from STL header 00178 * s and referenced STL components from "std::" namespace. Overall, changed to be 00179 * more portable. 00180 * 00181 * Revision 1.9 2003/06/12 23:08:20 nilspace 00182 * Fixed to calculate angular momentum. 00183 * 00184 * Revision 1.8 2003/06/12 18:02:15 nilspace 00185 * Added GetAngularVelocity() function. 00186 * 00187 * Revision 1.7 2003/05/22 14:33:58 nilspace 00188 * Added NULL default value to constructor. 00189 * 00190 * Revision 1.6 2003/05/13 18:46:29 nilspace 00191 * Checked pointers if they were initialized before calling. 00192 * 00193 * Revision 1.5 2003/05/02 16:16:46 nilspace 00194 * Documented the API. 00195 * 00196 * Revision 1.4 2003/04/29 20:56:25 nilspace 00197 * Update to work with Propagator. 00198 * 00199 * Revision 1.3 2003/04/29 18:47:31 nilspace 00200 * Added copy constructor and operator= functions. 00201 * 00202 * Revision 1.2 2003/04/23 16:26:02 nilspace 00203 * Updated directory structure & default parameters. 00204 * 00205 * Revision 1.1 2003/04/08 22:47:00 nilspace 00206 * Initial Submission. 00207 * 00208 * 00209 * 00210 ******************************************************************************/