I'm not sure of a scaling I did. I have a underpressuresensor that measures between -1 and 0 bar. Given by the sensor in 4-20mA.
This goes into a 0-20mA analogue input on a frequency drive (so that we don't need to use a plc analogue input-card.
This is what I did to scale it:
So, Integervalue from drive is not 0-27648 like in a PLC, but 0-16384.
So 20mA = 16384. deviding 20 by 5 gives us 4mA, so 16384 / 5 = 3276,8 this is the value that stands for 4mA.
So the range is 16mA, not 20. 16384 - 3276,8 = 13107,2 (range in integervalue
So what I did is:
(Measured value (0-16384) - 3276,8 (4mA)) / 13107,2
Now I have the measurement scaled into 0..1 bar.
But it has to be -1..0 bar, so:
((Measured value (0-16384) - 3276,8 (4mA)) / 13107,2) -1
Did I scale it well ? I have my doubts, therefor this POST
This goes into a 0-20mA analogue input on a frequency drive (so that we don't need to use a plc analogue input-card.
This is what I did to scale it:
Code:
L #PCD_RECV3
ITD
DTR
L 3.276800e+003 // INT waarde bij 4mA
-R
L 1.310720e+004
/R // Range 0..1
L 1.000000e+000
-R // Meetbereik -1..0 bar
T #Onderdruk
So, Integervalue from drive is not 0-27648 like in a PLC, but 0-16384.
So 20mA = 16384. deviding 20 by 5 gives us 4mA, so 16384 / 5 = 3276,8 this is the value that stands for 4mA.
So the range is 16mA, not 20. 16384 - 3276,8 = 13107,2 (range in integervalue
So what I did is:
(Measured value (0-16384) - 3276,8 (4mA)) / 13107,2
Now I have the measurement scaled into 0..1 bar.
But it has to be -1..0 bar, so:
((Measured value (0-16384) - 3276,8 (4mA)) / 13107,2) -1
Did I scale it well ? I have my doubts, therefor this POST