eclipse

The eclipse class gets generates sun illumination state at a particular inertial position.

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

class Eclipse : public SysModel

Public Functions

Eclipse()
~Eclipse()
void SelfInit()

This method initializes the object. It creates the module’s output messages.

Return

void

void CrossInit()

This method subscribes to the spice planet states and spaceccraft state messages.

Return

void

void UpdateState(uint64_t CurrentSimNanos)

This method governs the calculation and checking for eclipse conditions.

Return

void

Parameters
  • CurrentSimNanos: The current clock time for the simulation

void writeOutputMessages(uint64_t CurrentClock)

This method takes the computed shadow factors and outputs them to the m messaging system.

Return

void

Parameters
  • CurrentClock: The current simulation time (used for time stamping)

std::string addPositionMsgName(std::string msgName)

This method adds spacecraft state data message names to a vector, creates a new unique output message name for the eclipse data message and returns this to the user so that they may assign the eclipse message name to other modules requiring eclipse data. methods.

Return

std::string newEclipseMsgName The unique eclipse data msg name associated with the given input state message name.

Parameters
  • std::string: msgName The message name for the spacecraft state data for which to compute the eclipse data.

void addPlanetName(std::string planetName)

This method adds spacecraft state data message names to a vector, creates a new unique output message name for the eclipse data message and returns this to the user so that they may assign the eclipse message name to other modules requiring eclipse data. methods.

Return

std::string newEclipseMsgName The unique eclipse data msg name associated with the given input state message name.

Parameters
  • std::string: msgName The message name for the spacecraft state data for which to compute the eclipse data.

Public Members

uint64_t outputBufferCount

Number of output buffers to use

std::string sunInMsgName

Internal vector of planets

BSKLogger bskLogger

BSK Logging

Private Functions

void readInputMessages()

This method reads the spacecraft state and spice planet states from the messaging system.

Return

void

Parameters
  • CurrentClock: The current simulation time (used for time stamping)

double computePercentShadow(double planetRadius, Eigen::Vector3d r_HB_N, Eigen::Vector3d s_BP_N)

This method computes the fraction of sunlight given an eclipse.

Return

double fractionShadow The eclipse shadow fraction.

Parameters
  • std::string: msgName .

double getPlanetEquatorialRadius(std::string planetSpiceName)

This method return planet radii. methods.

Return

double The equatorial radius in metres associated with the given planet name.

Parameters
  • std::string: planetSpiceName The planet name according to the spice NAIF Integer ID codes.

Private Members

std::vector<std::string> planetNames

Names of planets we want to track

std::vector<std::string> planetInMsgNames

A vector of planet incoming message names ordered by the sequence in which planet names are added to the module

std::map<int64_t, SpicePlanetStateSimMsg> planetInMsgIdAndStates

A map of incoming planet message Ids and planet state ordered by the sequence in which planet names are added to the module

std::vector<float> planetRadii

[m] A vector of planet radii ordered by the sequence in which planet names are added to the module

int64_t sunInMsgId

Internal

SpicePlanetStateSimMsg sunInMsgState
std::vector<std::string> positionMsgNames

vector of msg names for each position state for which to evaluate eclipse conditions.

std::map<int64_t, SCPlusStatesSimMsg> positionInMsgIdAndState
std::vector<int64_t> eclipseOutMsgId
std::vector<std::string> eclipseOutMsgNames
std::vector<double> eclipseShadowFactors