Improved Unit Inference and Checking in Modelica
DOI:
https://doi.org/10.3384/ecp21817Keywords:
unit, Modelica, Hindley-MilnerAbstract
This paper will present a new unified algorithm for unitchecking and inference, and showing the benefits forvarious libraries.The Modelica Language supports declaring units forvariables using the SI-standard. This allows dimensionalchecking to detect possible errors in equations. The unitsfor variables make it easier to interpret, input and plottheir values. When we infer the unit of a variable we getthe same benefits also for variables without a declaredunit. We will use unit inference and checking for thecombination, even if the check is primarily a dimensionalcheck.Both dimensional checking and unit inference are alreadyimplemented in several Modelica tools, but notconsistently. The original motivation for this paper was tounderstand the different approaches, and demystify the unithandling with the goal of making it more available. Basedon that understanding this paper will also present a newunified algorithm combining the different strengths, andshowing the results for various libraries.Downloads
Published
2025-10-24
Issue
Section
Papers
License
Copyright (c) 2025 Hans Olsson

This work is licensed under a Creative Commons Attribution 4.0 International License.