Skip to content

Commit eb70e96

Browse files
committed
update iosys.rst and associated doc files and docstrings
1 parent 01e8c3c commit eb70e96

5 files changed

Lines changed: 126 additions & 19 deletions

File tree

control/lti.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ def damp(self):
6161
zeta = -real(splane_poles)/wn
6262
return wn, zeta, poles
6363

64+
def feedback(self, other=1, sign=-1):
65+
"""Feedback interconnection between two LTI objects."""
66+
# Implemented in subclasses, but documented here
67+
return NotImplemented
68+
6469
def frequency_response(self, omega=None, squeeze=None):
6570
"""Evaluate LTI system response at an array of frequencies.
6671

doc/figures/bdalg-feedback.png

31.5 KB
Loading

doc/functions.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Function reference
1010
:no-inherited-members:
1111
:no-special-members:
1212

13+
1314
System creation
1415
===============
1516

@@ -243,6 +244,7 @@ Utility functions
243244
db2mag
244245
isctime
245246
isdtime
247+
iosys_repr
246248
issiso
247249
mag2db
248250
reset_defaults

doc/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,3 @@ Your contributions are welcome! Simply fork the `GitHub repository <https://git
9494
Please see the `Developer's Wiki`_ for detailed instructions.
9595

9696
.. _Developer's Wiki: https://github.com/python-control/python-control/wiki
97-

doc/iosys.rst

Lines changed: 119 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,139 @@
11
.. _iosys-module:
22

3+
.. currentmodule:: control
4+
35
**************************
46
Interconnected I/O Systems
57
**************************
68

9+
Input/output systems can be interconnected in a variety of ways,
10+
including operator overloading, block diagram algebra functions, and
11+
using the :func:`interconnect` function to build a hiearchical system
12+
description. This chapter provides more detailed information on
13+
operator overloading and block diagram algebra, as well as a
14+
description of the :class:`InterconnectedSystem` class, which can be
15+
created using the :func:`interconnect` function.
16+
717
Operator overloading
818
====================
919

20+
The following operators are defined to operate between I/O systems:
21+
22+
.. list-table::
23+
:header-rows: 1
24+
25+
* - Operation
26+
- Desription
27+
- Equivalent command
28+
* - `sys1 + sys2`
29+
- Add the outputs of two systems receiving the same input
30+
- `parallel(sys1, sys2)`
31+
* - `sys1 * sys2`
32+
- Connect output(s) of sys2 to input(s) of sys1
33+
- `series(sys2, sys1)`
34+
* - `-sys`
35+
- Multiply the output(s) of the system by -1
36+
- `negate(sys)`
37+
* - `tf1 / tf2`
38+
- Divide one SISO transfer function by another
39+
- N/A
40+
* - `tf**n`
41+
- Multiply a transfer function by itself `n` times
42+
- N/A
43+
44+
If either of the systems is a number or an array of appropriate
45+
dimension, then the appropriate scalar or matrix operation is
46+
performed.
47+
48+
Systems of different types can be combined using these operations,
49+
with the following rules:
50+
51+
* If the two systems can be converted into the type of the other, the
52+
leftmost system determines the type of the output.
53+
54+
* If one system can be converted into the other, then the more general
55+
system determines the type of the output. In particular:
56+
57+
- State space and transfer function systems can be converted to
58+
nonlinear systems.
59+
60+
- Linear systems can be converted to frequency response data (FRD)
61+
systems, using the frequencies of the FRD system.
62+
63+
- FRD systems can only be combined with FRD systems, constants,
64+
and arrays.
65+
1066

1167
Block diagram algebra
1268
=====================
1369

70+
Block diagram algebra is implemented using the following functions:
71+
72+
.. autosummary::
73+
74+
series
75+
parallel
76+
feedback
77+
negate
78+
append
79+
80+
The :func:`feedback` function implements a standard feedback
81+
interconnection between two systems, as illustrated in the following
82+
diagram:
83+
84+
.. image:: figures/bdalg-feedback.png
85+
:width: 240
86+
87+
By default a gain of -1 is applied at the output of the second system,
88+
so the dynamics illustrate above can be created using the command
89+
90+
.. code::
91+
92+
Gyu = ct.feedback(G1, G2)
93+
94+
An optional `gain` parameter can be used to change the sign of the gain.
95+
96+
For LTI systems, the :func:`feedback` operation is also implemented
97+
via the :func:`LTI.feedback` method, so if `G1` is an LTI system then
98+
the following command will also work::
99+
100+
Gyu = G1.feedback(G2)
101+
102+
All block diagram algebra functions allow the names of the system and
103+
signals to be specified using the usual `name`, `inputs`, and
104+
`outputs` keywords, as described in the :class:`InputOutputSystem`
105+
class. For state space systems, the names of the states can also be
106+
given, but caution should be used since the order of states in the
107+
combined system is not gauranteed.
108+
14109

15110
Signal-based interconnection
16111
============================
17112

18113
More complex input/output systems can be constructed by using the
19-
:func:`~control.interconnect` function, which allows a collection of
114+
:func:`interconnect` function, which allows a collection of
20115
input/output subsystems to be combined with internal connections
21116
between the subsystems and a set of overall system inputs and outputs
22-
that link to the subsystems::
117+
that link to the subsystems. For example, the closed loop dynamics of
118+
a feedback control system using the standard names and labels for
119+
inputs and outputs could be constructed using the command
120+
121+
.. code::
23122
24-
steering = ct.interconnect(
123+
clsys = ct.interconnect(
25124
[plant, controller], name='system',
26125
connections=[['controller.e', '-plant.y']],
27126
inplist=['controller.e'], inputs='r',
28127
outlist=['plant.y'], outputs='y')
29128
30-
Interconnected systems can also be created using block diagram manipulations
31-
such as the :func:`~control.series`, :func:`~control.parallel`, and
32-
:func:`~control.feedback` functions. The :class:`~control.InputOutputSystem`
33-
class also supports various algebraic operations such as `*` (series
34-
interconnection) and `+` (parallel interconnection).
129+
The remainder of this section provides a detailed description of the
130+
operation of the :func:`interconnect` function.
35131

36-
Example
37-
=======
38132

39-
To illustrate the use of the input/output systems module, we create a
133+
Illustrative example
134+
--------------------
135+
136+
To illustrate the use of the :func:`interconnect` function, we create a
40137
model for a predator/prey system, following the notation and parameter
41138
values in `Feedback Systems <http://fbsbook.org>`_.
42139

@@ -123,7 +220,7 @@ lynxes as the desired output (following `Feedback Systems
123220
To construct the control law, we build a simple input/output system that
124221
applies a corrective input based on deviations from the equilibrium point.
125222
This system has no dynamics, since it is a static (affine) map, and can
126-
constructed using :func:`~control.nlsys` with no update function:
223+
constructed using :func:`nlsys` with no update function:
127224

128225
.. code-block:: python
129226
@@ -169,21 +266,21 @@ Finally, we simulate the closed loop system:
169266
plt.legend(['input'])
170267
plt.show(block=False)
171268
172-
Additional features
173-
===================
269+
This example shows the standard operations that would be used to build
270+
up an interconnected nonlinear system. The I/O systems module has a
271+
number of other features that can be used to simplify the creation and
272+
use of interconnected input/output systems.
174273

175-
The I/O systems module has a number of other features that can be used to
176-
simplify the creation and use of interconnected input/output systems.
177274

178-
Vector elements processing
275+
Vector element processing
179276
--------------------------
180277

181278
Several I/O system commands perform processing of vector elements
182279
(such as initial states or input vectors) and broadcast these to the
183280
proper shape.
184281

185282
For static elements, such as the initial state in a simulation or the
186-
nominal state and input for a linearization), the following processing
283+
nominal state and input for a linearization, the following processing
187284
is done:
188285

189286
* Scalars are automatically converted to a vector of the appropriate
@@ -254,6 +351,7 @@ use the list processing feature combined with time series broadcasting::
254351
In this command, the second and third arguments will be broadcast to match
255352
the number of time points.
256353

354+
257355
Summing junction
258356
----------------
259357

@@ -290,6 +388,7 @@ the command
290388
will produce an input/output block that implements `e[0] = r[0] - y[0]` and
291389
`e[1] = r[1] - y[1]`.
292390

391+
293392
Automatic connections using signal names
294393
----------------------------------------
295394

@@ -317,6 +416,7 @@ of the interconnected system) is not found, but inputs and outputs of
317416
individual systems that are not connected to other systems are left
318417
unconnected (so be careful!).
319418

419+
320420
Advanced specification of signal names
321421
--------------------------------------
322422

@@ -430,6 +530,7 @@ complicated to debug error message when things go wrong. Setting
430530
information about how the arguments are processed that may be helpful
431531
in understanding what is going wrong.
432532

533+
433534
Automated creation of state feedback systems
434535
--------------------------------------------
435536

0 commit comments

Comments
 (0)