Table of Contents

Class DynamicBody

Namespace
NominalSystems.Universe
Assembly
NominalSystems.Universe.dll

A dynamic body is able to be influenced by external forces, such as gravity, and will orbit various bodies. A dynamic body has physics attached and is able to have various components that can be added to the system.

public class DynamicBody : PhysicalObject, IIntegrable
Inheritance
DynamicBody
Implements
Derived
Inherited Members

Constructors

DynamicBody()

Basic constructor for the Dynamic Body Class

public DynamicBody()

Fields

Body

Stores a reference to the BodyEffector

[ForceSerialize]
protected BodyEffector Body

Field Value

BodyEffector

DvAccum_B

[m/s] Accumulated delta-v of center of mass relative to inertial frame in body frame coordinates

protected Vector3 DvAccum_B

Field Value

Vector3

DvAccum_BN_B

[m/s] accumulated delta-v of body frame relative to inertial frame in body frame coordinates

protected Vector3 DvAccum_BN_B

Field Value

Vector3

DynamicType

[-] The type of orbit propagation that is used for this object.

[EditableVariable("-", true, "", "")]
public DynamicType DynamicType

Field Value

DynamicType

InitialPeriod

[s] The orbital period of the body if the initial orbit is set

[EditableVariable("s", true, "", "")]
public double InitialPeriod

Field Value

double

Name

The name of the dynamic body provided by the user. This does not need to be unique and can be left empty.

public string Name

Field Value

string

NonConservativeAccelPntB_B

[m/s/s] Current body body acceleration in the B frame

protected Vector3 NonConservativeAccelPntB_B

Field Value

Vector3

OmegaDot_BN_B

[rad/s/s] angular acceleration of body wrt to N in body frame

protected Vector3 OmegaDot_BN_B

Field Value

Vector3

OrbitalPotentialEnergyContribution

[J] Contribution of stateEffector to total rotational energy

protected double OrbitalPotentialEnergyContribution

Field Value

double

Out_AtmoPropsMsg

Created Atmosphere message

public AtmospherePropsMessage Out_AtmoPropsMsg

Field Value

AtmospherePropsMessage

Out_BodyMassPropsMsg

The body mass properties message that stores the mass properties from all of the components that are added to this body. This will be the sum of all components and is used by the integrator.

public readonly MassPropsMessage Out_BodyMassPropsMsg

Field Value

MassPropsMessage

Out_EclipseMsg

Created Eclipse message

public EclipseMessage Out_EclipseMsg

Field Value

EclipseMessage

Out_MagneticFieldMsg

Created Magnetic Field message

public MagneticFieldMessage Out_MagneticFieldMsg

Field Value

MagneticFieldMessage

Out_SolarFluxMsg

Created Solar Flux message

public SolarFluxMessage Out_SolarFluxMsg

Field Value

SolarFluxMessage

OverrideMass

A flag whether to override the mass properties with some new custom ones.

[EditableVariable("-", false, "", "")]
public bool OverrideMass

Field Value

bool

Properties

A reference to all of the parameters of the object as states

[ForceSerialize]
public readonly StateProperties Properties

Field Value

StateProperties

RotAngMomPntCContr_B

[kg m^2/s] Contribution of stateEffector to total rotational angular mom.

protected Vector3 RotAngMomPntCContr_B

Field Value

Vector3

RotationalEnergyContribution

[J] Contribution of stateEffector to total rotational energy

protected double RotationalEnergyContribution

Field Value

double

SumForceExternal_B

[N] Sum of forces given in the body frame

protected Vector3 SumForceExternal_B

Field Value

Vector3

SumForceExternal_N

[N] Sum of forces given in the inertial frame

protected Vector3 SumForceExternal_N

Field Value

Vector3

SumTorquePntB_B

[N-m] Total torque about point B in B frame components

protected Vector3 SumTorquePntB_B

Field Value

Vector3

TotOrbAngMomPntN_N

[kg m^2/s] Total orbital angular momentum about N in N frame compenents

protected Vector3 TotOrbAngMomPntN_N

Field Value

Vector3

TotRotAngMomPntC_N

[kg m^2/s] Total rotational angular momentum about C in N frame compenents

protected Vector3 TotRotAngMomPntC_N

Field Value

Vector3

TotalOrbitalEnergy

[J] Total orbital kinetic energy

protected double TotalOrbitalEnergy

Field Value

double

TotalRotationalEnergy

[J] Total rotational energy

protected double TotalRotationalEnergy

Field Value

double

WriteStateData

