tdcpy.closed_loop module#
DDAE implementation
- class tdcpy.closed_loop.ClosedLoop(system, order, y_indices=None, u_indices=None, K0=None, hK=None, **kwargs)#
Bases:
TDSBaseClass representing system - controller interconnection
- Parameters:
- __init__(system, order, y_indices=None, u_indices=None, K0=None, hK=None, **kwargs)#
Initializes closed-loop system-controller interconnection
___________________ u1[-1] | | y1[-1] --------------->| |----------------> u1[0],...,u1[nu-2] | SYSTEM | y1[0],...,y[ny-2] ------>| |------- | |___________________| | | | | ___________________ | y2[0],...,y2[ny-2] | | | | u2[0],...,u1[nu-2] -------| |<------ y2[-1] | CONTROLLER | u2[-1] <---------------| |<--------------- |___________________|- Parameters:
system (DDAE) – system to be controlled
order (int) – order of controller, non-negative
y_indices (list, optional) – list of indices (outputs of system 1), if not defined, [0] is assumed
u_indices (list, optional) – list of indices (inputs of system 2), if not defined, [0] is assumed
K0 (npt.NDArray, optional) – initial controller values, shape (order+len(u_indices), order+len(y_indices), mK), if not defined, heuristic is used (TODO)
hK (npt.NDArray, optional) – controller delays, shape (mK,), if not defined, [0.] is assumed
- Return type:
None
Notes
Examples
>>> from tdcpy import DDAE, ClosedLoop >>> import numpy as np >>> A0 = np.array([[0., 1.], [-2., -3.]]) >>> A = np.stack([A0], axis=2) >>> hA = np.array([1.]) >>> E = np.eye(2) >>> B1 = np.array([[0.], [1.]]) >>> B = np.stack([B1], axis=2) >>> hB = np.array([0.]) >>> C1 = np.array([[1., 0.], [0., 1.]]) >>> C = np.stack([C1], axis=2) >>> hC = np.array([0.]) >>> D1 = np.array([[0., 0.], [0., 0.]]) >>> D = np.stack([D1], axis=2) >>> hD = np.array([0.]) >>> system = DDAE(E=E, A=A, hA=hA, B=B, hB=hB, C=C, hC=hC, D=D, hD=hD) >>> order = 1 >>> y_indices = [0, 1] >>> u_indices = [0] >>> K0 = np.array([[0., 0.]]) >>> K = np.stack([K0], axis=2) >>> hK = np.array([0.]) >>> cl = ClosedLoop(system, order, y_indices, u_indices, K, hK) >>> cl.E.shape (6, 6) >>> cl.A.shape (6, 6, 1) >>> cl.hA.shape (1,)
- property E: ndarray[tuple[Any, ...], dtype[_ScalarT]]#
E matrix from TDS representation, shape (n, n)
- get_delay_difference_equation()#
associated delay difference equation
- property hK#
- property mK#
- property K#