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 free-flying.

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.

Module I/O Messages

Msg Variable Name

Msg Type

Description

scStateOutMsg

SCStatesMsgPayload

spacecraft element state output message

scMassStateOutMsg

SCMassPropsMsgPayload

spacecraft element mass property output message

scEnergyMomentumOutMsg

SCEnergyMomentumMsgPayload

spacecraft element energy and momentum output message


struct DockingData
#include <spacecraftSystem.h>

docking data structure

Public Functions

inline DockingData()

Public Members

Eigen::Vector3d r_DB_B

variable

Eigen::Matrix3d dcm_DB

variable

Eigen::Vector3d r_DP_P

variable

Eigen::Matrix3d dcm_DP

variable

std::string portName

variable

class SpacecraftUnit
#include <spacecraftSystem.h>

spacecraft dynamic effector

Public Functions

SpacecraftUnit()
~SpacecraftUnit()
void addStateEffector(StateEffector *newStateEffector)

&#8212; Attaches a stateEffector to the system

void addDynamicEffector(DynamicEffector *newDynamicEffector)

&#8212; Attaches a dynamicEffector

void addDockingPort(DockingData *newDockingPort)

&#8212; Attaches a dynamicEffector

void SelfInitSC(int64_t moduleID)

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

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

&#8212; Name of the spacecraft so that multiple spacecraft can be distinguished

Message<SCStatesMsgPayload> scStateOutMsg

&#8212; Name of the state output message

Message<SCMassPropsMsgPayload> scMassStateOutMsg

&#8212; Name of the state output message

Message<SCEnergyMomentumMsgPayload> scEnergyMomentumOutMsg

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

[N-m] 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 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

Eigen::Vector3d omegaDot_BN_B

[rad/s/s] angular acceleration of body wrt to N in body frame

HubEffector hub

class variable

GravityEffector gravField

&#8212; Gravity effector for gravitational field experienced by spacecraft

std::vector<StateEffector*> states

&#8212; Vector of state effectors attached to dynObject

std::vector<DynamicEffector*> dynEffectors

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

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

StateData *hubR_N

&#8212; State data accesss to inertial position for the hub

StateData *hubV_N

&#8212; State data access to inertial velocity for the hub

StateData *hubOmega_BN_B

&#8212; State data access to the attitude rate of the hub

StateData *hubSigma

&#8212; State data access to sigmaBN for the hub

StateData *hubGravVelocity

&#8212; State data access to the gravity-accumulated DV on the Body frame

StateData *BcGravVelocity

&#8212; State data access to the gravity-accumulated DV on point Bc

Friends

friend class SpacecraftSystem
class SpacecraftSystem : public DynamicObject
#include <spacecraftSystem.h>

spacecraft dynamic effector

Public Functions

SpacecraftSystem()

&#8212; Constructor

This is the constructor, setting variables to default values

~SpacecraftSystem()

&#8212; Destructor

This is the destructor, nothing to report here

void initializeDynamics()

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

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

&#8212; This method computes the total energy and momentum of the s/c

void computeEnergyMomentumSystem(double time)

&#8212; This method computes the total energy and momentum of the s/c

void updateSpacecraftMassProps(double time, SpacecraftUnit &spacecraft)

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

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

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

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

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

&#8212; This method computes the equations of motion for the whole system

void equationsOfMotionSystem(double integTimeSeconds, double timeStep)

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

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

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

&#8212; pre-integration steps

Prepare for integration process, not currently implemented in SpacecraftSystem

Parameters

integrateToThisTime – Time to integrate to

void postIntegration(double callTime) final

&#8212; post-integration steps

Perform post-integration steps, not currently implemented in SpacecraftSystem

Parameters

integrateToThisTime – Time to integrate to

Public Members

uint64_t simTimePrevious

&#8212; Previous simulation time

uint64_t numOutMsgBuffers

&#8212; Number of output message buffers for I/O

std::string sysTimePropertyName

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

&#8212; Primary spacecraft in which other spacecraft can attach/detach to/from

std::vector<SpacecraftUnit*> spacecraftDockedToPrimary

&#8212; vector of spacecraft currently docked with primary spacecraft

std::vector<SpacecraftUnit*> unDockedSpacecraft

&#8212; vector of spacecraft currently detached from all other spacecraft

int numberOfSCAttachedToPrimary

class variable

BSKLogger bskLogger

&#8212; BSK Logging

Private Members

Eigen::MatrixXd *sysTime

[s] System time