Skip to content
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

BUG: wrong rocket mass in parachute u dot method #569

Merged
merged 5 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

## [v1.2.2] - 2024-03-dd

You can install this version by running `pip install rocketpy==1.2.2`

- BUG: wrong rocket mass in parachute u dot method [#569](https://github.com/RocketPy-Team/RocketPy/pull/569)

## [v1.2.1] - 2024-02-22

Expand Down
13 changes: 6 additions & 7 deletions rocketpy/rocket/rocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ class Rocket:
pointing from the rocket's nose cone to the rocket's tail.
Rocket.mass : float
Rocket's mass without motor and propellant, measured in kg.
Rocket.dry_mass : float
Rocket's mass without propellant, measured in kg. It does include the
motor mass.
Rocket.center_of_mass : Function
Position of the rocket's center of mass, including propellant, relative
to the user defined rocket reference system.
Expand Down Expand Up @@ -394,22 +397,18 @@ def evaluate_total_mass(self):
def evaluate_dry_mass(self):
"""Calculates and returns the rocket's dry mass. The dry
mass is defined as the sum of the motor's dry mass and the
rocket mass without motor. The function returns an object
of the Function class and is defined as a function of time.
rocket mass without motor.

Returns
-------
self.total_mass : Function
Function of time expressing the total mass of the rocket,
defined as the sum of the propellant mass and the rocket
mass without propellant.
self.dry_mass : float
Rocket's dry mass (Rocket + Motor) (kg)
"""
# Make sure there is a motor associated with the rocket
if self.motor is None:
print("Please associate this rocket with a motor!")
return False

# Calculate total dry mass: motor (without propellant) + rocket mass
self.dry_mass = self.mass + self.motor.dry_mass

return self.dry_mass
Expand Down
2 changes: 1 addition & 1 deletion rocketpy/simulation/flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -1911,7 +1911,7 @@ def u_dot_parachute(self, t, u, post_processing=False):
rho = self.env.density.get_value_opt(u[2])
to = 1.2
ma = ka * rho * (4 / 3) * np.pi * R**3
mp = self.rocket.mass
mp = self.rocket.dry_mass
phmbressan marked this conversation as resolved.
Show resolved Hide resolved
eta = 1
Rdot = (6 * R * (1 - eta) / (1.2**6)) * (
(1 - eta) * t**5 + eta * (to**3) * (t**2)
Expand Down
7 changes: 7 additions & 0 deletions tests/acceptance/test_bella_lui_rocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,10 @@ def drogue_trigger(p, h, y):
assert (
abs(apogee_time_measured - apogee_time_simulated) / apogee_time_simulated < 0.02
)
# Guarantee the impact velocity is within 30% of the real data.
# Use the last 5 real points to avoid outliers
assert (
abs(test_flight.impact_velocity - np.mean(vert_vel_kalt[-5:]))
/ abs(test_flight.impact_velocity)
< 0.30
)
4 changes: 2 additions & 2 deletions tests/test_flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ def test_accelerations(flight_calisto_custom_wind, flight_time, expected_values)
("t_initial", (0, 0, 0)),
("out_of_rail_time", (0, 2.248727, 25.703072)),
("apogee_time", (-13.209436, 16.05115, -0.000257)),
("t_final", (5, 2, -5.334289)),
("t_final", (5, 2, -5.65998)),
],
)
def test_velocities(flight_calisto_custom_wind, flight_time, expected_values):
Expand Down Expand Up @@ -729,7 +729,7 @@ def test_velocities(flight_calisto_custom_wind, flight_time, expected_values):
("t_initial", (1.6542528, 0.65918, -0.067107)),
("out_of_rail_time", (5.05334, 2.01364, -1.7541)),
("apogee_time", (2.35291, -1.8275, -0.87851)),
("t_final", (0, 0, 141.42421)),
("t_final", (0, 0, 159.2212)),
],
)
def test_aerodynamic_forces(flight_calisto_custom_wind, flight_time, expected_values):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def test_fin_flutter_analysis(flight_calisto_custom_wind):
assert np.isclose(flutter_mach(np.inf), 1.0048188594647927, atol=5e-3)
assert np.isclose(safety_factor(0), 64.78797, atol=5e-3)
assert np.isclose(safety_factor(10), 2.1948620401502072, atol=5e-3)
assert np.isclose(safety_factor(np.inf), 65.40588722032527, atol=5e-3)
assert np.isclose(safety_factor(np.inf), 61.64222220469224, atol=5e-3)


def test_flutter_prints(flight_calisto_custom_wind):
Expand Down
Loading