Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3c13f2c

Browse files
committed
add additional checks for overriding timebase
1 parentf17c919 commit3c13f2c

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

‎control/tests/timebase_test.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,28 @@ def test_composition(dt1, dt2, dt3, op, type):
3535
else:
3636
sys3=op(sys1,sys2)
3737
assertsys3.dt==dt3
38+
39+
40+
@pytest.mark.parametrize("dt", [None,0,0.1])
41+
deftest_composition_override(dt):
42+
# Define the system
43+
A,B,C,D= [[1,1], [0,1]], [[0], [1]], [[1,0]],0
44+
sys1=ct.ss(A,B,C,D,None,inputs='u1',outputs='y1')
45+
sys2=ct.ss(A,B,C,D,None,inputs='y1',outputs='y2')
46+
47+
# Show that we can override the type
48+
sys3=ct.interconnect([sys1,sys2],inputs='u1',outputs='y2',dt=dt)
49+
assertsys3.dt==dt
50+
51+
# Overriding the type with an inconsistent type generates an error
52+
sys1=ct.StateSpace(A,B,C,D,0.1,inputs='u1',outputs='y1')
53+
ifdt!=0.1anddtisnotNone:
54+
withpytest.raises(ValueError,match="incompatible timebases"):
55+
sys3=ct.interconnect(
56+
[sys1,sys2],inputs='u1',outputs='y2',dt=dt)
57+
58+
sys1=ct.StateSpace(A,B,C,D,0,inputs='u1',outputs='y1')
59+
ifdt!=0anddtisnotNone:
60+
withpytest.raises(ValueError,match="incompatible timebases"):
61+
sys3=ct.interconnect(
62+
[sys1,sys2],inputs='u1',outputs='y2',dt=dt)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp