def __init__(self, linsys, inputs=None, outputs=None, states=None, name=None): """Define a flat system from a SISO LTI system. Given a reachable, single-input/single-output, linear time-invariant system, create a differentially flat system representation. """ # Make sure we can handle the system if (not control.isctime(linsys)): raise control.ControlNotImplemented( "requires continuous time, linear control system") elif (not control.issiso(linsys)): raise control.ControlNotImplemented( "only single input, single output systems are supported") # Initialize the object as a LinearIO system LinearIOSystem.__init__(self, linsys, inputs=inputs, outputs=outputs, states=states, name=name) # Find the transformation to chain of integrators form # Note: store all array as ndarray, not matrix zsys, Tr = control.reachable_form(linsys) Tr = np.array(Tr[::-1, ::]) # flip rows # Extract the information that we need self.F = np.array(zsys.A[0, ::-1]) # input function coeffs self.T = Tr # state space transformation self.Tinv = np.linalg.inv(Tr) # compute inverse once # Compute the flat output variable z = C x Cfz = np.zeros(np.shape(linsys.C)) Cfz[0, 0] = 1 self.Cf = Cfz @ Tr
def __init__(self, sys): # Make sure we can handle the system if (not control.isctime(sys)): raise control.ControlNotImplemented( "requires continuous time, linear control system") elif (not control.issiso(sys)): raise control.ControlNotImplemented( "only single input, single output systems are supported") # Initialize the object and store system matrices FlatSystem.__init__(self, sys.states, sys.inputs) self.A = sys.A self.B = sys.B # Find the transformation to bring the system into reachable form zsys, Tr = control.reachable_form(sys) self.F = zsys.A[0,:] # input function coeffs self.T = Tr # state space transformation self.Tinv = np.linalg.inv(Tr) # computer inverse once # Compute the flat output variable z = C x Cfz = np.zeros(np.shape(sys.C)); Cfz[0, -1] = 1 self.C = Cfz * Tr
def __init__(self, sys): # Make sure we can handle the system if (not control.isctime(sys)): raise control.ControlNotImplemented( "requires continuous time, linear control system") elif (not control.issiso(sys)): raise control.ControlNotImplemented( "only single input, single output systems are supported") # Initialize the object and store system matrices FlatSystem.__init__(self, sys.states, sys.inputs) self.A = sys.A self.B = sys.B # Find the transformation to bring the system into reachable form zsys, Tr = control.reachable_form(sys) self.F = zsys.A[0, :] # input function coeffs self.T = Tr # state space transformation self.Tinv = np.linalg.inv(Tr) # computer inverse once # Compute the flat output variable z = C x Cfz = np.zeros(np.shape(sys.C)) Cfz[0, -1] = 1 self.C = Cfz * Tr
def __init__(self, linsys, inputs=None, outputs=None, states=None, name=None): """Define a flat system from a SISO LTI system. Given a reachable, single-input/single-output, linear time-invariant system, create a differentially flat system representation. Parameters ---------- linsys : StateSpace LTI StateSpace system to be converted inputs : int, list of str or None, optional Description of the system inputs. This can be given as an integer count or as a list of strings that name the individual signals. If an integer count is specified, the names of the signal will be of the form `s[i]` (where `s` is one of `u`, `y`, or `x`). If this parameter is not given or given as `None`, the relevant quantity will be determined when possible based on other information provided to functions using the system. outputs : int, list of str or None, optional Description of the system outputs. Same format as `inputs`. states : int, list of str, or None, optional Description of the system states. Same format as `inputs`. dt : None, True or float, optional System timebase. None (default) indicates continuous time, True indicates discrete time with undefined sampling time, positive number is discrete time with specified sampling time. params : dict, optional Parameter values for the systems. Passed to the evaluation functions for the system as default values, overriding internal defaults. name : string, optional System name (used for specifying signals) Returns ------- iosys : LinearFlatSystem Linear system represented as an flat input/output system """ # Make sure we can handle the system if (not control.isctime(linsys)): raise control.ControlNotImplemented( "requires continuous time, linear control system") elif (not control.issiso(linsys)): raise control.ControlNotImplemented( "only single input, single output systems are supported") # Initialize the object as a LinearIO system LinearIOSystem.__init__(self, linsys, inputs=inputs, outputs=outputs, states=states, name=name) # Find the transformation to chain of integrators form # Note: store all array as ndarray, not matrix zsys, Tr = control.reachable_form(linsys) Tr = np.array(Tr[::-1, ::]) # flip rows # Extract the information that we need self.F = np.array(zsys.A[0, ::-1]) # input function coeffs self.T = Tr # state space transformation self.Tinv = np.linalg.inv(Tr) # compute inverse once # Compute the flat output variable z = C x Cfz = np.zeros(np.shape(linsys.C)) Cfz[0, 0] = 1 self.Cf = np.dot(Cfz, Tr)