Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Sideslip Angle and Damping Coefficient Calculation #729

Merged
merged 4 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Attention: The newest changes should be on top -->

### Changed

-
- BUG: Sideslip Angle and Damping Coefficient Calculation [#729](https://github.com/RocketPy-Team/RocketPy/pull/729)
MateusStano marked this conversation as resolved.
Show resolved Hide resolved

### Fixed

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
Loading