@@ -50,7 +50,7 @@ def sys221(self):
50
50
D221 = [[1. , - 1. ]]
51
51
return StateSpace (A222 , B222 , C221 , D221 )
52
52
53
- def test_sisotool (self , sys , sysdt , sys222 , sys221 ):
53
+ def test_sisotool (self , sys ):
54
54
sisotool (sys , Hz = False )
55
55
fig = plt .gcf ()
56
56
ax_mag , ax_rlocus , ax_phase , ax_step = fig .axes [:4 ]
@@ -122,18 +122,46 @@ def test_sisotool(self, sys, sysdt, sys222, sys221):
122
122
assert_array_almost_equal (
123
123
ax_step .lines [0 ].get_data ()[1 ][:10 ], step_response_moved , 4 )
124
124
125
+ def test_sisotool_tvect (self , sys ):
125
126
# test supply tvect
126
- sisotool (sys , tvect = np .arange (0 , 1 , .1 ))
127
+ tvect = np .linspace (0 , 1 , 10 )
128
+ sisotool (sys , tvect = tvect )
129
+ fig = plt .gcf ()
130
+ ax_rlocus , ax_step = fig .axes [1 ], fig .axes [3 ]
131
+
132
+ # Move the rootlocus to another point and confirm same tvect
133
+ event = type ('test' , (object ,), {'xdata' : 2.31206868287 ,
134
+ 'ydata' : 15.5983051046 ,
135
+ 'inaxes' : ax_rlocus .axes })()
136
+ _RLClickDispatcher (event = event , sys = sys , fig = fig ,
137
+ ax_rlocus = ax_rlocus , sisotool = True , plotstr = '-' ,
138
+ bode_plot_params = dict (), tvect = tvect )
139
+ assert_array_almost_equal (tvect , ax_step .lines [0 ].get_data ()[0 ])
140
+
141
+ def test_sisotool_tvect_dt (self , sysdt ):
142
+ # test supply tvect
143
+ tvect = np .linspace (0 , 1 , 10 )
144
+ sisotool (sysdt , tvect = tvect )
145
+ fig = plt .gcf ()
146
+ ax_rlocus , ax_step = fig .axes [1 ], fig .axes [3 ]
127
147
128
- # test discrete-time
129
- sisotool (sysdt , tvect = 5 )
148
+ # Move the rootlocus to another point and confirm same tvect
149
+ event = type ('test' , (object ,), {'xdata' : 2.31206868287 ,
150
+ 'ydata' : 15.5983051046 ,
151
+ 'inaxes' : ax_rlocus .axes })()
152
+ _RLClickDispatcher (event = event , sys = sysdt , fig = fig ,
153
+ ax_rlocus = ax_rlocus , sisotool = True , plotstr = '-' ,
154
+ bode_plot_params = dict (), tvect = tvect )
155
+ assert_array_almost_equal (tvect , ax_step .lines [0 ].get_data ()[0 ])
130
156
131
- # test MIMO compatibility
132
- # sys must be siso or 2 input, 2 output
157
+ def test_sisotool_mimo (self , sys222 , sys221 ):
158
+ # a 2x2 should not raise an error:
159
+ sisotool (sys222 )
160
+
161
+ # but 2 input, 1 output should
133
162
with pytest .raises (ControlMIMONotImplemented ):
134
163
sisotool (sys221 )
135
- # does not raise an error:
136
- sisotool (sys222 )
164
+
137
165
138
166
139
167
0 commit comments