The ANALOG:OFFSET parameter is an array of integer values that are subtracted from each analog measurement before the individual ANALOG:SCALE scaling factors are applied. By default a signed integer, the ANALOG:OFFSET values may be either positive or negative numbers in the range of 32768 to +32767 and can include the value of zero. However, if the ANALOG:FORMAT parameter is UNSIGNED then the ANALOG:OFFSET parameter must be interpreted as unsigned integer numbers in the range of 0 to +65537.
There must always be a one to one correspondence between the ANALOG:SCALE and ANALOG:OFFSET parameters. Both the SCALE and OFFSET parameters must exist for every analog channel up to the value stored in the ANALOG:USED parameter.
The sampled analog data is normally stored in the C3D file as signed integer values within the range of -32768 to +32767. Its worth noting at this point that the precise binary encoding method for analog data is not specified within the C3D format specification and, so long as the scaled results are correct, analog data can be stored anywhere within the range of the integer data type.
In general, the analog data is encoded over a symmetrical range (from a value of +v to v) but this is not an absolute requirement. Several software applications write the raw analog data samples as unsigned values and use the OFFSET parameter to convert them to back to signed values when the data is scaled into real-world values.
The table shown below illustrates two common encoding methods used to represent both positive and negative values in C3D files.
|
Scale |
Offset Binary |
Two's Complement |
|
+ Full Scale |
1111 1111 |
0111 1111 |
|
+ 0.75 Full Scale |
1110 0000 |
0110 0000 |
|
+ 0.50 Full Scale |
1100 0000 |
0100 0000 |
|
+ 0.25 Full Scale |
1010 0000 |
0010 0000 |
|
0 |
1000 0000 |
0000 0000 |
|
0.25 Full Scale |
0110 0000 |
1110 0000 |
|
0.50 Full Scale |
0100 0000 |
1100 0000 |
|
0.75 Full Scale |
0010 0000 |
1010 0000 |
|
Full Scale + 1 LSB |
0000 0001 |
1000 0001 |
|
Full Scale |
0000 0000 |
1000 0000 |
Figure 28 Binary data formats
Offset Binary is a simple binary count that is offset in order to represent equal magnitude over the positive and negative ranges the maximum negative range being all zeros while all ones represents the maximum positive range. The mid-range or zero is represented by setting the most significant bit, with all other bits cleared. Twos Complement Binary uses a simple binary count to represent all positive values while all negative values are stored with the most significant bit set. The Twos Complement format simplifies the interface at a machine code level but offers no advantages within the C3D format or within high-level languages. It is a common output option for many Analog to Digital Converter (ADC) devices.
Software applications must always use the OFFSET and SCALE parameters to determine data magnitude and must not assume that either OFFSET or SCALE will take any particular value.
|
ADC resolution |
Signed OFFSET |
Unsigned OFFSET |
|
8-bits |
0 |
127 |
|
12-bits |
0 |
2047 |
|
14-bits |
0 |
8191 |
|
16-bits |
0 |
32767 |
Figure 29 Typical ANALOG:OFFSET values.
Typically, an analog-to-digital converter (ADC) has 12 to 16 bits of resolution, and can capture and store analog data using signed integer values from -32768 to +32767 representing both positive and negative input signal excursions. In order for software applications to correctly translate the analog data recorded in the C3D file into real world values, the ANALOG:OFFSET and ANALOG:SCALE parameters must contain appropriate values. These are applied as shown:
real world value = (data value ANALOG:OFFSET) * ANALOG:SCALE
For example, a ±5 volt ADC with 12-bits of resolution can produce 4096 discreet samples values these may be mapped as unsigned values using the range of 0 to +4095 (in which case the OFFSET would be +2047 for a symmetrical +5 to 5 volt range, translating the ADC samples into the signed integers). They could equally well be mapped directly as signed integers in the range of 2048 to +2047 in which case the OFFSET would be 0. If the ANALOG:SCALE and OFFSET values are applied correctly, both configurations will return identical values covering the range of +5 to 5 volts.
One application of the ANALOG:OFFSET is to adjust the zero baselines for devices such as force plates that should return a zero when unloaded. In practice, force plates are notorious for drifting away from an unloaded zero value, which can lead to measurement errors in use. There are two common methods for zeroing these devices, both involve determining the measurement error during some period of unloaded sampling, by subtracting the sampled data values from the recorded ANALOG:OFFSET value. This result can then be used to reset the ANALOG:OFFSET parameters to new values (each analog channel will have a different error value here) or, can be used to adjust the sampled analog data values or correct the original offset measurement error. Both methods are in common use; both methods may run into problems if either the analog data or OFFSET parameters are close to their limits.