# Model-Predictive Control (MPC)

## Introduction

Model-Predictive Control refers to the process of using a prediction model to simulate the future response of the controlled system, and an optimizer to optimize the future control signal trajectory to optimize a cost function over the simulation, subject to constraints. When an optimal trajectory is found, the first control input from this trajectory is applied to the controlled system, a new measurement is obtained, the estimate of the current state is updated and the process is repeated. An MPC controller is thus a model-based feedback controller capable of incorporating constraints, making it a generally applicable advanced control method.

The prediction model used by the optimizer may be either linear or nonlinear, and the same applies to the state observer. The following documentation will demonstrate how to setup, tune and simulate MPC controllers.

The workflow for designing an MPC controller is roughly split up into

1. Specifying the dynamics. This can be done in several ways:
2. Defining a state observer.
3. Specifying an MPC solver.
4. Defining an MPC problem containing things like
• Prediction horizon
• State and control constraints
• The dynamics and the observer

The currently defined problem types are

• LQMPCProblem: Linear Quadratic MPC problem. The cost is on the form $z^T Q_1 z + u^T Q_2 u$ where $z = C_z x$ are the controlled outputs.
• QMPCProblem: Quadratic Nonlinear MPC problem. The cost is on the form $x^T Q_1 x + u^T Q_2 u$.
• GenericMPCProblem: An MPC problem that allows the user to specify arbitrary costs and constraints, sometimes referred to as economic MPC. This documentation uses the terms, linear-quadratic, nonlinear-quadratic and generic MPC to refer to different variations of the MPC problem.

See docstrings and examples for further information. The following sections contains details around each step mentioned above. See the Getting started section below to navigate the topic.

## Getting started

The MPC documentation is divided into the two main sections

each of which has its own references to help you get started.

Common references for both sections are provided under MPC Details