Skip to content

Commit 3a554b5

Browse files
committed
docstring fixes: standardize description for lyap and care to be consistent with other functions, fix formatting in a few other functions. add references to NonlinearIOSystem and __call__ and remove evalfr
1 parent 8c764d0 commit 3a554b5

6 files changed

Lines changed: 36 additions & 34 deletions

File tree

control/dtime.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,6 @@ def sample_system(sysc, Ts, method='zoh', alpha=None, prewarp_frequency=None,
8484
copy_names : bool, Optional
8585
If True, copy the names of the input signals, output
8686
signals, and states to the sampled system.
87-
88-
Returns
89-
-------
90-
sysd : linsys
91-
Discrete time system, with sampling rate Ts
92-
93-
Additional Parameters
94-
---------------------
9587
inputs : int, list of str or None, optional
9688
Description of the system inputs. If not specified, the origional
9789
system inputs are used. See :class:`NamedIOSystem` for more
@@ -102,6 +94,11 @@ def sample_system(sysc, Ts, method='zoh', alpha=None, prewarp_frequency=None,
10294
Description of the system states. Same format as `inputs`. Only
10395
available if the system is :class:`StateSpace`.
10496
97+
Returns
98+
-------
99+
sysd : linsys
100+
Discrete time system, with sampling rate Ts
101+
105102
Notes
106103
-----
107104
See :meth:`StateSpace.sample` or :meth:`TransferFunction.sample` for

control/iosys.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2203,15 +2203,6 @@ def linearize(sys, xeq, ueq=None, t=0, params=None, **kw):
22032203
copy_names : bool, Optional
22042204
If True, Copy the names of the input signals, output signals, and
22052205
states to the linearized system.
2206-
2207-
Returns
2208-
-------
2209-
ss_sys : LinearIOSystem
2210-
The linearization of the system, as a :class:`~control.LinearIOSystem`
2211-
object (which is also a :class:`~control.StateSpace` object.
2212-
2213-
Additional Parameters
2214-
---------------------
22152206
inputs : int, list of str or None, optional
22162207
Description of the system inputs. If not specified, the origional
22172208
system inputs are used. See :class:`NamedIOSystem` for more
@@ -2221,6 +2212,12 @@ def linearize(sys, xeq, ueq=None, t=0, params=None, **kw):
22212212
states : int, list of str, or None, optional
22222213
Description of the system states. Same format as `inputs`.
22232214
2215+
Returns
2216+
-------
2217+
ss_sys : LinearIOSystem
2218+
The linearization of the system, as a :class:`~control.LinearIOSystem`
2219+
object (which is also a :class:`~control.StateSpace` object.
2220+
22242221
"""
22252222
if not isinstance(sys, InputOutputSystem):
22262223
raise TypeError("Can only linearize InputOutputSystem types")
@@ -2716,8 +2713,8 @@ def interconnect(syslist, connections=None, inplist=None, outlist=None,
27162713
:func:`~control.summing_block` function and the ability to automatically
27172714
interconnect signals with the same names:
27182715
2719-
>>> P = control.tf2io(control.tf(1, [1, 0]), inputs='u', outputs='y')
2720-
>>> C = control.tf2io(control.tf(10, [1, 1]), inputs='e', outputs='u')
2716+
>>> P = control.tf(1, [1, 0], inputs='u', outputs='y')
2717+
>>> C = control.tf(10, [1, 1], inputs='e', outputs='u')
27212718
>>> sumblk = control.summing_junction(inputs=['r', '-y'], output='e')
27222719
>>> T = control.interconnect([P, C, sumblk], inputs='r', outputs='y')
27232720

control/mateqn.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ def sb03md(n, C, A, U, dico, job='X', fact='N', trana='N', ldwork=None):
8888

8989

9090
def lyap(A, Q, C=None, E=None, method=None):
91-
"""X = lyap(A, Q) solves the continuous-time Lyapunov equation
91+
"""Solves the continuous-time Lyapunov equation
92+
93+
X = lyap(A, Q) solves
9294
9395
:math:`A X + X A^T + Q = 0`
9496
@@ -217,7 +219,9 @@ def lyap(A, Q, C=None, E=None, method=None):
217219

218220

219221
def dlyap(A, Q, C=None, E=None, method=None):
220-
"""dlyap(A, Q) solves the discrete-time Lyapunov equation
222+
"""Solves the discrete-time Lyapunov equation
223+
224+
X = dlyap(A, Q) solves
221225
222226
:math:`A X A^T - X + Q = 0`
223227
@@ -348,8 +352,9 @@ def dlyap(A, Q, C=None, E=None, method=None):
348352

349353
def care(A, B, Q, R=None, S=None, E=None, stabilizing=True, method=None,
350354
A_s="A", B_s="B", Q_s="Q", R_s="R", S_s="S", E_s="E"):
351-
"""X, L, G = care(A, B, Q, R=None) solves the continuous-time
352-
algebraic Riccati equation
355+
"""Solves the continuous-time algebraic Riccati equation
356+
357+
X, L, G = care(A, B, Q, R=None) solves
353358
354359
:math:`A^T X + X A - X B R^{-1} B^T X + Q = 0`
355360
@@ -505,9 +510,11 @@ def care(A, B, Q, R=None, S=None, E=None, stabilizing=True, method=None,
505510

506511
def dare(A, B, Q, R, S=None, E=None, stabilizing=True, method=None,
507512
A_s="A", B_s="B", Q_s="Q", R_s="R", S_s="S", E_s="E"):
508-
"""X, L, G = dare(A, B, Q, R) solves the discrete-time algebraic Riccati
513+
"""Solves the discrete-time algebraic Riccati
509514
equation
510515
516+
X, L, G = dare(A, B, Q, R) solves
517+
511518
:math:`A^T X A - X - A^T X B (B^T X B + R)^{-1} B^T X A + Q = 0`
512519
513520
where A and Q are square matrices of the same dimension. Further, Q

control/sisotool.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,6 @@ def rootlocus_pid_designer(plant, gain='P', sign=+1, input_signal='r',
209209
210210
C_f = Kp + Ki/s + Kd*s/(tau*s + 1).
211211
212-
If `plant` is a discrete-time system, then the proportional, integral, and
213-
derivative terms are given instead by Kp, Ki*dt/2*(z+1)/(z-1), and
214-
Kd/dt*(z-1)/z, respectively.
215-
216212
::
217213
218214
------> C_ff ------ d
@@ -224,6 +220,10 @@ def rootlocus_pid_designer(plant, gain='P', sign=+1, input_signal='r',
224220
| ----- C_b <-------|
225221
---------------------------------
226222
223+
If `plant` is a discrete-time system, then the proportional, integral, and
224+
derivative terms are given instead by Kp, Ki*dt/2*(z+1)/(z-1), and
225+
Kd/dt*(z-1)/z, respectively.
226+
227227
It is also possible to move the derivative term into the feedback path
228228
`C_b` using `derivative_in_feedback_path=True`. This may be desired to
229229
avoid that the plant is subject to an impulse function when the reference

control/statesp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ def __rdiv__(self, other):
807807
"StateSpace.__rdiv__ is not implemented yet.")
808808

809809
def __call__(self, x, squeeze=None, warn_infinite=True):
810-
"""Evaluate system's transfer function at complex frequency.
810+
"""Evaluate system's frequency response at complex frequencies.
811811
812812
Returns the complex frequency response `sys(x)` where `x` is `s` for
813813
continuous-time systems and `z` for discrete-time systems.

doc/control.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ System creation
2020
frd
2121
rss
2222
drss
23+
NonlinearIOSystem
24+
2325

2426
System interconnections
2527
=======================
@@ -32,9 +34,8 @@ System interconnections
3234
negate
3335
parallel
3436
series
37+
interconnect
3538

36-
See also the :ref:`iosys-module` module, which can be used to create and
37-
interconnect nonlinear input/output systems.
3839

3940
Frequency domain plotting
4041
=========================
@@ -78,8 +79,9 @@ Control system analysis
7879

7980
dcgain
8081
describing_function
81-
evalfr
82-
freqresp
82+
frequency_response
83+
TransferFunction.__call__
84+
StateSpace.__call__
8385
get_input_ff_index
8486
get_output_fb_index
8587
ispassive
@@ -141,7 +143,6 @@ Nonlinear system support
141143

142144
describing_function
143145
find_eqpt
144-
interconnect
145146
linearize
146147
input_output_response
147148
ss2io

0 commit comments

Comments
 (0)