[-] A flag whether to write state data

public bool WriteStateData

Field Value

bool

Properties

Attitude

[MRP] The attitude of the dynamic body in the form of a Modified Rodriguez Parameter (MRP). This is converted from the transformation of the local frame. This is equivalent to Transform_BN_N.

[EditableVariable("MRP", false, "", "")]
public Vector3 Attitude { get; set; }

Property Value

Vector3

AttitudeRate

[rad/s] Stores the current body attitude rate in the body frame

[EditableVariable("rad/s", false, "", "")]
public Vector3 AttitudeRate { get; set; }

Property Value

Vector3

GeodeticCoordinates

A vector with the lat [deg] long [deg] and alt [m] of the current body's position, in relation to the orbiting body.

public Vector3 GeodeticCoordinates { get; }

Property Value

Vector3

GravityEffector

A reference to the Gravity Effector object that can determine the effects of gravity

[ForceSerialize]
public GravityEffector GravityEffector { get; }

Property Value

GravityEffector

OrbitedBody

The body that this dynamic body is orbiting

[ForceSerialize]
public string OrbitedBody { get; }

Property Value

string

Position

[m] The position of the body in the inertial world state

public virtual Vector3 Position { get; set; }

Property Value

Vector3

Rotation

[deg] The rotation of the body in pitch, roll, yaw. This is converted from the local DCM matrix and is equivalent to DCM_BN.

[EditableVariable("deg", true, "", "")]
public virtual Vector3 Rotation { get; set; }

Property Value

Vector3

Velocity

[m/s] The velocity of the body in the inertial frame

[EditableVariable("m/s", false, "", "")]
public virtual Vector3 Velocity { get; set; }

Property Value

Vector3

WGSCoordinates

A WGS Accurate Earth model coordinate system with the Earth as the center being used for the position.

public Vector3 WGSCoordinates { get; }

Property Value

Vector3

Methods

ComputeEffectorEnergy(double, ref Vector3)

Computes the energy and momentum from the effectors.

protected virtual void ComputeEffectorEnergy(double time, ref Vector3 totRotAngMomPntC_B)

Parameters

time double

The current time [s]

totRotAngMomPntC_B Vector3

The current angular momentum data

ComputeEnergyMomentum(double, double)

Computes the total energy and momentum of the object. It finds the toal orbital energy, total orbital angular momentum, total rotational energy and total rotational angular momentum. These values are used for validation purposes

public virtual void ComputeEnergyMomentum(double time, double step)

Parameters

time double

The current time [s]

step double

The delta time [s]

GetLookupTrajectoryCoordinates(bool, int)

public Vector3[] GetLookupTrajectoryCoordinates(bool geodetic = false, int maxPoints = -1)

Parameters

geodetic bool
maxPoints int

Returns

Vector3[]

GetOrbitalPosition()

Returns the position between the body that is orbiting another planet and the orbited body.

public Vector3 GetOrbitalPosition()

Returns

Vector3

[m] The relative position between the body and the planet

GetOrbitalVelocity()

Returns the velocity between the body that is orbiting another planet and the orbited body.

public Vector3 GetOrbitalVelocity()

Returns

Vector3

[m/s] The relative velocity between the body and the planet

GetRelativePosition(string)

Returns the relative position between the body and another planet.

public Vector3 GetRelativePosition(string planet)

Parameters

planet string

The planet to get the relative position between

Returns

Vector3

[m] The relative position

GetRelativeVelocity(string)

Returns the relative velocity between the body and another planet.

public Vector3 GetRelativeVelocity(string planet)

Parameters

planet string

The planet to get the relative velocity between

Returns

Vector3

[m/s] The relative velocity

InitialiseBody(double, Vector3, Matrix3, Vector3, Vector3)

Initialises the object with a series of elements from the Vector elements library

public void InitialiseBody(double mass, Vector3 com, Matrix3 moi, Vector3 attitude, Vector3 attitudeRate)

Parameters

mass double

[kg] The mass of the object

com Vector3

[m] The center of mass position of the object

moi Matrix3

[kg/m^2] The Moment of Inertia of the object

attitude Vector3

[rad] The starting attitude of the object

attitudeRate Vector3

[rad/s] The starting attitude rate of the object

InitialiseDynamics(double)

Initialises all of the parameters and registers the properties in each state. Takes in account the Center of Mass

public virtual void InitialiseDynamics(double time)

Parameters

time double

The current time [s]

InitialiseEffectors()

Initialises the State and Dynamic effectors. This is handled in the kinematic body class.

