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. | |
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.
Stage::Stage | ( | const std::string & | name | ) |
Constructs a new Stage with a given name.
name | The name of the stage. |
|
default |
Default destructor.
void Stage::addMotor | ( | std::unique_ptr< Motor > | motor | ) |
Adds a motor to the stage.
motor | A unique_ptr to the Motor object. |
void Stage::applyFlightState | ( | const FlightState & | state | ) |
Updates the stage based on current flight conditions.
state | Current flight state. |
double Stage::calculateNormalForceCoefficient | ( | ) | const |
Calculates the normal force coefficient contribution from the stage's fins.
bool Stage::checkRecoveryEvent | ( | ) | const |
Checks if the recovery system should deploy (e.g., apogee, velocity triggers).
bool Stage::checkSeparationEvent | ( | ) | const |
Checks if the stage should separate (e.g., after burnout or trigger).
double Stage::getAirframeLength | ( | ) | const |
Gets the length of the airframe.
|
inline |
const std::string & Stage::getName | ( | ) | const |
Gets the name of the stage.
double Stage::getTotalMass | ( | ) | const |
Returns the total mass of the stage (structure + motors + payload).
double Stage::getTotalPropellantMass | ( | ) | const |
Returns the current total propellant mass of all motors in the stage.
std::array< double, 3 > Stage::getTotalThrust | ( | ) | const |
Calculates the total thrust vector produced by all motors in this stage.
void Stage::prepareForFlight | ( | const Environment & | env | ) |
Prepares the stage for flight simulation (e.g., motor ignition sequencing).
env | Launch environment. |
void Stage::setAirframe | ( | std::unique_ptr< Airframe > | airframe | ) |
Sets the airframe for the stage.
airframe | A unique_ptr to the Airframe object. |
void Stage::setFinSet | ( | std::unique_ptr< FinSet > | finSet | ) |
Sets the fin set for the stage.
finSet | A unique_ptr to the FinSet object. |
void Stage::setRecoverySystem | ( | std::unique_ptr< RecoverySystem > | recovery | ) |
Sets the recovery system for the stage.
recovery | A unique_ptr to the RecoverySystem object. |
void Stage::updateMassProperties | ( | ) |
Updates mass properties (e.g., after motor burn or separation).
|
private |
Structural body and aerodynamic surfaces.
|
private |
Fins for aerodynamic stability.
|
private |
List of motors in this stage.
|
private |
Name of the stage.
|
private |
Flag indicating recovery system deployment.
|
private |
Recovery deployment system.
|
private |
Flag indicating stage separation event.
|
private |
Total mass [kg].
|
private |
Remaining propellant [kg].