1 of 22

Eclipse UOMo

Eclipse Juno Demo Camp

Manchester, UK

2 of 22

What is it?

Units of Measurement API

3 of 22

Avoiding Interface�and Arithmetic Errors

The Goal

© 2007-2011 Creative Arts & Technologies

4 of 22

Emphasis

Most of today’s technologies including the Java Language so far lack support for common non-trivial Arithmetic problems like Unit Conversions

© 2007-2011 Creative Arts & Technologies

5 of 22

What do these disasters have in common?

  • Patriot Missile�The cause was an inaccurate calculation of the time since boot due to a computer arithmetic error.
  • Ariane 5 ExplosionThe floating point number which a value was converted from had a value greater than what would be represented by a 16 bit signed integer.

© 2007-2011 Creative Arts & Technologies

6 of 22

What do these disasters have in common?

  • Gimli Glider (near miss)Fuel loading was miscalculated through misunderstanding of the recently adopted Metric System, replacing the Imperial System
  • Mars Orbiter Preliminary findings indicate that one team used English units (e.g. inches, feet and pounds) while the other used metric units for a key spacecraft operation.
    • NASA lost a $125 million Mars orbiter because a Lockheed Martin engineering team used English units of measurement while the agency's team used the more conventional metric system for a key spacecraft operation
    • This also underlines the added risk when 3rd party contractors are involved or projects are developed Offshore

© 2007-2011 Creative Arts & Technologies

7 of 22

NASA “Star Wars” Initiative, 1983

23rd March 1983. Ronald Reagan announces SDI (or “Star Wars”): ground-based and space-based systems to protect the US from attack by strategic nuclear ballistic missiles.

8 of 22

1985

Mirror on underside of shuttle

SDI Experiment: The Plan

Big mountain in Hawaii

9 of 22

1985

SDI Experiment: What really happened

10 of 22

1985: What happened?

11 of 22

Unit Tests wouldn‘t find these…

  • All previous example illustrate three categories of errors difficult to find through Unit Testing:
    • Interface Errors (e.g. millisecond/second, radian/degree, meters/feet).
    • Arithmetic Errors (e.g. overflow).
    • Conversion Errors (e.g. wrong factors or rounding)

© 2007-2011 Creative Arts & Technologies

12 of 22

Causes of Conversion Errors

  • Ambiguity on the unit
    • Gallon Dry / Gallon Liquid
    • Gallon US / Gallon UK
    • Day Sidereal / Day Calendar
    • ...�
  • Wrong conversion factors:

static final double PIXEL_TO_INCH = 1 / 72;

double pixels = inches * PIXEL_TO_INCH

© 2007-2011 Creative Arts & Technologies

13 of 22

Eclipse UOMo

One Small Step…

14 of 22

Eclipse UOMo

  • Namespace: org.eclipse.uomo.*
  • Two main areas
    • Static Type Safe Units of Measure Support
      • Based on Units of Measurement API
      • On top of ICU4J, the Globalization standard at Eclipse and others (Android, GWT, Google Financial, etc.)
    • Prime UCUM Implementation
      • Successor to Eclipse OHF UCUM Bundle

© 2007-2011 Creative Arts & Technologies

One Unit Framework to Measure them All

15 of 22

Eclipse UOMo

  • UOMo currently consists of
    • UOMo Core
      • General parts of the framework, reusable components
    • UOMo Util
      • Utility classes, Formatting, Date/Time and other ICU4J or Unicode related items
    • UOMo XML
      • XMLPull and support for Markup Languages like UnitsML, MathML or SensorML

© 2007-2011 Creative Arts & Technologies

Bundles

16 of 22

Eclipse UOMo

    • UOMo Units
      • Based on Units of Measurement API
    • UOMo UCUM
      • Unified Code for Units of Measure support
    • UOMo Business
      • Business Types and Monetary System

© 2007-2011 Creative Arts & Technologies

Bundles (2)

17 of 22

UOMo: UCUM

  • The Unified Code for Units of Measure is a code system intended to include all units of measures being contemporarily used in international science, engineering, and business.
  • The purpose is to facilitate unambiguous electronic communication of quantities together with their units.
  • The focus is on electronic communication, as opposed to communication between humans.
  • A typical application of The Unified Code for Units of Measure are electronic data interchange (EDI) protocols, but there is nothing that prevents it from being used in other types of machine communication (e.g. persistence).

© 2007-2011 Creative Arts & Technologies

Unified Code for Units of Measure

18 of 22

UOMo: UCUM Examples

© 2007-2011 Creative Arts & Technologies

UCUM String

Human Unit

Quantity

m/s

Meter per second

Length

%

Percent

None

[tbs_us]

Tablespoon (US)

Volume

mm2

Square Millimeter

Area

mL/kg/h

Millilitre per Kilogram per hour

Dose

cm[H2O]/(s.m)

Centimeter H20 per second and meter

Pulmonary pressure time product

  • It's a grammar, not a list...

  • You can define your own by combining known units (or declaring new ones)

19 of 22

DEMO

Eclipse UOMo

20 of 22

Links

Eclipse – Project UOMo

http://www.eclipse.org/uomo/

Units of Measurement API

http://www.unitsofmeasurement.org

UCUM

http://www.unitsofmeasure.org

21 of 22

Q & A

Let‘s talk

22 of 22

Contact

werner@catmedia.us

or

uomo@catmedia.us

Twitter: @wernerkeil��Hashtag #EclipseUOMo