Abstract
Physical quantities expressed as units of measurement (UoM) are used regularly in scientific and engineering applications. The loss of the Mars climate orbiter, attributed to a confusion between the metric and imperial unit systems, popularised the disastrous consequences of incorrectly handling measurement values. We aim to classify the many solutions that have been proposed by looking at their capabilities and computational overheads. We assume an overall view, starting with a quantity aware Software Model, and then looking at the various approaches which allow these annotations to be transferred into code. Through a formal definition of both dimension checking and UoM conversion we are able to categorise the various options with regards to the stage at which they can be undertaken, their useability, and their coverage of potential errors.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
Ali, S., Hemmati, H., Holt, N.E., Arisholm, E., Briand, L.C.: Model transformations as a strategy to automate model-based testing-a tool and industrial case studies. Simul. Res. Lab. Tech. Rep. 2010–01, 1–28 (2010)
Allen, E., Chase, D., Luchangco, V., Maessen, J.-W., Steele, G.L.: Object-oriented units of measurement. In: Proceedings of Object-oriented Programming, Systems, Languages, and Applications, OOPSLA 2004, pp. 384–403, NY, USA. ACM (2004)
Antoniu, T., Steckler, P.A., Krishnamurthi, S., Neuwirth, E., Felleisen, M.: Validating the unit correctness of spreadsheet programs. In: Proceedings of Software Engineering, ICSE 2004, pp. 439–448, Washington, DC, USA. IEEE Computer Society (2004)
Apple. Swift open source. Online https://swift.org (2020). Accessed 15 Apr 2020
Bekolay, T.: A comprehensive look at representing physical quantities in python. In: Scientific Computing with Python (2013)
Bennich-Björkman, O., McKeever., S.: The next 700 unit of measurement checkers. In: Proceedings of Software Language Engineering, SLE 2018, pp. 121–132, NY, USA. Association for Computing Machinery (2018)
Bureau International des Poids et Mesures. SI Brochure: the international system of units (SI), 9th Edition, Dimensions of Quantities. Online https://www.bipm.org (2019). Accessed 15 Apr (2020)
Burgueño, L., Mayerhofer, T., Wimmer, M., Vallecillo, A.: Specifying quantities in software models. Inf. Softw. Technol. 113, 82–97 (2019)
Cavarra, A., Crichton, C., Davies, J., Hartman, A., Jeron, T., Mounier, L.: Using UML for automatic test generation. In: Proceedings of ISSTA, 01 (2002)
Chen, F., Rosu, G., Prasad Venkatesan, R.: Rule-based analysis of dimensional safety, In: RTA (2003)
Cooper, J., McKeever, S.: A model-driven approach to automatic conversion of physical units. Softw. Pract. Exper. 38(4), 337–359 (2008)
Damevski, K.: Expressing measurement units in interfaces for scientific component software. In: Proceedings of Component-Based High Performance Computing, CBHPC 2009, pp. 13:1–13:8, NY, USA. ACM (2009)
Henning, D.: Units of measurement validator for C#. Online https://www.codeproject.com/Articles/413750/Units-of-Measure-Validator-for-Csharp (2021). Accessed 25 Oct 2021
Dreiheller, A., Mohr, B., Moerschbacher, M.: Programming pascal with physical units. SIGPLAN Notes 21(12), 114–123 (1986)
Marcus Foster and Sean Tregeagle. Physical-type correctness in scientific python (2018)
Foster, M.P.: Quantities, units and computing. Comput. Stand. Interfaces 35, 529–535 (2013)
Fowler, M.: Analysis Patterns: Reusable Objects Models. Addison-Wesley Longman Publishing Co. Inc., Boston, MA, USA (1997)
Garny, A., et al.: CellML and associated tools and techniques. Philosophical Transactions of the Royal Society, A: Mathematical, Physical and Engineering Sciences, 366 (2008)
Gehani, N.: Units of measure as a data attribute. Comput. Lang. 2(3), 93–111 (1977)
Gibson, J.P., Méry, D.: Explicit modelling of physical measures: from Event-B to Java. In: International Workshop on Handling IMPlicit and EXplicit knowledge in formal system development (2017)
Hall, B.D.: Software for calculation with physical quantities. In: 2020 IEEE International Workshop on Metrology for Industry 4.0 IoT, pp. 458–463 (2020)
Hartmann, J., Vieira, M., Foster, H., Ruder, A.: A UML-based approach to system testing. Innov. Syst. Softw. Eng. 1, 12–24 (2005)
Hayes, I.J., Mahony, B.P.: Using units of measurement in formal specifications. Formal Aspects Comput. 7(3), 329–347 (1995)
Hilfinger, P.N.: An ada package for dimensional analysis. ACM Trans. Program. Lang. Syst. 10(2), 189–203 (1988)
Hills, M., Feng, C., Grigorem, R.: A rewriting logic approach to static checking of units of measurement in C. Electron. Notes Theor. Comput. Sci. 290, 51–67 (2012)
Jiang, L., Su, Z.: Osprey: a practical type system for validating dimensional unit correctness of C programs. In: Proceedings of the 28th International Conference on Software Engineering, ICSE 2006, pp. 262–271, New York, NY, USA. ACM (2006)
Joint Committee for Guides in Metrology (JCGM). International Vocabulary of Metrology, Basic and General Concepts and Associated Terms (VIM). Online https://www.bipm.org/en/about-us/ (2012). Accessed 15 Apr 2020
Jørring, U., Scherlis, W.L.: Compilers and staging transformations. In: Proceedings of the 13th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, POPL 1986, pp. 86–96, New York, NY, USA. Association for Computing Machinery (1986)
Karr, M., Loveman, D.B.: Incorporation of units into programming languages. Commun. ACM 21(5), 385–391 (1978)
Kasurinen, J., Taipale, O., Smolander, K.: Software test automation in practice: empirical observations. Adv. Softw. Eng. 2010, 01 (2010)
Kennedy, A.: Dimension types. In: Sannella, D. (ed.) ESOP 1994. LNCS, vol. 788, pp. 348–362. Springer, Heidelberg (1994). https://doi.org/10.1007/3-540-57880-3_23
Kennedy, A.: Types for units-of-measure: theory and practice. In: Central European Functional Programming School - Third Summer School, CEFP 2009, Budapest, Hungary, May 21–23, 2009 and Komárno, Slovakia, May 25–30, 2009, Revised Selected Lectures, pp. 268–305 (2009)
Krisper, M., Iber, J., Rauter, T., Kreiner, C.: Physical quantity: towards a pattern language for quantities and units in physical calculations. In: Proceedings of Pattern Languages of Programs, EuroPLoP 2017, pp. 9:1–9:20, NY, USA. ACM (2017)
Lungu, M.: Towards reverse engineering software ecosystems. In: 2008 IEEE International Conference on Software Maintenance, pp. 428–431 (2008)
Mayerhofer, T., Wimmer, M., Vallecillo, A.: Adding uncertainty and units to quantity types in software models. In Software Language Engineering, SLE 2016, pp. 118–131, NY, USA. ACM (2016)
McKeever, S.: From quantities in software models to implementation. In: Proceedings of the 9th International Conference on Model-Driven Engineering and Software Development - MODELSWARD, pp. 199–206. INSTICC, SciTePress (2021)
McKeever, S.: Discerning quantities from units of measurement. In: Proceedings of the 10th International Conference on Model-Driven Engineering and Software Development - MODELSWARD, pp. 105–115, Portugal. INSTICC, SciTePress (2022)
McKeever, S., Bennich-Björkman, O., Salah, O.-A.: Unit of measurement libraries, their popularity and suitability. Practice and Experience, Software (2020)
McKeever, S., Paçaci, G., Bennich-Björkman, O.: Quantity checking through unit of measurement libraries. Current status and future directions. In: Model-Driven Engineering and Software Development, MODELSWARD (2019)
Microsoft. F# software foundation. Online https://fsharp.org (2020). Accessed 15 Apr (2020)
Milner, R.: A theory of type polymorphism in programming. J. Comput. Syst. Sci. 17, 348–375 (1978)
Modelica. The Modelica Association. Online https://www.modelica.org (2020). Accessed 15 Apr 2020
Mussa, M., Ouchani, S., Sammane, W., Hamou-Lhadj, A.: A survey of model-driven testing techniques. In: Proceedings - International Conference on Quality Software, pp. 167–172, 08 (2009)
NIST. International System of Units (SI): base and derived. Online https://physics.nist.gov/cuu/Units/units.html (2015). Accessed 02 Oct 2019
Ore, J.-P., Detweiler, C., Elbaum, S.: Lightweight detection of physical unit inconsistencies without program annotations. In: Proceedings of International Symposium on Software Testing and Analysis, ISSTA 2017, pp. 341–351, NY, USA. ACM (2017)
Ore, J.-P., Detweiler, C., Elbaum, S.: Phriky-Units: a lightweight, annotation-free physical unit inconsistency detection tool. In: Software Testing and Analysis, ISSTA 2017, pp. 352–355, NY, USA. Association for Computing Machinery (2017)
Ore, J.-P., Elbaum, S., Detweiler, C.: Dimensional inconsistencies in code and ROS messages: a study of 5.9 m lines of code. In: Intelligent Robots and Systems, IROS, pp. 712–718. IEEE (2017)
Ore, J.-P., Elbaum, S., Detweiler, C., Karkazis, L.: Assessing the type annotation burden. In: Automated Software Engineering, ASE 2018, pp. 190–201, NY, USA. ACM (2018)
Salah, O.-A., McKeever, S.: Lack of adoption of units of measurement libraries: survey and anecdotes. In: Proceedings of Software Engineering in Practice, ICSE-SEIP 2020. ACM, May (2020)
Selic, B.: Beyond mere logic: A vision of modeling languages for the 21st century. In: Pervasive and Embedded Computing and Communication Systems (PECCS), pp. IS-9-IS-9 (2015)
Sonin, A.A.: The physical basis of dimensional analysis, Technical report. Massachusetts Institute of Technology (2001)
Stephenson, A., et al.: Mars climate orbiter mishap investigation board phase 1 report (1999). Accessed 01 Oct 2019
TIOBE. The importance of being earnest index. Online https://www.tiobe.com/tiobe-index/, 2022. Last Accessed on 2nd of October
Wand, M., O’Keefe, P.: Automatic dimensional inference. In: Computational Logic - Essays in Honor of Alan Robinson, pp. 479–483 (1991)
Witkin, R.: Jet’s fuel ran out after metric conversion errors. The New York Times, July (1983)
Xiang, T., Luo, J.Y., Dietl, W.: Precise inference of expressive units of measurement types. Proc. ACM Program. Lang., 4(OOPSLA), November (2020)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
A Staging Unit Conversions Proof
A Staging Unit Conversions Proof
-
Case for variables:
-
Case for addition:
The cases for the remaining multiplication rules are similar to that for addition.
Rights and permissions
Copyright information
© 2023 Springer Nature Switzerland AG
About this paper
Cite this paper
McKeever, S. (2023). Acknowledging Implementation Trade-Offs When Developing with Units of Measurement. In: Pires, L.F., Hammoudi, S., Seidewitz, E. (eds) Model-Driven Engineering and Software Development. MODELSWARD MODELSWARD 2021 2022. Communications in Computer and Information Science, vol 1708. Springer, Cham. https://doi.org/10.1007/978-3-031-38821-7_2
Download citation
DOI: https://doi.org/10.1007/978-3-031-38821-7_2
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-38820-0
Online ISBN: 978-3-031-38821-7
eBook Packages: Computer ScienceComputer Science (R0)