@@ -659,3 +659,35 @@ def test_stability_static_margins(
659659 assert np .all (moments / wind_sign <= 0 )
660660 else : # static_margin == 0
661661 assert np .all (np .abs (moments ) <= 1e-10 )
662+
663+
664+ def test_max_acceleration_power_off_time_with_controllers (
665+ flight_calisto_air_brakes ,
666+ ):
667+ """Test that max_acceleration_power_off_time returns a valid time when
668+ controllers are present (e.g., air brakes). This is a regression test for
669+ a bug where the time was always returned as 0.0.
670+
671+ Parameters
672+ ----------
673+ flight_calisto_air_brakes : rocketpy.Flight
674+ Flight object with air brakes. See the conftest.py file for more info
675+ regarding this pytest fixture.
676+ """
677+ test = flight_calisto_air_brakes
678+ burn_out_time = test .rocket .motor .burn_out_time
679+
680+ # The max_acceleration_power_off_time should be at or after motor burn out
681+ # It should NOT be 0.0, which was the bug behavior
682+ assert test .max_acceleration_power_off_time > 0 , (
683+ "max_acceleration_power_off_time should not be zero"
684+ )
685+ assert test .max_acceleration_power_off_time >= burn_out_time - 0.01 , (
686+ f"max_acceleration_power_off_time ({ test .max_acceleration_power_off_time } ) "
687+ f"should be at or after burn_out_time ({ burn_out_time } )"
688+ )
689+
690+ # Also verify max_acceleration_power_off is positive
691+ assert test .max_acceleration_power_off > 0 , (
692+ "max_acceleration_power_off should be greater than zero"
693+ )
0 commit comments