8000 Merge pull request #905 from murrayrm/simdocs-04Jun2023 · python-control/python-control@d834f7a · GitHub
[go: up one dir, main page]

Skip to content

Commit d834f7a

Browse files
authored
Merge pull request #905 from murrayrm/simdocs-04Jun2023
add/cleanup documentation on simulation functions
2 parents 3435304 + f0a34df commit d834f7a

File tree

7 files changed

+62
-15
lines changed

7 files changed

+62
-15
lines changed

control/__init__.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,15 @@
5454
5555
Available subpackages
5656
---------------------
57-
flatsys
58-
Differentially flat systems
59-
optimal
60-
Optimization-based control
57+
58+
The main control package includes the most commpon functions used in
59+
analysis, design, and simulation of feedback control systems. Several
60+
additional subpackages are available that provide more specialized
61+
functionality:
62+
63+
* :mod:`~control.flatsys`: Differentially flat systems
64+
* :mod:`~control.matlab`: MATLAB compatibility module
65+
* :mod:`~control.optimal`: Optimization-based control
6166
6267
"""
6368

control/flatsys/systraj.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
from ..timeresp import TimeResponseData
4141

4242
class SystemTrajectory:
43-
"""Class representing a system trajectory.
43+
"""Class representing a trajectory for a flat system.
4444
4545
The `SystemTrajectory` class is used to represent the
4646
trajectory of a (differentially flat) system. Used by the

control/iosys.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,6 +1699,15 @@ def input_output_response(
16991699
start with zero initial condition since this can be specified as
17001700
[xsys_0, 0]. A warning is issued if the initial conditions are padded
17011701
and and the final listed initial state is not zero.
1702+
1703+
2. If discontinuous inputs are given, the underlying SciPy numerical
1704+
integration algorithms can sometimes produce erroneous results due
1705+
to the default tolerances that are used. The `ivp_method` and
1706+
`ivp_keywords` parameters can be used to tune the ODE solver and
1707+
produce better results. In particular, using 'LSODA' as the
1708+
`ivp_method` or setting the `rtol` parameter to a smaller value
1709+
(e.g. using `ivp_kwargs={'rtol': 1e-4}`) can provide more accurate
1710+
results.
17021711
17031712
"""
17041713
#

control/optimal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# RMM, 11 Feb 2021
44
#
55

6-
"""The :mod:`~control.optimal` module provides support for optimization-based
6+
"""The :mod:`control.optimal` module provides support for optimization-based
77
controllers for nonlinear systems with state and input constraints.
88
99
The docstring examples assume that the following import commands::

control/timeresp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ def shape_matches(s_legal, s_actual):
820820
# Forced response of a linear system
821821
def forced_response(sys, T=None, U=0., X0=0., transpose=False,
822822
interpolate=False, return_x=None, squeeze=None):
823-
"""Simulate the output of a linear system.
823+
"""Compute the output of a linear system given the input.
824824
825825
As a convenience for parameters `U`, `X0`:
826826
Numbers (scalars) are converted to constant arrays with the correct shape.
@@ -1616,7 +1616,7 @@ def step_info(sysdata, T=None, T_num=None, yfinal=None,
16161616
def initial_response(sys, T=None, X0=0., input=0, output=None, T_num=None,
16171617
transpose=False, return_x=False, squeeze=None):
16181618
# pylint: disable=W0622
1619-
"""Initial condition response of a linear system
1619+
"""Compute the initial condition response for a linear system.
16201620
16211621
If the system has multiple outputs (MIMO), optionally, one output
16221622
may be selected. If no selection is made for the output, all

doc/classes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,8 @@ Additional classes
5858
flatsys.SystemTrajectory
5959
optimal.OptimalControlProblem
6060
optimal.OptimalControlResult
61+
optimal.OptimalEstimationProblem
62+
optimal.OptimalEstimationResult
63+
64+
The use of these classes is described in more detail in the
65+
:ref:`flatsys-module` module and the :ref:`optimal-module` module

doc/conventions.rst

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ way that different types of standard information used by the library.
1111
Throughout this manual, we assume the `control` package has been
1212
imported as `ct`.
1313

14-
1514
LTI system representation
1615
=========================
1716

@@ -132,11 +131,40 @@ constructor for the desired data type using the original system as the sole
132131
argument or using the explicit conversion functions :func:`ss2tf` and
133132
:func:`tf2ss`.
134133

134+
Simulating LTI systems
135+
======================
136+
137+
A number of functions are available for computing the output (and
138+
state) response of an LTI systems:
139+
140+
.. autosummary::
141+
:toctree: generated/
142+
:template: custom-class-template.rst
143+
144+
initial_response
145+
step_response
146+
impulse_response
147+
forced_response
148+
149+
Each of these functions returns a :class:`TimeResponseData` object
150+
that contains the data for the time response (described in more detail
151+
in the next section).
152+
153+
The :func:`forced_response` system is the most general and allows by
154+
the zero initial state response to be simulated as well as the
155+
response from a non-zero intial condition.
156+
157+
In addition the :func:`input_output_response` function, which handles
158+
simulation of nonlinear systems and interconnected systems, can be
159+
used. For an LTI system, results are generally more accurate using
160+
the LTI simulation functions above. The :func:`input_output_response`
161+
function is described in more detail in the :ref:`iosys-module` section.
162+
135163
.. currentmodule:: control
136164
.. _time-series-convention:
137165

138166
Time series data
139-
================
167+
----------------
140168
A variety of functions in the library return time series data: sequences of
141169
values that change over time. A common set of conventions is used for
142170
returning such data: columns represent different points in time, rows are
@@ -262,16 +290,16 @@ Selected variables that can be configured, along with their default values:
262290

263291
* freqplot.dB (False): Bode plot magnitude plotted in dB (otherwise powers
264292
of 10)
265-
293+
266294
* freqplot.deg (True): Bode plot phase plotted in degrees (otherwise radians)
267-
295+
268296
* freqplot.Hz (False): Bode plot frequency plotted in Hertz (otherwise
269297
rad/sec)
270-
298+
271299
* freqplot.grid (True): Include grids for magnitude and phase plots
272-
300+
273301
* freqplot.number_of_samples (1000): Number of frequency points in Bode plots
274-
302+
275303
* freqplot.feature_periphery_decade (1.0): How many decades to include in
276304
the frequency range on both sides of features (poles, zeros).
277305

0 commit comments

Comments
 (0)
0