Skip to content

Commit 5eaee66

Browse files
committed
updated OperatingPoint attribute names + docstring edits
1 parent 223acc6 commit 5eaee66

1 file changed

Lines changed: 37 additions & 27 deletions

File tree

control/nlsys.py

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -519,26 +519,25 @@ def linearize(self, x0, u0=None, t=0, params=None, eps=1e-6,
519519
copy_names=False, **kwargs):
520520
"""Linearize an input/output system at a given state and input.
521521
522-
Return the linearization of an input/output system at a given state
523-
and input value as a StateSpace system. See
524-
:func:`~control.linearize` for complete documentation.
522+
Return the linearization of an input/output system at a given
523+
operating point (or state and input value) as a StateSpace system.
524+
See :func:`~control.linearize` for complete documentation.
525525
526526
"""
527+
#
528+
# Default method: if the linearization is not defined by the
529+
# subclass, perform a numerical linearization use the `_rhs()` and
530+
# `_out()` member functions.
531+
#
527532
from .statesp import StateSpace
528533

529534
# Allow first argument to be an operating point
530535
if isinstance(x0, OperatingPoint):
531-
if u0 is None:
532-
u0 = x0.inputs
536+
u0 = x0.inputs if u0 is None else u0
533537
x0 = x0.states
534538
elif u0 is None:
535539
u0 = 0
536540

537-
#
538-
# If the linearization is not defined by the subclass, perform a
539-
# numerical linearization use the `_rhs()` and `_out()` member
540-
# functions.
541-
#
542541
# Process nominal states and inputs
543542
x0, nstates = _process_vector_argument(x0, "x0", self.nstates)
544543
u0, ninputs = _process_vector_argument(u0, "u0", self.ninputs)
@@ -1675,9 +1674,10 @@ class OperatingPoint(object):
16751674
"""A class for representing the operating point of a nonlinear I/O system.
16761675
16771676
The ``OperatingPoint`` class stores the operating point of a nonlinear
1678-
system, which consists of the state and input for a nonlinear system.
1679-
The main use for this class is as the return object for the
1680-
:func:`find_operating_point` function.
1677+
system, consisting of the state and input vectors for the system. The
1678+
main use for this class is as the return object for the
1679+
:func:`find_operating_point` function and as an input to the
1680+
:func:`linearize` function.
16811681
16821682
Attributes
16831683
----------
@@ -1690,14 +1690,14 @@ class OperatingPoint(object):
16901690
16911691
"""
16921692
def __init__(
1693-
self, states, inputs=None, yop=None, result=None,
1693+
self, states, inputs=None, outputs=None, result=None,
16941694
return_y=False, return_result=False):
16951695
self.states = states
16961696
self.inputs = inputs
16971697

1698-
if yop is None and return_y and not return_result:
1698+
if outputs is None and return_y and not return_result:
16991699
raise SystemError("return_y specified by no y0 value")
1700-
self.yop = yop
1700+
self.outputs = outputs
17011701
self.return_y = return_y
17021702

17031703
if result is None and return_result:
@@ -1708,9 +1708,9 @@ def __init__(
17081708
# Implement iter to allow assigning to a tuple
17091709
def __iter__(self):
17101710
if self.return_y and self.return_result:
1711-
return iter((self.states, self.inputs, self.yop, self.result))
1711+
return iter((self.states, self.inputs, self.outputs, self.result))
17121712
elif self.return_y:
1713-
return iter((self.states, self.inputs, self.yop))
1713+
return iter((self.states, self.inputs, self.outputs))
17141714
elif self.return_result:
17151715
return iter((self.states, self.inputs, self.result))
17161716
else:
@@ -1816,7 +1816,7 @@ def find_operating_point(
18161816
inputs : array of input values
18171817
Value of the inputs at the equilibrium point, or `None` if no
18181818
equilibrium point was found and `return_result` was False.
1819-
yop : array of output values, optional
1819+
outputs : array of output values, optional
18201820
If `return_y` is True, returns the value of the outputs at the
18211821
equilibrium point, or `None` if no equilibrium point was found and
18221822
`return_result` was False.
@@ -1826,11 +1826,21 @@ def find_operating_point(
18261826
18271827
Notes
18281828
-----
1829-
For continuous time systems, equilibrium points are defined as points for
1830-
which the right hand side of the differential equation is zero:
1831-
:math:`f(t, x_e, u_e) = 0`. For discrete time systems, equilibrium points
1832-
are defined as points for which the right hand side of the difference
1833-
equation returns the current state: :math:`f(t, x_e, u_e) = x_e`.
1829+
For continuous time systems, equilibrium points are defined as points
1830+
for which the right hand side of the differential equation is zero:
1831+
:math:`f(t, x_e, u_e) = 0`. For discrete time systems, equilibrium
1832+
points are defined as points for which the right hand side of the
1833+
difference equation returns the current state: :math:`f(t, x_e, u_e) =
1834+
x_e`.
1835+
1836+
Operating points are found using the :func:`scipy.optimize.root`
1837+
function, which will attempt to find states and inputs that satisfy the
1838+
specified constraints. If no solution is found and `return_result` is
1839+
`False`, the returned state and input for the operating point will be
1840+
`None`. If `return_result` is `True`, then the return values from
1841+
:func:`scipy.optimize.root` will be returned (but may not be valid).
1842+
If `root_method` is set to `lm`, then the least squares solution (in
1843+
the free variables) will be returned.
18341844
18351845
"""
18361846
from scipy.optimize import root
@@ -2034,9 +2044,9 @@ def rootfun(z):
20342044
def linearize(sys, xeq, ueq=None, t=0, params=None, **kw):
20352045
"""Linearize an input/output system at a given state and input.
20362046
2037-
This function computes the linearization of an input/output system at a
2038-
given state and input value and returns a :class:`~control.StateSpace`
2039-
object. The evaluation point need not be an equilibrium point.
2047+
Compute the linearization of an I/O system at an operating point (state
2048+
and input) and returns a :class:`~control.StateSpace` object. The
2049+
operating point need not be an equilibrium point.
20402050
20412051
Parameters
20422052
----------

0 commit comments

Comments
 (0)