Skip to content

Commit 77f52c8

Browse files
Fix hard-coded radius value for parachute added mass calculation
Calculate radius from cd_s using a typical hemispherical parachute drag coefficient (1.4) when radius is not explicitly provided. This fixes drift distance calculations for smaller parachutes like drogues. Formula: R = sqrt(cd_s / (Cd * π)) Closes #860 Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
1 parent 7c09fbb commit 77f52c8

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

rocketpy/rocket/parachute.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ class Parachute:
9494
Function of clean_pressure_signal.
9595
Parachute.radius : float
9696
Length of the non-unique semi-axis (radius) of the inflated hemispheroid
97-
parachute in meters.
98-
Parachute.height : float, None
97+
parachute in meters. Estimated from ``cd_s`` if not explicitly provided.
98+
Parachute.height : float
9999
Length of the unique semi-axis (height) of the inflated hemispheroid
100100
parachute in meters.
101101
Parachute.porosity : float
@@ -108,6 +108,10 @@ class Parachute:
108108
calculated from the porosity of the parachute.
109109
"""
110110

111+
# Typical drag coefficient for hemispherical parachute
112+
# Used to estimate radius from cd_s when radius is not provided
113+
HEMISPHERICAL_CD = 1.4
114+
111115
def __init__(
112116
self,
113117
name,
@@ -116,7 +120,7 @@ def __init__(
116120
sampling_rate,
117121
lag=0,
118122
noise=(0, 0, 0),
119-
radius=1.5,
123+
radius=None,
120124
height=None,
121125
porosity=0.0432,
122126
):
@@ -173,7 +177,9 @@ def __init__(
173177
Units are in Pa.
174178
radius : float, optional
175179
Length of the non-unique semi-axis (radius) of the inflated hemispheroid
176-
parachute. Default value is 1.5.
180+
parachute. If not provided, it is estimated from ``cd_s`` assuming a
181+
typical hemispherical parachute drag coefficient of 1.4, using the
182+
formula: ``radius = sqrt(cd_s / (HEMISPHERICAL_CD * pi))``.
177183
Units are in meters.
178184
height : float, optional
179185
Length of the unique semi-axis (height) of the inflated hemispheroid
@@ -200,8 +206,13 @@ def __init__(
200206
self.clean_pressure_signal_function = Function(0)
201207
self.noisy_pressure_signal_function = Function(0)
202208
self.noise_signal_function = Function(0)
203-
self.radius = radius
204-
self.height = height or radius
209+
# Estimate radius from cd_s if not provided
210+
if radius is None:
211+
# cd_s = Cd * S = Cd * π * R² => R = sqrt(cd_s / (Cd * π))
212+
self.radius = np.sqrt(cd_s / (self.HEMISPHERICAL_CD * np.pi))
213+
else:
214+
self.radius = radius
215+
self.height = height or self.radius
205216
self.porosity = porosity
206217
self.added_mass_coefficient = 1.068 * (
207218
1
@@ -340,8 +351,8 @@ def from_dict(cls, data):
340351
sampling_rate=data["sampling_rate"],
341352
lag=data["lag"],
342353
noise=data["noise"],
343-
radius=data.get("radius", 1.5),
344-
height=data.get("height", None),
354+
radius=data.get("radius"),
355+
height=data.get("height"),
345356
porosity=data.get("porosity", 0.0432),
346357
)
347358

0 commit comments

Comments
 (0)