Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork232
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 ourterms of service andprivacy 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?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
1898cb3 to0dff1a7Comparecodecovbot commentedDec 2, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## develop #899 +/- ##===========================================+ Coverage 80.27% 81.11% +0.84%=========================================== Files 104 107 +3 Lines 12769 13841 +1072 ===========================================+ Hits 10250 11227 +977- Misses 2519 2614 +95 ☔ 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= [] | ||
| fori,tinenumerate(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)) | ||
| returnresults |
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
0dff1a7 tod1e1a42CompareAdd new methods to compute center of pressure and stability marginas a function of angle of attack (α) instead of just using the liftcoefficient derivative. This provides a more accurate stabilitymargin 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 functionalityCo-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_alphaCo-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
d1e1a42 to581ad7aCompare
Uh oh!
There was an error while loading.Please reload this page.
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 agentset things up for you — coding agent works faster and does higher quality work when set up for your repo.