Scaling in PLC 5/80

junkerjorg

Member
Join Date
Nov 2007
Location
Wisconsin
Posts
56
I am used to scaling in the SLC family, nice and easy! What are the steps to scale an analog input in a PLC 5? I assume you use the CPT statement but not really sure. Any help would be appreciated!!
 
the "long" answer to your question is available in the "Sample Lessons" area of my website - as two downloadable PDF files on scaling ... or ... just tell us the range of your INPUT data (probably 0 to 4095) and what you want the OUTPUT (scaled) data to be ... if you can also give us the addresses, we'll be glad to nail it all down for you ...

note that many of the PLC-5 analog input modules will do the scaling "on board" if you set them up right - but most programmers don't use that feature ... using something like a CPT is much more common - and often gives much better resolution ...
 
Thanks Ron, appreciate the fast response. Input 0 to 4095, scaled output of 0 to 130. Input is coming from N22:11 and needs to output to N38:41.

Thanks a million and I will check out your site!
 
since both ranges start at ZERO, it's just a ratio ...

you can use a CPT - but an MUL will execute just a little bit faster - if you're into that sort of thing ...

scale.JPG


basically the math boils down to:

130 divided by 4095 equals 0.031746032 ... the MUL won't handle the final "2" ...
 
Last edited:
I almost always use the CPT just to be consistent, in case I need a zero offset on the engineering units.

cmpt.png



Take the raw counts (0-4095) and divide them by full scale (4095),
gives you a percent full scale, multiply that by your engineering span.

If you had an offset, say your engineering scale was 30-160, you
would add the offset (30) to the end of the expression.
 
Last edited:
Ron's tutorials are absolutely fantastic, but if you will indulge me, I want to point you right back at your SLC500 for a moment - the SCP instruction is indeed "nice and easy."

If you refer to the SLC500 instruction set reference manual you'll see that behind the scenes, the SCP instruction uses the same y=mx+b equation Ron shows us in his fantastic tutorials.

The instruction set reference manual informs us that the SCP instruction first takes the Scaled_Max, Scaled_Min, Input_Max and Input_Min values and pefroms the following calculation:


m = (scaled_MAX. - scaled_MIN.) / (input_MAX. - input_MIN.)


Next, using scaled Min and Input min and the m value, it does this calculation.


b = scaled_MIN - m * input_MIN


Then it solves the y=mx + b equation like this:
(m * INPUT) + b.


You'll find this exact same method that the SCP insruction uses covered on pages 15, 27,and 28 of Ron's tutorial, I just wanted to point out that its also in the instruction set refence manual - at some point in your future you might want to refer back to it and Ron's tutorial might not be right at your finger tips.

Now if you think about it for a minute, every single time the SCP instruction executes, it calculates m and b, doing the exact same calculations over and over and over again, several hundred times a second, every second, day in and day out, year after year, and the answers to m and b never change, and b is frequently zero and doesn't need to be calculated in the first place. IOW, the SCP instruction, for all its "nice and easy" convenience, is horribly inefficient - but it has its place and I love using it myself. But as you apply the know how from Ron's tutorial, don't lament the absence of the SCP instruction too much, because there are more efficient ways to do it.

 
Last edited:

Similar Topics

I want to measure the tank level and get the sensor output to the PLC. Below are the details : Tank Height =0 - 3m, the sensor is stalled 0,2m...
Replies
15
Views
701
Hello everyone, been trying to figure this one out for awhile now. The system configuration is as follows: Processor is an L63 5563 ControlLogix...
Replies
0
Views
625
I’m trying to perfect the HMI interface for analog configuration. I’ve provided the user the same options for all analog inputs, as follows...
Replies
10
Views
1,693
Hello All, What Wil be the raw scaling range if I want to connect 0-1vdc humidity sensor. Thanks
Replies
1
Views
961
I need to scale a raw value into Engineering units. i don't think there is a standard scaling block in PLC 5 instruction set (or i didn't see...
Replies
19
Views
7,355
Back
Top Bottom