diff --git a/CHANGELOG.md b/CHANGELOG.md index 106d31f72..9a833bf37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,15 +32,26 @@ Attention: The newest changes should be on top --> ### Added -- ### Changed -- ### Fixed -- + + +## [v1.4.2] - 2024-08-03 + +You can install this version by running `pip install rocketpy==1.4.2` + +### Changed + +- REL: Bump versioning to RocketPy v1.4.2 [#648](https://github.com/RocketPy-Team/RocketPy/pull/648) +- ENH: Adding rocket radius to RailButtons class [#643](https://github.com/RocketPy-Team/RocketPy/pull/643) + +### Fixed + +- BUG: Time Node Merge Not Including Controllers [#647](https://github.com/RocketPy-Team/RocketPy/pull/647) ## [v1.4.1] - 2024-07-20 @@ -48,12 +59,12 @@ You can install this version by running `pip install rocketpy==1.4.1` ### Changed -- Bumps rocketpy version to 1.4.1 [#646](https://github.com/RocketPy-Team/RocketPy/pull/646) +- REL: Bumps rocketpy version to 1.4.1 [#646](https://github.com/RocketPy-Team/RocketPy/pull/646) - ENH: Insert apogee state into solution list during flight simulation [#638](https://github.com/RocketPy-Team/RocketPy/pull/638) +- MNT: Refactor AeroSurfaces [#634](https://github.com/RocketPy-Team/RocketPy/pull/634) - ENH: Environment class major refactor may 2024 [#605](https://github.com/RocketPy-Team/RocketPy/pull/605) - MNT: Refactors the code to adopt flake8 [#631](https://github.com/RocketPy-Team/RocketPy/pull/631) - MNT: Refactors the code to adopt pylint [#621](https://github.com/RocketPy-Team/RocketPy/pull/621) -- MNT: Refactor AeroSurfaces [#634](https://github.com/RocketPy-Team/RocketPy/pull/634) ## [1.4.0] - 2024-07-06 diff --git a/docs/conf.py b/docs/conf.py index 7de64de99..ce4162c1e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -25,7 +25,7 @@ author = "RocketPy Team" # The full version, including alpha/beta/rc tags -release = "1.4.1" +release = "1.4.2" # -- General configuration --------------------------------------------------- diff --git a/docs/user/installation.rst b/docs/user/installation.rst index 5bbd6b3af..d82c6bf29 100644 --- a/docs/user/installation.rst +++ b/docs/user/installation.rst @@ -19,7 +19,7 @@ If you want to choose a specific version to guarantee compatibility, you may ins .. code-block:: shell - pip install rocketpy==1.4.1 + pip install rocketpy==1.4.2 Optional Installation Method: ``conda`` diff --git a/pyproject.toml b/pyproject.toml index c150e56eb..93fe7bb93 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "rocketpy" -version = "1.4.1" +version = "1.4.2" description="Advanced 6-DOF trajectory simulation for High-Power Rocketry." dynamic = ["dependencies"] readme = "README.md" diff --git a/rocketpy/rocket/aero_surface/rail_buttons.py b/rocketpy/rocket/aero_surface/rail_buttons.py index 6ffafbb97..102f35737 100644 --- a/rocketpy/rocket/aero_surface/rail_buttons.py +++ b/rocketpy/rocket/aero_surface/rail_buttons.py @@ -17,7 +17,13 @@ class RailButtons(AeroSurface): relative to one of the other principal axis. """ - def __init__(self, buttons_distance, angular_position=45, name="Rail Buttons"): + def __init__( + self, + buttons_distance, + angular_position=45, + name="Rail Buttons", + rocket_radius=None, + ): """Initializes RailButtons Class. Parameters @@ -30,6 +36,10 @@ def __init__(self, buttons_distance, angular_position=45, name="Rail Buttons"): relative to one of the other principal axis. name : string, optional Name of the rail buttons. Default is "Rail Buttons". + rocket_radius : int, float, optional + Radius of the rocket at the location of the rail buttons in meters. + If not provided, it will be calculated when the RailButtons object + is added to a Rocket object. Returns ------- @@ -40,7 +50,7 @@ def __init__(self, buttons_distance, angular_position=45, name="Rail Buttons"): self.buttons_distance = buttons_distance self.angular_position = angular_position self.name = name - + self.rocket_radius = rocket_radius self.evaluate_lift_coefficient() self.evaluate_center_of_pressure() diff --git a/rocketpy/rocket/rocket.py b/rocketpy/rocket/rocket.py index d6dff9113..1687d51d2 100644 --- a/rocketpy/rocket/rocket.py +++ b/rocketpy/rocket/rocket.py @@ -947,6 +947,7 @@ def add_surfaces(self, surfaces, positions): the root chord which is highest in the rocket coordinate system. For Tail type, position is relative to the point belonging to the tail which is highest in the rocket coordinate system. + For RailButtons type, position is relative to the lower rail button. See Also -------- @@ -956,11 +957,16 @@ def add_surfaces(self, surfaces, positions): ------- None """ - try: - for surface, position in zip(surfaces, positions): + if not isinstance(surfaces, list): + surfaces = [surfaces] + positions = [positions] + + for surface, position in zip(surfaces, positions): + if isinstance(surface, RailButtons): + surface.rocket_radius = surface.rocket_radius or self.radius + self.rail_buttons.add(surface, position) + else: self.aerodynamic_surfaces.add(surface, position) - except TypeError: - self.aerodynamic_surfaces.add(surfaces, positions) self.evaluate_center_of_pressure() self.evaluate_stability_margin() @@ -1512,6 +1518,7 @@ def set_rail_buttons( rail_buttons = RailButtons( buttons_distance=buttons_distance, angular_position=angular_position ) + rail_buttons.rocket_radius = rail_buttons.rocket_radius or self.radius self.rail_buttons.add(rail_buttons, lower_button_position) return rail_buttons diff --git a/rocketpy/simulation/flight.py b/rocketpy/simulation/flight.py index 6b43b18c1..31d1f79d5 100644 --- a/rocketpy/simulation/flight.py +++ b/rocketpy/simulation/flight.py @@ -3498,6 +3498,7 @@ def merge(self): try: # Try to access the node and merge if it exists tmp_dict[time].parachutes += node.parachutes + tmp_dict[time]._controllers += node._controllers tmp_dict[time].callbacks += node.callbacks except KeyError: # If the node does not exist, add it to the dictionary diff --git a/tests/unit/test_rocket.py b/tests/unit/test_rocket.py index a984466ee..e36302c3e 100644 --- a/tests/unit/test_rocket.py +++ b/tests/unit/test_rocket.py @@ -392,6 +392,15 @@ def test_set_rail_button(calisto): ].position == pytest.approx(0.2, 1e-12) +def test_add_rail_button(calisto, calisto_rail_buttons): + calisto.add_surfaces(calisto_rail_buttons, -0.5) + assert calisto.rail_buttons[0].position == -0.5 + upper_position = ( + calisto_rail_buttons.buttons_distance + calisto.rail_buttons[0].position + ) + assert upper_position == pytest.approx(0.2, 1e-12) + + def test_evaluate_total_mass(calisto_motorless): """Tests the evaluate_total_mass method of the Rocket class. Both with respect to return instances and expected behaviour.