control.optimal.create_mpc_iosystem

control.optimal.create_mpc_iosystem(sys, timepts, cost, constraints=None, terminal_cost=None, terminal_constraints=None, 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 points, 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.

  • timepts (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()).

  • inputs (int or list of str, optional) – Set the names of the inputs, outputs, and states, as described in InputOutputSystem().

  • outputs (int or list of str, optional) – Set the names of the inputs, outputs, and states, as described in InputOutputSystem().

  • states (int or list of str, optional) – Set the names of the inputs, outputs, and states, as described in InputOutputSystem().

  • name (string, optional) – System name (used for specifying signals). If unspecified, a generic name <sys[id]> is generated with a unique integer id.

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

InputOutputSystem

Notes

Additional keyword parameters can be used to fine-tune the behavior of the underlying optimization and integrations functions. See OptimalControlProblem() for more information.