Nothing Special   »   [go: up one dir, main page]

Skip to main content

Acknowledging Implementation Trade-Offs When Developing with Units of Measurement

  • Conference paper
  • First Online:
Model-Driven Engineering and Software Development (MODELSWARD 2021, MODELSWARD 2022)

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 59.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 79.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    https://www.omg.org/omgmarte/.

  2. 2.

    https://sysml.org.

  3. 3.

    http://github.com/boostorg/units.

References

  1. 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)

    Google Scholar 

  2. 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)

    Google Scholar 

  3. 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)

    Google Scholar 

  4. Apple. Swift open source. Online https://swift.org (2020). Accessed 15 Apr 2020

  5. Bekolay, T.: A comprehensive look at representing physical quantities in python. In: Scientific Computing with Python (2013)

    Google Scholar 

  6. 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)

    Google Scholar 

  7. 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)

  8. Burgueño, L., Mayerhofer, T., Wimmer, M., Vallecillo, A.: Specifying quantities in software models. Inf. Softw. Technol. 113, 82–97 (2019)

    Article  Google Scholar 

  9. Cavarra, A., Crichton, C., Davies, J., Hartman, A., Jeron, T., Mounier, L.: Using UML for automatic test generation. In: Proceedings of ISSTA, 01 (2002)

    Google Scholar 

  10. Chen, F., Rosu, G., Prasad Venkatesan, R.: Rule-based analysis of dimensional safety, In: RTA (2003)

    Google Scholar 

  11. Cooper, J., McKeever, S.: A model-driven approach to automatic conversion of physical units. Softw. Pract. Exper. 38(4), 337–359 (2008)

    Article  Google Scholar 

  12. 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)

    Google Scholar 

  13. 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

  14. Dreiheller, A., Mohr, B., Moerschbacher, M.: Programming pascal with physical units. SIGPLAN Notes 21(12), 114–123 (1986)

    Article  Google Scholar 

  15. Marcus Foster and Sean Tregeagle. Physical-type correctness in scientific python (2018)

    Google Scholar 

  16. Foster, M.P.: Quantities, units and computing. Comput. Stand. Interfaces 35, 529–535 (2013)

    Article  Google Scholar 

  17. Fowler, M.: Analysis Patterns: Reusable Objects Models. Addison-Wesley Longman Publishing Co. Inc., Boston, MA, USA (1997)

    Google Scholar 

  18. Garny, A., et al.: CellML and associated tools and techniques. Philosophical Transactions of the Royal Society, A: Mathematical, Physical and Engineering Sciences, 366 (2008)

    Google Scholar 

  19. Gehani, N.: Units of measure as a data attribute. Comput. Lang. 2(3), 93–111 (1977)

    Article  MATH  Google Scholar 

  20. 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)

    Google Scholar 

  21. 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)

    Google Scholar 

  22. Hartmann, J., Vieira, M., Foster, H., Ruder, A.: A UML-based approach to system testing. Innov. Syst. Softw. Eng. 1, 12–24 (2005)

    Article  Google Scholar 

  23. Hayes, I.J., Mahony, B.P.: Using units of measurement in formal specifications. Formal Aspects Comput. 7(3), 329–347 (1995)

    Article  Google Scholar 

  24. Hilfinger, P.N.: An ada package for dimensional analysis. ACM Trans. Program. Lang. Syst. 10(2), 189–203 (1988)

    Article  Google Scholar 

  25. 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)

    Article  Google Scholar 

  26. 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)

    Google Scholar 

  27. 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

  28. 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)

    Google Scholar 

  29. Karr, M., Loveman, D.B.: Incorporation of units into programming languages. Commun. ACM 21(5), 385–391 (1978)

    Article  Google Scholar 

  30. Kasurinen, J., Taipale, O., Smolander, K.: Software test automation in practice: empirical observations. Adv. Softw. Eng. 2010, 01 (2010)

    Article  Google Scholar 

  31. 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

    Chapter  Google Scholar 

  32. 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)

    Google Scholar 

  33. 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)

    Google Scholar 

  34. Lungu, M.: Towards reverse engineering software ecosystems. In: 2008 IEEE International Conference on Software Maintenance, pp. 428–431 (2008)

    Google Scholar 

  35. 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)

    Google Scholar 

  36. 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)

    Google Scholar 

  37. 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)

    Google Scholar 

  38. McKeever, S., Bennich-Björkman, O., Salah, O.-A.: Unit of measurement libraries, their popularity and suitability. Practice and Experience, Software (2020)

    Google Scholar 

  39. 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)

    Google Scholar 

  40. Microsoft. F# software foundation. Online https://fsharp.org (2020). Accessed 15 Apr (2020)

  41. Milner, R.: A theory of type polymorphism in programming. J. Comput. Syst. Sci. 17, 348–375 (1978)

    Article  MathSciNet  MATH  Google Scholar 

  42. Modelica. The Modelica Association. Online https://www.modelica.org (2020). Accessed 15 Apr 2020

  43. 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)

    Google Scholar 

  44. NIST. International System of Units (SI): base and derived. Online https://physics.nist.gov/cuu/Units/units.html (2015). Accessed 02 Oct 2019

  45. 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)

    Google Scholar 

  46. 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)

    Google Scholar 

  47. 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)

    Google Scholar 

  48. 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)

    Google Scholar 

  49. 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)

    Google Scholar 

  50. 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)

    Google Scholar 

  51. Sonin, A.A.: The physical basis of dimensional analysis, Technical report. Massachusetts Institute of Technology (2001)

    Google Scholar 

  52. Stephenson, A., et al.: Mars climate orbiter mishap investigation board phase 1 report (1999). Accessed 01 Oct 2019

    Google Scholar 

  53. TIOBE. The importance of being earnest index. Online https://www.tiobe.com/tiobe-index/, 2022. Last Accessed on 2nd of October

  54. Wand, M., O’Keefe, P.: Automatic dimensional inference. In: Computational Logic - Essays in Honor of Alan Robinson, pp. 479–483 (1991)

    Google Scholar 

  55. Witkin, R.: Jet’s fuel ran out after metric conversion errors. The New York Times, July (1983)

    Google Scholar 

  56. Xiang, T., Luo, J.Y., Dietl, W.: Precise inference of expressive units of measurement types. Proc. ACM Program. Lang., 4(OOPSLA), November (2020)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Steve McKeever .

Editor information

Editors and Affiliations

A Staging Unit Conversions Proof

A Staging Unit Conversions Proof

  • Case for variables:

    figure p
  • Case for addition:

    figure q

The cases for the remaining multiplication rules are similar to that for addition.

Rights and permissions

Reprints and permissions

Copyright information

© 2023 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics