RocketPy
RocketPy copied to clipboard
ENH: Make Static Margin Calculation Lazy
Currently, the static margin calculation is performed during the simulation, which is unnecessary and potentially inefficient. This calculation should be deferred and performed only when it is explicitly needed. This adjustment could enhance the performance and streamline the simulation process.
Proposed Solution:
- Refactor the static margin calculation so that it is computed lazily.
- Ensure that the calculation is triggered only when the static margin value is specifically requested.
- Use some logic like that of
@cached_property, so that it is only calculated when its need - Make sure that whenever something is added/changed in the rocket that could chang the SM value (e.g. adding a new aero surface) the cached value is cleaned