@@ -628,3 +628,35 @@ def test_stability_static_margins(
628628 assert np .all (moments / wind_sign <= 0 )
629629 else : # static_margin == 0
630630 assert np .all (np .abs (moments ) <= 1e-10 )
631+
632+
633+ def test_max_acceleration_power_off_time_with_controllers (
634+ flight_calisto_air_brakes ,
635+ ):
636+ """Test that max_acceleration_power_off_time returns a valid time when
637+ controllers are present (e.g., air brakes). This is a regression test for
638+ a bug where the time was always returned as 0.0.
639+
640+ Parameters
641+ ----------
642+ flight_calisto_air_brakes : rocketpy.Flight
643+ Flight object with air brakes. See the conftest.py file for more info
644+ regarding this pytest fixture.
645+ """
646+ test = flight_calisto_air_brakes
647+ burn_out_time = test .rocket .motor .burn_out_time
648+
649+ # The max_acceleration_power_off_time should be at or after motor burn out
650+ # It should NOT be 0.0, which was the bug behavior
651+ assert test .max_acceleration_power_off_time > 0 , (
652+ "max_acceleration_power_off_time should not be zero"
653+ )
654+ assert test .max_acceleration_power_off_time >= burn_out_time - 0.01 , (
655+ f"max_acceleration_power_off_time ({ test .max_acceleration_power_off_time } ) "
656+ f"should be at or after burn_out_time ({ burn_out_time } )"
657+ )
658+
659+ # Also verify max_acceleration_power_off is positive
660+ assert test .max_acceleration_power_off > 0 , (
661+ "max_acceleration_power_off should be greater than zero"
662+ )
0 commit comments