Loading...
Searching...
No Matches
Stage Class Reference

Represents a single stage of a (potentially) multi-stage rocket. More...

`#include <Stage.h>`

## Public Member Functions

| Stage (const std::string &name)
| Constructs a new Stage with a given name.
| ~Stage ()=default
| Default destructor.
void | addMotor (std::unique_ptr< Motor > motor)
| Adds a motor to the stage.
void | setAirframe (std::unique_ptr< Airframe > airframe)
| Sets the airframe for the stage.
void | setFinSet (std::unique_ptr< FinSet > finSet)
| Sets the fin set for the stage.
void | setRecoverySystem (std::unique_ptr< RecoverySystem > recovery)
| Sets the recovery system for the stage.
double | getTotalMass () const
| Returns the total mass of the stage (structure + motors + payload).
double | getTotalPropellantMass () const
| Returns the current total propellant mass of all motors in the stage.
void | updateMassProperties ()
| Updates mass properties (e.g., after motor burn or separation).
void | prepareForFlight (const Environment &env)
| Prepares the stage for flight simulation (e.g., motor ignition sequencing).
void | applyFlightState (const FlightState &state)
| Updates the stage based on current flight conditions.
bool | checkSeparationEvent () const
| Checks if the stage should separate (e.g., after burnout or trigger).
bool | checkRecoveryEvent () const
| Checks if the recovery system should deploy (e.g., apogee, velocity triggers).
double | getAirframeLength () const
| Gets the length of the airframe.
double | calculateNormalForceCoefficient () const
| Calculates the normal force coefficient contribution from the stage's fins.
const std::string & | getName () const
| Gets the name of the stage.
std::array< double, 3 > | getTotalThrust () const
| Calculates the total thrust vector produced by all motors in this stage.
const std::vector< std::unique_ptr< Motor > > & | getMotorsForTesting () const

## Private Attributes

std::string | name_
| Name of the stage.
std::vector< std::unique_ptr< Motor > > | motors_
| List of motors in this stage.
std::unique_ptr< Airframe > | airframe_
| Structural body and aerodynamic surfaces.
std::unique_ptr< FinSet > | finSet_
| Fins for aerodynamic stability.
std::unique_ptr< RecoverySystem > | recoverySystem_
| Recovery deployment system.
double | totalMass_
| Total mass [kg].
double | totalPropellantMass_
| Remaining propellant [kg].
bool | separationTriggered_
| Flag indicating stage separation event.
bool | recoveryDeployed_
| Flag indicating recovery system deployment.

## Detailed Description

Represents a single stage of a (potentially) multi-stage rocket.

A Stage contains structural components, motors, recovery systems, and manages its own mass properties and separation events.

## Constructor & Destructor Documentation

## Stage()

Stage::Stage | ( | const std::string & | name | ) |

Constructs a new Stage with a given name.

Parameters

  name | The name of the stage.

## ~Stage()

Stage::~Stage | ( |  | ) |

default

Default destructor.

## Member Function Documentation

## addMotor()

void Stage::addMotor | ( | std::unique_ptr< Motor > | motor | ) |

Adds a motor to the stage.

Parameters

  motor | A unique_ptr to the Motor object.

Here is the caller graph for this function:

## applyFlightState()

void Stage::applyFlightState | ( | const FlightState & | state | ) |

Updates the stage based on current flight conditions.

Parameters

  state | Current flight state.

## calculateNormalForceCoefficient()

double Stage::calculateNormalForceCoefficient | ( |  | ) | const

Calculates the normal force coefficient contribution from the stage's fins.

Returns
  Normal force coefficient (dimensionless).

Here is the caller graph for this function:

## checkRecoveryEvent()

bool Stage::checkRecoveryEvent | ( |  | ) | const

Checks if the recovery system should deploy (e.g., apogee, velocity triggers).

Returns
  True if recovery deployment condition met.

## checkSeparationEvent()

bool Stage::checkSeparationEvent | ( |  | ) | const

Checks if the stage should separate (e.g., after burnout or trigger).

Returns
  True if ready to separate.

## getAirframeLength()

double Stage::getAirframeLength | ( |  | ) | const

Gets the length of the airframe.

Returns
  Length in meters (0 if no airframe assigned).

Here is the caller graph for this function:

## getMotorsForTesting()

const std::vector< std::unique_ptr< Motor > > & Stage::getMotorsForTesting | ( |  | ) | const

inline

Here is the caller graph for this function:

## getName()

const std::string & Stage::getName | ( |  | ) | const

Gets the name of the stage.

Returns
  Stage name as a constant reference.

## getTotalMass()

double Stage::getTotalMass | ( |  | ) | const

Returns the total mass of the stage (structure + motors + payload).

Returns
  Total mass in kilograms.

Here is the caller graph for this function:

## getTotalPropellantMass()

double Stage::getTotalPropellantMass | ( |  | ) | const

Returns the current total propellant mass of all motors in the stage.

Returns
  Propellant mass in kilograms.

Here is the caller graph for this function:

## getTotalThrust()

std::array< double, 3 > Stage::getTotalThrust | ( |  | ) | const

Calculates the total thrust vector produced by all motors in this stage.

Returns
  Thrust vector (Newton) in body-fixed frame (Z-forward).

Here is the caller graph for this function:

## prepareForFlight()

void Stage::prepareForFlight | ( | const Environment & | env | ) |

Prepares the stage for flight simulation (e.g., motor ignition sequencing).

Parameters

  env | Launch environment.

Here is the caller graph for this function:

## setAirframe()

void Stage::setAirframe | ( | std::unique_ptr< Airframe > | airframe | ) |

Sets the airframe for the stage.

Parameters

  airframe | A unique_ptr to the Airframe object.

Here is the caller graph for this function:

## setFinSet()

void Stage::setFinSet | ( | std::unique_ptr< FinSet > | finSet | ) |

Sets the fin set for the stage.

Parameters

  finSet | A unique_ptr to the FinSet object.

Here is the caller graph for this function:

## setRecoverySystem()

void Stage::setRecoverySystem | ( | std::unique_ptr< RecoverySystem > | recovery | ) |

Sets the recovery system for the stage.

Parameters

  recovery | A unique_ptr to the RecoverySystem object.

## updateMassProperties()

void Stage::updateMassProperties | ( |  | ) |

Updates mass properties (e.g., after motor burn or separation).

Here is the caller graph for this function:

## Member Data Documentation

## airframe_

std::unique_ptr<Airframe> Stage::airframe_

private

Structural body and aerodynamic surfaces.

## finSet_

std::unique_ptr<FinSet> Stage::finSet_

private

Fins for aerodynamic stability.

## motors_

std::vector<std::unique_ptr<Motor> > Stage::motors_

private

List of motors in this stage.

## name_

std::string Stage::name_

private

Name of the stage.

## recoveryDeployed_

bool Stage::recoveryDeployed_

private

Flag indicating recovery system deployment.

## recoverySystem_

std::unique_ptr<RecoverySystem> Stage::recoverySystem_

private

Recovery deployment system.

## separationTriggered_

bool Stage::separationTriggered_

private

Flag indicating stage separation event.

## totalMass_

double Stage::totalMass_

private

Total mass [kg].

## totalPropellantMass_

double Stage::totalPropellantMass_

private

Remaining propellant [kg].

The documentation for this class was generated from the following files:

- include/Stage.h
- src/Stage.cpp