Skip to content

Commit

Permalink
Merge pull request #729 from RocketPy-Team/bug/generic-surfaces-corre…
Browse files Browse the repository at this point in the history
…ctions

BUG: Sideslip Angle and Damping Coefficient Calculation
  • Loading branch information
MateusStano authored Nov 15, 2024
2 parents c512c40 + 1574aea commit 5856353
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Attention: The newest changes should be on top -->

### Fixed

-
- BUG: Sideslip Angle and Damping Coefficient Calculation [#729](https://github.com/RocketPy-Team/RocketPy/pull/729)

## [v1.6.2] - 2024-11-08

Expand Down
8 changes: 4 additions & 4 deletions rocketpy/rocket/aero_surface/generic_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def compute_forces_and_moments(

# Angles of attack and sideslip
alpha = np.arctan2(stream_velocity[1], stream_velocity[2])
beta = np.arctan2(-stream_velocity[0], stream_velocity[2])
beta = np.arctan2(stream_velocity[0], stream_velocity[2])

# Compute aerodynamic forces and moments
lift, side, drag, pitch, yaw, roll = self._compute_from_coefficients(
Expand All @@ -283,9 +283,9 @@ def compute_forces_and_moments(
beta,
stream_mach,
reynolds,
omega[0],
omega[1],
omega[2],
omega[0], # q
omega[1], # r
omega[2], # p
)

# Conversion from aerodynamic frame to body frame
Expand Down
30 changes: 15 additions & 15 deletions rocketpy/rocket/aero_surface/linear_generic_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,22 @@ def __init__(
Coefficient of lift derivative with respect to yaw rate.
Default is 0.\n
cQ_0: callable, str, optional
Coefficient of pitch moment at zero angle of attack.
Coefficient of side force at zero angle of attack.
Default is 0.\n
cQ_alpha: callable, str, optional
Coefficient of pitch moment derivative with respect to angle of
Coefficient of side force derivative with respect to angle of
attack. Default is 0.\n
cQ_beta: callable, str, optional
Coefficient of pitch moment derivative with respect to sideslip
Coefficient of side force derivative with respect to sideslip
angle. Default is 0.\n
cQ_p: callable, str, optional
Coefficient of pitch moment derivative with respect to roll rate.
Coefficient of side force derivative with respect to roll rate.
Default is 0.\n
cQ_q: callable, str, optional
Coefficient of pitch moment derivative with respect to pitch rate.
Coefficient of side force derivative with respect to pitch rate.
Default is 0.\n
cQ_r: callable, str, optional
Coefficient of pitch moment derivative with respect to yaw rate.
Coefficient of side force derivative with respect to yaw rate.
Default is 0.\n
cD_0: callable, str, optional
Coefficient of drag at zero angle of attack. Default is 0.\n
Expand Down Expand Up @@ -258,11 +258,11 @@ def total_coefficient(
):
return (
c_p(alpha, beta, mach, reynolds, pitch_rate, yaw_rate, roll_rate)
* pitch_rate
* roll_rate
+ c_q(alpha, beta, mach, reynolds, pitch_rate, yaw_rate, roll_rate)
* yaw_rate
* pitch_rate
+ c_r(alpha, beta, mach, reynolds, pitch_rate, yaw_rate, roll_rate)
* roll_rate
* yaw_rate
)

return Function(
Expand Down Expand Up @@ -372,38 +372,38 @@ def _compute_from_coefficients(
# Compute aerodynamic forces
lift = dyn_pressure_area * self.cLf(
alpha, beta, mach, reynolds, pitch_rate, yaw_rate, roll_rate
) - dyn_pressure_area_damping * self.cLd(
) + dyn_pressure_area_damping * self.cLd(
alpha, beta, mach, reynolds, pitch_rate, yaw_rate, roll_rate
)

side = dyn_pressure_area * self.cQf(
alpha, beta, mach, reynolds, pitch_rate, yaw_rate, roll_rate
) - dyn_pressure_area_damping * self.cQd(
) + dyn_pressure_area_damping * self.cQd(
alpha, beta, mach, reynolds, pitch_rate, yaw_rate, roll_rate
)

drag = dyn_pressure_area * self.cDf(
alpha, beta, mach, reynolds, pitch_rate, yaw_rate, roll_rate
) - dyn_pressure_area_damping * self.cDd(
) + dyn_pressure_area_damping * self.cDd(
alpha, beta, mach, reynolds, pitch_rate, yaw_rate, roll_rate
)

# Compute aerodynamic moments
pitch = dyn_pressure_area_length * self.cmf(
alpha, beta, mach, reynolds, pitch_rate, yaw_rate, roll_rate
) - dyn_pressure_area_length_damping * self.cmd(
) + dyn_pressure_area_length_damping * self.cmd(
alpha, beta, mach, reynolds, pitch_rate, yaw_rate, roll_rate
)

yaw = dyn_pressure_area_length * self.cnf(
alpha, beta, mach, reynolds, pitch_rate, yaw_rate, roll_rate
) - dyn_pressure_area_length_damping * self.cnd(
) + dyn_pressure_area_length_damping * self.cnd(
alpha, beta, mach, reynolds, pitch_rate, yaw_rate, roll_rate
)

roll = dyn_pressure_area_length * self.clf(
alpha, beta, mach, reynolds, pitch_rate, yaw_rate, roll_rate
) - dyn_pressure_area_length_damping * self.cld(
) + dyn_pressure_area_length_damping * self.cld(
alpha, beta, mach, reynolds, pitch_rate, yaw_rate, roll_rate
)

Expand Down
2 changes: 1 addition & 1 deletion rocketpy/simulation/flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -2699,7 +2699,7 @@ def angle_of_sideslip(self):
# Stream velocity in standard aerodynamic frame
stream_velocity = -self.stream_velocity_body_frame
beta = np.arctan2(
-stream_velocity[:, 0],
stream_velocity[:, 0],
stream_velocity[:, 2],
) # x-z plane
return np.column_stack([self.time, np.rad2deg(beta)])
Expand Down

0 comments on commit 5856353

Please sign in to comment.