Module: atmosphereBase

Executive Summary

General atmosphere base class used to calculate neutral density/temperature using arbitrary models The Atmosphere class is used to calculate the neutral density and temperature above a body using arbitrary models. Each atmosphere is attached to a specific planet, but provides support for multiple spacecraft through addSpacecraftToModel().

Message Connection Descriptions

The following table lists all the module input and output messages. The module msg connection is set by the user from python. The msg type contains a link to the message structure definition, while the description provides information on what this message is used for.

Module I/O Messages

Msg Variable Name

Msg Type

Description

scStateInMsgs

SCStatesMsgPayload

vector of spacecraft state input messages

envOutMsgs

AtmoPropsMsgPayload

vector of atmospheric density output messages

planetPosInMsg

SpicePlanetStateMsgPayload

(optional) planet state input message. If not provided the planet state is zero information.

epochInMsg

EpochMsgPayload

(optional) epoch date/time input message


class AtmosphereBase : public SysModel
#include <atmosphereBase.h>

atmospheric density base class

Public Functions

AtmosphereBase()

This method initializes some basic parameters for the module.

Returns:

void

~AtmosphereBase()

Destructor.

Returns:

void

void Reset(uint64_t CurrentSimNanos)

This method is used to reset the module.

Returns:

void

void addSpacecraftToModel(Message<SCStatesMsgPayload> *tmpScMsg)

Adds the spacecraft message to a vector of sc messages and automatically creates the corresponding output message.

Parameters:

tmpScMsg – A spacecraft state message name.

Returns:

void

void UpdateState(uint64_t CurrentSimNanos)

Computes the current local magnetic field for each spacecraft and writes their respective messages.

Parameters:

CurrentSimNanos – The current simulation time in nanoseconds

Returns:

void

Public Members

std::vector<ReadFunctor<SCStatesMsgPayload>> scStateInMsgs

Vector of the spacecraft position/velocity input message.

std::vector<Message<AtmoPropsMsgPayload>*> envOutMsgs

Vector of message names to be written out by the environment.

ReadFunctor<SpicePlanetStateMsgPayload> planetPosInMsg

Message name for the planet’s SPICE position message.

ReadFunctor<EpochMsgPayload> epochInMsg

(optional) epoch date/time input message

double envMinReach

[m] Minimum planet-relative position needed for the environment to work, default is off (neg. value)

double envMaxReach

[m] Maximum distance at which the environment will be calculated, default is off (neg. value)

double planetRadius

[m] Radius of the planet

BSKLogger bskLogger

&#8212; BSK Logging

Protected Functions

void writeMessages(uint64_t CurrentClock)

This method is used to write the output magnetic field messages whose names are established in AddSpacecraftToModel.

Parameters:

CurrentClock – The current time used for time-stamping the message

Returns:

void

bool readMessages()

This method is used to read the incoming command message and set the associated spacecraft positions for computing the atmosphere.

Returns:

void

void updateLocalAtmosphere(double currentTime)

This method is used to update the local magnetic field based on each spacecraft’s position.

Returns:

void

void updateRelativePos(SpicePlanetStateMsgPayload *planetState, SCStatesMsgPayload *scState)

This method is used to determine the spacecraft position vector relative to the planet.

Parameters:
  • planetState – A space planetstate message struct.

  • scState – A spacecraft states message struct.

Returns:

void

virtual void evaluateAtmosphereModel(AtmoPropsMsgPayload *msg, double currentTime) = 0

class method

virtual void customReset(uint64_t CurrentClock)

Custom Reset() method. This allows a child class to add additional functionality to the Reset() method

Returns:

void

virtual void customWriteMessages(uint64_t CurrentClock)

Custom output message writing method. This allows a child class to add additional functionality.

Returns:

void

virtual bool customReadMessages()

Custom output input reading method. This allows a child class to add additional functionality.

Returns:

void

virtual void customSetEpochFromVariable()

Custom customSetEpochFromVariable() method. This allows a child class to specify how the module epoch information is set by a module variable.

Returns:

void

Protected Attributes

Eigen::Vector3d r_BP_N

[m] sc position vector relative to planet in inertial N frame components

Eigen::Vector3d r_BP_P

[m] sc position vector relative to planet in planet-fixed frame components

double orbitRadius

[m] sc orbit radius about planet

double orbitAltitude

[m] sc altitude above planetRadius

std::vector<AtmoPropsMsgPayload> envOutBuffer

&#8212; Message buffer for magnetic field messages

std::vector<SCStatesMsgPayload> scStates

vector of the spacecraft state messages

SpicePlanetStateMsgPayload planetState

planet state message

struct tm epochDateTime

time/date structure containing the epoch information using a Gregorian calendar