Comparison Instruction

Real Espana

Member
Join Date
Jan 2008
Location
San Pedro Sula
Posts
25
Hello everyone,

I am working on a plc simulation program and I put four GEQ comparison instruction in series on a rung to unlatch a bit and it is working fine but my question is:

is it right or wrong to do this on a plc program?

Thanks.
 
Hmmm...It is neither "right" nor "wrong" but it might be "inefficient use of programming memory", or "unnecessary complexity for the rung logic".

It depends on the situation, and if there is some other way that would eliminate some of those 4 GEQ's. I use the LIM comparison instruction, which combines two into one, so you might only need two LIM's.

Upload a picture of yor rung, or ZIP your program and post it here. I am sure everyone will give you their opinion of your logic!
 
That logic does not compute i.e if x is >= to 1 and x >= 2 & so on anything above 1 will be true so why add more?
I can undrstand >= and <= this will give limit between the two
x is >= to 1 & <=2 means x can be between 1 & 2 only
 
It is not in any way "wrong" to construct whatever logic fits the needs.

Real Espana did not say whether the GEQ's were testing the same source data.

Lancie1 and Parky have made that assumption.

If indeed the four GEQ's are testing the same source, then it could still be a perfectly valid rung contruction, if the tests are made against data variables, not constants.
 
parky said:
That logic does not compute i.e if x is >= to 1 and x >= 2 & so on anything above 1 will be true so why add more?

If the GEQ's were in parrallel, your statemnt is true but Real Espana says

I put four GEQ comparison instruction in series

So only anything above 2 would be true.

I do agree with you in why use 4 when it appears 1 is enough.
 
Gil47 said:
If the GEQ's were in parrallel, your statemnt is true but Real Espana says



So only anything above 2 would be true.

I do agree with you in why use 4 when it appears 1 is enough.

Like Daba said...



IF they're testing the same value, 1 would be enough.

IF they're testing 4 different values, then the OP needs 4 GEQs.

We don't know enough about the application to make this evaluation, do we????:confused:
 
Lancie1 and Parky have made that assumption.
Gil47, add yourself to the list



To clarify my post....

Recipe for making large pancakes:-

Eggs >= 4
Milk >= 2 (pints)
Flour >= 12 (oz)
Salt >= 1 (teaspoon)

Ingredients OK ?
 
daba said:
Gil47, add yourself to the list



To clarify my post....

Recipe for making large pancakes:-

Eggs >= 4
Milk >= 2 (pints)
Flour >= 12 (oz)
Salt >= 1 (teaspoon)

Ingredients OK ?

According to me this shouldn't be fault. Probably you are forcing the baker/user to have a minimum of dough/pancakes. I think it is normal like you can't dose when the asked quantity is lower then the afterfall.
If i had to program it i would make a loop out of it with variable inputs and outputs (in this case) when the loop makes 4 loops set/reset/whatever the bit/word/whatever if one of the comparisons isn't true jump out the loop over the bit/word/whatever


Grtz
 
daba said:
Gil47, add yourself to the list


To clarify my post....

Recipe for making large pancakes:- or Humble Pie

Eggs >= 4
Milk >= 2 (pints)
Flour >= 12 (oz)
Salt >= 1 (teaspoon)

Ingredients OK ?

I am currently eating my piece any one for the 4th :geek: piece
 
If i had to program it i would make a loop out of it with variable inputs and outputs
But a loop is not anywhere near as efficient as executing four comparissons when you factor in loop overhead and branching.


I just wrote a program that contained the following rung, with three GEQ instructions in series. Simple. Efficient. And Bubba understands it.

GEQ X_AXIS_POSITION 10.0 GEQ Y_AXIS_POSITION 10.0 GEQ Z_AXIS_POSITION 10.0 OTE CLAMPED.
 
Correct (allmost) if A >= 1 and B >=2 And C >= 3
However as for 2 eggs etc. remember 2,3,100 eggs do not make a good recipe it would be eggs = 2 and milk = 1 ltr etc.
also all the variable(s) would have to be >= to the constant(s)
as they are in series (and function assume the compares are ENO type (input/output) & not straitfoward And>= functions
 
By the way Daba, would't like to eat your recipe as any amount of eggs, milk, flour etc. >= required ingredients = recipe ok??????????
Or use your logic on a lift (are we at floor 1, floor 2 >>>>> oops just gone through the roof!
Yep it's getting late & had a long day programming a palletiser.
 
parky said:
By the way Daba, would't like to eat your recipe as any amount of eggs, milk, flour etc. >= required ingredients = recipe ok??????????
Or use your logic on a lift (are we at floor 1, floor 2 >>>>> oops just gone through the roof!
Yep it's getting late & had a long day programming a palletiser.

I'm sorry - but that's just a stupid comparison!! When you're doing an elevator you would use EQUs, not GEQs.

You have to program your program to fit your system. You obviously don't program an elevator the same as you would a mixing system, or as you would a palletizer.

What daba said is what I said -- IF you're using four GEQs to establish that four different parameters have been met, that's ok. Perhaps you would rather have each one individually go to a bit, then series those bits together to give the "OK"... same difference...

IF your using four GEQs to measure the SAME parameter against four different values, that's obviously redundant and could be solved with a single, wisely-chosen GEQ. And even then, using four GEQs would be ok, just inefficient.

The problem is Real Espana has never come back and told us exactly what he's trying to do. Up until now, we're assuming (Gee... I hate that word...)
 
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.
 
Or use your logic on a lift (are we at floor 1, floor 2 >>>>> oops just gone through the roof!

Parky, you've done it again - you've assumed the GEQ's are all talking about the same lift !

If talking about different lifts :-

IF
Lift 1 above floor 20
AND
Lift 2 above floor 20
AND
Lift 3 above floor 20
AND
Lift 4 above floor 20
THEN
Message,Groundfloor = "Waiting Time for Lift 2 mins"
END
 

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,611
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,190
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,203
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,373
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,525
Back
Top Bottom