00001
00002
00008
00009
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
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
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 }
00170
00171 #endif
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214