3 |
// |
// |
4 |
#ifndef sgp4_h |
#ifndef sgp4_h |
5 |
#define sgp4_h |
#define sgp4_h |
6 |
#pragma once |
|
7 |
|
#if !defined(__CINT__) || defined(__MAKECINT__) |
8 |
|
|
9 |
//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers |
//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers |
10 |
#include <stdio.h> |
#include <stdio.h> |
11 |
//#include <tchar.h> |
//#include <tchar.h> |
12 |
|
#include <ctype.h> |
13 |
#include <string> |
#include <string> |
14 |
#include <map> |
#include <map> |
15 |
#include <vector> |
#include <vector> |
371 |
{ |
{ |
372 |
UNITS_NONE, // not initialized |
UNITS_NONE, // not initialized |
373 |
UNITS_AE, |
UNITS_AE, |
374 |
UNITS_KM, |
UNITS_KM |
375 |
}; |
}; |
376 |
|
|
377 |
cVector m_pos; |
cVector m_pos; |
379 |
cJulian m_date; |
cJulian m_date; |
380 |
VecUnits m_VecUnits; |
VecUnits m_VecUnits; |
381 |
}; |
}; |
382 |
|
// |
383 |
|
// cNoradBase.h |
384 |
|
// |
385 |
|
// This class provides a base class for the NORAD SGP4/SDP4 |
386 |
|
// orbit models. |
387 |
|
// |
388 |
|
// Copyright (c) 2003 Michael F. Henry |
389 |
|
// |
390 |
|
#pragma once |
391 |
|
|
392 |
|
////////////////////////////////////////////////////////////////////////////// |
393 |
|
|
394 |
|
class cEci; |
395 |
|
class cOrbit; |
396 |
|
|
397 |
|
////////////////////////////////////////////////////////////////////////////// |
398 |
|
|
399 |
|
class cNoradBase |
400 |
|
{ |
401 |
|
public: |
402 |
|
cNoradBase(const cOrbit&); |
403 |
|
virtual ~cNoradBase() {}; |
404 |
|
|
405 |
|
virtual bool getPosition(double tsince, cEci &eci) = 0; |
406 |
|
|
407 |
|
protected: |
408 |
|
cNoradBase& operator=(const cNoradBase&); |
409 |
|
|
410 |
|
void Initialize(); |
411 |
|
bool FinalPosition(double incl, double omega, double e, |
412 |
|
double a, double xl, double xnode, |
413 |
|
double xn, double tsince, cEci &eci); |
414 |
|
|
415 |
|
const cOrbit &m_Orbit; |
416 |
|
|
417 |
|
// Orbital parameter variables which need only be calculated one |
418 |
|
// time for a given orbit (ECI position time-independent). |
419 |
|
double m_satInc; // inclination |
420 |
|
double m_satEcc; // eccentricity |
421 |
|
|
422 |
|
double m_cosio; double m_theta2; double m_x3thm1; double m_eosq; |
423 |
|
double m_betao2; double m_betao; double m_aodp; double m_xnodp; |
424 |
|
double m_s4; double m_qoms24; double m_perigee; double m_tsi; |
425 |
|
double m_eta; double m_etasq; double m_eeta; double m_coef; |
426 |
|
double m_coef1; double m_c1; double m_c2; double m_c3; |
427 |
|
double m_c4; double m_sinio; double m_a3ovk2; double m_x1mth2; |
428 |
|
double m_xmdot; double m_omgdot; double m_xhdot1; double m_xnodot; |
429 |
|
double m_xnodcf; double m_t2cof; double m_xlcof; double m_aycof; |
430 |
|
double m_x7thm1; |
431 |
|
}; |
432 |
|
// |
433 |
|
// cOrbit.h |
434 |
|
// |
435 |
|
// This is the header file for the class cOrbit. This class accepts a |
436 |
|
// single satellite's NORAD two-line element set and provides information |
437 |
|
// regarding the satellite's orbit such as period, axis length, |
438 |
|
// ECI coordinates/velocity, etc., using the SGP4/SDP4 orbital models. |
439 |
|
// |
440 |
|
// Copyright (c) 2002-2003 Michael F. Henry |
441 |
|
// |
442 |
|
#pragma once |
443 |
|
|
444 |
|
#include "math.h" |
445 |
|
|
446 |
|
using namespace std; |
447 |
|
////////////////////////////////////////////////////////////////////////////// |
448 |
|
|
449 |
|
class cVector; |
450 |
|
class cGeoCoord; |
451 |
|
class cEci; |
452 |
|
|
453 |
|
////////////////////////////////////////////////////////////////////////////// |
454 |
|
class cOrbit |
455 |
|
{ |
456 |
|
public: |
457 |
|
cOrbit(const cTle &tle); |
458 |
|
virtual ~cOrbit(); |
459 |
|
|
460 |
|
// Return satellite ECI data at given minutes since element's epoch. |
461 |
|
bool getPosition(double tsince, cEci *pEci) const; |
462 |
|
|
463 |
|
double Inclination() const { return radGet(cTle::FLD_I); } |
464 |
|
double Eccentricity() const { return m_tle.getField(cTle::FLD_E); } |
465 |
|
double RAAN() const { return radGet(cTle::FLD_RAAN); } |
466 |
|
double ArgPerigee() const { return radGet(cTle::FLD_ARGPER); } |
467 |
|
double BStar() const { return m_tle.getField(cTle::FLD_BSTAR) / AE;} |
468 |
|
double Drag() const { return m_tle.getField(cTle::FLD_MMOTIONDT); } |
469 |
|
double mnMotion() const { return m_tle.getField(cTle::FLD_MMOTION); } |
470 |
|
double mnAnomaly() const { return radGet(cTle::FLD_M); } |
471 |
|
double mnAnomaly(cJulian t) const; // mean anomaly (in radians) at time t |
472 |
|
|
473 |
|
cJulian Epoch() const { return m_jdEpoch; } |
474 |
|
|
475 |
|
double TPlusEpoch(const cJulian &t) const; // time span [t - epoch] in secs |
476 |
|
|
477 |
|
string SatName(bool fAppendId = false) const; |
478 |
|
|
479 |
|
// "Recovered" from the input elements |
480 |
|
double SemiMajor() const { return m_aeAxisSemiMajorRec; } |
481 |
|
double SemiMinor() const { return m_aeAxisSemiMinorRec; } |
482 |
|
double mnMotionRec() const { return m_mnMotionRec; } // mn motion, rads/min |
483 |
|
double Major() const { return 2.0 * SemiMajor(); } // major axis in AE |
484 |
|
double Minor() const { return 2.0 * SemiMinor(); } // minor axis in AE |
485 |
|
double Perigee() const { return m_kmPerigeeRec; } // perigee in km |
486 |
|
double Apogee() const { return m_kmApogeeRec; } // apogee in km |
487 |
|
double Period() const; // period in seconds |
488 |
|
|
489 |
|
protected: |
490 |
|
double radGet(cTle::eField fld) const |
491 |
|
{ return m_tle.getField(fld, cTle::U_RAD); } |
492 |
|
|
493 |
|
double degGet(cTle::eField fld) const |
494 |
|
{ return m_tle.getField(fld, cTle::U_DEG); } |
495 |
|
|
496 |
|
private: |
497 |
|
cTle m_tle; |
498 |
|
cJulian m_jdEpoch; |
499 |
|
cNoradBase *m_pNoradModel; |
500 |
|
|
501 |
|
// Caching variables; note units are not necessarily the same as tle units |
502 |
|
mutable double m_secPeriod; |
503 |
|
|
504 |
|
// Caching variables recovered from the input TLE elements |
505 |
|
double m_aeAxisSemiMinorRec; // semi-minor axis, in AE units |
506 |
|
double m_aeAxisSemiMajorRec; // semi-major axis, in AE units |
507 |
|
double m_mnMotionRec; // radians per minute |
508 |
|
double m_kmPerigeeRec; // perigee, in km |
509 |
|
double m_kmApogeeRec; // apogee, in km |
510 |
|
}; |
511 |
|
|
512 |
|
// |
513 |
|
// cNoradSGP4.h |
514 |
|
// |
515 |
|
// This class implements the NORAD Simple General Perturbation 4 orbit |
516 |
|
// model. This model provides the ECI coordiantes/velocity of satellites |
517 |
|
// with orbit periods less than 225 minutes. |
518 |
|
// |
519 |
|
// Copyright (c) 2003 Michael F. Henry |
520 |
|
// |
521 |
|
#pragma once |
522 |
|
|
523 |
|
class cOrbit; |
524 |
|
|
525 |
|
////////////////////////////////////////////////////////////////////////////// |
526 |
|
class cNoradSGP4 : public cNoradBase |
527 |
|
{ |
528 |
|
public: |
529 |
|
cNoradSGP4(const cOrbit &orbit); |
530 |
|
virtual ~cNoradSGP4() {}; |
531 |
|
|
532 |
|
virtual bool getPosition(double tsince, cEci &eci); |
533 |
|
|
534 |
|
protected: |
535 |
|
double m_c5; |
536 |
|
double m_omgcof; |
537 |
|
double m_xmcof; |
538 |
|
double m_delmo; |
539 |
|
double m_sinmo; |
540 |
|
}; |
541 |
|
|
542 |
|
// |
543 |
|
// cNoradSDP4.h |
544 |
|
// |
545 |
|
// This class implements the NORAD Simple Deep Perturbation 4 orbit |
546 |
|
// model. This model provides the ECI coordinates/velocity of satellites |
547 |
|
// with periods >= 225 minutes. |
548 |
|
// |
549 |
|
// Copyright (c) 2003 Michael F. Henry |
550 |
|
// |
551 |
|
#pragma once |
552 |
|
|
553 |
|
class cOrbit; |
554 |
|
|
555 |
|
////////////////////////////////////////////////////////////////////////////// |
556 |
|
class cNoradSDP4 : public cNoradBase |
557 |
|
{ |
558 |
|
public: |
559 |
|
cNoradSDP4(const cOrbit &orbit); |
560 |
|
virtual ~cNoradSDP4() {}; |
561 |
|
|
562 |
|
virtual bool getPosition(double tsince, cEci &eci); |
563 |
|
|
564 |
|
protected: |
565 |
|
bool DeepInit(double *eosq, double *sinio, double *cosio, double *m_betao, |
566 |
|
double *m_aodp, double *m_theta2, double *m_sing, double *m_cosg, |
567 |
|
double *m_betao2,double *xmdot, double *omgdot, double *xnodott); |
568 |
|
|
569 |
|
bool DeepSecular(double *xmdf, double *omgadf,double *xnode, double *emm, |
570 |
|
double *xincc, double *xnn, double *tsince); |
571 |
|
bool DeepCalcDotTerms (double *pxndot, double *pxnddt, double *pxldot); |
572 |
|
void DeepCalcIntegrator(double *pxndot, double *pxnddt, double *pxldot, |
573 |
|
const double &delt); |
574 |
|
bool DeepPeriodics(double *e, double *xincc, double *omgadf, |
575 |
|
double *xnode, double *xmam); |
576 |
|
double m_sing; |
577 |
|
double m_cosg; |
578 |
|
|
579 |
|
// Deep Initialization |
580 |
|
double eqsq; double siniq; double cosiq; double rteqsq; double ao; |
581 |
|
double cosq2; double sinomo; double cosomo; double bsq; double xlldot; |
582 |
|
double omgdt; double xnodot; |
583 |
|
|
584 |
|
// Deep Secular, Periodic |
585 |
|
double xll; double omgasm; double xnodes; double _em; |
586 |
|
double xinc; double xn; double t; |
587 |
|
|
588 |
|
// Variables shared by "Deep" routines |
589 |
|
double dp_e3; double dp_ee2; double dp_savtsn; double dp_se2; |
590 |
|
double dp_se3; double dp_sgh2; double dp_sgh3; double dp_sgh4; |
591 |
|
double dp_sghs; double dp_sh2; double dp_sh3; double dp_si2; |
592 |
|
double dp_si3; double dp_sl2; double dp_sl3; double dp_sl4; |
593 |
|
double dp_xgh2; double dp_xgh3; double dp_xgh4; double dp_xh2; |
594 |
|
double dp_xh3; double dp_xi2; double dp_xi3; double dp_xl2; |
595 |
|
double dp_xl3; double dp_xl4; double dp_xqncl; double dp_zmol; |
596 |
|
double dp_zmos; |
597 |
|
|
598 |
|
double dp_atime; double dp_d2201; double dp_d2211; double dp_d3210; |
599 |
|
double dp_d3222; double dp_d4410; double dp_d4422; double dp_d5220; |
600 |
|
double dp_d5232; double dp_d5421; double dp_d5433; double dp_del1; |
601 |
|
double dp_del2; double dp_del3; double dp_fasx2; double dp_fasx4; |
602 |
|
double dp_fasx6; double dp_omegaq; double dp_sse; double dp_ssg; |
603 |
|
double dp_ssh; double dp_ssi; double dp_ssl; double dp_step2; |
604 |
|
double dp_stepn; double dp_stepp; double dp_thgr; double dp_xfact; |
605 |
|
double dp_xlamo; double dp_xli; double dp_xni; |
606 |
|
|
607 |
|
bool dp_iresfl; |
608 |
|
bool dp_isynfl; |
609 |
|
|
610 |
|
// DeepInit vars that change with epoch |
611 |
|
double dpi_c; double dpi_ctem; double dpi_day; double dpi_gam; |
612 |
|
double dpi_stem; double dpi_xnodce; double dpi_zcosgl; double dpi_zcoshl; |
613 |
|
double dpi_zcosil; double dpi_zsingl; double dpi_zsinhl; double dpi_zsinil; |
614 |
|
double dpi_zx; double dpi_zy; |
615 |
|
|
616 |
|
}; |
617 |
|
|
618 |
#endif |
#endif |
619 |
|
#endif |
620 |
|
|