How to add a calibration factor or offset value to an input using automatic scaling.
Continuum Universal Input
If using the Conversion field to offset the ElecValue on an input that is using an automatic scale, the resulting value will not be calculated properly.
For this to function with an input using an automatic scale we need to setup an InfinityFunction to do the scaling for us and then add/subtract our offset from this result.
1. Create a new InfinityFunction in the controller called “IPConvert”
2. Paste the below code (between the lines) into the function and save it.
'This InfinityFunction must be called from the conversion line of the input
'This InfinityFunction will allow an offset to be applied to a universal input
'Example Conversion line in the Input - IPConvert(EngScaleTop, ElecScaleTop, EngScaleBot, ElecScaleBot, -1)
Arg 1 EngTop 'Engineering Units - Top of Scale
Arg 2 VltTop 'Voltage - Top of Scale
Arg 3 EngBot 'Engineering Units - Bottom of Scale
Arg 4 VltBot 'Voltage - Bottom of Scale
Arg 5 Offset 'Amount to Offset returned value
Numeric Slope, C
Slope = ((EngTop - EngBot) / (VltTop - VltBot))
C = EngBot + (Slope * (minimum(VltTop, maximum(ElecValue, VltBot)) - VltBot))
Return C + Offset
3. Go to your inputs on that controller that need to use this function.
4. confirm that the auto conversion fields have been set to the scale range you require.
5. type the below into the conversion field, replacing the “-0” at the end with whatever offset is required.
IPConvert(EngScaleTop, ElecScaleTop, EngScaleBot, ElecScaleBot, -0)