8000 Solved undershoot value calculus problem. · rtrhd/python-control@a95f75f · GitHub
[go: up one dir, main page]

Skip to content

Commit a95f75f

Browse files
committed
Solved undershoot value calculus problem.
Improper systems with negative respose, if do not have inverse respons, the undershoot must be 0. This ocurr in the MIMO system used in the step_info test. I think, the rise time and setting minimun and maximun computed by this funtion are right in.
1 parent 203cae8 commit a95f75f

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

control/tests/timeresp_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,10 @@ 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,# -0.1935 in MATLAB. (is wrong)
305305
'SettlingMax': -0.1485,
306306
'Overshoot': 132.0170,
307-
'Undershoot': 79.222, # 0. in MATLAB
307+
'Undershoot': 0, # 0. in MATLAB (is correct)
308308
'Peak': 0.4350,
309309
'PeakTime': .2,
310310
'SteadyStateValue': -0.1875}]]

control/timeresp.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,7 @@ def step_info(sysdata, T=None, T_num=None, yfinal=None,
882882

883883
# Steady state value
884884
InfValue = InfValues[i, j]
885+
InfValue_sign = np.sign(InfValue)
885886
sgnInf = np.sign(InfValue.real)
886887

887888
rise_time: float = np.NaN
@@ -923,11 +924,11 @@ def step_info(sysdata, T=None, T_num=None, yfinal=None,
923924
else:
924925
overshoot = 0
925926

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)
927+
# Undershoot
928+
y_us = (InfValue_sign*yout).min()
929+
y_us_index = (InfValue_sign*yout).argmin()
930+
if (InfValue_sign * yout[y_us_index]) < 0: # must have oposite sign
931+
undershoot = np.abs(100. * np.abs(y_us) / InfValue)
931932
else:
932933
undershoot = 0
933934

0 commit comments

Comments
 (0)
0