Model-based control with FMI and a C++ runtime for Modelica

Rüdiger Franke
ABB, Germany

Marcus Walther
TU Dresden, Germany

Niklas Worschech
Bosch Rexroth, Germany

Willi Braun
FH Bielefeld, Germany

Bernhard Bachmann
FH Bielefeld, Germany

Ladda ner artikelhttp://dx.doi.org/10.3384/ecp15118339

Ingår i: Proceedings of the 11th International Modelica Conference, Versailles, France, September 21-23, 2015

Linköping Electronic Conference Proceedings 118:36, s. 339-347

Visa mer +

Publicerad: 2015-09-18

ISBN: 978-91-7685-955-1

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


Modelica describes physical systems on a high level, using model objects, multi-dimensional arrays and oth-er data structures as well as graphical representations. Modelica models are translated to differential-algebraic equation systems and compiled to executable code pri-or to their execution in numerical solvers. The transla-tion gives a lot of possibilities for code optimization. This is particularly important for model-based control applications. This paper investigates the exploitation of C++ for Modelica code optimization. C++ supports advanced programming concepts and at the same time aims to “leave no room for a lower-level language … (except for assembly code in rare cases)” [6]. The multitude of different requirements on arrays is treated with polymorphism. Templates keep the C++ code small and improve type safety. Built-in exception handling and destructors for memory management also contribute to smaller and more readable code. These ideas have been implemented in the OpenModel-ica C++ runtime. The paper describes its enhancement with new array features and with an FMI 2.0 interface. FMI serves as interface between modeling tools and control applications. In particular the new FMI 2.0 meets requirements of numerical optimization solvers in model-based control. A publically available application example demon-strates the achievements. CPU times obtained with the OpenModelica C++ runtime are significantly faster than CPU times obtained with the C runtime or with Dymola.


Modelica; OpenModelica; FMI C++ model-based control; MPC; MHE; SQP; HQP


P. J. Denning: The locality principle, Communications of the ACM - Designing for the mobile device, July 2005.

R. Franke, E. Arnold: Applying new numerical algorithms to the solution of discrete-time optimal control problems. In: Computer Intensive Methods in Control and Signal Processing: The Curse of Dimensionality, Birhäuser, Basel, 1997.

R. Franke, M. Rode, K. Krüger: On-line Optimization of Drum Boiler Startup, 3rd International Modelica Conference, 2003. https://www.modelica.org/events/Conference2003/papers/h29_Franke.pdf

R. Franke, L. Vogelbacher. Nonlinear model predictive control for cost optimal startup of steam power plants. at – Automatisierungstechnik, 54(12):630–637, 2006.

R. Franke, B.S. Babji, M. Antoine, A. Isaksson: Model-based online applications in the ABB Dynamic Optimization framework, 6th International Modelica Conference, Bielefeld, March 3-4, 2008.

R. Franke, S. Saliba, A. Frick: Virtual Power Plants for Smart Markets, PowerGen Europe, Cologne, June 2014. Functional Mock-up Interface for Model Exchange and Co-Simulation, Version 2.0, July 2014.

E. Lazutkin, A. Geletu, S. Hopfgarten, P. Li: Modified Multiple Shooting Combined with Collocation Method in JModelica.org with Symbolic Calculations, Proceedings of the 10th International ModelicaConference March 10-12, 2014, Lund, Sweden. http://www.ep.liu.se/ecp/096/104/ecp14096104.pdf

F. Magnusson, K. Berntorp, B. Olofsson, J. Åkesson: Symbolic Transformations of Dynamic Optimization Problems, Proceedings of the 10th International Modelica Conference, Lund, Sweden, March 10-12, 2014.

Z.K. Nagy, B. Mahn, R. Franke, F. Allgöwer. Evaluation study of an efficient output feedback nonlinear model predictive control for temperature tracking in an industrial batch reactor. Control Engineering Practice, 15(7):839 – 850, 2007.

J. Neupert, E. Arnold, O. Sawodny, and K. Schneider: Tracking and anti-sway control for boom cranes. Control Engineering Practice, 18(1):31–44, 2010. OpenModelica System Documentation, February 2014.

A. Pfeiffer: Optimization Library for Interactive Multi-Criteria Optimization Tasks, Proceedings of the 9th International Modelica Conference, September 3-5, 2012, Munich, Germany. http://www.ep.liu.se/ecp/076/068/ecp12076068.pdf

V. Ruge, W. Braun, B. Bachmann: Efficient Implementation of Collocation Methods for Optimization using OpenModelica and ADOL-C, Proceedings of the 10th International ModelicaConference, March 10-12, 2014, Lund, Sweden.

B. Stroustrup: The C++ Programming Language, Fourth Edition, Addison-Wesley Pearson Education Inc., 2014.

J. Wagenpfeil, E. Arnold, H. Linke, O. Sawodny: Modeling and optimized water management of artificial inland waterway systems. Journal of Hydroinformatics, 15(2):348–365, 2013.

N. Worschech, L. Mikelsons: A Toolchain for Real-Time Simulation using the OpenModelica Compiler, 9th International Modelica Conference, Munich, 2012. http://www.ep.liu.se/ecp/076/086/ecp12076086.pdf

D. Zimmer, M. Otter, H. Elmqvist, G. Kurzbach: Custom Annotations: Handling Meta-Information in Modelica, Proceedings of the 10th International ModelicaConference, March 10-12, 2014, Lund, Sweden. https://www.modelica.org/events/modelica2014/proceedings/html/submissions/ECP14096173_ZimmerOtterElmqvistKurzbach.pdf

J. Åkesson, K.-E. Årzén, M. Gäfvert, T. Bergdahl, H. Tummescheit. Modeling and optimization with Optimica and JModelica.org – languages and tools for solving large-scale dynamic optimization problems. Computers and Chemical Engineering, 34(11):1737–1749, November 2010.

Citeringar i Crossref