diff --git a/control/tests/timeresp_test.py b/control/tests/timeresp_test.py index 54b9bc95b..1c97b9385 100644 --- a/control/tests/timeresp_test.py +++ b/control/tests/timeresp_test.py @@ -243,6 +243,23 @@ def siso_tf_kneg(self): 'SteadyStateValue': -1.0} return T + @pytest.fixture + def siso_tf_asymptotic_from_neg1(self): + # Peak_value = Undershoot = y_final(y(t=inf)) + T = TSys(TransferFunction([-1, 1], [1, 1])) + T.step_info = { + 'RiseTime': 2.197, + 'SettlingTime': 4.605, + 'SettlingMin': 0.9, + 'SettlingMax': 1.0, + 'Overshoot': 0, + 'Undershoot': 100.0, + 'Peak': 1.0, + 'PeakTime': 0.0, + 'SteadyStateValue': 1.0} + T.kwargs = {'step_info': {'T': np.arange(0, 5, 1e-3)}} + return T + @pytest.fixture def siso_tf_step_matlab(self): # example from matlab online help @@ -348,7 +365,8 @@ def tsystem(self, pole_cancellation, no_pole_cancellation, siso_tf_type1, siso_tf_kpos, siso_tf_kneg, siso_tf_step_matlab, siso_ss_step_matlab, - mimo_ss_step_matlab, mimo_tf_step_info): + mimo_ss_step_matlab, mimo_tf_step_info, + siso_tf_asymptotic_from_neg1): systems = {"siso_ss1": siso_ss1, "siso_ss2": siso_ss2, "siso_tf1": siso_tf1, @@ -373,6 +391,7 @@ def tsystem(self, "siso_ss_step_matlab": siso_ss_step_matlab, "mimo_ss_step_matlab": mimo_ss_step_matlab, "mimo_tf_step": mimo_tf_step_info, + "siso_tf_asymptotic_from_neg1": siso_tf_asymptotic_from_neg1, } return systems[request.param] @@ -466,7 +485,8 @@ def assert_step_info_match(self, sys, info, info_ref): "siso_ss_step_matlab", "siso_tf_kpos", "siso_tf_kneg", - "siso_tf_type1"], + "siso_tf_type1", + "siso_tf_asymptotic_from_neg1"], indirect=["tsystem"]) def test_step_info(self, tsystem, systype, time_2d, yfinal): """Test step info for SISO systems.""" diff --git a/control/timeresp.py b/control/timeresp.py index f0c130eb0..fd2e19c91 100644 --- a/control/timeresp.py +++ b/control/timeresp.py @@ -912,8 +912,8 @@ def step_info(sysdata, T=None, T_num=None, yfinal=None, if settled < len(T): settling_time = T[settled] - settling_min = (yout[tr_upper_index:]).min() - settling_max = (yout[tr_upper_index:]).max() + settling_min = min((yout[tr_upper_index:]).min(), InfValue) + settling_max = max((yout[tr_upper_index:]).max(), InfValue) # Overshoot y_os = (sgnInf * yout).max()