C++ Module: linearSpringMassDamper
Executive Summary
This class in an instantiation of the state effector class and implements an effector representing a oscillating particle
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 initial-mass check runs before state registration during
spacecraft initialization, including when the effector is attached without being added to a
task. Invalid input raises BasiliskError.
Reset() repeats this configuration check without accessing parent states or changing
integrated displacement, velocity, 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 LinearSpringMassDamper : public StateEffector, public SysModel, public FuelSlosh
- #include <linearSpringMassDamper.h>
linear spring mass damper state effector class
Public Functions
-
LinearSpringMassDamper()
Constructor.
This is the constructor, setting variables to default values
-
~LinearSpringMassDamper()
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 SMD to register its states.
This is the method for the spring mass damper particle to register its states: rho and rhoDot
- Parameters:
states – [inout] Dynamic parameter manager used to register states or properties.
-
void linkInStates(DynParamManager &states) override
Method for SMD to get access of other states.
Method for spring mass damper particle 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 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 calcForceTorqueOnBody(double integTime, Eigen::Vector3d omega_BN_B) override
Force and torque on s/c due to linear spring mass damper.
Calculate the force and torque exerted on the attached body.
- Parameters:
integTime – [in] [s] Current integration time.
omega_BN_B – [in] [rad/s] Hub angular velocity expressed in body-frame components.
-
void updateEffectorMassProps(double integTime) override
Method for stateEffector to give mass contributions.
This is the method for the SMD to add its contributions to the mass props and mass prop rates of the vehicle
- 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 SMD 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 SMD 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 SMD. 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 k
[N/m] linear spring constant for spring mass damper
-
double c
[N-s/m] linear damping term for spring mass damper
-
double rhoInit
[m] Initial value for spring mass damper particle offset
-
double rhoDotInit
[m/s] Initial value for spring mass damper particle offset derivative
-
double massInit
[kg] Initial value for spring mass damper particle mass
-
std::string nameOfRhoState
[-] Identifier for the rho state data container
-
std::string nameOfRhoDotState
[-] Identifier for the rhoDot state data container
-
std::string nameOfMassState
[-] Identifier for the mass state data container
-
BSKLogger bskLogger
BSK Logging.
Private Functions
-
void validateConfiguration()
Validate the initial particle mass without changing its current state.
Validate the initial particle mass, retaining the supported empty-particle case.
Private Members
-
double cRho
Term needed for back-sub method.
-
double rho
[m] spring mass damper displacement from equilibrium
-
double rhoDot
[m/s] time derivative of displacement from equilibrium
-
double massSMD
[kg] mass of spring mass damper particle
Private Static Attributes
-
static uint64_t effectorID = 1
[] ID number of this panel
-
LinearSpringMassDamper()