Conference article

Integration of CasADi and

Joel Andersson
Department of Electrical Engineering and Optimization in Engineering Center (OPTEC), K.U. Leuven, Belgium

Johan Åkesson
Department of Automatic Control, Lund University, Sweden \ Modelon AB, Sweden

Francesco Casellad
Dipartimento di Elettronica e Informazione, Politecnico di Milano, Italy

Moritz Diehl
Department of Electrical Engineering and Optimization in Engineering Center (OPTEC), K.U. Leuven, Belgium

Download article

Published in: Proceedings of the 8th International Modelica Conference; March 20th-22nd; Technical Univeristy; Dresden; Germany

Linköping Electronic Conference Proceedings 63:25, p. 218-231

Show more +

Published: 2011-06-30

ISBN: 978-91-7393-096-3

ISSN: 1650-3686 (print), 1650-3740 (online)


This paper presents the integration of two open source softwares: CasADi; which is a framework for efficient evaluation of expressions and their derivatives; and the Modelica-based platform The integration of the tools is based on an XML format for exchange of DAE models. The platform supports export of models in this XML format; wheras CasADi supports import of models expressed in this format. Furthermore; we have carried out comparisons with ACADO; which is a multiple shooting package for solving optimal control problems.

CasADi; in turn; has been interfaced with ACADO Toolkit; enabling users to define optimal control problems using Modelica and Optimica specifications; and use solve using direct multiple shooting. In addition; a collocation algorithm targeted at solving largescale DAE constrained dynamic optimization problems has been implemented. This implementation explores CasADi’s Python and IPOPT interfaces; which offer a convenient; yet highly efficient environment for development of optimization algorithms. The algorithms are evaluated using industrially relevant benchmark problems.


Dynamic optimization; Symbolic manipulation; Modelica;; ACADO Toolkit; CasADi


[1] Johan Åkesson. Optimica—an extension of modelica supporting dynamic optimization. In 6th International Modelica Conference 2008. Modelica Association; March 2008.

[2] Johan Åkesson; Karl-Erik Årzén; Magnus Gäfvert; Tove Bergdahl; and Hubertus Tummescheit. Modeling and optimization with Optimica and—languages and tools for solving large-scale dynamic optimization problem. Computers and Chemical Engineering; 34(11):1737–1749; November 2010. doi: 10.1016/j.compchemeng.2009.11.011.

[3] Johan Åkesson and Ola Slätteke. Modeling; calibration and control of a paper machine dryer section. In 5th International Modelica Conference 2006; Vienna; Austria; September 2006. Modelica Association.

[4] J. Andersson; B. Houska; and M. Diehl. Towards a Computer Algebra System with Automatic Differentiation for use with Object-Oriented modelling languages. In 3rd International Workshop on Equation-Based Object-Oriented Modeling Languages and Tools; Oslo; Norway; October 3; 2010.

[5] Niklas Andersson; Per-Ola Larsson; Johan Åkesson; Staffan Haugwitz; and Bernt Nilsson. Calibration of a polyethylene plant for grade change optimizations. In 21st European Symposium on Computer-Aided Process Engineering; May 2011. Accepted for publication. doi: 10.1016/B978-0-444-53711-9.50135-8.

[6] D. M. Beazley. Automated scientific software scripting with SWIG. Future Gener. Comput. Syst.; 19:599–609; July 2003. doi: 10.1016/S0167-739X(02)00171-1.

[7] B. M. Bell. CppAD Home Page; 2010. http: //

[8] Lorenz T. Biegler. Nonlinear programming: concepts; algorithms; and applications to chemical processes. SIAM; 2010.

[9] T. Binder; L. Blank; H.G. Bock; R. Bulirsch; W. Dahmen; M. Diehl; T. Kronseder; W Marquardt; J.P. Schlöder; and O. v. Stryk. Online Optimization of Large Scale Systems; chapter Introduction to model based optimization of chemical processes on moving horizons; pages 295–339. Springer-Verlag; Berlin Heidelberg; 2001.

[10] H.G. Bock and K.J. Plitt. A multiple shooting algorithm for direct solution of optimal control problems. In Proceedings 9th IFAC World Congress Budapest; pages 243–247. Pergamon Press; 1984.

[11] F. Casella; F. Donida; and J. Åkesson. Object-oriented modeling and optimal control: A case study in power plant start-up. In Proc. 18th IFAC World Congress; 2011. In submission.

[12] Francesco Casella; Filippo Donida; and Johan Åkesson. An XML representation of DAE systems obtained from Modelica models. In Proceedings of the 7th International Modelica Conference 2009. Modelica Association; September 2009.

[13] Dassault Systemes. Dymola web page; 2010.

