control.find_operating_point
- control.find_operating_point(sys, initial_state=0.0, inputs=None, outputs=None, t=0, params=None, input_indices=None, output_indices=None, state_indices=None, deriv_indices=None, derivs=None, root_method=None, root_kwargs=None, return_outputs=None, return_result=None, **kwargs)[source]
Find an operating point for an input/output system.
An operating point for a nonlinear system is a state and input around which a nonlinear system operates. This point is most commonly an equilibrium point for the system, but in some cases a non-equilibrium operating point can be used.
This function attempts to find an operating point given a specification for the desired inputs, outputs, states, or state updates of the system.
In its simplest form,
find_operating_point
finds an equilibrium point given either the desired input or desired output:xeq, ueq = find_operating_point(sys, x0, u0) xeq, ueq = find_operating_point(sys, x0, u0, y0)
The first form finds an equilibrium point for a given input u0 based on an initial guess x0. The second form fixes the desired output values and uses x0 and u0 as an initial guess to find the equilibrium point. If no equilibrium point can be found, the function returns the operating point that minimizes the state update (state derivative for continuous-time systems, state difference for discrete-time systems).
More complex operating points can be found by specifying which states, inputs, or outputs should be used in computing the operating point, as well as desired values of the states, inputs, outputs, or state updates.
- Parameters
- sys
NonlinearIOSystem
I/O system for which the operating point is sought.
- initial_state (or x0)list of initial state values
Initial guess for the value of the state near the operating point.
- inputs (or u0)list of input values, optional
If
y0
is not specified, sets the value of the input. Ify0
is given, provides an initial guess for the value of the input. Can be omitted if the system does not have any inputs.- outputs (or y0)list of output values, optional
If specified, sets the desired values of the outputs at the operating point.
- tfloat, optional
Evaluation time, for time-varying systems.
- paramsdict, optional
Parameter values for the system. Passed to the evaluation functions for the system as default values, overriding internal defaults.
- input_indices (or iu)list of input indices, optional
If specified, only the inputs with the given indices will be fixed at the specified values in solving for an operating point. All other inputs will be varied. Input indices can be listed in any order.
- output_indices (or iy)list of output indices, optional
If specified, only the outputs with the given indices will be fixed at the specified values in solving for an operating point. All other outputs will be varied. Output indices can be listed in any order.
- state_indices (or ix)list of state indices, optional
If specified, states with the given indices will be fixed at the specified values in solving for an operating point. All other states will be varied. State indices can be listed in any order.
- derivs (or dx0)list of update values, optional
If specified, the value of update map must match the listed value instead of the default value for an equilibrium point.
- deriv_indices (or idx)list of state indices, optional
If specified, state updates with the given indices will have their update maps fixed at the values given in
dx0
. All other update 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 atdx0
in searching for an operating point.- root_methodstr, optional
Method to find the operating point. If specified, this parameter is passed to the
scipy.optimize.root
function.- root_kwargsdict, optional
Additional keyword arguments to pass
scipy.optimize.root
.- return_outputsbool, optional
If True, return the value of outputs at the operating point.
- return_resultbool, optional
If True, return the
result
option from thescipy.optimize.root
function used to compute the operating point.
- sys
- Returns
- op_point
OperatingPoint
The solution represented as an
OperatingPoint
object. The main attributes arestates
andinputs
, which represent the state and input arrays at the operating point. If accessed as a tuple, returnsstates
,inputs
, and optionallyoutputs
andresult
based on thereturn_outputs
andreturn_result
parameters. SeeOperatingPoint
for a description of other attributes.- op_point.statesarray
State vector at the operating point.
- op_point.inputsarray
Input vector at the operating point.
- op_point.outputsarray, optional
Output vector at the operating point.
- op_point
Notes
For continuous-time systems, equilibrium points are defined as points for which the right hand side of the differential equation is zero:
. For discrete-time systems, equilibrium points are defined as points for which the right hand side of the difference equation returns the current state:
.
Operating points are found using the
scipy.optimize.root
function, which will attempt to find states and inputs that satisfy the specified constraints. If no solution is found andreturn_result
is False, the returned state and input for the operating point will be None. Ifreturn_result
is True, then the return values fromscipy.optimize.root
will be returned (but may not be valid). Ifroot_method
is set to ‘lm’, then the least squares solution (in the free variables) will be returned.