Module: thrusterDynamicEffector
Executive Summary
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.
Danger
This thruster module is not compatible with variable time step integrators.
Message Connection Descriptions
The following table lists all the module input and output messages. The module msg variable name 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.
Msg Variable Name |
Msg Type |
Description |
---|---|---|
cmdsInMsg |
(optional) input message with thruster commands. If not connected the thruster commands are set to zero. |
|
thrusterOutMsgs |
output message vector for thruster data |
Note
The dynamic behaviour of this module is governed by the variables inside Module: THRTimePair, which determine the on and off-ramp characteristics. The default behaviour is to not have on and off-ramps active. The cutoffFrequency
variable inside Module: THRSimConfig has no impact on this module and is instead supposed to be used to determine the dynamic behaviour within Module: thrusterStateEffector.
-
class ThrusterDynamicEffector : public SysModel, public DynamicEffector
- #include <thrusterDynamicEffector.h>
thruster dynamic effector class
Public Functions
-
ThrusterDynamicEffector()
The Constructor.
-
~ThrusterDynamicEffector()
The destructor.
-
void linkInStates(DynParamManager &states)
This method is used to link the states to the thrusters
- Parameters:
states – The states to link
- Returns:
void
-
void computeForceTorque(double integTime, double timeStep)
This method computes the Forces on Torque on the Spacecraft Body.
- Parameters:
integTime – Integration time
timeStep – Current integration time step used
- Returns:
void
-
void computeStateContribution(double integTime)
This method computes contributions to the fuel mass depletion.
-
void Reset(uint64_t CurrentSimNanos)
This method is used to reset the module.
- Returns:
void
-
void addThruster(THRSimConfig *newThruster)
This method adds new thruster(s) to the thruster set.
- Parameters:
newThruster – thruster sim config(s)
- Returns:
void
-
void addThruster(THRSimConfig *newThruster, Message<SCStatesMsgPayload> *bodyStateMsg)
This method adds new thruster(s) to the thruster set connected to a different body than the hub.
- Parameters:
newThruster – thruster sim config(s)
bodyStateMsg – body states to which thruster(s) are attached
- Returns:
void
-
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
- 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
-
bool ReadInputs()
This method is used to read the incoming command message and set the associated command structure for operating the thrusters.
- Returns:
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.
- Parameters:
currentTime – The current simulation time converted to a double
- Returns:
void
-
void ComputeThrusterFire(THRSimConfig *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.
- Parameters:
CurrentThruster – Pointer to the configuration data for a given thruster
currentTime – The current simulation clock time converted to a double
- Returns:
void
-
void ComputeThrusterShut(THRSimConfig *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.
- Parameters:
CurrentThruster – Pointer to the configuration data for a given thruster
currentTime – The current simulation clock time converted to a double
- Returns:
void
-
void UpdateThrusterProperties()
This method is used to update the location and orientation of the thrusters at every UpdateState call when the thrusters are attached to a body other than the hub.
- Returns:
void
-
void computeBlowDownDecay(THRSimConfig *CurrentThruster)
This method is used to update the blow down effects to the thrust and/or Isp at every computeForceTorque call when the thrusters are attached to a fuel tank subject to blow down effects.
- Returns:
void
-
double thrFactorToTime(THRSimConfig *thrData, std::vector<THRTimePair> *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
- 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
- Returns:
double The time in the ramp associated with the thrust factor
Public Members
-
ReadFunctor<THRArrayOnTimeCmdMsgPayload> cmdsInMsg
— input message with thruster commands
-
std::vector<Message<THROutputMsgPayload>*> thrusterOutMsgs
— output message vector for thruster data
-
int stepsInRamp
class variable
-
std::vector<THRSimConfig> thrusterData
— Thruster information
-
std::vector<double> NewThrustCmds
— Incoming thrust commands
-
double mDotTotal
kg/s Current mass flow rate of thrusters
-
double fuelMass
kg Current total fuel mass of connected fuel tank
-
double prevFireTime
s Previous thruster firing time
-
Eigen::MatrixXd *inertialPositionProperty
[m] r_N inertial position relative to system spice zeroBase/refBase
-
BSKLogger bskLogger
— BSK Logging
Private Members
-
std::vector<THROutputMsgPayload> thrusterOutBuffer
— Message buffer for thruster data
-
THRArrayOnTimeCmdMsgPayload incomingCmdBuffer
— One-time allocation for savings
-
std::vector<ReadFunctor<SCStatesMsgPayload>> attachedBodyInMsgs
vector of body states message where the thrusters attach to
-
SCStatesMsgPayload attachedBodyBuffer
-
std::vector<BodyToHubInfo> bodyToHubInfo
-
uint64_t prevCommandTime
— Time for previous valid thruster firing
-
ThrusterDynamicEffector()