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.

nHingedRigidBodyStateEffector module input and output messages

Module I/O Messages

Msg Variable Name

Msg Type

Description

nHingedRigidBodyOutMsgs

HingedRigidBodyMsgPayload

Output vector of messages containing the panel angle and angle rate.

nHingedRigidBodyConfigLogOutMsgs

SCStatesMsgPayload

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.


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

Eigen::Matrix3d IPntS_S

[kg-m^2] Inertia of hinged rigid body about point S in S frame components

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

Eigen::Matrix3d dcm_SB

&#8212; DCM from body to S frame

Eigen::Vector3d omega_BN_S

[rad/s] omega_BN in S frame components

Eigen::Vector3d omega_SB_B

[rad/s] omega_SB in B frame components

Eigen::Vector3d sHat1_B

&#8212; unit direction vector for the first axis of the S frame

Eigen::Vector3d sHat2_B

&#8212; unit direction vector for the second axis of the S frame

Eigen::Vector3d sHat3_B

&#8212; unit direction vector for the third axis of the S frame

Eigen::Vector3d r_HB_B

&#8212; Vector pointing from B to this panel’s hinge in B frame components

Eigen::Vector3d rPrime_HB_B

[m/s] Body time derivative of this panel’s r_HB_B

Eigen::Vector3d r_SB_B

&#8212; Vector pointing from B to CoM of hinged rigid body in B frame components

Eigen::Matrix3d rTilde_SB_B

&#8212; Tilde matrix of rSB_B

Eigen::Vector3d rPrime_SB_B

[m/s] Body time derivative of rSB_B

Eigen::Matrix3d rPrimeTilde_SB_B

&#8212; Tilde matrix of rPrime_SB_B

Eigen::Matrix3d ISPrimePntS_B

[kg-m^2/s] time body derivative IPntS in body frame components

Eigen::Vector3d r_ScN_N

[m] position vector of the panel CoM S relative to the inertial frame

Eigen::Vector3d v_ScN_N

[m/s] inertial velocity vector of S relative to the inertial frame

std::string nameOfInertialPositionProperty

&#8212; identifier for the inertial position property

std::string nameOfInertialVelocityProperty

&#8212; identifier for the inertial velocity property

std::string nameOfInertialAttitudeProperty

&#8212; identifier for the inertial attitude property

std::string nameOfInertialAngVelocityProperty

&#8212; 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

Eigen::MatrixXd *sigma_SN = nullptr

&#8212; MRP attitude of panel frame S relative to the inertial frame

Eigen::MatrixXd *omega_SN_S = nullptr

[rad/s] inertial panel frame angular velocity vector

std::vector<DynamicEffector*> dynEffectors

&#8212; Vector of dynamic effectors attached to this panel

Eigen::Vector3d extForce_B

[N] attached effector force on this panel in B frame components

Eigen::Vector3d extTorquePntH_B

[N-m] attached effector torque on this panel about H in B frame components

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()

&#8212; Contructor

This is the constructor, setting variables to default values

~NHingedRigidBodyStateEffector()

&#8212; Destructor

This is the destructor, releasing the per panel output messages

double HeaviFunc(double cond)

&#8212; Heaviside function used for matrix contributions

  • Method for defining the Heaviside function for the EOMs */

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 registerStates(DynParamManager &statesIn) override

&#8212; 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

void registerProperties(DynParamManager &states) override

&#8212; 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

void addDynamicEffector(DynamicEffector *newDynamicEffector, int segment) override

&#8212; 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

&#8212; Method for getting access to other states

This method allows the HRB state effector to have access to the hub states and gravity

void updateEffectorMassProps(double integTime) override

&#8212; 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

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

&#8212; Back-sub contributions

This method allows the HRB state effector to give its contributions to the matrices needed for the back-sub method

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

&#8212; 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

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

&#8212; Method for computing the effector derivatives

This method is used to find the derivatives for the HRB stateEffector: thetaDDot and the kinematic derivative

Public Members

std::string nameOfThetaState

&#8212; Identifier for the theta state data container

std::string nameOfThetaDotState

&#8212; Identifier for the thetaDot state data container

Eigen::Vector3d r_HB_B

[m] vector pointing from body frame origin to the first Hinge location

Eigen::Matrix3d rTilde_HB_B

&#8212; Tilde matrix of rHB_B

Eigen::Matrix3d dcm_HB

&#8212; DCM from body frame to hinge frame

BSKLogger bskLogger

&#8212; BSK Logging

std::vector<Message<HingedRigidBodyMsgPayload>*> nHingedRigidBodyOutMsgs

&#8212; panel state output messages

std::vector<Message<SCStatesMsgPayload>*> nHingedRigidBodyConfigLogOutMsgs

&#8212; panel config log messages

Private Functions

void checkPanelUniformity()

&#8212; Method for rejecting a panel chain the EOMs cannot represent

This method checks that the panel chain is one the equations of motion can represent

void computePanelInertialStates()

&#8212; 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

StateData *thetaState

&#8212; state manager of theta for hinged rigid body

StateData *thetaDotState

&#8212; state manager of thetaDot for hinged rigid body

std::vector<HingedPanel> PanelVec

&#8212; vector containing all the info on the different panels

Eigen::MatrixXd matrixADHRB

[-] term needed for back substitution

Eigen::MatrixXd matrixEDHRB

[-] term needed for back substitution

Eigen::MatrixX3d matrixFDHRB

[-] term needed for back substitution

Eigen::MatrixX3d matrixGDHRB

[-] term needed for back substitution

Eigen::VectorXd vectorVDHRB

[-] term needed for back substitution

Eigen::Vector3d omegaLoc_BN_B

[rad/s] local copy of omegaBN

Eigen::MRPd sigma_BN = {0.0, 0.0, 0.0}

&#8212; Hub attitude relative to the inertial frame

StateData *hubSigmaState = nullptr

hub attitude state, read live for the published kinematics

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

Eigen::MatrixXd *g_N

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

std::string propertyNameIndex

&#8212; effector identifier used to name the per panel properties

bool hasAttachedEffectors = false

&#8212; true once any panel carries a dynamic effector

Private Static Attributes

static uint64_t effectorID = 1

[] ID number of this panel