JMCI Java Measurement Calculus
Interface
The Java Measurement Calculus Interface project provides a framework for
performing operations on measurements, in particular physical quantities.
Last modified: October 4, 2004
Background
Say you made a temperature measurement and measured a result of 40 degrees. Then
you made another measurement and measured 80 degrees. Is the second measurement
twice as hot as the first?
The answer is... You don't have enough information to say! The answer is yes
if the units are in degrees Kelvin, but not if the units are in degrees Celsius
or degrees Fahrenheit!
In a system dealing with measurements about the physical world, the metadata
that describes the measurement value is critical to being able to make sense of
that measurement value. Seemingly simple arithmetic operations may not be so
simple once the metadata for the measurement, such as units or scale types, are
taken into consideration.
In most of today's measurement systems, the rules for properly operating on
measurement data and physical quantities are either ignored or handled
in an ad hoc manner, greatly reducing the reliability of the overall system.
We believe that the these rules, which we call the Measurement Calculus, should
be first-class infrastructures in a measurement system rather than afterthoughts
to the main program logic.
This project provides a set of APIs for representing measurements about the
physical world and for performing operations on these measurements. The
reference implementation provides basic arithmetic and logic operations on
measurement instances taking into account any available metadata. The API is
expandable through the addition of modules containing rules for other
operations.
Announcements
July 16, 2004
The white paper Measurement Calculus: It's not just arithmetic on the
numbers is now available in the document section. This is the electronic
version of the paper that was available at the JDDAC JavaOne booth.
Project Summary
The following lists of tasks are open items as of October 4, 2004 and will
be updated periodically.
| Task |
Description |
| Tidy
up the Measurement class |
- Have its javadoc tell all about
it, why it's here, how it's different from an ArgArray,
etc.
- Give it a formatter (probably
an abstract superclass, so we can have ASCII, HTML, XML, etc.
versions) -- this will output value and units, and include
uncertainty as number of digits or as +/- a number+unit.
- Make MeasMath part of the same
package. Decide whether it's a separate class or a collection of
methods on Measurement. I.e. do we have MeasMath.add(meas1,
meas2) or meas1.add(meas2)?
- Rationalize the names of the
operations: add/plus, times/mult/prod, div/quot, etc.
|
| Integrate
Measurement with Dimension and Unit so that one can force a
Measurement to accept values only in a unit (or set of units), or
only in a dimension (i.e. any unit of length). |
- Migrate from the String notion
of units.
- Define the semantics of
assignment to a Measurement: can I set the value of a
measurement which has no unit, can I change the unit without
changing the value & uncertainty, how do I state that a
measurement has a preferred unit or required dimension, etc.
|
| Write
a Unit Formatter |
The
Unit class has only a stub of a Formatter. Write this class, and
subclasses for ASCII, HTML, etc. |
| Extend
the Measurement Calculus into Timestamp, Location and Name. |
What
are the timestamp, location, and name of the average of a collection
of Measurements? This surely depends on aspects of the situation:
the timestamp, for example, should sometimes be the average,
sometimes the most recent, sometimes the smallest interval that
contains all the points. The name can be computed only if certain
conditions are met, e.g. "xyz length" divided by "xyz
time" is likely to be "xyz speed". And similarly for
locations. |
| Figure
out the semantics of dimensionless quantities. |
What
is strain/time (where strain is length/length)? Is it frequency
(i.e. strain is treated as "1")? Is it speed/length (i.e.
factor it into (length/time)/length)? Should we leave it as
strain/time? What's the right way to represent a dimension which is
not in lowest terms? How can we keep strain separate from other
dimensionless quantities (e.g. relative humidity), but still allow
them to be cast to a common parent when needed (so they can use
units like percent)? |
| For
the adventurous: figure out the semantics of specialized dimensions. |
For
example, energy can be specialized into mechanical, chemical and
electrical. Electrical energy / time is electrical power, which can
be specialized into resistive and reactive. Having separated these,
we can force different units (e.g. BTU does not get applied to
electrical energy), and different arithmetic operations (e.g.
reactive power requires a phase angle). This is well begun, but
needs finishing. In particular, products and quotients have the same
problems as dimensionless ratios, above. |
| Treatment
of uncertainty |
The
treatment of uncertainty is uneven. For addition/subtraction we
assume normal error distribution and do operations in quadrature;
for multiplication/division/exponentiation we use confidence
intervals. I'd like to have better science behind this, yet still
keep the simple cases simple. |
| Units
with fractional powers. |
We
don't allow units/dimensions with fractional powers, such as volts
per root Hertz. We want to allow this without forcing everyone to
use floating-point exponents (e.g. volume in feet^3.0). We have an
idea for this, but would like to discuss it, and need help
implementing it. |
|
Participation
At this time we are currently seeking advisory members with expertise in such
backgrounds as measurements and statistics. We are currently in the process of developing the framework for this
API and soliciting feedback on the initial implementation. A discussion forum
is available to provide a venue for communication.
We are currently seeking developers with the skills and interests listed above
to work with Project Owners to enhance the current implementation.
For more information please contact
Jerry
Liu.