Skip to content

Commit b36d053

Browse files
committed
slight adjustment of decay time in step response
1 parent 9c87a5b commit b36d053

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

control/tests/sisotool_test.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ def test_sisotool(self, sys):
6868

6969
# Check the step response before moving the point
7070
step_response_original = np.array(
71-
[0. , 0.0366, 0.2032, 0.4857, 0.82 , 1.1358, 1.3762, 1.507 ,
72-
1.5206, 1.4326])
71+
[0. , 0.021 , 0.124 , 0.3146, 0.5653, 0.8385, 1.0969, 1.3095,
72+
1.4549, 1.5231])
7373
assert_array_almost_equal(
7474
ax_step.lines[0].get_data()[1][:10], step_response_original, 4)
7575

@@ -113,8 +113,8 @@ def test_sisotool(self, sys):
113113

114114
# Check if the step response has changed
115115
step_response_moved = np.array(
116-
[0. , 0.0415, 0.2687, 0.7248, 1.3367, 1.9505, 2.3765, 2.4469,
117-
2.0738, 1.2926])
116+
[0. , 0.023 , 0.1554, 0.4401, 0.8646, 1.3722, 1.875 , 2.2709,
117+
2.4633, 2.3827])
118118
assert_array_almost_equal(
119119
ax_step.lines[0].get_data()[1][:10], step_response_moved, 4)
120120

control/tests/timeresp_test.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,10 @@ def test_step_pole_cancellation(self, pole_cancellation,
310310
step_info_no_cancellation = step_info(no_pole_cancellation)
311311
step_info_cancellation = step_info(pole_cancellation)
312312
for key in step_info_no_cancellation:
313+
if key == 'Overshoot':
314+
# skip this test because these systems have no overshoot
315+
# => very sensitive to parameters
316+
continue
313317
np.testing.assert_allclose(step_info_no_cancellation[key],
314318
step_info_cancellation[key], rtol=1e-4)
315319

@@ -522,7 +526,7 @@ def test_step_robustness(self):
522526

523527
@pytest.mark.parametrize(
524528
"tfsys, tfinal",
525-
[(TransferFunction(1, [1, .5]), 17.034386), # pole at 0.5
529+
[(TransferFunction(1, [1, .5]), 13.81551), # pole at 0.5
526530
(TransferFunction(1, [1, .5]).sample(.1), 25), # discrete pole at 0.5
527531
(TransferFunction(1, [1, .5, 0]), 25)]) # poles at 0.5 and 0
528532
def test_auto_generated_time_vector_tfinal(self, tfsys, tfinal):

control/timeresp.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ def step_info(sys, T=None, T_num=None, SettlingTimeThreshold=0.02,
792792
T, yout = step_response(sys, T)
793793

794794
# Steady state value
795-
InfValue = yout[-1]
795+
InfValue = sys.dcgain()
796796

797797
# RiseTime
798798
tr_lower_index = (np.where(yout >= RiseTimeLimits[0] * InfValue)[0])[0]
@@ -1124,7 +1124,7 @@ def _ideal_tfinal_and_dt(sys, is_step=True):
11241124
default_dt = 0.1
11251125
total_cycles = 5 # number of cycles for oscillating modes
11261126
pts_per_cycle = 25 # Number of points divide a period of oscillation
1127-
log_decay_percent = np.log(5000) # Factor of reduction for real pole decays
1127+
log_decay_percent = np.log(1000) # Factor of reduction for real pole decays
11281128

11291129
if sys._isstatic():
11301130
tfinal = default_tfinal

0 commit comments

Comments
 (0)