Directly generating controller code from models is important for advanced model-based design. This paper describes how Dymola can generate embedded C-code from Modelica models, designed to be easy to embed, with care about minimal foot-print, traceability, and straightforward integration in embedded platforms and gives actual application examples.>
The paper focuses on using Rosenbrock methods for index-1 problems (instead of the normal transformation to index 0) that allows Dymola to handle stiff systems in a way that both is theoretically sound and has an upper bound on the execution time per sample.>
The stiff systems in the control system often occur due to using an inverse (simplified) model of the real plant in the controller. A nonlinear feedforward controller and a controller with feedback linearization, both applying an inverse model, demonstrate the proposed process by using Rosenbrock methods for embedded code generation.
Keywords: Modelica, inverse models, real-time, embedded, Rosenbrock methods, inline integration, feedforward controller, feedback linearization
Proceedings of the 12th International Modelica Conference, Prague, Czech Republic, May 15-17, 2017
C. Bertsch, J. Neudorfer, E. Ahle, S. S. Arumugham, K. Ramachandran, A. Thuy. FMI for Physical Models on Automotive Embedded Targets. Proc. of 11th International Modelica Conference, pp. 43-50. Versailles, France, 2015.
H. Elmqvist, S. E. Mattsson, H. Olsson, J. Andreasson, M. Otter, C. Schweiger, D. Brück. Realtime Simulation of Detailed Vehicle and Powertrain Dynamics. Electronics Simulation and Optimization. SAE 2004 World Congress, Detroit, USA, 2004.
E. Hairer, G. Wanner. Solving Ordinary Differential Equations II. Stiff and Differential-Algebraic Problems. Springer, 1991.
G. Looye, M. Thümmel, M. Kurze, M. Otter, J. Bals. Nonlinear Inverse Models for Control. Proceedings of 4th International Modelica Conference, pp. 267-279, TU Hamburg-Harburg, Gemany, 2005.
C. Lubich, M. Roche. Rosenbrock Methods for Differentialalgebraic Systems with Solution-dependent Singular Matrix Multiplying the Derivative. Computing 43, 325-342, Springer, 1990.
MISRA Consortium. Guidelines for the Use of the C Language in Critical Systems. 2013.
M. Otter, B. Thiele, H. Elmqvist. A Library for Synchronous Control Systems in Modelica. Proc. of 9th International Modelica Conference, pp. 27-36. Munich, Germany, 2012.
J. Rang. Improved traditional Rosenbrock Wanner methods for stiff odes and daes. Technical report, Institute of Scientific Computing, Technical University Braunschweig, 2013.
L. Satabin, J.-L. Colaco, O. Andrieu, B. Pagano. Towards a Formalized Modelica Subset. Proc. of 11th International Modelica Conference, pp. 637-646. Versailles, France, 2015.