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.
翻译:Modelica是一种成熟的物理信息建模语言,但许多现代工程工作流程(如优化、可微仿真、科学机器学习和系统分析)需要使用CasADi、JAX和Julia等其他环境。现有Modelica工具链的基础设施并未直接面向这些语言,因此模型通常需要重写,或在接口中丢失重要信息。本文提出Rumoca,一种Rust原生的Modelica编译器,可将Modelica转化为面向多种工具的通用代数前端。Rumoca的组织结构为一系列明确的阶段边界,涵盖从解析到微分代数方程(DAE)构建及模板驱动代码生成的全过程,并配备支持实时软件在环执行的本地Rust仿真后端。我们报告了Modelica标准库在各流水线阶段的量化覆盖率,同时提供了与开源参考模型在编译时和仿真时的基准测试对比。该编译器以VS Code扩展形式发布,并通过WebAssembly在浏览器中运行,支持零安装的交互式演练和自包含的HTML仿真器。端到端案例研究展示了四旋翼模型的实时软件在环控制,以及单一Modelica源在多个代数后端的部署能力。