🤖 AI Summary
This work proposes the first native Rust implementation of a Modelica compiler that seamlessly bridges Modelica with modern scientific computing ecosystems such as CasADi, JAX, and Julia, eliminating the need for error-prone model rewrites and preserving full semantic fidelity. By structuring compilation into well-defined phases that translate Modelica into a generic algebraic intermediate representation, the system enables multi-backend code generation and real-time simulation. It uniquely supports zero-install execution in web browsers via WebAssembly and facilitates hardware- and software-in-the-loop control. The compiler covers core functionalities of the Modelica Standard Library and demonstrates superior compilation and simulation performance compared to existing open-source alternatives, with successful validation in quadrotor real-time control and cross-platform unified modeling scenarios.
📝 Abstract
Modelica is a well established cyber-physical modeling language, but many modern engineering workflows, such as optimization, differentiable simulation, scientific machine learning, and system analysis, make use of other environments such as CasADi, JAX, and Julia. Existing infrastructure for Modelica toolchains does not target these languages directly, meaning models must typically be rewritten, or lose important information in the interface. This paper presents Rumoca, a Rust-native Modelica compiler that turns Modelica into a universal algebraic frontend for a variety of tools. Rumoca is organized as a sequence of explicit phase boundaries from parsing through Differential-Algebraic Equation (DAE) construction and template-driven code generation, with a native Rust simulation backend that also supports real-time, software-in-the-loop execution. We report quantitative coverage of the Modelica Standard Library across pipeline phases, together with compile-time and simulation-time benchmarks against an open-source reference. The full compiler ships as a VS Code extension and runs in the browser via WebAssembly, enabling zero-install playgrounds and self-contained HTML simulators. End-to-end case studies demonstrate realtime software-in-the-loop control of a quadrotor model and deployment of a single Modelica source across multiple algebraic backends.