control.create_statefbk_iosystem

control.create_statefbk_iosystem(sys, K, integral_action=None, xd_labels='xd[{i}]', ud_labels='ud[{i}]', estimator=None, type='linear')

Create an I/O system using a (full) state feedback controller

This function creates an input/output system that implements a state feedback controller of the form

u = ud - K_p (x - xd) - K_i integral(C x - C x_d)

It can be called in the form

ctrl, clsys = ct.create_statefbk_iosystem(sys, K)

where sys is the process dynamics and K is the state (+ integral) feedback gain (eg, from LQR). The function returns the controller ctrl and the closed loop systems clsys, both as I/O systems.

Parameters
  • sys (InputOutputSystem) – The I/O system that represents the process dynamics. If no estimator is given, the output of this system should represent the full state.

  • K (ndarray) – The state feedback gain. This matrix defines the gains to be applied to the system. If integral_action is None, then the dimensions of this array should be (sys.ninputs, sys.nstates). If integral action is set to a matrix or a function, then additional columns represent the gains of the integral states of the controller.

  • xd_labels (str or list of str, optional) – Set the name of the signals to use for the desired state and inputs. If a single string is specified, it should be a format string using the variable i as an index. Otherwise, a list of strings matching the size of xd and ud, respectively, should be used. Default is 'xd[{i}]' for xd_labels and 'xd[{i}]' for ud_labels.

  • ud_labels (str or list of str, optional) – Set the name of the signals to use for the desired state and inputs. If a single string is specified, it should be a format string using the variable i as an index. Otherwise, a list of strings matching the size of xd and ud, respectively, should be used. Default is 'xd[{i}]' for xd_labels and 'xd[{i}]' for ud_labels.

  • integral_action (None, ndarray, or func, optional) – If this keyword is specified, the controller can include integral action in addition to state feedback. If integral_action is an ndarray, it will be multiplied by the current and desired state to generate the error for the internal integrator states of the control law. If integral_action is a function h, that function will be called with the signature h(t, x, u, params) to obtain the outputs that should be integrated. The number of outputs that are to be integrated must match the number of additional columns in the K matrix.

  • estimator (InputOutputSystem, optional) – If an estimator is provided, using the states of the estimator as the system inputs for the controller.

  • type ('nonlinear' or 'linear', optional) – Set the type of controller to create. The default is a linear controller implementing the LQR regulator. If the type is ‘nonlinear’, a :class:NonlinearIOSystem is created instead, with the gain K as a parameter (allowing modifications of the gain at runtime).

Returns

  • ctrl (InputOutputSystem) – Input/output system representing the controller. This system takes as inputs the desired state xd, the desired input ud, and the system state x. It outputs the controller action u according to the formula u = ud - K(x - xd). If the keyword integral_action is specified, then an additional set of integrators is included in the control system (with the gain matrix K having the integral gains appended after the state gains).

  • clsys (InputOutputSystem) – Input/output system representing the closed loop system. This systems takes as inputs the desired trajectory (xd, ud) and outputs the system state x and the applied input u (vertically stacked).