Comparison Instruction

But a loop is not anywhere near as efficient

Why did i say a loop,(i assume it is for receipe handling) a receipe isn't allways just 4 components what happens when the user would change the receipe and have 5 ingredients? System fails ??? No with a loop you make the amount of loops variable to the amount of components you have to dose.
So the loop has it benefits.
 
Lets get it right first of all the original poster asked a question without any real idea on his process (not a good idea).

some of us assumed this guy or girl (cannot assume anything?) was new to programming plc's as the question asked did point to this. so it was wrongly assumed by some of us that he (she) was trying to set a bit if x >= 2 and x >= 3 etc (not uncommon with beginners).
Again the point of the recipe as written was just that a recipe for make up not end of all ingredients, the >= is also not a good idea for recipe makeup as it's just as bad being out of limits either way.
All recipe targets should be >= Recipe - Low Tol and <= Recipe High Tol) i.e. if 20 eggs = perfect then 19 to 21 is within limits, <19 or > 21 is out of tollerance.
Eggs >= 19 <= 21
Flour >= 3.5kg <= 4.2kg
etc.
Some posts for help are like trying to find the height of a building, you have the distance from the base, pen, paper & calculator but nobody gave you the protractor for the angle.
We are probably all guilty of this at times as we already know the requirements when posting but forget to add all of them
 
Lancie1 and Parky have made that assumption.
Nah, I never assumed any such thing. My only thought was that I have been programming a long time and don't remember EVER having a need to use 4 GEQ's in series on the same rung! There's a big difference between THEORY and the REAL world. In theory it is okay, but I can't think of any useful real-world examples.

Does anyone have an actual running (not a made-up example), useful, program that has 4 GEQ's in series on the same rung?

EDIT: I looked through my accumulation of PLC programs. The cloeset thing I found was 3 EQU (equal) comparisons. In another case I used 2 GEQ's and 1 NEQ on the same rung in series. By induction, it seems that the case of 4 comparisons in series would rarely NEED to occur.
 
Last edited:
Lancie1 - I rather believe you did, or how can you use LIMs with different data...

Lancie1 said:
I use the LIM comparison instruction, which combines two into one, so you might only need two LIM's.


Anyway I replied to critiscism with :-

daba said:
An example only - Minimum Quantities required for successful production.

I suppose I should have asked in the rhetoric - "Can we make pancakes today?"

But I think it served it's purpose.

and people still kept coming back at me - let it go !
'nuff said .....


As for a practical examples Lancie1, yes I'm sure I could find several if I needed to, I do know I have needed this logic construction in the past, but here's one from memory :-

Pastuerisation Temperature >= Minimum Temperature
Pastueriser Flowrate >= Minimum Flowrate
Regen Section Return Flow >= Minimum Flowrate
Steam Pressure >= Minimum Pressure
Coolant Flow >= Minumum Flowrate
Coolant Pressure >= Minimum Pressure
Inlet Buffer Tank Level >= Minimum Forward Flow Level
Sterile Buffer Tank Level <= Maximum Holding level
= Allowed to go Forward Flow

If I had coded this as a series of GEQs LEQs etc. on the same rung (and I'm not admitting whether I did or not, to avert any response), then there would be nothing wrong with it, It would work.

Like I said in my first post, there is absolutely nothing wrong with constructing logic with all the conditionals in series on one rung, I didn't say it made the code easier or harder to follow, or that it made the program execute faster or slower, I simply stated that it is logically OK to do it. In fact in ControlLogix, it can make the program execute faster if you place the instruction most likely to be false at the beginning of the rung, the controller stops evaluating further conditional instructions because nothing can make it true again.


Lancie1 said:
EDIT: I looked through my accumulation of PLC programs. The cloeset thing I found was 3 EQU (equal) comparisons. In another case I used 2 GEQ's and 1 NEQ on the same rung in series. By induction, it seems that the case of 4 comparisons in series would rarely NEED to occur.

so ! : just because you've never done it - don't assume no-one else has either.
 
so ! : just because you've never done it - don't assume no-one else has either.
I didn't--that is why I asked. So far, I have to conclude that no one has actually used more than 3 comparisons in series. If you have an example that was written more than 2 weeks ago that does, please post it.
 
Lancie1 said:
I didn't--that is why I asked. So far, I have to conclude that no one has actually used more than 3 comparisons in series. If you have an example that was written more than 2 weeks ago that does, please post it.

Here is a real example.
Receipe handling according to me is using it alot.

Check if the requested amount that you have to dose isn't lower then the afterfall(i'm not gone explain what afterfall is)

Let say you have a receipe of 10 components then you would have 10 comparisons after another.

