Jim said...
...but will only fall through to the output when and if the bit is equal to one.
Gotta stop you there Jim...
Unless you are looking at the code in the manner that Peter is describing (more later), you don't need a series of "1's" to get to the output. You need a series of Yes's or True's.
BIT
----| |---------( ) Indicator Light #1
BIT
----|/|---------( ) Indicator Light #2
.
The first rung "asks" if BIT is ON (1).
If the answer is YES or TRUE, then the output is ON. If the answer is NO or FALSE, then the output is OFF.
In this case, if BIT is ON (1), then the answer is YES or TRUE. If so, then Indicator #1 will be on.
The second rung "asks" if BIT is OFF (0).
If the answer is YES or TRUE, then the output is ON. If the answer is NO or FALSE, then the output is OFF.
In this case, if BIT is OFF (0), then the answer is YES or TRUE. If so, then Indicator #2 will be on.
Notice that the two rungs are mutually exclusive. That is, since each is controlled by different states of the same bit, if one indicator light is ON the other is OFF.
Also notice that the two lines written in red are identical. Whether, or not, an answer is YES/TRUE depends not only on the state of the particular bit but also on the particular question being asked.
This means,
depending on the particular question being "asked", either a "1" or a "0" can produce a YES or TRUE result.
This method allows you to look directly at the input indicator lights on the PLC and make a direct comparison (without making any mental conversions - discussed in the next section).
IN1 IN2 IN3 OUT
--| |----|/|----| |----( )
.
Looking at the indicator lights on the PLC, if IN1=ON and IN2=
OFF and IN3=ON then the output should be ON .
Peter's description using AND and AND-NOT is the
REAL way that these rungs are being evaluated by the processor.
--| |-- = AND
--|/|-- = AND-NOT
In this case, Jim, you are correct in saying that the processor is looking for a series of 1's in order to turn on the output. However, for some, this can be more confusing than the "imaginary relay".
BIT
----| |---------( ) Indicator Light #1
BIT
----|/|---------( ) Indicator Light #2
.
In the first rung, the processor looks at the actual value of BIT. If the actual value is "1" then the output is on. If the actual value is "0" then the output is off.
In the second rung, the processor takes the actual value of BIT and then reverses (negates) the value (0->1 and 1->0).
If the reversed (negated) value is "1" (actual value = 0) then the output is on.
If the reversed (negated) value is "0" (actual value = 1) then the output is off.
This method also allows you to look directly at the input indicator lights on the PLC and make a direct comparison.
IN1 IN2 IN3 OUT
--| |----|/|----| |----( )
.
Looking at the indicator lights on the PLC, if IN1=ON and IN2=
OFF and IN3=ON then the output should be ON .
HOWEVER... if you are "thinking" that you need a string of 1's, and if you don't go through the mental exercise of "un-negating" IN2, then you might be looking for IN1=ON, IN2=ON, and IN3=ON.
A more complete description of Peter's "breathing/living" evaluation might be...
BREATHING FOOD WATER SHELTER DISEASE BEER LIFE
---| |------| |-----| |------| |---------|/|---------| |-------( )
IF... 1 1 1 1 0 1 then 1 <-- Actual visible indications on lights
True True True True True TRUE! ON
IF... 1 AND 1 AND 1 AND 1 AND 1 AND 1 then 1 <-- Internal values, not visible
(-NOT-0)
.
I suggest that all new programmers that come to PLCs from the electrical world (not necessarily those programmers from the PC Programming world) use the method described at the top of this post.
Experienced PC Programmers should be able to slip easily into either method... their choice.
However, in terms of working with direct corrolations between actual and expected conditions I strongly suggest that all programmers blow-off that damned imaginary relay thing and use the first method at the top of the post... even those that are used to working with assembly (AND and AND-NOT).
jimbo said...
"I agree that this is a pretty simple concept. Applying the smybols to make the logic work the way you want is as simple as knowing what they do."
This is certainly true. So why go through the effort of trying to figure out what they do by applying them to the imaginary relay?
jimbo said...
"But the fact of the matter is, that the original designers of ladder logic chose to use the symbols (--| |--), & (--|/|--) which come from the relay world as N.O. and N.C. contacts."
Simply because there were some less then bright EE's that couldn't get the hang of ON and OFF.
jimbo said...
"Because those symbols are universally used in the world of PLC logic and the symbols come from relay logic, the analogy is inherent in the system."
Nobody has even suggested removing the symbols... the only suggestion was to understand the symbols in a more direct manner without relying on the imaginary relay to explain ON and OFF.
jimbo said...
"I don't know. Maybe they've never seen a relay or used one to make a logical NOT in an electrical circuit. I would say that kind of knowledge/experience is prerequisite to PLC programming."
It's nice that you appear to understand how to make a logical NOT in an electrical circuit. However, it also appears that your primary need for understanding how a relay works might be so that you can understand how the "imaginary relay" works...
You said it yourself jimbo...
"On the other hand, judging from the replies, this thread was helpful to a number of people."
The thread is helpful to a lot of people because, intuitively, they just have a hard time swallowing the need for the "imaginary relay" concept. How can the concept of ON or OFF be so complicated that it can only be understood through imaginary means?
New programmers, subjected to training under that damned imaginary relay concept must think to themselves, "Gee... ON and OFF sure seems like a pretty simple concept. Could it be that ON and OFF is more complicated than I think? Jeez... What am I missing here? If I'm only supposed to be able to understand this stuff through imaginary means, what is it that I am missing? WHY do I HAVE to be understand it through imaginary means?"
And as you have seen, some have seen through the sham that is the imaginary relay. Obviously, Dr Struger, as mentioned by Philip, went from one extreme to the other to satisfy the EE's you mentioned.
Imagine that Ron, the PLC concept had to be dumbed down for the EE's. It's really sad to think that an EE couldn't understand the concept of ON and OFF without resorting to magical means. Electrical folks would do very well if they never hear of the imaginary relay... they can appreciate the concept of ON and OFF.
Jimbo, for the most part you sound like you want to maintain the understanding of the symbols through the imaginary relay. But then you give an "AMEN" to Peter's discussion about AND, AND-NOT and OR.
Do you not see the contradiction in that?
The AND and AND-NOT method has nothing to do with the imaginary relay.
jimbo said...
"I just have a hard time seeing their side, and how this knowledge isn't immediatly obvious."
Well, jimbo... I guess you're just one of the lucky ones... and yet you sort-a, kind-a seem to support that damned imaginary relay thingee... maybe you are not as in-tune with logic as you would have us think.
There is no need for an analogy. ON and OFF are as simple as ON and OFF... don-cha-think?
(394)