Conference article

Extendable Physical Unit Checking with Understandable Error Reporting

Peter Aronsson
MathCore Engineering AB, Linköping, Sweden

David Broman
Dept. of Computer & Information Science, Linköping University, Sweden

Download article

Published in: Proceedings of the 7th International Modelica Conference; Como; Italy; 20-22 September 2009

Linköping Electronic Conference Proceedings 43:105, p. 890-897

Show more +

Published: 2009-12-29

ISBN: 978-91-7393-513-5

ISSN: 1650-3686 (print), 1650-3740 (online)


Dimensional analysis and physical unit checking are important tools for helping users to detect and correct mistakes in dynamic mathematical models. To make tools useful in a broad range of domains; it is important to also support other units than the SI standard. For instance; such units are common in biochemical or financial modeling. Furthermore; if two or more units turn out be in conflict after checking; it is vital that the reported unit information is given in an understandable format for the user; e.g.; “N.m” should preferably be shown instead of “”; even if they represent the same unit. Presently; there is no standardized solution to handle these problems for Modelica models. The contribution presented in this paper is twofold. Firstly; we propose an extension to the Modelica language that makes it possible for a library designer to define both new base units and derived units within Modelica models and packets. Today this information is implicitly defined in the specification. Secondly; we describe and analyze a solution to the problem of presenting units to users in a more convenient way; based on an algorithm using Mixed Integer Programming (MIP). Both solutions are implemented; tested; and illustrated with several examples.


Dimensional analysis; unit checking; dimensions; error reporting; language design


[1] D. Broman; P. Aronsson; P. Fritzson; “Design Considerations for Dimensional Inference and Unit Consistency Checking in Modelica”; 6Th International Modelica Conference; March 3-4; 2008; Bielefeld; Germany.

[2] J. Brugård et. Al; “Creating a Bridge between Modelica and the Systems Biology Community”; 7th International Modelica Conference; Como; Italy; 2009.

[3] Peter Bunus; “Debugging Techniques for Equation-Based Languages”. Ph.D. Thesis. Department of Computer and Information Science. Linköping University. 2004.

[4] Bureau international des poids et mesures (BIPM). Le Système international d’unités; The International System of Units. Organisation intergouvermentale de la Convention du Mètre; 8th Edition.

[5] Dynasim. Dymola version 7.0 [Last access: August 23; 2009].

[6] ITI. SimulationX. [Last access: August 20; 2009].

[7] MathCore. MathModelica [Last access: August 23; 2009].

[8] Mathematica. Wolfram Research Inc. [Last access: August 23; 2009]

[9] S.-E. Mattson; H. Elmqvist; “Unit Checking and Quantity Conservation”; 6Th International Modelica Conference; March 3-4; 2008; Bielefeld; Germany.

[10] Modelica Association. “Modelica - A Unified Object-Oriented Language for Physical Systems Modeling Language Specification Version 3.1” 2009. Available from

[11] The OpenModelica Project. Available from:

[12] Systems Biology Markup Language (SBML); Available from:

Citations in Crossref