Skip to content

Commit 1f9e46c

Browse files
committed
TST: add unit test for comparing return values of continuous/discrete sims
1 parent 32f13bc commit 1f9e46c

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

control/tests/timeresp_test.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from control.timeresp import *
1515
from control.statesp import *
1616
from control.xferfcn import TransferFunction, _convertToTransferFunction
17-
17+
from control.dtime import c2d
1818

1919
class TestTimeresp(unittest.TestCase):
2020
def setUp(self):
@@ -77,6 +77,15 @@ def test_step_response(self):
7777
np.testing.assert_array_almost_equal(y_00, youttrue, decimal=4)
7878
np.testing.assert_array_almost_equal(y_11, youttrue, decimal=4)
7979

80+
# Make sure continuous and discrete time use same return conventions
81+
sysc = self.mimo_ss1
82+
sysd = c2d(sysc, 1) # discrete time system
83+
Tvec = np.linspace(0, 10, 11) # make sure to use integer times 0..10
84+
Tc, youtc = step_response(sysc, Tvec, input=0)
85+
Td, youtd = step_response(sysd, Tvec, input=0)
86+
np.testing.assert_array_equal(Tc.shape, Td.shape)
87+
np.testing.assert_array_equal(youtc.shape, youtd.shape)
88+
8089
def test_impulse_response(self):
8190
# Test SISO system
8291
sys = self.siso_ss1

0 commit comments

Comments
 (0)