13
13
"""
14
14
15
15
import numpy as np
16
+
16
17
from numpy import absolute , real , angle , abs
17
18
from warnings import warn
18
19
from . import config
21
22
__all__ = ['poles' , 'zeros' , 'damp' , 'evalfr' , 'frequency_response' ,
22
23
'freqresp' , 'dcgain' , 'pole' , 'zero' ]
23
24
25
+
24
26
class LTI (NamedIOSystem ):
25
27
"""LTI is a parent class to linear time-invariant (LTI) system objects.
26
28
@@ -44,6 +46,7 @@ class LTI(NamedIOSystem):
44
46
Note: dt processing has been moved to the NamedIOSystem class.
45
47
46
48
"""
49
+
47
50
def __init__ (self , inputs = 1 , outputs = 1 , states = None , name = None , ** kwargs ):
48
51
"""Assign the LTI object's numbers of inputs and ouputs."""
49
52
super ().__init__ (
@@ -71,8 +74,7 @@ def _set_inputs(self, value):
71
74
72
75
#: Deprecated
73
76
inputs = property (
74
- _get_inputs , _set_inputs , doc =
75
- """
77
+ _get_inputs , _set_inputs , doc = """
76
78
Deprecated attribute; use :attr:`ninputs` instead.
77
79
78
80
The ``inputs`` attribute was used to store the number of system
@@ -94,8 +96,7 @@ def _set_outputs(self, value):
94
96
95
97
#: Deprecated
96
98
outputs = property (
97
- _get_outputs , _set_outputs , doc =
98
- """
99
+ _get_outputs , _set_outputs , doc = """
99
100
Deprecated attribute; use :attr:`noutputs` instead.
100
101
101
102
The ``outputs`` attribute was used to store the number of system
@@ -201,6 +202,11 @@ def _dcgain(self, warn_infinite):
201
202
else :
202
203
return zeroresp
203
204
205
+ def ispassive (self ):
206
+ # importing here prevents circular dependancy
207
+ from control .passivity import ispassive
208
+ return ispassive (self )
209
+
204
210
#
205
211
# Deprecated functions
206
212
#
@@ -321,7 +327,7 @@ def damp(sys, doprint=True):
321
327
wn , damping , poles = sys .damp ()
322
328
if doprint :
323
329
print ('_____Eigenvalue______ Damping___ Frequency_' )
324
- for p , d , w in zip (poles , damping , wn ) :
330
+ for p , d , w in zip (poles , damping , wn ):
325
331
if abs (p .imag ) < 1e-12 :
326
332
print ("%10.4g %10.4g %10.4g" %
327
333
(p .real , 1.0 , - p .real ))
@@ -330,6 +336,7 @@ def damp(sys, doprint=True):
330
336
(p .real , p .imag , d , w ))
331
337
return wn , damping , poles
332
338
339
+
333
340
def evalfr (sys , x , squeeze = None ):
334
341
"""Evaluate the transfer function of an LTI system for complex frequency x.
335
342
@@ -388,6 +395,7 @@ def evalfr(sys, x, squeeze=None):
388
395
"""
389
396
return sys .__call__ (x , squeeze = squeeze )
390
397
398
+
391
399
def frequency_response (sys , omega , squeeze = None ):
392
400
"""Frequency response of an LTI system at multiple angular frequencies.
393
401
0 commit comments