[14] M. Diehl; H.G. Bock; J.P. Schlöder; R. Findeisen; Z. Nagy; and F. Allgöwer. Real-time optimization and Nonlinear Model Predictive Control of Processes governed by differential-algebraic equations. J. Proc. Contr.; 12(4):577–585; 2002. doi: 10.1016/S0959-1524(01)00023-3.

[15] M. Diehl; H. J. Ferreau; and N. Haverbeke. Non-linear model predictive control; volume 384 of Lecture Notes in Control and Information Sciences; chapter Efficient Numerical Methods for Nonlinear MPC and Moving Horizon Estimation; pages 391–417. Springer; 2009.

[16] Inc. Enthought. SciPy; 2010.

[17] Dave Beazley et al. SWIG – Simplified Wrapper and Interface Generator; version 2.0; 2010.

[18] H. J. Ferreau; H. G. Bock; and M. Diehl. An online active set strategy to overcome the limitations of explicit MPC. International Journal of Robust and Nonlinear Control; 18(8):816–830; 2008. doi: 10.1002/rnc.1251.

[19] R Fourer; D. Gay; and B Kernighan. AMPL – A Modeling Language for Mathematical Programming. Brooks/Cole — Thomson Learning; 2003.

[20] R. Franke; M. Rode; and K Krüger. On-line optimization of drum boiler startup. In Proceedings of Modelica’2003 conference; 2003.

[21] Gams Development Corporation. GAMS webpage; 2010.

[22] A. Griewank. Evaluating Derivatives; Principles and Techniques of Algorithmic Differentiation. Number 19 in Frontiers in Appl. Math. SIAM; Philadelphia; 2000.

[23] Staffan Haugwitz; Johan Åkesson; and Per Hagander. Dynamic start-up optimization of a plate reactor with uncertainties. Journal of Process Control; 19(4):686–700; April 2009. doi: 10.1016/j.jprocont.2008.07.005.

[24] G. A. Hicks and W. H. Ray. Approximation methods for optimal control synthesis. Can. J. Chem. Eng.; 20:522 –529; 1971. doi: 10.1002/cjce.5450490416.

[25] A. C. Hindmarsh; P. N. Brown; K. E. Grant; S. L. Lee; R. Serban; D. E. Shumaker; and C. S. Woodward. Sundials: Suite of nonlinear and differential/algebraic equation solvers. ACM Transactions on Mathematical Software; 31:363–396; 2005. doi: 10.1145/1089014.1089020.

[26] B. Houska; H.J. Ferreau; and M. Diehl. ACADO Toolkit – An Open Source Framework for Automatic Control and Dynamic Optimization. Optimal Control Applications and Methods; 2010. (in print). doi: 10.1002/oca.939.

[27] J. Hunter; D. Dale; and M. Droettboom. Mat-PlotLib: Python plotting; 2010.

[28] P-O. Larsson; J. Åkesson; Staffan Haugwitz; and Niklas Andersson. Modeling and optimization of grade changes for multistage polyethylene reactors. In Proc. 18th IFAC World Congress; 2011. In submission.

[29] Modelisar. Functional Mock-up Interface for Model Exchange; 2010.

[30] T. Oliphant. Numpy Home Page; 2009.

[31] B. Olofsson; H. Nilsson; A. Robertsson; and J. Åkesson. Optimal tracking and identification of paths for industrial robots. In Proc. 18th IFAC World Congress; 2011. In submission.

[32] Roberto Parrotto; Johan Åkesson; and Francesco Casella. An XML representation of DAE systems obtained from continuous-time Modelica models. In Third International Workshop on Equation-based Object-oriented Modeling Languages and Tools - EOOLT 2010; September 2010.

[33] J. Poland; A. J. Isaksson; and P. Aronsson. Building and solving nonlinear optimal control and estimation problems. In 7th International Modelica Conference; 2009.

[34] Process Systems Enterprise. gPROMS HomePage; 2010.

[35] K. Prölss; H. Tummescheit; S. Velut; Y. Zhu; J. Åkesson; and C. D. Laird. Models for a postcombustion absorption unit for use in simulation; optimization and in a non-linear model predictive control scheme. In 8th International Modelica Conference; 2011.

[36] Python Software Foundation. Python Programming Language – Official Website; January 2011.

[37] The Modelica Association. Modelica – a unified object-oriented language for physical systems modeling; language specification; version 3.2. Technical report; Modelica Association; 2010.

[38] Lee Thomason. TinyXML; January 2011.

[39] Andreas Wächter and Lorenz T. Biegler. On the implementation of an interior-point filter line-search algorithm for large-scale nonlinear programming. Mathematical Programming; 106(1):25–58; 2006. doi: 10.1007/s10107-004-0559-y.

[40] V. M. Zavala and L. T. Biegler. The advanced step NMPC controller: Optimality; stability and robustness. Automatica; 45(1):86–93; 2009. doi: 10.1016/j.automatica.2008.06.011.

Citations in Crossref