The code in this repository is based on the works in [1][2] and is written in Python. For more information on the required modules and packages refer to section Technical requirements. It is a variation of an unscented kalman filter stochastic nonlinear model predictive control (UKF-SNMPC) algorithm. To cite UKF-SNMPC please use the publications [1][2].
First install the required technical prerequisites and download the Python files contained in this repository. Next run Simulation_UKF_SNMPC, which should run the pre-defined problem. Once this works the problem definition can be edited in UKF_SNMPC_problem_definition to define your own problem. The code automatically outputs a data library for analysis and plots to be employed in for example Matlab or Python.
Model predictive control (MPC) is a popular control method, which is however reliant on an accurate dynamic model. Many dynamic systems however are affected by significant uncertainties often leading to a lower performance and significant constraint violations. In this algorithm we assume that a nonlinear system is affected by known stochastic parametric uncertainties leading to a stochastic nonlinear MPC (SNMPC) approach. The square-root Unscented Kalman filter (UKF) equations are used in this context for both estimation and propagation of mean and covariance of the states by generating separate scenarios as shown in the figure above. The uncertainty description is used to optimize an objective in expectation and employ chance-constraints to maintain feasibility despite the presence of the stochastic uncertainties. The covariance of the nonlinear constraints is found using linearization. The dynamic equation system is assumed to be given by differential algebraic equations (DAE). Further description on the theory can be found in [1][2].
- Cheap SNMPC implementation for both receding and shrinking time horizons
- Parameter and state estimation using the square-root UKF
- Nonlinear chance constraints on states to maintain feasibility
- Robust horizon up to which uncertainties are propagated to prevent the growth of open-loop uncertainties
- Efficient solution of nonlinear dynamic optimization formulation using automatic differentiation
The algorithm has been shown in [1][2] as an efficient tool for the control of a batch process in a shrinking horizon, which is an example of a highly nonlinear and unsteady-state system. These are described by first-principles DAEs. See below for example the improved temperature control of the proposed algorithm compared to a nominal NMPC using soft-constraints.
The code was written using CasADi in Python 2.7 and hence requires CasADi with all its sub-dependencies. Simply download a Python 2.7 distribution such as Python(x,y) and install CasADi following the instructions. The HSL linear solvers are also required for IPOPT to work well, see Obtaining-HSL for more information.
[1] E. Bradford, and L. Imsland, Stochastic Nonlinear Model Predictive Control with State Estimation by Incorporation of the Unscented Kalman Filter, arXiv preprint arXiv:1709.01201, 2017.
[2] E. Bradford, and L. Imsland, Economic stochastic model predictive control using the unscented Kalman filter, IFAC-PapersOnLine, vol. 51, no. 18, pp. 417-422, 2018.
This project has received funding from the European Union’s Horizon 2020 research and innovation programme under the Marie SklodowskaCurie grant agreement No 675215.
This project is licensed under the MIT license – see LICENSE.md in the repository for details.