8000 ENH: Introduce the StochasticAirBrakes class by kevin-alcaniz · Pull Request #785 · RocketPy-Team/RocketPy · GitHub
[go: up one dir, main page]

Skip to content

ENH: Introduce the StochasticAirBrakes class #785

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9fe3a37
wind factor bug corrected
kevin-alcaniz Mar 14, 2025
f6efa81
BUG: StochasticModel visualize attributes of a uniform distribution
kevin-alcaniz Mar 15, 2025
04337ab
variable names corrections
kevin-alcaniz Mar 15, 2025
7f551c2
Merge branch 'develop' into develop
kevin-alcaniz Mar 15, 2025
18f8323
Corrections requested by the pylint test
kevin-alcaniz Mar 15, 2025
72c63b4
Merge branch 'develop' of https://github.com/kevin-alcaniz/RocketPy i…
kevin-alcaniz Mar 15, 2025
a46de46
ENH: add multiplication for 2D functions in rocketpy.function
kevin-alcaniz Mar 16, 2025
7181360
ENH: StochasticAirBrakes class created
kevin-alcaniz Mar 16, 2025
e1549e0
ENH: set_air_brakes function created
kevin-alcaniz Mar 18, 2025
89a83a6
Merge pull request #1 from kevin-alcaniz/enh/set-air-brakes-function
kevin-alcaniz Mar 18, 2025
b14ce09
Merge pull request #2 from kevin-alcaniz/enh/multiply_2D_functions
kevin-alcaniz Mar 18, 2025
2d2a0e8
ENH: add StochasticAirBrake to rocketpy.stochastic_rocket
kevin-alcaniz Mar 18, 2025
b206647
BUG: StochasticAirBrake object input in _Controller
kevin-alcaniz Mar 18, 2025
f0ebdda
Merge pull request #3 from kevin-alcaniz/bug/stochastic-airbrake-in-c…
kevin-alcaniz Mar 18, 2025
e45ae76
ENH: add time_overshoot option to rocketpy.stochastic_flight
kevin-alcaniz Mar 18, 2025
7f082d2
DOC: StochasticAirBrakes related documentation added
kevin-alcaniz Mar 18, 2025
1c4c791
ENH: pylint recommendations done
kevin-alcaniz Mar 18, 2025
85e82e6
ENH: Reformatted files to pass Ruff linting checks
kevin-alcaniz Mar 18, 2025
0eead44
Merge pull request #4 from kevin-alcaniz/enh/ruff-modifications
kevin-alcaniz Mar 18, 2025
a52ad3e
ENH: Update rocketpy/stochastic/stochastic_rocket.py
kevin-alcaniz Mar 19, 2025
91f83c8
DOC: improve drag curve factor definition in StochasticAirBrakes
kevin-alcaniz Mar 23, 2025
95a69fa
ENH: Change assert statement to if
kevin-alcaniz Mar 23, 2025
ac958d6
DOC: better explanation of __mul__ function
kevin-alcaniz Mar 23, 2025
d51f15b
ENH: delete set_air_brakes function for simplicity
kevin-alcaniz Mar 23, 2025
8e66319
Merge branch 'enh/stochastic-airbrakes-feature' of https://github.com…
kevin-alcaniz Mar 23, 2025
6d8c9b5
Merge branch 'develop' into enh/stochastic-airbrakes-feature
kevin-alcaniz Mar 23, 2025
f83bf87
DOC: CHANGELOG file updated
kevin-alcaniz Mar 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ENH: Reformatted files to pass Ruff linting checks
  • Loading branch information
