C++ Module: MtbEffector
Executive Summary
This module converts magnetic torque bar dipoles to body torques.
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.
Msg Variable Name |
Msg Type |
Description |
|---|---|---|
mtbCmdInMsg |
input msg for commanded Magnetic Torque Bar (MTB) dipole array in the magnetic torque bar frame T. |
|
magInMsg |
input msg for magnetic field data in inertial frame N. |
|
mtbParamsInMsg |
input msg for layout of magnetic torque bars. |
|
mtbOutMsg |
output message containing net torque produced by the torque bars in body frame B components. |
User Guide
Note that the MTB input configuration message variable GtMatrix_B must be provided in a row major format.
Initialization and Reset
When the spacecraft links this effector to the hub attitude state, initialization verifies that mtbCmdInMsg,
magInMsg, and mtbParamsInMsg are connected. This validation occurs even if only the spacecraft is added
to a task.
The configuration message’s numMTB must lie between zero and MAX_EFF_CNT, inclusive.
An already-written configuration is checked during attachment and Reset(). Torque evaluation checks every
configuration it consumes before transposing the alignment matrix or indexing the dipole arrays. Invalid counts
raise BasiliskError; a zero-bar configuration produces zero torque.
Torque evaluation is driven by the spacecraft dynamics and reads the input messages directly. Add the effector
to a task when mtbOutMsg must be updated, because the effector publishes that message from UpdateState().
When the effector is scheduled, its Reset() repeats the required-message checks and
zeros all external force and torque outputs. The cached input-message data is not cleared.
-
class MtbEffector : public SysModel, public DynamicEffector
- #include <MtbEffector.h>
This module converts magnetic torque bar dipoles to body torques.
Public Functions
-
MtbEffector()
This is the constructor for the module class. It sets default variable values and initializes the various parts of the model
-
~MtbEffector()
Module Destructor
-
void Reset(uint64_t CurrentSimNanos)
Reset the effector outputs and validate required input-message connections.
- Parameters:
CurrentSimNanos – [ns] Time at which the reset occurs
-
void UpdateState(uint64_t CurrentSimNanos)
This is the main method that gets called every time the module is updated. Provide an appropriate description.
- Parameters:
CurrentSimNanos – [in] [ns] Current simulation time.
-
void linkInStates(DynParamManager &states)
This method is used to link the magnetic torque bar effector to the hub attitude.
- Parameters:
states – [in] Dynamic parameter manager containing the required states.
-
void computeForceTorque(double integTime, double timeStep)
This method computes the body torque contribution from all magnetic torque bars.
- Parameters:
integTime – [in] [s] Current integration time.
timeStep – [in] [s] Integration time step.
-
void WriteOutputMessages(uint64_t CurrentClock)
Write the magnetic torque bar output message.
- Parameters:
CurrentClock – [in] [ns] Current simulation time.
Public Members
-
Message<MTBMsgPayload> mtbOutMsg
output message containing net torque produced by the torque bars in Body components
-
ReadFunctor<MTBCmdMsgPayload> mtbCmdInMsg
input msg for commanded mtb dipole array in the magnetic torque bar frame T
-
ReadFunctor<MagneticFieldMsgPayload> magInMsg
input msg for magnetic field data in inertial frame N
-
ReadFunctor<MTBArrayConfigMsgPayload> mtbParamsInMsg
input msg for layout of magnetic torque bars
-
BSKLogger bskLogger
BSK Logging.
Private Functions
-
void validateConfiguration()
Validate required input connections and the count in an already-written configuration.
Private Members
-
MTBCmdMsgPayload mtbCmdInMsgBuffer
msg buffer or commanded mtb dipole array in the magnetic torque bar frame T
-
MagneticFieldMsgPayload magInMsgBuffer
msg buffer for magnetic field data in inertial frame N
-
MTBArrayConfigMsgPayload mtbConfigParams
msg for layout of magnetic torque bars
-
MtbEffector()