From a0a570afc22092dcd41cfc3550a578f0627529cf Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Tue, 30 Mar 2021 16:22:49 +0200 Subject: [PATCH 1/3] test more asymptotic step_info --- control/tests/timeresp_test.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/control/tests/timeresp_test.py b/control/tests/timeresp_test.py index 54b9bc95b..fb12ad811 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 = {'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.""" From 6e94302de16b024a69a542999f25d952a3dd1dda Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Tue, 30 Mar 2021 16:23:14 +0200 Subject: [PATCH 2/3] fix settling min/max for asymptotic systen --- control/timeresp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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() From e06197c4d9889aa4d71d0e1ff0b0953b269c8b59 Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Wed, 31 Mar 2021 00:43:35 +0200 Subject: [PATCH 3/3] actually use the specified time vector --- control/tests/timeresp_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/control/tests/timeresp_test.py b/control/tests/timeresp_test.py index fb12ad811..1c97b9385 100644 --- a/control/tests/timeresp_test.py +++ b/control/tests/timeresp_test.py @@ -257,7 +257,7 @@ def siso_tf_asymptotic_from_neg1(self): 'Peak': 1.0, 'PeakTime': 0.0, 'SteadyStateValue': 1.0} - T.kwargs = {'T': np.arange(0, 5, 1e-3)} + T.kwargs = {'step_info': {'T': np.arange(0, 5, 1e-3)}} return T @pytest.fixture pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy