High-Order Acausal Models

David Broman, Peter Fritzson

Abstract

This paper introduces Higher-Order Acausal Models (HOAMs), a paradigm merging functional programming flexibility with equation-based physical modeling. By treating models as "first-class citizens" that can be passed to and returned from functions, the authors demonstrate how to build highly reusable, recursively defined, and dynamically transformed simulation libraries with significantly reduced boilerplate compared to traditional tools.

Introduction

In the domain of physical system simulation—encompassing automotive, robotics, and power grid engineering—engineers rely on Equation-Based Object-Oriented (EOO) languages like Modelica. While powerful, these languages often struggle with model transformation and reuse. For instance, programmatically swapping sub-components or creating generic arrays of components often requires complex, tool-specific scripting or rigid language constructs like Modelica’s redeclare. This paper addresses the gap between mathematical elegance and the software engineering overhead required for complex model libraries by applying higher-order functional programming concepts to acausal modeling.

Methodology

The authors present their framework using the Modeling Kernel Language (MKL). The core innovation is the implementation of Higher-Order Acausal Models (HOAMs), which are models that can be parameterized with other HOAMs, recursively composed, and treated as standard values within the language.

The standard simulation pipeline for Equation-Based Object-Oriented (EOO) models, highlighting the distinction between static elaboration and dynamic runtime.

Unlike standard modeling tools where a "model" is a static template, MKL treats a model as a value. This allows developers to define basic components (e.g., resistors, capacitors) and then use higher-order functions like composeparallel or serialize to assemble them programmatically. This shift moves the logic of model construction from external scripts or compiler settings directly into the modeling language itself.

Key Insights

  • Models as First-Class Citizens: Treating physical models (sets of Differential Algebraic Equations) as standard data types allows developers to apply proven functional patterns to system architecture.
  • Recursion over Loops: Instead of specialized for loop constructs, recursive functions are used to generate repetitive structures (e.g., a chain of springs). This is mathematically cleaner and more flexible for defining base cases and recursive steps.
  • Generic Transformations: Functions like serialize can take any model and connector type to string $N$ elements together, providing meta-modeling capabilities without requiring a complex meta-programming layer.
  • Acausal Connectivity: Models maintain their acausal nature throughout functional transformations, ensuring that signal flow direction (input vs. output) remains flexible until the final simulation phase.

Results

The paper provides a qualitative proof-of-concept by modeling a DC motor connected to a flexible shaft.

  • Conciseness: Using the serialize function, the authors generated a flexible shaft model with 120 elements using only a few lines of code.
  • Scalability: The prototype implementation successfully elaborated this recursive model into a system of 3,159 equations, proving that the functional approach can scale to industrially relevant complexity.
  • Unified Semantics: The authors demonstrate that HOAMs can replace several disparate features in languages like Modelica (such as redeclare and for-equations) with a single, unified functional mechanism.

Limitations and Future Work

Currently, HOAM transformations occur during the elaboration (compile-time) phase, meaning the model structure is fixed before simulation starts. Future work will explore structural variability, where the model could dynamically change its number of equations during runtime. Additionally, as MKL is currently untyped, a robust static type system is needed to ensure safety in large-scale engineering (e.g., preventing the connection of a mechanical flange to an electrical pin). Finally, the authors note that a full formal semantic description of how HOAMs interact with "flow" variables like force or current is still in progress.

Summary updated

BibTeX
@article{broman2009high,
  author = {David Broman and Peter Fritzson},
  title = {{High-Order Acausal Models}},
  journal = {Simul. Notes Eur.},
  year = {2009},
  doi = {10.11128/sne.19.tn.09921},
}
Figure