perturb 1.0.0
A modern C++11 wrapper for the SGP4 orbit propagator
|
An internal namespace containing the underlying SGP4 implementation. More...
Classes | |
struct | elsetrec |
Typedefs | |
typedef struct perturb::sgp4::elsetrec | elsetrec |
Enumerations | |
enum | gravconsttype { wgs72old , wgs72 , wgs84 } |
Functions | |
bool | sgp4init (gravconsttype whichconst, char opsmode, const char satn[5], const double epoch, const double xbstar, const double xndot, const double xnddot, const double xecco, const double xargpo, const double xinclo, const double xmo, const double xno, const double xnodeo, elsetrec &satrec) |
bool | sgp4 (elsetrec &satrec, double tsince, double r[3], double v[3]) |
void | getgravconst (gravconsttype whichconst, double &tumin, double &mus, double &radiusearthkm, double &xke, double &j2, double &j3, double &j4, double &j3oj2) |
void | twoline2rv (char longstr1[130], char longstr2[130], char typerun, char typeinput, char opsmode, gravconsttype whichconst, double &startmfe, double &stopmfe, double &deltamin, elsetrec &satrec) |
double | gstime_SGP4 (double jdut1) |
double | sgn_SGP4 (double x) |
double | mag_SGP4 (double x[3]) |
void | cross_SGP4 (double vec1[3], double vec2[3], double outvec[3]) |
double | dot_SGP4 (double x[3], double y[3]) |
double | angle_SGP4 (double vec1[3], double vec2[3]) |
void | newtonnu_SGP4 (double ecc, double nu, double &e0, double &m) |
double | asinh_SGP4 (double xval) |
void | rv2coe_SGP4 (double r[3], double v[3], double mus, double &p, double &a, double &ecc, double &incl, double &omega, double &argp, double &nu, double &m, double &arglat, double &truelon, double &lonper) |
void | jday_SGP4 (int year, int mon, int day, int hr, int minute, double sec, double &jd, double &jdFrac) |
void | days2mdhms_SGP4 (int year, double days, int &mon, int &day, int &hr, int &minute, double &sec) |
void | invjday_SGP4 (double jd, double jdFrac, int &year, int &mon, int &day, int &hr, int &minute, double &sec) |
An internal namespace containing the underlying SGP4 implementation.
If you need some deeper functionality, feel free to dig into this. However, the whole goal of this library is to avoid the need to do that. If you find yourself needing some functionality that perturb's interface doesn't offer, please open an issue as others may have similar thoughts / needs.
double perturb::sgp4::angle_SGP4 | ( | double | vec1[3], |
double | vec2[3] | ||
) |
procedure angle_SGP4
this procedure calculates the angle between two vectors. the output is set to 999999.1 to indicate an undefined value. be sure to check for this at the output phase.
author : david vallado 719-573-2600 1 mar 2001
inputs description range / units vec1 - vector number 1 vec2 - vector number 2
outputs : theta - angle between the two vectors -pi to pi
locals : temp - temporary real variable
coupling :
double perturb::sgp4::asinh_SGP4 | ( | double | xval | ) |
void perturb::sgp4::cross_SGP4 | ( | double | vec1[3], |
double | vec2[3], | ||
double | outvec[3] | ||
) |
void perturb::sgp4::days2mdhms_SGP4 | ( | int | year, |
double | days, | ||
int & | mon, | ||
int & | day, | ||
int & | hr, | ||
int & | minute, | ||
double & | sec | ||
) |
procedure days2mdhms_SGP4
this procedure converts the day of the year, days, to the equivalent month day, hour, minute and second.
algorithm : set up array for the number of days per month find leap year - use 1900 because 2000 is a leap year loop through a temp value while the value is < the days perform int conversions to the correct day and month convert remainder into h m s using type conversions
author : david vallado 719-573-2600 1 mar 2001
inputs description range / units year - year 1900 .. 2100 days - julian day of the year 1.0 .. 366.0
outputs : mon - month 1 .. 12 day - day 1 .. 28,29,30,31 hr - hour 0 .. 23 min - minute 0 .. 59 sec - second 0.0 .. 59.999
locals : dayofyr - day of year temp - temporary extended values inttemp - temporary int value i - index lmonth[13] - int array containing the number of days per month
coupling :
double perturb::sgp4::dot_SGP4 | ( | double | x[3], |
double | y[3] | ||
) |
void perturb::sgp4::getgravconst | ( | gravconsttype | whichconst, |
double & | tumin, | ||
double & | mus, | ||
double & | radiusearthkm, | ||
double & | xke, | ||
double & | j2, | ||
double & | j3, | ||
double & | j4, | ||
double & | j3oj2 | ||
) |
function getgravconst
this function gets constants for the propagator. note that mu is identified to facilitiate comparisons with newer models. the common useage is wgs72.
author : david vallado 719-573-2600 21 jul 2006
inputs : whichconst - which set of constants to use wgs72old, wgs72, wgs84
outputs : tumin - minutes in one time unit mu - earth gravitational parameter radiusearthkm - radius of the earth in km xke - reciprocal of tumin j2, j3, j4 - un-normalized zonal harmonic values j3oj2 - j3 divided by j2
locals :
coupling : none
references : norad spacetrack report #3
double perturb::sgp4::gstime_SGP4 | ( | double | jdut1 | ) |
function gstime_SGP4
this function finds the greenwich sidereal time.
author : david vallado 719-573-2600 1 mar 2001
inputs description range / units jdut1 - julian date in ut1 days from 4713 bc
outputs : gstime - greenwich sidereal time 0 to 2pi rad
locals : temp - temporary variable for doubles rad tut1 - julian centuries from the jan 1, 2000 12 h epoch (ut1)
coupling : none
references :
void perturb::sgp4::invjday_SGP4 | ( | double | jd, |
double | jdfrac, | ||
int & | year, | ||
int & | mon, | ||
int & | day, | ||
int & | hr, | ||
int & | minute, | ||
double & | sec | ||
) |
procedure invjday_SGP4
this procedure finds the year, month, day, hour, minute and second given the julian date. tu can be ut1, tdt, tdb, etc.
algorithm : set up starting values find leap year - use 1900 because 2000 is a leap year find the elapsed days through the year in a loop call routine to find each individual value
author : david vallado 719-573-2600 1 mar 2001
inputs description range / units jd - julian date days from 4713 bc jdfrac - julian date fraction into day days from 4713 bc
outputs : year - year 1900 .. 2100 mon - month 1 .. 12 day - day 1 .. 28,29,30,31 hr - hour 0 .. 23 min - minute 0 .. 59 sec - second 0.0 .. 59.999
locals : days - day of year plus fractional portion of a day days tu - julian centuries from 0 h jan 0, 1900 temp - temporary double values leapyrs - number of leap years from 1900
coupling : days2mdhms - finds month, day, hour, minute and second given days and year
references :
void perturb::sgp4::jday_SGP4 | ( | int | year, |
int | mon, | ||
int | day, | ||
int | hr, | ||
int | minute, | ||
double | sec, | ||
double & | jd, | ||
double & | jdFrac | ||
) |
procedure jday_SGP4
this procedure finds the julian date given the year, month, day, and time. the julian date is defined by each elapsed day since noon, jan 1, 4713 bc.
algorithm : calculate the answer in one step for efficiency
author : david vallado 719-573-2600 1 mar 2001
inputs description range / units year - year 1900 .. 2100 mon - month 1 .. 12 day - day 1 .. 28,29,30,31 hr - universal time hour 0 .. 23 min - universal time min 0 .. 59 sec - universal time sec 0.0 .. 59.999
outputs : jd - julian date days from 4713 bc jdfrac - julian date fraction into day days from 4713 bc
locals : none.
coupling : none.
references :
double perturb::sgp4::mag_SGP4 | ( | double | x[3] | ) |
void perturb::sgp4::newtonnu_SGP4 | ( | double | ecc, |
double | nu, | ||
double & | e0, | ||
double & | m | ||
) |
function newtonnu_SGP4
this function solves keplers equation when the true anomaly is known. the mean and eccentric, parabolic, or hyperbolic anomaly is also found. the parabolic limit at 168ø is arbitrary. the hyperbolic anomaly is also limited. the hyperbolic sine is used because it's not double valued.
author : david vallado 719-573-2600 27 may 2002
revisions vallado - fix small 24 sep 2002
inputs description range / units ecc - eccentricity 0.0 to nu - true anomaly -2pi to 2pi rad
outputs : e0 - eccentric anomaly 0.0 to 2pi rad 153.02 ø m - mean anomaly 0.0 to 2pi rad 151.7425 ø
locals : e1 - eccentric anomaly, next value rad sine - sine of e cose - cosine of e ktr - index
coupling : asinh - arc hyperbolic sine
references :
void perturb::sgp4::rv2coe_SGP4 | ( | double | r[3], |
double | v[3], | ||
double | mus, | ||
double & | p, | ||
double & | a, | ||
double & | ecc, | ||
double & | incl, | ||
double & | omega, | ||
double & | argp, | ||
double & | nu, | ||
double & | m, | ||
double & | arglat, | ||
double & | truelon, | ||
double & | lonper | ||
) |
function rv2coe_SGP4
this function finds the classical orbital elements given the geocentric equatorial position and velocity vectors.
author : david vallado 719-573-2600 21 jun 2002
revisions vallado - fix special cases 5 sep 2002 vallado - delete extra check in inclination code 16 oct 2002 vallado - add constant file use 29 jun 2003 vallado - add mu 2 apr 2007
inputs description range / units r - ijk position vector km v - ijk velocity vector km / s mu - gravitational parameter km3 / s2
outputs : p - semilatus rectum km a - semimajor axis km ecc - eccentricity incl - inclination 0.0 to pi rad omega - right ascension of ascending node 0.0 to 2pi rad argp - argument of perigee 0.0 to 2pi rad nu - true anomaly 0.0 to 2pi rad m - mean anomaly 0.0 to 2pi rad arglat - argument of latitude (ci) 0.0 to 2pi rad truelon - true longitude (ce) 0.0 to 2pi rad lonper - longitude of periapsis (ee) 0.0 to 2pi rad
locals : hbar - angular momentum h vector km2 / s ebar - eccentricity e vector nbar - line of nodes n vector c1 - v**2 - u/r rdotv - r dot v hk - hk unit vector sme - specfic mechanical energy km2 / s2 i - index e - eccentric, parabolic, hyperbolic anomaly rad temp - temporary variable typeorbit - type of orbit ee, ei, ce, ci
coupling : mag - magnitude of a vector cross - cross product of two vectors angle - find the angle between two vectors newtonnu - find the mean anomaly
references :
bool perturb::sgp4::sgp4 | ( | elsetrec & | satrec, |
double | tsince, | ||
double | r[3], | ||
double | v[3] | ||
) |
procedure sgp4
this procedure is the sgp4 prediction model from space command. this is an updated and combined version of sgp4 and sdp4, which were originally published separately in spacetrack report #3. this version follows the methodology from the aiaa paper (2006) describing the history and development of the code.
author : david vallado 719-573-2600 28 jun 2005
inputs : satrec - initialised structure from sgp4init() call. tsince - time since epoch (minutes)
outputs : r - position vector km v - velocity km/sec return code - non-zero on error. 1 - mean elements, ecc >= 1.0 or ecc < -0.001 or a < 0.95 er 2 - mean motion less than 0.0 3 - pert elements, ecc < 0.0 or ecc > 1.0 4 - semi-latus rectum < 0.0 5 - epoch elements are sub-orbital 6 - satellite has decayed
locals : am - axnl, aynl - betal - cosim , sinim , cosomm , sinomm , cnod , snod , cos2u , sin2u , coseo1 , sineo1 , cosi , sini , cosip , sinip , cosisq , cossu , sinsu , cosu , sinu delm - delomg - dndt - eccm - emsq - ecose - el2 - eo1 - eccp - esine - argpm - argpp - omgadf -c pl - r - rtemsq - rdotl - rl - rvdot - rvdotl - su - t2 , t3 , t4 , tc tem5, temp , temp1 , temp2 , tempa , tempe , templ u , ux , uy , uz , vx , vy , vz inclm - inclination mm - mean anomaly nm - mean motion nodem - right asc of ascending node xinc - xincp - xl - xlm - mp - xmdf - xmx - xmy - nodedf - xnode - nodep - np -
coupling : getgravconst- no longer used. Variables are conatined within satrec dpper dpspace
references : hoots, roehrich, norad spacetrack report #3 1980 hoots, norad spacetrack report #6 1986 hoots, schumacher and glover 2004
bool perturb::sgp4::sgp4init | ( | gravconsttype | whichconst, |
char | opsmode, | ||
const char | satn[5], | ||
const double | epoch, | ||
const double | xbstar, | ||
const double | xndot, | ||
const double | xnddot, | ||
const double | xecco, | ||
const double | xargpo, | ||
const double | xinclo, | ||
const double | xmo, | ||
const double | xno_kozai, | ||
const double | xnodeo, | ||
elsetrec & | satrec | ||
) |
procedure sgp4init
this procedure initializes variables for sgp4.
author : david vallado 719-573-2600 28 jun 2005
inputs : opsmode - mode of operation afspc or improved 'a', 'i' whichconst - which set of constants to use 72, 84 satn - satellite number bstar - sgp4 type drag coefficient kg/m2er ecco - eccentricity epoch - epoch time in days from jan 0, 1950. 0 hr argpo - argument of perigee (output if ds) inclo - inclination mo - mean anomaly (output if ds) no - mean motion nodeo - right ascension of ascending node
outputs : satrec - common values for subsequent calls return code - non-zero on error. 1 - mean elements, ecc >= 1.0 or ecc < -0.001 or a < 0.95 er 2 - mean motion less than 0.0 3 - pert elements, ecc < 0.0 or ecc > 1.0 4 - semi-latus rectum < 0.0 5 - epoch elements are sub-orbital 6 - satellite has decayed
locals : cnodm , snodm , cosim , sinim , cosomm , sinomm cc1sq , cc2 , cc3 coef , coef1 cosio4 - day - dndt - em - eccentricity emsq - eccentricity squared eeta - etasq - gam - argpm - argument of perigee nodem - inclm - inclination mm - mean anomaly nm - mean motion perige - perigee pinvsq - psisq - qzms24 - rtemsq - s1, s2, s3, s4, s5, s6, s7 - sfour - ss1, ss2, ss3, ss4, ss5, ss6, ss7 - sz1, sz2, sz3 sz11, sz12, sz13, sz21, sz22, sz23, sz31, sz32, sz33 - tc - temp - temp1, temp2, temp3 - tsi - xpidot - xhdot1 - z1, z2, z3 - z11, z12, z13, z21, z22, z23, z31, z32, z33 -
coupling : getgravconst- initl - dscom - dpper - dsinit - sgp4 -
references : hoots, roehrich, norad spacetrack report #3 1980 hoots, norad spacetrack report #6 1986 hoots, schumacher and glover 2004
void perturb::sgp4::twoline2rv | ( | char | longstr1[130], |
char | longstr2[130], | ||
char | typerun, | ||
char | typeinput, | ||
char | opsmode, | ||
gravconsttype | whichconst, | ||
double & | startmfe, | ||
double & | stopmfe, | ||
double & | deltamin, | ||
elsetrec & | satrec | ||
) |
function twoline2rv
this function converts the two line element set character string data to variables and initializes the sgp4 variables. several intermediate varaibles and quantities are determined. note that the result is a structure so multiple satellites can be processed simaltaneously without having to reinitialize. the verification mode is an important option that permits quick checks of any changes to the underlying technical theory. this option works using a modified tle file in which the start, stop, and delta time values are included at the end of the second line of data. this only works with the verification mode. the catalog mode simply propagates from -1440 to 1440 min from epoch and is useful when performing entire catalog runs.
author : david vallado 719-573-2600 1 mar 2001
inputs : longstr1 - first line of the tle longstr2 - second line of the tle typerun - type of run verification 'v', catalog 'c', manual 'm' typeinput - type of manual input mfe 'm', epoch 'e', dayofyr 'd' opsmode - mode of operation afspc or improved 'a', 'i' whichconst - which set of constants to use 72, 84
outputs : satrec - structure containing all the sgp4 satellite information
coupling : getgravconst- days2mdhms - conversion of days to month, day, hour, minute, second jday - convert day month year hour minute second into julian date sgp4init - initialize the sgp4 variables
references : norad spacetrack report #3