Skip to content

A basic nonlinear model predictive control implementation using Casadi with Unscented Kalman filter state estimation

License

Notifications You must be signed in to change notification settings

Eric-Bradford/Nominal_NMPC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nominal Nonlinear Model Predictive Control

The code in this repository is a basic nonlinear model predictive control (NMPC) implementation in Python with soft constraints, which uses an Unscented Kalman filter for state estimation. The NMPC algorithm does not consider possible uncertainties and is therefore referred to as nominal. For more information on the required modules and packages refer to section Technical requirements. If you found this code useful, consider citing [1][2] that use this implementation for verification purposes.

Getting started

First install the required technical prerequisites and download the Python files contained in this repository. Next run Simulation, which should run the pre-defined problem. Once this works the problem definition can be edited in 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.

Description

Nonlinear model predictive control (NMPC) is a popular control method for multivariable control problems with important process constraints. The dynamic equation system is assumed to be given by differential algebraic equations (DAE). The code is mostly meant to be used as a way to verify the performance of more novel algorithms against an implementation more likely to be found in industry. It has the following features:

  • Cheap NMPC implementation for both receding and shrinking time horizons
  • Parameter and state estimation using the UKF
  • Efficient solution of nonlinear dynamic optimization formulation using automatic differentiation
  • Always feasible due to soft-constraints

Technical requirements

The code was written using CasADi in Python 3.9 and hence requires CasADi with all its sub-dependencies. Simply download a Python distribution and install CasADi following the instructions. In addition, it uses the Unscented Kalman filter implementation from filterpy.

References

[1] E. Bradford, and L. Imsland, Output feedback stochastic nonlinear model predictive control for batch processes, Computers & Chemical Engineering, vol. 126, pp. 434-450, 2019.

[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.

Legal information

This project is licensed under the MIT license – see LICENSE.md in the repository for details.