Skip to content

Commit e6fdc17

Browse files
committed
updated per @slivingston review comments
1 parent 47e1c09 commit e6fdc17

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

control/nlsys.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class NonlinearIOSystem(InputOutputSystem):
9393
generic name <sys[id]> is generated with a unique integer id.
9494
9595
params : dict, optional
96-
Parameter values for the system. Passed to the evaluation functions
96+
Parameter values for the system. Passed to the evaluation functions
9797
for the system as default values, overriding internal defaults.
9898
9999
See Also
@@ -1671,7 +1671,7 @@ def ivp_rhs(t, x):
16711671
success=soln.success, message=message)
16721672

16731673

1674-
class OperatingPoint(object):
1674+
class OperatingPoint():
16751675
"""A class for representing the operating point of a nonlinear I/O system.
16761676
16771677
The ``OperatingPoint`` class stores the operating point of a nonlinear
@@ -1693,18 +1693,18 @@ class OperatingPoint(object):
16931693
16941694
"""
16951695
def __init__(
1696-
self, states, inputs=None, outputs=None, result=None,
1696+
self, states, inputs, outputs=None, result=None,
16971697
return_outputs=False, return_result=False):
16981698
self.states = states
16991699
self.inputs = inputs
17001700

17011701
if outputs is None and return_outputs and not return_result:
1702-
raise SystemError("return_outputs specified by no y0 value")
1702+
raise ValueError("return_outputs specified but no outputs value")
17031703
self.outputs = outputs
17041704
self.return_outputs = return_outputs
17051705

17061706
if result is None and return_result:
1707-
raise SystemError("return_result specified by no result value")
1707+
raise ValueError("return_result specified but no result value")
17081708
self.result = result
17091709
self.return_result = return_result
17101710

@@ -1799,7 +1799,7 @@ def find_operating_point(
17991799
values will be ignored in solving for an operating point. State
18001800
indices can be listed in any order. By default, all updates will be
18011801
fixed at `dx0` in searching for an operating point.
1802-
root_method : str, optonal
1802+
root_method : str, optional
18031803
Method to find the operating point. If specified, this parameter
18041804
is passed to the :func:`scipy.optimize.root` function.
18051805
root_kwargs : dict, optional

control/tests/iosys_test.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -2089,7 +2089,6 @@ def test_find_eqpt(x0, ix, u0, iu, y0, iy, dx0, idx, dt, x_expect, u_expect):
20892089

20902090

20912091
# Test out new operating point version of find_eqpt
2092-
# TODO: add return_)y tests
20932092
def test_find_operating_point():
20942093
dt = 1
20952094
sys = ct.NonlinearIOSystem(
@@ -2148,7 +2147,7 @@ def test_operating_point():
21482147
np.testing.assert_allclose(linsys_orig.C, linsys_oppt.C)
21492148
np.testing.assert_allclose(linsys_orig.D, linsys_oppt.D)
21502149

2151-
# Call find_operating point with method and keyword arguments
2150+
# Call find_operating_point with method and keyword arguments
21522151
op_point = ct.find_operating_point(
21532152
sys, 0, 0, root_method='lm', root_kwargs={'tol': 1e-6})
21542153

examples/cruise-control.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def cruise_plot(sys, t, y, label=None, t_hill=None, vref=20, antiwindup=False,
349349
# and u given the gear, slope, and desired output velocity)
350350
X0, U0, Y0 = ct.find_operating_point(
351351
cruise_pi, [vref[0], 0], [vref[0], gear[0], theta0[0]],
352-
y0=[0, vref[0]], iu=[1, 2], iy=[1], return_y=True)
352+
y0=[0, vref[0]], iu=[1, 2], iy=[1], return_outputs=True)
353353

354354
# Now simulate the effect of a hill at t = 5 seconds
355355
plt.figure()

examples/cruise.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@
804804
"# Compute the equilibrium throttle setting for the desired speed\n",
805805
"X0, U0, Y0 = ct.find_eqpt(\n",
806806
" cruise_pi, [vref[0], 0], [vref[0], gear[0], theta0[0]],\n",
807-
" y0=[0, vref[0]], iu=[1, 2], iy=[1], return_y=True)\n",
807+
" y0=[0, vref[0]], iu=[1, 2], iy=[1], return_outputs=True)\n",
808808
"\n",
809809
"# Now simulate the effect of a hill at t = 5 seconds\n",
810810
"plt.figure()\n",

0 commit comments

Comments
 (0)