Skip to content

Include InfValue into settling min/max calculation for step_info #600

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions control/tests/timeresp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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]

Expand Down Expand Up @@ -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."""
Expand Down
4 changes: 2 additions & 2 deletions control/timeresp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down