{"title":"人工胰腺非线性模型预测控制的C代码生成","authors":"Dimitri Boiroux, John Bagterp J⊘rgensen","doi":"10.1109/PC.2017.7976235","DOIUrl":null,"url":null,"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.","PeriodicalId":377619,"journal":{"name":"2017 21st International Conference on Process Control (PC)","volume":"20 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2017-06-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"C code generation applied to nonlinear model predictive control for an artificial pancreas\",\"authors\":\"Dimitri Boiroux, John Bagterp J⊘rgensen\",\"doi\":\"10.1109/PC.2017.7976235\",\"DOIUrl\":null,\"url\":null,\"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.\",\"PeriodicalId\":377619,\"journal\":{\"name\":\"2017 21st International Conference on Process Control (PC)\",\"volume\":\"20 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2017-06-01\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"2017 21st International Conference on Process Control (PC)\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1109/PC.2017.7976235\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"2017 21st International Conference on Process Control (PC)","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/PC.2017.7976235","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0
摘要
本文提出了一种由MATLAB代码生成C语言代码的方法,该方法应用于非线性模型预测控制算法。C代码生成使用MATLAB编码器工具箱。与手工将代码从MATLAB移植到C语言相比,它可以大大减少开发所需的时间,同时确保可靠且相当优化的代码。给出了代码生成在非线性最优控制问题(OCP)数值解中的应用。OCP采用顺序二次规划算法进行多次射击和灵敏度计算。我们考虑1型糖尿病患者的葡萄糖调节问题作为一个案例研究。使用生成C代码的平均计算时间为0.21 s (MATLAB: 1.5 s),使用生成C代码的最大计算时间为0.97 s (MATLAB: 5.7 s),与MATLAB实现相比,生成C代码的平均运行速度提高了7倍以上。
C code generation applied to nonlinear model predictive control for an artificial pancreas
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.