scaling on SLC5/03

brian1

Member
Join Date
Feb 2004
Posts
6
I am trying to scale a value to read in Eng.units. I am applying 4 - 20mA into an analog card with the counts being 3277 - 16384. I ruined my brain trying to figure out the SCL function with no luck and couldn't figure out the tag scaling on the PanelView550 either so I thought I'd do it in the logic and just display the integer value on the display. I don't usually do the programming around here so I'm a little rusty on the scaling math. In short I want to take my 4 to 20 mA and display it as 0 to 100 PSI. If anyone can give me a clue I'll be forever grateful. God bless you.
Brian
 
On a 5/03 (or any A-B processor where it is available) I use the Scale With Parameters (SCP) function - it is easier to set up and modify.

In this example I have the full scale value stored in regiser N7:82. You can use a constant like 100 or 1000, but I like to be able to adjust the scaling from the operator interface in case the transmitters is replaced some day. Note that the 6242 and 31208 values are for an MicroLogix 1200 - your values should be used as appropriate. For most 5/03 applications I set up the card for engineering units, with 4000 to 20000 as 4-20 mA, but that isn't necessary.

scp.jpg
 
Last edited:
Tom Jenkins said:
In this example I have the full scale value stored in regiser N7:82. You can use a constant like 100 or 1000, but I like to be able to adjust the scaling from the operator interface in case the transmitters is replaced some day.

I like to use a data file for input min, input max, and scaled min as well as scaled max so that that versatility is there for all the parameters.
 
(( Raw counts - 3277)/ 13107)*100)= Eng. units

Although above statement is mathematically correct,
I don't think it would provide proper result.
Reason is that after dividing by 13107 you would get
maximum 1.250019 which in integer world would be
simply 1. After multiplication by 100 your reading
would be either 0 or 100psi which is probably not
exactly what you wanted.
You could try using floating point math to get
correct result or simply divide by 131.
This would mean very very small error (0.053%)
but the result would be 0-100psi.

EngUnits=(Raw counts - 3277)/131
 
Last edited:
When you are scaling anlog input to an integer value, you have to foresee that the input exceeds 4-20mA.
When the input signal is outside 4-20mA, you have to think how the program react.

In Tom Jenkins demonstration of the SCP instruction, the destination value is scaled, but not limited between 0 and the value of integer N7:82 - in this case 320.

So an input value of 3.4mA (which is a typical output from a sensor when it is in error - another error signal is typical 21mA) will result in a destination value of less than 0.
If you have limited your panel to display values between 0-100, the value is then out of range and a series of asterics (*) will be displayed.
To avoid this situation, use GRT and LES in combination with MOV.
(LES N7:0 0 MOV 0 N7:0, meaning; if N7:0 is less than 0, then move the value 0 into N7:0). If you do this, you can at the same time set a flag to display an error message.
 

Similar Topics

Hi, I have a ControlLogix system with 1756-IF16 analogue inputs. I can't scale the inputs at the card as there is a requirement to facilitate...
Replies
2
Views
39
I know nothing about simaticnet OPC server. I do know Kepware. I would only ever scale raw to engineering in the PLC, but it is possible to scale...
Replies
5
Views
212
Hi all. I'm working on a rehab and I'm trying to figure stuff out. See screenshot at the bottom. Local:5:I.Data[6] in BTD instruction is a...
Replies
6
Views
701
Hello all, First post here. Hitting a wall with finding info on this topic online, and none of my coworkers have a clue. I have a PanelView...
Replies
10
Views
1,335
Hello, We monitor the temperature of a pipe via a 4-20mA temperature transducer. This goes into DB135(Read Analog Inputs). The issue I have is the...
Replies
0
Views
624
Back
Top Bottom