Journal article icon

Journal article

A model−driven approach to automatic conversion of physical units

Abstract:
When physical quantities are used in programs they are typically represented as raw numbers, with the units in which they were measured only being given in comments, if at all. This can lead to errors from the use of dimensionally inconsistent expressions, or the comparison of two quantities of the same dimension but measured in different units, which are not discovered until run time. Any program working with the physical world has this issue, with scientific modelling being a major application. Implementors of models have the time consuming and error-prone task of adding in dynamic units checks and conversions manually. Most existing programming languages do not provide support for representing units explicitly (although extensions to some have been proposed). With the advent of domain specific modelling languages, incorporating code generation techniques, we propose checking physical units at the level of the modelling language, removing the need for such support in the underlying implementation language. We present our work in the context of one such modelling language: CellML, developed at the University of Auckland with a focus on modelling biological systems. We have developed an intuitive algorithm for performing automatic conversions between quantities measured in different units. It both requires fewer conversion operations than current approaches, and makes more sensible choices about which quantities to convert. Uniquely, by using partial evaluation techniques it is also capable of dealing robustly with quantities raised to arbitrary powers, even where the exponent is given by an expression. We demonstrate our algorithm on various examples.

Actions


Access Document


Publisher copy:
10.1002/spe.828

Authors



Journal:
Softw. Pract. Exper. More from this journal
Volume:
38
Issue:
4
Pages:
337-359
Publication date:
2008-01-01
DOI:
ISSN:
0038-0644


UUID:
uuid:b5a18a68-ec0a-49ed-85c5-ae3074e9d73d
Local pid:
cs:2137
Deposit date:
2015-03-31

Terms of use



Views and Downloads






If you are the owner of this record, you can report an update to it here: Report update to this record

TO TOP