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 off course
@thodorisbais@wernerkeil
12. 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);
13. Rolling your Own Library
• Development
• Maintenance
• Upgrades & extensions
@thodorisbais@wernerkeil
14. Werner Keil Thodoris Bais
Spec Lead JSR-385 Expert Group Member JSR-385
Let’s meet
@thodorisbais@wernerkeil
19. 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
20. Setting up a project
<dependencies>
<dependency>
<groupId>tech.units</groupId>
<artifactId>indriya</artifactId>
<version>2.0.2</version>
</dependency>
</dependencies>
@thodorisbais@wernerkeil
22. –Wikipedia
“A physical quantity is a physical property of a phenomenon, body,
or substance, that can be quantified by measurement.”
Definition of a Physical Quantity
@thodorisbais@wernerkeil
23. Speed of Light
c = 299,792,458 m/s
Value Unit
@thodorisbais@wernerkeil
25. Speed of Light
c = 299,792,458 m/s
= 1,079,252,849 km/h
@thodorisbais@wernerkeil
26. 1. Define two quantities
a. A mass
b. A length
2. Print them out
Useful classes:
•tech.units.indriya.quantity.Quantities
•getQuantity(java.lang.Number value, javax.measure.Unit unit)
•tech.units.indriya.unit.Units
•javax.measure.Quantity
•javax.measure.quantity.Mass
Exercise Time
@thodorisbais@wernerkeil
27. • Divide the mass by the square of the height
• Print out the result
Exercise Time
@thodorisbais@wernerkeil
28. • Parse mass and height from a String
Exercise Time
@thodorisbais@wernerkeil
35. 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
41. Adorsys School
January 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
42. 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
Adorsys School
January Exam on Maths
43. 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
Adorsys School
January Exam on Maths
44. 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
Adorsys School
January Exam on Maths
45. 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
Adorsys School
January Exam on Maths
46. 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
Adorsys School
January Exam on Maths
47. Powers
Units
•(m)2 = m2
•(km)2 = km2
•(m2)2 = m4
Quantities
• (3 m)2 = 9 m2
•
@thodorisbais@wernerkeil
Adorsys School
January Exam on Maths
48. 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
Adorsys School
January Exam on Maths
50. •299,792,458 m/s
•299792458 m/s
•299792.458 km/s
•299,792.458 km/s
•299,792,458 km*s-1
• 299,792.458 km×s-1
•299,792.458 km·s-1
•299,792.458 km·s⁻¹
•299,792.458 km*s^-1
•1,079,252,849 km/h
•1,079,252,849 km/t
• 670,616,629 mph
Speed of Light
@thodorisbais@wernerkeil
51. Systems of UnitSystems of Unit
• Metric System
• Imperial System
• US customary units
• Roman units of measurement
•Norwegian Units of Measurement
@thodorisbais@wernerkeil
53. What Was the Fundamental
Problem Again?
Primitive (Java) types are primitive types
@thodorisbais@wernerkeil
54. JSR-385 Current Status
• JCP page
• https://jcp.org/en/jsr/detail?id=385
• GitHub repositories
• https://github.com/unitsofmeasurement
• https://github.com/thodorisbais/jsr385-examples
• Current status
• Final Release
@thodorisbais@wernerkeil