Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fa15e6f

Browse files
committed
update discrete time tests to be stable
1 parent 72653b7 commit fa15e6f

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

control/tests/discrete_test.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ class Tsys:
2626
sys = rss(3, 1, 1)
2727
T.siso_ss1 = StateSpace(sys.A, sys.B, sys.C, sys.D, None)
2828
T.siso_ss1c = StateSpace(sys.A, sys.B, sys.C, sys.D, 0.0)
29-
T.siso_ss1d = StateSpace(sys.A, sys.B, sys.C, sys.D, 0.1)
30-
T.siso_ss2d = StateSpace(sys.A, sys.B, sys.C, sys.D, 0.2)
31-
T.siso_ss3d = StateSpace(sys.A, sys.B, sys.C, sys.D, True)
29+
30+
dsys = ct.sample_system(sys, 1)
31+
T.siso_ss1d = StateSpace(dsys.A, dsys.B, dsys.C, dsys.D, 0.1)
32+
T.siso_ss2d = StateSpace(dsys.A, dsys.B, dsys.C, dsys.D, 0.2)
33+
T.siso_ss3d = StateSpace(dsys.A, dsys.B, dsys.C, dsys.D, True)
3234

3335
# Two input, two output continuous-time system
3436
A = [[-3., 4., 2.], [-1., -3., 0.], [2., 5., 3.]]
@@ -39,17 +41,18 @@ class Tsys:
3941
T.mimo_ss1c = StateSpace(A, B, C, D, 0)
4042

4143
# Two input, two output discrete-time system
42-
T.mimo_ss1d = StateSpace(A, B, C, D, 0.1)
44+
T.mimo_ss1d = ct.sample_system(T.mimo_ss1c, 0.1)
4345

4446
# Same system, but with a different sampling time
45-
T.mimo_ss2d = StateSpace(A, B, C, D, 0.2)
47+
T.mimo_ss2d = StateSpace(
48+
T.mimo_ss1d.A, T.mimo_ss1d.B, T.mimo_ss1d.C, T.mimo_ss1d.D, 0.2)
4649

4750
# Single input, single output continuus and discrete transfer function
4851
T.siso_tf1 = TransferFunction([1, 1], [1, 2, 1], None)
49-
T.siso_tf1c = TransferFunction([1, 1], [1, 2, 1], 0)
50-
T.siso_tf1d = TransferFunction([1, 1], [1, 2, 1], 0.1)
51-
T.siso_tf2d = TransferFunction([1, 1], [1, 2, 1], 0.2)
52-
T.siso_tf3d = TransferFunction([1, 1], [1, 2, 1], True)
52+
T.siso_tf1c = TransferFunction([1, 1], [1, 0.2, 1], 0)
53+
T.siso_tf1d = TransferFunction([1, 1], [1, 0.2, 0.1], 0.1)
54+
T.siso_tf2d = TransferFunction([1, 1], [1, 0.2, 0.1], 0.2)
55+
T.siso_tf3d = TransferFunction([1, 1], [1, 0.2, 0.1], True)
5356

5457
return T
5558

0 commit comments

Comments
 (0)