Skip to content

Commit

Permalink
Merge pull request #476 from RocketPy-Team/hotfix/negative-static-margin
Browse files Browse the repository at this point in the history
HOTFIX: Negative Static Margin
  • Loading branch information
MateusStano authored Nov 21, 2023
2 parents 3d3d982 + f398875 commit 8428fd8
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
author = "RocketPy Team"

# The full version, including alpha/beta/rc tags
release = "1.1.0"
release = "1.1.1"


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/user/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.1.0
pip install rocketpy==1.1.1
Optional Installation Method: ``conda``
Expand Down
1 change: 0 additions & 1 deletion rocketpy/rocket/rocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,6 @@ def evaluate_static_margin(self):
self.static_margin.set_source(
lambda time: (self.center_of_mass(time) - self.cp_position(0))
/ (2 * self.radius)
* self._csys
)
# Change sign if coordinate system is upside down
self.static_margin *= self._csys
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

setuptools.setup(
name="rocketpy",
version="1.1.0",
version="1.1.1",
install_requires=necessary_require,
extras_require={
"env_analysis": env_analysis_require,
Expand Down
19 changes: 6 additions & 13 deletions tests/test_rocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,15 @@ def test_aero_surfaces_infos(
assert calisto_trapezoidal_fins.draw() == None


@patch("matplotlib.pyplot.show")
def test_coordinate_system_orientation(
mock_show, calisto_nose_cone, cesaroni_m1670, calisto_trapezoidal_fins
calisto_nose_cone, cesaroni_m1670, calisto_trapezoidal_fins
):
"""Test if the coordinate system orientation is working properly. This test
basically checks if the static margin is the same for the same rocket with
different coordinate system orientation.
Parameters
----------
mock_show : mock
Mock of matplotlib.pyplot.show
calisto_nose_cone : rocketpy.NoseCone
Nose cone of the rocket
cesaroni_m1670 : rocketpy.SolidMotor
Expand All @@ -51,7 +48,7 @@ def test_coordinate_system_orientation(
burn_time=3.9,
dry_mass=1.815,
dry_inertia=(0.125, 0.125, 0.002),
center_of_dry_mass_position=0.317,
center_of_dry_mass_position=-0.317,
nozzle_position=0,
grain_number=5,
grain_density=1815,
Expand All @@ -60,7 +57,7 @@ def test_coordinate_system_orientation(
grain_separation=5 / 1000,
grain_outer_radius=33 / 1000,
grain_initial_height=120 / 1000,
grains_center_of_mass_position=0.397,
grains_center_of_mass_position=-0.397,
grain_initial_inner_radius=15 / 1000,
interpolation_method="linear",
coordinate_system_orientation="combustion_chamber_to_nozzle",
Expand All @@ -81,7 +78,7 @@ def test_coordinate_system_orientation(
rocket_tail_to_nose.aerodynamic_surfaces.add(calisto_nose_cone, 1.160)
rocket_tail_to_nose.aerodynamic_surfaces.add(calisto_trapezoidal_fins, -1.168)

static_margin_tail_to_nose = rocket_tail_to_nose.static_margin(0)
static_margin_tail_to_nose = rocket_tail_to_nose.static_margin

rocket_nose_to_tail = Rocket(
radius=0.0635,
Expand All @@ -98,13 +95,9 @@ def test_coordinate_system_orientation(
rocket_nose_to_tail.aerodynamic_surfaces.add(calisto_nose_cone, -1.160)
rocket_nose_to_tail.aerodynamic_surfaces.add(calisto_trapezoidal_fins, 1.168)

static_margin_nose_to_tail = rocket_nose_to_tail.static_margin(0)
static_margin_nose_to_tail = rocket_nose_to_tail.static_margin

assert (
rocket_tail_to_nose.all_info() == None
or rocket_nose_to_tail.all_info() == None
or not abs(static_margin_tail_to_nose - static_margin_nose_to_tail) < 0.0001
)
assert np.array_equal(static_margin_tail_to_nose, static_margin_nose_to_tail)


@patch("matplotlib.pyplot.show")
Expand Down

0 comments on commit 8428fd8

Please sign in to comment.