Skip to content

Support for measures of absolute values and for intervals (differences)

steveraysteveray edited this page Jun 17, 2024 · 7 revisions

A common error is to confuse the conversion of absolute measurements from interval measurements. For example, a temperature of 32 degrees Fahrenheit is equal to 0 degrees Celsius. But a temperature difference of 32 degrees Fahrenheit equals a temperature difference of 17.8 degrees Celsius.

Converting units on Linear Scales

Converting absolute values

Most scales are linear, described by

$$y = ax + b$$

...where $a$ is the slope, $x$ is the phenomenon being measured, and $b$ is the offset. (Also, most scales have a zero offset (Celsius and Fahrenheit being exceptions)).

Since QUDT is describing everything relative to SI units, for a given SI unit $a$ is set to $1$ and $b$ is set to zero offset, so that

$$\text{SI unit} = x$$

To convert an arbitrary unit $y$ into the SI unit, therefore, we have:

$$y = ax + b$$

$$y = a \cdot \text{SI unit} + b$$

so

$$\text{SI unit} = \frac{y - b}{a}$$

In QUDT, we define

$$\text{Conversion offset} = -b \equiv{CO}$$

and

$$\text{Conversion multiplier} = \frac{1}{a} \equiv{CM}$$

so

$$\text{SI unit} = {(y + {CO}_{y})} \cdot {CM}_y$$

To convert unit $y$ into unit $z$ therefore:

$$z = a \cdot \text{SI unit} + b$$

$$z = \frac{SI unit}{CM_z} - CO_{z}$$

$$z(y) = \frac{{(y + CO_{y})} \cdot CM_y}{CM_z} - CO_{z}$$

Converting interval values

For intervals of a unit, we are talking about $\delta y$, the incremental change of y, which is really the slope, or the first derivative of $y$. If the scale of the unit is linear, then the slope is a constant regardless of the value, and is equal to $a$, or $\frac{1}{CM_y}$.

This is why converting intervals becomes simpler for linear scales. The offsets disappear when you take the derivative:

$$\delta z = \frac{{(\delta y)} \cdot CM_y}{CM_z}$$

or

$$\frac{\delta z}{\delta y} = \frac{CM_y}{CM_z}$$

What does this mean for our ontology?

We need to be able to state whether a Quantity is a delta value or an absolute value. That is, the user needs to say if they are dealing with a delta(Quantity), because in that case conversions use the equation for $\frac{\delta z}{\delta y}$ instead of the equation for $z(y)$.

To support this, the qudt:Quantity class has a property qudt:isDeltaQuantity. It is associated with the qudt:Quantity because the quantity describes the context of the measurment. qudt:isDeltaQuantity is a boolean property to record whether the measurement is an absolute value of the Quantity instance, or a delta (or difference) value. Setting isDeltaQuantity to "true" means the measurement is an interval. isDeltaQuantity set to "false" means the measurement is an absolute value. An application can then take the appropriate action, such as in unit conversion, etc.

It should be noted that in these cases, the unit is still the same unit on the same scale. There is nothing special about the unit.

Logarithmic scales

The slope is not a constant for logarithmic or other nonlinear scales. Rather, if for example

$$y = a \cdot \log_{10} x + b$$

then

$$\frac{\delta y}{\delta x} = \frac{a}{x \ln (10)}$$

so the slope depends on the value of $x$. This is why unit conversion is not as simple for nonlinear scales. Add to this the complexity that many nonlinear scales, such as the so-called "Richter Scale" is not a simple logarithmic function, but rather a combination of dispacement of the earth and distance from the epicenter. So it becomes questionable whether unit conversion in such a case even makes sense.