Skip to content

Commit 209434f

Browse files
Merge branch 'develop' into enh/class_dispersion
2 parents 582092b + 1e17549 commit 209434f

File tree

2 files changed

+31
-21
lines changed

2 files changed

+31
-21
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
4141

4242
### Changed
4343

44+
- MNT: refactor u_dot parachute method [#596](https://github.com/RocketPy-Team/RocketPy/pull/596)
4445
- BLD: Change setup.py to pyproject.toml [#589](https://github.com/RocketPy-Team/RocketPy/pull/589)
4546
- DEP: delete deprecated rocketpy.tools.cached_property [#587](https://github.com/RocketPy-Team/RocketPy/pull/587)
4647
- ENH: Flight simulation speed up [#581] (https://github.com/RocketPy-Team/RocketPy/pull/581)

rocketpy/simulation/flight.py

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,34 +1789,42 @@ def u_dot_parachute(self, t, u, post_processing=False):
17891789
e0dot, e1dot, e2dot, e3dot, alpha1, alpha2, alpha3].
17901790
17911791
"""
1792-
# Parachute data
1793-
cd_s = self.parachute_cd_s
1794-
ka = 1
1795-
R = 1.5
1796-
rho = self.env.density.get_value_opt(u[2])
1797-
to = 1.2
1798-
ma = ka * rho * (4 / 3) * np.pi * R**3
1799-
mp = self.rocket.dry_mass
1800-
eta = 1
1801-
Rdot = (6 * R * (1 - eta) / (1.2**6)) * (
1802-
(1 - eta) * t**5 + eta * (to**3) * (t**2)
1803-
)
1804-
Rdot = 0
18051792
# Get relevant state data
1806-
x, y, z, vx, vy, vz, e0, e1, e2, e3, omega1, omega2, omega3 = u
1807-
# Get wind data
1793+
z, vx, vy, vz = u[2:6]
1794+
1795+
# Get atmospheric data
1796+
rho = self.env.density.get_value_opt(z)
18081797
wind_velocity_x = self.env.wind_velocity_x.get_value_opt(z)
18091798
wind_velocity_y = self.env.wind_velocity_y.get_value_opt(z)
1810-
free_stream_speed = (
1811-
(wind_velocity_x - vx) ** 2 + (wind_velocity_y - vy) ** 2 + (vz) ** 2
1812-
) ** 0.5
1799+
1800+
# Get Parachute data
1801+
cd_s = self.parachute_cd_s
1802+
1803+
# Get the mass of the rocket
1804+
mp = self.rocket.dry_mass
1805+
1806+
# Define constants
1807+
ka = 1 # Added mass coefficient (depends on parachute's porosity)
1808+
R = 1.5 # Parachute radius
1809+
# to = 1.2
1810+
# eta = 1
1811+
# Rdot = (6 * R * (1 - eta) / (1.2**6)) * (
1812+
# (1 - eta) * t**5 + eta * (to**3) * (t**2)
1813+
# )
1814+
# Rdot = 0
1815+
1816+
# Calculate added mass
1817+
ma = ka * rho * (4 / 3) * np.pi * R**3
1818+
1819+
# Calculate freestream speed
18131820
freestream_x = vx - wind_velocity_x
18141821
freestream_y = vy - wind_velocity_y
18151822
freestream_z = vz
1823+
free_stream_speed = (freestream_x**2 + freestream_y**2 + freestream_z**2) ** 0.5
1824+
18161825
# Determine drag force
1817-
pseudoD = (
1818-
-0.5 * rho * cd_s * free_stream_speed - ka * rho * 4 * np.pi * (R**2) * Rdot
1819-
)
1826+
pseudoD = -0.5 * rho * cd_s * free_stream_speed
1827+
# pseudoD = pseudoD - ka * rho * 4 * np.pi * (R**2) * Rdot
18201828
Dx = pseudoD * freestream_x
18211829
Dy = pseudoD * freestream_y
18221830
Dz = pseudoD * freestream_z
@@ -2785,6 +2793,7 @@ def __transform_pressure_signals_lists_to_functions(self):
27852793
"""
27862794
# Transform parachute sensor feed into functions
27872795
for parachute in self.rocket.parachutes:
2796+
# TODO: these Functions do not need input validation
27882797
parachute.clean_pressure_signal_function = Function(
27892798
parachute.clean_pressure_signal,
27902799
"Time (s)",

0 commit comments

Comments
 (0)