Engineering Values versus Native Values (Raw Values)

Definitions

A Variable's Engineering Value

The engineering value of a variable is the value before it is encoded for storage by the software. A frequency of 50.2Hz has an engineering value of 50.2.

A Variable's Native (Raw) Value

The native value of a variable is the value of a variable as it is stored in memory and thus may include encoding. The native value is sometimes referred to as the raw value. Consider a frequency variable that may need to describe 50.2Hz using an integer data type. Integers are not able to natively encode the decimal portion so the software designer may decide to use a fixed point representation where 1Hz has the value of 100. In this example the native value of a 50.2Hz frequency would be 5020.

Why Not Just Use Floating Point Data Types?

A variable that is assigned to a floating point type typically has an engineering value and a native value that will be the same. So why not just use floating point data types? Why go to the trouble of using fixed point representations? There are a few reasons.

This is why most of MotoHawk's crank angle domain values use an int16 data type with a x16 fixed point representation. One decimal place of resolution is sufficient, the values are not overly large, but they are used on simple processors like the S12, which does not have native floating point support and is RAM and FLASH constrained. Other processors do have more memory, but calibration memory is still limited and so using a fixed point representation for crank angle domain variables still makes sense.

Representation in Instrumentation

While there are advantages to using a fixed point representation on the embedded target, it is a major disadvantage to have to view and work with the data in this form when using instrumentation tools like MotoTune. A calibrator, for example, needs to see the engineering value of an ignition advance map. They don't want to work directly with the native values. Therefore MotoHawk offers the feature where the encoding of a variable can be defined so instrumentation can represent the value in its engineering units whilst the embedded execution operates using the native values (that are in a fixed point form).

Blocks like the Probe, Calibration and the Data Definition blocks support Gain, Offset and Exponent fields to allow the developer to define how to convert to and from an engineering value and a native value.

Note that the execution cost to convert from native to engineering values and vice versa is born by the instrumentation (which is an environment that can afford such execution).

Converting to Native values to Engineering Unit values

Engineering Value = ((Native Value * Gain)^Exponent + Offset

For example, MotoHawk crank angle variables use a x16 fixed point encoding such that a native value of 16 represents 1degCA (engineering value of 1). The Gain is 0.0625, the Offset is 0.0 and the Exponent is also 1.0 for such variables.

Converting Engineering Unit Value to Native Values

It is quite common to need to convert an engineering value into a native value like when specifying the default value of a Calibration. The following equation is used:
Native Value = ((Engineering Value - Offset) / Gain)^-Exponent