Skip to content

Commit 76346d8

Browse files
committed
state space systems section content
1 parent ec89ffb commit 76346d8

6 files changed

Lines changed: 191 additions & 48 deletions

File tree

control/iosys.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,11 @@ def _generic_name_check(self):
243243
#: :meta hide-value:
244244
nstates = None
245245

246+
#: System timebase.
247+
#:
248+
#: :meta hide-value:
249+
dt = None
250+
246251
#
247252
# System representation
248253
#
@@ -256,7 +261,7 @@ def __str__(self):
256261
out += f"\nStates ({self.nstates}): {self.state_labels}"
257262
out += self._dt_repr(separator="\n", space=" ")
258263
return out
259-
264+
260265
def __repr__(self):
261266
return iosys_repr(self, format=self.repr_format)
262267

control/modelsimp.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
# Author: Steve Brunton, Kevin Chen, Lauren Padilla
44
# Date: 30 Nov 2010
55
#
6-
# This file contains routines for obtaining reduced order models
7-
#
6+
"""This :mod:`modelsimp` modules contains routines for obtaining
7+
reduced order models for state space systems.
8+
9+
"""
810

911
import warnings
1012

control/passivity.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
# passivity.py
2+
#
3+
# Author: Mark Yeatman
4+
#Date: July 17, 2022
5+
16
"""
27
Functions for passive control.
38
4-
Author: Mark Yeatman
5-
Date: July 17, 2022
69
"""
710

811
import numpy as np

control/statefbk.py

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,10 @@
33
# Author: Richard M. Murray, Roberto Bucher
44
# Date: 31 May 2010
55
#
6-
# This file contains routines for designing state space controllers
7-
#
8-
# Copyright (c) 2010 by California Institute of Technology
9-
# All rights reserved.
10-
#
11-
# Redistribution and use in source and binary forms, with or without
12-
# modification, are permitted provided that the following conditions
13-
# are met:
14-
#
15-
# 1. Redistributions of source code must retain the above copyright
16-
# notice, this list of conditions and the following disclaimer.
17-
#
18-
# 2. Redistributions in binary form must reproduce the above copyright
19-
# notice, this list of conditions and the following disclaimer in the
20-
# documentation and/or other materials provided with the distribution.
21-
#
22-
# 3. Neither the name of the California Institute of Technology nor
23-
# the names of its contributors may be used to endorse or promote
24-
# products derived from this software without specific prior
25-
# written permission.
26-
#
27-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28-
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29-
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
30-
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CALTECH
31-
# OR THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32-
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33-
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
34-
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
35-
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36-
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
37-
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38-
# SUCH DAMAGE.
39-
#
40-
# $Id$
6+
"""The statefbk module contains routines for designing state space
7+
controllers.
8+
9+
"""
4110

4211
import warnings
4312

doc/response.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ and styles for various signals and traces::
162162

163163
.. image:: figures/timeplot-mimo_step-linestyle.png
164164

165+
166+
.. _frequency_response:
167+
165168
Frequency response data
166169
=======================
167170

doc/statesp.rst

Lines changed: 169 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,182 @@
33
State space analysis and design
44
===============================
55

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+
614
State space properties
715
----------------------
816

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+
960
State feedback design
1061
---------------------
1162

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.
14114

15115
State estimation
16116
----------------
17117

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

Comments
 (0)