C++ Module: nHingedRigidBodyStateEffector
Executive Summary
This class is an instantiation of the stateEffector class and is a N-hinged rigid body effector. This effector is a rigid body attached to the hub through a torsional spring and damper that approximates a flexible appendage. See Allard, Schaub, and Piggott paper: General Hinged Solar Panel Dynamics Approximating First-Order Spacecraft Flexing for a detailed description of this model. A hinged rigid body has 2 states: theta and thetaDot
The module
PDF Description
contains further information on this module’s function,
how to run it, as well as testing.
Important
The equations of motion are derived for a chain of identical panels. Every panel must carry the
same positive mass and the same hinge to center of mass distance d, and each hinge sits
2d from the one before it. The panel inertia IPntS_S may differ from panel to panel.
Initialization rejects a chain that violates the mass or distance requirement. An uneven chain
is modeled with C++ Module: dualHingedRigidBodyStateEffector for two panels, or with
C++ Module: spinningBodyNDOFStateEffector for an arbitrary number.
Message Connection Descriptions
The following table lists all the module output messages. Each is a vector carrying one message per panel, ordered outward from the hub.
Msg Variable Name |
Msg Type |
Description |
|---|---|---|
nHingedRigidBodyOutMsgs |
Output vector of messages containing the panel angle and angle rate. |
|
nHingedRigidBodyConfigLogOutMsgs |
Output vector of messages containing the panel inertial states. The position and velocity are those of the panel center of mass, and the attitude and angular velocity are those of the panel frame S. |
Initialization and Reset
The chain must contain at least one panel. Each panel’s mass must be finite and strictly
positive, and the combined panel mass must remain finite. The uniformity requirements above
apply to both mass and d, and each d must be finite. dcm_HB must be a finite,
orthogonal, right-handed rotation matrix; scaled axes and reflections are rejected.
These checks run before state registration during spacecraft initialization, including when
the effector is attached without being added to a task. Reset() performs the same checks
without accessing parent states or changing integrated panel states. It does not rebuild the
registered state layout. Invalid configurations raise BasiliskError.
See Initialization and Configuration Validation.
Hosting a Dynamic Effector
This effector supports the branching described in Advanced: Effector Module Branching, so a compatible dynamic effector can be carried by one of the panels rather than by the hub:
panelEffector.addDynamicEffector(childEffector, segment)
Here segment is the one-based panel number, counting outward from the hub, so 1 is the
panel attached to the hub.
This effector then makes its inertial position, velocity, attitude, and angular velocity available in place of the hub’s, and the child reads whichever of the four its model needs. Any geometry given to the child is expressed in that panel’s frame rather than the hub body frame. Both this effector and the child are still added to the task in the usual way.
-
struct HingedPanel
- #include <nHingedRigidBodyStateEffector.h>
Struct containing all the panel variables. All members are public by default so they can be changed by methods of the N_hingedRigidBodyStateEffector class.
Public Functions
-
template<typename Type>
inline void assignStateParamNames(Type effector) Assign this panel’s state-engine property names to an attached effector.
- Template Parameters:
Type – Pointer type for an effector that accepts inertial property names.
- Parameters:
effector – Effector that receives the panel’s inertial property names.
Public Members
-
double mass = 1.0
[kg] mass of hinged panel
-
double d = 1.0
[m] distance from hinge point to hinged rigid body center of mass
-
double k = 1.0
[N-m/rad] torsional spring constant of hinge
-
double c = 0.0
[N-m-s/rad] rotational damping coefficient of hinge
-
double thetaInit = 0.0
[rad] Initial hinged rigid body angle
-
double thetaDotInit = 0.0
[rad/s] Initial hinged rigid body angle rate
-
double theta = 0.0
[rad] hinged rigid body angle
-
double theta_0 = 0.0
[rad] hinged rigid body rest angle
-
double thetaDot = 0.0
[rad/s] hinged rigid body angle rate
-
std::string nameOfInertialPositionProperty
identifier for the inertial position property
-
std::string nameOfInertialVelocityProperty
identifier for the inertial velocity property
-
std::string nameOfInertialAttitudeProperty
identifier for the inertial attitude property
-
std::string nameOfInertialAngVelocityProperty
identifier for the inertial angular velocity property
-
Eigen::MatrixXd *r_HN_N = nullptr
[m] position vector of the panel hinge H relative to the inertial frame
-
Eigen::MatrixXd *v_HN_N = nullptr
[m/s] inertial velocity vector of H relative to the inertial frame
-
std::vector<DynamicEffector*> dynEffectors
Vector of dynamic effectors attached to this panel.
-
template<typename Type>
-
class NHingedRigidBodyStateEffector : public StateEffector, public SysModel
- #include <nHingedRigidBodyStateEffector.h>
NHingedRigidBodyStateEffector class.
Public Functions
-
void addHingedPanel(HingedPanel NewPanel)
class method
This method appends a panel to the chain along with its output messages
- Parameters:
NewPanel – the panel to append to the chain
-
NHingedRigidBodyStateEffector()
Constructor.
This is the constructor, setting variables to default values
-
~NHingedRigidBodyStateEffector()
Destructor.
This is the destructor, releasing the per panel output messages
-
double HeaviFunc(double cond)
Heaviside function used for matrix contributions.
Define the Heaviside function used by the equations of motion.
- Parameters:
cond – [in] Condition evaluated by the Heaviside function.
-
void writeOutputStateMessages(uint64_t CurrentClock) override
This method takes the computed theta states and outputs them to the messaging system.
- Parameters:
CurrentClock – The current simulation time (used for time stamping)
-
void UpdateState(uint64_t CurrentSimNanos) override
This method is used so that the simulation will ask HRB to update messages.
- Parameters:
CurrentSimNanos – The current simulation time in nanoseconds
-
void Reset(uint64_t CurrentSimNanos) override
Validate configuration without changing integrated states.
- Parameters:
CurrentSimNanos – [ns] Current simulation time.
-
void registerStates(DynParamManager &statesIn) override
Method for registering the HRB states.
This method allows the HRB state effector to register its states: theta and thetaDot with the dyn param manager
- Parameters:
statesIn – [inout] Dynamic parameter manager used to register states or properties.
-
void registerProperties(DynParamManager &states) override
Method for registering the panel properties.
This method registers the panel inertial properties with the dynamic parameter manager and links them into dependent dynamic effectors
- Parameters:
states – [inout] Dynamic parameter manager used to register states or properties.
-
void addDynamicEffector(DynamicEffector *newDynamicEffector, int segment) override
Attach an effector.
This method attaches a dynamicEffector to one of the panels
- Parameters:
newDynamicEffector – the dynamic effector to be attached
segment – the panel to attach to, counting outward from the hub starting at 1
-
void linkInStates(DynParamManager &states) override
Method for getting access to other states.
This method allows the HRB state effector to have access to the hub states and gravity
- Parameters:
states – [in] Dynamic parameter manager containing the required states.
-
void updateEffectorMassProps(double integTime) override
Method for stateEffector to give mass contributions.
This method allows the HRB state effector to provide its contributions to the mass props and mass prop rates of the spacecraft
- Parameters:
integTime – [in] [s] Current integration time.
-
void updateContributions(double integTime, BackSubMatrices &backSubContr, Eigen::MRPd sigma_BN, Eigen::Vector3d omega_BN_B, Eigen::Vector3d g_N) override
Back-sub contributions.
This method allows the HRB state effector to give its contributions to the matrices needed for the back-sub method
- Parameters:
integTime – [in] [s] Current integration time.
backSubContr – [inout] Backsubstitution contributions.
sigma_BN – [in] Hub attitude relative to the inertial frame.
omega_BN_B – [in] [rad/s] Hub angular velocity expressed in body-frame components.
g_N – [in] [m/s^2] Gravitational acceleration expressed in inertial-frame components.
-
void updateEnergyMomContributions(double integTime, Eigen::Vector3d &rotAngMomPntCContr_B, double &rotEnergyContr, Eigen::Vector3d omega_BN_B) override
Energy and momentum calculations.
This method is for calculating the contributions of the HRB state effector to the energy and momentum of the s/c
- Parameters:
integTime – [in] [s] Current integration time.
rotAngMomPntCContr_B – [inout] [kg*m^2/s] Rotational angular momentum contribution.
rotEnergyContr – [inout] [J] Rotational energy contribution.
omega_BN_B – [in] [rad/s] Hub angular velocity expressed in body-frame components.
-
void computeDerivatives(double integTime, Eigen::Vector3d rDDot_BN_N, Eigen::Vector3d omegaDot_BN_B, Eigen::MRPd sigma_BN) override
Method for computing the effector derivatives.
This method is used to find the derivatives for the HRB stateEffector: thetaDDot and the kinematic derivative
- Parameters:
integTime – [in] [s] Current integration time.
rDDot_BN_N – [in] [m/s^2] Hub translational acceleration expressed in inertial-frame components.
omegaDot_BN_B – [in] [rad/s^2] Hub angular acceleration expressed in body-frame components.
sigma_BN – [in] Hub attitude relative to the inertial frame.
Public Members
-
std::string nameOfThetaState
Identifier for the theta state data container.
-
std::string nameOfThetaDotState
Identifier for the thetaDot state data container.
-
BSKLogger bskLogger
BSK Logging.
-
std::vector<Message<HingedRigidBodyMsgPayload>*> nHingedRigidBodyOutMsgs
panel state output messages
-
std::vector<Message<SCStatesMsgPayload>*> nHingedRigidBodyConfigLogOutMsgs
panel config log messages
Private Functions
-
void validateConfiguration()
Validate panel masses, uniformity, and the configured hinge-frame DCM.
Validate panel masses, uniformity, and the fixed hinge orientation before state registration.
-
void computePanelInertialStates()
Method for computing the panel states relative to the inertial frame.
This method computes the panel states relative to the inertial frame
Private Members
-
double totalMass
[kg] Total mass of effector
-
std::vector<HingedPanel> PanelVec
vector containing all the info on the different panels
-
Eigen::MatrixXd *inertialPositionProperty = nullptr
[m] r_N position relative to system spice zeroBase
-
Eigen::MatrixXd *inertialVelocityProperty = nullptr
[m/s] v_N velocity relative to system spice zeroBase
-
std::string propertyNameIndex
effector identifier used to name the per panel properties
-
bool hasAttachedEffectors = false
true once any panel carries a dynamic effector
Private Static Attributes
-
static uint64_t effectorID = 1
[] ID number of this panel
-
void addHingedPanel(HingedPanel NewPanel)