using cpt instructions for scaling

kandymann

Lifetime Supporting Member
Join Date
Jan 2011
Location
Virginia
Posts
168
Hello
I need some help. I am using 1769-IF8 analog input module to measure silo capacity. I have configured my module for engineering units (3200-21000).

My question is.... how do i convert a 4ma signl (3200) to read 0% and the same for 20ma signal (21000) to 100%. I simply cannot figure out the math. Thank you all for the help.
 
To use the CPT (Compute) instruction, you must know the math equations used with it to compute the Slope and Offset variables. Most people now use the SCP instruction, which does the math internally and you only have to input the Min and Max values for both the signal input and the scaled output.

Here are the basic equations:

Scaled Value = Input Value X Slope + Offset
Slope = (Scaled Max - Scaled Min) / (Input Max - Input Min)
Offset = Scaled Min - (Input Min X Slope)
 
Last edited:
If your card is configured for engineering units then 4ma = 4000 counts and 20ma=20000
counts.

What PLC are you using? ( CompactLogix or ML1500)
 
Thanks guys for the replys.

Ron i will try your formula. I am using logix 5000 v19 and i do not see a SCP instruction.

Any reason why?
 
http://www.plctalk.net/qanda/showthread.php?t=69309

There are examples here if searched.

Ron's method works but make sure you documented it well. I don't like sticking a * scale factor in an cpt because 1 yr from now I won't remember where I got it. Where using a interpolator is self explanatory. And is the same thing as a SCP instruction in the SLC platform.
 
Thanks guys for the replys.

Ron i will try your formula. I am using logix 5000 v19 and i do not see a SCP instruction.

Any reason why?

If anybody can answer that, they deserve a gold medal. For some absolutely STUPID reason, they chose not to include the SCP in ladder logic for the 5000 platform.

It is there as a function block, but your license needs to allow you to use function blocks.

In my opinion, Allen-Bradley really badly screwed up when they didn't include the SCP as a ladder function in 5000. You'd think after 20 revisions, they would have figured that out, but so far, no joy...
 
Sadly, Rockwell did not include the magnificent SCP instruction for CompactLogix, and the similar SCL instruction is available only as Function Block, not ladder.

However, they obviously realised their gaffe and made SCP available as an add on instruction, which you can import from the attached file.

This saves you messing about with the CPT instruction.
 
I have function block but i am by no means experienced with this particular programming language.

Rons formula works great but i would really love to see the math in order to document it.

I have one more item i need to scale and that is a belt scale. The feed rate.
4ma = 0 tons
20ma = 192 tons.

Can one of u all please show me the math. I need to document this and use these formulas for future additions.

Again. Thanks guys
 
Rons formula works great but i would really love to see the math in order to document it.

be careful what you ask for ... you can find much more than you want to know about "scaling" from the two downloads available on the Sample Lessons page of my website ... (it was so large that I broke it into two sections to make it manageable for some people's slower connections) ...

and for your latest project, try this:

input TIMES 0.012 MINUS 48 ...

or said another way ...

tons = (input * 0.012) - 48 ...
 
Last edited:
Ron

Again thanks. That formula worked like a charm. When i get home tonight i am going to read that scaling information you have if you will post me the link. I need to know how to do this. I do not like being in threse predicaments. I am really looking forward to knowing your formulas.
 
the link is included in my forum signature ... just go to the Sample Lessons page from the menu - and scroll down to the "scaling" stuff ...

tip: if you have a Texas Instruments calculator - model TI-36X - then you can solve problems like these in seconds using NO MATH ...
 
If you are using a version of RSLogix5000 that supports Add-On Instructions, than I would recommend that you go the way of using the SCP.

Reason being ... it is simple to troubleshoot, and if you are going to use it more than once, then the SCP will be available.
 

Similar Topics

I have 4 outputs which cycle off-back on, one at a time if more than 1 output shuts off I need to set an alarm I`m wanting to use the compute...
Replies
3
Views
1,879
Hello, Trying to understand the MOD in Logix 5000 when used in a CPT block. I'm familiar with MOD or modulo as a ratio or division...
Replies
6
Views
3,488
I have a need to calculate the difference between two values in percent. I tried Google and found a formula that does exactly that. I attempted to...
Replies
5
Views
2,805
Hello all L30ER, rs 5000 MINI Using a laser as redundancy for encoder for linear motion. Placement is critical. Please look over this CPT...
Replies
10
Views
3,308
I want to average a phorsphorus reading (F8:20) over an hour (4 samples/hr). Ranged 0.03 to 3.0 mg/l. I may want to increase it to 4 or an 8 hr...
Replies
15
Views
5,542
Back
Top Bottom