...
Note |
---|
It is possible to lose data precision due to data type conversion |
Table of Contents | ||||
---|---|---|---|---|
|
Linear Scaling
Code Block |
---|
Register{SL,LR,HR,LE,HE} |
...
Register is the tag or register name in the end device
SL is the linear scale identifier and must appear first after the open bracket.
LR is the low raw value.
HR is the high raw value.
LE is the low engineering value.
HE is the high engineering value.
...
ScaledValue = (1000 - 0)/(4095 - 0)(100 - 0) + 0 = 24.42
To calculate raw data before sending to device:
RawValue = (ScaledValue-LoEGU)/(HiEGU-LoEGU)(HiRaw-LoRaw)+LoRaw
...
Code Block |
---|
Register{SQ,LR,HR,LE,HE} |
Validate lows are lower than highs.
Register is the tag or register name in the end device
SQ is the square root scale identifier and must appear first after the open bracket.
LR is the low raw value.
HR is the high raw value.
LE is the low engineering value.
HE is the high engineering value.
To calculate scaled data after reading from device:
Formula: ScaledValue = SQRT((Raw-LoRaw)/(HiRaw-LoRaw))*(HiEGU-LoEGU)+LoEGU
...
ScaledValue = SQRT((1000 - 0)/(4095 - 0))(100 - 0) + 0 = 49.42
To calculate raw data before sending to device:
Formula: Raw = ((Scaled-LoEGU)/(HiEGU–LoEGU))^2(HiRaw-LoRaw)+LoRaw
...
Code Block |
---|
Register{SG,Gain:Offset} |
Validate Note: Gain is must not be zero.
Register is the tag or register name in the end device
SG is the gain/offset scale identifier and must appear after the open bracket.
Gain is a multiplier.
Offset is an addition.
To calculate scaled data after reading from device:
Formula: ScaledValue = (RawValue * gain) + offset
...
ScaledValue = 1000 * 2.5 + 1 = 2501
To calculate raw data before sending to device:
Formula: RawValue = (ScaledValue - offset) / gain
...
Code Block |
---|
Register{SI:Inverse} or Register{SI} |
Validate that Item Note: The item raw value is must not be zero.
Register is the tag or register name in the end device
SI is the inverse scale identifier and must appear after the open bracket.
Inverse is a divider and is optional.
The default inverse for “{SI}” is 1. {SI} is the same as {SI:1}.
To calculate scaled data after reading from device:
Formula: ScaledValue = Inverse/RawValue
...
ScaledValue = 2/1000 = 0.002
To calculate raw data before sending to device:
Formula: RawValue = (1/ScaledValue) * Inverse
...