Stochastic Rocket#
- class rocketpy.stochastic.StochasticRocket[source]#
A Stochastic Rocket class that inherits from StochasticModel.
See also
- Variables:
obj (
Rocket) – The Rocket object to be used as a base for the Stochastic rocket.motors (
Components) – A Components instance containing all the motors of the rocket.aerodynamic_surfaces (
Components) – A Components instance containing all the aerodynamic surfaces of the rocket.rail_buttons (
Components) – A Components instance containing all the rail buttons of the rocket.parachutes (
listofStochasticParachute) – A list of StochasticParachute instances containing all the parachutes of the rocket.radius (
tuple,list,int,float) – The radius of the rocket.mass (
tuple,list,int,float) – The mass of the rocket.inertia_11 (
tuple,list,int,float) – The inertia of the rocket around the x axis.inertia_22 (
tuple,list,int,float) – The inertia of the rocket around the y axis.inertia_33 (
tuple,list,int,float) – The inertia of the rocket around the z axis.inertia_12 (
tuple,list,int,float) – The inertia of the rocket around the xy axis.inertia_13 (
tuple,list,int,float) – The inertia of the rocket around the xz axis.inertia_23 (
tuple,list,int,float) – The inertia of the rocket around the yz axis.power_off_drag (
list) – The power off drag of the rocket.power_on_drag (
list) – The power on drag of the rocket.power_off_drag_factor (
tuple,list,int,float) – The power off drag factor of the rocket.power_on_drag_factor (
tuple,list,int,float) – The power on drag factor of the rocket.center_of_mass_without_motor (
tuple,list,int,float) – The center of mass of the rocket without the motor.coordinate_system_orientation (
list[str]) – The orientation of the coordinate system of the rocket. This attribute can not be a randomized.
- __init__(rocket, radius=None, mass=None, inertia_11=None, inertia_22=None, inertia_33=None, inertia_12=None, inertia_13=None, inertia_23=None, power_off_drag=None, power_on_drag=None, power_off_drag_factor=(1, 0), power_on_drag_factor=(1, 0), center_of_mass_without_motor=None)[source]#
Initializes the Stochastic Rocket class.
See also
- Parameters:
rocket (
Rocket) – The Rocket object to be used as a base for the Stochastic rocket.radius (
int,float,tuple,list, optional) – The radius of the rocket.mass (
int,float,tuple,list, optional) – The mass of the rocket.inertia_11 (
int,float,tuple,list, optional) – The inertia of the rocket around the x axis.inertia_22 (
int,float,tuple,list, optional) – The inertia of the rocket around the y axis.inertia_33 (
int,float,tuple,list, optional) – The inertia of the rocket around the z axis.inertia_12 (
int,float,tuple,list, optional) – The inertia of the rocket around the xy axis.inertia_13 (
int,float,tuple,list, optional) – The inertia of the rocket around the xz axis.inertia_23 (
int,float,tuple,list, optional) – The inertia of the rocket around the yz axis.power_off_drag (
list, optional) – The power off drag of the rocket.power_on_drag (
list, optional) – The power on drag of the rocket.power_off_drag_factor (
int,float,tuple,list, optional) – The power off drag factor of the rocket. This represents a factor that multiplies the power off drag curve.power_on_drag_factor (
int,float,tuple,list, optional) – The power on drag factor of the rocket. This represents a factor that multiplies the power on drag curve.center_of_mass_without_motor (
int,float,tuple,list, optional) – The center of mass of the rocket without the motor.
- _set_stochastic(seed=None)[source]#
Set the stochastic attributes for Components, positions and inputs.
- Parameters:
seed (
int, optional) – Seed for the random number generator.
- add_motor(motor, position=None)[source]#
Adds a stochastic motor to the stochastic rocket. If a motor is already present, it will be replaced.
- Parameters:
motor (
StochasticMotororMotor) – The motor to be added to the stochastic rocket.position (
tuple,list,int,float, optional) – The position of the motor.
- _add_surfaces(surfaces, positions, type_, stochastic_type, error_message)[source]#
Adds a stochastic aerodynamic surface to the stochastic rocket. If an aerodynamic surface is already present, it will be replaced.
- Parameters:
surfaces (
StochasticAeroSurfaceorAeroSurface) – The aerodynamic surface to be added to the stochastic rocket.positions (
tuple,list,int,float, optional) – The position of the aerodynamic surface.type (
type) – The type of the aerodynamic surface to be added to the stochastic rocket.stochastic_type (
type) – The type of the stochastic aerodynamic surface to be added to the stochastic rocket.error_message (
str) – The error message to be raised if the input is not of the correct type.
- add_nose(nose, position=None)[source]#
Adds a stochastic nose cone to the stochastic rocket.
- Parameters:
nose (
StochasticNoseConeorNoseCone) – The nose cone to be added to the stochastic rocket.position (
tuple,list,int,float, optional) – The position of the nose cone.
- add_trapezoidal_fins(fins, position=None)[source]#
Adds a stochastic trapezoidal fins to the stochastic rocket.
- Parameters:
fins (
StochasticTrapezoidalFinsorTrapezoidalFins) – The trapezoidal fins to be added to the stochastic rocket.position (
tuple,list,int,float, optional) – The position of the trapezoidal fins.
- add_elliptical_fins(fins, position=None)[source]#
Adds a stochastic elliptical fins to the stochastic rocket.
- Parameters:
fins (
StochasticEllipticalFinsorEllipticalFins) – The elliptical fins to be added to the stochastic rocket.position (
tuple,list,int,float, optional) – The position of the elliptical fins.
- add_tail(tail, position=None)[source]#
Adds a stochastic tail to the stochastic rocket.
- Parameters:
tail (
StochasticTailorTail) – The tail to be added to the stochastic rocket.position (
tuple,list,int,float, optional) – The position of the tail.
- add_parachute(parachute)[source]#
Adds a stochastic parachute to the stochastic rocket.
- Parameters:
parachute (
StochasticParachuteorParachute) – The parachute to be added to the stochastic rocket.
- set_rail_buttons(rail_buttons, lower_button_position=None)[source]#
Sets the rail buttons of the stochastic rocket.
- Parameters:
rail_buttons (
StochasticRailButtonsorRailButtons) – The rail buttons to be added to the stochastic rocket.lower_button_position (
tuple,list,int,float, optional) – The position of the lower button.
- add_air_brakes(air_brakes, controller)[source]#
Adds an air brake to the stochastic rocket.
- Parameters:
air_brakes (
StochasticAirBrakesorAirbrakes) – The air brake to be added to the stochastic rocket.controller (
_Controller) – Deterministic air brake controller.
- add_cp_eccentricity(x=None, y=None)[source]#
Moves line of action of aerodynamic forces to simulate an eccentricity in the position of the center of pressure relative to the center of dry mass of the rocket.
- Parameters:
x (
tuple,list,int,float, optional) – Distance in meters by which the CP is to be translated in the x direction relative to the center of dry mass axial line. The x axis is defined according to the body axes coordinate system.y (
tuple,list,int,float, optional) – Distance in meters by which the CP is to be translated in the y direction relative to the center of dry mass axial line. The y axis is defined according to the body axes coordinate system.
- Returns:
self – Object of the StochasticRocket class.
- Return type:
- add_thrust_eccentricity(x=None, y=None)[source]#
Moves line of action of thrust forces to simulate a misalignment of the thrust vector and the center of dry mass.
- Parameters:
x (
tuple,list,int,float, optional) – Distance in meters by which the line of action of the thrust force is to be translated in the x direction relative to the center of dry mass axial line. The x axis is defined according to the body axes coordinate system.y (
tuple,list,int,float, optional) – Distance in meters by which the line of action of the thrust force is to be translated in the y direction relative to the center of dry mass axial line. The y axis is defined according to the body axes coordinate system.
- Returns:
self – Object of the StochasticRocket class.
- Return type:
- _validate_eccentricity(eccentricity, position)[source]#
Validate the eccentricity argument.
- Parameters:
eccentricity (
str) – The eccentricity to which the position argument refers to.position (
tuple,list,int,float) – The position argument to be validated.
- Returns:
Validated position argument.
- Return type:
tupleorlist- Raises:
ValueError – If the position argument does not conform to the specified formats.
- _validate_position(validated_object, position)[source]#
Validate the position argument.
- Parameters:
validated_object (
object) – The object to which the position argument refers to.position (
tuple,list,int,float) – The position argument to be validated.
- Returns:
Validated position argument.
- Return type:
tupleorlist- Raises:
ValueError – If the position argument does not conform to the specified formats.
- _create_get_position(validated_object)[source]#
Create a function to get the nominal position from an object.
- Parameters:
validated_object (
object) – The object to which the position argument refers to.- Returns:
Function to get the nominal position from an object. The function must receive two arguments.
- Return type:
function
- dict_generator()[source]#
Special generator for the rocket class that yields a dictionary with the randomly generated input arguments. The dictionary is saved as an attribute of the class. The dictionary is generated by looping through all attributes of the class and generating a random value for each attribute. The random values are generated according to the format of each attribute. Tuples are generated using the distribution function specified in the tuple. Lists are generated using the random.choice function.
- Parameters:
None
- Yields:
dict– Dictionary with the randomly generated input arguments.