Table of Contents

Class OrbitalMotionLibrary

Namespace
NominalSystems.Universe
Assembly
NominalSystems.Universe.dll

[Nominal] Helper library for Orbital motion functions. These include Classical (Keplerian) elements, Vector Elements, Two Line Elements, Hill Frame and general orbital motion.


public static class OrbitalMotionLibrary
Inheritance
OrbitalMotionLibrary

Methods

CalculateClassicElements(ClassicElements, double, double)

Determines the new classical elements of some orbit after a specific amount has time has passed. This can be used to propagate the orbit by some time and determine the new set of orbital elements.

public static ClassicElements CalculateClassicElements(ClassicElements initial, double mu, double time)

Parameters

initial ClassicElements

[-] The initial set of classical elements

mu double

[-] The gravitational Mu parameter of the orbiting body

time double

[s] The time to propagate the orbit by

Returns

ClassicElements

[-] The new set of classical elements that exists

ClassicToRelativeElements(ClassicElements, ClassicElements)

A method that return the relative elements from input classic elements

public static RelativeElements ClassicToRelativeElements(ClassicElements leader, ClassicElements follower)

Parameters

leader ClassicElements

The classical orbital elements for the leader spacecraft

follower ClassicElements

The classical orbital elements for the follower spacecraft

Returns

RelativeElements

The relative elements from the classical elements

ClassicToRelativeMeanElements(double, double, ClassicElements, ClassicElements)

A method that returns the mean relative elements between two spacecraft, as a leader and follower system. This calculates the mean elements from the classic elements.

public static RelativeElements ClassicToRelativeMeanElements(double radius, double j2, ClassicElements leader, ClassicElements follower)

Parameters

radius double

[m] The equatorial radius of the planet

j2 double

[-] The J2 parameter of the planet

leader ClassicElements

The classical elements of the leader spacecraft

follower ClassicElements

The classical elements of the follower spacecraft

Returns

RelativeElements

The relative elements describing the mean element set

ClassicToVectorElements(double, ClassicElements)

Converts a classic elements to a vector elements based on the Mu of the body.

public static VectorElements ClassicToVectorElements(double mu, ClassicElements classicElements)

Parameters

mu double

[-] Gravitational Mu parameter

classicElements ClassicElements

[-] A classical elements set

Returns

VectorElements

[-] A vector element set

