Module: fuelTank

This class is an instantiation of the stateEffector abstract class and implements an effector representing a fuel tank. This fuel tank has one state associated with it and is the mass of the fuel inside the tank

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


Defines

_USE_MATH_DEFINES
FUEL_TANK_H

Enums

enum FuelTankModelTypes

Values:

enumerator TANK_MODEL_FIRST_MODEL
enumerator TANK_MODEL_CONSTANT_VOLUME
enumerator TANK_MODEL_CONSTANT_DENSITY
enumerator TANK_MODEL_EMPTYING
enumerator TANK_MODEL_UNIFORM_BURN
enumerator TANK_MODEL_CENTRIFUGAL_BURN
enumerator TANK_MODEL_LAST_MODEL

Variables

FuelTankModelConstantVolume_t FuelTankModelConstantVolume
FuelTankModelConstantDensity_t FuelTankModelConstantDensity
FuelTankModelEmptying_t FuelTankModelEmptying
FuelTankModelUniformBurn_t FuelTankModelUniformBurn
FuelTankModelCentrifugalBurn_t FuelTankModelCentrifugalBurn
FuelTankModel *FuelTankModels[TANK_MODEL_LAST_MODEL - TANK_MODEL_FIRST_MODEL]
struct FuelTankModel

Subclassed by FuelTankModelCentrifugalBurn_t, FuelTankModelConstantDensity_t, FuelTankModelConstantVolume_t, FuelTankModelEmptying_t, FuelTankModelUniformBurn_t

Public Functions

void computeTankProps(double mFuel) = 0
void computeTankPropDerivs(double mFuel, double mDotFuel) = 0
FuelTankModel()
~FuelTankModel()

Public Members

double propMassInit

[kg] Initial propellant mass in tank

Eigen::Vector3d r_TcT_TInit

[m] Initial position vector from B to tank point in B frame comp.

Eigen::Matrix3d ITankPntT_T

[kg m^2] Inertia of tank about pnt T in B frame comp.

Eigen::Matrix3d IPrimeTankPntT_T

[kg m^2/s] Derivative of inertia of tank about pnt T in B frame comp.

Eigen::Vector3d r_TcT_T

[m] position vector from B to tank point in B frame comp.

Eigen::Vector3d rPrime_TcT_T

[m/s] Derivative of position vector from B to tank point in B frame comp.

Eigen::Vector3d rPPrime_TcT_T

[m/s^2] Second derivative of position vector from B to tank point in B frame comp.

struct FuelTankModelConstantVolume_t : public FuelTankModel

Public Functions

void computeTankProps(double mFuel)
void computeTankPropDerivs(double mFuel, double mDotFuel)

Public Members

double radiusTankInit

[m] Initial radius of the spherical tank

struct FuelTankModelConstantDensity_t : public FuelTankModel

Public Functions

void computeTankProps(double mFuel)
void computeTankPropDerivs(double mFuel, double mDotFuel)

Public Members

double radiusTankInit

[m] Initial radius of the spherical tank

double radiusTank

[m] Current radius of the spherical tank

struct FuelTankModelEmptying_t : public FuelTankModel

Public Functions

void computeTankProps(double mFuel)
void computeTankPropDerivs(double mFuel, double mDotFuel)

Public Members

double radiusTankInit

[m] Initial radius of the spherical tank

double rhoFuel

[kg/m^3] density of the fuel

double thetaStar

[rad] angle from vertical to top of fuel

double thetaDotStar

[rad/s] derivative of angle from vertical to top of fuel

double thetaDDotStar

[rad/s^2] second derivative of angle from vertical to top of fuel

Eigen::Vector3d k3

Direction of fuel depletion

struct FuelTankModelUniformBurn_t : public FuelTankModel

Public Functions

void computeTankProps(double mFuel)
void computeTankPropDerivs(double mFuel, double mDotFuel)

Public Members

double radiusTankInit

[m] Initial radius of the cylindrical tank

