1313"""
1414
1515import numpy as np
16+
1617from numpy import absolute , real , angle , abs
1718from warnings import warn
1819from . import config
2122__all__ = ['poles' , 'zeros' , 'damp' , 'evalfr' , 'frequency_response' ,
2223 'freqresp' , 'dcgain' , 'pole' , 'zero' ]
2324
25+
2426class LTI (NamedIOSystem ):
2527 """LTI is a parent class to linear time-invariant (LTI) system objects.
2628
@@ -44,6 +46,7 @@ class LTI(NamedIOSystem):
4446 Note: dt processing has been moved to the NamedIOSystem class.
4547
4648 """
49+
4750 def __init__ (self , inputs = 1 , outputs = 1 , states = None , name = None , ** kwargs ):
4851 """Assign the LTI object's numbers of inputs and ouputs."""
4952 super ().__init__ (
@@ -71,8 +74,7 @@ def _set_inputs(self, value):
7174
7275 #: Deprecated
7376 inputs = property (
74- _get_inputs , _set_inputs , doc =
75- """
77+ _get_inputs , _set_inputs , doc = """
7678 Deprecated attribute; use :attr:`ninputs` instead.
7779
7880 The ``inputs`` attribute was used to store the number of system
@@ -94,8 +96,7 @@ def _set_outputs(self, value):
9496
9597 #: Deprecated
9698 outputs = property (
97- _get_outputs , _set_outputs , doc =
98- """
99+ _get_outputs , _set_outputs , doc = """
99100 Deprecated attribute; use :attr:`noutputs` instead.
100101
101102 The ``outputs`` attribute was used to store the number of system
@@ -201,6 +202,11 @@ def _dcgain(self, warn_infinite):
201202 else :
202203 return zeroresp
203204
205+ def ispassive (self ):
206+ # importing here prevents circular dependancy
207+ from control .passivity import ispassive
208+ return ispassive (self )
209+
204210 #
205211 # Deprecated functions
206212 #
@@ -321,7 +327,7 @@ def damp(sys, doprint=True):
321327 wn , damping , poles = sys .damp ()
322328 if doprint :
323329 print ('_____Eigenvalue______ Damping___ Frequency_' )
324- for p , d , w in zip (poles , damping , wn ) :
330+ for p , d , w in zip (poles , damping , wn ):
325331 if abs (p .imag ) < 1e-12 :
326332 print ("%10.4g %10.4g %10.4g" %
327333 (p .real , 1.0 , - p .real ))
@@ -330,6 +336,7 @@ def damp(sys, doprint=True):
330336 (p .real , p .imag , d , w ))
331337 return wn , damping , poles
332338
339+
333340def evalfr (sys , x , squeeze = None ):
334341 """Evaluate the transfer function of an LTI system for complex frequency x.
335342
@@ -388,6 +395,7 @@ def evalfr(sys, x, squeeze=None):
388395 """
389396 return sys .__call__ (x , squeeze = squeeze )
390397
398+
391399def frequency_response (sys , omega , squeeze = None ):
392400 """Frequency response of an LTI system at multiple angular frequencies.
393401
0 commit comments