diff --git a/rocketpy/stochastic/__init__.py b/rocketpy/stochastic/__init__.py new file mode 100644 index 000000000..4e53b6360 --- /dev/null +++ b/rocketpy/stochastic/__init__.py @@ -0,0 +1,14 @@ +from .stochastic_model import StochasticModel +from .stochastic_aero_surfaces import ( + StochasticEllipticalFins, + StochasticNoseCone, + StochasticRailButtons, + StochasticTail, + StochasticTrapezoidalFins, +) +from .stochastic_environment import StochasticEnvironment +from .stochastic_flight import StochasticFlight +from .stochastic_parachute import StochasticParachute +from .stochastic_rocket import StochasticRocket +from .stochastic_solid_motor import StochasticSolidMotor +from .stochastic_generic_motor import StochasticGenericMotor diff --git a/rocketpy/monte_carlo/mc_aero_surfaces.py b/rocketpy/stochastic/stochastic_aero_surfaces.py similarity index 84% rename from rocketpy/monte_carlo/mc_aero_surfaces.py rename to rocketpy/stochastic/stochastic_aero_surfaces.py index c8f2aa73e..c0302203b 100644 --- a/rocketpy/monte_carlo/mc_aero_surfaces.py +++ b/rocketpy/stochastic/stochastic_aero_surfaces.py @@ -1,16 +1,11 @@ -from rocketpy.rocket.aero_surface import ( - EllipticalFins, - NoseCone, - RailButtons, - Tail, - TrapezoidalFins, -) +from rocketpy.rocket.aero_surface import (EllipticalFins, NoseCone, + RailButtons, Tail, TrapezoidalFins) -from .dispersion_model import DispersionModel +from .stochastic_model import StochasticModel -class McNoseCone(DispersionModel): - """A Monte Carlo Nose Cone class that inherits from MonteCarloModel. This +class StochasticNoseCone(StochasticModel): + """A Stochastic Nose Cone class that inherits from StochasticModel. This class is used to receive a NoseCone object and information about the dispersion of its parameters and generate a random nose cone object based on the provided information. @@ -21,19 +16,19 @@ class is used to receive a NoseCone object and information about the NoseCone object to be used for validation. length : tuple, list, int, float Length of the nose cone in meters. Follows the standard input format of - Dispersion Models. + Stochastic Models. kind : list List of strings representing the kind of nose cone. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. base_radius : tuple, list, int, float Base radius of the nose cone in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. bluffness : tuple, list, int, float Bluffness of the nose cone. Follows the standard input format of - Dispersion Models. + Stochastic Models. rocket_radius : tuple, list, int, float Rocket radius of the nose cone in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. name : list List of names. This attribute can not be randomized. """ @@ -47,12 +42,12 @@ def __init__( bluffness=None, rocket_radius=None, ): - """Initializes the Monte Carlo Nose Cone class. + """Initializes the Stochastic Nose Cone class. See Also -------- This should link to somewhere that explains how inputs works in - dispersion models. + stochastic models. Parameters ---------- @@ -60,19 +55,19 @@ def __init__( NoseCone object to be used for validation. length : tuple, list, int, float Length of the nose cone in meters. Follows the standard input format - of Dispersion Models. + of Stochastic Models. kind : list List of strings representing the kind of nose cone. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. base_radius : tuple, list, int, float Base radius of the nose cone in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. bluffness : tuple, list, int, float Bluffness of the nose cone. Follows the standard input format of - Dispersion Models. + Stochastic Models. rocket_radius : tuple, list, int, float Rocket radius of the nose cone in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. """ self._validate_kind(kind) super().__init__( @@ -114,8 +109,8 @@ def create_object(self): return nosecone -class McTrapezoidalFins(DispersionModel): - """A Monte Carlo Trapezoidal Fins class that inherits from MonteCarloModel. +class StochasticTrapezoidalFins(StochasticModel): + """A Stochastic Trapezoidal Fins class that inherits from StochasticModel. This class is used to receive a TrapezoidalFins object and information about the dispersion of its parameters and generate a random trapezoidal fins object based on the provided information. @@ -126,28 +121,28 @@ class McTrapezoidalFins(DispersionModel): TrapezoidalFins object to be used for validation. n : list of ints List of integers representing the number of fins. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. root_chord : tuple, list, int, float Root chord of the fins in meters. Follows the standard input format of - Dispersion Models. + Stochastic Models. tip_chord : tuple, list, int, float Tip chord of the fins in meters. Follows the standard input format of - Dispersion Models. + Stochastic Models. span : tuple, list, int, float Span of the fins in meters. Follows the standard input format of - Dispersion Models. + Stochastic Models. rocket_radius : tuple, list, int, float Rocket radius of the fins in meters. Follows the standard input format - of Dispersion Models. + of Stochastic Models. cant_angle : tuple, list, int, float Cant angle of the fins in degrees. Follows the standard input format of - Dispersion Models. + Stochastic Models. sweep_length : tuple, list, int, float Sweep length of the fins in meters. Follows the standard input format of - Dispersion Models. + Stochastic Models. sweep_angle : tuple, list, int, float Sweep angle of the fins in degrees. Follows the standard input format of - Dispersion Models. + Stochastic Models. airfoil : list List of tuples in the form of (airfoil file path, airfoil name). name : list @@ -167,12 +162,12 @@ def __init__( sweep_angle=None, airfoil=None, ): - """Initializes the Monte Carlo Trapezoidal Fins class. + """Initializes the Stochastic Trapezoidal Fins class. See Also -------- This should link to somewhere that explains how inputs works in - dispersion models. + stochastic models. Parameters ---------- @@ -180,28 +175,28 @@ def __init__( TrapezoidalFins object to be used for validation. n : list of ints List of integers representing the number of fins. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. root_chord : tuple, list, int, float Root chord of the fins in meters. Follows the standard input format - of Dispersion Models. + of Stochastic Models. tip_chord : tuple, list, int, float Tip chord of the fins in meters. Follows the standard input format - of Dispersion Models. + of Stochastic Models. span : tuple, list, int, float Span of the fins in meters. Follows the standard input format of - Dispersion Models. + Stochastic Models. rocket_radius : tuple, list, int, float Rocket radius of the fins in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. cant_angle : tuple, list, int, float Cant angle of the fins in degrees. Follows the standard input format - of Dispersion Models. + of Stochastic Models. sweep_length : tuple, list, int, float Sweep length of the fins in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. sweep_angle : tuple, list, int, float Sweep angle of the fins in degrees. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. airfoil : list List of tuples in the form of (airfoil file path, airfoil name). """ @@ -245,8 +240,8 @@ def create_object(self): return fins -class McEllipticalFins(DispersionModel): - """A Monte Carlo Elliptical Fins class that inherits from MonteCarloModel. +class StochasticEllipticalFins(StochasticModel): + """A Stochastic Elliptical Fins class that inherits from StochasticModel. This class is used to receive a EllipticalFins object and information about the dispersion of its parameters and generate a random elliptical fins object based on the provided information. @@ -257,19 +252,19 @@ class McEllipticalFins(DispersionModel): EllipticalFins object to be used for validation. n : list of ints List of integers representing the number of fins. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. root_chord : tuple, list, int, float Root chord of the fins in meters. Follows the standard input format of - Dispersion Models. + Stochastic Models. span : tuple, list, int, float Span of the fins in meters. Follows the standard input format of - Dispersion Models. + Stochastic Models. rocket_radius : tuple, list, int, float Rocket radius of the fins in meters. Follows the standard input format - of Dispersion Models. + of Stochastic Models. cant_angle : tuple, list, int, float Cant angle of the fins in degrees. Follows the standard input format of - Dispersion Models. + Stochastic Models. airfoil : list List of tuples in the form of (airfoil file path, airfoil name). name : list @@ -286,12 +281,12 @@ def __init__( cant_angle=None, airfoil=None, ): - """Initializes the Monte Carlo Elliptical Fins class. + """Initializes the Stochastic Elliptical Fins class. See Also -------- This should link to somewhere that explains how inputs works in - dispersion models. + stochastic models. Parameters ---------- @@ -299,19 +294,19 @@ def __init__( EllipticalFins object to be used for validation. n : list of ints List of integers representing the number of fins. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. root_chord : tuple, list, int, float Root chord of the fins in meters. Follows the standard input format - of Dispersion Models. + of Stochastic Models. span : tuple, list, int, float Span of the fins in meters. Follows the standard input format of - Dispersion Models. + Stochastic Models. rocket_radius : tuple, list, int, float Rocket radius of the fins in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. cant_angle : tuple, list, int, float Cant angle of the fins in degrees. Follows the standard input format - of Dispersion Models. + of Stochastic Models. airfoil : list List of tuples in the form of (airfoil file path, airfoil name). """ @@ -350,8 +345,8 @@ def create_object(self): return fins -class McTail(DispersionModel): - """A Monte Carlo Tail class that inherits from MonteCarloModel. This class +class StochasticTail(StochasticModel): + """A Stochastic Tail class that inherits from StochasticModel. This class is used to receive a Tail object and information about the dispersion of its parameters and generate a random tail object based on the provided information. @@ -362,16 +357,16 @@ class McTail(DispersionModel): Tail object to be used for validation. top_radius : tuple, list, int, float Top radius of the tail in meters. Follows the standard input format of - Dispersion Models. + Stochastic Models. bottom_radius : tuple, list, int, float Bottom radius of the tail in meters. Follows the standard input format - of Dispersion Models. + of Stochastic Models. length : tuple, list, int, float Length of the tail in meters. Follows the standard input format of - Dispersion Models. + Stochastic Models. rocket_radius : tuple, list, int, float Rocket radius of the tail in meters. Follows the standard input format - of Dispersion Models. + of Stochastic Models. name : list List of names. This attribute can not be randomized. """ @@ -384,12 +379,12 @@ def __init__( length=None, rocket_radius=None, ): - """Initializes the Monte Carlo Tail class. + """Initializes the Stochastic Tail class. See Also -------- This should link to somewhere that explains how inputs works in - dispersion models. + stochastic models. Parameters ---------- @@ -397,16 +392,16 @@ def __init__( Tail object to be used for validation. top_radius : tuple, list, int, float Top radius of the tail in meters. Follows the standard input format - of Dispersion Models. + of Stochastic Models. bottom_radius : tuple, list, int, float Bottom radius of the tail in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. length : tuple, list, int, float Length of the tail in meters. Follows the standard input format of - Dispersion Models. + Stochastic Models. rocket_radius : tuple, list, int, float Rocket radius of the tail in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. """ super().__init__( tail, @@ -437,8 +432,8 @@ def create_object(self): return tail -class McRailButtons(DispersionModel): - """A Monte Carlo RailButtons class that inherits from MonteCarloModel. This +class StochasticRailButtons(StochasticModel): + """A Stochastic RailButtons class that inherits from StochasticModel. This class is used to receive a RailButtons object and information about the dispersion of its parameters and generate a random rail buttons object based on the provided information. @@ -449,13 +444,13 @@ class is used to receive a RailButtons object and information about the RailButtons object to be used for validation. rail_buttons : list List of RailButton objects. Follows the standard input format of - Dispersion Models. + Stochastic Models. buttons_distance : tuple, list, int, float Distance between the buttons in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. angular_position : tuple, list, int, float Angular position of the buttons in degrees. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. name : list List of names. This attribute can not be randomized. """ @@ -466,12 +461,12 @@ def __init__( buttons_distance=None, angular_position=None, ): - """Initializes the Monte Carlo RailButtons class. + """Initializes the Stochastic RailButtons class. See Also -------- This should link to somewhere that explains how inputs works in - dispersion models. + stochastic models. Parameters ---------- @@ -479,10 +474,10 @@ def __init__( RailButtons object to be used for validation. buttons_distance : tuple, list, int, float Distance between the buttons in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. angular_position : tuple, list, int, float Angular position of the buttons in degrees. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. """ super().__init__( rail_buttons, diff --git a/rocketpy/monte_carlo/mc_environment.py b/rocketpy/stochastic/stochastic_environment.py similarity index 90% rename from rocketpy/monte_carlo/mc_environment.py rename to rocketpy/stochastic/stochastic_environment.py index 51a27f865..4dcef97dc 100644 --- a/rocketpy/monte_carlo/mc_environment.py +++ b/rocketpy/stochastic/stochastic_environment.py @@ -1,10 +1,10 @@ from rocketpy.environment import Environment -from .dispersion_model import DispersionModel +from .stochastic_model import StochasticModel -class McEnvironment(DispersionModel): - """A Monte Carlo Environment class that inherits from MonteCarloModel. This +class StochasticEnvironment(StochasticModel): + """A Stochastic Environment class that inherits from StochasticModel. This class is used to receive a Environment object and information about the dispersion of its parameters and generate a random environment object based on the provided information. @@ -15,16 +15,16 @@ class is used to receive a Environment object and information about the Environment object to be used for validation. elevation : tuple, list, int, float Elevation of the launch site in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. gravity : tuple, list, int, float Gravitational acceleration in meters per second squared. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. latitude : tuple, list, int, float Latitude of the launch site in degrees. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. longitude : tuple, list, int, float Longitude of the launch site in degrees. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. ensemble_member : list List of integers representing the ensemble member to be selected. wind_velocity_x_factor : tuple, list, int, float @@ -51,12 +51,12 @@ def __init__( wind_velocity_x_factor=(1, 0), wind_velocity_y_factor=(1, 0), ): - """Initializes the Monte Carlo Environment class. + """Initializes the Stochastic Environment class. See Also -------- This should link to somewhere that explains how inputs works in - dispersion models. + Stochastic models. Parameters ---------- @@ -67,26 +67,26 @@ def __init__( (year, month, day, hour). elevation : int, float, tuple, list, optional Elevation of the launch site in meters. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. gravity : int, float, tuple, list, optional Gravitational acceleration in meters per second squared. Follows - the standard input format of Dispersion Models. + the standard input format of Stochastic Models. latitude : int, float, tuple, list, optional Latitude of the launch site in degrees. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. longitude : int, float, tuple, list, optional Longitude of the launch site in degrees. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. ensemble_member : list, optional List of integers representing the ensemble member to be selected. wind_velocity_x_factor : int, float, tuple, list, optional Factor to be multiplied by the wind velocity in the x direction. - Follows the factor input format of Dispersion Models. + Follows the factor input format of Stochastic Models. wind_velocity_y_factor : int, float, tuple, list, optional Factor to be multiplied by the wind velocity in the y direction. - Follows the factor input format of Dispersion Models. + Follows the factor input format of Stochastic Models. """ - # Validate in DispersionModel + # Validate in StochasticModel super().__init__( environment, date=None, diff --git a/rocketpy/monte_carlo/mc_flight.py b/rocketpy/stochastic/stochastic_flight.py similarity index 87% rename from rocketpy/monte_carlo/mc_flight.py rename to rocketpy/stochastic/stochastic_flight.py index 9d00c2c09..a80fada10 100644 --- a/rocketpy/monte_carlo/mc_flight.py +++ b/rocketpy/stochastic/stochastic_flight.py @@ -1,10 +1,10 @@ from rocketpy.simulation import Flight -from .dispersion_model import DispersionModel +from .stochastic_model import StochasticModel -class McFlight(DispersionModel): - """A Monte Carlo Flight class that inherits from MonteCarloModel. This +class StochasticFlight(StochasticModel): + """A Stochastic Flight class that inherits from StochasticModel. This class is used to receive a Flight object and information about the dispersion of its parameters and generate a random flight object based on the provided information. @@ -12,16 +12,16 @@ class is used to receive a Flight object and information about the Attributes ---------- flight : Flight - The Flight object to be used as a base for the Monte Carlo flight. + The Flight object to be used as a base for the Stochastic flight. rail_length : int, float, tuple, list, optional The rail length of the flight. Follows the standard input format of - Dispersion Models. + Stochastic Models. inclination : int, float, tuple, list, optional The inclination of the flight. Follows the standard input format of - Dispersion Models. + Stochastic Models. heading : int, float, tuple, list, optional The heading of the flight. Follows the standard input format of - Dispersion Models. + Stochastic Models. initial_solution : tuple, list, optional The initial solution of the flight. This is a tuple of 14 elements that represent the initial conditions of the flight. This attribute can not @@ -40,26 +40,26 @@ def __init__( initial_solution=None, terminate_on_apogee=None, ): - """Initializes the Monte Carlo Flight class. + """Initializes the Stochastic Flight class. See Also -------- This should link to somewhere that explains how inputs works in - dispersion models. + Stochastic models. Parameters ---------- flight : Flight - The Flight object to be used as a base for the Monte Carlo flight. + The Flight object to be used as a base for the Stochastic flight. rail_length : int, float, tuple, list, optional The rail length of the flight. Follows the standard input format of - Dispersion Models. + Stochastic Models. inclination : int, float, tuple, list, optional The inclination of the flight. Follows the standard input format of - Dispersion Models. + Stochastic Models. heading : int, float, tuple, list, optional The heading of the flight. Follows the standard input format of - Dispersion Models. + Stochastic Models. initial_solution : tuple, list, optional The initial solution of the flight. This is a tuple of 14 elements that represent the initial conditions of the flight. This attribute @@ -100,21 +100,21 @@ def _validate_initial_solution(self, initial_solution): # TODO: these call dict_generator a lot of times unecessaryly def _randomize_rail_length(self): """Randomizes the rail length of the flight. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. """ generated_dict = next(self.dict_generator()) return generated_dict["rail_length"] def _randomize_inclination(self): """Randomizes the inclination of the flight. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. """ generated_dict = next(self.dict_generator()) return generated_dict["inclination"] def _randomize_heading(self): """Randomizes the heading of the flight. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. """ generated_dict = next(self.dict_generator()) return generated_dict["heading"] diff --git a/rocketpy/monte_carlo/mc_generic_motor.py b/rocketpy/stochastic/stochastic_generic_motor.py similarity index 82% rename from rocketpy/monte_carlo/mc_generic_motor.py rename to rocketpy/stochastic/stochastic_generic_motor.py index 1403d69a9..bb0415197 100644 --- a/rocketpy/monte_carlo/mc_generic_motor.py +++ b/rocketpy/stochastic/stochastic_generic_motor.py @@ -1,10 +1,10 @@ from rocketpy.motors import GenericMotor -from .motor_dispersion_model import MotorDispersionModel +from .stochastic_motor_model import StochasticMotorModel -class McGenericMotor(MotorDispersionModel): - """A Monte Carlo Generic Motor class that inherits from MonteCarloModel. +class StochasticGenericMotor(StochasticMotorModel): + """A Stochastic Generic Motor class that inherits from StochasticModel. This class is used to receive a GenericMotor object and information about the dispersion of its parameters and generate a random generic motor object based on the provided information. @@ -17,52 +17,52 @@ class McGenericMotor(MotorDispersionModel): List of strings representing the thrust source to be selected. total_impulse : int, float, tuple, list Total impulse of the motor in newton seconds. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. burn_start_time : int, float, tuple, list Burn start time of the motor in seconds. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. burn_out_time : int, float, tuple, list Burn out time of the motor in seconds. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. dry_mass : int, float, tuple, list Dry mass of the motor in kilograms. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. dry_I_11 : int, float, tuple, list Dry inertia of the motor in kilograms times meters squared. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. dry_I_22 : int, float, tuple, list Dry inertia of the motor in kilograms times meters squared. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. dry_I_33 : int, float, tuple, list Dry inertia of the motor in kilograms times meters squared. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. dry_I_12 : int, float, tuple, list Dry inertia of the motor in kilograms times meters squared. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. dry_I_13 : int, float, tuple, list Dry inertia of the motor in kilograms times meters squared. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. dry_I_23 : int, float, tuple, list Dry inertia of the motor in kilograms times meters squared. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. chamber_radius : int, float, tuple, list Chamber radius of the motor in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. chamber_height : int, float, tuple, list Chamber height of the motor in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. chamber_position : int, float, tuple, list Chamber position of the motor in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. nozzle_radius : int, float, tuple, list Nozzle radius of the motor in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. nozzle_position : int, float, tuple, list Nozzle position of the motor in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. center_of_dry_mass_position : int, float, tuple, list Center of dry mass position of the motor in meters. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. interpolation_method : str, optional Interpolation method to be used. This attribute can not be randomized. coordinate_system_orientation : str, optional @@ -92,12 +92,12 @@ def __init__( nozzle_position=None, center_of_dry_mass_position=None, ): - """Initializes the Monte Carlo Generic Motor class. + """Initializes the Stochastic Generic Motor class. See Also -------- This should link to somewhere that explains how inputs works in - dispersion models. + Stochastic Models. Parameters ---------- @@ -105,55 +105,55 @@ def __init__( GenericMotor object to be used for validation. thrust_source : list, optional List of strings representing the thrust source to be selected. - Follows the 1d array like input format of Dispersion Models. + Follows the 1d array like input format of Stochastic Models. total_impulse : int, float, tuple, list, optional Total impulse of the motor in newton seconds. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. burn_start_time : int, float, tuple, list, optional Burn start time of the motor in seconds. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. burn_out_time : int, float, tuple, list, optional Burn out time of the motor in seconds. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. dry_mass : int, float, tuple, list, optional Dry mass of the motor in kilograms. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. dry_I_11 : int, float, tuple, list, optional Dry inertia of the motor in kilograms times meters squared. Follows - the standard input format of Dispersion Models. + the standard input format of Stochastic Models. dry_I_22 : int, float, tuple, list, optional Dry inertia of the motor in kilograms times meters squared. Follows - the standard input format of Dispersion Models. + the standard input format of Stochastic Models. dry_I_33 : int, float, tuple, list, optional Dry inertia of the motor in kilograms times meters squared. Follows - the standard input format of Dispersion Models. + the standard input format of Stochastic Models. dry_I_12 : int, float, tuple, list, optional Dry inertia of the motor in kilograms times meters squared. Follows - the standard input format of Dispersion Models. + the standard input format of Stochastic Models. dry_I_13 : int, float, tuple, list, optional Dry inertia of the motor in kilograms times meters squared. Follows - the standard input format of Dispersion Models. + the standard input format of Stochastic Models. dry_I_23 : int, float, tuple, list, optional Dry inertia of the motor in kilograms times meters squared. Follows - the standard input format of Dispersion Models. + the standard input format of Stochastic Models. chamber_radius : int, float, tuple, list, optional Chamber radius of the motor in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. chamber_height : int, float, tuple, list, optional Chamber height of the motor in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. chamber_position : int, float, tuple, list, optional Chamber position of the motor in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. nozzle_radius : int, float, tuple, list, optional Nozzle radius of the motor in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. nozzle_position : int, float, tuple, list, optional Nozzle position of the motor in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. center_of_dry_mass_position : int, float, tuple, list, optional Center of dry mass position of the motor in meters. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. """ super().__init__( generic_motor, diff --git a/rocketpy/monte_carlo/dispersion_model.py b/rocketpy/stochastic/stochastic_model.py similarity index 99% rename from rocketpy/monte_carlo/dispersion_model.py rename to rocketpy/stochastic/stochastic_model.py index 8c52cf354..c24faa631 100644 --- a/rocketpy/monte_carlo/dispersion_model.py +++ b/rocketpy/stochastic/stochastic_model.py @@ -1,14 +1,13 @@ from random import choice import numpy as np - from rocketpy.mathutils.function import Function from ..tools import get_distribution -class DispersionModel: - """Base class for all Monte Carlo classes. This class is used to validate +class StochasticModel: + """Base class for all Stochastic classes. This class is used to validate the input arguments of the child classes. The input arguments are validated and saved as attributes of the class in the correct format. The attributes are then used to generate a dictionary with the randomly generated input @@ -24,7 +23,7 @@ class DispersionModel: ] def __init__(self, object, **kwargs): - """Initialize the DispersionModel class with validated input arguments. + """Initialize the StochasticModel class with validated input arguments. Parameters ---------- diff --git a/rocketpy/monte_carlo/motor_dispersion_model.py b/rocketpy/stochastic/stochastic_motor_model.py similarity index 52% rename from rocketpy/monte_carlo/motor_dispersion_model.py rename to rocketpy/stochastic/stochastic_motor_model.py index 800fdcb39..ee125068b 100644 --- a/rocketpy/monte_carlo/motor_dispersion_model.py +++ b/rocketpy/stochastic/stochastic_motor_model.py @@ -1,9 +1,9 @@ -from .dispersion_model import DispersionModel +from .stochastic_model import StochasticModel -class MotorDispersionModel(DispersionModel): - """Monte Carlo Motor Model class that inherits from MonteCarloModel. This - class is used to standardize the input of the motor dispersion model. +class StochasticMotorModel(StochasticModel): + """Stochastic Motor Model class that inherits from StochasticModel. This + class is used to standardize the input of the motor stochastic model. """ def __init__(self, object, **kwargs): diff --git a/rocketpy/monte_carlo/mc_parachute.py b/rocketpy/stochastic/stochastic_parachute.py similarity index 85% rename from rocketpy/monte_carlo/mc_parachute.py rename to rocketpy/stochastic/stochastic_parachute.py index 7c8945dcd..108c82a25 100644 --- a/rocketpy/monte_carlo/mc_parachute.py +++ b/rocketpy/stochastic/stochastic_parachute.py @@ -1,10 +1,10 @@ from rocketpy.rocket import Parachute -from .dispersion_model import DispersionModel +from .stochastic_model import StochasticModel -class McParachute(DispersionModel): - """A Monte Carlo Parachute class that inherits from MonteCarloModel. This +class StochasticParachute(StochasticModel): + """A Stochastic Parachute class that inherits from StochasticModel. This class is used to receive a Parachute object and information about the dispersion of its parameters and generate a random parachute object based on the provided information. @@ -15,19 +15,19 @@ class is used to receive a Parachute object and information about the Parachute object to be used for validation. cd_s : tuple, list, int, float Drag coefficient of the parachute. Follows the standard input format of - Dispersion Models. + Stochastic Models. trigger : list List of callables, string "apogee" or ints/floats. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. sampling_rate : tuple, list, int, float Sampling rate of the parachute in seconds. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. lag : tuple, list, int, float Lag of the parachute in seconds. Follows the standard input format of - Dispersion Models. + Stochastic Models. noise : list List of tuples in the form of (mean, standard deviation, - time-correlation). Follows the standard input format of Dispersion + time-correlation). Follows the standard input format of Stochastic Models. name : list List of names. This attribute can not be randomized. @@ -42,12 +42,12 @@ def __init__( lag=None, noise=None, ): - """Initializes the Monte Carlo Parachute class. + """Initializes the Stochastic Parachute class. See Also -------- This should link to somewhere that explains how inputs works in - dispersion models. + Stochastic Models. Parameters ---------- @@ -55,19 +55,19 @@ def __init__( Parachute object to be used for validation. cd_s : tuple, list, int, float Drag coefficient of the parachute. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. trigger : list List of callables, string "apogee" or ints/floats. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. sampling_rate : tuple, list, int, float Sampling rate of the parachute in seconds. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. lag : tuple, list, int, float Lag of the parachute in seconds. Follows the standard input format - of Dispersion Models. + of Stochastic Models. noise : list List of tuples in the form of (mean, standard deviation, - time-correlation). Follows the standard input format of Dispersion + time-correlation). Follows the standard input format of Stochastic Models. """ self._validate_trigger(trigger) @@ -86,7 +86,7 @@ def _validate_trigger(self, trigger): """Validates the trigger input. If the trigger input argument is not None, it must be: - a list of callables, string "apogee" or ints/floats - - a tuple that will be further validated in the DispersionModel class + - a tuple that will be further validated in the StochasticModel class """ if trigger is not None: assert isinstance(trigger, list) and all( diff --git a/rocketpy/monte_carlo/mc_rocket.py b/rocketpy/stochastic/stochastic_rocket.py similarity index 73% rename from rocketpy/monte_carlo/mc_rocket.py rename to rocketpy/stochastic/stochastic_rocket.py index 42d56e72f..10a36860c 100644 --- a/rocketpy/monte_carlo/mc_rocket.py +++ b/rocketpy/stochastic/stochastic_rocket.py @@ -1,35 +1,27 @@ import warnings from random import choice -from rocketpy.monte_carlo.mc_generic_motor import McGenericMotor -from rocketpy.monte_carlo.motor_dispersion_model import MotorDispersionModel from rocketpy.motors.motor import EmptyMotor, GenericMotor, Motor from rocketpy.motors.solid_motor import SolidMotor -from rocketpy.rocket.aero_surface import ( - EllipticalFins, - NoseCone, - RailButtons, - Tail, - TrapezoidalFins, -) +from rocketpy.rocket.aero_surface import (EllipticalFins, NoseCone, + RailButtons, Tail, TrapezoidalFins) from rocketpy.rocket.components import Components from rocketpy.rocket.parachute import Parachute from rocketpy.rocket.rocket import Rocket +from rocketpy.stochastic.stochastic_generic_motor import StochasticGenericMotor +from rocketpy.stochastic.stochastic_motor_model import StochasticMotorModel -from .dispersion_model import DispersionModel -from .mc_aero_surfaces import ( - McEllipticalFins, - McNoseCone, - McRailButtons, - McTail, - McTrapezoidalFins, -) -from .mc_parachute import McParachute -from .mc_solid_motor import McSolidMotor +from .stochastic_aero_surfaces import (StochasticEllipticalFins, + StochasticNoseCone, + StochasticRailButtons, StochasticTail, + StochasticTrapezoidalFins) +from .stochastic_model import StochasticModel +from .stochastic_parachute import StochasticParachute +from .stochastic_solid_motor import StochasticSolidMotor -class McRocket(DispersionModel): - """A Monte Carlo Rocket class that inherits from MonteCarloModel. This +class StochasticRocket(StochasticModel): + """A Stochastic Rocket class that inherits from StochasticModel. This class is used to receive a Rocket object and information about the dispersion of its parameters and generate a random rocket object based on the provided information. @@ -37,7 +29,7 @@ class is used to receive a Rocket object and information about the Attributes ---------- object : Rocket - The Rocket object to be used as a base for the Monte Carlo 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 @@ -45,48 +37,48 @@ class is used to receive a Rocket object and information about the rocket. rail_buttons : Components A Components instance containing all the rail buttons of the rocket. - parachutes : list of McParachute - A list of McParachute instances containing all the parachutes of the + parachutes : list of StochasticParachute + A list of StochasticParachute instances containing all the parachutes of the rocket. radius : tuple, list, int, float The radius of the rocket. Follows the standard input format of - Dispersion Models. + Stochastic Models. mass : tuple, list, int, float The mass of the rocket. Follows the standard input format of - Dispersion Models. + Stochastic Models. inertia_11 : tuple, list, int, float The inertia of the rocket around the x axis. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. inertia_22 : tuple, list, int, float The inertia of the rocket around the y axis. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. inertia_33 : tuple, list, int, float The inertia of the rocket around the z axis. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. inertia_12 : tuple, list, int, float The inertia of the rocket around the xy axis. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. inertia_13 : tuple, list, int, float The inertia of the rocket around the xz axis. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. inertia_23 : tuple, list, int, float The inertia of the rocket around the yz axis. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. power_off_drag : list The power off drag of the rocket. Follows the 1d array like input format - of Dispersion Models. + of Stochastic Models. power_on_drag : list The power on drag of the rocket. Follows the 1d array like input format - of Dispersion Models. + of Stochastic Models. power_off_drag_factor : tuple, list, int, float The power off drag factor of the rocket. Follows the factor input - format of Dispersion Models. + format of Stochastic Models. power_on_drag_factor : tuple, list, int, float The power on drag factor of the rocket. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. center_of_mass_without_motor : tuple, list, int, float The center of mass of the rocket without the motor. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. coordinate_system_orientation : list The orientation of the coordinate system of the rocket. This attribute can not be a randomized. @@ -109,56 +101,56 @@ def __init__( power_on_drag_factor=(1, 0), center_of_mass_without_motor=None, ): - """Initializes the Monte Carlo Rocket class. + """Initializes the Stochastic Rocket class. See Also -------- This should link to somewhere that explains how inputs works in - dispersion models. + Stochastic models. Parameters ---------- rocket : Rocket - The Rocket object to be used as a base for the Monte Carlo 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. Follows the standard input format of - Dispersion Models. + Stochastic Models. mass : int, float, tuple, list, optional The mass of the rocket. Follows the standard input format of - Dispersion Models. + Stochastic Models. inertia_11 : int, float, tuple, list, optional The inertia of the rocket around the x axis. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. inertia_22 : int, float, tuple, list, optional The inertia of the rocket around the y axis. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. inertia_33 : int, float, tuple, list, optional The inertia of the rocket around the z axis. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. inertia_12 : int, float, tuple, list, optional The inertia of the rocket around the xy axis. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. inertia_13 : int, float, tuple, list, optional The inertia of the rocket around the xz axis. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. inertia_23 : int, float, tuple, list, optional The inertia of the rocket around the yz axis. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. power_off_drag : list, optional The power off drag of the rocket. Follows the 1d array like input - format of Dispersion Models. + format of Stochastic Models. power_on_drag : list, optional The power on drag of the rocket. Follows the 1d array like input - format of Dispersion Models. + format of Stochastic Models. power_off_drag_factor : int, float, tuple, list, optional The power off drag factor of the rocket. Follows the factor input - format of Dispersion Models. + format of Stochastic Models. power_on_drag_factor : int, float, tuple, list, optional The power on drag factor of the rocket. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. center_of_mass_without_motor : int, float, tuple, list, optional The center of mass of the rocket without the motor. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. """ self._validate_1d_array_like("power_off_drag", power_off_drag) self._validate_1d_array_like("power_on_drag", power_on_drag) @@ -213,7 +205,7 @@ def __str__(self): # Otherwise, just use the default string representation of the value. value_str = str(value) if isinstance(value, list) and len(value) > 0: - if isinstance(value[0], (McParachute)): + if isinstance(value[0], (StochasticParachute)): value_str = "" for parachute in value: value_str += f"\n\t{parachute.name[0]} " @@ -221,157 +213,159 @@ def __str__(self): return s.strip() def add_motor(self, motor, position=None): - """Adds a monte carlo motor to the monte carlo rocket. If a motor is + """Adds a stochastic motor to the stochastic rocket. If a motor is already present, it will be replaced. Parameters ---------- - motor : McMotor or Motor - The motor to be added to the monte carlo rocket. + motor : StochasticMotor or Motor + The motor to be added to the stochastic rocket. position : tuple, list, int, float, optional The position of the motor. Follows the standard input format of - Dispersion Models. + Stochastic Models. """ # checks if there is a motor already if len(self.motors) > 0: warnings.warn( - "Only one motor can be added to the monte carlo rocket. " + "Only one motor can be added to the stochastic rocket. " "The previous motor will be replaced." ) self.motors = Components() # checks if input is a Motor - if not isinstance(motor, (Motor, MotorDispersionModel)): - raise AssertionError("`motor` must be a McMotor or Motor type") + if not isinstance(motor, (Motor, StochasticMotorModel)): + raise AssertionError("`motor` must be a StochasticMotor or Motor type") if isinstance(motor, Motor): - # create McMotor + # create StochasticMotor # TODO check motor type when hybrids and liquids are implemented if isinstance(motor, SolidMotor): - motor = McSolidMotor(solid_motor=motor) + motor = StochasticSolidMotor(solid_motor=motor) elif isinstance(motor, GenericMotor): - motor = McGenericMotor(generic_motor=motor) + motor = StochasticGenericMotor(generic_motor=motor) self.motors.add(motor, self._validate_position(motor, position)) - def _add_surfaces(self, surfaces, positions, type, monte_carlo_type, error_message): - """Adds a monte carlo aerodynamic surface to the monte carlo rocket. If + def _add_surfaces(self, surfaces, positions, type, stochastic_type, error_message): + """Adds a stochastic aerodynamic surface to the stochastic rocket. If an aerodynamic surface is already present, it will be replaced. Parameters ---------- - surfaces : McAeroSurface or AeroSurface - The aerodynamic surface to be added to the monte carlo rocket. + surfaces : StochasticAeroSurface or AeroSurface + The aerodynamic surface to be added to the stochastic rocket. positions : tuple, list, int, float, optional The position of the aerodynamic surface. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. type : type - The type of the aerodynamic surface to be added to the monte carlo + The type of the aerodynamic surface to be added to the stochastic rocket. - monte_carlo_type : type - The type of the monte carlo aerodynamic surface to be added to the - monte carlo 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. """ - if not isinstance(surfaces, (type, monte_carlo_type)): + if not isinstance(surfaces, (type, stochastic_type)): raise AssertionError(error_message) if isinstance(surfaces, type): - # create McSurfaces - surfaces = monte_carlo_type(component=surfaces) + # create StochasticSurfaces + surfaces = stochastic_type(component=surfaces) self.aerodynamic_surfaces.add( surfaces, self._validate_position(surfaces, positions) ) def add_nose(self, nose, position=None): - """Adds a monte carlo nose cone to the monte carlo rocket. + """Adds a stochastic nose cone to the stochastic rocket. Parameters ---------- - nose : McNoseCone or NoseCone - The nose cone to be added to the monte carlo rocket. + nose : StochasticNoseCone or NoseCone + The nose cone to be added to the stochastic rocket. position : tuple, list, int, float, optional The position of the nose cone. Follows the standard input format of - Dispersion Models. + Stochastic Models. """ self._add_surfaces( nose, position, NoseCone, - McNoseCone, - "`nose` must be of NoseCone or McNoseCone type", + StochasticNoseCone, + "`nose` must be of NoseCone or StochasticNoseCone type", ) def add_trapezoidal_fins(self, fins, position=None): - """Adds a monte carlo trapezoidal fins to the monte carlo rocket. + """Adds a stochastic trapezoidal fins to the stochastic rocket. Parameters ---------- - fins : McTrapezoidalFins or TrapezoidalFins - The trapezoidal fins to be added to the monte carlo rocket. + fins : StochasticTrapezoidalFins or TrapezoidalFins + The trapezoidal fins to be added to the stochastic rocket. position : tuple, list, int, float, optional The position of the trapezoidal fins. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. """ self._add_surfaces( fins, position, TrapezoidalFins, - McTrapezoidalFins, - "`fins` must be of TrapezoidalFins or McTrapezoidalFins type", + StochasticTrapezoidalFins, + "`fins` must be of TrapezoidalFins or StochasticTrapezoidalFins type", ) def add_elliptical_fins(self, fins, position=None): - """Adds a monte carlo elliptical fins to the monte carlo rocket. + """Adds a stochastic elliptical fins to the stochastic rocket. Parameters ---------- - fins : McEllipticalFins or EllipticalFins - The elliptical fins to be added to the monte carlo rocket. + fins : StochasticEllipticalFins or EllipticalFins + The elliptical fins to be added to the stochastic rocket. position : tuple, list, int, float, optional The position of the elliptical fins. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. """ self._add_surfaces( fins, position, EllipticalFins, - McEllipticalFins, - "`fins` must be of EllipticalFins or McEllipticalFins type", + StochasticEllipticalFins, + "`fins` must be of EllipticalFins or StochasticEllipticalFins type", ) def add_tail(self, tail, position=None): - """Adds a monte carlo tail to the monte carlo rocket. + """Adds a stochastic tail to the stochastic rocket. Parameters ---------- - tail : McTail or Tail - The tail to be added to the monte carlo rocket. + tail : StochasticTail or Tail + The tail to be added to the stochastic rocket. position : tuple, list, int, float, optional The position of the tail. Follows the standard input format of - Dispersion Models. + Stochastic Models. """ self._add_surfaces( tail, position, Tail, - McTail, - "`tail` must be of Tail or McTail type", + StochasticTail, + "`tail` must be of Tail or StochasticTail type", ) def add_parachute(self, parachute): - """Adds a monte carlo parachute to the monte carlo rocket. + """Adds a stochastic parachute to the stochastic rocket. Parameters ---------- - parachute : McParachute or Parachute - The parachute to be added to the monte carlo rocket. + parachute : StochasticParachute or Parachute + The parachute to be added to the stochastic rocket. """ - # checks if input is a McParachute type - if not isinstance(parachute, (Parachute, McParachute)): - raise AssertionError("`parachute` must be of Parachute or McParachute type") + # checks if input is a StochasticParachute type + if not isinstance(parachute, (Parachute, StochasticParachute)): + raise AssertionError( + "`parachute` must be of Parachute or StochasticParachute type" + ) if isinstance(parachute, Parachute): - # create McParachute - parachute = McParachute(parachute=parachute) + # create StochasticParachute + parachute = StochasticParachute(parachute=parachute) self.parachutes.append(parachute) def set_rail_buttons( @@ -379,23 +373,23 @@ def set_rail_buttons( rail_buttons, lower_button_position=None, ): - """Sets the rail buttons of the monte carlo rocket. + """Sets the rail buttons of the stochastic rocket. Parameters ---------- - rail_buttons : McRailButtons or RailButtons - The rail buttons to be added to the monte carlo rocket. + rail_buttons : StochasticRailButtons or RailButtons + The rail buttons to be added to the stochastic rocket. lower_button_position : tuple, list, int, float, optional The position of the lower button. Follows the standard input format - of Dispersion Models. + of Stochastic Models. """ - if not isinstance(rail_buttons, (McRailButtons, RailButtons)): + if not isinstance(rail_buttons, (StochasticRailButtons, RailButtons)): raise AssertionError( - "`rail_buttons` must be of RailButtons or McRailButtons type" + "`rail_buttons` must be of RailButtons or StochasticRailButtons type" ) if isinstance(rail_buttons, RailButtons): - # create McRailButtons - rail_buttons = McRailButtons(rail_buttons=rail_buttons) + # create StochasticRailButtons + rail_buttons = StochasticRailButtons(rail_buttons=rail_buttons) self.rail_buttons.add( rail_buttons, self._validate_position(rail_buttons, lower_button_position) ) @@ -470,8 +464,8 @@ def _create_get_position(self, validated_object): f"not have the same {validated_object.object.__class__.__name__} " "to get the nominal position value from." ) - # special case for motor dispersion model - if isinstance(validated_object, (MotorDispersionModel)): + # special case for motor stochastic model + if isinstance(validated_object, (StochasticMotorModel)): if isinstance(self.object.motor, EmptyMotor): raise AssertionError(error_msg) @@ -480,7 +474,7 @@ def get_motor_position(self_object, _): return get_motor_position else: - if isinstance(validated_object, McRailButtons): + if isinstance(validated_object, StochasticRailButtons): def get_surface_position(self_object, _): surfaces = self_object.rail_buttons.get_tuple_by_type( @@ -544,36 +538,34 @@ def dict_generator(self): self.last_rnd_dict = generated_dict yield generated_dict - def _create_motor(self, component_monte_carlo_motor): - monte_carlo_motor = component_monte_carlo_motor.component - motor = monte_carlo_motor.create_object() - position_rnd = self._randomize_position(component_monte_carlo_motor.position) - self.last_rnd_dict["motors"].append(monte_carlo_motor.last_rnd_dict) + def _create_motor(self, component_stochastic_motor): + stochastic_motor = component_stochastic_motor.component + motor = stochastic_motor.create_object() + position_rnd = self._randomize_position(component_stochastic_motor.position) + self.last_rnd_dict["motors"].append(stochastic_motor.last_rnd_dict) self.last_rnd_dict["motors"][-1]["position"] = position_rnd return motor, position_rnd - def _create_surface(self, component_monte_carlo_surface): - monte_carlo_surface = component_monte_carlo_surface.component - surface = monte_carlo_surface.create_object() - position_rnd = self._randomize_position(component_monte_carlo_surface.position) + def _create_surface(self, component_stochastic_surface): + stochastic_surface = component_stochastic_surface.component + surface = stochastic_surface.create_object() + position_rnd = self._randomize_position(component_stochastic_surface.position) self.last_rnd_dict["aerodynamic_surfaces"].append( - monte_carlo_surface.last_rnd_dict + stochastic_surface.last_rnd_dict ) self.last_rnd_dict["aerodynamic_surfaces"][-1]["position"] = position_rnd return surface, position_rnd - def _create_rail_buttons(self, component_monte_carlo_rail_buttons): - monte_carlo_rail_buttons = component_monte_carlo_rail_buttons.component - rail_buttons = monte_carlo_rail_buttons.create_object() + def _create_rail_buttons(self, component_stochastic_rail_buttons): + stochastic_rail_buttons = component_stochastic_rail_buttons.component + rail_buttons = stochastic_rail_buttons.create_object() lower_button_position_rnd = self._randomize_position( - component_monte_carlo_rail_buttons.position + component_stochastic_rail_buttons.position ) upper_button_position_rnd = ( rail_buttons.buttons_distance + lower_button_position_rnd ) - self.last_rnd_dict["rail_buttons"].append( - monte_carlo_rail_buttons.last_rnd_dict - ) + self.last_rnd_dict["rail_buttons"].append(stochastic_rail_buttons.last_rnd_dict) self.last_rnd_dict["rail_buttons"][-1][ "lower_button_position" ] = lower_button_position_rnd @@ -582,9 +574,9 @@ def _create_rail_buttons(self, component_monte_carlo_rail_buttons): ] = upper_button_position_rnd return rail_buttons, lower_button_position_rnd, upper_button_position_rnd - def _create_parachute(self, monte_carlo_parachute): - parachute = monte_carlo_parachute.create_object() - self.last_rnd_dict["parachutes"].append(monte_carlo_parachute.last_rnd_dict) + def _create_parachute(self, stochastic_parachute): + parachute = stochastic_parachute.create_object() + self.last_rnd_dict["parachutes"].append(stochastic_parachute.last_rnd_dict) return parachute def create_object(self): diff --git a/rocketpy/monte_carlo/mc_solid_motor.py b/rocketpy/stochastic/stochastic_solid_motor.py similarity index 80% rename from rocketpy/monte_carlo/mc_solid_motor.py rename to rocketpy/stochastic/stochastic_solid_motor.py index 1e285df1e..2b51ccc9c 100644 --- a/rocketpy/monte_carlo/mc_solid_motor.py +++ b/rocketpy/stochastic/stochastic_solid_motor.py @@ -1,10 +1,10 @@ from rocketpy.motors import SolidMotor -from .motor_dispersion_model import MotorDispersionModel +from .stochastic_motor_model import StochasticMotorModel -class McSolidMotor(MotorDispersionModel): - """A Monte Carlo Solid Motor class that inherits from MonteCarloModel. This +class StochasticSolidMotor(StochasticMotorModel): + """A Stochastic Solid Motor class that inherits from StochasticModel. This class is used to receive a SolidMotor object and information about the dispersion of its parameters and generate a random solid motor object based on the provided information. @@ -17,67 +17,67 @@ class is used to receive a SolidMotor object and information about the List of strings representing the thrust source to be selected. total_impulse : int, float, tuple, list Total impulse of the motor in newton seconds. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. burn_start_time : int, float, tuple, list Burn start time of the motor in seconds. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. burn_out_time : int, float, tuple, list Burn out time of the motor in seconds. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. dry_mass : int, float, tuple, list Dry mass of the motor in kilograms. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. dry_I_11 : int, float, tuple, list Dry inertia of the motor in kilograms times meters squared. Follows - the standard input format of Dispersion Models. + the standard input format of Stochastic Models. dry_I_22 : int, float, tuple, list Dry inertia of the motor in kilograms times meters squared. Follows - the standard input format of Dispersion Models. + the standard input format of Stochastic Models. dry_I_33 : int, float, tuple, list Dry inertia of the motor in kilograms times meters squared. Follows - the standard input format of Dispersion Models. + the standard input format of Stochastic Models. dry_I_12 : int, float, tuple, list Dry inertia of the motor in kilograms times meters squared. Follows - the standard input format of Dispersion Models. + the standard input format of Stochastic Models. dry_I_13 : int, float, tuple, list Dry inertia of the motor in kilograms times meters squared. Follows - the standard input format of Dispersion Models. + the standard input format of Stochastic Models. dry_I_23 : int, float, tuple, list Dry inertia of the motor in kilograms times meters squared. Follows - the standard input format of Dispersion Models. + the standard input format of Stochastic Models. nozzle_radius : int, float, tuple, list Nozzle radius of the motor in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. grain_number : int, float, tuple, list Number of grains in the motor. Follows the standard input format of - Dispersion Models. + Stochastic Models. grain_density : int, float, tuple, list Density of the grains in the motor in kilograms per meters cubed. - Follows the standard input format of Dispersion Models. + Follows the standard input format of Stochastic Models. grain_outer_radius : int, float, tuple, list Outer radius of the grains in the motor in meters. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. grain_initial_inner_radius : int, float, tuple, list Initial inner radius of the grains in the motor in meters. Follows - the standard input format of Dispersion Models. + the standard input format of Stochastic Models. grain_initial_height : int, float, tuple, list Initial height of the grains in the motor in meters. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. grain_separation : int, float, tuple, list Separation between grains in the motor in meters. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. grains_center_of_mass_position : int, float, tuple, list Position of the center of mass of the grains in the motor in - meters. Follows the standard input format of Dispersion Models. + meters. Follows the standard input format of Stochastic Models. center_of_dry_mass_position : int, float, tuple, list Position of the center of mass of the dry mass in the motor in - meters. Follows the standard input format of Dispersion Models. + meters. Follows the standard input format of Stochastic Models. nozzle_position : int, float, tuple, list Position of the nozzle in the motor in meters. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. throat_radius : int, float, tuple, list Radius of the throat in the motor in meters. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. """ def __init__( @@ -106,12 +106,12 @@ def __init__( nozzle_position=None, throat_radius=None, ): - """Initializes the Monte Carlo Solid Motor class. + """Initializes the Stochastic Solid Motor class. See Also -------- This should link to somewhere that explains how inputs works in - dispersion models. + Stochastic Models. Parameters ---------- @@ -119,70 +119,70 @@ def __init__( SolidMotor object to be used for validation. thrust_source : list, optional List of strings representing the thrust source to be selected. - Follows the 1d array like input format of Dispersion Models. + Follows the 1d array like input format of Stochastic Models. total_impulse : int, float, tuple, list, optional Total impulse of the motor in newton seconds. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. burn_start_time : int, float, tuple, list, optional Burn start time of the motor in seconds. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. burn_out_time : int, float, tuple, list, optional Burn out time of the motor in seconds. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. dry_mass : int, float, tuple, list, optional Dry mass of the motor in kilograms. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. dry_I_11 : int, float, tuple, list, optional Dry inertia of the motor in kilograms times meters squared. Follows - the standard input format of Dispersion Models. + the standard input format of Stochastic Models. dry_I_22 : int, float, tuple, list, optional Dry inertia of the motor in kilograms times meters squared. Follows - the standard input format of Dispersion Models. + the standard input format of Stochastic Models. dry_I_33 : int, float, tuple, list, optional Dry inertia of the motor in kilograms times meters squared. Follows - the standard input format of Dispersion Models. + the standard input format of Stochastic Models. dry_I_12 : int, float, tuple, list, optional Dry inertia of the motor in kilograms times meters squared. Follows - the standard input format of Dispersion Models. + the standard input format of Stochastic Models. dry_I_13 : int, float, tuple, list, optional Dry inertia of the motor in kilograms times meters squared. Follows - the standard input format of Dispersion Models. + the standard input format of Stochastic Models. dry_I_23 : int, float, tuple, list, optional Dry inertia of the motor in kilograms times meters squared. Follows - the standard input format of Dispersion Models. + the standard input format of Stochastic Models. nozzle_radius : int, float, tuple, list, optional Nozzle radius of the motor in meters. Follows the standard input - format of Dispersion Models. + format of Stochastic Models. grain_number : int, float, tuple, list, optional Number of grains in the motor. Follows the standard input format of - Dispersion Models. + Stochastic Models. grain_density : int, float, tuple, list, optional Density of the grains in the motor in kilograms per meters cubed. - Follows the standard input format of Dispersion Models. + Follows the standard input format of Stochastic Models. grain_outer_radius : int, float, tuple, list, optional Outer radius of the grains in the motor in meters. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. grain_initial_inner_radius : int, float, tuple, list, optional Initial inner radius of the grains in the motor in meters. Follows - the standard input format of Dispersion Models. + the standard input format of Stochastic Models. grain_initial_height : int, float, tuple, list, optional Initial height of the grains in the motor in meters. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. grain_separation : int, float, tuple, list, optional Separation between grains in the motor in meters. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. grains_center_of_mass_position : int, float, tuple, list, optional Position of the center of mass of the grains in the motor in - meters. Follows the standard input format of Dispersion Models. + meters. Follows the standard input format of Stochastic Models. center_of_dry_mass_position : int, float, tuple, list, optional Position of the center of mass of the dry mass in the motor in - meters. Follows the standard input format of Dispersion Models. + meters. Follows the standard input format of Stochastic Models. nozzle_position : int, float, tuple, list, optional Position of the nozzle in the motor in meters. Follows the - standard input format of Dispersion Models. + standard input format of Stochastic Models. throat_radius : int, float, tuple, list, optional Radius of the throat in the motor in meters. Follows the standard - input format of Dispersion Models. + input format of Stochastic Models. """ super().__init__( solid_motor,