A framework for implementation-independent simulation models
Mathematical modeling and the simulation of complex physical systems is a central activity in engineering. The models are the result of large investments in time and measurement equipment and therefore need to be used as efficiently as possible. If one and the same model can be run in several simulation environments and in other applications, then the model can be simulated today and tomorrow in the most appropriate environment with respect to user background, the engineering domain at hand, and more. Modern equation-based modeling languages provide this functionality in principle since the models are translated into executable code by separate model compilers. These compilers today generate code for standalone simulation using a fixed interface toward a number of numerical solvers. What is missing is a compiler that can generate customized code for various simulation environments, where the generated code interfaces with other models in the environment through the conventional solution of powerports. Each port holds both input and output variables such as force and velocity. A compiler architecture is proposed in this article. Also, an implementation for a subset of the Modelica language is demonstrated in the case of two widely different simulation environment targets. The model ports are adapted initially to the simulation environment characteristics in terms of the variables part of the ports, and an input-output causality is found for which the model can be solved and that suits the environment. The equation system is optimized, and information such as Jacobians, assignments, and more is generated in the XML format. Finally, code generators specific for each environment are employed that create the final executable code.
simulation compiler modelica causality xml code generation dae