Scaling 4-20Ma rslogix5000

sparkytex

Lifetime Supporting Member
Join Date
Jun 2013
Location
Port Hardy B.C.
Posts
354
Hey guys,

Normally I have an add in instruction that does this for me but the version of RSLogix I have (borrowed laptop) doesn’t have AOI’s so I have to do it old school. I need to scale a 4-20 mA input to 0-3173. I have the analog input selected as Eng Units so it’s changed the raw data to 4000-20000.

I can’t for the life of me find my old books that show me the formula on how to scales 4 mA to 0 and 20 mA to 3173 using the 4000-20000 Eu. Can someone help me remember the formula using the CPT function to achieve this please?

Thanks in advance.

- Tex
 
just a guess but i think its

y = mx + b

but i havent actually done it that way so im not entirely sure.
 
Hello!

It is easy!
You can use linear function with two points.
For Example "X" - is your input (current 4-20ma).
"Y" - is your output.

Linear_function.png
 
I have used this formula a few times to calculate the scaling. Just thought it might help someone out there.

(Input Raw - Input Min) * ((Scaled Max - Scaled Min) / (Input Max - Input Min) + Scaled Min) = Output Value
 
I found this didn't work
(Input Raw - Input Min) * ((Scaled Max - Scaled Min) / (Input Max - Input Min) + Scaled Min) = Output Value

Changed to-
Code:
 (Input Raw - Input Min) * (Scaled Max - Scaled Min) / ((Input Max - Input Min) + Scaled Min) = Output Value
 
Last edited:
Missing parentheses have been known to cause pain and suffering, especially when you make a C on a test in Middle school and your parents find out.
 
I found this didn't work

Changed to-
(Input Raw - Input Min) * (Scaled Max - Scaled Min) / ((Input Max - Input Min) + Scaled Min) = Output Value

I am pretty sure that is not quite correct e.g. say

  • InputMin,InputMax = 4,20
  • ScaledMin,ScaledMax = 4,20
  • i.e. OutputValue should always equal InputRaw
  • So for InputRaw = 12 (half-scale):
    • (12 - 4) * (20 - 4) / ((20 - 4) + 4) = OutputValue
    • (8) * (16) / ((16) + 4) = OutputValue
    • (8 * 16) / (20) = OutputValue
    • (128) / (20) = OutputValue
    • (6.4) = OutputValue, which is not equal to the InputRaw (12)

That said, it will give correct results if [Scaled Min] is zero, and believable results of [Scaled Min] is a small fraction (1% or so) of [Scaled Max].

The correct formula is
(Input Raw - Input Min) * (Scaled Max - Scaled Min) / (Input Max - Input Min) + Scaled Min = Output
with "conventional" precedence rules (mult and div before adding; left-to-right or right-to-left for equal operator precedence), or
((Input Raw - Input Min) * (Scaled Max - Scaled Min) / (Input Max - Input Min)) + Scaled Min = Output
to eliminate more operator precedence rules as a possible issue other than parenthetical statements evaluated first and inside to outside.


I used to be amazed at the frequency at which scaling questions comes up on this forum. But then I watched a quiz competition on a twitch channel where one adult thought named "Van Golf" painted the Mona Lisa, another said the product of 19 and 11 was 201, and a third said 209 but needed the entire thirty seconds to get there.
 
Conversion Formula

Conversion Formula
( E – A ) / (B – A ) X (D – C ) + C
THE EQUATION :Conversion Formula
• E : THE KNOWN VARIBLE
• A : 1ST LOWEST SCALE VARIBLE
• B : 1ST HIGHEST SCALE VARIBLE
• C : 2ND LOWEST SCALE VARIBLE
• D : 2ND HIGHEST SCALE VARIBLE

Conversion Formula
Example
E : THE KNOWN VARIBLE = 9 PSI
A : 1ST LOWEST SCALE VARIBLE = 3 PSI
B : 1ST HIGHEST SCALE VARIBLE = 15 PSI
C : 2ND LOWEST SCALE VARIBLE = 4 MA
D : 2ND HIGHEST SCALE VARIBLE = 20MA
[ ( 9 – 3 ) / (15 – 3 ) X (20 – 4 ) + 4 ]
= 12 MA
 

Similar Topics

5069 IF8 with a 4-20ma 0-100psi, sealed fixed, no calibration, transducer attached. IF8 is scaled 4ma= 0 psi, 20ma=100psi. If over time the...
Replies
12
Views
2,568
Hello, I have looked through the archives and haven't had any luck on the basics of scaling. I'm trying to refresh myself and what formulas I can...
Replies
10
Views
2,693
Hi, im using a wago 750-455 connected to s7-300 cpu I use fc105 but the scaling is not right, the value is 20% off. Almost like the fc thinks im...
Replies
15
Views
4,308
Hello, I am seeing an issue with inaccurate tank level. It is an elliptical bottom tank with an Anderson Level sensor mounted on the bottom of...
Replies
20
Views
7,441
Hey guys, I have been having a bit of trouble with analog output scaling. I’m programming out of a compactlogix, I’m trying to output 4-20mA to a...
Replies
13
Views
3,126
Back
Top Bottom