@@ -178,6 +178,28 @@ def timebaseEqual(sys1, sys2):
178178 else :
179179 return sys1 .dt == sys2 .dt
180180
181+ # Find a common timebase between two or more systems
182+ def _find_timebase (sys1 , * sysn ):
183+ """Find the common timebase between systems, otherwise return False"""
184+
185+ # Create a list of systems to check
186+ syslist = [sys1 ]
187+ syslist .append (* sysn )
188+
189+ # Look for a common timebase
190+ dt = None
191+
192+ for sys in syslist :
193+ # Make sure time bases are consistent
194+ if (dt is None and sys .dt is not None ) or \
195+ (dt is True and isdiscrete (sys )):
196+ # Timebase was not specified; set to match this system
197+ dt = sys .dt
198+ elif dt != sys .dt :
199+ return False
200+ return dt
201+
202+
181203# Check to see if a system is a discrete time system
182204def isdtime (sys , strict = False ):
183205 """
@@ -200,6 +222,15 @@ def isdtime(sys, strict=False):
200222 if isinstance (sys , LTI ):
201223 return sys .isdtime (strict )
202224
225+ # Check to see if object has a dt object
226+ if hasattr (sys , 'dt' ):
227+ # If no timebase is given, answer depends on strict flag
228+ if sys .dt == None :
229+ return True if not strict else False
230+
231+ # Look for dt > 0 (also works if dt = True)
232+ return sys .dt > 0
233+
203234 # Got passed something we don't recognize
204235 return False
205236
@@ -225,6 +256,13 @@ def isctime(sys, strict=False):
225256 if isinstance (sys , LTI ):
226257 return sys .isctime (strict )
227258
259+ # Check to see if object has a dt object
260+ if hasattr (sys , 'dt' ):
261+ # If no timebase is given, answer depends on strict flag
262+ if sys .dt is None :
263+ return True if not strict else False
264+ return sys .dt == 0
265+
228266 # Got passed something we don't recognize
229267 return False
230268
0 commit comments