protected virtual void InitialiseEffectors()

IsChildTypeSupported(Type)

Returns true if 'Component' type is a supported child

protected override bool IsChildTypeSupported(Type type)

Parameters

type Type

a 'Component' type

Returns

bool

LinkEffectors()

Links data to all of the effectors This is handled in the kinematic body class.

protected virtual void LinkEffectors()

OnBegin(double)

Called when the 'Component' is beginning

protected override void OnBegin(double time)

Parameters

time double

current time (seconds)

OnDecodeMetadata(JObject)

Called after the "Component" was loaded to handle additional metadata.

protected override void OnDecodeMetadata(JObject metadata)

Parameters

metadata JObject

OnEncodeMetadata(JObject)

Called while the "Component" is being saved to save additional metadata.

protected override JObject OnEncodeMetadata(JObject metadata)

Parameters

metadata JObject

Returns

JObject

OnHeirarchyChange()

An event that is executed when some object within the chain of components in the heirarchy is added or removed from the system. This can be used to recalculate physics or create a new list of objects.

protected override void OnHeirarchyChange()

OnIntegratorChanged(IntegratorType)

Callback when the integrator changes type and needs a new type for the physics integration.

public void OnIntegratorChanged(IntegratorType type)

Parameters

type IntegratorType

[-] The integration type

OnReset(double)

Called when the 'Component' is reset from a simulation

protected override void OnReset(double time)

Parameters

time double

reset time (seconds)

OnUpdate(double, double)

Called when the 'Component' should update

protected override void OnUpdate(double time, double step)

Parameters

time double

current time (seconds)

step double

the time step (seconds)

SetClassicElements(ClassicElements, string)

Sets the classic elements of a body to a series of parameters based on the Keplerian elements.

public void SetClassicElements(ClassicElements elements, string orbitingBody = "earth")

Parameters

elements ClassicElements

The Classical Elements

orbitingBody string

The name of the body orbiting

SetClassicElements(double, double, double, double, double, double, string)

Sets the classic elements of a body to a series of parameters based on all of the required parameters

public void SetClassicElements(double semiMajorAxis, double eccentricity, double inclination, double omegaAscension, double argumentOfPeriapsis, double trueAnomaly, string orbitingBody = "earth")

Parameters

semiMajorAxis double

[m] Semi Major Axis

eccentricity double

[-] The Eccentricity

inclination double

[rad] The Inclination

omegaAscension double

[rad] The Right Ascension

argumentOfPeriapsis double

[rad] The Periapsis Argument Node

trueAnomaly double

[rad] The True Anomaly

orbitingBody string

The name of the body orbiting

SetCustomTrajectory(string, bool, string, bool, bool)

Sets the path to the lookup data to read from. This should be an absolute path to the CSV file with the data from the file. This assumes the file is of the correct format, but will not throw an error if not.

public bool SetCustomTrajectory(string lookupPath, bool integratePostData = true, string orbitingBody = "earth", bool usePointingAttitude = false, bool repeatAtEnd = false)

Parameters

lookupPath string

The path to the lookup data. This is the absolute path to the CSV file.

integratePostData bool

A flag for if the state should be integrated after the data is exhausted.

orbitingBody string

The name of the body orbiting

usePointingAttitude bool

A flag whether to use an attitude that points in the direction of motion

repeatAtEnd bool

A flag whether to repeat the data set at the end of the data sheet

Returns

bool

A successful add flag of lookup data

SetGeodeticElements(GeodeticElements, string)

Sets the Geodetic Elements of Latitude, Longitude and Altitude to some properties in the element struct.

public void SetGeodeticElements(GeodeticElements elements, string orbitingBody = "earth")

Parameters

elements GeodeticElements

The LLA Geodetic Elements data

orbitingBody string

The name of the body orbiting

SetGeodeticElements(double, double, double, string)

Sets the Geodetic Elements of Latitude, Longitude and Altitude to some properties passed in by this function.

public void SetGeodeticElements(double latitude, double longitude, double altitude, string orbitingBody = "earth")

Parameters

latitude double

[deg] The Latitude

longitude double

[deg] The Longitude

altitude double

[m] The Altittude above the surface

orbitingBody string

The name of the body orbiting

SetHillFrame(Vector3, Vector3, Vector3, Vector3)

Sets the orientation of this body relative to another body using the Hill Frame vector.

public void SetHillFrame(Vector3 chiefPosition, Vector3 chiefVelocity, Vector3 hillPosition, Vector3 hillVelocity)

Parameters

