Help for a dummy

rhufstetler

Member
Join Date
Oct 2007
Location
West Point, GA
Posts
12
Sometimes I feel like I am as lost as last year's Easter Egg.....
I am trying to write a program for a MICROLOGIX1200. The current problem is: I have an analog 4-20 mAmp signal from a water level transmitter (PT-207B). 1) I must store this data in the PLC 2) I must compare this value with a set value of 191. Based on the results of that compare either being greater than or less than send an appropriate output.
How do I store the analog signal's information in the PLC and how do I then compare it to a given numeric value (where and how to store)?
Similar problem is a pressure transmitter PT-207A - based on input compared to set values determines appropriate output....
Please don't tar and feather me just yet....
Rodney.
 
Some crucial information is missing in order for us to be able to help you.


What analog IO module are you using with your ML1200 and what is its slot location, ie, expansion IO modules will be in slot 1, slot2, slot 3, etc, numbered left to right from the right hand end of the controller base unit?

After we establish what IO module you are using and where it is located, we need to establish the address of the input. eg, Channel 0 of an analog input at slot 1, would be I:1.0.

You may need to review addressing in the manual. All manuals can be downloaded at AB.com. Go to the bottom of the right hand panel and select literature library/manuals on line.

The analog module is going to return a raw analog value. This will have to be scaled to engineering units. The best instructon to do this is the SCP instruction. What does 191 represent (feet, inches, gallons, etc) and what is the full scale range of the water level transmitter. This is information that we need to help you determine what to scale to.

The comparison is the easy part and we can use a varitey of instructions, GRT, GEQ, LEQ, LES, LIM to achieve the needed results.

Also,while you are at it, give us the full scale on the pressure transmitter and the address of the input to which it is wired as well.
 
See if this will help get you started, note the analog has to be configured and there can be issue depending on the card being used.


MLSCP.jpg
 
Thanks!
Analog IO - 1762-IF4 4 channel expansion module
As it is the only other piece of equipment involved let's say slot 1 and start with channel 0 i.e. I:1/0
Now with the hard Q's - I am not sure of what the limits or values are, but will find out. I have assumed it is in inches and have requested the information. As for the limits - clueless.

RSDORAN - Thanks for the picture as it is worth 1K words. I see where the analog input address is and how it is derived and see the output is stored as an integer. Then I see how the two different integers are compared and the resulting output.
I will have to obtain more in-depth information on the parameters of the pressure switch and high water level switch to correctly program the analog IO module. Most helpful, thanks!
Rodney.....
 
OK, but what happens when it is equal to 191? You need to define the process to determine what you want it to do. Consider using a GEQ or LEQ in one of Ron's ladders.
 
I could have used one of those but just threw this together quickly to give him some direction, Alaric had already mentioned the instructions. Hopefully he will take the time to read about the compare instructions to understand what they do.

The SCP (scale with parameters) is avaiable to the ML 1200 and 1500, probably the 1100 too but I have version 5.20 of RSL500.

What is funny is that when I tried to create a new program I could not find SCP, but I happened to have an old program that had it. I may have just overlooked it because I made the post around 3 PM which is when I have to pick up my daughter from school.
 
Last edited:
Good afternoon all! I have read the compare instructions and do understand what they do, thanks! I got lost in the instructions on the parameters for the SCP and or PID command. As for the use or not use of equal - the program only wants to enable the output if the input is greater or less than the compared to value. I.E. If the analog input of <source A > I:1.0 (which is from the expandable Analog IO - 1762-IF4 4 module in slot 1) is greater than integer <source B> N7:0 (256) then enable output O:0/11.
If the source A is less than source B then enable O:0/12.
What I am still having issues with the configuration of converting the analog signal into engineering usable decimal values for the I:1.0 i.e. source A.
But not be dismayed, I am like a bulldog with a chew toy! I will not be denied! While it may appear that I have bitten off more than I can chew I will just take one small bite at a time and eventually this elephant will be devored. And I will walk away full and more wiser for it. HAHAHAHA I appreciate your patience and understanding not to mention your willingness to help the "green" PLC users, especially this one - mucho gracious muy amigos (sp?).
GO DALLAS!!!!
Rodney.
 
Attached is the program so far - good bad or otherwise - as this is my first attempt at writing a PLC program - be gentle, be kind but I know my cherry is fixing to get picked. LOL - HAHAHAHA - I sure am glad you guys have a sense of humor - you must, right? After all, you keep reading my post and replying - many thanks!
Rodney.
 
The numbers in my example are for 4-20ma input i.e. 3277-16383, more or less. 2 to the power of 14 is 16384 divide that by 20 ( max ma) and you get 819.2 times 4 (min ma) you get 3276.8. That number is rounded, not sure why I took 1 off the 16384, may be an AB thing.

Anyway, for the output (Scaled Min/Max) you just use the range expected from the trasmitter i.e. the level of water in the container.

What Bruce was refering too was what happens when the number Equals 191, have to consider that too. Usually you would use something like Greater than or Equal too (GEQ) for the 191 and (LES) for less than. In other words you want to match the compares so they never overlap but never leave a number excluded.
 