double lengthTank

[m] Length of the tank

struct FuelTankModelCentrifugalBurn_t : public FuelTankModel

Public Functions

void computeTankProps(double mFuel)
void computeTankPropDerivs(double mFuel, double mDotFuel)

Public Members

double radiusTankInit

[m] Initial radius of the cylindrical tank

double lengthTank

[m] Length of the tank

double radiusInner

[m] Inner radius of the cylindrical tank

class FuelTank : public StateEffector, public SysModel

Public Functions

FuelTank()

Contructor

This is the constructor, setting variables to default values

~FuelTank()

Destructor

This is the destructor, nothing to report here

void SelfInit()

This method initializes the object. It creates the module’s output messages.

Return

void

void CrossInit()

This method allows for cross initialization between different modules

Return

void

void WriteOutputMessages(uint64_t CurrentClock)

This method takes the computed fuel tank mass properties and outputs them to the messaging system.

Return

void

Parameters
  • CurrentClock: The current simulation time (used for time stamping)

void UpdateState(uint64_t CurrentSimNanos)

This method allows the fuel tank to write out its messages to the messaging system

Return

void

Parameters
  • CurrentSimNanos: The current simulation time in nanoseconds

void setTankModel(FuelTankModelTypes model)
void pushFuelSloshParticle(FuelSlosh *particle)

Method to attach fuel slosh particle

This is a method to attach a fuel slosh particle to the tank

void registerStates(DynParamManager &states)

Method to register mass state with state manager

Method for fuel tank to register states. The fuel tank has one state associated with it: mass, and it also has the responsibility to call register states for the fuel slosh particles

void linkInStates(DynParamManager &states)

Method to give the tank access to other states

Method for fuel tank to access the states that it needs, needs omega

void updateEffectorMassProps(double integTime)

Method to add contribtution mass props from the tank

This method gives the fuel tank the ability to add its contributions the mass of the vehicle.

void addThrusterSet(DynamicEffector *NewdynEff)

Method to add thruster

void updateContributions(double integTime, BackSubMatrices &backSubContr, Eigen::Vector3d sigma_BN, Eigen::Vector3d omega_BN_B, Eigen::Vector3d g_N)

Back-sub contributions

This method allows the fuel tank to add its contributions to the matrices for the back-sub method.

void updateEnergyMomContributions(double integTime, Eigen::Vector3d &rotAngMomPntCContr_B, double &rotEnergyContr, Eigen::Vector3d omega_BN_B)

Energy and momentum calculations

This method allows the fuel tank to contribute to the energy and momentum calculations

void computeDerivatives(double integTime, Eigen::Vector3d rDDot_BN_N, Eigen::Vector3d omegaDot_BN_B, Eigen::Vector3d sigma_BN)

Method for each stateEffector to calculate derivatives

This method allows the fuel tank to compute its derivative

Public Members

std::string nameOfMassState

name of mass state

std::vector<FuelSlosh*> fuelSloshParticles

vector of fuel slosh particles

std::vector<DynamicEffector*> dynEffectors

Vector of dynamic effectors for thrusters

Eigen::Matrix3d dcm_TB

DCM from body frame to tank frame

Eigen::Vector3d r_TB_B

[m] position of tank in B frame

bool updateOnly

Sets whether to use update only mass depletion

std::string FuelTankOutMsgName

fuel tank output message name

FuelTankSimMsg FuelTankMassPropMsg

instance of messaging system message struct

BSKLogger bskLogger

BSK Logging

Private Members

StateData *omegaState

state data for omega_BN of the hub

StateData *massState

state data for mass state

double fuelConsumption

[kg/s] rate of fuel being consumed

double tankFuelConsumption

[kg/s] rate of fuel being consumed from tank

FuelTankModel *fuelTankModel

style of tank to simulate

Eigen::Matrix3d ITankPntT_B
Eigen::Vector3d r_TcB_B
int64_t FuelTankOutMsgId

state output message ID