C++ Module: sphericalPendulum

Executive Summary

This class in an instantiation of the state effector class and implements an effector representing spherical pendulum.

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

Message Connection Descriptions

This state effector does not have any input or output messages.

Initialization and Reset

massInit must be finite and non-negative. Zero initial mass and depletion to zero during integration remain supported. The damping matrix D must be finite, symmetric, and positive semidefinite; both zero damping and singular positive-semidefinite damping are permitted.

These checks run before state registration during spacecraft initialization, including when the effector is attached without being added to a task. Invalid configurations raise BasiliskError. Reset() repeats the checks without accessing parent states or changing integrated angles, angular rates, or mass. In particular, it does not restore depleted mass from massInit. Initial values are applied during state registration. See Initialization and Configuration Validation.


class SphericalPendulum : public StateEffector, public SysModel, public FuelSlosh
#include <sphericalPendulum.h>

spherical pendulum state effector model

Public Functions

SphericalPendulum()

Constructor.

This is the constructor, setting variables to default values

~SphericalPendulum()

Destructor.

This is the destructor, nothing to report here

void Reset(uint64_t CurrentSimNanos) override

Validate configuration without restoring depleted mass or changing integrated states.

Parameters:

CurrentSimNanos – [ns] Current simulation time.

void registerStates(DynParamManager &states) override

Method for FSP to register its states.

This is the method for the spherical pendulum to register its states: l and lDot

Parameters:

states – [inout] Dynamic parameter manager used to register states or properties.

void linkInStates(DynParamManager &states) override

Method for FSP to get access of other states.

Method for spherical pendulum to access the states that it needs. It needs gravity and the hub states

Parameters:

states – [in] Dynamic parameter manager containing the required states.

void updateEffectorMassProps(double integTime) override

Method for FSP to add its contributions to mass props.

This is the method for the FSP to add its contributions to the mass props and mass prop rates of the vehicle

Parameters:

integTime – [in] [s] Current integration time.

void modifyStates(double integTime) override

Method to force states modification during integration.

Apply post-integration state modifications.

Parameters:

integTime – [in] [s] Current integration time.

void retrieveMassValue(double integTime) override

This method is used to pass mass properties information to the fuel tank

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 is for the FSP to add its contributions to 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 the FSP to add its contributions to energy and momentum

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 each stateEffector to calculate derivatives.

This method is used to define the derivatives of the FSP. One is the trivial kinematic derivative and the other is derived using the back-sub method

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

double pendulumRadius

[m] distance between the center of the tank and the spherical pendulum mass

Eigen::Matrix3d D

[N*s/m] symmetric positive-semidefinite damping matrix in P0 components

double phiDotInit

[rad/s] Initial value for spherical pendulum pendulum offset derivative

double thetaDotInit

[rad/s] Initial value for spherical pendulum pendulum offset derivative

double massInit

[kg] Initial value for spherical pendulum mass

std::string nameOfPhiState

[-] Identifier for the phi state data container

std::string nameOfThetaState

[-] Identifier for the theta state data container

std::string nameOfPhiDotState

[-] Identifier for the phiDot state data container

std::string nameOfThetaDotState

[-] Identifier for the thetaDot state data container

std::string nameOfMassState

[-] Identifier for the mass state data container

Eigen::Vector3d d

[m] position vector from B point to tank center , T, in body frame

StateData *massState = nullptr

state data for the pendulums mass

Eigen::Vector3d pHat_01

first vector of the P0 frame in B frame components

Eigen::Vector3d pHat_02

second vector of the P0 frame in B frame components

Eigen::Vector3d pHat_03

third vector of the P0 frame in B frame components

BSKLogger bskLogger

BSK Logging.

Private Functions

void validateConfiguration()

Validate initial mass and damping without changing the current states.

Validate initial mass and damping, retaining zero mass and semidefinite damping.

Private Members

double phiInit

[rad] Initial value for spherical pendulum pendulum offset

double thetaInit

[rad] Initial value for spherical pendulum pendulum offset

double phi

[rad] spherical pendulum displacement in P0 frame

double theta

[rad] spherical pendulum displacement in P0 frame

double phiDot

[rad/s] time derivative of displacement in P0 frame

double thetaDot

[rad/s] time derivative of displacement in P0 frame

double massFSP

[kg] mass of spherical pendulum pendulum

Eigen::Vector3d r_PcB_B

[m] position vector form B to center of mass location of pendulum

Eigen::Matrix3d rTilde_PcB_B

[m] tilde matrix of r_Pc_B

Eigen::Vector3d rPrime_PcB_B

[m/s] Body time derivative of r_Pc_B

Eigen::Matrix3d rPrimeTilde_PcB_B

[m/s] Tilde matrix of rPrime_PcB_B

Eigen::Vector3d aPhi

Term needed for back-sub method.

Eigen::Vector3d bPhi

Term needed for back-sub method.

Eigen::Vector3d aTheta

Term needed for back-sub method.

Eigen::Vector3d bTheta

Term needed for back-sub method.

double cPhi

Term needed for back-sub method.

double cTheta

Term needed for back-sub method.

Eigen::MatrixXd *g_N

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

Eigen::Vector3d l_B

[m] vector from the center of the tank to the spherical pendulum pendulum in B frame

Eigen::Vector3d lPrime_B

[m/s] derivative of l respect to B frame

Eigen::Vector3d lPrime_P0

[m/s] derivative of l in P0 frame

StateData *phiState

state data for spherical pendulum displacement

StateData *thetaState

state data for spherical pendulum displacement

StateData *phiDotState

state data for time derivative of phi;

StateData *thetaDotState

state data for time derivative of theta;

Eigen::Matrix3d dcm_B_P0

Private Static Attributes

static uint64_t effectorID = 1

[] ID number of this panel