control.optimal.create_mpc_iosystem¶
- control.optimal.create_mpc_iosystem(sys, horizon, cost, constraints=[], terminal_cost=None, terminal_constraints=[], log=False, **kwargs)[source]¶
Create a model predictive I/O control system
This function creates an input/output system that implements a model predictive control for a system given the time horizon, cost function and constraints that define the finite-horizon optimization that should be carried out at each state.
- Parameters
sys (InputOutputSystem) – I/O system for which the optimal input will be computed.
horizon (1D array_like) – List of times at which the optimal input should be computed.
cost (callable) – Function that returns the integral cost given the current state and input. Called as cost(x, u).
constraints (list of tuples, optional) – List of constraints that should hold at each point in the time vector. See
solve_ocp()
for more details.terminal_cost (callable, optional) – Function that returns the terminal cost given the current state and input. Called as terminal_cost(x, u).
terminal_constraints (list of tuples, optional) – List of constraints that should hold at the end of the trajectory. Same format as constraints.
kwargs (dict, optional) – Additional parameters (passed to
scipy.optimal.minimize()
).
- Returns
ctrl – An I/O system taking the current state of the model system and returning the current input to be applied that minimizes the cost function while satisfying the constraints.
- Return type
Notes
Additional keyword parameters can be used to fine tune the behavior of the underlying optimization and integrations functions. See
OptimalControlProblem()
for more information.