Module: thrusterDynamicEffector

Thruster dynamics class used to provide thruster effects on body. This class is used to hold and operate a set of thrusters that are located on the spacecraft. It contains all of the configuration data for the thruster set, reads an array of on-time requests (double precision in seconds). It is intended to be attached to the dynamics plant in the system using the DynEffector interface and as such, does not directly write the current force or torque into the messaging system. The nominal interface to dynamics are the dynEffectorForce and dynEffectorTorque arrays that are provided by the DynEffector base class. There is technically double inheritance here, but both the DynEffector and SysModel classes are abstract base classes so there is no risk of diamond.

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


class ThrusterDynamicEffector : public SysModel, public DynamicEffector

Public Functions

ThrusterDynamicEffector()

The Constructor.

~ThrusterDynamicEffector()

The destructor.

void linkInStates(DynParamManager &states)

This method is used to link the states to the thrusters

Return

void

Parameters
  • states: The states to link

void computeForceTorque(double integTime)

This method computes the Forces on Torque on the Spacecraft Body.

Return

void

Parameters
  • integTime: Integration time

void computeStateContribution(double integTime)
void SelfInit()

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

Return

void

void CrossInit()

This method is used to connect the input command message to the thrusters. 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 addThruster(THRConfigSimMsg *newThruster)

Add a new thruster to the thruster set.

void UpdateState(uint64_t CurrentSimNanos)

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

Return

void

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

bool ReadInputs()

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

Return

void

void ConfigureThrustRequests(double currentTime)

This method is used to read the new commands vector and set the thruster firings appropriately. It assumes that the ReadInputs method has already been run successfully. It honors all previous thruster firings if they are still active. Note that for unit testing purposes you can insert firings directly into NewThrustCmds.

Return

void

Parameters
  • currentTime: The current simulation time converted to a double

void ComputeThrusterFire(THRConfigSimMsg *CurrentThruster, double currentTime)

This method is used to get the current force for a thruster firing. It uses the configuration data associated with a given thruster and the current clock time to determine what state and force the thruster should be in.

Return

void

Parameters
  • CurrentThruster: Pointer to the configuration data for a given thruster

  • CurrentTime: The current simulation clock time converted to a double

void ComputeThrusterShut(THRConfigSimMsg *CurrentThruster, double currentTime)

This method is used to go through the process of shutting down a thruster once it has been commanded off. It uses the configuration data associated with a given thruster and the current clock time to turn off the thruster according to the ramp profile.

Return

void

Parameters
  • CurrentThruster: Pointer to the configuration data for a given thruster

  • CurrentTime: The current simulation clock time converted to a double

double thrFactorToTime(THRConfigSimMsg *thrData, std::vector<THRTimePairSimMsg> *thrRamp)

This method finds the location in the time in the specified ramp that corresponds to the current thruster thrust factor. It is designed to initialize the ramp-up and ramp-down effects to the appropriate point in their respective ramps based on the initial force

Return

double The time in the ramp associated with the thrust factor

Parameters
  • thrData: The data for the thruster that we are currently firing

  • thrRamp: This just allows us to avoid switching to figure out which ramp

Public Members

int stepsInRamp
std::vector<THRConfigSimMsg> thrusterData

Thruster information

std::string InputCmds

message used to read command inputs

std::string inputProperties

[-] The mass properties of the spacecraft

uint64_t thrusterOutMsgNameBufferCount

Count on number of buffers to output

std::vector<std::string> thrusterOutMsgNames

Message name for all thruster data

std::vector<double> NewThrustCmds

Incoming thrust commands

double mDotTotal

kg/s Current mass flow rate of thrusters

double prevFireTime

s Previous thruster firing time

StateData *hubSigma
StateData *hubOmega
BSKLogger bskLogger

BSK Logging

Private Members

std::vector<uint64_t> thrusterOutMsgIds

Message ID of each thruster

std::vector<THROutputSimMsg> thrusterOutBuffer

Message buffer for thruster data

int64_t CmdsInMsgID

Message ID for incoming data

THRArrayOnTimeCmdIntMsg IncomingCmdBuffer

One-time allocation for savings

uint64_t prevCommandTime

Time for previous valid thruster firing