From eea38304c1af3b1501d5514b481a135357b1d267 Mon Sep 17 00:00:00 2001 From: Daniel Warner Date: Thu, 24 Mar 2011 15:55:10 +0000 Subject: [PATCH] Initial commit --- .hgignore | 3 + Coord.cpp | 6 ++ Coord.h | 123 +++++++++++++++++++++ Globals.cpp | 23 ++++ Globals.h | 124 +++++++++++++++++++++ Julian.cpp | 232 ++++++++++++++++++++++++++++++++++++++++ Julian.h | 87 +++++++++++++++ Rewrite.vcxproj | 92 ++++++++++++++++ Rewrite.vcxproj.filters | 48 +++++++++ Rewrite.vcxproj.user | 3 + SGP4-VER.TLE | 111 +++++++++++++++++++ Vector.cpp | 1 + Vector.h | 53 +++++++++ main.cpp | 13 +++ 14 files changed, 919 insertions(+) create mode 100644 .hgignore create mode 100644 Coord.cpp create mode 100644 Coord.h create mode 100644 Globals.cpp create mode 100644 Globals.h create mode 100644 Julian.cpp create mode 100644 Julian.h create mode 100644 Rewrite.vcxproj create mode 100644 Rewrite.vcxproj.filters create mode 100644 Rewrite.vcxproj.user create mode 100644 SGP4-VER.TLE create mode 100644 Vector.cpp create mode 100644 Vector.h create mode 100644 main.cpp diff --git a/.hgignore b/.hgignore new file mode 100644 index 0000000..d84b781 --- /dev/null +++ b/.hgignore @@ -0,0 +1,3 @@ +syntax: glob +Release\* +Debug\* \ No newline at end of file diff --git a/Coord.cpp b/Coord.cpp new file mode 100644 index 0000000..0f19de5 --- /dev/null +++ b/Coord.cpp @@ -0,0 +1,6 @@ +#include "Coord.h" + + + + + diff --git a/Coord.h b/Coord.h new file mode 100644 index 0000000..f18d902 --- /dev/null +++ b/Coord.h @@ -0,0 +1,123 @@ +#ifndef COORD_H_ +#define COORD_H_ + +class CoordGeographic { +public: + + CoordGeographic() + : lat_(0.0), lon_(0.0), alt_(0.0) { + } + + CoordGeographic(double latitude, double longitude, double altitude) + : lat_(latitude), lon_(longitude), alt_(altitude) { + } + + virtual ~CoordGeographic() { + }; + + void SetLatitude(const double& latitude) { + lat_ = latitude; + } + + void SetLongitude(const double& longitude) { + lon_ = longitude; + } + + void SetAltitude(const double& altitude) { + alt_ = altitude; + } + + double GetLatitude() const { + return lat_; + } + + double GetLongitude() const { + return lon_; + } + + double GetAltitude() const { + return alt_; + } + +private: + /* + * radians (north positive, south negative) + */ + double lat_; + /* + * radians (east positive, west negative) + */ + double lon_; + /* + * kilometers + */ + double alt_; +}; + +class CoordTopographic { +public: + + CoordTopographic() + : azimuth_(0.0), elevation_(0.0), range_(0.0), range_rate_(0.0) { + } + + CoordTopographic(double azimuth, double elevation, double range, double range_rate) + : azimuth_(azimuth), elevation_(elevation), range_(range), range_rate_(range_rate) { + } + + virtual ~CoordTopographic() { + }; + + void SetAzimuth(const double& azimuth) { + azimuth_ = azimuth; + } + + void SetElevation(const double& elevation) { + elevation_ = elevation; + } + + void SetRange(const double& range) { + range_ = range; + } + + void SetRangeRate(const double& range_rate) { + range_rate_ = range_rate; + } + + double GetAzimuth() const { + return azimuth_; + } + + double GetElevation() const { + return elevation_; + } + + double GetRange() const { + return range_; + } + + double GetRangeRate() const { + return range_rate_; + } + +private: + /* + * radians + */ + double azimuth_; + /* + * radians + */ + double elevation_; + /* + * kilometers + */ + double range_; + /* + * kilometers / second + */ + double range_rate_; +}; + +#endif + diff --git a/Globals.cpp b/Globals.cpp new file mode 100644 index 0000000..a2e2179 --- /dev/null +++ b/Globals.cpp @@ -0,0 +1,23 @@ +#include "Globals.h" + +Globals::Globals(void) { +} + +Globals::~Globals(void) { +} + +double Globals::Fmod2p(const double& arg) { + double modu = fmod(arg, TWOPI()); + if (modu < 0.0) + modu += TWOPI(); + + return modu; +} + +double Globals::Deg2Rad(const double& deg) { + return deg * PI() / 180.0; +} + +double Globals::Rad2Deg(const double& rad) { + return rad * 180.0 / PI(); +} diff --git a/Globals.h b/Globals.h new file mode 100644 index 0000000..5dd474a --- /dev/null +++ b/Globals.h @@ -0,0 +1,124 @@ +#ifndef GLOBALS_H_ +#define GLOBALS_H_ + +#include + +class Globals { +public: + Globals(void); + ~Globals(void); + + static const double Q0() { + return 120.0; + } + + static const double S0() { + return 78.0; + } + + static const double CK2() { + return 0.5 * XJ2() * AE() * AE(); + } + + static const double CK4() { + return -0.375 * XJ4() * AE() * AE() * AE() * AE(); + } + + static const double TOTHRD() { + return 2.0 / 3.0; + } + + static const double XKE() { + return 60.0 / sqrt(XKMPER() * XKMPER() * XKMPER() / MU()); + } + + static const double S() { + return AE() * (1.0 + S0() / XKMPER()); + } + + static const double AE() { + return 1.0; + } + + static const double XKMPER() { + return 6378.135; + } + + static const double QOMS2T() { + return pow((Q0() - S0()) * AE() / XKMPER(), 4.0); + } + + static const double XJ2() { + return 1.082616e-3; + } + + static const double XJ3() { + return -2.53881e-6; + } + + static const double XJ4() { + return -1.65597e-6; + } + + static const double MU() { + return 398600.8; + } + + static const double J3OJ2() { + return XJ3() / XJ2(); + } + + static const double RADS_PER_DEG() { + return -0.253881E-5; + } + + static const double PI() { + return 3.14159265358979323846; + } + + static const double TWOPI() { + return 2.0 * PI(); + } + + static const double SEC_PER_DAY() { + return 86400.0; + } + + static const double MIN_PER_DAY() { + return 1440.0; + } + + static const double HR_PER_DAY() { + return 24.0; + } + + static const double OMEGA_E() { + return 1.00273790934; + } + + static const double F() { + return 1.0 / 298.26; + } + + static const double EPOCH_JAN1_00H_1900() { + // Jan 1.0 1900 = Jan 1 1900 00h UTC + return 2415019.5; + } + + static const double EPOCH_JAN1_12H_1900() { + // Jan 1.5 1900 = Jan 1 1900 12h UTC + return 2415020.0; + } + + static const double EPOCH_JAN1_12H_2000() { + // Jan 1.5 2000 = Jan 1 2000 12h UTC + return 2451545.0; + } + + static double Fmod2p(const double& arg); + static double Deg2Rad(const double& deg); + static double Rad2Deg(const double& rad); +}; + +#endif + diff --git a/Julian.cpp b/Julian.cpp new file mode 100644 index 0000000..9a1b0c5 --- /dev/null +++ b/Julian.cpp @@ -0,0 +1,232 @@ +#include "Globals.h" +#include "Julian.h" + +#include +#include +#include +#include + +#ifdef WIN32 +#include +#else +#include +#endif + +Julian::Julian() { +#ifdef WIN32 + SYSTEMTIME st; + GetSystemTime(&st); + Initialize(st.wYear, + st.wMonth, + st.wDay, + st.wHour, + st.wMinute, + (double) st.wSecond + (double) st.wMilliseconds / 1000.0); +#else + struct timeval tv; + gettimeofday(&tv, NULL); + struct tm; + gmtime_r(&tv.tv_sec, &tm); + Initialize(tm.tm_year + 1900, + tm.tm_mon, + tm.tm_mday, + tm.tm_hour, + tm.tm_min, + (double) tm.tm_sec + (double) tv.tv_usec / 1000000.0) +#endif +} + +Julian::Julian(const Julian& jul) { + date_ = jul.date_; +} + +/* + * create julian date given time_t value + */ +Julian::Julian(const time_t t) { + struct tm ptm; +#if WIN32 + assert(gmtime_s(&ptm, &t)); +#else + if (gmtime_r(&t, &ptm) == NULL) + assert(1); +#endif + int year = ptm.tm_year + 1900; + double day = ptm.tm_yday + 1 + + (ptm.tm_hour + + ((ptm.tm_min + + (ptm.tm_sec / 60.0)) / 60.0)) / 24.0; + + Initialize(year, day); +} + +/* + * create julian date from year and day of year + */ +Julian::Julian(int year, double day) { + Initialize(year, day); +} + +/* + * create julian date from individual components + * year: 2004 + * mon: 1-12 + * day: 1-31 + * hour: 0-23 + * min: 0-59 + * sec: 0-59.99 + */ +Julian::Julian(int year, int mon, int day, int hour, int min, double sec) { + Initialize(year, mon, day, hour, min, sec); +} + +/* + * create julian date from year and day of year + */ +void Julian::Initialize(int year, double day) { + + // Now calculate Julian date + year--; + + // Centuries are not leap years unless they divide by 400 + int A = (year / 100); + int B = 2 - A + (A / 4); + + // 1720994.5 = Oct 30, year -1 + double new_years = (int) (365.25 * year) + + (int) (30.6001 * 14) + + 1720994.5 + B; + + date_ = new_years + day; +} + +/* + * create julian date from individual components + * year: 2004 + * mon: 1-12 + * day: 1-31 + * hour: 0-23 + * min: 0-59 + * sec: 0-59.99 + */ +void Julian::Initialize(int year, int mon, int day, int hour, int min, double sec) { + // Calculate N, the day of the year (1..366) + int N; + int F1 = (int) ((275.0 * mon) / 9.0); + int F2 = (int) ((mon + 9.0) / 12.0); + + if (IsLeapYear(year)) { + // Leap year + N = F1 - F2 + day - 30; + } else { + // Common year + N = F1 - (2 * F2) + day - 30; + } + + double dblDay = N + (hour + (min + (sec / 60.0)) / 60.0) / 24.0; + + Initialize(year, dblDay); +} + +/* + * gets year, month and day of month from julian date + */ +void Julian::GetComponent(int& year, int& month, double& dom) const { + + double jdAdj = GetDate() + 0.5; + int Z = (int) jdAdj; // integer part + double F = jdAdj - Z; // fractional part + double alpha = (int) ((Z - 1867216.25) / 36524.25); + double A = Z + 1 + alpha - (int) (alpha / 4.0); + double B = A + 1524.0; + int C = (int) ((B - 122.1) / 365.25); + int D = (int) (C * 365.25); + int E = (int) ((B - D) / 30.6001); + + dom = B - D - (int) (E * 30.6001) + F; + month = (E < 13.5) ? (E - 1) : (E - 13); + year = (month > 2.5) ? (C - 4716) : (C - 4715); +} + +/* + * converts time to time_t + * note: resolution to seconds only + */ +time_t Julian::ToTime() const { + + int nYear; + int nMonth; + double dblDay; + + GetComponent(nYear, nMonth, dblDay); + + // dblDay is the fractional Julian Day (i.e., 29.5577). + // Save the whole number day in nDOM and convert dblDay to + // the fractional portion of day. + int nDOM = (int) dblDay; + + dblDay -= nDOM; + + const int SEC_PER_MIN = 60; + const int SEC_PER_HR = 60 * SEC_PER_MIN; + const int SEC_PER_DAY = 24 * SEC_PER_HR; + + int secs = (int) ((dblDay * SEC_PER_DAY) + 0.5); + + // Create a "struct tm" type. + // NOTE: + // The "struct tm" type has a 1-second resolution. Any fractional + // component of the "seconds" time value is discarded. + struct tm tGMT; + memset(&tGMT, 0, sizeof (tGMT)); + + tGMT.tm_year = nYear - 1900; // 2001 is 101 + tGMT.tm_mon = nMonth - 1; // January is 0 + tGMT.tm_mday = nDOM; // First day is 1 + tGMT.tm_hour = secs / SEC_PER_HR; + tGMT.tm_min = (secs % SEC_PER_HR) / SEC_PER_MIN; + tGMT.tm_sec = (secs % SEC_PER_HR) % SEC_PER_MIN; + tGMT.tm_isdst = 0; // No conversion desired + + time_t tEpoch = mktime(&tGMT); + + if (tEpoch != -1) { + // Valid time_t value returned from mktime(). + // mktime() expects a local time which means that tEpoch now needs + // to be adjusted by the difference between this time zone and GMT. + // tEpoch -= _timezone; + } + + return tEpoch; +} + +/* + * Greenwich Mean Sidereal Time + */ +double Julian::ToGMST() const { + double value; + double tut1; + + // tut1 = Julian centuries from 2000 Jan. 1 12h UT1 (since J2000 which is 2451545.0) + // a Julian century is 36525 days + tut1 = (date_ - 2451545.0) / 36525.0; + + // Rotation angle in arcseconds + value = 67310.54841 + (876600.0 * 3600.0 + 8640184.812866) * tut1 + 0.093104 * pow(tut1, 2.0) - 0.0000062 * pow(tut1, 3.0); + + // 360.0 / 86400.0 = 1.0 / 240.0 + value = fmod(Globals::Deg2Rad(value / 240.0), Globals::TWOPI()); + + // check quadrants + if (value < 0.0) + value += Globals::TWOPI(); + + return value; +} + +/* + * Local Mean Sideral Time + */ +double Julian::ToLMST(const double& lon) const { + return fmod(ToGMST() + lon, Globals::TWOPI()); +} diff --git a/Julian.h b/Julian.h new file mode 100644 index 0000000..b101f9d --- /dev/null +++ b/Julian.h @@ -0,0 +1,87 @@ +#ifndef JULIAN_H_ +#define JULIAN_H_ + +#include "Globals.h" + +#include + +class Julian { +public: + Julian(); + Julian(const Julian& jul); + Julian(const time_t t); + Julian(int year, double day); + Julian(int year, int mon, int day, int hour, int min, double sec); + + ~Julian() { + }; + + time_t ToTime() const; + double ToGMST() const; + double ToLMST(const double& lon) const; + + double FromJan1_00h_1900() const { + return date_ - Globals::EPOCH_JAN1_00H_1900(); + } + + double FromJan1_12h_1900() const { + return date_ - Globals::EPOCH_JAN1_12H_1900(); + } + + double FromJan1_12h_2000() const { + return date_ - Globals::EPOCH_JAN1_12H_2000(); + } + + void GetComponent(int& year, int& month, double& dom) const; + + double GetDate() const { + return date_; + } + + void AddDay(double day) { + date_ += day; + } + + void AddHour(double hr) { + date_ += (hr / Globals::HR_PER_DAY()); + } + + void AddMin(double min) { + date_ += (min / Globals::MIN_PER_DAY()); + } + + void AddSec(double sec) { + date_ += (sec / Globals::SEC_PER_DAY()); + } + + double SpanDay(const Julian& b) const { + return date_ - b.date_; + } + + double SpanHour(const Julian& b) const { + return SpanDay(b) * Globals::HR_PER_DAY(); + } + + double SpanMin(const Julian& b) const { + return SpanDay(b) * Globals::MIN_PER_DAY(); + } + + double SpanSec(const Julian& b) const { + return SpanDay(b) * Globals::SEC_PER_DAY(); + } + + static bool IsLeapYear(int y) { + return (y % 4 == 0 && y % 100 != 0) || (y % 400 == 0); + } + +protected: + void Initialize(int year, double day); + void Initialize(int year, int mon, int day, int hour, int min, double sec); + + /* + * the stored julian date + */ + double date_; +}; + +#endif diff --git a/Rewrite.vcxproj b/Rewrite.vcxproj new file mode 100644 index 0000000..998bf96 --- /dev/null +++ b/Rewrite.vcxproj @@ -0,0 +1,92 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {FD8F49F4-DC34-430F-8D62-C3E9C6EE124F} + Win32Proj + Rewrite + + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + true + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Rewrite.vcxproj.filters b/Rewrite.vcxproj.filters new file mode 100644 index 0000000..7e3811e --- /dev/null +++ b/Rewrite.vcxproj.filters @@ -0,0 +1,48 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/Rewrite.vcxproj.user b/Rewrite.vcxproj.user new file mode 100644 index 0000000..695b5c7 --- /dev/null +++ b/Rewrite.vcxproj.user @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/SGP4-VER.TLE b/SGP4-VER.TLE new file mode 100644 index 0000000..03e5c7c --- /dev/null +++ b/SGP4-VER.TLE @@ -0,0 +1,111 @@ +# ------------------ Verification test cases ---------------------- +# ## fig show lyddane fix error with gsfc ver +1 04632U 70093B 04031.91070959 -.00000084 00000-0 10000-3 0 9955 +2 04632 11.4628 273.1101 1450506 207.6000 143.9350 1.20231981 44145 -5184.0 -4896.0 120.00 +# SL-12 R/B # Shows Lyddane choice at 1860 and 4700 min +1 20413U 83020D 05363.79166667 .00000000 00000-0 00000+0 0 7041 +2 20413 12.3514 187.4253 7864447 196.3027 356.5478 0.24690082 7978 1440.0 4320.0 120.00 +# SMS 1 AKM # show the integrator problem with gsfc ver +1 09998U 74033F 05148.79417928 -.00000112 00000-0 00000+0 0 4480 +2 09998 9.4958 313.1750 0270971 327.5225 30.8097 1.16186785 45878 -1440.0 -720.00 60.0 +# SL-12 R/B # Shows Lyddane choice at 1860 and 4700 min +1 20413U 83020D 05363.79166667 .00000000 00000-0 00000+0 0 7041 +2 20413 12.3514 187.4253 7864447 196.3027 356.5478 0.24690082 7978 1844000 1845100 5.00 +# # TEME example +1 00005U 58002B 00179.78495062 .00000023 00000-0 28098-4 0 4753 +2 00005 34.2682 348.7242 1859667 331.7664 19.3264 10.82419157413667 0.00 4320.0 360.00 +# DELTA 1 DEB # near earth normal drag equation +# # perigee = 377.26km, so moderate drag case +1 06251U 62025E 06176.82412014 .00008885 00000-0 12808-3 0 3985 +2 06251 58.0579 54.0425 0030035 139.1568 221.1854 15.56387291 6774 0.0 2880.0 120.00 +# MOLNIYA 2-14 # 12h resonant ecc in 0.65 to 0.7 range +1 08195U 75081A 06176.33215444 .00000099 00000-0 11873-3 0 813 +2 08195 64.1586 279.0717 6877146 264.7651 20.2257 2.00491383225656 0.0 2880.0 120.00 +# MOLNIYA 1-36 ## fig 12h resonant ecc in 0.7 to 0.715 range +1 09880U 77021A 06176.56157475 .00000421 00000-0 10000-3 0 9814 +2 09880 64.5968 349.3786 7069051 270.0229 16.3320 2.00813614112380 0.0 2880.0 120.00 +# # Original STR#3 SDP4 test +1 11801U 80230.29629788 .01431103 00000-0 14311-1 13 +2 11801 46.7916 230.4354 7318036 47.4722 10.4117 2.28537848 13 0.0 1440.0 360.00 +# EUTELSAT 1-F1 (ECS1)## fig lyddane choice in GSFC at 2080 min +1 14128U 83058A 06176.02844893 -.00000158 00000-0 10000-3 0 9627 +2 14128 11.4384 35.2134 0011562 26.4582 333.5652 0.98870114 46093 0.0 2880.0 120.00 +# SL-6 R/B(2) # Deep space, perigee = 82.48 (<98) for +# # s4 > 20 mod +1 16925U 86065D 06151.67415771 .02550794 -30915-6 18784-3 0 4486 +2 16925 62.0906 295.0239 5596327 245.1593 47.9690 4.88511875148616 0.0 1440.0 120.00 + +# MOLNIYA 1-83 # 12h resonant, ecc > 0.715 (negative BSTAR) +1 21897U 92011A 06176.02341244 -.00001273 00000-0 -13525-3 0 3044 +2 21897 62.1749 198.0096 7421690 253.0462 20.1561 2.01269994104880 0.0 2880.0 120.00 +# SL-6 R/B(2) # last tle given, decayed 2006-04-04, day 94 +1 22312U 93002D 06094.46235912 .99999999 81888-5 49949-3 0 3953 +2 22312 62.1486 77.4698 0308723 267.9229 88.7392 15.95744531 98783 54.2028672 1440.0 20.00 +# SL-6 R/B(2) # 12h resonant ecc in the > 0.715 range +1 22674U 93035D 06176.55909107 .00002121 00000-0 29868-3 0 6569 +2 22674 63.5035 354.4452 7541712 253.3264 18.7754 1.96679808 93877 0.0 2880.0 120.00 +# ARIANE 44L+ R/B # Lyddane bug at <= 70 min for atan2(), +# # no quadrant fix +1 23177U 94040C 06175.45752052 .00000386 00000-0 76590-3 0 95 +2 23177 7.0496 179.8238 7258491 296.0482 8.3061 2.25906668 97438 0.0 1440.0 120.00 +# WIND # STR#3 Kepler failes past about 200 min +1 23333U 94071A 94305.49999999 -.00172956 26967-3 10000-3 0 15 +2 23333 28.7490 2.3720 9728298 30.4360 1.3500 0.07309491 70 0.0 1600.0 120.00 +# ARIANE 42P+3 R/B ## fig Lyddane bug at > 280.5 min for AcTan() +1 23599U 95029B 06171.76535463 .00085586 12891-6 12956-2 0 2905 +2 23599 6.9327 0.2849 5782022 274.4436 25.2425 4.47796565123555 0.0 720.0 20.00 +# ITALSAT 2 # 24h resonant GEO, inclination > 3 deg +1 24208U 96044A 06177.04061740 -.00000094 00000-0 10000-3 0 1600 +2 24208 3.8536 80.0121 0026640 311.0977 48.3000 1.00778054 36119 0.0 1440.0 120.00 +# AMC-4 ## fig low incl, show incl shift with +# ## gsfc version from 240 to 1440 min +1 25954U 99060A 04039.68057285 -.00000108 00000-0 00000-0 0 6847 +2 25954 0.0004 243.8136 0001765 15.5294 22.7134 1.00271289 15615 -1440.0 1440.0 120.00 +# INTELSAT 902 # negative incl at 9313 min then +# # 270 deg Lyddane bug at 37606 min +1 26900U 01039A 06106.74503247 .00000045 00000-0 10000-3 0 8290 +2 26900 0.0164 266.5378 0003319 86.1794 182.2590 1.00273847 16981 9300.00 9400.00 60.00 +# COSMOS 1024 DEB # 12h resonant ecc in 0.5 to 0.65 range +1 26975U 78066F 06174.85818871 .00000620 00000-0 10000-3 0 6809 +2 26975 68.4714 236.1303 5602877 123.7484 302.5767 2.05657553 67521 0.0 2880.0 120.00 +# CBERS 2 # Near Earth, ecc = 8.84E-5 (< 1.0e-4) +# # drop certain normal drag terms +1 28057U 03049A 06177.78615833 .00000060 00000-0 35940-4 0 1836 +2 28057 98.4283 247.6961 0000884 88.1964 271.9322 14.35478080140550 0.0 2880.0 120.00 +# NAVSTAR 53 (USA 175)# 12h non-resonant GPS (ecc < 0.5 ecc) +1 28129U 03058A 06175.57071136 -.00000104 00000-0 10000-3 0 459 +2 28129 54.7298 324.8098 0048506 266.2640 93.1663 2.00562768 18443 0.0 1440.0 120.00 +# COSMOS 2405 # Near Earth, perigee = 127.20 (< 156) s4 mod +1 28350U 04020A 06167.21788666 .16154492 76267-5 18678-3 0 8894 +2 28350 64.9977 345.6130 0024870 260.7578 99.9590 16.47856722116490 0.0 2880.0 120.00 +# H-2 R/B # Deep space, perigee = 135.75 (<156) s4 mod +1 28623U 05006B 06177.81079184 .00637644 69054-6 96390-3 0 6000 +2 28623 28.5200 114.9834 6249053 170.2550 212.8965 3.79477162 12753 0.0 1440.0 120.00 +# XM-3 # 24h resonant geo, incl < 3 deg goes +# # negative around 1130 min +1 28626U 05008A 06176.46683397 -.00000205 00000-0 10000-3 0 2190 +2 28626 0.0019 286.9433 0000335 13.7918 55.6504 1.00270176 4891 0.0 1440.0 120.00 +# MINOTAUR R/B # Sub-orbital case - Decayed 2005-11-29 +# #(perigee = -51km), lost in 50 minutes +1 28872U 05037B 05333.02012661 .25992681 00000-0 24476-3 0 1534 +2 28872 96.4736 157.9986 0303955 244.0492 110.6523 16.46015938 10708 0.0 60.0 5.00 +# SL-14 DEB # Last stage of decay - lost in under 420 min +1 29141U 85108AA 06170.26783845 .99999999 00000-0 13519-0 0 718 +2 29141 82.4288 273.4882 0015848 277.2124 83.9133 15.93343074 6828 0.0 440.0 20.00 +# SL-12 DEB # Near Earth, perigee = 212.24 < 220 +# # simplified drag eq +1 29238U 06022G 06177.28732010 .00766286 10823-4 13334-2 0 101 +2 29238 51.5595 213.7903 0202579 95.2503 267.9010 15.73823839 1061 0.0 1440.0 120.00 +# # Original STR#3 SGP4 test +1 88888U 80275.98708465 .00073094 13844-3 66816-4 0 87 +2 88888 72.8435 115.9689 0086731 52.6988 110.5714 16.05824518 1058 0.0 1440.0 120.00 +# +# # check error code 4 +1 33333U 05037B 05333.02012661 .25992681 00000-0 24476-3 0 1534 +2 33333 96.4736 157.9986 9950000 244.0492 110.6523 4.00004038 10708 0.0 150.0 5.00 +# # try and check error code 2 but this +1 33334U 78066F 06174.85818871 .00000620 00000-0 10000-3 0 6809 +2 33334 68.4714 236.1303 5602877 123.7484 302.5767 0.00001000 67521 0.0 1440.0 1.00 +# # try to check error code 3 looks like ep never goes below zero, tied close to ecc +1 33335U 05008A 06176.46683397 -.00000205 00000-0 10000-3 0 2190 +2 33335 0.0019 286.9433 0000004 13.7918 55.6504 1.00270176 4891 0.0 1440.0 20.00 \ No newline at end of file diff --git a/Vector.cpp b/Vector.cpp new file mode 100644 index 0000000..37e7137 --- /dev/null +++ b/Vector.cpp @@ -0,0 +1 @@ +#include "Vector.h" diff --git a/Vector.h b/Vector.h new file mode 100644 index 0000000..ed8c16d --- /dev/null +++ b/Vector.h @@ -0,0 +1,53 @@ +#ifndef VECTOR_H_ +#define VECTOR_H_ + +class Vector { +public: + + Vector(double x = 0.0, double y = 0.0, double z = 0.0, double w = 0.0) + : x_(x), y_(y), z_(z), w_(w) { + } + + virtual ~Vector() { + }; + + void SetX(const double& x) { + x_ = x; + } + + void SetY(const double& y) { + y_ = y; + } + + void SetZ(const double& z) { + z_ = z; + } + + void SetW(const double& w) { + w_ = w; + } + + double GetX() const { + return x_; + } + + double GetY() const { + return y_; + } + + double GetZ() const { + return z_; + } + + double GetW() const { + return w_; + } + +protected: + double x_; + double y_; + double z_; + double w_; +}; + +#endif \ No newline at end of file diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..c91bc2a --- /dev/null +++ b/main.cpp @@ -0,0 +1,13 @@ +#include "Julian.h" + +#include + +int main() { + Julian julian_now; + int year = 0; + int month = 0; + double day = 0.0; + julian_now.GetComponent(year, month, day); + printf("year: %i\nmonth: %i\nday: %lf\n", year, month, day); + return 0; +} \ No newline at end of file