Module: gravityEffector

class SphericalHarmonics

Public Functions

SphericalHarmonics()
~SphericalHarmonics()
bool initializeParameters()
double getK(const unsigned int degree)

[-] configure all spher-harm based on inputs

Eigen::Vector3d computeField(const Eigen::Vector3d pos_Pfix, unsigned int degree, bool include_zero_degree)

——————————Main Interface————————-///

Use to compute the field in position pos, given in a body frame.

Parameters
  • [in] pos: Position in which the field is to be computed.

  • [in] degree: used to compute the field.

  • [out] acc: Vector including the computed field.

  • [in] include_zero_degree: Boolean that determines whether the zero-degree term is included.

bool harmReady()

Public Members

double maxDeg
double radEquator

[-] Maximum degree of the spherical harmonics

double muBody

[-] Reference radius for the planet

std::vector<std::vector<double>> cBar

[-] Gravitation parameter for the planet

std::vector<std::vector<double>> sBar

[-] C coefficient set

std::vector<std::vector<double>> aBar

[-] S coefficient set

std::vector<std::vector<double>> n1

[-] Normalized ‘derived’ Assoc. Legendre

std::vector<std::vector<double>> n2

[-] What am I

std::vector<std::vector<double>> nQuot1

[-] What am I

std::vector<std::vector<double>> nQuot2

[-] What am I

BSKLogger bskLogger

[-] What am I

BSK Logging

class GravBodyData
#include <gravityEffector.h>

Container for gravitational body data.

This class is designed to hold all of the information for a gravity body. The nominal use-case has it initialized at the python level and attached to dynamics using the AddGravityBody method.

The module PDF Description contains further information on this module’s function, how to run it, as well as testing.

Public Functions

GravBodyData()

Set parameters for a gravity body.

~GravBodyData()

Destructor.

void initBody(int64_t moduleID)

Method to initialize the gravity body.

Eigen::Vector3d computeGravityInertial(Eigen::Vector3d r_I, uint64_t simTimeNanos)
double computePotentialEnergy(Eigen::Vector3d r_I)
void loadEphemeris(int64_t moduleID)

Command to load the ephemeris data.

Public Members

bool isCentralBody

Flag indicating that object is center.

bool isDisplayBody

Flag indicating that body is display.

bool useSphericalHarmParams

Flag indicating to use spherical harmonics perturbations.

double mu

[m3/s^2] central body gravitational param

double ephemTime

[s] Ephemeris time for the body in question

double ephIntTime

[s] Integration time associated with the ephem data

double radEquator

[m] Equatorial radius for the body

SpicePlanetStateSimMsg localPlanet

[-] Class storage of ephemeris info from scheduled portion

SingleMessageHeader localHeader
std::string bodyInMsgName

[-] Header information for ephemeris storage

Gravitational body name

std::string outputMsgName

Ephemeris information relative to display frame.

std::string planetEphemName

Ephemeris name for the planet.

int64_t outputMsgID

ID for output message data.

int64_t bodyMsgID

ID for ephemeris data message.

SphericalHarmonics spherHarm

Object that computes the spherical harmonics gravity field.

BSKLogger bskLogger

BSK Logging

class GravityEffector : public SysModel

Public Functions

GravityEffector()
~GravityEffector()
void SelfInit()
void CrossInit()
void UpdateState(uint64_t CurrentSimNanos)
void linkInStates(DynParamManager &statesIn)
void registerProperties(DynParamManager &statesIn)
void computeGravityField(Eigen::Vector3d r_cF_N, Eigen::Vector3d rDot_cF_N)

Calculate gravitational acceleration of s/c wrt inertial (no central body) or wrt central body @params r_cF_N is position of center of mass of s/c wrt frame it is stored/integrated in in spacecraft @params rDot_cF_N is the derivative of above

void updateInertialPosAndVel(Eigen::Vector3d r_BF_N, Eigen::Vector3d rDot_BF_N)

Calculate gravitational acceleration of s/c wrt inertial (no central body) or wrt central body @params r_BF_N is position of body frame of s/c wrt frame it is stored/integrated in in spacecraft @params rDot_BF_N is the derivative of above

void updateEnergyContributions(Eigen::Vector3d r_CN_N, double &orbPotEnergyContr)

Orbital Potential Energy Contributions

void setGravBodies(std::vector<GravBodyData*> gravBodies)
void addGravBody(GravBodyData *gravBody)
void prependSpacecraftNameToStates()

Public Members

std::string vehicleGravityPropName
std::string systemTimeCorrPropName

[-] Name of the vehicle mass state

std::vector<GravBodyData*> gravBodies

[-] Name of the correlation between times

GravBodyData *centralBody

[-] Vector of bodies we feel gravity from

Central body

std::string inertialPositionPropName
std::string inertialVelocityPropName

[-] Name of the inertial position property

std::string nameOfSpacecraftAttachedTo

[-] Name of the inertial velocity property

BSKLogger bskLogger

[-] Name of the s/c this gravity model is attached to

BSK Logging

Private Functions

Eigen::Vector3d getEulerSteppedGravBodyPosition(GravBodyData *bodyData)

Calculate gravitational acceleration of s/c wrt inertial (no central body) or wrt central body @params r_cF_N is position of center of mass of s/c wrt frame it is stored/integrated in in spacecraft @params rDot_cF_N is the derivative of above

void writeOutputMessages(uint64_t currentSimNanos)

Private Members

Eigen::MatrixXd *gravProperty
Eigen::MatrixXd *timeCorr

[-] g_N property for output

int64_t centralBodyOutMsgId

[-] Time correlation property

std::string centralBodyOutMsgName

[-] Id for the central body spice data output message

Eigen::MatrixXd *inertialPositionProperty

[-] Unique name for the central body spice data output message

Eigen::MatrixXd *inertialVelocityProperty

[m] r_N inertial position relative to system spice zeroBase/refBase coordinate frame, property for output.