CreateFrozenOrbit(DateTime, double, double, 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(DateTime date, double radius, double axisOmega, double semiMajorAxis, double timeOfDay = 0)

Parameters

date DateTime

[-] The time for the frozen orbit

radius double

[m] The equatorial radius of the planet

axisOmega double

[rad/s] The planet rotation rate on its axis

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(CelestialBody, 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(CelestialBody planet, SpiceTimeMessage time, double semiMajorAxis, double eccentricity = 0, double timeOfDay = 0)

Parameters

planet CelestialBody

[-] 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

CreateSunSynchronousOrbit(double, double, double, double, double, double, DateTime, 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(double mu, double parentMu, double bodyRadius, double j2, double bodyOrbitRadius, double julianDate, DateTime date, double semiMajorAxis, double eccentricity = 0, double timeOfDay = 0)

Parameters

mu double

[-] The gravitational mu parameter of the orbited body

parentMu double

[-] The gravitational mu parameter of the orbited body's orbit. For example, for orbiting the moon, this will be the Earth's mu. Otherwise, it will be the sun's mu.

bodyRadius double

[m] The radius of the orbiting body

j2 double

[-] The J2 parameter of the orbited body

bodyOrbitRadius double

[m] The radius of the planet's orbit around its parent body. This will typically be the radius of the planet to the sun, unless selecting the moon.

julianDate double

[-] The Julian date of the current epoch

date DateTime

[-] The date for the SSO orbit

semiMajorAxis double

[m] The SMA of the orbit of the object

eccentricity double

[-] The eccentricity of the orbit

timeOfDay double

[-] The time of day to align the SOO orbit to

Returns

ClassicElements

[rad] The inclination angle of the orbit

EccentricToMeanAnomaly(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 EccentricToMeanAnomaly(double eccentricAnomaly, double eccentricity)

Parameters

eccentricAnomaly double

[rad] Eccentric anomaly

eccentricity double

[-] Eccentricity(0 <= e > 1)

Returns

double

[rad] Mean elliptic anomaly

EccentricToTrueAnomaly(double, double)

Converts the Eccentric Anomaly to the True Anomaly

public static double EccentricToTrueAnomaly(double eccentricAnomaly, double eccentricity)

Parameters

eccentricAnomaly 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

GetNumTwoLineElementsInFile(string)

Extracts the number of TLEs from a file with multiple TLE's

public static int GetNumTwoLineElementsInFile(string path)

Parameters

path string

Name of the TLE file in the directory

Returns

int

The number of TLEs in a file

GetOrbitalPeriod(double, ClassicElements)

Calculates the period of the orbit from a classical element set, which will use the average radius between apoapsis and periapsis.

public static double GetOrbitalPeriod(double mu, ClassicElements elements)

Parameters

mu double

The primary body gravitational parameter

elements ClassicElements

The orbital elements

Returns

double

[s] The period in second of the orbit

GetOrbitalPeriod(double, double)

Calculates the period of the orbit

public static double GetOrbitalPeriod(double mu, double semiMajorAxis)

Parameters

mu double

The primary body gravitational parameter

semiMajorAxis double

[m] The orbit semi-major axis

Returns

double

[s] The orbit time in seconds

GetOrbitalPeriodRadius(double, double)

Returns the Semi Major Axis (SMA) from an Orbital Period in seconds.

public static double GetOrbitalPeriodRadius(double mu, double period)

Parameters

mu double

The primary body gravitational parameter

period double

[s] The orbital period

Returns

double

[m] The semi major axis of the orbit

GetSemiLatusRectum(double, double)

Calculates the cross section of the semi-major latus of the orbit.

public static double GetSemiLatusRectum(double semiMajorAxis, double eccentricity)

Parameters

semiMajorAxis double

[m] The SMA of the orbit

eccentricity double

[-] The eccentricity of the orbit

Returns

double

[m] The Semi Latus Rectum parameter

GetSunSynchronousInclination(double, double, double, double, double, double, double)

Returns the inclination in radians of a defined SSO orbit based on the semi major axis and desired eccentricity of the orbit. This will depend on the planet's orbit and the object the planet itself is orbiting around.

public static double GetSunSynchronousInclination(double mu, double parentMu, double bodyRadius, double j2, double bodyOrbitRadius, double semiMajorAxis, double eccentricity = 0)

Parameters

mu double

[-] The gravitational mu parameter of the orbited body

parentMu double

[-] The gravitational mu parameter of the orbited body's orbit. For example, for orbiting the moon, this will be the Earth's mu. Otherwise, it will be the sun's mu.

bodyRadius double

[m] The radius of the orbiting body

j2 double

[-] The J2 parameter of the orbited body

bodyOrbitRadius double

[m] The radius of the planet's orbit around its parent body. This will typically be the radius of the planet to the sun, unless selecting the moon.

semiMajorAxis double

[m] The SMA of the orbit of the object

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 perturbed 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 orbiting 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

GetTLEFromFile(string, int)

Extracts a generic TLE from a file with multiple TLE's

public static string[] GetTLEFromFile(string path, int satNum)

Parameters

path string

Name of the TLE file in the directory

satNum int

Desired satellite in the list Assuming multiple TLE's in the same file

Returns

string[]

The extracted TLE

Exceptions

Exception

HillFrameToVectorElements(Vector3, Vector3, Vector3, Vector3)

Maps Hill frame deputy states to inertial inertial position and velocity vectors.

public static VectorElements HillFrameToVectorElements(Vector3 position, Vector3 velocity, Vector3 rho, Vector3 rhoPrime)

Parameters

position Vector3

[m] Chief inertial position vector

velocity Vector3

[m/s] Chief inertial velocity vector

rho Vector3

[m] Deputy Hill position vector

rhoPrime Vector3

[m/s] Deputy Hill velocity vector

Returns

VectorElements

[-] The vector elements of the other body

InertialToHillFrame(Vector3, Vector3)

Maps inertial position and velocity vectors in the Hill frame DCM HN

public static Matrix3 InertialToHillFrame(Vector3 position, Vector3 velocity)

Parameters

position Vector3

[m] Inertial position vector

velocity Vector3

[m/s] Inertial velocity vector

Returns

Matrix3

[-] Hill frame DCM relative to inertial frame

MeanToEccentricAnomaly(double, double)

Converts the Mean Anomaly to the Eccentric Anomaly

public static double MeanToEccentricAnomaly(double meanAnomaly, double eccentricity)

Parameters

meanAnomaly double

[rad] The Mean Anomaly

eccentricity double

[-] The eccentricity of the orbit (0 <= e > 1)

Returns

double

[rad] The Eccentric Anomaly

MeanToOsculatingElements(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 MeanToOsculatingElements(double radius, double j2, ClassicElements orbit, bool meanToOsculating)

Parameters

radius double

[m] Equatorial radius or the orbital body

j2 double

[-] J2 parameter for the orbital body of interest

orbit ClassicElements

[-] Classical orbit element set

meanToOsculating bool

[-] Sgn=True:mean to osc, Sgn=False:osc to mean

Returns

ClassicElements

[-] A classical element struct

MeanToTrueAnomaly(double, double)

Calculate the true anomaly from the mean anomaly.

public static double MeanToTrueAnomaly(double meanAnomaly, double eccentricity)

Parameters

meanAnomaly double

[rad] The Mean Anomaly

eccentricity double

[-] The eccentricity of the orbit (0 <= e > 1)

Returns

double

[rad] The True Anomaly

NonSingularToRelativeElements(NonSingularElements, NonSingularElements)

Calculate the relative orbital elements based on input non-singular orbital elements

public static RelativeElements NonSingularToRelativeElements(NonSingularElements leader, NonSingularElements follower)

Parameters

leader NonSingularElements

The non-singular orbital elements of the lead spacecraft

follower NonSingularElements

The non-singular orbital elements of the follower spacecraft

Returns

RelativeElements

The relative elements from the non-singular elements

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

ReadTwoLineElements(string, int)

Reads and creates a TLE to the simulation from a file with multiple TLE's

public static TwoLineElements ReadTwoLineElements(string path, int satNumber)

Parameters

path string

Name of the TLE file in the directory

satNumber int

Desired satellite in the list Assuming multiple TLE's in the same file

Returns

TwoLineElements

The two line element set that was read

ReadTwoLineElements(string, string, string)

Reads Generates a TLE within the simulation using strings of each line of the TLE. This will include the designator line as the line0.

public static TwoLineElements ReadTwoLineElements(string line0, string line1, string line2)

Parameters

line0 string

The designator line of the TLE

line1 string

The first line of the TLE

line2 string

The second line of the TLE

Returns

TwoLineElements

The TLE for the data provided

ReadTwoLineElementsInString(string, int)

Reads and creates a TLE to the simulation from a file with multiple TLE's from a string containing the contents of the file.

public static TwoLineElements ReadTwoLineElementsInString(string content, int index)

Parameters

content string

The content of the file containing TLEs

index int

The index to grab the TLE from

Returns

TwoLineElements

The Two Line Element set from the string

SortTLEsByEpoch(TwoLineElements[])

Sorts an array of Two Line Elements by their Epoch

public static TwoLineElements[] SortTLEsByEpoch(TwoLineElements[] tles)

Parameters

tles TwoLineElements[]

The Array of TwoLineElements to sort

Returns

TwoLineElements[]

An array of sorted TwoLineElements

TLEEpochToDateTime(string)

Generates a DateTime from the Epoch included in the TLE. If the TLE Line is invalid, the current UTC Now DateTime is returned

public static DateTime TLEEpochToDateTime(string line2)

Parameters

line2 string

The TLE Line with the Epoch Information

Returns

DateTime

The extracted Epoch as a DateTime. Returns the current UTC Now DateTime if the function is misconfigured

TrueToEccentricAnomaly(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 TrueToEccentricAnomaly(double trueAnomaly, double eccentricity)

Parameters

trueAnomaly double

[rad] True anomaly angle

eccentricity double

[-] Eccentricity (0 <= e > 1)

Returns

double

[rad] Eccentric anomaly

TrueToMeanAnomaly(double, double)

Calculate the mean anomaly from the true anomaly

public static double TrueToMeanAnomaly(double trueAnomaly, double eccentricity)

Parameters

trueAnomaly double

[rad] The true anomaly of the orbit

eccentricity double

[-] The eccentricity of the orbit (0 <= e > 1)

Returns

double

[rad] Mean elliptic anomaly

TwoLineElementsToDateTime(TwoLineElements)

Generates a DateTime from the Epoch included in the TLE.

public static DateTime TwoLineElementsToDateTime(TwoLineElements tle)

Parameters

tle TwoLineElements

The two line elements to extract

Returns

DateTime

The datetime of a two line element set

TwoLineToClassicElements(TwoLineElements)

Converts a TLE to Classic Elements

public static ClassicElements TwoLineToClassicElements(TwoLineElements tle)

Parameters

tle TwoLineElements

The Two Line Elements data

Returns

ClassicElements

The Classic Elements data

VectorToClassicElements(double, VectorElements)

Converts a vector elements to a classic elements based on the Mu of the body.

public static ClassicElements VectorToClassicElements(double mu, VectorElements rv)

Parameters

mu double

[-] Gravitational Mu parameter

rv VectorElements

[-] A vector elements set

Returns

ClassicElements

[-] A classic element set

VectorToRelativeElements(double, VectorElements, VectorElements)

A method that returns the relative orbital elements from an input state vector

public static RelativeElements VectorToRelativeElements(double mu, VectorElements leader, VectorElements follower)

Parameters

mu double

The gravitational parameter of the primary body

leader VectorElements

The vector elements of the leader spacecraft

follower VectorElements

The vector elements of the follower spacecraft

Returns

RelativeElements

The relative elements to convert

VectorToRelativeMeanElements(double, double, double, VectorElements, VectorElements)

A method that returns the mean relative elements between two spacecraft, as a leader and follower system. This calculates the mean elements from the vector elements.

public static RelativeElements VectorToRelativeMeanElements(double mu, double radius, double j2, VectorElements leader, VectorElements follower)

Parameters

mu double

[-] The gravitational parameter of the primary body

radius double

[m] The equatorial radius of the planet

j2 double

[-] The J2 parameter of the planet

leader VectorElements

The vector elements of the leader spacecraft

follower VectorElements

The vector elements of the follower spacecraft

Returns

RelativeElements

The relative elements describing the mean element set