File indexing completed on 2024-04-21 03:48:42

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2012 Gerhard HOLTKAMP
0004 //
0005 
0006 #if !defined(__planetarysats_h)
0007 #define __planetarysats_h
0008 
0009 #include "attlib.h"
0010 #include "astrolib_export.h"
0011 
0012 class ASTROLIB_EXPORT PlanetarySats     // Calculate spacecraft around other planets
0013 {
0014   public:
0015     PlanetarySats();
0016     ~PlanetarySats();
0017 
0018     void setStepWidth(double s);  // set the step width (seconds)
0019     void setDeltaTAI_UTC(double d);  // set IERS Parameter TAI - UTC
0020     void setAutoTAI_UTC();  // IERS Parameter TAI - UTC to auto
0021     void getTime ();  // Get System Time and Date
0022     void setDeltaRT(double drt);
0023     void setMJD(int year, int month, int day, int hour, int min, double sec);// set time
0024     static void getDatefromMJD(double mjd, int &year, int &month, int &day, int &hour, int &min, double &sec);
0025     void setSatFile(char* fname);
0026     void setPlanet(char* pname);
0027     int selectSat(char* sname);
0028     void getSatName(char* sname) const;
0029     void setStateVector(double mjd, double x, double y, double z, double vx, double vy, double vz);
0030     int getStateVector(int nsat);
0031     void stateToKepler();
0032     void getKeplerElements(double &perc, double &apoc, double &inc, double &ecc, double &ra, double &tano, double &m0, double &a, double &n0);
0033     void getPlanetographic(double &lng, double &lat, double &height) const;
0034     void getFixedFrame(double &x, double &y, double &z, double &vx, double &vy, double &vz);
0035     void currentPos();
0036     void nextStep();
0037     double getLastMJD() const;
0038 
0039   private:  
0040     void plsatinit();  // initialize PlanetarySats
0041     static double atan23 (double y, double x);  // atan without singularity for x,y=0
0042     void getMercury();
0043     void getVenus();
0044     void getMoon();
0045     void getMars();
0046     void getSatPos (double t);
0047     static Mat3 getSelenographic (double jd);
0048 
0049    // data fields
0050       
0051       char pls_satelmfl[205];  // name of file for satellite state vectors
0052       char pls_satname[40];  // name of satellite
0053       char pls_plntname[40]; // name of planet
0054 
0055       bool pls_moonflg;  // true if Moon, false if other body
0056 
0057       int pls_day;           // date
0058       int pls_month;
0059       int pls_year;
0060       int pls_hour;
0061       int pls_minute;
0062       int pls_second;
0063       double pls_time;     // current time in MJD (UTC)
0064       double pls_del_tdut;   // TDT - UT in sec
0065       int pls_del_auto;      // 1 = automatic del_tdut,  0 = manual
0066       double pls_step;       // stepwidth in sec
0067       double pls_delta_rt;   // delta time to R/T in hours
0068       
0069       double pls_tepoch;  // MJD epoch of state vector (TT)
0070       Vec3 pls_rep;  // state vector km and km/s
0071       Vec3 pls_vep;
0072       
0073       double pls_ra; // Right Ascension
0074       double pls_per; // argument of perige center
0075       double pls_m0;  // mean anomaly
0076       double pls_ecc; // eccentricity
0077       double pls_inc; // inclination
0078       double pls_a;  // semi-major axis (km)
0079       double pls_n0;  // mean motion  (rev/day)
0080       
0081       double pls_GM;  // graviatational constant (m^3/s^2)
0082       double pls_J2;  // J2 gravitational term
0083       double pls_R0; // equatorial radius (km)
0084       double pls_flat;  // flattening factor
0085       double pls_axl0;  // l-direction of rotation axis
0086       double pls_axl1;  // delta of axl0
0087       double pls_axb0;  // b-direction of rotation axis
0088       double pls_axb1;  // delta of axb0
0089       double pls_W;    // location of prime meridian
0090       double pls_Wd;   // daily variation of W.
0091 
0092       Vec3 pls_r;  // current state vector  m and m/s
0093       Vec3 pls_v;     
0094       double pls_lat;  // planetary latitude (decimal degrees)
0095       double pls_lng;  // planetary longitude (decimal degrees)
0096       double pls_height; // height above reference ellipsoid (km)    
0097 };
0098 
0099 #endif         // __planetarysats_h sentry.
0100