# AI setting for ranges 4…20 mA

For analog inputs, the conversion is set in the IDE using the parameters KP and QP, by which the "raw" input value of voltage or current measured by the module will be converted into the measured physical quantity. For the range 0…10 V or 0…20 mA, where the conversion input is voltage or current in V or mA, and the physical quantity has a range of 0…x, it is quite simple. A linear transformation is used, which is expressed by the equation

y = KP * x + QP,

where y - output value of the transformation,
x - transformed value (input voltage, current).

Example for a CO2 sensor with a range of 0…5000 ppm and a voltage output of 0…10 V:
KP = 500Q
P = 0
thus, for example, a 5 V signal represents a value of 500 * 5 + 0 = 2500 ppm.

For current ranges of 4… 20 mA we have to solve a system of two equations "real = KP * measured + QP"so, for example, for a pressure sensor with an output of 4… 20 mA and a range of 0… 6 bar:
0 = KP * 4 + QP
6 = KP * 20 + QP
—————-
Subtract the equations from each other:
6 = KP * 16
and thus KP = 0.375
Substitute into the first equation and get QP:
QP = - KP * 4 = -1.5

In SoftPLC we fill in the coefficients KP = 0.375 and QP = -1.5.

I remind you that the range set in the SoftPLC IDE must correspond to the range set in the module (the module must be configured using ModComTool or converter mode from IDE) and if we measure current, it is necessary to activate the appropriate parallel resistor switch for the input. If we want to use voltage inputs that do not have a switching resistor for current measurement, it is possible to externally connect a 125 Ohm resistor in parallel to the input with the highest possible accuracy.