Skip to content

Commit 574cf69

Browse files
committed
small tweaks to comments, docstrings, unit tests
1 parent 2fcc287 commit 574cf69

File tree

3 files changed

+22
-18
lines changed

3 files changed

+22
-18
lines changed

control/iosys.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2727,12 +2727,16 @@ def interconnect(
27272727
System name (used for specifying signals). If unspecified, a generic
27282728
name <sys[id]> is generated with a unique integer id.
27292729
2730-
check_unused : bool
2730+
check_unused : bool, optional
27312731
If True, check for unused sub-system signals. This check is
27322732
not done if connections is False, and neither input nor output
27332733
mappings are specified.
27342734
2735-
ignore_inputs : list of input-spec
2735+
add_unused : bool, optional
2736+
If True, subsystem signals that are not connected to other components
2737+
are added as inputs and outputs of the interconnected system.
2738+
2739+
ignore_inputs : list of input-spec, optional
27362740
A list of sub-system inputs known not to be connected. This is
27372741
*only* used in checking for unused signals, and does not
27382742
disable use of the input.
@@ -2742,7 +2746,7 @@ def interconnect(
27422746
signals from all sub-systems with that base name are
27432747
considered ignored.
27442748
2745-
ignore_outputs : list of output-spec
2749+
ignore_outputs : list of output-spec, optional
27462750
A list of sub-system outputs known not to be connected. This
27472751
is *only* used in checking for unused signals, and does not
27482752
disable use of the output.
@@ -2752,7 +2756,7 @@ def interconnect(
27522756
outputs from all sub-systems with that base name are
27532757
considered ignored.
27542758
2755-
warn_duplicate : None, True, or False
2759+
warn_duplicate : None, True, or False, optional
27562760
Control how warnings are generated if duplicate objects or names are
27572761
detected. In `None` (default), then warnings are generated for
27582762
systems that have non-generic names. If `False`, warnings are not

control/optimal.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ class OptimalControlProblem():
104104
105105
Notes
106106
-----
107-
To describe an optimal control problem we need an input/output system, a
108-
time horizon, a cost function, and (optionally) a set of constraints on
109-
the state and/or input, either along the trajectory and at the terminal
110-
time. This class sets up an optimization over the inputs at each point in
111-
time, using the integral and terminal costs as well as the trajectory and
112-
terminal constraints. The `compute_trajectory` method sets up an
113-
optimization problem that can be solved using
114-
:func:`scipy.optimize.minimize`.
107+
To describe an optimal control problem we need an input/output system,
108+
a set of time points over a a fixed horizon, a cost function, and
109+
(optionally) a set of constraints on the state and/or input, either
110+
along the trajectory and at the terminal time. This class sets up an
111+
optimization over the inputs at each point in time, using the integral
112+
and terminal costs as well as the trajectory and terminal constraints.
113+
The `compute_trajectory` method sets up an optimization problem that
114+
can be solved using :func:`scipy.optimize.minimize`.
115115
116116
The `_cost_function` method takes the information computes the cost of the
117117
trajectory generated by the proposed input. It does this by calling a

control/tests/statefbk_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ def test_lqr_discrete(self):
512512
K, S, E = ct.dlqr(csys, Q, R)
513513

514514
@pytest.mark.parametrize(
515-
'nstates, noutputs, ninputs, nintegrators, type',
515+
'nstates, noutputs, ninputs, nintegrators, type_',
516516
[(2, 0, 1, 0, None),
517517
(2, 1, 1, 0, None),
518518
(4, 0, 2, 0, None),
@@ -525,7 +525,7 @@ def test_lqr_discrete(self):
525525
(4, 3, 2, 2, 'nonlinear'),
526526
])
527527
def test_statefbk_iosys(
528-
self, nstates, ninputs, noutputs, nintegrators, type):
528+
self, nstates, ninputs, noutputs, nintegrators, type_):
529529
# Create the system to be controlled (and estimator)
530530
# TODO: make sure it is controllable?
531531
if noutputs == 0:
@@ -571,14 +571,14 @@ def test_statefbk_iosys(
571571
# Create an I/O system for the controller
572572
ctrl, clsys = ct.create_statefbk_iosystem(
573573
sys, K, integral_action=C_int, estimator=est,
574-
controller_type=type, name=type)
574+
controller_type=type_, name=type_)
575575

576576
# Make sure the name got set correctly
577-
if type is not None:
578-
assert ctrl.name == type
577+
if type_ is not None:
578+
assert ctrl.name == type_
579579

580580
# If we used a nonlinear controller, linearize it for testing
581-
if type == 'nonlinear':
581+
if type_ == 'nonlinear':
582582
clsys = clsys.linearize(0, 0)
583583

584584
# Make sure the linear system elements are correct

0 commit comments

Comments
 (0)