Skip to content

Commit 02ddd1b

Browse files
committed
ENH: added parachute radius
1 parent 0873d21 commit 02ddd1b

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

rocketpy/rocket/parachute.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ def __init__(
103103
lag=0,
104104
noise=(0, 0, 0),
105105
parachute_radius=1.5,
106+
parachute_height=None,
106107
porosity=0.0432,
107108
):
108109
"""Initializes Parachute class.
@@ -156,6 +157,15 @@ def __init__(
156157
The values are used to add noise to the pressure signal which is
157158
passed to the trigger function. Default value is ``(0, 0, 0)``.
158159
Units are in Pa.
160+
parachute_radius : float, optional
161+
Radius of the inflated parachute in meters. Default value is 1.5.
162+
Units are in meters.
163+
parachute_height : float, optional
164+
Height of the inflated parachute in meters.
165+
Default value is the radius parachute. Units are in meters.
166+
porosity : float, optional
167+
Porosity of the parachute material, which is a measure of how much air can
168+
pass through the parachute material. Default value is 0.0432.
159169
"""
160170
self.name = name
161171
self.cd_s = cd_s
@@ -164,6 +174,9 @@ def __init__(
164174
self.lag = lag
165175
self.noise = noise
166176
self.parachute_radius = parachute_radius
177+
if parachute_height is None:
178+
parachute_height = parachute_radius
179+
self.parachute_height = parachute_height
167180
self.porosity = porosity
168181
self.noise_signal = [[-1e-6, np.random.normal(noise[0], noise[1])]]
169182
self.noisy_pressure_signal = []
@@ -269,6 +282,7 @@ def to_dict(self, include_outputs=False):
269282
"lag": self.lag,
270283
"noise": self.noise,
271284
"parachute_radius": self.parachute_radius,
285+
"parachute_height": self.parachute_height,
272286
"porosity": self.porosity,
273287
}
274288

@@ -296,8 +310,9 @@ def from_dict(cls, data):
296310
sampling_rate=data["sampling_rate"],
297311
lag=data["lag"],
298312
noise=data["noise"],
299-
parachute_radius=data["parachute_radius"],
300-
porosity=data["porosity"],
313+
parachute_radius=data.get("parachute_radius", 1.5),
314+
parachute_height=data.get("parachute_height", None),
315+
porosity=data.get("porosity", 0.0432),
301316
)
302317

303318
return parachute

rocketpy/simulation/flight.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,9 @@ def __simulate(self, verbose):
771771
lambda self, parachute_radius=parachute.radius: setattr(
772772
self, "parachute_radius", parachute_radius
773773
),
774+
lambda self, parachute_height=parachute.height: setattr(
775+
self, "parachute_height", parachute_height
776+
),
774777
lambda self, parachute_porosity=parachute.porosity: setattr(
775778
self, "parachute_porosity", parachute_porosity
776779
),
@@ -1023,6 +1026,9 @@ def __simulate(self, verbose):
10231026
lambda self, parachute_radius=parachute.radius: setattr(
10241027
self, "parachute_radius", parachute_radius
10251028
),
1029+
lambda self, parachute_height=parachute.height: setattr(
1030+
self, "parachute_height", parachute_height
1031+
),
10261032
lambda self, parachute_porosity=parachute.porosity: setattr(
10271033
self, "parachute_porosity", parachute_porosity
10281034
),
@@ -1973,7 +1979,8 @@ def u_dot_parachute(self, t, u, post_processing=False):
19731979

19741980
# Get Parachute data
19751981
cd_s = self.parachute_cd_s
1976-
R = self.parachute_radius
1982+
parachute_radius = self.parachute_radius
1983+
parachute_height = self.parachute_height
19771984
porosity = self.parachute_porosity
19781985

19791986

@@ -1992,7 +1999,7 @@ def u_dot_parachute(self, t, u, post_processing=False):
19921999
# tf = 8 * nominal diameter / velocity at line stretch
19932000

19942001
# Calculate added mass
1995-
ma = ka * rho * (4 / 3) * np.pi * R**3 # ma = ka * rho * (4 / 3) * np.pi * R**2 * height
2002+
ma = ka * rho * (4 / 3) * np.pi * parachute_radius**2 * parachute_height
19962003

19972004
# Calculate freestream speed
19982005
freestream_x = vx - wind_velocity_x
@@ -2001,14 +2008,14 @@ def u_dot_parachute(self, t, u, post_processing=False):
20012008
free_stream_speed = (freestream_x**2 + freestream_y**2 + freestream_z**2) ** 0.5
20022009

20032010
# Determine drag force
2004-
pseudo_drag = -0.5 * rho * cd_s * free_stream_speed # * Area
2011+
pseudo_drag = -0.5 * rho * cd_s * free_stream_speed
20052012
# pseudo_drag = pseudo_drag - ka * rho * 4 * np.pi * (R**2) * Rdot
20062013
Dx = pseudo_drag * freestream_x # add eta efficiency for wake
20072014
Dy = pseudo_drag * freestream_y
20082015
Dz = pseudo_drag * freestream_z
20092016
ax = Dx / (mp + ma)
20102017
ay = Dy / (mp + ma)
2011-
az = (Dz - 9.8 * mp) / (mp + ma)
2018+
az = (Dz - mp * self.env.gravity.get_value_opt(z)) / (mp + ma)
20122019

20132020
if post_processing:
20142021
self.__post_processed_variables.append(

0 commit comments

Comments
 (0)