Skip to content
Open
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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ Attention: The newest changes should be on top -->

### Fixed

- BUG: energy_data plot not working for 3 dof sims [[#906](https://github.com/RocketPy-Team/RocketPy/issues/906)]
- BUG: Fix hard-coded radius value for parachute added mass calculation [#889](https://github.com/RocketPy-Team/RocketPy/pull/889)
- BUG: Fix parallel Monte Carlo simulation showing incorrect iteration count [#806](https://github.com/RocketPy-Team/RocketPy/pull/806)
- BUG: energy_data plot not working for 3 dof sims [#906](https://github.com/RocketPy-Team/RocketPy/issues/906)
- BUG: Fix CSV column header spacing in FlightDataExporter [#864](https://github.com/RocketPy-Team/RocketPy/issues/864)
- BUG: Fix parallel Monte Carlo simulation showing incorrect iteration count [#806](https://github.com/RocketPy-Team/RocketPy/pull/806)

Expand Down
26 changes: 19 additions & 7 deletions rocketpy/rocket/parachute.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ class Parachute:
Function of clean_pressure_signal.
Parachute.radius : float
Length of the non-unique semi-axis (radius) of the inflated hemispheroid
parachute in meters.
Parachute.height : float, None
parachute in meters. Estimated from ``cd_s`` using the formula
``R = sqrt(cd_s / (1.4 * π))`` if not explicitly provided.
Parachute.height : float
Length of the unique semi-axis (height) of the inflated hemispheroid
parachute in meters.
Parachute.porosity : float
Expand All @@ -108,6 +109,10 @@ class Parachute:
calculated from the porosity of the parachute.
"""

# Typical drag coefficient for hemispherical parachute
# Used to estimate radius from cd_s when radius is not provided
HEMISPHERICAL_CD = 1.4

def __init__(
self,
name,
Expand All @@ -116,7 +121,7 @@ def __init__(
sampling_rate,
lag=0,
noise=(0, 0, 0),
radius=1.5,
radius=None,
height=None,
porosity=0.0432,
):
Expand Down Expand Up @@ -173,7 +178,9 @@ def __init__(
Units are in Pa.
radius : float, optional
Length of the non-unique semi-axis (radius) of the inflated hemispheroid
parachute. Default value is 1.5.
parachute. If not provided, it is estimated from ``cd_s`` assuming a
typical hemispherical parachute drag coefficient of 1.4, using the
formula: ``radius = sqrt(cd_s / (HEMISPHERICAL_CD * pi))``.
Units are in meters.
height : float, optional
Length of the unique semi-axis (height) of the inflated hemispheroid
Expand All @@ -200,8 +207,13 @@ def __init__(
self.clean_pressure_signal_function = Function(0)
self.noisy_pressure_signal_function = Function(0)
self.noise_signal_function = Function(0)
self.radius = radius
self.height = height or radius
# Estimate radius from cd_s if not provided
if radius is None:
# cd_s = Cd * S = Cd * π * R² => R = sqrt(cd_s / (Cd * π))
self.radius = np.sqrt(cd_s / (self.HEMISPHERICAL_CD * np.pi))
else:
self.radius = radius
self.height = height or self.radius
self.porosity = porosity
self.added_mass_coefficient = 1.068 * (
1
Expand Down Expand Up @@ -340,7 +352,7 @@ def from_dict(cls, data):
sampling_rate=data["sampling_rate"],
lag=data["lag"],
noise=data["noise"],
radius=data.get("radius", 1.5),
radius=data.get("radius", None),
height=data.get("height", None),
porosity=data.get("porosity", 0.0432),
)
Expand Down
6 changes: 4 additions & 2 deletions rocketpy/rocket/rocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -1483,7 +1483,7 @@ def add_parachute(
sampling_rate=100,
lag=0,
noise=(0, 0, 0),
radius=1.5,
radius=None,
height=None,
porosity=0.0432,
):
Expand Down Expand Up @@ -1546,7 +1546,9 @@ def add_parachute(
are in pascal.
radius : float, optional
Length of the non-unique semi-axis (radius) of the inflated hemispheroid
parachute. Default value is 1.5.
parachute. If not provided, it is estimated from ``cd_s`` assuming a
typical hemispherical parachute drag coefficient of 1.4, using the
formula: ``radius = sqrt(cd_s / (1.4 * pi))``.
Units are in meters.
height : float, optional
Length of the unique semi-axis (height) of the inflated hemispheroid
Expand Down
Loading