@@ -181,7 +181,7 @@ def __call__(sys, u, params=None, squeeze=None):
181
181
182
182
"""
183
183
# Make sure the call makes sense
184
- if not sys ._isstatic () :
184
+ if sys .nstates != 0 :
185
185
raise TypeError (
186
186
"function evaluation is only supported for static "
187
187
"input/output systems" )
@@ -199,7 +199,7 @@ def __call__(sys, u, params=None, squeeze=None):
199
199
def __mul__ (self , other ):
200
200
"""Multiply two input/output systems (series interconnection)"""
201
201
# Convert 'other' to an I/O system if needed
202
- other = _convert_static_iosystem (other )
202
+ other = _convert_to_iosystem (other )
203
203
if not isinstance (other , InputOutputSystem ):
204
204
return NotImplemented
205
205
@@ -231,7 +231,7 @@ def __mul__(self, other):
231
231
def __rmul__ (self , other ):
232
232
"""Pre-multiply an input/output systems by a scalar/matrix"""
233
233
# Convert other to an I/O system if needed
234
- other = _convert_static_iosystem (other )
234
+ other = _convert_to_iosystem (other )
235
235
if not isinstance (other , InputOutputSystem ):
236
236
return NotImplemented
237
237
@@ -263,7 +263,7 @@ def __rmul__(self, other):
263
263
def __add__ (self , other ):
264
264
"""Add two input/output systems (parallel interconnection)"""
265
265
# Convert other to an I/O system if needed
266
- other = _convert_static_iosystem (other )
266
+ other = _convert_to_iosystem (other )
267
267
if not isinstance (other , InputOutputSystem ):
268
268
return NotImplemented
269
269
@@ -284,7 +284,7 @@ def __add__(self, other):
284
284
def __radd__ (self , other ):
285
285
"""Parallel addition of input/output system to a compatible object."""
286
286
# Convert other to an I/O system if needed
287
- other = _convert_static_iosystem (other )
287
+ other = _convert_to_iosystem (other )
288
288
if not isinstance (other , InputOutputSystem ):
289
289
return NotImplemented
290
290
@@ -305,7 +305,7 @@ def __radd__(self, other):
305
305
def __sub__ (self , other ):
306
306
"""Subtract two input/output systems (parallel interconnection)"""
307
307
# Convert other to an I/O system if needed
308
- other = _convert_static_iosystem (other )
308
+ other = _convert_to_iosystem (other )
309
309
if not isinstance (other , InputOutputSystem ):
310
310
return NotImplemented
311
311
@@ -329,7 +329,7 @@ def __sub__(self, other):
329
329
def __rsub__ (self , other ):
330
330
"""Parallel subtraction of I/O system to a compatible object."""
331
331
# Convert other to an I/O system if needed
332
- other = _convert_static_iosystem (other )
332
+ other = _convert_to_iosystem (other )
333
333
if not isinstance (other , InputOutputSystem ):
334
334
return NotImplemented
335
335
return other - self
@@ -355,6 +355,10 @@ def __truediv__(self, other):
355
355
else :
356
356
return NotImplemented
357
357
358
+ # Determine if a system is static (memoryless)
359
+ def _isstatic (self ):
360
+ return self .nstates == 0
361
+
358
362
def _update_params (self , params ):
359
363
# Update the current parameter values
360
364
self ._current_params = self .params .copy ()
@@ -484,7 +488,7 @@ def feedback(self, other=1, sign=-1, params=None):
484
488
485
489
"""
486
490
# Convert sys2 to an I/O system if needed
487
- other = _convert_static_iosystem (other )
491
+ other = _convert_to_iosystem (other )
488
492
489
493
# Make sure systems can be interconnected
490
494
if self .noutputs != other .ninputs or other .noutputs != self .ninputs :
@@ -932,6 +936,7 @@ def _out(self, t, x, u):
932
936
# Make the full set of subsystem outputs to system output
933
937
return self .output_map @ ylist
934
938
939
+ # Find steady state (static) inputs and outputs
935
940
def _compute_static_io (self , t , x , u ):
936
941
# Figure out the total number of inputs and outputs
937
942
(ninputs , noutputs ) = self .connect_map .shape
@@ -1711,8 +1716,8 @@ def ufun(t):
1711
1716
dt = (t - T [idx - 1 ]) / (T [idx ] - T [idx - 1 ])
1712
1717
return U [..., idx - 1 ] * (1. - dt ) + U [..., idx ] * dt
1713
1718
1714
- # Check to make sure this is not a static function
1715
- if sys ._isstatic () :
1719
+ # Check to make sure see if this is a static function
1720
+ if sys .nstates == 0 :
1716
1721
# Make sure the user gave a time vector for evaluation (or 'T')
1717
1722
if t_eval is None :
1718
1723
# User overrode t_eval with None, but didn't give us the times...
@@ -2924,8 +2929,8 @@ def _process_vector_argument(arg, name, size):
2924
2929
return val , nelem
2925
2930
2926
2931
2927
- # Utility function to create an I/O system from a static gain
2928
- def _convert_static_iosystem (sys ):
2932
+ # Utility function to create an I/O system ( from number or array)
2933
+ def _convert_to_iosystem (sys ):
2929
2934
# If we were given an I/O system, do nothing
2930
2935
if isinstance (sys , InputOutputSystem ):
2931
2936
return sys
0 commit comments