Skip to content

Commit ce4c2b6

Browse files
authored
Merge pull request #590 from juanodecc/step_info_improve_undershoot
Change step_info undershoot percentage calculation
2 parents 203cae8 + 14a92fe commit ce4c2b6

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

control/tests/timeresp_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -301,17 +301,17 @@ def mimo_ss_step_matlab(self):
301301
'SteadyStateValue': -0.5394},
302302
{'RiseTime': 0.0000, # (*)
303303
'SettlingTime': 3.4000,
304-
'SettlingMin': -0.1034,
304+
'SettlingMin': -0.4350, # (*)
305305
'SettlingMax': -0.1485,
306306
'Overshoot': 132.0170,
307-
'Undershoot': 79.222, # 0. in MATLAB
307+
'Undershoot': 0.,
308308
'Peak': 0.4350,
309309
'PeakTime': .2,
310310
'SteadyStateValue': -0.1875}]]
311-
# (*): MATLAB gives 0.4 here, but it is unclear what
312-
# 10% and 90% of the steady state response mean, when
313-
# the step for this channel does not start a 0 for
314-
# 0 initial conditions
311+
# (*): MATLAB gives 0.4 for RiseTime and -0.1034 for
312+
# SettlingMin, but it is unclear what 10% and 90% of
313+
# the steady state response mean, when the step for
314+
# this channel does not start a 0.
315315
return T
316316

317317
@pytest.fixture

control/timeresp.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -923,11 +923,11 @@ def step_info(sysdata, T=None, T_num=None, yfinal=None,
923923
else:
924924
overshoot = 0
925925

926-
# Undershoot
927-
y_us = (sgnInf * yout).min()
928-
dy_us = np.abs(y_us)
929-
if dy_us > 0:
930-
undershoot = np.abs(100. * dy_us / InfValue)
926+
# Undershoot : InfValue and undershoot must have opposite sign
927+
y_us_index = (sgnInf * yout).argmin()
928+
y_us = yout[y_us_index]
929+
if (sgnInf * y_us) < 0:
930+
undershoot = (-100. * y_us / InfValue)
931931
else:
932932
undershoot = 0
933933

0 commit comments

Comments
 (0)