harold.lqr

harold.lqr(G, Q, R=None, S=None, weight_on='state')

A full-state static feedback control design solver for which the following quadratic cost function is integrated (summed) over all positive time axis

           [x]' [ Q | S ] [x]
J(x, u) =  [-]  [---|---] [-]
           [u]  [ S | R ] [u]

for a continuous-time (discrete-time) system. If the system is given as a transfer-function then first a conversion to a state model is performed. If the “weight_on” is set to “output” then the cost function is assumed to be in the following form

           [x]' [ C | D ]' [ Q | S ] [ C | D ] [x]
J(x, u) =  [-]  [---|---]  [---|---] [---|---] [-] := J(y, u)
           [u]  [ 0 | I ]  [ S | R ] [ 0 | I ] [u]

Based on the provided system, the solution type is automatically selected between continuous-time and discrete-time solutions.

Parameters:
  • G (State, Transfer) – The regulated dynamic system representation
  • Q (array_like) – Square, state or output weighting matrix
  • R (array_like) – Square input weighting matrix
  • S (array_like) – Crossweighting matrix
  • weight_on (str, optional) – Depending on its value of “state” or “output”, the weights are applied on either states or the output.
Returns:

  • K (ndarray) – The regulator K such that A-BK is stable
  • X (ndarray) – The stabilizing solution to the corresponding Riccati equation
  • eigs (ndarray) – The array of closed loop A-BK eigenvalues.

Notes

For the conditions that weight matrices should satisfy, see SciPy documentation over scipy.linalg.solve_continuous_are() and scipy.linalg.solve_discrete_are()

Moreover, for the output weighted case, the returned solution is not always guaranteed to be the stabilizing solution.

If a Transfer is given, a the mismatch between the Q shape and the resulting number of states after the conversion can happen. It is recommended to work with State realizations directly.