Module: reactionWheelStateEffector

Executive Summary

Class that is used to implement an effector impacting a dynamic body that does not itself maintain a state or represent a changing component of the body (for example: gravity, thrusters, solar radiation pressure, etc.)

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

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

rwMotorCmdInMsg

ArrayMotorTorqueMsgPayload

(optional) RW motor torque array cmd input message. If not connected the motor torques are set to zero.

rwSpeedOutMsg

RWSpeedMsgPayload

RW speed array output message

rwOutMsgs

RWConfigLogMsgPayload

vector of RW log output messages


class ReactionWheelStateEffector : public SysModel, public StateEffector
#include <reactionWheelStateEffector.h>

reaction wheel state effector class

Public Functions

ReactionWheelStateEffector()
~ReactionWheelStateEffector()
void registerStates(DynParamManager &states)
void linkInStates(DynParamManager &states)
void writeOutputStateMessages(uint64_t integTimeNanos)

This method is here to write the output message structure into the specified message.

Parameters:

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

Returns:

void

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

&#8212; Method for stateEffector to give mass contributions

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

&#8212; Back-sub contributions

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

&#8212; Energy and momentum calculations

void Reset(uint64_t CurrentSimNanos)

Reset the module to origina configuration values.

Returns:

void

void addReactionWheel(RWConfigMsgPayload *NewRW)

add a RW data object to the reactionWheelStateEffector

Returns:

void

void UpdateState(uint64_t CurrentSimNanos)

This method is the main cyclical call for the scheduled part of the RW dynamics model. It reads the current commands array and sets the RW 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

Parameters:

CurrentSimNanos – The current simulation time in nanoseconds

Returns:

void

void WriteOutputMessages(uint64_t CurrentClock)

This method is here to write the output message structure into the specified message.

Parameters:

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

Returns:

void

void ReadInputs()

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

Returns:

void

void ConfigureRWRequests(double CurrentTime)

This method is used to read the new commands vector and set the RW firings appropriately. It assumes that the ReadInputs method has already been run successfully.

Parameters:

CurrentTime – The current simulation time converted to a double

Returns:

void

Public Members

std::vector<RWConfigMsgPayload*> ReactionWheelData

&#8212; RW information

ReadFunctor<ArrayMotorTorqueMsgPayload> rwMotorCmdInMsg

&#8212; RW motor torque array cmd input message

Message<RWSpeedMsgPayload> rwSpeedOutMsg

&#8212; RW speed array output message

std::vector<Message<RWConfigLogMsgPayload>*> rwOutMsgs

&#8212; vector of RW log output messages

std::vector<RWCmdMsgPayload> NewRWCmds

&#8212; Incoming attitude commands

RWSpeedMsgPayload rwSpeedMsgBuffer = {}

(-) Output data from the reaction wheels

std::string nameOfReactionWheelOmegasState

class variable

std::string nameOfReactionWheelThetasState

class variable

size_t numRW

number of reaction wheels

size_t numRWJitter

number of RW with jitter

BSKLogger bskLogger

&#8212; BSK Logging

Private Members

ArrayMotorTorqueMsgPayload incomingCmdBuffer = {}

&#8212; One-time allocation for savings

uint64_t prevCommandTime

&#8212; Time for previous valid thruster firing

StateData *OmegasState

class variable

StateData *thetasState

class variable

Eigen::MatrixXd *g_N

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