Try again with attachment. Be advised you must zip it first ( if you are trying to attach a .RSS file.
 
you might want to consider the “chatter / noise / jiggle” issue too ... most analog signals “move around” a little bit even when something like the tank level is perfectly stable ... specifically, you’re probably NOT going to see a nice neat “stay in one place” signal like 191 ... so think about leaving some slack in the comparison values ...



or ...



think about using the compare statement to control a timer ... in other words, IF-the-level-is-LESS-THAN-191-for-10-seconds-THEN-take-some-action ... in most cases, you’ll be plagued by “nuisance” alarms if you don’t take this stuff into consideration ...
 
In order to use the SCP instruction you need to get some information about your module and your sensor.

If you will look on page 1-6 of manual 1762-RM001E-EN-P You will find the following table for your IO module.

A100907C.JPG


This table shows us what we can expect the IO module to return as a raw value for the input range that we have configured it for. Here we can see that with a 4-20mA transmitter with the IO module configured for raw proportional we will get a value of 6240 at 4mA. This is our input minimum. We will also get a value of of 31200 at 20mA, which is our input maximum. (It also shows the values if you configure the modules as scaled for PID)

Now we need some particulars about your level sensor. Since you haven't given us the details yet, I'm going to make up some numbers. For this example when the level sensor returns a value of 4mA the fluid height in the tank is twelve inches - this make believe sensor doesn't go all the way to the bottom of the tank, leaving 12 inches below the sensor. The level sensor returns a value of 20mA when there is 200 inches in the tank. Thus the range over which the sensor measures is 188 inches.

Now we have the numbers we need: 6240, 31200, 12, and 200. The SCP instruction looks like this:
A100907D.JPG


I usually place my analog scaling right at the top of the program (rung 0 in this case) or in a subroutine that is executed before the main section of my program is executed.

I noticed in the program that you posted that you had configured the input to be scaled for PID. Should you leave it that way then you would selecct the values of 3120 and 16380 for input min and input max. Substitute the numbers for Scaled Min and Scaled Max that will match your sensor when you have them.

This method gives you the level scaled into whatever engineering units your level sensor is calibrated in. For this example I chose inches since that is what you indicated.

Working in engineering units is convenient, but the PLC actually doesn't care one way or the other, and I see in your posted program that you decided to do some direct comparrisons to the raw analog value from the card. This is perfectly legitimate, but you need to scale the reference value for the comparrison so that it fits in the range of 6240 to 31200 for raw, or 3120 to 15600 if you scale it for PID. Since I personally prefer to work with the raw values, I'll use that.

So, supposing that I wanted to know what the raw input value for 75" would be? I can use a simple relational trick to figure this out, one that is easy to remember and apply: A is to B as X is to Y. A and B are the process variable and process variable range, X is the unknown, and Y is the raw analog span.

Remember that there is a 12 inch offset, so...

(75-12) is to (200-12) as x is to (31200-6240). I'll write this as a ratio

63 x
---- : -----
188 24960


Cross multiplying and setting the terms equal, I get 188x=1572480
and solving for x, I get 8364. I subtracted out the offset for 4mA, so adding it back in now, I get 14604. So, at a fluid depth of 75" I should read 14604 as the raw analog input value.

So if I don't want to program the scaling into the PLC but make a raw comparrison, then to check and see if the level is greater than 75 inches I would use
A100907E.JPG



And finally, suppose that I wanted to turn the entire thing around, and scale numbers representing the desired value in engineering units, say 75 inches again, into raw equivalents for use in making a raw comparrison as above. I could flip the application of the SCP instruction around, and do this:
A100907F.JPG


converting the engineering unit value of 75 inches, to the corresponding value for comparrison with my raw analog input. Observe that the SCP instruction gives us 14604 in N7:2, the same value we calculated above. Now, N7:2 can be compared to the raw input value from I:1.0

I hope that helps.

---------------------------------------------

Last, I have a question about something in the program you posted that is a bit troubling...

Please explain rungs 10 and 11. On rung 11 you have an output O:0/12. Then on rung 10 you have an XIO instruction performing a logical AND NOT I:0/29. I:0/29 is labeled FROM OUTPUT O:0.0/12. Before I go jumping to conclusions, will you explain what the relationship between I:0/29 and O:0/12 is and what is wired to each one. The same thing exists at rungs 12 and 14 also.
 
Alaric said:
In order to use the SCP instruction you need to get some information about your module and your sensor.

If you will look on page 1-6 of manual 1762-RM001E-EN-P You will find the following table for your IO module.

A100907C.JPG

I'm going to muddy the water a little:
I believe the table above is for a 1762-IF2OF2 module, the OP says he has a 1762-IF4 see AB knowledgebase I.D. 19719 below
for the 1762-IF4 data format ita a little different.
 

Similar Topics

Ok, any help would be great. I am looking for a device to activate a speed warning sign for semi trucks. I have a device that has two 12V dc...
Replies
4
Views
3,309
Hello, I need to write the following program in Ladder language, but I could not integrate the Fibonacci sequence into the ladder. Can you help...
Replies
20
Views
334
this a program to send data to barcode printer I want to integrate a new printer in a new machine and i wanted to adapt the old prgram on it but I...
Replies
4
Views
163
So i've been at this for a long while, i have Citect Scada 2018, i have full access to everything but i can't seem to find any option or...
Replies
0
Views
59
Hi all, hope you are having a great day, I am in need of your help to create a AOI or program that does this kind of job: I have a IO Link...
Replies
26
Views
540
Back
Top Bottom