diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cb9bd42f..0995b6eef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,7 +40,7 @@ Attention: The newest changes should be on top --> ### Fixed -- BUG: Add explicit timeouts to ThrustCurve API requests [#935](https://github.com/RocketPy-Team/RocketPy/pull/935) +- ## [v1.12.0] - 2026-03-08 @@ -71,6 +71,8 @@ Attention: The newest changes should be on top --> ### Fixed +- BUG: Restore `Rocket.power_off_drag` and `Rocket.power_on_drag` as `Function` objects while preserving raw inputs in `power_off_drag_input` and `power_on_drag_input` [#941](https://github.com/RocketPy-Team/RocketPy/pull/941) +- BUG: Add explicit timeouts to ThrustCurve API requests [#935](https://github.com/RocketPy-Team/RocketPy/pull/935) - BUG: Fix hard-coded radius value for parachute added mass calculation [#889](https://github.com/RocketPy-Team/RocketPy/pull/889) - DOC: Fix documentation build [#908](https://github.com/RocketPy-Team/RocketPy/pull/908) - BUG: energy_data plot not working for 3 dof sims [[#906](https://github.com/RocketPy-Team/RocketPy/issues/906)] diff --git a/rocketpy/rocket/point_mass_rocket.py b/rocketpy/rocket/point_mass_rocket.py index eaddaadec..d55477b53 100644 --- a/rocketpy/rocket/point_mass_rocket.py +++ b/rocketpy/rocket/point_mass_rocket.py @@ -41,6 +41,18 @@ class PointMassRocket(Rocket): center_of_mass_without_motor : float Position, in meters, of the rocket's center of mass without motor relative to the rocket's coordinate system. + power_off_drag : Function + Rocket's drag coefficient as a function of Mach number when the + motor is off. Alias for ``power_off_drag_by_mach``. + power_on_drag : Function + Rocket's drag coefficient as a function of Mach number when the + motor is on. Alias for ``power_on_drag_by_mach``. + power_off_drag_input : int, float, callable, array, string, Function + Original user input for the drag coefficient with motor off. + Preserved for reconstruction and Monte Carlo workflows. + power_on_drag_input : int, float, callable, array, string, Function + Original user input for the drag coefficient with motor on. + Preserved for reconstruction and Monte Carlo workflows. power_off_drag_7d : Function Drag coefficient function with seven inputs in the order: alpha, beta, mach, reynolds, pitch_rate, yaw_rate, roll_rate. @@ -53,6 +65,7 @@ class PointMassRocket(Rocket): Convenience wrapper for power-on drag as a Mach-only function. """ + def __init__( self, radius: float, diff --git a/rocketpy/rocket/rocket.py b/rocketpy/rocket/rocket.py index 51719753d..0e44365d6 100644 --- a/rocketpy/rocket/rocket.py +++ b/rocketpy/rocket/rocket.py @@ -147,12 +147,18 @@ class Rocket: Rocket.static_margin : float Float value corresponding to rocket static margin when loaded with propellant in units of rocket diameter or calibers. - Rocket.power_off_drag : int, float, callable, string, array, Function + Rocket.power_off_drag : Function + Rocket's drag coefficient as a function of Mach number when the + motor is off. Alias for ``power_off_drag_by_mach``. + Rocket.power_on_drag : Function + Rocket's drag coefficient as a function of Mach number when the + motor is on. Alias for ``power_on_drag_by_mach``. + Rocket.power_off_drag_input : int, float, callable, string, array, Function Original user input for rocket's drag coefficient when the motor is - off. This is preserved for reconstruction and Monte Carlo workflows. - Rocket.power_on_drag : int, float, callable, string, array, Function + off. Preserved for reconstruction and Monte Carlo workflows. + Rocket.power_on_drag_input : int, float, callable, string, array, Function Original user input for rocket's drag coefficient when the motor is - on. This is preserved for reconstruction and Monte Carlo workflows. + on. Preserved for reconstruction and Monte Carlo workflows. Rocket.power_off_drag_7d : Function Rocket's drag coefficient with motor off as a 7D function of (alpha, beta, mach, reynolds, pitch_rate, yaw_rate, roll_rate). @@ -375,9 +381,12 @@ def __init__( # pylint: disable=too-many-statements interpolation="linear", extrapolation="constant", ) - # Saving user input for monte carlo - self.power_off_drag = power_off_drag - self.power_on_drag = power_on_drag + # Saving raw user input for reconstruction and Monte Carlo + self._power_off_drag_input = power_off_drag + self._power_on_drag_input = power_on_drag + # Public API attributes: keep as Function (Mach-only) for backward compatibility + self.power_off_drag = self.power_off_drag_by_mach + self.power_on_drag = self.power_on_drag_by_mach # Create a, possibly, temporary empty motor # self.motors = Components() # currently unused, only 1 motor is supported