Module: vscmgStateEffector

This dynamic effector class implements a variable speed control moment gyroscope or VSCMG device.

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


class VSCMGStateEffector : public SysModel, public StateEffector

Public Functions

VSCMGStateEffector()
~VSCMGStateEffector()
void registerStates(DynParamManager &states)
void linkInStates(DynParamManager &states)
void updateEffectorMassProps(double integTime)
void SelfInit()

This method is used to clear out the current VSCMG states and make sure that the overall model is ready

Return

void

void CrossInit()

This method is used to connect the input command message to the VSCMGs. It sets the message ID based on what it finds for the input string. If the message is not successfully linked, it will warn the user.

Return

void

void AddVSCMG(VSCMGConfigSimMsg *NewVSCMG)
void UpdateState(uint64_t CurrentSimNanos)

This method is the main cyclical call for the scheduled part of the VSCMG dynamics model. It reads the current commands array and sets the VSCMG configuration data based on that incoming command set. Note that the main dynamical method (ComputeDynamics()) is not called here and is intended to be called from the dynamics plant in the system

Return

void

Parameters
  • CurrentSimNanos: The current simulation time in nanoseconds

void WriteOutputMessages(uint64_t CurrentClock)

This method is here to write the output message structure into the specified message. It is currently blank but we will certainly have an output message soon. If it is already here, bludgeon whoever added it and didn’t fix the comment.

Return

void

Parameters
  • CurrentClock: The current time used for time-stamping the message

void ReadInputs()

This method is used to read the incoming command message and set the associated command structure for operating the VSCMGs.

Return

void

void ConfigureVSCMGRequests(double CurrentTime)
void updateContributions(double integTime, BackSubMatrices &backSubContr, Eigen::Vector3d sigma_BN, Eigen::Vector3d omega_BN_B, Eigen::Vector3d g_N)

Back-sub contributions

void updateEnergyMomContributions(double integTime, Eigen::Vector3d &rotAngMomPntCContr_B, double &rotEnergyContr, Eigen::Vector3d omega_BN_B)

Energy and momentum calculations

void computeDerivatives(double integTime, Eigen::Vector3d rDDot_BN_N, Eigen::Vector3d omegaDot_BN_B, Eigen::Vector3d sigma_BN)

Method for each stateEffector to calculate derivatives

Public Members

std::vector<VSCMGConfigSimMsg> VSCMGData

VSCMG data structure

Eigen::MatrixXd *g_N

[m/s^2] Gravitational acceleration in N frame components

std::string InputCmds

message used to read command inputs

std::string OutputDataString

port to use for output data

uint64_t OutputBufferCount

Count on number of buffers to output

std::vector<VSCMGCmdSimMsg> NewVSCMGCmds

Incoming torque commands

VSCMGSpeedIntMsg outputStates

(-) Output data from the VSCMGs

std::string nameOfVSCMGOmegasState
std::string nameOfVSCMGThetasState
std::string nameOfVSCMGGammasState
std::string nameOfVSCMGGammaDotsState
int numVSCMG
int numVSCMGJitter
BSKLogger bskLogger

BSK Logging

Private Members

std::vector<std::string> vscmgOutMsgNames

vector with the message names of each VSCMG

std::vector<uint64_t> vscmgOutMsgIds

vector with the ID of each VSCMG

int64_t CmdsInMsgID

Message ID for incoming data

int64_t StateOutMsgID

Message ID for outgoing data

VSCMGArrayTorqueIntMsg IncomingCmdBuffer

One-time allocation for savings

uint64_t prevCommandTime

Time for previous valid thruster firing

StateData *hubSigma
StateData *hubOmega
StateData *hubVelocity
StateData *OmegasState
StateData *thetasState
StateData *gammasState
StateData *gammaDotsState