Skip to content

Commit 31b7a67

Browse files
Merge pull request #569 from RocketPy-Team/bug/rocket-mass-in-parachute-u-dot
BUG: wrong rocket mass in parachute u dot method
2 parents 31fb869 + 0829a77 commit 31b7a67

File tree

6 files changed

+22
-11
lines changed

6 files changed

+22
-11
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3838

3939
### Fixed
4040

41+
## [v1.2.2] - 2024-03-dd
42+
43+
You can install this version by running `pip install rocketpy==1.2.2`
44+
45+
- BUG: wrong rocket mass in parachute u dot method [#569](https://github.com/RocketPy-Team/RocketPy/pull/569)
4146

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

rocketpy/rocket/rocket.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ class Rocket:
6161
pointing from the rocket's nose cone to the rocket's tail.
6262
Rocket.mass : float
6363
Rocket's mass without motor and propellant, measured in kg.
64+
Rocket.dry_mass : float
65+
Rocket's mass without propellant, measured in kg. It does include the
66+
motor mass.
6467
Rocket.center_of_mass : Function
6568
Position of the rocket's center of mass, including propellant, relative
6669
to the user defined rocket reference system.
@@ -394,22 +397,18 @@ def evaluate_total_mass(self):
394397
def evaluate_dry_mass(self):
395398
"""Calculates and returns the rocket's dry mass. The dry
396399
mass is defined as the sum of the motor's dry mass and the
397-
rocket mass without motor. The function returns an object
398-
of the Function class and is defined as a function of time.
400+
rocket mass without motor.
399401
400402
Returns
401403
-------
402-
self.total_mass : Function
403-
Function of time expressing the total mass of the rocket,
404-
defined as the sum of the propellant mass and the rocket
405-
mass without propellant.
404+
self.dry_mass : float
405+
Rocket's dry mass (Rocket + Motor) (kg)
406406
"""
407407
# Make sure there is a motor associated with the rocket
408408
if self.motor is None:
409409
print("Please associate this rocket with a motor!")
410410
return False
411411

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

415414
return self.dry_mass

rocketpy/simulation/flight.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1911,7 +1911,7 @@ def u_dot_parachute(self, t, u, post_processing=False):
19111911
rho = self.env.density.get_value_opt(u[2])
19121912
to = 1.2
19131913
ma = ka * rho * (4 / 3) * np.pi * R**3
1914-
mp = self.rocket.mass
1914+
mp = self.rocket.dry_mass
19151915
eta = 1
19161916
Rdot = (6 * R * (1 - eta) / (1.2**6)) * (
19171917
(1 - eta) * t**5 + eta * (to**3) * (t**2)

tests/acceptance/test_bella_lui_rocket.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,3 +242,10 @@ def drogue_trigger(p, h, y):
242242
assert (
243243
abs(apogee_time_measured - apogee_time_simulated) / apogee_time_simulated < 0.02
244244
)
245+
# Guarantee the impact velocity is within 30% of the real data.
246+
# Use the last 5 real points to avoid outliers
247+
assert (
248+
abs(test_flight.impact_velocity - np.mean(vert_vel_kalt[-5:]))
249+
/ abs(test_flight.impact_velocity)
250+
< 0.30
251+
)

tests/test_flight.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ def test_accelerations(flight_calisto_custom_wind, flight_time, expected_values)
691691
("t_initial", (0, 0, 0)),
692692
("out_of_rail_time", (0, 2.248727, 25.703072)),
693693
("apogee_time", (-13.209436, 16.05115, -0.000257)),
694-
("t_final", (5, 2, -5.334289)),
694+
("t_final", (5, 2, -5.65998)),
695695
],
696696
)
697697
def test_velocities(flight_calisto_custom_wind, flight_time, expected_values):
@@ -729,7 +729,7 @@ def test_velocities(flight_calisto_custom_wind, flight_time, expected_values):
729729
("t_initial", (1.6542528, 0.65918, -0.067107)),
730730
("out_of_rail_time", (5.05334, 2.01364, -1.7541)),
731731
("apogee_time", (2.35291, -1.8275, -0.87851)),
732-
("t_final", (0, 0, 141.42421)),
732+
("t_final", (0, 0, 159.2212)),
733733
],
734734
)
735735
def test_aerodynamic_forces(flight_calisto_custom_wind, flight_time, expected_values):

tests/unit/test_utilities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def test_fin_flutter_analysis(flight_calisto_custom_wind):
153153
assert np.isclose(flutter_mach(np.inf), 1.0048188594647927, atol=5e-3)
154154
assert np.isclose(safety_factor(0), 64.78797, atol=5e-3)
155155
assert np.isclose(safety_factor(10), 2.1948620401502072, atol=5e-3)
156-
assert np.isclose(safety_factor(np.inf), 65.40588722032527, atol=5e-3)
156+
assert np.isclose(safety_factor(np.inf), 61.64222220469224, atol=5e-3)
157157

158158

159159
def test_flutter_prints(flight_calisto_custom_wind):

0 commit comments

Comments
 (0)