2017 21st International Conference on Process Control (PC)

C Code Generation Applied to Nonlinear Model Predictive Control for an Artificial Pancreas

D. Boiroux, J.B. Jørgensen
Technical University of Denmark

Abstract

This paper presents a method to generate C code from MATLAB code applied to a nonlinear model predictive control (NMPC) algorithm. The C code generation uses the MATLAB Coder Toolbox. It can drastically reduce the time required for development compared to a manual porting of code from MATLAB to C, while ensuring a reliable and fairly optimized code. We present an application of code generation to the numerical solution of nonlinear optimal control problems (OCP). The OCP uses a sequential quadratic programming algorithm with multiple shooting and sensitivity computation. We consider the problem of glucose regulation for people with type 1 diabetes as a case study. The average computation time when using generated C code is 0.21 s (MATLAB: 1.5 s), and the maximum computation time when using generated C code is 0.97 s (MATLAB: 5.7 s). Compared to the MATLAB implementation, generated C code can run in average more than 7 times faster.

Full paper

102.pdf

Session

Model Predictive Control (Lecture)

Reference

Boiroux, D.; Jørgensen, J.B.: C Code Generation Applied to Nonlinear Model Predictive Control for an Artificial Pancreas. Editors: Fikar, M. and Kvasnica, M., In Proceedings of the 2017 21st International Conference on Process Control (PC), Štrbské Pleso, Slovakia, June 6 – 9, 327–332, 2017.

BibTeX
@inProceedings{pc2017-102,
author = {Boiroux, D. and Jørgensen, J.B.},
title = {C Code Generation Applied to Nonlinear Model Predictive Control for an Artificial Pancreas},
booktitle = {Proceedings of the 2017 21st International Conference on Process Control (PC)},
year = {2017},
pages = {327-332},
editor = {Fikar, M. and Kvasnica, M.},
address = {\v{S}trbsk\'e Pleso, Slovakia}}
Copyright © 2017 IEEE. All rights reserved.