Skip to content
LIBRARY

MPCComponents ​

Documentation for MPCComponents.

MPCComponents is a library of model-predictive control components implemented in the Dyad language. Linear MPC is backed by LinearMPC.jl, nonlinear MPC by acados, nonlinear state estimation by LowLevelParticleFilters.jl, and a purely discrete model built from these components can be exported as standalone C code.

The controllers and observers are clocked components: they are connected to a continuous-time plant through samplers and holds from DiscreteComponents, and a closed-loop model is simulated like any other Dyad model.

ComponentDescription
LinearMPCControllerLinear MPC as one clocked component: state observer and condensed QP.
LinearMPCObserver, LinearMPCOptimizerThe two parts of LinearMPCController, also usable on their own.
PIDEquivalentMPCControllerReproduces DiscreteComponents.DiscretePIDStandard exactly while no constraint is active, so that constraints and preview can be added to a tuned PID controller.
ACADOSMPCNonlinear MPC for ODE, semi-explicit index-1 DAE and discrete-time prediction models.
UKFObserverUnscented Kalman filter for a nonlinear prediction model, as one clocked component.
DelayLineTapped delay line, used to assemble preview vectors.

The analysis CCodeExport exports a model containing these components to C.

Installation ​

Install MPCComponents from the Dyad registry with

julia
import Pkg
Pkg.add("MPCComponents")

acados is provided by acados_jll; neither a C compiler nor Python or CasADi is needed to simulate.

Getting started ​

  • Model-predictive control: the receding-horizon principle, the signals of an MPC loop, a comparison with PID and LQR control, and the choice between linear and nonlinear MPC.

  • Linear MPC: the prediction model, cost function, constraints, horizons and Kalman filter of LinearMPCController, with a reference-tracking example.

  • Nonlinear MPC: the prediction model, discretization, cost function, constraints, solver and state estimation of ACADOSMPC, with a pendulum example.

Tutorials ​

The tutorials are translations of the MPC tutorials of DyadControlSystems.

The component reference at the bottom of the sidebar lists every component, type, analysis and example of the library.