magneticFieldBase#

Executive Summary#

General magnetic field base class used to calculate the magnetic field above a planet using multiple models. The MagneticField class is used to calculate the magnetic field vector above a body using multiple models. This base class is used to hold relevant planetary magnetic field properties to compute answers for a given set of spacecraft locations relative to a specified planet. Specific magnetic field models are implemented as classes that inherit from this base class. Planetary parameters, including position and input message, are settable by the user. In a given simulation, each planet of interest should have only one magnetic field model associated with it linked to the spacecraft in orbit about that body.

Each magnetic field 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

MagneticFieldMsgPayload

vector of magnetic 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 MagneticFieldBase : public SysModel#

magnetic field base class

Subclassed by MagneticFieldCenteredDipole, MagneticFieldWMM

Public Functions

MagneticFieldBase()#

This method initializes some basic parameters for the module.

Returns:

void

~MagneticFieldBase()#

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 name to a vector of sc message names and automatically creates an output message name.

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<MagneticFieldMsgPayload>*> 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#

— BSK Logging