Module: spacecraftDynamics¶
This is an instantiation of the Module: dynamicObject abstract class that is a spacecraft with Module: stateEffector’s and Module: dynamicEffector’s attached to it. The spacecraftDynamics allows for both translation and rotation. Module: stateEffector’s such as RWs, flexible solar panel, fuel slosh etc can be added to the spacecraft by attaching stateEffectors. Module: dynamicEffector’s such as thrusters, external force and torque, SRP etc can be added to the spacecraft by attaching dynamicEffectors. This class performs all of this interaction between stateEffectors, dynamicEffectors and the hub. In contrast to Module: spacecraftPlus, this class allows for several complex spacecraft components to form a system. This hubs can be rigidly connected or free-flying.
The module
PDF Description
contains further information on this module’s function,
how to run it, as well as testing.
-
class
Spacecraft
¶ Public Functions
-
Spacecraft
()¶
-
~Spacecraft
()¶
-
void
addStateEffector
(StateEffector *newStateEffector)¶ Attaches a stateEffector to the system
-
void
addDynamicEffector
(DynamicEffector *newDynamicEffector)¶ Attaches a dynamicEffector
-
void
addDockingPort
(DockingData *newDockingPort)¶ Attaches a dynamicEffector
-
void
SelfInitSC
(int64_t moduleID)¶ Lets spacecraft plus create its own msgs
-
void
CrossInitSC
()¶ Hook to tie s/c plus back into provided msgs
-
void
writeOutputMessagesSC
(uint64_t clockTime, int64_t moduleID)¶ Method to write all of the class output messages
-
void
linkInStatesSC
(DynParamManager &statesIn)¶ Method to get access to the hub’s states.
-
void
initializeDynamicsSC
(DynParamManager &statesIn)¶
Public Members
-
bool
docked
¶
-
int64_t
scStateOutMsgId
¶ Message ID for the outgoing spacecraft state
-
int64_t
scMassStateOutMsgId
¶ Message ID for the outgoing spacecraft mass state
-
int64_t
scEnergyMomentumOutMsgId
¶ Message ID for the outgoing spacecraft mass state
-
uint64_t
numOutMsgBuffers
¶ Number of output message buffers for I/O
-
std::string
spacecraftName
¶ Name of the spacecraft so that multiple spacecraft can be distinguished
-
std::string
scStateOutMsgName
¶ Name of the state output message
-
std::string
scMassStateOutMsgName
¶ Name of the state output message
-
std::string
scEnergyMomentumOutMsgName
¶ Name of the state output message
-
double
totOrbEnergy
¶ [J] Total orbital kinetic energy
-
double
totRotEnergy
¶ [J] Total rotational energy
-
double
rotEnergyContr
¶ [J] Contribution of stateEffector to total rotational energy
-
double
orbPotentialEnergyContr
¶ [J] Contribution of stateEffector to total rotational energy
-
Eigen::Vector3d
totOrbAngMomPntN_N
¶ [kg m^2/s] Total orbital angular momentum about N in N frame compenents
-
Eigen::Vector3d
totRotAngMomPntC_N
¶ [kg m^2/s] Total rotational angular momentum about C in N frame compenents
-
Eigen::Vector3d
rotAngMomPntCContr_B
¶ [kg m^2/s] Contribution of stateEffector to total rotational angular mom.
-
BackSubMatrices
backSubMatricesContributions
¶
-
Eigen::Vector3d
dvAccum_B
¶ [m/s] Accumulated delta-v of center of mass relative to inertial frame in body frame coordinates
-
Eigen::Vector3d
dvAccum_BN_B
¶ [m/s] accumulated delta-v of body frame relative to inertial frame in body frame coordinates
-
Eigen::Vector3d
nonConservativeAccelpntB_B
¶ [m/s/s] Current spacecraft body acceleration in the B frame
-
HubEffector
hub
¶
-
GravityEffector
gravField
¶ Gravity effector for gravitational field experienced by spacecraft
-
std::vector<StateEffector*>
states
¶ Vector of state effectors attached to dynObject
-
std::vector<DynamicEffector*>
dynEffectors
¶ Vector of dynamic effectors attached to dynObject
-
std::vector<DockingData*>
dockingPoints
¶
-
Eigen::MatrixXd *
inertialPositionProperty
¶ [m] r_N inertial position relative to system spice zeroBase/refBase
-
-
class
SpacecraftDynamics
: public DynamicObject¶ Public Functions
-
SpacecraftDynamics
()¶ Constructor
This is the constructor, setting variables to default values
-
~SpacecraftDynamics
()¶ Destructor
This is the destructor, nothing to report here
-
void
initializeDynamics
()¶ This method initializes all of the dynamics and variables for the s/c
This method is used to initialize the simulation by registering all of the states, linking the dynamicEffectors, stateEffectors, and the hub, initialize gravity, and initialize the sim with the initial conditions specified in python for the simulation
-
void
computeEnergyMomentum
(double time)¶ This method computes the total energy and momentum of the s/c
This method is used to find the total energy and momentum of the spacecraft. It finds the total orbital energy, total orbital angular momentum, total rotational energy and total rotational angular momentum. These values are used for validation purposes.
-
void
computeEnergyMomentumSC
(double time, Spacecraft &spacecraft)¶ This method computes the total energy and momentum of the s/c
-
void
computeEnergyMomentumSystem
(double time)¶ This method computes the total energy and momentum of the s/c
-
void
updateSpacecraftMassProps
(double time, Spacecraft &spacecraft)¶ This method computes the total mass properties of the s/c
This method is used to update the mass properties of the entire spacecraft using contributions from stateEffectors
-
void
updateSystemMassProps
(double time)¶ This method computes the total mass properties of the s/c
-
void
initializeSCPosVelocity
(Spacecraft &spacecraft)¶
-
void
SelfInit
()¶ Lets spacecraft plus create its own msgs
This method creates the messages for s/c output data and initializes the gravity field
-
void
CrossInit
()¶ Hook to tie s/c plus back into provided msgs
This method is used to cross link the messages and to initialize the dynamics
-
void
writeOutputMessages
(uint64_t clockTime)¶ Method to write all of the class output messages
This is the method where the messages of the state of vehicle are written
-
void
UpdateState
(uint64_t CurrentSimNanos)¶ Runtime hook back into Basilisk arch
This method is a part of sysModel and is used to integrate the state and update the state in the messaging system
-
void
equationsOfMotion
(double integTimeSeconds)¶ This method computes the equations of motion for the whole system
This method is solving Xdot = F(X,t) for the system. The hub needs to calculate its derivatives, along with all of the stateEffectors. The hub also has gravity and dynamicEffectors acting on it and these relationships are controlled in this method. At the end of this method all of the states will have their corresponding state derivatives set in the dynParam Manager thus solving for Xdot
-
void
equationsOfMotionSC
(double integTimeSeconds, Spacecraft &spacecraft)¶ This method computes the equations of motion for the whole system
-
void
equationsOfMotionSystem
(double integTimeSeconds)¶ This method computes the equations of motion for the whole system
-
void
findPriorStateInformation
(Spacecraft &spacecraft)¶
-
void
calculateDeltaVandAcceleration
(Spacecraft &spacecraft, double localTimeStep)¶
-
void
integrateState
(double time)¶ This method steps the state forward one step in time
This method is used to integrate the state forward in time, switch MRPs, calculate energy and momentum, and calculate the accumulated deltaV
-
void
attachSpacecraftToPrimary
(Spacecraft *newSpacecraft, std::string dockingPortNameOfNewSpacecraft, std::string dockingToPortName)¶ Attaches a spacecraft to the primary spacecraft chain
This method attaches a spacecraft to the chain of spacecraft attached to the primary spacecraft
-
void
addSpacecraftUndocked
(Spacecraft *newSpacecraft)¶ Attaches a spacecraft to the primary spacecraft chain
This method adds a spacecraft to the simulation as a free floating spacecraft
-
void
determineAttachedSCStates
()¶
Public Members
-
uint64_t
simTimePrevious
¶ Previous simulation time
-
uint64_t
numOutMsgBuffers
¶ Number of output message buffers for I/O
-
std::string
sysTimePropertyName
¶ Name of the system time property
-
double
currTimeStep
¶ [s] Time after integration, used for dvAccum calculation
-
double
timePrevious
¶ [s] Time before integration, used for dvAccum calculation
-
Spacecraft
primaryCentralSpacecraft
¶ Primary spacecraft in which other spacecraft can attach/detach to/from
-
std::vector<Spacecraft*>
spacecraftDockedToPrimary
¶ vector of spacecraft currently docked with primary spacecraft
-
std::vector<Spacecraft*>
unDockedSpacecraft
¶ vector of spacecraft currently detached from all other spacecraft
-
int
numberOfSCAttachedToPrimary
¶
-