1616
1717class Lti :
1818 """Lti is a parent class to linear time invariant control (LTI) objects.
19-
19+
2020 Lti is the parent to the StateSpace and TransferFunction child
2121 classes. It contains the number of inputs and outputs, and the
2222 timebase (dt) for the system.
@@ -55,9 +55,9 @@ class Lti:
5555 zero
5656 feedback
5757 returnScipySignalLti
58-
58+
5959 """
60-
60+
6161 def __init__ (self , inputs = 1 , outputs = 1 , dt = None ):
6262 """Assign the LTI object's numbers of inputs and ouputs."""
6363
@@ -66,6 +66,39 @@ def __init__(self, inputs=1, outputs=1, dt=None):
6666 self .outputs = outputs
6767 self .dt = dt
6868
69+ def isdtime (self , strict = False ):
70+ """
71+ Check to see if a system is a discrete-time system
72+
73+ Parameters
74+ ----------
75+ strict: bool (default = False)
76+ If strict is True, make sure that timebase is not None
77+ """
78+
79+ # If no timebase is given, answer depends on strict flag
80+ if self .dt == None :
81+ return True if not strict else False
82+
83+ # Look for dt > 0 (also works if dt = True)
84+ return self .dt > 0
85+
86+ def isctime (self , strict = False ):
87+ """
88+ Check to see if a system is a continuous-time system
89+
90+ Parameters
91+ ----------
92+ sys : LTI system
93+ System to be checked
94+ strict: bool (default = False)
95+ If strict is True, make sure that timebase is not None
96+ """
97+ # If no timebase is given, answer depends on strict flag
98+ if self .dt is None :
99+ return True if not strict else False
100+ return self .dt == 0
101+
69102 def damp (self ):
70103 poles = self .pole ()
71104 wn = absolute (poles )
@@ -97,7 +130,7 @@ def timebase(sys, strict=True):
97130 elif not isinstance (sys , Lti ):
98131 raise ValueError ("Timebase not defined" )
99132
100- # Return the dample time, with converstion to float if strict is false
133+ # Return the sample time, with converstion to float if strict is false
101134 if (sys .dt == None ):
102135 return None
103136 elif (strict ):
@@ -144,22 +177,17 @@ def isdtime(sys, strict=False):
144177 # OK as long as strict checking is off
145178 return True if not strict else False
146179
147- # Check for a transfer fucntion or state space object
180+ # Check for a transfer function or state- space object
148181 if isinstance (sys , Lti ):
149- # If no timebase is given, answer depends on strict flag
150- if sys .dt == None :
151- return True if not strict else False
182+ return sys .isdtime (strict )
152183
153- # Look for dt > 0 (also works if dt = True)
154- return sys .dt > 0
155-
156- # Got possed something we don't recognize
184+ # Got passed something we don't recognize
157185 return False
158186
159187# Check to see if a system is a continuous time system
160188def isctime (sys , strict = False ):
161189 """
162- Check to see if a system is a continuous time system
190+ Check to see if a system is a continuous- time system
163191
164192 Parameters
165193 ----------
@@ -174,14 +202,9 @@ def isctime(sys, strict=False):
174202 # OK as long as strict checking is off
175203 return True if not strict else False
176204
177- # Check for a transfer fucntion or state space object
205+ # Check for a transfer function or state space object
178206 if isinstance (sys , Lti ):
179- # If no timebase is given, answer depends on strict flag
180- if sys .dt == None :
181- return True if not strict else False
182-
183- # Look for dt == 0
184- return sys .dt == 0
207+ return sys .isctime (strict )
185208
186- # Got possed something we don't recognize
209+ # Got passed something we don't recognize
187210 return False
0 commit comments