Remove unnecessary virtual destructor. Correct doxygen comments. Adjust formatting.
parent
faf87bed0d
commit
7cf5e6496b
|
@ -3234,9 +3234,9 @@ fi
|
|||
|
||||
|
||||
if test x$enable_debug = xyes; then
|
||||
AM_CXXFLAGS="-g -O0 -Werror -Wextra -W -Wall -Wconversion"
|
||||
AM_CXXFLAGS="-g -O0 -Wextra -W -Wall -Wconversion -std=c++11"
|
||||
else
|
||||
AM_CXXFLAGS="-DNDEBUG -O2 -fomit-frame-pointer -Wextra -Werror -W -Wall -Wconversion"
|
||||
AM_CXXFLAGS="-DNDEBUG -O2 -fomit-frame-pointer -Wextra -W -Wall -Wconversion -std=c++11"
|
||||
fi
|
||||
|
||||
ac_ext=c
|
||||
|
|
|
@ -19,9 +19,9 @@ AC_ARG_ENABLE(debug,
|
|||
enable_debug=no)
|
||||
|
||||
if test x$enable_debug = xyes; then
|
||||
AM_CXXFLAGS="-g -O0 -Werror -Wextra -W -Wall -Wconversion"
|
||||
AM_CXXFLAGS="-g -O0 -Wextra -W -Wall -Wconversion -std=c++11"
|
||||
else
|
||||
AM_CXXFLAGS="-DNDEBUG -O2 -fomit-frame-pointer -Wextra -Werror -W -Wall -Wconversion"
|
||||
AM_CXXFLAGS="-DNDEBUG -O2 -fomit-frame-pointer -Wextra -W -Wall -Wconversion -std=c++11"
|
||||
fi
|
||||
|
||||
AC_SEARCH_LIBS([clock_gettime],
|
||||
|
|
|
@ -79,13 +79,6 @@ public:
|
|||
altitude = geo.altitude;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~CoordGeodetic()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Assignment operator
|
||||
* @param[in] geo object to copy from
|
||||
|
@ -158,8 +151,8 @@ private:
|
|||
|
||||
/**
|
||||
* Dump a Coordgeodetic to a stream
|
||||
* @params[in,out] strm stream to output to
|
||||
* @params[in] g the CoordGeodetic to print
|
||||
* @param[in,out] strm stream to output to
|
||||
* @param[in] g the CoordGeodetic to print
|
||||
*/
|
||||
inline std::ostream& operator<<(std::ostream& strm, const CoordGeodetic& g)
|
||||
{
|
||||
|
|
|
@ -31,17 +31,17 @@
|
|||
* Azimuth and elevation are stored in radians. Range in kilometres. Range
|
||||
* rate in kilometres/second.
|
||||
*/
|
||||
struct CoordTopocentric
|
||||
struct CoordTopocentric final
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
CoordTopocentric()
|
||||
: azimuth(0.0),
|
||||
elevation(0.0),
|
||||
range(0.0),
|
||||
range_rate(0.0)
|
||||
: azimuth(0.0)
|
||||
, elevation(0.0)
|
||||
, range(0.0)
|
||||
, range_rate(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -57,10 +57,10 @@ public:
|
|||
double el,
|
||||
double rnge,
|
||||
double rnge_rate)
|
||||
: azimuth(az),
|
||||
elevation(el),
|
||||
range(rnge),
|
||||
range_rate(rnge_rate)
|
||||
: azimuth(az)
|
||||
, elevation(el)
|
||||
, range(rnge)
|
||||
, range_rate(rnge_rate)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -76,13 +76,6 @@ public:
|
|||
range_rate = topo.range_rate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~CoordTopocentric()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Assignment operator
|
||||
* @param[in] topo object to copy from
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <cstdint>
|
||||
#include "TimeSpan.h"
|
||||
#include "Util.h"
|
||||
|
||||
|
@ -57,7 +58,7 @@ public:
|
|||
* Constructor
|
||||
* @param[in] ticks raw tick value
|
||||
*/
|
||||
DateTime(unsigned long long ticks)
|
||||
DateTime(int64_t ticks)
|
||||
: m_encoded(ticks)
|
||||
{
|
||||
}
|
||||
|
@ -67,9 +68,10 @@ public:
|
|||
* @param[in] year the year
|
||||
* @param[in] doy the day of the year
|
||||
*/
|
||||
DateTime(int year, double doy)
|
||||
DateTime(unsigned int year, double doy)
|
||||
{
|
||||
m_encoded = TimeSpan(static_cast<long long int>(AbsoluteDays(year, doy) * TicksPerDay)).Ticks();
|
||||
m_encoded = TimeSpan(
|
||||
static_cast<int64_t>(AbsoluteDays(year, doy) * TicksPerDay)).Ticks();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -298,10 +300,9 @@ public:
|
|||
/**
|
||||
*
|
||||
*/
|
||||
double AbsoluteDays(int year, double doy) const
|
||||
double AbsoluteDays(unsigned int year, double doy) const
|
||||
{
|
||||
|
||||
int previousYear = year - 1;
|
||||
int64_t previousYear = year - 1;
|
||||
|
||||
/*
|
||||
* + days in previous years ignoring leap days
|
||||
|
@ -309,10 +310,10 @@ public:
|
|||
* - minus prior century years
|
||||
* + plus prior years divisible by 400 days
|
||||
*/
|
||||
long long daysSoFar = 365 * previousYear
|
||||
+ previousYear / 4
|
||||
- previousYear / 100
|
||||
+ previousYear / 400;
|
||||
int64_t daysSoFar = 365 * previousYear
|
||||
+ previousYear / 4LL
|
||||
- previousYear / 100LL
|
||||
+ previousYear / 400LL;
|
||||
|
||||
return static_cast<double>(daysSoFar) + doy - 1.0;
|
||||
}
|
||||
|
@ -441,11 +442,11 @@ public:
|
|||
|
||||
DateTime AddMicroseconds(const double microseconds) const
|
||||
{
|
||||
long long ticks = static_cast<long long>(microseconds * TicksPerMicrosecond);
|
||||
int64_t ticks = static_cast<int64_t>(microseconds * TicksPerMicrosecond);
|
||||
return AddTicks(ticks);
|
||||
}
|
||||
|
||||
DateTime AddTicks(long long ticks) const
|
||||
DateTime AddTicks(int64_t ticks) const
|
||||
{
|
||||
return DateTime(m_encoded + ticks);
|
||||
}
|
||||
|
@ -454,7 +455,7 @@ public:
|
|||
* Get the number of ticks
|
||||
* @returns the number of ticks
|
||||
*/
|
||||
long long Ticks() const
|
||||
int64_t Ticks() const
|
||||
{
|
||||
return m_encoded;
|
||||
}
|
||||
|
@ -646,7 +647,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
unsigned long long m_encoded;
|
||||
int64_t m_encoded;
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& strm, const DateTime& dt)
|
||||
|
@ -656,24 +657,12 @@ inline std::ostream& operator<<(std::ostream& strm, const DateTime& dt)
|
|||
|
||||
inline DateTime operator+(const DateTime& dt, TimeSpan ts)
|
||||
{
|
||||
long long int res = dt.Ticks() + ts.Ticks();
|
||||
if (res < 0 || res > MaxValueTicks)
|
||||
{
|
||||
throw 1;
|
||||
}
|
||||
|
||||
return DateTime(res);
|
||||
return DateTime(dt.Ticks() + ts.Ticks());
|
||||
}
|
||||
|
||||
inline DateTime operator-(const DateTime& dt, const TimeSpan& ts)
|
||||
{
|
||||
long long int res = dt.Ticks() - ts.Ticks();
|
||||
if (res < 0 || res > MaxValueTicks)
|
||||
{
|
||||
throw 1;
|
||||
}
|
||||
|
||||
return DateTime(res);
|
||||
return DateTime(dt.Ticks() - ts.Ticks());
|
||||
}
|
||||
|
||||
inline TimeSpan operator-(const DateTime& dt1, const DateTime& dt2)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
#include "DecayedException.h"
|
||||
|
||||
DecayedException::~DecayedException()
|
||||
{
|
||||
}
|
|
@ -21,12 +21,13 @@
|
|||
#include "DateTime.h"
|
||||
#include "Vector.h"
|
||||
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
/**
|
||||
* @brief The exception that the SGP4 class throws when a satellite decays.
|
||||
*/
|
||||
class DecayedException : public std::exception
|
||||
class DecayedException : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -36,24 +37,16 @@ public:
|
|||
* @param[in] vel velocity of the satellite at dt
|
||||
*/
|
||||
DecayedException(const DateTime& dt, const Vector& pos, const Vector& vel)
|
||||
: _dt(dt), _pos(pos), _vel(vel)
|
||||
: runtime_error("Satellite decayed")
|
||||
, _dt(dt)
|
||||
, _pos(pos)
|
||||
, _vel(vel)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~DecayedException(void) throw ()
|
||||
{
|
||||
}
|
||||
DecayedException(const DecayedException&) = default;
|
||||
|
||||
/**
|
||||
* @returns the error string
|
||||
*/
|
||||
virtual const char* what() const throw ()
|
||||
{
|
||||
return "Error: Satellite decayed";
|
||||
}
|
||||
virtual ~DecayedException();
|
||||
|
||||
/**
|
||||
* @returns the date
|
||||
|
|
|
@ -54,11 +54,11 @@ public:
|
|||
|
||||
/**
|
||||
* @param[in] dt the date to be used for this position
|
||||
* @param[in] position
|
||||
* @param[in] position the position
|
||||
*/
|
||||
Eci(const DateTime &dt, const Vector &position)
|
||||
: m_dt(dt),
|
||||
m_position(position)
|
||||
: m_dt(dt)
|
||||
, m_position(position)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -68,16 +68,9 @@ public:
|
|||
* @param[in] velocity the velocity
|
||||
*/
|
||||
Eci(const DateTime &dt, const Vector &position, const Vector &velocity)
|
||||
: m_dt(dt),
|
||||
m_position(position),
|
||||
m_velocity(velocity)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~Eci()
|
||||
: m_dt(dt)
|
||||
, m_position(position)
|
||||
, m_velocity(velocity)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,9 @@ libsgp4_a_SOURCES = \
|
|||
Globals.cpp \
|
||||
Observer.cpp \
|
||||
OrbitalElements.cpp \
|
||||
DecayedException.cpp \
|
||||
SatelliteException.cpp \
|
||||
TleException.cpp \
|
||||
SGP4.cpp \
|
||||
SolarPosition.cpp \
|
||||
TimeSpan.cpp \
|
||||
|
@ -14,7 +17,7 @@ libsgp4_a_SOURCES = \
|
|||
Util.cpp \
|
||||
Vector.cpp
|
||||
|
||||
include_HEADERS = \
|
||||
include_HEADERS = \
|
||||
CoordGeodetic.h \
|
||||
CoordTopocentric.h \
|
||||
DateTime.h \
|
||||
|
|
|
@ -102,8 +102,10 @@ libsgp4_a_LIBADD =
|
|||
am_libsgp4_a_OBJECTS = CoordGeodetic.$(OBJEXT) \
|
||||
CoordTopocentric.$(OBJEXT) DateTime.$(OBJEXT) Eci.$(OBJEXT) \
|
||||
Globals.$(OBJEXT) Observer.$(OBJEXT) OrbitalElements.$(OBJEXT) \
|
||||
SGP4.$(OBJEXT) SolarPosition.$(OBJEXT) TimeSpan.$(OBJEXT) \
|
||||
Tle.$(OBJEXT) Util.$(OBJEXT) Vector.$(OBJEXT)
|
||||
DecayedException.$(OBJEXT) SatelliteException.$(OBJEXT) \
|
||||
TleException.$(OBJEXT) SGP4.$(OBJEXT) SolarPosition.$(OBJEXT) \
|
||||
TimeSpan.$(OBJEXT) Tle.$(OBJEXT) Util.$(OBJEXT) \
|
||||
Vector.$(OBJEXT)
|
||||
libsgp4_a_OBJECTS = $(am_libsgp4_a_OBJECTS)
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
|
@ -233,6 +235,9 @@ libsgp4_a_SOURCES = \
|
|||
Globals.cpp \
|
||||
Observer.cpp \
|
||||
OrbitalElements.cpp \
|
||||
DecayedException.cpp \
|
||||
SatelliteException.cpp \
|
||||
TleException.cpp \
|
||||
SGP4.cpp \
|
||||
SolarPosition.cpp \
|
||||
TimeSpan.cpp \
|
||||
|
@ -337,14 +342,17 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoordGeodetic.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CoordTopocentric.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DateTime.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DecayedException.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Eci.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Globals.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Observer.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OrbitalElements.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SGP4.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SatelliteException.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SolarPosition.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TimeSpan.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Tle.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TleException.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Util.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Vector.Po@am__quote@
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ public:
|
|||
Observer(const double latitude,
|
||||
const double longitude,
|
||||
const double altitude)
|
||||
: m_geo(latitude, longitude, altitude),
|
||||
m_eci(DateTime(), m_geo)
|
||||
: m_geo(latitude, longitude, altitude)
|
||||
, m_eci(DateTime(), m_geo)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -49,15 +49,8 @@ public:
|
|||
* @param[in] geo the observers position
|
||||
*/
|
||||
Observer(const CoordGeodetic &geo)
|
||||
: m_geo(geo),
|
||||
m_eci(DateTime(), geo)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~Observer()
|
||||
: m_geo(geo)
|
||||
, m_eci(DateTime(), geo)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -31,10 +31,6 @@ class OrbitalElements
|
|||
public:
|
||||
OrbitalElements(const Tle& tle);
|
||||
|
||||
virtual ~OrbitalElements()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* XMO
|
||||
*/
|
||||
|
|
|
@ -215,8 +215,6 @@ void SGP4::Initialise()
|
|||
}
|
||||
}
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
Eci SGP4::FindPosition(const DateTime& dt) const
|
||||
{
|
||||
return FindPosition((dt - elements_.Epoch()).TotalMinutes());
|
||||
|
@ -433,23 +431,6 @@ Eci SGP4::FindPositionSGP4(double tsince) const
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param[in] tsince
|
||||
* @param[in] e
|
||||
* @param[in] a
|
||||
* @param[in] omega
|
||||
* @param[in] xl
|
||||
* @param[in] xnode
|
||||
* @param[in] xincl
|
||||
* @param[in] xlcof
|
||||
* @param[in] aycof
|
||||
* @param[in] x3thml
|
||||
* @param[in] x1mth2
|
||||
* @param[in] x7thm1
|
||||
* @param[in] cosio
|
||||
* @param[in] sinio
|
||||
* @returns Eci result
|
||||
*/
|
||||
Eci SGP4::CalculateFinalPositionVelocity(
|
||||
const double tsince,
|
||||
const double e,
|
||||
|
@ -633,14 +614,6 @@ Eci SGP4::CalculateFinalPositionVelocity(
|
|||
return Eci(elements_.Epoch().AddMinutes(tsince), position, velocity);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param[in] x
|
||||
* @param[in] constant
|
||||
* @param[in] linear
|
||||
* @param[in] squared
|
||||
* @param[in] cubed
|
||||
* @returns result
|
||||
*/
|
||||
static inline double EvaluateCubicPolynomial(
|
||||
const double x,
|
||||
const double constant,
|
||||
|
@ -651,18 +624,6 @@ static inline double EvaluateCubicPolynomial(
|
|||
return constant + x * (linear + x * (squared + x * cubed));
|
||||
}
|
||||
|
||||
/**
|
||||
* Deep space initialisation
|
||||
* @param[in] eosq
|
||||
* @param[in] sinio
|
||||
* @param[in] cosio
|
||||
* @param[in] betao
|
||||
* @param[in] theta2
|
||||
* @param[in] betao2
|
||||
* @param[in] xmdot
|
||||
* @param[in] omgdot
|
||||
* @param[in] xnodot
|
||||
*/
|
||||
void SGP4::DeepSpaceInitialise(
|
||||
const double eosq,
|
||||
const double sinio,
|
||||
|
@ -1073,15 +1034,6 @@ void SGP4::DeepSpaceInitialise(
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate lunar / solar terms
|
||||
* @param[in] tsince
|
||||
* @param[out] pe
|
||||
* @param[out] pinc
|
||||
* @param[out] pl
|
||||
* @param[out] pgh
|
||||
* @param[out] ph
|
||||
*/
|
||||
void SGP4::DeepSpaceCalculateLunarSolarTerms(
|
||||
const double tsince,
|
||||
double& pe,
|
||||
|
@ -1149,15 +1101,6 @@ void SGP4::DeepSpaceCalculateLunarSolarTerms(
|
|||
ph = shs + shl;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate lunar / solar periodics and apply
|
||||
* @param[in] tsince
|
||||
* @param[in,out] em
|
||||
* @param[in,out] xinc
|
||||
* @param[in,out] omgasm
|
||||
* @param[in,out] xnodes
|
||||
* @param[in,out] xll
|
||||
*/
|
||||
void SGP4::DeepSpacePeriodics(
|
||||
const double tsince,
|
||||
double& em,
|
||||
|
@ -1261,16 +1204,6 @@ void SGP4::DeepSpacePeriodics(
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Deep space secular effects
|
||||
* @param[in] tsince
|
||||
* @param[in,out] xll
|
||||
* @param[in,out] omgasm
|
||||
* @param[in,out] xnodes
|
||||
* @param[in,out] em
|
||||
* @param[in,out] xinc
|
||||
* @param[in,out] xn
|
||||
*/
|
||||
void SGP4::DeepSpaceSecular(
|
||||
const double tsince,
|
||||
double& xll,
|
||||
|
@ -1372,10 +1305,6 @@ void SGP4::DeepSpaceSecular(
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate dot terms
|
||||
* @param[in,out] the integrator values
|
||||
*/
|
||||
void SGP4::DeepSpaceCalcDotTerms(struct IntegratorValues& values) const
|
||||
{
|
||||
static const double G22 = 5.7686396;
|
||||
|
@ -1455,12 +1384,6 @@ void SGP4::DeepSpaceCalcDotTerms(struct IntegratorValues& values) const
|
|||
values.xnddt *= values.xldot;
|
||||
}
|
||||
|
||||
/*
|
||||
* Deep space integrator for time period of delt
|
||||
* @param[in] delt
|
||||
* @param[in] step2
|
||||
* @param[in] values
|
||||
*/
|
||||
void SGP4::DeepSpaceIntegrator(
|
||||
const double delt,
|
||||
const double step2,
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
/**
|
||||
* @brief The simplified perturbations model 4 propagater.
|
||||
*/
|
||||
class SGP4
|
||||
class SGP4 final
|
||||
{
|
||||
public:
|
||||
SGP4(const Tle& tle)
|
||||
|
@ -42,10 +42,6 @@ public:
|
|||
Initialise();
|
||||
}
|
||||
|
||||
virtual ~SGP4()
|
||||
{
|
||||
}
|
||||
|
||||
void SetTle(const Tle& tle);
|
||||
Eci FindPosition(double tsince) const;
|
||||
Eci FindPosition(const DateTime& date) const;
|
||||
|
@ -91,16 +87,7 @@ private:
|
|||
double gsto;
|
||||
double zmol;
|
||||
double zmos;
|
||||
/*
|
||||
* whether the deep space orbit is
|
||||
* geopotential resonance for 12 hour orbits
|
||||
*/
|
||||
bool resonance_flag;
|
||||
/*
|
||||
* whether the deep space orbit is
|
||||
* 24h synchronous resonance
|
||||
*/
|
||||
bool synchronous_flag;
|
||||
|
||||
/*
|
||||
* lunar / solar constants for epoch
|
||||
* applied during DeepSpaceSecular()
|
||||
|
@ -154,6 +141,16 @@ private:
|
|||
double del1;
|
||||
double del2;
|
||||
double del3;
|
||||
/*
|
||||
* whether the deep space orbit is
|
||||
* geopotential resonance for 12 hour orbits
|
||||
*/
|
||||
bool resonance_flag;
|
||||
/*
|
||||
* whether the deep space orbit is
|
||||
* 24h synchronous resonance
|
||||
*/
|
||||
bool synchronous_flag;
|
||||
};
|
||||
|
||||
struct IntegratorValues
|
||||
|
@ -209,6 +206,9 @@ private:
|
|||
const double x7thm1,
|
||||
const double cosio,
|
||||
const double sinio) const;
|
||||
/**
|
||||
* Deep space initialisation
|
||||
*/
|
||||
void DeepSpaceInitialise(
|
||||
const double eosq,
|
||||
const double sinio,
|
||||
|
@ -219,6 +219,9 @@ private:
|
|||
const double xmdot,
|
||||
const double omgdot,
|
||||
const double xnodot);
|
||||
/*
|
||||
* Calculate lunar / solar terms
|
||||
*/
|
||||
void DeepSpaceCalculateLunarSolarTerms(
|
||||
const double tsince,
|
||||
double& pe,
|
||||
|
@ -226,6 +229,9 @@ private:
|
|||
double& pl,
|
||||
double& pgh,
|
||||
double& ph) const;
|
||||
/**
|
||||
* Calculate lunar / solar periodics and apply
|
||||
*/
|
||||
void DeepSpacePeriodics(
|
||||
const double tsince,
|
||||
double& em,
|
||||
|
@ -233,6 +239,9 @@ private:
|
|||
double& omgasm,
|
||||
double& xnodes,
|
||||
double& xll) const;
|
||||
/**
|
||||
* Deep space secular effects
|
||||
*/
|
||||
void DeepSpaceSecular(
|
||||
const double tsince,
|
||||
double& xll,
|
||||
|
@ -241,19 +250,20 @@ private:
|
|||
double& em,
|
||||
double& xinc,
|
||||
double& xn) const;
|
||||
/**
|
||||
* Calculate dot terms
|
||||
* @param[in,out] values the integrator values
|
||||
*/
|
||||
void DeepSpaceCalcDotTerms(struct IntegratorValues& values) const;
|
||||
/**
|
||||
* Deep space integrator for time period of delt
|
||||
*/
|
||||
void DeepSpaceIntegrator(
|
||||
const double delt,
|
||||
const double step2,
|
||||
const struct IntegratorValues& values) const;
|
||||
void Reset();
|
||||
|
||||
/*
|
||||
* flags
|
||||
*/
|
||||
bool use_simple_model_;
|
||||
bool use_deep_space_;
|
||||
|
||||
/*
|
||||
* the constants used
|
||||
*/
|
||||
|
@ -268,6 +278,12 @@ private:
|
|||
*/
|
||||
OrbitalElements elements_;
|
||||
|
||||
/*
|
||||
* flags
|
||||
*/
|
||||
bool use_simple_model_;
|
||||
bool use_deep_space_;
|
||||
|
||||
static const struct SGP4::CommonConstants Empty_CommonConstants;
|
||||
static const struct SGP4::NearSpaceConstants Empty_NearSpaceConstants;
|
||||
static const struct SGP4::DeepSpaceConstants Empty_DeepSpaceConstants;
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
#include "SatelliteException.h"
|
||||
|
||||
SatelliteException::~SatelliteException()
|
||||
{
|
||||
}
|
|
@ -18,30 +18,23 @@
|
|||
#ifndef SATELLITEEXCEPTION_H_
|
||||
#define SATELLITEEXCEPTION_H_
|
||||
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
/**
|
||||
* @brief The exception that the SGP4 class throws upon an error.
|
||||
*/
|
||||
class SatelliteException : public std::exception
|
||||
class SatelliteException : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
SatelliteException(const char* message)
|
||||
: message_(message)
|
||||
: runtime_error(message)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~SatelliteException(void) throw ()
|
||||
{
|
||||
}
|
||||
SatelliteException(const SatelliteException&) = default;
|
||||
|
||||
virtual const char* what() const throw ()
|
||||
{
|
||||
return message_.c_str();
|
||||
}
|
||||
|
||||
private:
|
||||
std::string message_;
|
||||
virtual ~SatelliteException();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -31,10 +31,6 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual ~SolarPosition()
|
||||
{
|
||||
}
|
||||
|
||||
Eci FindPosition(const DateTime& dt);
|
||||
|
||||
private:
|
||||
|
|
|
@ -22,22 +22,23 @@
|
|||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
|
||||
namespace
|
||||
{
|
||||
static const long long TicksPerDay = 86400000000LL;
|
||||
static const long long TicksPerHour = 3600000000LL;
|
||||
static const long long TicksPerMinute = 60000000LL;
|
||||
static const long long TicksPerSecond = 1000000LL;
|
||||
static const long long TicksPerMillisecond = 1000LL;
|
||||
static const long long TicksPerMicrosecond = 1LL;
|
||||
static const int64_t TicksPerDay = 86400000000LL;
|
||||
static const int64_t TicksPerHour = 3600000000LL;
|
||||
static const int64_t TicksPerMinute = 60000000LL;
|
||||
static const int64_t TicksPerSecond = 1000000LL;
|
||||
static const int64_t TicksPerMillisecond = 1000LL;
|
||||
static const int64_t TicksPerMicrosecond = 1LL;
|
||||
|
||||
static const long long UnixEpoch = 62135596800000000LL;
|
||||
static const int64_t UnixEpoch = 62135596800000000LL;
|
||||
|
||||
static const long long MaxValueTicks = 315537897599999999LL;
|
||||
static const int64_t MaxValueTicks = 315537897599999999LL;
|
||||
|
||||
// 1582-Oct-15
|
||||
static const long long GregorianStart = 49916304000000000LL;
|
||||
static const int64_t GregorianStart = 49916304000000000LL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,7 +51,7 @@ namespace
|
|||
class TimeSpan
|
||||
{
|
||||
public:
|
||||
TimeSpan(long long ticks)
|
||||
TimeSpan(int64_t ticks)
|
||||
: m_ticks(ticks)
|
||||
{
|
||||
}
|
||||
|
@ -130,7 +131,7 @@ public:
|
|||
return static_cast<int>(m_ticks % TicksPerSecond / TicksPerMicrosecond);
|
||||
}
|
||||
|
||||
long long Ticks() const
|
||||
int64_t Ticks() const
|
||||
{
|
||||
return m_ticks;
|
||||
}
|
||||
|
@ -194,7 +195,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
long long m_ticks;
|
||||
int64_t m_ticks;
|
||||
|
||||
void CalculateTicks(int days,
|
||||
int hours,
|
||||
|
|
|
@ -25,9 +25,9 @@ namespace
|
|||
static const unsigned int TLE1_LEN_NORADNUM = 5;
|
||||
static const unsigned int TLE1_COL_INTLDESC_A = 9;
|
||||
static const unsigned int TLE1_LEN_INTLDESC_A = 2;
|
||||
static const unsigned int TLE1_COL_INTLDESC_B = 11;
|
||||
// static const unsigned int TLE1_COL_INTLDESC_B = 11;
|
||||
static const unsigned int TLE1_LEN_INTLDESC_B = 3;
|
||||
static const unsigned int TLE1_COL_INTLDESC_C = 14;
|
||||
// static const unsigned int TLE1_COL_INTLDESC_C = 14;
|
||||
static const unsigned int TLE1_LEN_INTLDESC_C = 3;
|
||||
static const unsigned int TLE1_COL_EPOCH_A = 18;
|
||||
static const unsigned int TLE1_LEN_EPOCH_A = 2;
|
||||
|
@ -39,10 +39,10 @@ namespace
|
|||
static const unsigned int TLE1_LEN_MEANMOTIONDDT6 = 8;
|
||||
static const unsigned int TLE1_COL_BSTAR = 53;
|
||||
static const unsigned int TLE1_LEN_BSTAR = 8;
|
||||
static const unsigned int TLE1_COL_EPHEMTYPE = 62;
|
||||
static const unsigned int TLE1_LEN_EPHEMTYPE = 1;
|
||||
static const unsigned int TLE1_COL_ELNUM = 64;
|
||||
static const unsigned int TLE1_LEN_ELNUM = 4;
|
||||
// static const unsigned int TLE1_COL_EPHEMTYPE = 62;
|
||||
// static const unsigned int TLE1_LEN_EPHEMTYPE = 1;
|
||||
// static const unsigned int TLE1_COL_ELNUM = 64;
|
||||
// static const unsigned int TLE1_LEN_ELNUM = 4;
|
||||
|
||||
static const unsigned int TLE2_COL_NORADNUM = 2;
|
||||
static const unsigned int TLE2_LEN_NORADNUM = 5;
|
||||
|
@ -147,6 +147,7 @@ void Tle::Initialize()
|
|||
year += 2000;
|
||||
else
|
||||
year += 1900;
|
||||
|
||||
epoch_ = DateTime(year, day);
|
||||
}
|
||||
|
||||
|
@ -176,7 +177,7 @@ void Tle::ExtractInteger(const std::string& str, unsigned int& val)
|
|||
if (isdigit(*i))
|
||||
{
|
||||
found_digit = true;
|
||||
temp = (temp * 10) + (*i - '0');
|
||||
temp = (temp * 10) + (static_cast<unsigned char>(*i) - '0');
|
||||
}
|
||||
else if (found_digit)
|
||||
{
|
||||
|
@ -335,7 +336,7 @@ void Tle::ExtractExponential(const std::string& str, double& val)
|
|||
throw TleException("Invalid sign");
|
||||
}
|
||||
}
|
||||
else if (i == str.begin() + str.length() - 2)
|
||||
else if (i == str.end() - 2)
|
||||
{
|
||||
if (*i == '-' || *i == '+')
|
||||
{
|
||||
|
|
|
@ -37,8 +37,8 @@ public:
|
|||
*/
|
||||
Tle(const std::string& line_one,
|
||||
const std::string& line_two)
|
||||
: line_one_(line_one),
|
||||
line_two_(line_two)
|
||||
: line_one_(line_one)
|
||||
, line_two_(line_two)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
@ -52,9 +52,9 @@ public:
|
|||
Tle(const std::string& name,
|
||||
const std::string& line_one,
|
||||
const std::string& line_two)
|
||||
: name_(name),
|
||||
line_one_(line_one),
|
||||
line_two_(line_two)
|
||||
: name_(name)
|
||||
, line_one_(line_one)
|
||||
, line_two_(line_two)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
@ -84,13 +84,6 @@ public:
|
|||
orbit_number_ = tle.orbit_number_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~Tle()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the satellite name
|
||||
* @returns the satellite name
|
||||
|
@ -322,7 +315,6 @@ private:
|
|||
std::string line_one_;
|
||||
std::string line_two_;
|
||||
|
||||
unsigned int norad_number_;
|
||||
std::string int_designator_;
|
||||
DateTime epoch_;
|
||||
double mean_motion_dt2_;
|
||||
|
@ -334,6 +326,7 @@ private:
|
|||
double argument_perigee_;
|
||||
double mean_anomaly_;
|
||||
double mean_motion_;
|
||||
unsigned int norad_number_;
|
||||
unsigned int orbit_number_;
|
||||
|
||||
static const unsigned int TLE_LEN_LINE_DATA = 69;
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
#include "TleException.h"
|
||||
|
||||
TleException::~TleException()
|
||||
{
|
||||
}
|
|
@ -18,14 +18,15 @@
|
|||
#ifndef TLEEXCEPTION_H_
|
||||
#define TLEEXCEPTION_H_
|
||||
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
/**
|
||||
* @brief The exception that the Tle class throws on an error.
|
||||
*
|
||||
* The exception that the Tle decoder will throw on an error.
|
||||
*/
|
||||
class TleException : public std::exception
|
||||
class TleException : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -33,29 +34,13 @@ public:
|
|||
* @param message Exception message
|
||||
*/
|
||||
TleException(const char* message)
|
||||
: m_message(message)
|
||||
: runtime_error(message)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~TleException(void) throw ()
|
||||
{
|
||||
}
|
||||
TleException(const TleException&) = default;
|
||||
|
||||
/**
|
||||
* Get the exception message
|
||||
* @returns the exception message
|
||||
*/
|
||||
virtual const char* what() const throw ()
|
||||
{
|
||||
return m_message.c_str();
|
||||
}
|
||||
|
||||
private:
|
||||
/** the exception message */
|
||||
std::string m_message;
|
||||
virtual ~TleException();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace Util
|
|||
*/
|
||||
inline double Mod(const double x, const double y)
|
||||
{
|
||||
if (y == 0)
|
||||
if (y == 0.0)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
|
|
@ -80,13 +80,6 @@ public:
|
|||
w = v.w;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~Vector()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Assignment operator
|
||||
* @param v value to copy from
|
||||
|
|
Loading…
Reference in New Issue