-
-
Notifications
You must be signed in to change notification settings - Fork 51
Add free flight simulation support (with cleanup) #74
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
Add free flight simulation support (with cleanup) #74
Conversation
This commit addresses issue camUrban#68 by replacing the maximum-period logic with least-common multiple (LCM) calculation when determining the cycle period for averaging forces and moments in unsteady simulations. Changes: - Added Movement._lcm() static method to calculate LCM of two periods - Added Movement._lcm_multiple() static method to calculate LCM across multiple periods - Added Movement.lcm_period property that returns the LCM of all motion periods from airplane_movements and operating_point_movement - Updated Movement initialization to use lcm_period instead of max_period when calculating num_steps for cyclic motion (line 252) - Updated UnsteadyProblem initialization in problems.py to use lcm_period instead of max_period when determining first_averaging_step (line 137) - Updated docstrings to clarify that lcm_period should be used for cycle-averaging calculations - Added unit tests for lcm_period calculation with static, single-period, and multiple-period movements Why LCM instead of max: When motions have different periods (e.g., 2s and 3s), using the maximum period (3s) does not ensure each motion completes an integer number of cycles. The LCM approach ensures proper cycle-averaging by using a period where all motions complete exactly N cycles. For 2s and 3s periods, the LCM is 6s, allowing the 2s motion to complete 3 cycles and the 3s motion to complete 2 cycles. The max_period property is preserved for backward compatibility. Fixes camUrban#68
…tting warning Rewrites the test_lcm_period_with_multiple_airplanes to explicitly construct Airplane, Wing, and WingCrossSectionMovement fixtures for two airplanes with periods 2.0 and 3.0. Prior results caused errors due to referencing missing fixture functions. Also fixes a warning about this file from the black CI action.
Added all_periods property to movement classes at all levels: - WingCrossSectionMovement: Collects all non-zero periods from position and angle motion - WingMovement: Collects periods from all wing cross sections plus own motion - AirplaneMovement: Collects periods from all wing movements plus own motion Updated Movement.lcm_period to use all_periods instead of max_period from each AirplaneMovement. This ensures LCM calculation includes ALL individual periods from the entire hierarchy, not just the maximum at each level. Example fix: For an airplane with wing motions at 3.0s and 4.0s periods, the old code calculated LCM(4.0) = 4.0 (missing the 3.0s motion). The new code calculates LCM(3.0, 4.0) = 12.0 (correct). Also added lcm_period to Movement class docstring as requested. Fixes failing tests: - test_lcm_period_with_multiple_wings_same_airplane - test_lcm_period_with_multiple_cross_sections_same_wing
…_periods` properties to the movement class docstrings
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feature/free_flight #74 +/- ##
=======================================================
+ Coverage 72.67% 72.90% +0.22%
=======================================================
Files 29 29
Lines 5530 5588 +58
=======================================================
+ Hits 4019 4074 +55
- Misses 1511 1514 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
camUrban
left a comment
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.
I switched the base of this PR to the feature branch this work is targeting instead of main, since the feature is still in progress and not ready for release.
I really appreciate you taking care of the merge-from-main. However, I still need those debug scripts for now (while this work is still in progress). Would you mind restoring the deleted files? Thanks again for jumping in on this!
Restoring files removed in de9110f as requested by @camUrban. These files are still needed for active development and testing of the free flight simulation feature. Restored: - debugging_scripts/ (8 files) - Development test scripts - docs/FREE_FLIGHT_DEVELOPMENT.md - Development tracking doc - gammabot_simulations/ (40 files) - Simulation test cases and results
|
Hey @AKHIL-149! This PR is a bit behind now after merging in the logging and Reynolds number calculation changes. I'm going to close it and update the free flight repo manually. |
Summary
This PR adds free flight simulation capabilities (based on #66) with the following improvements:
FREE_FLIGHT_DEVELOPMENT.md)Changes
Test Plan
Based on PR #66 by @camUrban with cleanup for merge.