The document discusses the Mars Climate Orbiter mission, which failed due to a mix-up between metric and imperial units. It suggests that using JSR-385, a Java specification request for a units of measurement API, could have prevented this error. JSR-385 provides a standard library for defining and working with physical quantities and units that avoids issues with primitive types. The document provides an overview of key concepts in JSR-385 like dimensions, units, quantities, and systems of units.
4. Mars Climate
Orbiter
ā¢ Launched on 11
December 1998āØ
ā¢ 338 kilogramsāØ
ā¢ $125 millionsāØ
ā¢ To study Martian
climate, atmosphere
and surface changes
@thodorisbais@wernerkeil
8. Mars Climate Orbiter
āThe problem here was not the error; it was the
failure of NASAās systems engineering, and the
checks and balances in our process, to detect the
error. Thatās why we lost the spacecraft.ā
Edward WeilerāØ
NASA associate administrator of space science,āØ
IEEE Spectrum: Why the Mars Probe went oļ¬ course
@thodorisbais@wernerkeil
12. What is the Fundamental
Problem?
Primitive (Java) types are primitive types
@thodorisbais@wernerkeil
13. What is the Fundamental Problem?
Primitive (Java) types are primitive types
ā¢ static final double C = 1079252849;āØ
ā¢ static final double SPEED_OF_LIGHT = 1079252849;āØ
ā¢ static final double SPEED_OF_LIGHT_IN_KM_PER_H = 1079252849;
@thodorisbais@wernerkeil
static final Quantity<SPEED> SPEED_OF_LIGHT =
Quantities.getQuantity(1079252849, Units.KILOMETRE_PER_HOUR);
14. Rolling your Own Library
ā¢ Development
ā¢ Maintenance
ā¢ Upgrades & extensions
@thodorisbais@wernerkeil
15. Werner Keil Thodoris Bais
Spec Lead JSR-385 Expert Group Member JSR-385
Letās meet
@thodorisbais@wernerkeil
20. Write a program to calculate the BMI of a person
Exercise description
BMI is a person's weight in kilograms (kg) divided by his or her height in meters squared
@thodorisbais@wernerkeil
21. Setting up a project
<dependencies>
<dependency>
<groupId>tech.units</groupId>
<artifactId>indriya</artifactId>
<version>2.0.1</version>
</dependency>
</dependencies>
@thodorisbais@wernerkeil
23. āWikipedia
āA physical quantity is a physical property of a phenomenon, body,
or substance, that can be quantiļ¬ed by measurement.ā
Deļ¬nition of a Physical Quantity
@thodorisbais@wernerkeil
24. Speed of Light
c = 299,792,458 m/s
Value Unit
@thodorisbais@wernerkeil
34. Dimensions
ā¢ L: length
ā¢ T: time
ā¢ M: mass
ā¢ I: electric current
ā¢ Ī: thermodynamic temperature
ā¢ N: amount of substance
ā¢ J: luminous intensity
ā¢ (1)
Force: L Ā· M Ā· T-2
@thodorisbais@wernerkeil
39. DevoxxUA School
November Exam on Maths
How much is 0 Ā°C + 0 Ā°C?
ā¢ 0 Ā°C
ā¢ 0 Ā°C
ā¢ 273.15 Ā°C
Two absolute temperatures
0 Ā°C + 0 Ā°C = 273.15K + 273.15K
= 546.30K
= 273.15 Ā°C
@thodorisbais@wernerkeil
40. How much is 0 Ā°C + 0 Ā°C?
ā¢ 0 Ā°C
ā¢ 0 Ā°C
ā¢ 273.15 Ā°C
An absolute temperature and a temperature change
0 Ā°C + 0 Ā°C = 273.15K + 0K
= 273.15K
= 0 Ā°C
@thodorisbais@wernerkeil
DevoxxUA School
November Exam on Maths
41. How much is 0 Ā°C + 0 Ā°C?
ā¢ 0 Ā°C
ā¢ 0 Ā°C
ā¢ 273.15 Ā°C
Two temperature changes
0 Ā°C + 0 Ā°C = 0K + 0K
= 0K
= 0 Ā°C
@thodorisbais@wernerkeil
DevoxxUA School
November Exam on Maths
42. How much is 0 Ā°C + 0 Ā°C?
273.15 Ā°C (546.30 K)
0 Ā°C + 0 Ā°C = 0 Ā°C (273.15 K)
0 Ā°C (0 K)
Answer
@thodorisbais@wernerkeil
DevoxxUA School
November Exam on Maths
43. Multiplication
Units
ā¢kg Ć m = kgĀ·m
ā¢kg Ć mm = kgĀ·mm
ā¢g Ć km = gĀ·km ā kgĀ·m
ā¢m Ć m = m2
ā¢km Ć km = km2
ā¢mm Ć km = mmĀ·km ā m2
ā¢Āµm Ć m = ĀµmĀ·m ā mm2
Quantities
ā¢2 kg Ć 3 m = 6 kgĀ·m
@thodorisbais@wernerkeil
DevoxxUA School
November Exam on Maths
44. Division
Units
ā¢kg / m = kgĀ·m-1
ā¢kg / mm = kgĀ·mm-1
ā¢g / mm = gĀ·mm-1 ā kgĀ·m-1
ā¢m2 / m = m
ā¢m / m = 1
ā¢km / km = 1
ā¢km / m = km/m ā 1k
Quantities
ā¢ 3 kg / 2 m = 1.5 kgĀ·m-1
@thodorisbais@wernerkeil
DevoxxUA School
November Exam on Maths
45. Powers
Units
ā¢(m)2 = m2āØ
ā¢(km)2 = km2
ā¢(m2)2 = m4
Quantities
ā¢ (3 m)2 = 9 m2
ā¢
@thodorisbais@wernerkeil
DevoxxUA School
November Exam on Maths
46. Celsius Revisited
Units
ā¢(K)2 = K2āØ
ā¢(Ā°C)2 ā (K - 273.15)2
ā¢m Ć Ā°C ā mĀ·(K - 273.15)
Quantities
ā¢0 Ā°C2 ā 74,610.9225 K2
ā¢1 mĀ°C ā 1 mK or 273.151K
@thodorisbais@wernerkeil
DevoxxUA School
November Exam on Maths
48. Systems of Unit
Systems of UnitSystems of Unit
ā¢ Metric System
ā¢ Imperial System
ā¢ US customary units
ā¢ Roman units of measurement
ā¢Norwegian Units of Measurement
@thodorisbais@wernerkeil
50. What Was the Fundamental
Problem Again?
Primitive (Java) types are primitive types
@thodorisbais@wernerkeil
51. JSR-385 Current Status
ā¢ JCP page
ā¢ https://jcp.org/en/jsr/detail?id=385
ā¢ GitHub repositories
ā¢ https://github.com/unitsofmeasurement
ā¢ Current status
ā¢ Final Release
@thodorisbais@wernerkeil