Keplerian.h

Go to the documentation of this file.
00001 
00002 
00008 /* 
00009 * \todo include conversion functions
00010 */
00012 
00013 #ifndef __SSF_KEPLERIAN_H__
00014 #define __SSF_KEPLERIAN_H__
00015 #include "Matrix.h"
00016 #include "OrbitStateRepresentation.h"
00017 #include <string>
00018 #include <stdlib.h>
00019 #include <sstream>
00020 using namespace std;
00021 
00022 #define MU 1    // not a good value for MU.
00023 #ifndef PI
00024 #include <math.h>
00025 #define PI M_PI
00026 #endif
00027 namespace O_SESSAME {
00028 
00030 #define NUM_KEPLERIAN_ELEMENTS 6 
00031 const int SEMIMAJOR_AXIS = VectorIndexBase + 0; 
00032 const int ECCENTRICITY  = VectorIndexBase + 1; 
00033 const int INCLINATION   = VectorIndexBase + 2; 
00034 const int LONG_ASC_NODE = VectorIndexBase + 3; 
00035 const int ARG_PERIGEE   = VectorIndexBase + 4; 
00036 const int TRUE_ANOMALY  = VectorIndexBase + 5; 
00039 typedef struct tleStruct {
00040         string  satName;                                
00041         int             satNumber;                              
00042         char    satClassification;              
00043         int             launchYear;                             
00044         int             launchNumber;                   
00045         string  launchPiece;                    
00046         int             epochYear;                              
00047         double  epochDay;                               
00048         double  meanmotion1stDeriv;             
00049         double  meanmotion2ndDeriv;             
00050         double  bstarDrag;                              
00051         int             ephemerisType;                  
00052         int             elementNumber;                  
00053         int             checksumLine1;                  
00054         double  meanAnomaly;                    
00055         double  eccentricAnomaly;               
00056         double  meanMotion;                             
00057         int             revolutionNumber;               
00058         int             checksumLine2;                  
00059 };
00060 
00061                 
00062                 
00071 class Keplerian : public OrbitStateRepresentation
00072 {
00073 public:
00074     
00075     virtual ~Keplerian();
00076 
00077         virtual Keplerian* NewPointer();
00078 
00079     virtual Keplerian* Clone();
00080 
00081         Keplerian();
00082     
00083     Keplerian(const Vector& _Elements);
00084 
00085     void SetPositionVelocity(const Vector& _Position, const Vector& _Velocity);
00086 
00087     void SetPositionVelocity(const Vector& _PositionVelocity);
00088 
00089         void SetPositionVelocity(const Vector& _Position, const Vector& _Velocity, const OrbitFrame& _OrbFrame);
00090     
00091     void SetPositionVelocity(const Vector& _PositionVelocity, const OrbitFrame& _OrbFrame);
00092 
00093     Vector GetPositionVelocity() const;
00094 
00095     Vector GetPositionVelocity(const OrbitFrame& _TargetOrbFrame) const;
00096 
00097     void GetPositionVelocity(Vector& _Position, Vector& _Velocity) const;
00098   
00099     void GetPositionVelocity(Vector& _Position, Vector& _Velocity, const OrbitFrame& _TargetOrbFrame) const;
00100 
00101         double GetEccentricAnomalyFromMeanAnomaly(const double& _MeanAnomaly);
00102         
00103         void GetTrueAnomalyFromEccentricAnomaly(const double& _EccentricAnomaly);
00104         
00105         tleStruct ReadTwoLineElementSet(const string& _TwoLineElementSet);
00106 
00107 
00108 
00109 /* ********* KEPLERIAN SPECIFIC FUNCTIONS ********* */    
00110 
00119     inline double GetSemiParameter() const {return GetSemimajorAxis() * (1 - pow(GetEccentricity(),2));};
00120 
00122     inline double GetSemimajorAxis() const {return m_OrbitalElements(SEMIMAJOR_AXIS);};
00123 
00125     inline double GetEccentricity() const {return m_OrbitalElements(ECCENTRICITY);};
00126 
00128     inline double GetInclination() const {return m_OrbitalElements(INCLINATION);};
00129 
00131     inline double GetLongAscNode() const {return m_OrbitalElements(LONG_ASC_NODE);};
00132 
00134     inline double GetArgPerigee() const  {return m_OrbitalElements(ARG_PERIGEE);};
00135 
00137     inline double GetTrueAnomaly() const {return m_OrbitalElements(TRUE_ANOMALY);};
00138 
00140     inline double GetMeanMotion() const  {return sqrt(MU/pow(GetSemimajorAxis(),3));};
00141 
00144 /* ********* ********* ******** ********* ********* */    
00145         
00146         
00147         
00148         
00149         
00150 /* ********* DEPRECATED FUNCTIONS ********* */    
00151 
00152     virtual void SetState(const Vector& _Elements);
00153 
00154     virtual Vector GetState() const;
00155         
00156     virtual void GetState(Vector& _Elements) const;
00157         
00158 /* ********* ********** ********* ********* */          
00159 
00160         
00161 
00162 private:
00164     Vector m_OrbitalElements;
00165 
00167         tleStruct m_tleData;
00168 };
00169 } // close namespace O_SESSAME
00170 
00171 #endif
00172 
00173 // Do not change the comments below - they will be added automatically by CVS
00174 /*****************************************************************************
00175 *       $Log: Keplerian.h,v $
00176 *       Revision 1.11  2003/05/23 19:28:14  simpliciter
00177 *       Moved comments to implementation file, basic housekeeping.
00178 *       
00179 *       Revision 1.10  2003/05/20 20:49:42  simpliciter
00180 *       Added new functions for parsing TLEs:
00181 *         - GetEccentricAnomalyFromMeanAnomaly,
00182 *         - GetTrueAnomalyFromEccentricAnomaly,
00183 *         - ReadTwoLineElementSet.
00184 *       
00185 *       Revision 1.9  2003/05/13 18:47:56  nilspace
00186 *       Fixed comments for better formatting.
00187 *       
00188 *       Revision 1.8  2003/05/05 20:46:38  nilspace
00189 *       Added inertial Get/SetPositionVelocity to conform to new OrbitStateRepresentation abstract class.
00190 *       
00191 *       Revision 1.7  2003/05/02 16:16:46  nilspace
00192 *       Documented the API.
00193 *       
00194 *       Revision 1.6  2003/04/29 18:48:30  nilspace
00195 *       Added NewPointer and Clone functions to help in getting the correct memory allocation.
00196 *       
00197 *       Revision 1.5  2003/04/24 21:14:23  nilspace
00198 *       const'd all Get() functions.
00199 *       
00200 *       Revision 1.4  2003/04/24 20:10:47  nilspace
00201 *       const'd all Get() functions.
00202 *       
00203 *       Revision 1.3  2003/04/23 18:52:29  nilspace
00204 *       Updated to call correct OrbitFrame::GetRotation calls.
00205 *       Added temporary PI and MU values.
00206 *       Added K_Vector Values.
00207 *       
00208 *       Revision 1.2  2003/04/22 18:06:08  nilspace
00209 *       Added math for Matthew Berry.
00210 *       
00211 *       Revision 1.1  2003/04/08 22:47:35  nilspace
00212 *       Initial Submission.
00213 *
00214 ******************************************************************************/

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