Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
updated per @slivingston review comments
  • Loading branch information
murrayrm committed Nov 11, 2024
commit e6fdc17258dee3c3c7df0f48ed9d3b6718c42fbb
12 changes: 6 additions & 6 deletions control/nlsys.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class NonlinearIOSystem(InputOutputSystem):
generic name <sys[id]> is generated with a unique integer id.

params : dict, optional
Parameter values for the system. Passed to the evaluation functions
Parameter values for the system. Passed to the evaluation functions
for the system as default values, overriding internal defaults.

See Also
Expand Down Expand Up @@ -1671,7 +1671,7 @@ def ivp_rhs(t, x):
success=soln.success, message=message)


class OperatingPoint(object):
class OperatingPoint():
"""A class for representing the operating point of a nonlinear I/O system.

The ``OperatingPoint`` class stores the operating point of a nonlinear
Expand All @@ -1693,18 +1693,18 @@ class OperatingPoint(object):

"""
def __init__(
self, states, inputs=None, outputs=None, result=None,
self, states, inputs, outputs=None, result=None,
return_outputs=False, return_result=False):
self.states = states
self.inputs = inputs

if outputs is None and return_outputs and not return_result:
raise SystemError("return_outputs specified by no y0 value")
raise ValueError("return_outputs specified but no outputs value")
self.outputs = outputs
self.return_outputs = return_outputs

if result is None and return_result:
raise SystemError("return_result specified by no result value")
raise ValueError("return_result specified but no result value")
self.result = result
self.return_result = return_result

Expand Down Expand Up @@ -1799,7 +1799,7 @@ def find_operating_point(
values will be ignored in solving for an operating point. State
indices can be listed in any order. By default, all updates will be
fixed at `dx0` in searching for an operating point.
root_method : str, optonal
root_method : str, optional
Method to find the operating point. If specified, this parameter
is passed to the :func:`scipy.optimize.root` function.
root_kwargs : dict, optional
Expand Down
3 changes: 1 addition & 2 deletions control/tests/iosys_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2089,7 +2089,6 @@ def test_find_eqpt(x0, ix, u0, iu, y0, iy, dx0, idx, dt, x_expect, u_expect):


# Test out new operating point version of find_eqpt
# TODO: add return_)y tests
def test_find_operating_point():
dt = 1
sys = ct.NonlinearIOSystem(
Expand Down Expand Up @@ -2148,7 +2147,7 @@ def test_operating_point():
np.testing.assert_allclose(linsys_orig.C, linsys_oppt.C)
np.testing.assert_allclose(linsys_orig.D, linsys_oppt.D)

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

Expand Down
2 changes: 1 addition & 1 deletion examples/cruise-control.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def cruise_plot(sys, t, y, label=None, t_hill=None, vref=20, antiwindup=False,
# and u given the gear, slope, and desired output velocity)
X0, U0, Y0 = ct.find_operating_point(
cruise_pi, [vref[0], 0], [vref[0], gear[0], theta0[0]],
y0=[0, vref[0]], iu=[1, 2], iy=[1], return_y=True)
y0=[0, vref[0]], iu=[1, 2], iy=[1], return_outputs=True)

# Now simulate the effect of a hill at t = 5 seconds
plt.figure()
Expand Down
2 changes: 1 addition & 1 deletion examples/cruise.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@
"# Compute the equilibrium throttle setting for the desired speed\n",
"X0, U0, Y0 = ct.find_eqpt(\n",
" cruise_pi, [vref[0], 0], [vref[0], gear[0], theta0[0]],\n",
" y0=[0, vref[0]], iu=[1, 2], iy=[1], return_y=True)\n",
" y0=[0, vref[0]], iu=[1, 2], iy=[1], return_outputs=True)\n",
"\n",
"# Now simulate the effect of a hill at t = 5 seconds\n",
"plt.figure()\n",
Expand Down