fast-aircraft-design / FAST-OAD

FAST-OAD: An open source framework for rapid Overall Aircraft Design
GNU General Public License v3.0
51 stars 25 forks source link

Genericity for macro segments #488

Closed christophe-david closed 1 year ago

christophe-david commented 1 year ago

This PR implements the concept of macro-segment.

Additionally, the segments package was getting cluttered and has been reorganized, and some renaming has been done (abstract classes that were not called Abstract..., etc..)

A first try at macro-segment implementation was the TakeOffSequence class, that aggregated the segments for ground speed change, rotation, and end of takeoff. The macro-segment must have all needed parameters that apply to aggregated segments, and also some dedicated parameters that will apply to some aggregated parameters in a defined way. For instance, the target for ground speed change is the rotation speed. Then TakeOffSequence has a rotation_equivalent_airspeed parameter that is used to create the target flight point of the GroundSpeedChangeSegment instance.

The learned lesson of this first try is that the parameters of the macro-segment are strongly linked to parameters of aggregated segments. Any future change in one of the aggregated segment will have to be propagated to the concerned macro-segments, which is not DRY. This problem is solved by using the meta class MacroSegmentMeta that allows to derive from MacroSegmentBase, and ensures that all parameters of the aggregated segments are present in the macro-segment. And MacroSegmentBase ensures that parameter values of the macro-segment are used for aggregated segments. Specific cases (like the above-given example of rotation speed) are managed through overloading.

codecov[bot] commented 1 year ago

Codecov Report

Merging #488 (ad88cce) into master (8c4f0b7) will increase coverage by 0.08%. The diff coverage is 95.83%.

@@            Coverage Diff             @@
##           master     #488      +/-   ##
==========================================
+ Coverage   84.25%   84.34%   +0.08%     
==========================================
  Files         128      130       +2     
  Lines        5971     6005      +34     
  Branches      880      885       +5     
==========================================
+ Hits         5031     5065      +34     
  Misses        784      784              
  Partials      156      156              
Impacted Files Coverage Δ
...sion_definition/mission_builder/mission_builder.py 88.75% <ø> (ø)
...es/mission/segments/registered/takeoff/__init__.py 100.00% <ø> (ø)
...ls/performances/mission/segments/time_step_base.py 93.44% <93.44%> (ø)
src/fastoad/api.py 100.00% <100.00%> (ø)
src/fastoad/models/performances/mission/mission.py 94.73% <100.00%> (ø)
...odels/performances/mission/openmdao/mission_run.py 91.07% <100.00%> (ø)
src/fastoad/models/performances/mission/routes.py 95.89% <100.00%> (ø)
...stoad/models/performances/mission/segments/base.py 90.00% <100.00%> (-1.99%) :arrow_down:
...ls/performances/mission/segments/macro_segments.py 100.00% <100.00%> (ø)
...rformances/mission/segments/registered/__init__.py 100.00% <100.00%> (ø)
... and 12 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.