kevin-alcaniz committed Mar 18, 2025
commit 85e82e639931e45b6bac1d35484a93e64368d6dd
20 changes: 15 additions & 5 deletions rocketpy/mathutils/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -2264,7 +2264,9 @@ def __mul__(self, other): # pylint: disable=too-many-statements
):
if not self_source_is_array:
return Function(lambda x: (self.get_value_opt(x) * other), inputs)
source = np.column_stack((self.x_array, np.multiply(self.y_array, other)))
source = np.column_stack(
(self.x_array, np.multiply(self.y_array, other))
)
outputs = f"({self.__outputs__[0]}*{other})"
return Function(
source,
Expand All @@ -2284,15 +2286,21 @@ def __mul__(self, other): # pylint: disable=too-many-statements
and np.array_equal(self.x_array, other.x_array)
and np.array_equal(self.y_array, other.y_array)
):
source = np.column_stack((self.x_array, self.y_array, self.z_array * other.z_array))
source = np.column_stack(
(self.x_array, self.y_array, self.z_array * other.z_array)
)
outputs = f"({self.__outputs__[0]}*{other.__outputs__[0]})"
return Function(source, inputs, outputs, interp, extrap)
elif isinstance(other, NUMERICAL_TYPES) or self.__is_single_element_array(
other
):
if not self_source_is_array:
return Function(lambda x,y: (self.get_value_opt(x,y) * other), inputs)
source = np.column_stack((self.x_array, self.y_array, np.multiply(self.z_array, other)))
return Function(
lambda x, y: (self.get_value_opt(x, y) * other), inputs
)
source = np.column_stack(
(self.x_array, self.y_array, np.multiply(self.z_array, other))
)
outputs = f"({self.__outputs__[0]}*{other})"
return Function(
source,
Expand All @@ -2302,7 +2310,9 @@ def __mul__(self, other): # pylint: disable=too-many-statements
extrap,
)
elif callable(other):
return Function(lambda x,y: (self.get_value_opt(x,y) * other(x)), inputs)
return Function(
lambda x, y: (self.get_value_opt(x, y) * other(x)), inputs
)
else:
raise TypeError("Unsupported type for multiplication")

Expand Down
18 changes: 9 additions & 9 deletions rocketpy/stochastic/stochastic_aero_surfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ class StochasticAirBrakes(StochasticModel):
object : AirBrakes
AirBrakes object to be used for validation.
drag_coefficient_curve : list, str
The drag coefficient curve of the air brakes can account for
The drag coefficient curve of the air brakes can account for
either the air brakes' drag alone or the combined drag of both
the rocket and the air brakes.
drag_coefficient_curve_factor : tuple, list, int, float
Expand Down Expand Up @@ -479,7 +479,7 @@ def __init__(
reference_area=None,
clamp=None,
override_rocket_drag=None,
deployment_level=(0,0),
deployment_level=(0, 0),
):
"""Initializes the Stochastic AirBrakes class.

Expand All @@ -492,7 +492,7 @@ def __init__(
air_brakes : AirBrakes
AirBrakes object to be used for validation.
drag_coefficient_curve : list, str, optional
The drag coefficient curve of the air brakes can account for
The drag coefficient curve of the air brakes can account for
either the air brakes' drag alone or the combined drag of both
the rocket and the air brakes.
drag_coefficient_curve_factor : tuple, list, int, float, optional
Expand Down Expand Up @@ -534,11 +534,11 @@ def create_object(self):
"""
generated_dict = next(self.dict_generator())
air_brakes = AirBrakes(
drag_coefficient_curve=generated_dict['drag_coefficient_curve'],
reference_area=generated_dict['reference_area'],
clamp=generated_dict['clamp'],
override_rocket_drag=generated_dict['override_rocket_drag'],
deployment_level=generated_dict['deployment_level'],
drag_coefficient_curve=generated_dict["drag_coefficient_curve"],
reference_area=generated_dict["reference_area"],
clamp=generated_dict["clamp"],
override_rocket_drag=generated_dict["override_rocket_drag"],
deployment_level=generated_dict["deployment_level"],
)
air_brakes.drag_coefficient *= generated_dict['drag_coefficient_curve_factor']
air_brakes.drag_coefficient *= generated_dict["drag_coefficient_curve_factor"]
return air_brakes
6 changes: 1 addition & 5 deletions rocketpy/stochastic/stochastic_rocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,7 @@ def set_rail_buttons(
rail_buttons, self._validate_position(rail_buttons, lower_button_position)
)

def add_air_brakes(
self,
air_brakes,
controller
):
def add_air_brakes(self, air_brakes, controller):
"""Adds an air brake to the stochastic rocket.

Parameters
Expand Down
0