Skip to content

Commit 34f39dc

Browse files
committed
reformat numbered notes sections
1 parent b742bd2 commit 34f39dc

9 files changed

Lines changed: 107 additions & 109 deletions

File tree

control/flatsys/flatsys.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,17 @@ class FlatSystem(NonlinearIOSystem):
5858
-----
5959
The class must implement two functions:
6060
61-
zflag = flatsys.foward(x, u, params)
61+
``zflag = flatsys.foward(x, u, params)``
62+
6263
This function computes the flag (derivatives) of the flat output.
6364
The inputs to this function are the state 'x' and inputs 'u' (both
6465
1D arrays). The output should be a 2D array with the first
6566
dimension equal to the number of system inputs and the second
6667
dimension of the length required to represent the full system
6768
dynamics (typically the number of states)
6869
69-
x, u = flatsys.reverse(zflag, params)
70+
``x, u = flatsys.reverse(zflag, params)``
71+
7072
This function system state and inputs give the the flag (derivatives)
7173
of the flat output. The input to this function is an 2D array whose
7274
first dimension is equal to the number of system inputs and whose
@@ -737,19 +739,20 @@ def solve_flat_ocp(
737739
738740
Notes
739741
-----
740-
1. Additional keyword parameters can be used to fine tune the behavior
741-
of the underlying optimization function. See `minimize_*` keywords
742-
in `optimal.OptimalControlProblem` for more information.
743-
744-
2. The return data structure includes the following additional attributes:
745-
* success : bool indicating whether the optimization succeeded
746-
* cost : computed cost of the returned trajectory
747-
* message : message returned by optimization if success if False
748-
749-
3. A common failure in solving optimal control problem is that the
750-
default initial guess violates the constraints and the optimizer
751-
can't find a feasible solution. Using the `initial_guess` parameter
752-
can often be used to overcome these errors.
742+
Additional keyword parameters can be used to fine tune the behavior of
743+
the underlying optimization function. See `minimize_*` keywords in
744+
`optimal.OptimalControlProblem` for more information.
745+
746+
The return data structure includes the following additional attributes:
747+
748+
* success : bool indicating whether the optimization succeeded
749+
* cost : computed cost of the returned trajectory
750+
* message : message returned by optimization if success if False
751+
752+
A common failure in solving optimal control problem is that the default
753+
initial guess violates the constraints and the optimizer can't find a
754+
feasible solution. Using the `initial_guess` parameter can often be
755+
used to overcome these errors.
753756
754757
"""
755758
#

control/lti.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -316,19 +316,20 @@ def damp(sys, doprint=True):
316316
317317
Notes
318318
-----
319-
If the system is continuous,
320-
wn = abs(poles)
321-
zeta = -real(poles)/poles
319+
If the system is continuous
320+
321+
| ``wn = abs(poles)``
322+
| ``zeta = -real(poles)/poles``
322323
323324
If the system is discrete, the discrete poles are mapped to their
324325
equivalent location in the s-plane via
325326
326-
s = log(poles)/dt
327+
| ``s = log(poles)/dt``
327328
328329
and
329330
330-
wn = abs(s)
331-
zeta = -real(s)/wn.
331+
| ``wn = abs(s)``
332+
| ``zeta = -real(s)/wn``
332333
333334
Examples
334335
--------
@@ -477,20 +478,19 @@ def frequency_response(
477478
478479
Notes
479480
-----
480-
1. This function is a wrapper for `StateSpace.frequency_response`
481-
and `TransferFunction.frequency_response`.
482-
483-
2. You can also use the lower-level methods ``sys(s)`` or ``sys(z)`` to
484-
generate the frequency response for a single system.
485-
486-
3. All frequency data should be given in rad/sec. If frequency limits
487-
are computed automatically, the `Hz` keyword can be used to ensure
488-
that limits are in factors of decades in Hz, so that Bode plots with
489-
``Hz=True`` look better.
490-
491-
4. The frequency response data can be plotted by calling the
492-
`bode_plot` function or using the `plot` method of
493-
the `FrequencyResponseData` class.
481+
This function is a wrapper for `StateSpace.frequency_response` and
482+
`TransferFunction.frequency_response`. You can also use the
483+
lower-level methods ``sys(s)`` or ``sys(z)`` to generate the frequency
484+
response for a single system.
485+
486+
All frequency data should be given in rad/sec. If frequency limits are
487+
computed automatically, the `Hz` keyword can be used to ensure that
488+
limits are in factors of decades in Hz, so that Bode plots with
489+
``Hz=True`` look better.
490+
491+
The frequency response data can be plotted by calling the `bode_plot`
492+
function or using the `plot` method of the `FrequencyResponseData`
493+
class.
494494
495495
Examples
496496
--------

control/nlsys.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,22 +1537,22 @@ def input_output_response(
15371537
15381538
Notes
15391539
-----
1540-
1. If a smaller number of initial conditions are given than the number of
1541-
states in the system, the initial conditions will be padded with
1542-
zeros. This is often useful for interconnected control systems where
1543-
the process dynamics are the first system and all other components
1544-
start with zero initial condition since this can be specified as
1545-
[xsys_0, 0]. A warning is issued if the initial conditions are padded
1546-
and and the final listed initial state is not zero.
1547-
1548-
2. If discontinuous inputs are given, the underlying SciPy numerical
1549-
integration algorithms can sometimes produce erroneous results due
1550-
to the default tolerances that are used. The `ivp_method` and
1551-
`ivp_keywords` parameters can be used to tune the ODE solver and
1552-
produce better results. In particular, using 'LSODA' as the
1553-
`ivp_method` or setting the `rtol` parameter to a smaller value
1554-
(e.g. using ``ivp_kwargs={'rtol': 1e-4}``) can provide more accurate
1555-
results.
1540+
If a smaller number of initial conditions are given than the number of
1541+
states in the system, the initial conditions will be padded with zeros.
1542+
This is often useful for interconnected control systems where the
1543+
process dynamics are the first system and all other components start
1544+
with zero initial condition since this can be specified as [xsys_0, 0].
1545+
A warning is issued if the initial conditions are padded and and the
1546+
final listed initial state is not zero.
1547+
1548+
If discontinuous inputs are given, the underlying SciPy numerical
1549+
integration algorithms can sometimes produce erroneous results due to
1550+
the default tolerances that are used. The `ivp_method` and
1551+
`ivp_keywords` parameters can be used to tune the ODE solver and
1552+
produce better results. In particular, using 'LSODA' as the
1553+
`ivp_method` or setting the `rtol` parameter to a smaller value
1554+
(e.g. using ``ivp_kwargs={'rtol': 1e-4}``) can provide more accurate
1555+
results.
15561556
15571557
"""
15581558
#

control/optimal.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,19 +1109,19 @@ def solve_ocp(
11091109
11101110
Notes
11111111
-----
1112-
1. For discrete time systems, the final value of the timepts vector
1113-
specifies the final time t_N, and the trajectory cost is computed
1114-
from time t_0 to t_{N-1}. Note that the input u_N does not affect
1115-
the state x_N and so it should always be returned as 0. Further, if
1116-
neither a terminal cost nor a terminal constraint is given, then the
1117-
input at time point t_{N-1} does not affect the cost function and
1118-
hence u_{N-1} will also be returned as zero. If you want the
1119-
trajectory cost to include state costs at time t_{N}, then you can
1120-
set `terminal_cost` to be the same function as `cost`.
1121-
1122-
2. Additional keyword parameters can be used to fine-tune the behavior
1123-
of the underlying optimization and integration functions. See
1124-
`OptimalControlProblem` for more information.
1112+
For discrete time systems, the final value of the timepts vector
1113+
specifies the final time t_N, and the trajectory cost is computed from
1114+
time t_0 to t_{N-1}. Note that the input u_N does not affect the state
1115+
x_N and so it should always be returned as 0. Further, if neither a
1116+
terminal cost nor a terminal constraint is given, then the input at
1117+
time point t_{N-1} does not affect the cost function and hence u_{N-1}
1118+
will also be returned as zero. If you want the trajectory cost to
1119+
include state costs at time t_{N}, then you can set `terminal_cost` to
1120+
be the same function as `cost`.
1121+
1122+
Additional keyword parameters can be used to fine-tune the behavior of
1123+
the underlying optimization and integration functions. See
1124+
`OptimalControlProblem` for more information.
11251125
11261126
"""
11271127
# Process keyword arguments

control/statefbk.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,13 @@ def place(A, B, p):
6565
6666
Notes
6767
-----
68-
Algorithm
69-
This is a wrapper function for `scipy.signal.place_poles`, which
70-
implements the Tits and Yang algorithm [1]_. It will handle SISO,
71-
MISO, and MIMO systems. If you want more control over the algorithm,
72-
use `scipy.signal.place_poles` directly.
73-
74-
Limitations
75-
The algorithm will not place poles at the same location more
76-
than rank(B) times.
68+
This is a wrapper function for `scipy.signal.place_poles`, which
69+
implements the Tits and Yang algorithm [1]_. It will handle SISO, MISO,
70+
and MIMO systems. If you want more control over the algorithm, use
71+
`scipy.signal.place_poles` directly.
72+
73+
Limitations: The algorithm will not place poles at the same location
74+
more than rank(B) times.
7775
7876
References
7977
----------

control/statesp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,7 @@ def sample(self, Ts, method='zoh', alpha=None, prewarp_frequency=None,
13251325
13261326
Notes
13271327
-----
1328-
Uses `scipy.signal.cont2discrete`
1328+
Uses `scipy.signal.cont2discrete`.
13291329
13301330
Examples
13311331
--------

control/timeplot.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -159,22 +159,21 @@ def time_response_plot(
159159
160160
Notes
161161
-----
162-
1. A new figure will be generated if there is no current figure or
163-
the current figure has an incompatible number of axes. To
164-
force the creation of a new figures, use `plt.figure`. To reuse
165-
a portion of an existing figure, use the ``ax`` keyword.
166-
167-
2. The line properties (color, linestyle, etc) can be set for the
168-
entire plot using the `fmt` and/or `kwargs` parameter, which
169-
are passed on to `matplotlib`. When combining signals or
170-
traces, the `input_props`, `output_props`, and `trace_props`
171-
parameters can be used to pass a list of dictionaries
172-
containing the line properties to use. These input/output
173-
properties are combined with the trace properties and finally
174-
the kwarg properties to determine the final line properties.
175-
176-
3. The default plot properties, such as font sizes, can be set using
177-
`config.defaults[''timeplot.rcParams']`.
162+
A new figure will be generated if there is no current figure or the
163+
current figure has an incompatible number of axes. To force the
164+
creation of a new figures, use `plt.figure`. To reuse a portion of an
165+
existing figure, use the ``ax`` keyword.
166+
167+
The line properties (color, linestyle, etc) can be set for the entire
168+
plot using the `fmt` and/or `kwargs` parameter, which are passed on to
169+
`matplotlib`. When combining signals or traces, the `input_props`,
170+
`output_props`, and `trace_props` parameters can be used to pass a list
171+
of dictionaries containing the line properties to use. These
172+
input/output properties are combined with the trace properties and
173+
finally the kwarg properties to determine the final line properties.
174+
175+
The default plot properties, such as font sizes, can be set using
176+
`config.defaults[''timeplot.rcParams']`.
178177
179178
"""
180179
from .ctrlplot import _process_ax_keyword, _process_line_labels

control/timeresp.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -997,22 +997,22 @@ def forced_response(sysdata, T=None, U=0., X0=0., transpose=False, params=None,
997997
998998
Notes
999999
-----
1000-
1. For discrete time systems, the input/output response is computed
1001-
using the `scipy.signal.dlsim` function.
1002-
1003-
2. For continuous time systems, the output is computed using the matrix
1004-
exponential ``exp(A t)`` and assuming linear interpolation of the
1005-
inputs between time points.
1006-
1007-
3. If a nonlinear I/O system is passed to `forced_response`, the
1008-
`input_output_response` function is called instead. The main
1009-
difference between `input_output_response` and `forced_response` is
1010-
that `forced_response` is specialized (and optimized) for linear
1011-
systems.
1012-
1013-
4. (legacy) The return value of the system can also be accessed by
1014-
assigning the function to a tuple of length 2 (time, output) or of
1015-
length 3 (time, output, state) if `return_x` is True.
1000+
For discrete time systems, the input/output response is computed
1001+
using the `scipy.signal.dlsim` function.
1002+
1003+
For continuous time systems, the output is computed using the
1004+
matrix exponential ``exp(A t)`` and assuming linear interpolation
1005+
of the inputs between time points.
1006+
1007+
If a nonlinear I/O system is passed to `forced_response`, the
1008+
`input_output_response` function is called instead. The main
1009+
difference between `input_output_response` and `forced_response`
1010+
is that `forced_response` is specialized (and optimized) for
1011+
linear systems.
1012+
1013+
(legacy) The return value of the system can also be accessed by
1014+
assigning the function to a tuple of length 2 (time, output) or of
1015+
length 3 (time, output, state) if `return_x` is True.
10161016
10171017
Examples
10181018
--------

control/xferfcn.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,9 +1210,7 @@ def sample(self, Ts, method='zoh', alpha=None, prewarp_frequency=None,
12101210
12111211
Notes
12121212
-----
1213-
1. Available only for SISO systems
1214-
1215-
2. Uses `scipy.signal.cont2discrete`
1213+
Available only for SISO systems. Uses `scipy.signal.cont2discrete`.
12161214
12171215
Examples
12181216
--------

0 commit comments

Comments
 (0)