|
3 | 3 | State space analysis and design |
4 | 4 | =============================== |
5 | 5 |
|
| 6 | +This section describes the functions the are available to analyze |
| 7 | +state space systems and design state feedback controllers. The |
| 8 | +functionality described here is mainly specific to state space system |
| 9 | +representations; additional functions for analysis of linear |
| 10 | +input/output systems are defined in the next section and can also be |
| 11 | +applied to LTI systems in state space form. |
| 12 | + |
| 13 | + |
6 | 14 | State space properties |
7 | 15 | ---------------------- |
8 | 16 |
|
| 17 | +The following basic attributes and methods are available for |
| 18 | +:class:`StateSpace` objects: |
| 19 | + |
| 20 | +.. autosummary:: |
| 21 | + |
| 22 | + ~StateSpace.A |
| 23 | + ~StateSpace.B |
| 24 | + ~StateSpace.C |
| 25 | + ~StateSpace.D |
| 26 | + ~StateSpace.dt |
| 27 | + ~StateSpace.shape |
| 28 | + ~StateSpace.nstates |
| 29 | + ~StateSpace.poles |
| 30 | + ~StateSpace.zeros |
| 31 | + ~StateSpace.dcgain |
| 32 | + ~StateSpace.sample |
| 33 | + ~StateSpace.returnScipySignalLTI |
| 34 | + |
| 35 | +A complete list of attributes, methods, and properties is available in |
| 36 | +the :class:`~control.StateSpace` class documentation. |
| 37 | + |
| 38 | + |
| 39 | +Similarity transformations and canonical forms |
| 40 | +---------------------------------------------- |
| 41 | + |
| 42 | +State space systems can be transformed into different internal |
| 43 | +representations representing a variety of standard cananonical forms |
| 44 | +that have the same input/output properties. The |
| 45 | +:func:`similarity_transform` function allows a change of internal |
| 46 | +state variable via similarity transformation and the |
| 47 | +:func:`canonical_form` function converts sytems into different |
| 48 | +canonical forms. Additional information is available on the |
| 49 | +documentation pages for the individual functions: |
| 50 | + |
| 51 | +.. autosummary:: |
| 52 | + |
| 53 | + canonical_form |
| 54 | + observable_form |
| 55 | + modal_form |
| 56 | + reachable_form |
| 57 | + similarity_transform |
| 58 | + |
| 59 | + |
9 | 60 | State feedback design |
10 | 61 | --------------------- |
11 | 62 |
|
12 | | -Canonical forms |
13 | | ---------------- |
| 63 | +State feedback controllers for a linear system are controllers of the form |
| 64 | + |
| 65 | +.. math:: |
| 66 | +
|
| 67 | + u = -K x |
| 68 | +
|
| 69 | +where :math:`K \in {\mathbb R}^{m \times n}` is a matrix of feedback |
| 70 | +gains. Assuming the systems is controllable, the resulting closed |
| 71 | +loop system will have dynamics matrix :math:`A - B K` with stable |
| 72 | +eigenvalues. |
| 73 | + |
| 74 | +Feedback controllers can be designed using one of several |
| 75 | +methods: |
| 76 | + |
| 77 | +.. autosummary:: |
| 78 | + |
| 79 | + acker |
| 80 | + lqr |
| 81 | + place |
| 82 | + place_varga |
| 83 | + |
| 84 | +The :func:`acker`, :func:`place`, and :func:`place_varga` place the |
| 85 | +eigenvalues of the closed loop system to a desired set of values. |
| 86 | +Each takes the `A` and `B` matrices of the state space system and the |
| 87 | +desired locaton of the eigenvalues and returns a gain matrix `K`:: |
| 88 | + |
| 89 | + K = ct.place(sys.A, sys.B, E) |
| 90 | + |
| 91 | +where `E` is a 1D array of desired eigenvalues. |
| 92 | + |
| 93 | +The :func:`lqr` function computes the optimal state feedback controller |
| 94 | +that minimizes the quadratic cost |
| 95 | + |
| 96 | +.. math:: |
| 97 | +
|
| 98 | + J = \int_0^\infty (x' Q x + u' R u + 2 x' N u) dt |
| 99 | +
|
| 100 | +by solving the approriate Riccati equation. It returns the gain |
| 101 | +matrix `K`, the solution to the Riccati equation `S`, and the location |
| 102 | +of the closed loop eigenvalues `E`. It can be called in one of |
| 103 | +several forms: |
| 104 | + |
| 105 | + * `K, S, E = ct.lqr(sys, Q, R)` |
| 106 | + * `K, S, E = ct.lqr(sys, Q, R, N)` |
| 107 | + * `K, S, E = ct.lqr(A, B, Q, R)` |
| 108 | + * `K, S, E = ct.lqr(A, B, Q, R, N)` |
| 109 | + |
| 110 | +If `sys` is a discrete time system, the first two forms will compute |
| 111 | +the discrete time optimal controller. For the second two forms, the |
| 112 | +:func:`dlqr` function can be used. Additional arguments and details |
| 113 | +are given on the :func:`lqr` and :func:`dlqr` documentation pages. |
14 | 114 |
|
15 | 115 | State estimation |
16 | 116 | ---------------- |
17 | 117 |
|
18 | | -Passive systems |
19 | | ---------------- |
20 | | -.. automodule:: passive |
21 | | - :no-members: |
22 | | - :no-inherited-members: |
23 | | - :no-special-members: |
| 118 | +State estimators (or observers) are dynamical systems that estimate |
| 119 | +the state of the system given a model of the dynamics and the input |
| 120 | +and output signals as a function of time. Linear state estimators |
| 121 | +have the form |
| 122 | + |
| 123 | +.. math:: |
| 124 | +
|
| 125 | + \frac{d\hat x}{dt} = A \hat x + B u + L(y - C\hat x - D u), |
| 126 | +
|
| 127 | +where :math:`\hat x` is an estimate of the state and :math:`L \in |
| 128 | +{\mathbb R}^{n \times p}` represents the estimator gain. The gain |
| 129 | +:math:`L` is chosen such that the eigenvalues of the matrix :math:`A - |
| 130 | +L C` are stable, resulting in an estimate that converges to the value |
| 131 | +of the system state. |
| 132 | + |
| 133 | +The gain matrix :math:`L` can be chosen using eigenvalue placement by |
| 134 | +calling the :func:`place` function:: |
| 135 | + |
| 136 | + L = ct.place(sys.A.T, sys.C.T, E).T |
| 137 | + |
| 138 | +where `E` is the desired location of the eigenvalues and `.T` computes |
| 139 | +the transpose of a matrix. |
| 140 | + |
| 141 | +Alternatively, an optimal estimator can be computed using the |
| 142 | +:func:`lqe` function. We consider a continuous time, state space |
| 143 | +system |
| 144 | + |
| 145 | +.. math:: |
| 146 | +
|
| 147 | + \frac{dx}{dt} &= Ax + Bu + Gw \\ |
| 148 | + y &= Cx + Du + v |
| 149 | +
|
| 150 | +with unbiased process noise :math:`w` and measurement noise :math:`v` |
| 151 | +with covariances satisfying |
| 152 | + |
| 153 | +.. math:: |
| 154 | +
|
| 155 | + {\mathbb E}\{w w^T\} = QN,\qquad |
| 156 | + {\mathbb E}\{v v^T\} = RN,\qquad |
| 157 | + {\mathbb E}\{w v^T\} = NN |
| 158 | +
|
| 159 | +where :math:`{\mathbb E}\{\cdot\}` represents the expectation of a |
| 160 | +quantity. |
| 161 | + |
| 162 | +The :func:`lqe` function computes the observer gain matrix L such that the |
| 163 | +stationary (non-time-varying) Kalman filter |
| 164 | + |
| 165 | +.. math:: |
| 166 | +
|
| 167 | + \frac{d\hat x}{dt} = A \hat x + B u + L(y - C\hat x - D u), |
| 168 | +
|
| 169 | +produces a state estimate :math:`\hat x` that minimizes the expected |
| 170 | +squared error using the sensor measurements :math:`y`. |
| 171 | + |
| 172 | +As with the :func:`lqr` function, the :func:`lqe` function can be called in several forms: |
| 173 | + |
| 174 | + * `L, P, E = lqe(sys, QN, RN)` |
| 175 | + * `L, P, E = lqe(sys, QN, RN, NN)` |
| 176 | + * `L, P, E = lqe(A, G, C, QN, RN)` |
| 177 | + * `L, P, E = lqe(A, G, C, QN, RN, NN)` |
| 178 | + |
| 179 | +where `sys` is an :class:`LTI` object, and `A`, `G`, `C`, `QN`, `RN`, |
| 180 | +and `NN` are 2D arrays of appropriate dimension. If `sys` is a |
| 181 | +discrete time system, the first two forms will compute the discrete |
| 182 | +time optimal controller. For the second two forms, the :func:`dlqr` |
| 183 | +function can be used. Additional arguments and details are given on |
| 184 | +the :func:`lqr` and :func:`dlqr` documentation pages. |
0 commit comments