Class OrbitalMotionLibrary
- Namespace
- NominalSystems.Universe
- Assembly
- NominalSystems.Universe.dll
Helper library for Orbital motion functions. These include Classical (Keplerian) elements, Vector Elements, Two Line Elements, Hill Frame and general orbital motion. All methods are public and can be used by any class at any point in time.
public static class OrbitalMotionLibrary
- Inheritance
-
OrbitalMotionLibrary
Methods
CalculateClassicalAtTime(ClassicElements, double, double)
public static ClassicElements CalculateClassicalAtTime(ClassicElements initial, double mu, double time)
Parameters
initial
ClassicElementsmu
doubletime
double
Returns
ClassicalElem2VectorElem(double, ClassicElements)
Converts a classic elements to a vector elements based on the MU of the body
public static VectorElements ClassicalElem2VectorElem(double mu, ClassicElements classicElements)
Parameters
mu
double[-] Gravitational MU parameter
classicElements
ClassicElements[-] A classical elements struct
Returns
- VectorElements
[-] A vector element struct
CreateFrozenOrbit(GravityBody, SpiceTimeMessage, double, double)
Creates a frozen orbit based on some parameters. This assumes that the orbit will pass over the same ground location at the same local time of day each time.
public static ClassicElements CreateFrozenOrbit(GravityBody planet, SpiceTimeMessage time, double semiMajorAxis, double timeOfDay = 0)
Parameters
planet
GravityBody[-] The orbiting planet to orbit around
time
SpiceTimeMessage[-] The SPICE time message of the current epoch
semiMajorAxis
double[m] The SMA of the orbit
timeOfDay
double[h] The time of day between 0 and 24 hours
Returns
- ClassicElements
[-] The classical elements of the orbit for the SSO
CreateSunSynchronousOrbit(GravityBody, SpiceTimeMessage, double, double, double)
Creates a sun synchronous orbit based on some parameters. This will return the classical elements associated with a sun synchronous orbit. An SSO will pass the Earth's equator at a fixed time of day, which is defined by the timeOfDay parameter.
public static ClassicElements CreateSunSynchronousOrbit(GravityBody planet, SpiceTimeMessage time, double semiMajorAxis, double eccentricity = 0, double timeOfDay = 0)
Parameters
planet
GravityBody[-] The orbiting planet to orbit around
time
SpiceTimeMessage[-] The SPICE time message of the current epoch
semiMajorAxis
double[m] The SMA of the orbit
eccentricity
double[-] The eccentricity of the orbit
timeOfDay
double[h] The time of day between 0 and 24 hours
Returns
- ClassicElements
[-] The classical elements of the orbit for the SSO
Eccentric2MeanAnom(double, double)
Maps the eccentric anomaly angle into the corresponding mean elliptic anomaly angle. Both 2D and 1D elliptic orbit are allowed.
public static double Eccentric2MeanAnom(double eccentricAnom, double eccentricity)
Parameters
Returns
- double
[rad] Mean elliptic anomaly
Eccentric2TrueAnom(double, double)
Converts the Eccentric Anomaly to the True Anomaly
public static double Eccentric2TrueAnom(double eccentricAnom, double eccentricity)
Parameters
eccentricAnom
double[rad] The Eccentric Anomaly
eccentricity
double[-] The eccentricity of the orbit (0 <= e > 1)
Returns
- double
[rad] The True Anomaly
GetMeanMotion(double, double)
Calculates the mean motion of a particular orbit with some semi major axis.
public static double GetMeanMotion(double mu, double semiMajorAxis)
Parameters
mu
double[m^3 s^-2] The gravitational MU parameter of the planet orbiting
semiMajorAxis
double[m] The SMA of the orbit
Returns
- double
[s^-2] The mean motion for the orbit
GetSMAFromPeriod(double, double)
Returns the Semi Major Axis (SMA) from an Orbital Period in seconds.
public static double GetSMAFromPeriod(double mu, double period)
Parameters
Returns
- double
[m] The semi major axis of the orbit
GetSemiLactusRectum(double, double)
Calculates the cross section of the semi-major lactus of the orbit.
public static double GetSemiLactusRectum(double semiMajorAxis, double eccentricity)
Parameters
Returns
- double
[m] The Semi Lactus Rectum parameter
GetSunSynchronousInclination(GravityBody, double, double)
Returns the inclination in radians of a defined SSO orbit based on the semi major axis and desired eccentricity of the orbit.
public static double GetSunSynchronousInclination(GravityBody planet, double semiMajorAxis, double eccentricity = 0)
Parameters
planet
GravityBody[-] The orbiting planet to orbit around
semiMajorAxis
double[m] The SMA of the orbit
eccentricity
double[-] The eccentricity of the orbit
Returns
- double
[rad] The inclination angle of the orbit
GetSunSynchronousInclinationEstimate(double, double, double, double, double, double)
Calculates the sun synchronous inclination estimate based on the position of the planet relative to the sun and the mean and peturbed motion of the orbit.
public static double GetSunSynchronousInclinationEstimate(double meanMotion, double perturbedMotion, double bodyRadius, double bodyOrbit, double bodyJ2, double bodyParentMu)
Parameters
meanMotion
double[s^-2] The mean motion of the orbit
perturbedMotion
double[s^-2] The perturbed motion of the orbit
bodyRadius
double[m] The radius of the orbting body
bodyOrbit
double[m] The sun-body radius of the orbit of the orbiting body
bodyJ2
double[-] The orbiting body J2 value
bodyParentMu
double[m^3 s^-2] The gravitational Mu parameter of the parent of the orbital body
Returns
- double
[rad] The estimated inclination of the orbit
Hill2VectorElem(Vector3, Vector3, Vector3, Vector3)
Maps Hill frame deputy states to inertial inertial position and velocity vectors
public static VectorElements Hill2VectorElem(Vector3 rc_N, Vector3 vc_N, Vector3 rho_H, Vector3 rhoPrime_H)
Parameters
rc_N
Vector3[m] Chief inertial position vector
vc_N
Vector3[m/s] Chief inertial velocity vector
rho_H
Vector3[m] Deputy Hill position vector
rhoPrime_H
Vector3[m/s] Deputy Hill velocity vector
Returns
- VectorElements
[-] The vector elements of the other body
InertialFrameToHillFrame(Vector3, Vector3)
Maps inertial position and velocity vectors in the Hill frame DCM HN
public static Matrix3 InertialFrameToHillFrame(Vector3 rc_N, Vector3 vc_N)
Parameters
Returns
- Matrix3
[-] Hill frame DCM relative to inertial frame
Mean2EccentricAnom(double, double)
Converts the Mean Anomaly to the Eccentric Anomaly
public static double Mean2EccentricAnom(double meanAnom, double eccentricity)
Parameters
meanAnom
double[rad] The Mean Anomaly
eccentricity
double[-] The eccentricity of the orbit (0 <= e > 1)
Returns
- double
[rad] The Eccentric Anomaly
Mean2OscElem(double, double, ClassicElements, bool)
First-order J2 Mapping Between Mean and Osculating Orbital Elements Analytical Mechanics of Space Systems, Hanspeter Schaub, John L. Junkins, 4th edition. [m] or [km] should be the same both for req and elements.
public static ClassicElements Mean2OscElem(double Req, double J2, ClassicElements OE, bool MeanToOsc)
Parameters
Req
double[-] Equatorial radius or the orbital body
J2
double[-] J2 parameter for the orbital body of interest
OE
ClassicElements[-] Classical orbit element set
MeanToOsc
bool[-] Sgn=True:mean to osc, Sgn=False:osc to mean
Returns
- ClassicElements
[-] A classical element struct
Period(double, double)
Calculate the period of the orbit
public static double Period(double mu, double semiMajorAxis)
Parameters
mu
doubleThe primary body gravitational parameter
semiMajorAxis
double[m] The orbit semi-major axis
Returns
- double
[s] The orbit time in seconds
Exceptions
- Exception
An error in the SMA or Mu will throw an error
ProgressByTime(VectorElements, double, double)
Progresses some Vector Elements that are about some orbital body with a Mu by some time. This will predict where the orbit will be after a specific amount of seconds.
public static VectorElements ProgressByTime(VectorElements initial, double mu, double delta)
Parameters
initial
VectorElements[m] The initial vector elements to start with
mu
double[m3 s−2] The orbiting planet's Mu
delta
double[s] The time to progress by
Returns
- VectorElements
[m] The final vector elements that have been progressed by a certain amount of time
TLE2ClassicElements(TwoLineElements)
Converts The TLE to Classic Elements
public static ClassicElements TLE2ClassicElements(TwoLineElements tle)
Parameters
tle
TwoLineElementsThe Two Line Elements data
Returns
- ClassicElements
The Classic Elements data
True2EccentricAnom(double, double)
Maps true anomaly angles into eccentric anomaly angles. This function requires the orbit to be either circular or non - rectilinear elliptic orbit.
public static double True2EccentricAnom(double trueAnom, double eccentricity)
Parameters
Returns
- double
[rad] Eccentric anomaly
True2MeanAnom(double, double)
Calculate the mean anomaly from the true anomaly
public static double True2MeanAnom(double trueAnom, double eccentricity)
Parameters
trueAnom
double[rad] The true anomaly of the orbit
eccentricity
double[-] The eccentricity of the orbit (0 <= e > 1)
Returns
- double
[rad] Mean elliptic anomaly
VectorElem2ClassicalElem(double, VectorElements)
Converts a vector elements to a classic elements based on the MU of the body
public static ClassicElements VectorElem2ClassicalElem(double mu, VectorElements rv)
Parameters
mu
double[-] Gravitational MU parameter
rv
VectorElements[-] A vector elements struct
Returns
- ClassicElements
[-] A classic element struct