-
-
Notifications
You must be signed in to change notification settings - Fork 224
ENH: Improve Stability Margin with Angle of Attack Dependency #899
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
base: develop
Are you sure you want to change the base?
Conversation
1898cb3 to
0dff1a7
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #899 +/- ##
===========================================
+ Coverage 80.27% 81.03% +0.76%
===========================================
Files 104 107 +3
Lines 12769 13671 +902
===========================================
+ Hits 10250 11078 +828
- Misses 2519 2593 +74 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| aoa_values = self.angle_of_attack.y_array | ||
| mach_values = self.mach_number.y_array | ||
| time_values = self.time | ||
|
|
||
| results = [] | ||
| for i, t in enumerate(time_values): | ||
| # Convert angle of attack from degrees to radians | ||
| alpha_rad = np.deg2rad(aoa_values[i]) | ||
| mach = mach_values[i] | ||
| sm = self.rocket.get_stability_margin_from_alpha(alpha_rad, mach, t) | ||
| results.append((t, sm)) | ||
|
|
||
| return results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be more pythonic
Add new methods to compute center of pressure and stability margin as a function of angle of attack (α) instead of just using the lift coefficient derivative. This provides a more accurate stability margin that varies with angle of attack, similar to OpenRocket. - Add Rocket.get_cp_position_from_alpha(alpha, mach) method - Add Rocket.get_stability_margin_from_alpha(alpha, mach, time) method - Update Flight.stability_margin to use angle of attack from simulation - Add tests for new functionality Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
- Add comment explaining degrees to radians conversion in Flight.stability_margin - Replace magic number 1e-10 with named constant epsilon in get_cp_position_from_alpha Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
0dff1a7 to
d1e1a42
Compare
Pull request type
Checklist
black rocketpy/ tests/) has passed locallypytest tests -m slow --runslow) have passed locallyCHANGELOG.mdhas been updated (if relevant)Current behavior
Stability margin uses CN_α (lift coefficient derivative) to compute center of pressure:
This produces a CP independent of angle of attack, unlike OpenRocket's more dynamic behavior.
New behavior
Stability margin now uses CN(α) (actual lift coefficient) for CP calculation:
New methods in
Rocketclass:get_cp_position_from_alpha(alpha, mach)- computes CP as function of AoA and Machget_stability_margin_from_alpha(alpha, mach, time)- computes stability margin using AoA-dependent CPUpdated in
Flightclass:stability_marginnow uses simulation's angle of attack dataNote: With current linear lift models (
cl = clalpha * α), the α cancels mathematically. This change establishes the correct framework for future non-linear aerodynamic models (custom airfoils, wind tunnel data).Breaking change
Additional information
References:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.