chiefPosition Vector3

[m] The Chief Inertial Position

chiefVelocity Vector3

[m/s] The Chief Inertial Velocity

hillPosition Vector3

[m] The Hill Frame Position

hillVelocity Vector3

[m/s] The Hill Frame Velocity

SetHillFrame(DynamicBody, Vector3, Vector3)

Sets the orientation of this body relative to another body using the Hill Frame vector. This will require another body as input.

public void SetHillFrame(DynamicBody other, Vector3 hillPosition, Vector3 hillVelocity)

Parameters

other DynamicBody

[-] The other dynamic body to use

hillPosition Vector3

[m] The Hill Frame Position

hillVelocity Vector3

[m] The Hill Frame Velocity

SetTwoLineElements(TwoLineElements, string)

Sets the Two Line Elements (TLE) data of a particular craft to a specific position stored in the struct.

public void SetTwoLineElements(TwoLineElements elements, string orbitingBody = "earth")

Parameters

elements TwoLineElements

The TLE elements data

orbitingBody string

The name of the body orbiting

SetTwoLineElements(string, int, string)

Sets the Two Line Elements (TLE) data of a particular craft to some data.

public string SetTwoLineElements(string path, int index, string orbitingBody = "earth")

Parameters

path string

The full file path to the file that exists with the TLEs.

index int

The index of the orbiting body being initialised

orbitingBody string

The name of the body orbiting

Returns

string

SetTwoLineElements(string, string, string, string)

Sets the Two Line Elements (TLE) data of a particular craft with some individual lines of the TLE.

public void SetTwoLineElements(string line1, string line2, string line3, string orbitingBody = "earth")

Parameters

line1 string

The first line - usually the body information

line2 string

The second line for the TLE

line3 string

The third line for the TLE

orbitingBody string

The name of the body orbiting

SetVectorElements(Vector3, Vector3, string)

Sets the position and velocity of a body to a series of parameters.

public void SetVectorElements(Vector3 position, Vector3 velocity, string orbitingBody = "earth")

Parameters

position Vector3

[m] The position of the body

velocity Vector3

[m/s] The velocity of the body

orbitingBody string

The name of the body orbiting

SetVectorElements(VectorElements, string)

Sets the position and velocity of a body to a series of parameters based on the Vector Elements. This is just a position and velocity, with an optional orbiting body.

public void SetVectorElements(VectorElements elements, string orbitingBody = "earth")

Parameters

elements VectorElements

The position and velocity of the body

orbitingBody string

The name of the body orbiting

UpdateEffectorEquations(double)

Updates the Effector Equations of state

protected virtual void UpdateEffectorEquations(double time)

Parameters

time double

The current time [s]

UpdateEquationsOfMotion(double, double)

Updates all of the State Equations with their correct derivatives

public virtual void UpdateEquationsOfMotion(double time, double step)

Parameters

time double

The current time [s]

step double

The current delta time [s]

UpdateIntegration(double, double)

Attempts to integrate the body using a full integration system and updates all the parameters on the mass of the system and can integrate 6 degrees of freedom.

protected virtual void UpdateIntegration(double time, double step)

Parameters

time double

[s] The current simulation time at this point

step double

[s] The current time-step

UpdateLookup(double, double)

Attempts to use a lookup table for the body based on positions and rotations from the lookup table. This must have been initialised correctly otherwise no lookup parameters will be computed.

protected virtual void UpdateLookup(double time, double step)

Parameters

time double

[s] The current simulation time at this point

step double

[s] The current time-step

UpdateMassProperties(double, double)

Updates the Mass Properties of the body and all components. This will also attempt to cache the data on the components that exist on the heirarchy tree (in the body [B] frame) in a transform state for multiple use. This is the dirty flag.

public override void UpdateMassProperties(double time, double step)

Parameters

time double

The current time [s]

step double

The timestep between each

UpdateOrbit(double, double)

Attempts to adjust the position of the body by propegating the orbit around the current orbiting body. This assumes no other sources of dynamics or physics models.

protected virtual void UpdateOrbit(double time, double step)

Parameters

time double

[s] The current simulation time at this point

step double

[s] The current time-step

UpdateStates(double, double)

Updates the state of the dynamic body including updating the messages, properties and mass of the components. This does not perform the integration.

protected virtual void UpdateStates(double time, double step)

Parameters

time double

The current time [s]

step double

The delta time [s]

WriteOutputMessages(double)

Writes data to output messages that are able to store the state of data.

public virtual void WriteOutputMessages(double time)

Parameters

time double