Module: spacecraftSystem¶
Warning
This module allows for multiple spacecraft units (mother craft and a docked daughter craft, etc.) to be simulated as an integrated dynamical system. See Dr. Cody Allard’s dissertation for more information. However, this is still work in progress and not all effectors are compatible with this manner of doing the dynamics. Use Module: spacecraft to create a spacecraft simulation object unless you are familiar what this expanded spacecraft dynamics module provides.
Executive Summary¶
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: spacecraft, this class allows for several complex spacecraft components to form a system. This hubs can be rigidly connected or freeflying.
The module
PDF Description
contains further information on this module’s function,
how to run it, as well as testing.
Message Connection Descriptions¶
The following table lists all the module input and output messages. The module msg connection is set by the user from python. The msg type contains a link to the message structure definition, while the description provides information on what this message is used for.
Msg Variable Name 
Msg Type 
Description 

scStateOutMsg 
spacecraft element state output message 

scMassStateOutMsg 
spacecraft element mass property output message 

scEnergyMomentumOutMsg 
spacecraft element energy and momentum output message 

struct DockingData¶
 #include <spacecraftSystem.h>
docking data structure
Public Functions

inline DockingData()¶

inline DockingData()¶

class SpacecraftUnit¶
 #include <spacecraftSystem.h>
spacecraft dynamic effector
Public Functions

SpacecraftUnit()¶

~SpacecraftUnit()¶

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 ResetSC(uint64_t CurrentSimNanos)¶
This method is used to reset the module.
 Returns
void

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)¶
class method
Public Members

bool docked¶
class variable

std::string spacecraftName¶
— Name of the spacecraft so that multiple spacecraft can be distinguished

Message<SCStatesMsgPayload> scStateOutMsg¶
— Name of the state output message

Message<SCMassPropsMsgPayload> scMassStateOutMsg¶
— Name of the state output message

Message<SCEnergyMomentumMsgPayload> scEnergyMomentumOutMsg¶
— 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¶
class variable

Eigen::Vector3d sumForceExternal_N¶
[N] Sum of forces given in the inertial frame

Eigen::Vector3d sumForceExternal_B¶
[N] Sum of forces given in the body frame

Eigen::Vector3d sumTorquePntB_B¶
[Nm] Total torque about point B in B frame components

Eigen::Vector3d oldV_CN_N¶
class variable

Eigen::Vector3d oldV_BN_N¶
class variable

Eigen::Vector3d oldOmega_BN_B¶
class variable

Eigen::Vector3d dvAccum_CN_B¶
[m/s] Accumulated deltav of center of mass relative to inertial frame in body frame coordinates

Eigen::Vector3d dvAccum_BN_B¶
[m/s] accumulated deltav 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

Eigen::Vector3d omegaDot_BN_B¶
[rad/s/s] angular acceleration of body wrt to N in body frame

HubEffector hub¶
class variable

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¶
class variable

Eigen::MatrixXd *inertialPositionProperty¶
[m] r_N inertial position relative to system spice zeroBase/refBase

Eigen::MatrixXd *inertialVelocityProperty¶
[m] v_N inertial velocity relative to system spice zeroBase/refBase

BSKLogger bskLogger¶
— BSK Logging
Private Members

Eigen::MatrixXd *m_SC¶
[kg] spacecrafts total mass

Eigen::MatrixXd *mDot_SC¶
[kg/s] Time derivative of spacecrafts total mass

Eigen::MatrixXd *ISCPntB_B¶
[kg m^2] Inertia of s/c about point B in B frame components

Eigen::MatrixXd *c_B¶
[m] Vector from point B to CoM of s/c in B frame components

Eigen::MatrixXd *cPrime_B¶
[m/s] Body time derivative of c_B

Eigen::MatrixXd *cDot_B¶
[m/s] Inertial time derivative of c_B

Eigen::MatrixXd *ISCPntBPrime_B¶
[kg m^2/s] Body time derivative of ISCPntB_B

Eigen::MatrixXd *g_N¶
[m/s^2] Gravitational acceleration in N frame components
Friends
 friend class SpacecraftSystem

SpacecraftUnit()¶

class SpacecraftSystem : public DynamicObject¶
 #include <spacecraftSystem.h>
spacecraft dynamic effector
Public Functions

SpacecraftSystem()¶
— Constructor
This is the constructor, setting variables to default values

~SpacecraftSystem()¶
— 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, SpacecraftUnit &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, SpacecraftUnit &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(SpacecraftUnit &spacecraft)¶
class method

void Reset(uint64_t CurrentSimNanos)¶
This method is used to reset the module.
 Returns
void

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, double timeStep)¶
— 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, double timeStep, SpacecraftUnit &spacecraft)¶
— This method computes the equations of motion for the whole system

void equationsOfMotionSystem(double integTimeSeconds, double timeStep)¶
— This method computes the equations of motion for the whole system

void findPriorStateInformation(SpacecraftUnit &spacecraft)¶
class method

void calculateDeltaVandAcceleration(SpacecraftUnit &spacecraft, double localTimeStep)¶
class method

void attachSpacecraftToPrimary(SpacecraftUnit *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(SpacecraftUnit *newSpacecraft)¶
— Attaches a spacecraft to the primary spacecraft chain
This method adds a spacecraft to the simulation as a free floating spacecraft

void determineAttachedSCStates()¶
class method

void preIntegration(double callTime) final¶
— preintegration steps
Prepare for integration process, not currently implemented in SpacecraftSystem
 Parameters
integrateToThisTime – Time to integrate to

void postIntegration(double callTime) final¶
— postintegration steps
Perform postintegration steps, not currently implemented in SpacecraftSystem
 Parameters
integrateToThisTime – Time to integrate to
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

SpacecraftUnit primaryCentralSpacecraft¶
— Primary spacecraft in which other spacecraft can attach/detach to/from

std::vector<SpacecraftUnit*> spacecraftDockedToPrimary¶
— vector of spacecraft currently docked with primary spacecraft

std::vector<SpacecraftUnit*> unDockedSpacecraft¶
— vector of spacecraft currently detached from all other spacecraft

int numberOfSCAttachedToPrimary¶
class variable

BSKLogger bskLogger¶
— BSK Logging
Private Members

Eigen::MatrixXd *sysTime¶
[s] System time

SpacecraftSystem()¶