rslogix5000 intruction help

sparkytex

Lifetime Supporting Member
Join Date
Jun 2013
Location
Port Hardy B.C.
Posts
354
So I got the controller and modules configured and i'm currently working on the ladder logic for my chiller program. This rslogix5000 is completely different then what im used to (rslogix5). basically what I have is a temperature transmitter that's scale is 0 to 20 degrees. 0 degrees being 4 mA and 20 degrees being 20 mA. I hooked up a signal generator to my analog module so I can figure this out. at 4 mA in the controller tags under local:1:I.ch0data it shows an integer of 6243 at 4 mA and 18891 at 12 mA and 31325 at 20 mA. In the rslogix5 I would do a cpt function i.e. (word)*(.008-5)and put the desination as an integer bit. here's what needs to happen, theres a 3 position valve and a by pass pump and a temperature transmitter. when the incoming lake water to the chiller goes below 13 degrees c, I need the bypass pump to be energized and valve in open posistion, and any thing over 14 degrees the pump de-energizes and the valve closes. should I do a cpt instruction followed by a less than function to energize the pump? I have the cpt function started but I don't know how to store the destination as an integer bit so I can use that in my less than instruction. is there an easier way to scale the analog incoming in the controller tags?
 
The CompactLogix analog modules are less functional than the ControlLogix (1756 series) analog modules, which have onboard scaling to engineering units if you want.

Because these modules are also for use with distributed I/O systems and with the MicroLogix 1500, they have data representation that's a mix of SLC-500 and PLC-5 styles.

What you're seeing is "raw / proportional" data mode for the analog input channel. I don't like to use this, because it's hard to figure out from the product data exactly where the low and high mA or V limits are that correspond with 0 and 32767 values in the data register.

What may be easier for you is to configure the module for 'Engineering Units'. These aren't really engineering units, but rather values in microamperes or millivolts.

If you set the module up for 'Engineering Units', you will get 4000 for 4.000 mA, and 20000 for 20.000 mA.

That's a lot easier to write your scaling code with, and a lot easier to troubleshoot if you are accustomed to process instruments and 4-20 mA current loops.
 
The SLC-500 had a great instruction called "Scale with Parameters" (SCP) that was just a simple linear equation. You would plug in the raw values for minimum and maximum, and the scaled minimum and maximum, and the instruction would take the input and scale it in a straight line.

ControlLogix puts that instruction in the Function Block language, so one of the first Add-On Instructions that came out was a re-creation of the SCP instruction for use in Relay Ladder Logic routines.

You might find that CPT works for you, or you might want to use SCP to change from raw counts, or mA, to degrees C.

You can get the add-on instruction from the RA Sample Code website just by searching on the keyword 'SCP'.
 
I second using the SCP Add-On if you can get it and install it.

If you'd can't or rather not download the add-on, you can do your scaling with the SCL inctruction, but it is only available in Function Block routines.

Otherwise, you can easily do a CPT instruction to scale your input and move it into a tag. You can use the expression:

( (local:1:I.ch0data - Raw_Min) / (Raw_Max - Raw_Min) ) * (Eng_Max - Eng_Min) + Eng_Min



Where Raw_Min, Raw_Max, Eng_Min, and Eng_Max are you raw and engineering units respectively (your input is being fed in raw counts, up to 32767).

Here is an example screenshot. You can name your tags anything you want, but I stuck with the aforementioned, and named the temperature tag TT01_Value.

attachment.php


CPT Scaling.JPG
 
ok, im having troubles getting the cpt function to work. I have it set as (local:1:I.CH0Data)*.0008-5 as my expression. but I cant get a proper destination it keeps saying Invalid data type. argument must match parameter data type. I created a tag under controller tags im using "integer.0" as my destination. I created the "interger" under controller tags, right click, new tag ( name: integer type: base data type: DINT Style: decimal ) when I hit the + sign left of "integer" I see I have 31 addresses to choose from but on the far left it says data type as a header and under that they all say "BOOL", which is probly why the compute function wont work!! how do I change the data type or am I using the wrong tag altogether? how do I get a proper destination address with the cpt function?
 
integer.0 is the first bit (Bool) of the integer (DINT?) You want to use just integer. But wouldn't it be better to use a REAL datatype to get the fractional part too?
 
You need to get your data types the same for the compute function. Take your data from that channel and move it to a tag that is a real. Once you do that you can use the real tag in your compute function.

BTW DINT stand for double integer. when you hit the + sign it showed you all the bits in the double integer.

A REAL is the same as a Float in RSLogic5 a DINT is the same as a Long integer INT is the same as an Integer. BOOL is the same as a bit

In RSLogix5000 you do not need to create data files but you do still need to define what data type each tag is.
 
integer.0 is the first bit (Bool) of the integer (DINT?) You want to use just integer. But wouldn't it be better to use a REAL datatype to get the fractional part too?

This is correct. Sorry I should have been clearer in my example.

You can use an Integer tag if you want, but because it is not floating point it will not capture any fractional results of the CPT.

Make your Destination tag a type of REAL and that should work.

For future reference, for any arithmetic or MOV instructions where you need to move or compute a value into an integer, be sure to use the whole word and not the bit specifier (.0, .1, ...... .31), which only specify the specific bit.

For example:

In the screenshot, I am trying to move a value of 32 into test_int.

My first MOV is valid because I am referencing the entire DINT tag.

The second MOV is NOT valid because I am trying to move an integer into a Bool (the first bit, .0 , of the test_int DINT).

attachment.php


Example.JPG
 
yes your right, I used a real datatype and it works perfect for what I want. I had to use the whole word. I hooked up the signal generator and its all doing exactly as I wanted! thanks guys, this site rocks! brian
 
Last edited:

Similar Topics

Hi! So my problem is a little funky, I had Studio 5000 v 24 and 30 installed, but forgot to install RSLogix (which I cannot go without). Is there...
Replies
2
Views
112
So I had an odd request from a customer for the above. I have written the logic and tested it all in one PLC with only using 7 outputs and 7...
Replies
15
Views
427
Hello everyone, I have an RSLogix5000 project which is running live in the factory but I need to make some changes to the logic. I want to test...
Replies
0
Views
1,120
Good Morning Everyone, I'm looking to use the GSV instruction to get I/O fault codes for my project so I know if there's a comms issue in my E/IP...
Replies
5
Views
866
The machine is running production. When trying to go online with the laptop the whole machine looses communication and faults out. Drives, HMI...
Replies
13
Views
1,932
Back
Top Bottom