We present a tool for user-friendly generation of machine learning surrogates that allows for fast and optimizer-free Model Predictive Control. Using a variety of practically-relevant examples, we demonstrate its utility to the workflow of a control engineer in the context of Julia simulation tools (such as ModelingToolkit.jl).
Model Predictive Control (MPC) provides a powerful framework to control a dynamical system and is particularly useful for nonlinear systems that may have constraints on states as well as a general objective function. The concept is to use a prediction model of the future response of the system and then determine the optimal control inputs that optimize the future evolved trajectory. Thus, an (expensive) online optimizer is called at each time step with the requirement that a solution is available before the next time step. The first of these control inputs is then passed onto the plant model (or actual system). An observer (such as a Kalman filter or variants) is used to provide an estimate of the system state which is fed back to the predictive controller for the next time step. The need for an online optimizer commonly results in a limitation of the sample rate of the system or the length of the prediction horizon which may make MPC intractable for nonlinear systems with fast dynamics. Furthermore, it necessitates verification of the optimizer especially for safety-critical applications.
This work presents an alternative approach for optimizer-free control that both results in a substantial speedup over online optimization and removes the need for optimizer verification. The method followed is to simulate the MPC controller for several sampled reference conditions as well as initial states and train a neural network-based surrogate to learn the control law from the simulated data. We discuss the philosophy followed and highlight the benefits and drawbacks of constructing a surrogate for the optimizer versus for both the optimizer and the observer. We apply and benchmark the tool developed to several practically-relevant problems arising from various industries such as aerospace and chemical engineering. We also demonstrate the ability of the surrogate controller to reject disturbances and deal with set-point changes. With these examples, we show 100-150x speed-ups with low training errors compared to online optimization.
Lastly, we present the use of the toolkit in a typical workflow of a control engineer starting from the development of a dynamic system model (e.g., using ModelingToolkit.jl) to the development of the MPC model and finally to surrogatization and analysis in order to highlight its use as an enabling technology especially for control of fast nonlinear systems.