00001 ////////////////////////////////////////////////////////////////////////////////////////////////// 00002 /*! \file OrbitHistory.h 00003 * \brief Interface to the Orbit History 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 #ifndef __ORBIT_HISTORY_H__ 00013 #define __ORBIT_HISTORY_H__ 00014 00015 #include <matrix/Matrix.h> 00016 #include <rotation/Rotation.h> 00017 #include <datahandling/History.h> 00018 #include <orbit/OrbitState.h> 00019 #include <orbit/orbitstaterep/PositionVelocity.h> 00020 #include <vector> 00021 using namespace std; 00022 namespace O_SESSAME { 00023 00024 /*! \brief Class for storing a time history of orbital states. 00025 * \ingroup StateHistory 00026 * 00027 * The OrbitHistory class provides a container of previous OrbitState objects. The user 00028 * may append new states, reset the collection of states, or return the orbit history 00029 * in a matrix. If the user appends orbit states at time which earlier than the end 00030 * of the current history, the current history is deleted from that point on, and the 00031 * new orbit states are appended. 00032 * 00033 * \par Examples: 00034 \code 00035 OrbitState myOrbitState; 00036 myOrbitState.SetStateRepresentation(new PositionVelocity); 00037 myOrbitState.SetOrbitFrame(new OrbitFrameIJK); 00038 Vector initPV(6); 00039 myOrbitState.SetState(initPV); 00040 myOrbit->SetStateObject(myOrbitState); 00041 00042 OrbitHistory myOrbitHistory; // create an orbit history with an empty collection 00043 myOrbitHistory.AppendHistory(0, myOrbitState); // add the state myOrbitState which occured at t=0 to the history 00044 00045 cout << myOrbitHistory.GetHistory() << endl; // Get a matrix of the stored state and output 00046 // [t0, orbit elements @ t=0] 00047 // [t1, orbit elements @ t=1] 00048 // [t2, orbit elements @ t=2] etc... 00049 \endcode 00050 */ 00051 class OrbitHistory : public History 00052 { 00053 public: 00054 /*! \brief Default Constructor 00055 */ 00056 OrbitHistory(); 00057 00058 /*! \brief Add the orbit state that occured at a time in seconds to the history. 00059 * 00060 * Appends the state at t=_appendTime. if the new state 00061 * occured at a time that is earlier than any of the stored values 00062 * then the time history will be erased from the overlap point 00063 * and the new state will be appended. 00064 * @param _appendTime time (in seconds) to be added. 00065 * @param _appendOrbitState the new orbital state to be added. 00066 */ 00067 void AppendHistory(const double &_appendTime, const OrbitState &_appendOrbitState); 00068 00069 /*! \brief Add the orbit state that occured with an ssfTime object to the history. 00070 * 00071 * Appends the state at t=_appendTime. if the new state 00072 * occured at a time that is earlier than any of the stored values 00073 * then the time history will be erased from the overlap point 00074 * and the new state will be appended. 00075 * @param _appendTime the ssfTime object specifying when the state occured. 00076 * @param _appendOrbitState the new orbital state to be added. 00077 */ 00078 void AppendHistory(const ssfTime &_appendTime, const OrbitState &_appendOrbitState); 00079 00080 /*! \brief Add a vector of ssfTime and OrbitState objects to the stored history. 00081 * 00082 * if the beginning of the new state vector occured earlier than 00083 * any of the stored values then the orbit history will be erased 00084 * from the overlap point and the new orbit state vector will be appended. 00085 * @param _appendTime vector of ssfTime objects to be appended. 00086 * @param _appendOrbitState vector of OrbitState objects to be appended. 00087 */ 00088 void AppendHistory(const vector<ssfTime> &_appendTime, const vector<OrbitState> &_appendOrbitState); 00089 00090 /*! \brief Erases the orbit state history */ 00091 void ResetHistory(); 00092 00093 /*! \brief Returns a matrix of the orbit state history 00094 * 00095 * returns the matrix of the form: // Get a matrix of the stored state and output 00096 // [t0, orbit elements @ t=0] 00097 // [t1, orbit elements @ t=1] 00098 // [t2, orbit elements @ t=2] etc... 00099 * @return nxm matrix of the state history, where n is the number of time states stored and m is the number of elements in the OrbitStateRepresentation. 00100 */ 00101 Matrix GetHistory(); 00102 00103 /*! \brief Returns the Orbit state at the requested time. 00104 * \warning Always interpolates using position \& velocity. 00105 * 00106 * May require interpolation (see Interpolator). 00107 * @param _requestedTime requested state time. If it is not an integrated mesh point, interpolation will be used to determine the approximated value. 00108 * The _requestedTime may be different due to errors (outside state bounds, uncalculable interpolation). 00109 * @param _returnOrbitState the orbital state at the requested time (the requested time @em may be different due to errors) 00110 */ 00111 void GetState(const ssfTime& _requestedTime, OrbitState& _returnOrbitState); 00112 00113 /*! \brief Returns the Orbit state at the requested time. 00114 * \warning Always interpolates using position \& velocity. 00115 * 00116 * Performs the same functionality as GetState(ssfTime& _requestedTime, OrbitState& _returnOrbitState), but returns the orbit state from the 00117 * function rather than by reference. 00118 * @param _requestedTime requested state time. If it is not an integrated mesh point, interpolation will be used to determine the approximated value. 00119 * The _requestedTime may be different due to errors (outside state bounds, uncalculable interpolation). 00120 * @return the orbital state at the requested time (the requested time @em may be different due to errors) 00121 */ 00122 OrbitState GetState(const ssfTime& _requestedTime); 00123 private: 00124 /*! \brief internal vector container of the OrbitState objects describing the state history */ 00125 vector<OrbitState> m_OrbitHistory; 00126 /*! \brief internal vector of orbit interpolations */ 00127 vector<Interpolator*> m_OrbitInterpolations; 00128 }; 00129 } // close namespace O_SESSAME 00130 00131 #endif 00132 00133 00134 // Do not change the comments below - they will be added automatically by CVS 00135 /***************************************************************************** 00136 * $Log: OrbitHistory.h,v $ 00137 * Revision 1.2 2005/06/10 12:53:28 jayhawk_hokie 00138 * 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). 00139 * 00140 * Revision 1.1.1.1 2005/04/26 17:40:56 cakinli 00141 * Adding OpenSESSAME to DSACSS distrib to capture fixed version. 00142 * 00143 * Revision 1.7 2003/05/22 21:01:31 nilspace 00144 * Updated comments and added SetOrbitRepresentation(new PositionVelocity). 00145 * 00146 * Revision 1.6 2003/05/20 17:50:01 nilspace 00147 * Updated comments. 00148 * 00149 * Revision 1.5 2003/05/13 18:45:35 nilspace 00150 * Added interpolation functionality. 00151 * 00152 * Revision 1.4 2003/05/01 23:59:48 nilspace 00153 * Commented the API. 00154 * 00155 * Revision 1.3 2003/04/27 22:04:33 nilspace 00156 * Created the namespace O_SESSAME. 00157 * 00158 * Revision 1.2 2003/04/25 17:15:00 nilspace 00159 * Added OrbitHistory & made sure it builds. 00160 * Moved Appending time to History.cpp. 00161 * 00162 * Revision 1.1 2003/04/25 13:39:09 nilspace 00163 * Initial Submission. 00164 * 00165 * Revision 1.1 2003/03/27 20:29:20 nilspace 00166 * Initial Submission. 00167 * 00168 ******************************************************************************/