Why?
There is no need to start a dosing that mechanicaly isn't possible to dose (minimun that you can dose mechanical is allmost the afterfall)

So alot of this dosing pc is checking for that, and if there is a component that is lower then the afterfall it gives you an alarm at the beginning and won't allow you to start.
 
Lancie1
I gave you an example from memory. I don't have ACD file examples, as they don't belong to me, and even if I could get hold of them I'd be breaching copyright laws posting in here. Just take my word for it - I've done it in the past, and if the situation should arise in the future, I would consider doing it again.

Why can't you accept that the logic is flawless, whether it is 3 comparison instructions (which you admit to), or 4, (which "you conclude" is rarely going to occur).

So take one of your "3" situations, and the customer asks for another criteria to be met.
What you gonna do, re-write all the code to avoid the "4" situation ?
Or would you just stick the new comparison in the same rung, and break your own unfounded "rule" ?
What practical difference does it make how many there are ?

If someone else can provide an actual example, (OZEE ?) then perhaps Lancie1 will get off my case, and stop acting all superior.
 
daba said:
If someone else can provide an actual example, (OZEE ?) then perhaps Lancie1 will get off my case, and stop acting all superior.

I don't know that I have an actual example. If I need to use 4 serial GEQs, I would not be afraid to use 'em that way! I have done several blending systems where there have been more ingredients than four. But we have absolutely no idea what Real Espana needed!!

There's absolutely, positively no reason whatsoever (period. end of discussion!) that it CANNOT be done!! Just as with any other coding, you need to define what you need. If 4 serial GEQs is what you need, it absolutely WILL work! (E.g., do I have the minimum amount required for each of the 4 -- or 5, or 6, or 10... -- ingredients required to start my batching operation?)

Can those 4 serial GEQs be refined to 1 GEQ? Dunno -- It depends on what you're comparing!! If your asking if 100 is GEQ 1, 5, 10 and 20, then yes, it can be refined to a single GEQ (GEQ 100 20), because (GEQ 100 1), (GEQ 100 5), and (GEQ 100 10) are all redundant. But if you're needing to know if you have more than 100 lbs of flour, 50 lbs of sugar, 5 gallons of oil and 20 eggs, then you need four GEQs!

Is it the most efficient use of code? Who cares?? Is it more efficient to code each of the GEQs to a bit, the serial the bits?? Not necessarily. If I need to know each of those individual GEQ results various places in the program, I might write them to individual bits, then serialize the bits. If this is the only place I care about them, I'd use for serial GEQs.

But -- REAL ESPANA has never come back to tell us what he needs!! He asked a hit-and-run question -- and look at the carnage it has caused!

(Hey - REAL ESPANA -- I see you online right now, looking at this thread!! Please explain what you were needing!!)
 
Last edited:
Hi everyone!!!

I am working on the elavator simulation and I am using four GEQs and each one uses the same input in source A but diferent integer value in source B what I am doing is to unlatch the going down bit when the elevator needs to go down.

Do you think that I have to change this logic?

Thanks,
 
Real,

Yes, you need to change your logic. You do not need ANY GEQ's in Subroutine 7 to latch the STOP bit. Here is that part of the program, done correctly. (The Going Up and Going down bits should not be unlatched until the NEXT Subroutine 8: Stop & Open Door.)

What I am doing is to unlatch the going down bit when the elevator needs to go down.
You said it backwards: The Going Down bit should only be LATCHED when the elevator needs to go down, and unlatched (BOTH Going Up and Going Down) when it is ready to STOP.

Elevator_Subroutine_7A.jpg


You do need ONE GEQ to unlatch the Going Down bit in Sub 8, like this:

Elevator_Subroutine_8_Partial.jpg
 
Last edited:
Hold on... Pastuerisation >= what if it was 99.9 boiled product or burnt curry sauce, >= xx AND <= xx makes more sense
 

Similar Topics

Hi guys! Can someone post how to use this function? Really having difficulties to use it. thanks. Regards, Brooks
Replies
4
Views
3,625
I have a program that records a position value from an encoder and stores it in an integer file each time the operator moves the machine to a new...
Replies
9
Views
3,205
In my SLC 504 programs, I have used the FBC instruction to scan a word for a bit that has been set. This instruction is not supported in the...
Replies
2
Views
4,225
Per title - what's the worst and best wire duct brands you have worked with, and why? They all look the same on the outside, but there are...
Replies
13
Views
2,402
I have installed a Cognex barcode scanner on a machine. I have a 1769-L18ER CompactLogix processor. I have communication setup and working. I...
Replies
26
Views
4,584
Back
Top Bottom