Kstars

satellite.h
1 /*
2  SPDX-FileCopyrightText: 2009 Jerome SONRIER <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "skyobject.h"
10 
11 #include <QString>
12 
13 class KSPopupMenu;
14 
15 /**
16  * @class Satellite
17  * Represents an artificial satellites.
18  *
19  * @author Jérôme SONRIER
20  * @version 0.1
21  */
22 class Satellite : public SkyObject
23 {
24  public:
25  /** @short Constructor */
26  Satellite(const QString &name, const QString &line1, const QString &line2);
27 
28  /**
29  * @return a clone of this object
30  * @note See SkyObject::clone()
31  */
32  Satellite *clone() const override;
33 
34  /** @short Destructor */
35  virtual ~Satellite() override = default;
36 
37  /** @short Update satellite position */
38  int updatePos();
39 
40  /**
41  * @return True if the satellite is visible (above horizon, in the sunlight and sun at least 12° under horizon)
42  */
43  bool isVisible();
44 
45  /** @return True if the satellite is selected */
46  bool selected();
47 
48  /** @short Select or not the satellite */
49  void setSelected(bool selected);
50 
51  /** @return Satellite velocity in km/s */
52  double velocity() const;
53 
54  /** @return Satellite altitude in km */
55  double altitude() const;
56 
57  /** @return Satellite range from observer in km */
58  double range() const;
59 
60  /** @return Satellite international designator */
61  QString id() const;
62 
63  /** @return Satellite TLE */
64  QString tle() const;
65 
66  /**
67  * @brief sgp4ErrorString Get error string associated with sgp4 calculation failure
68  * @param code error code as returned from sgp4() function
69  * @return error string
70  */
71  QString sgp4ErrorString(int code);
72 
73  void initPopupMenu(KSPopupMenu *pmenu) override;
74 
75  private:
76  /** @short Compute non time dependent parameters */
77  void init();
78 
79  /** @short Compute satellite position */
80  int sgp4(double tsince);
81 
82  /** @return Arcsine of the argument */
83  double arcSin(double arg);
84 
85  /**
86  * Provides the difference between UT (approximately the same as UTC)
87  * and ET (now referred to as TDT).
88  * This function is based on a least squares fit of data from 1950
89  * to 1991 and will need to be updated periodically.
90  */
91  double deltaET(double year);
92 
93  /** @return arg1 mod arg2 */
94  double Modulus(double arg1, double arg2);
95 
96  // TLE
97  /// Satellite Number
98  int m_number { 0 };
99  /// Security Classification
100  QChar m_class;
101  /// International Designator
102  QString m_id;
103  /// Complete TLE
104  QString m_tle;
105  /// Epoch Year
106  double m_epoch_year { 0 };
107  /// Epoch (Day of the year and fractional portion of the day)
108  double m_epoch { 0 };
109  /// First Time Derivative of the Mean Motion
110  double m_first_deriv { 0 };
111  /// Second Time Derivative of Mean Motion
112  double m_second_deriv { 0 };
113  /// BSTAR drag term (decimal point assumed)
114  double m_bstar { 0 };
115  /// Ephemeris type
116  int m_ephem_type { 0 };
117  /// Element number
118  int m_elem_number { 0 };
119  /// Inclination [Radians]
120  double m_inclination { 0 };
121  /// Right Ascension of the Ascending Node [Radians]
122  double m_ra { 0 };
123  /// Eccentricity
124  double m_eccentricity { 0 };
125  /// Argument of Perigee [Radians]
126  double m_arg_perigee { 0 };
127  /// Mean Anomaly [Radians]
128  double m_mean_anomaly { 0 };
129  /// Mean Motion [Radians per minutes]
130  double m_mean_motion { 0 };
131  /// Revolution number at epoch [Revs]
132  int m_nb_revolution { 0 };
133  /// TLE epoch converted to julian date
134  double m_tle_jd { 0 };
135 
136  // Satellite
137  /// True if the satellite is visible
138  bool m_is_visible { false };
139  /// True if the satellite is in the shadow of the earth
140  bool m_is_eclipsed { false };
141  /// True if the satellite is selected
142  bool m_is_selected { false };
143  /// Satellite velocity in km/s
144  double m_velocity { 0 };
145  /// Satellite altitude in km
146  double m_altitude { 0 };
147  /// Satellite range from observer in km
148  double m_range { 0 };
149 
150  // Near Earth
151  bool isimp { false };
152  double aycof { 0 }, con41 { 0 }, cc1 { 0 }, cc4 { 0 }, cc5 { 0 }, d2 { 0 }, d3 { 0 }, d4 { 0 };
153  double delmo { 0 }, eta { 0 }, argpdot { 0 }, omgcof { 0 }, sinmao { 0 }, t { 0 }, t2cof { 0 };
154  double t3cof { 0 }, t4cof { 0 }, t5cof { 0 }, x1mth2 { 0 }, x7thm1 { 0 }, mdot { 0 };
155  double nodedot { 0 }, xlcof { 0 }, xmcof { 0 }, nodecf { 0 };
156 
157  // Deep Space
158  int irez { 0 };
159  double d2201 { 0 }, d2211 { 0 }, d3210 { 0 }, d3222 { 0 }, d4410 { 0 }, d4422 { 0 }, d5220 { 0 };
160  double d5232 { 0 }, d5421 { 0 }, d5433 { 0 }, dedt { 0 }, del1 { 0 }, del2 { 0 }, del3 { 0 };
161  double didt { 0 }, dmdt { 0 }, dnodt { 0 }, domdt { 0 }, e3 { 0 }, ee2 { 0 }, peo { 0 };
162  double pgho { 0 }, pho { 0 }, pinco { 0 }, plo { 0 }, se2 { 0 }, se3 { 0 }, sgh2 { 0 };
163  double sgh3 { 0 }, sgh4 { 0 }, sh2 { 0 }, sh3 { 0 }, si2 { 0 }, si3 { 0 }, sl2 { 0 }, sl3 { 0 };
164  double sl4 { 0 }, gsto { 0 }, xfact { 0 }, xgh2 { 0 }, xgh3 { 0 }, xgh4 { 0 }, xh2 { 0 };
165  double xh3 { 0 }, xi2 { 0 }, xi3 { 0 }, xl2 { 0 }, xl3 { 0 }, xl4 { 0 }, xlamo { 0 }, zmol { 0 };
166  double zmos { 0 }, atime { 0 }, xli { 0 }, xni { 0 };
167 
168  char method;
169 };
bool isVisible()
Definition: satellite.cpp:1294
Satellite * clone() const override
Definition: satellite.cpp:96
QString id() const
Definition: satellite.cpp:1333
void initPopupMenu(KSPopupMenu *pmenu) override
Initialize the popup menut.
Definition: satellite.cpp:1309
double altitude() const
Definition: satellite.cpp:1323
virtual QString name(void) const
Definition: skyobject.h:145
Satellite(const QString &name, const QString &line1, const QString &line2)
Constructor.
Definition: satellite.cpp:48
bool selected()
Definition: satellite.cpp:1299
double velocity() const
Definition: satellite.cpp:1318
double range() const
Definition: satellite.cpp:1328
QString tle() const
Definition: satellite.cpp:1338
QString sgp4ErrorString(int code)
sgp4ErrorString Get error string associated with sgp4 calculation failure
Definition: satellite.cpp:1232
void setSelected(bool selected)
Select or not the satellite.
Definition: satellite.cpp:1304
int updatePos()
Update satellite position.
Definition: satellite.cpp:706
virtual ~Satellite() override=default
Destructor.
Information about an object in the sky.
Definition: skyobject.h:41
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Sep 21 2023 04:05:28 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.