Using GEQ,LEQ, and LIM

LStewart

Member
Join Date
Apr 2005
Location
Mississippi
Posts
95
I am making a machine modification, and came across some programming that made me question why, they are using a GEQ and a LEQ on the same rung to set limits for part selection. I was wondering why they didn't just use the limit instruction. Is there any advantage to doing it this way?

Just wondering,
Lori
 
In order to the the EQUAL function work.
The limit is between, and I believe the exact value won't pass a true on the logic.
 
CroCop said:
In order to the the EQUAL function work.
The limit is between, and I believe the exact value won't pass a true on the logic.

From RSLogix Hepl Files: (RSLogix500)
Description
Use the LIM instruction to test for values within or outside a specified range, depending on how you set the limits.
Entering Parameters
Depending on how you define the Test parameter, the Low and High Limit parameters can be a word address or program constant. See below.
Test Low Limit High Limit
Constant Word Address Word Address
Word Address Constant or Word Address Constant or Word Address
True/False Status of the Instruction
If the Low Limit has a value equal to or less than the High Limit, the instruction is true when the Test value is between the limits or is equal to either limit. If the Test value is outside the limits, the instruction is false.
If the Low Limit has a value greater than the High Limit, the instruction is false when the Test value is between the limits. If the Test value is equal to either limit or outside the limits, the instruction is true.
Rockwell Software 2005

From RsLogix5 (not as clear)
Description
The LIM instruction is an input instruction that tests for values inside or outside a specified range. The instruction is false until it detects that the test value is within certain limits. Then the instruction goes true. When the instruction detects that the test value goes outside certain limits, it goes false.
You can use the LIM instruction to test if an analog input value is within specified limits.
© 1997 Rockwell Software Inc.
 
Last edited:
Okay Mickey so if I am reading this correctly,(I am at home and don't have rslogix here), in this instance of using GEQ and LEQ there is no difference in using these and a LIM. If I have a limit of .01599 to .0165, if my reading is .01599, the rung would be true using either method. I was just wondering why this person would have done it this way versus a LIM instruction.
 
I may be wrong or the situation I had was long ago and it different now. The situation I had was the LIM instruction did not "equal" the high and low limits...ie if low limit was set to 5 and the monitored value was 5 then it was out of limit.

It is also possible the programmer was not familiar with the LIM instruction and was use too using Compare instructions.
 
The LIM instruction can do the same thing as a GEQ/LEQ or a GRT/LES. You get all four of the variations by having the low limit less than or greater than the high limit and inverting the result of the LIM.
1) Inside or equal to limits.
2) Outside or equal to limits.
3) Inside but not equal to limits.
4) Outside but not equal to limits.
The only cases it can't handle are ones like GEQ/LES. (i.e. Ones that aren't symmetrical)

My main problem with the LIM instruction: I have to read the instruction help file every time I run into one to verify which of the four variations I've got. (OK, if it's variation 1, I don't look it up). I never have to look up GEQ, LES etc. Two clear instructions vs. one confusing instruction is a pretty easy decision for me.
 
The original programmer probably didn't know about or understand the LIM instruction. The combination of GEQ and LEQ instructions was just his/her solution.

Many years ago I used to teach classes in Basic (Dartmouth). Thirty students given the same programming task.... each and every one would have a totally different method to achieve the end result. Some solutions were more elegant, some had code was that more efficient, some programs were easier to follow the flow of the logic, but the bottom line was that each program did exactly what it was supposed to do. Everybody's mind works differently (and some more logically than others).
 
LStewart said:
...If I have a limit of .01599 to .0165, if my reading is .01599,

Slightly off topic:

Do you know that when using comparrisons on floating point numbers you can sometimes have some unexpected results when you "think" the process variable is equal to a particular value?

Take your reading of .01599. The exact number 0.01599 CANNOT be represented in a single precision floating point number. The closest you can get is 0.01598998.

This usually isn't a problem when using constants, as the constant will be stored in the closest possible representation. However you could be fooled if the source and target of a comparrison are both calculated, especailly if they are calculated from other floating point numbers. You might use a calculator and find that the calculator says the results are equal, but the PLC still evaluates the EQU as false.
 
That was part of my problem, they were taking a reading from 2 gages, comparing the readings, and using the lesser reading, they were not capturing the readings,and that was blowing my little mind, I was adding access doors to a pick frame, I used the LIM to set up my doors, but when I would show door 3 should open, door 4 would open. I rechecked the program and saw that they were using the readings on the fly when a timer done bit would come on. So there would be a difference in the reading, especially if the operator kept her hand on the part, I changed the program to capture the readings and the thing started working. This operation has had some quality issues and I am hoping this resolves it, now they should get better and more consistant readings.
 

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,890
I have a project to automate four generator sets. The system will monitor and store the load demand of the factory. Once there's Power outage, the...
Replies
0
Views
55
Adding ethernet equipment to an existing panel that has none. We have some solid ethernet cables coming from other remote cabinets that I plan to...
Replies
3
Views
116
I'm trying to control a device via MODBUS RTU and the ModbusRtuMasterV2_PcCOM in Twincat 3. I've configured a device with the right com port and...
Replies
7
Views
221
Hi, I'm trying to use the IO Device Library (Product Versions) which is configured to work with the 1756-EN4TR & 1756-EN2TR but my system uses...
Replies
0
Views
59
Back
Top Bottom