The "Imaginary Relay" Problem, Part-1 of 2

Terry Woods

Member
Join Date
Apr 2002
Posts
3,170
“Why Some Novices are Confused by the ‘Imaginary Relay’ Model”

Even if we might not be able to explicitly express the basic rules of logic, we all eventually “internalize” (at least, some of) the more basic rules through life-experiences.

When any novice first comes to learn PLC’s, whether he realizes it or not, he is not completely in-the-dark, at least, not with respect to the really basic parts of logic.


I really can’t say anything disparaging about the “intent” behind the “Imaginary Relay” model. It was nothing more, or less, than an Engineer’s attempt to simplify, what was then, apparently, (and still is, apparently) a difficult concept to grasp.

Since the target-audience for the simplification was the electricians/technicians of the day, the simplification had to be based on something they could relate to.

Ergo... the “Imaginary Relay”.




Teacher: So, that’s how the Imaginary-Relay model works.
Student: Uhhhh... I can’t quite put my finger on it, but something just doesn’t seem to make sense.
Teacher: Trust me! I’m a Teacher! I KNOW WHAT I’M DOING! (Just go with it... it’ll make more sense as time goes on.)


As a “solution”, the “Imaginary Relay” model includes its own set of problems. The “Imaginary Relay” model is...
  • logically incomplete,
  • logically contradictory, and eventually,
  • counter-intuitive!

It appears to me that the Imaginary Relay model simply trades one set of problems for another. (Kinda like selling your old car and then buying a brand-new used car! You’ve traded a known set of problems for an unknown set of problems. Whether or not you have actually bettered your situation remains to be seen!)

What the Teacher said... “Just go with it... it’ll make more sense as time goes on.”

What the Teacher is saying... “Have FAITH!”


The Imaginary Relay model asks that you “Just go with it... and, Have FAITH”.


The real problem lays in the fact that the Imaginary Relay model is NOT asking you to “Imagine a Relay”... rather, it is asking you to “Imagine an IMAGINARY RELAY”.


Let’s say we have a normally open, single-contact, limit switch, identified as 2B. At this point, the limit switch is simply lying on the floor. It’s not really monitoring the status of anything. We are simply trying to monitor the status of the limit switch. Now, let’s invoke the Imaginary Relay.

Limit Switch 2B drives the Imaginary Relay. We are asked to imagine this relay with a normally open contact and a normally closed contact.

FIGURE-1

REAL IMAGINED

LS-2B
/ relay
------o o------------( coil )

normally open
o----------------- >

-----------------------o
\
o----------------- >
normally closed


.
The problem begins right here!
We are being asked to imagine a thing that really exists in reality. We can pick one up and say “this is a relay”. When asked to “imagine a relay” inserted into a circuit (as shown above), we can do so, very easily, because we are very familiar with what a relay is and how it works. We also assume the normal operating characteristics. It’s not hard to imagine a “real” thing.

So... let’s pretend that this “imaginary relay” is Really REAL.

So... this limit switch controls a REAL Relay. There are two outputs from that relay: one output is from the Normally Opened contact and one output is from the Normally Closed contact.

Assuming the system is healthy these two outputs indicate the state of the limit switch.

When the limit switch is OFF, the relay is OFF:
  • the Normally Open Contact is OPENED, and
  • the Normally Closed Contact is CLOSED.

When the limit switch is ON, the relay is ON:
  • the Normally Open Contact is CLOSED, and
  • the Normally Closed Contact is OPENED.



Now, let’s connect each relay-output to a PLC-input. Connect the output from the Normally Opened contact to PLC-Input-0 and the output from the Normally Closed contact to PLC-Input-1.

FIGURE-2

REAL REAL REAL

LS-2B
/ relay
------o o------------( coil )

normally open
o--------------------o (LED) PLC Input-0

-----------------------o
\
o--------------------o (LED) PLC Input-1
normally closed


.
Again, assuming the system is healthy, when the limit switch is OFF, the relay is OFF:
  • The Normally Opened Contact is OPENED and the LED, at PLC Input-0, is OFF.
  • The Normally Closed Contact is CLOSED and the LED, at PLC Input-1, is ON.
When the limit switch is ON, the relay is ON:
  • The Normally Opened Contact is OPENED and the LED, at PLC Input-0, is OFF.
  • The Normally Closed Contact is CLOSED and the LED, at PLC Input-1, is ON.


Now, in this scheme, if any programmer wanted to determine the state of the limit switch he could write something like this:

FIGURE-3


The signal That
from --| |-- means…
of relay 2B LS 2B
is ON! IS ON!
-----| |-----------------------------( C1 )
PLC Input
Input-0



The signal That
from --|/|-- means…
of relay 2B LS 2B
is ON! IS OFF!
-----| |-----------------------------( C2 )
PLC Input
Input-1


.
Now, anywhere that he wants to, a programmer can reference C1 if he wants to know if the limit switch is ON, or C2 if he wants to know if the limit switch is OFF.

So, using the REAL version of the “Imaginary Relay” model gives us a direct indication of the state of the limit switch: LS-2B is ON; LS-2B is OFF. The “REAL-Relay” model is about as neat, clean, logical, and straight forward as it can be. It’s also Wrong! Huh?????

In reality, we use only ONE PLC INPUT to monitor the status of any single-contact field device.

(This is where the model really fails!)

The reality of using only one PLC-input forces us to imagine that both of the outputs from the relay (either the Real-Relay or the Imaginary-Relay) are connected to the same PLC-Input. Now, remembering that the state of the “imaginary relay” is supposed to indicate the state of LS-2B, we get something like this...

FIGURE-4


2B
--| |--+--( ??? )
|
2B |
--|/|--+


.
Bonus Points if you can “read” this rung. (Thanks, Allen!)

The “–-( ??? )” represents the single, real, PLC Input.

I might not be the sharpest knife in the drawer, but, it looks to me like the PLC-input will ALWAYS be ON! No matter what the state of LS-2B is!

How can the PLC Input differentiate between the two possible conditions? How can you derive “UNIQUE” information from an “OR” source? How can a novice, familiar with even a little bit of logic, accept this concept?

I believe that this is the source of the confusion for many moderately experienced users as well as most novices.

To get past this faux pas, the model asks that you ignore the reasonable, logical conclusion that the model, itself, creates.

By asking novices to ignore that logical conundrum, the model is really asking novices to “Imagine an IMAGINARY-Relay”. This is quite different from being asked to “Imagine a Relay”.

When asked to “imagine a relay”, we can do so, very easily, because we are very familiar with what a relay is and how it works. We also assume the normal operating characteristics.

However, when asked to Imagine an “IMAGINARY Relay”, the word “Magic” is buried in there somewhere.

In any logic situation, you can not determine “UNIQUENESS” from an “OR” source. If, however, it is simply declared that WE WILL HAVE “UNIQUE” INFORMATION, despite the logical inconsistency... then, somehow, the normal characteristics of the Imaginary Relay have to be bent just a little to meet that illogical requirement.

So, whether spoken or not, the novice is being asked to imagine a relay that doesn’t quite follow the rules of logic as they are understood... they are being asked to Imagine an “IMAGINARY-Relay”, a relay that has just a bit of “magic” in it! (....it must be an Irish Relay). Somehow, the Imaginary Relay is expected to impart “UNIQUE” information from an “OR” source.

Hmmmm... how ‘bout this...

 
FIGURE-5
Imaginary
LS-2B or REAL
/ relay
------o o------------( coil )

normally open +-------------+
o----------------| |
| M A G I C |
-----------------------o | B O X |-----o (LED) PLC Input-0
\ | |
o----------------| |
normally closed +-------------+


.
 
The "Imaginary Relay" Problem, Part-2 of 2

So, we seem to have resolved the problem by just applying a little MAGIC!

Hmmm... isn't the essence of “magic” something to do with “that which defies logic?” That is, ILLOGICAL?

Well, it certainly does that! But, how can we expect logical responses from a system that appears to operate illogically? And, here’s the really interesting part... Whether the magic box is there or not, the PLC does indeed seem to make logical sense out of the input!!!

If we have to assume that the “Magic Box” is there, then we have to believe that, something has happened inside that “Magic Box”. Somehow, the Magic Box reads both of the inputs, and then determines what information to pass to the PLC.

This scheme is illogical and shouldn’t work, and yet, somehow, it appears that it does!
Now, how the hell can that be??????? What could that Magic Box be doing???????


With this inconsistency firmly entrenched in their minds, “imagine” the conflict and contradiction that some novices run into when they have to deal with Negative (or Reverse) Logic! I think, in that case, the confusion factor goes up by a factor of “Possible-States2”. They can’t help but feel they are in a “logical-rats’-nest”.


So, that’s how I perceived the “Imaginary Relay” model “problem” when I was first learning PLC’s. I made code work, but that damned “Magic Box” was gnawing at the back of my brain.

It wasn’t until I went to college for my Electrical Engineering Degree that I finally made the trip to the mountain-top and found the meaning of... well, not “life”, I already knew that one... but rather, the meaning of PLC-Type Logic.

When I reached the mountain-top, I asked my question. I received the following answer(?)...


“PLC-Type Logic,” said the Wisdom of the Ages, “like any other type of logic, is the pursuit of discovering, and then asking the ‘right’ questions. At its’ most fundamental level, the ‘right’ question in Logic is, ‘Is it TRUE?’ Then, by logical extension, the converse question is, ‘Is it NOT TRUE’. You can only reach Nirvana by crossing a ‘Bridge of YES’s’ from here to there!

Thinking ‘Positively’ will make your path easier. Thinking ‘Negatively’ places you on the Dark-Side... It’s scary over there, but that path too can be negotiated... if you are Pure of Heart!

Oh, and for Pete’s sake, don’t forget, the ‘it’ is a ‘something’, be sure to put a reasonable ‘Name’ on it!

Well, there ya go dude, now... please, step-aside... NEXT!


I was thunder-struck! The clouds cleared, the fog lifted! “Is it TRUE”, and “Is it NOT TRUE”. Imagine that!

When I returned from the mountain, I took up drinking beer, smoking cigarettes, drinking more beer, countering the beer with coffee, and then countering the coffee with more beer, and then, when I was finally in balance with the rest of the universe, I reconsidered the “Imaginary Relay” model. It still didn’t make any sense.

So... I considered what the heck the symbols --| |-- and --|/|-- were really all about.

I thought back on my trip to the mountain, “...the ‘right’ question in Logic is, ‘Is it TRUE?’ Then, by logical extension, the converse question is, ‘Is it NOT TRUE’. You can only reach Nirvana by crossing a ‘Bridge of YES’s’ from here to there! Thinking “Positively” will make your path easier.

Hmmmm... So, to get from here (left-rail) to there (output at the right rail), I need a “bridge of YES’s”. And I need to think “Positively” (at least, for now).

Well, I “positively” need a “bridge of YES’s”. And I “positively” believe that “YES” is the answer to a question. So... if I “positively” ask a question and “positively” get a “positive” answer, then that is the first “positive” step of my journey!

How do I ask a “positive” question? “...the ‘right’ question in Logic is, ‘Is it TRUE?’

Is “what” TRUE?

Thinking back on my old friend, LS-2B... “Is LS-2B TRUE”.

Hmmm... Isn’t that just a bit like “Is LS-2B Pure-of-Heart (YES/NO)?”
Or maybe... “Does LS-2B Exist (YES/NO)?”

I don’t care about its morals or its’ existential existence... I only want to know if the damned thing is ON or not. So... why not ask... “Is LS-2B ON?” Duuuhhh... there’s a thought!

OK, “Is LS-2B ON?”
If it is OFF, then the answer is NO! (Go To Jail! Do Not Pass GO! Go Directly to Jail!)
If it is ON, then the answer is YES! EUREKA!!! My first plank in the bridge!

And so, the journey begins!

Wait a minute... that doesn’t address the --| |-- and --|/|-- issue.

Hmmm... Ladder Logic is supposed to mimic typical, electrical, relay logic. So, looking at the --| |-- symbol in Ladder Logic and knowing that, in a typical, electrical, relay logic drawing, that same symbol requires that something Turn-ON to cause it to Close, I can then deduce (I hope you can too!) that the --| |-- symbol in Ladder Logic is “ASKING is it TRUE that “something” ON”! The answer has to be YES or NO!!!


--| |-- means...

“Is it TRUE that ‘SOMETHING is ON?’ ”



And then, by extension...

--|/|-- means...

“Is it NOT TRUE that ‘SOMETHING is ON?’ ” (i.e. Is it TRUE that “Something is NOT ON?”



Using our old friend LS-2B, I can ask...

Is it TRUE that “LS-2B is ON”?

LS-2B
IS ON
---| |----------( YES, LS-2B IS ON )


.
If the answer is YES, then the bridge is made and the output turns ON!
If the answer is NO, then the bridge is NOT made and the output turns OFF!

or I can ask...

Is it NOT TRUE that “LS-2B is ON? (i.e. “Is LS-2B NOT ON?”)


LS-2B
IS ON
---|/|----------( YES, LS-2B IS NOT ON )


.
The slash indicates that I should ask the “converse question”. That is, “Is it NOT TRUE”.

I read this rung thusly, “Is LS-2B OFF?”

If the answer is YES, then the bridge is made and the output turns ON!
If the answer is NO, then the bridge is NOT made and the output turns OFF!

Wow! Symmetry! The Universe really is in synch!


Then it occurred to me...

What does it mean if LS-2B is ON? What does it mean if LS-2B is OFF?

As it stands right now, I have NO IDEA!

I thought for a bit... going over the words that I heard on the mountain-top...

Ahhh... YES! “...for Pete’s sake, don’t forget, put a reasonable ‘Name’ on the ‘it’ part of the question.” That’s what I needed, a Name! But, I already had a name – LS-2B! What’s wrong with that?

Hmmmmmmm... (thinking... thinking... thinking... )

AH-HA! “A REASONABLE NAME”! I needed a Reasonable Name! A “Reasonable Name” as in REASONED! As in, “What is the Reason for this Input or Control Relay?”

ALERT !! -- BASIC LAW OF THE PLC UNIVERSE – ALERT !! (that means, pay attention)
The MOST fundamental step to be taken, before writing a single line of code, is to give REASONABLE NAMES to your Inputs and Control Relays.


So, let’s say that LS-2B monitors the status of a door, actually, it monitors if the door is “Closed”. So, my questions now become...

Is it TRUE that “The Door is CLOSED?”

DOOR IS
CLOSED
---| |----------( YES, The Door is CLOSED )


.


or I can ask...

Is it NOT TRUE that “The Door is CLOSED? (i.e. “Is the Door NOT Closed?”)


DOOR IS
CLOSED
---|/|----------( YES, the Door is NOT CLOSED )


.
The slash indicates that I should ask the “converse question”. That is, “Is it NOT TRUE”.

I read this rung thusly, “Is the Door NOT Closed?”




Here’s how I look at that Imaginary-Relay now...



FIGURE-2

BOGUS BOOOOOGGUUUSS! REAL! REAL

LS-2B Imaginary
/ Relay
------o o------------( coil )
+----------------+
normally open | DOOR IS |
o-------------------X CLOSED |
| / |
-----------------------o | --o o-----|-----o (LED) PLC Input-0
\ | LS-2B |
o-------------------X |
normally closed | |
+----------------+


.



Hmmmm...Imagine that.

If the Door is Closed, then LS-2B is Closed, and Input-0 is ON... “DOOR IS CLOSED”
If the Door is NOT Closed, then LS-2B is Opened, and Input-0 is OFF... “DOOR IS NOT CLOSED”

DOOR IS
CLOSED
---| |----------( YES, The Door is CLOSED )
Input-0


DOOR IS
CLOSED
---|/|----------( YES, the Door is NOT CLOSED )
Input-0


.

Hmmmm... Well... That was interesting.

I then got down to do some serious PLC programming. The only complications I run into these days (that is, only with respect to the PLC “Imaginary-Relay” issue – I still have my KEEPERS don’ cha know?) are related to the complexities of delving deeper and deeper into the “What-If”.

Speaking of “What if...”, I couldn’t help running into the following situation:

How do I know that the Limit Switch is configured so that the presence of a signal means “YES, The Door is CLOSED”? What if the switch is wired using the Normally Closed contact? The presence of the signal would then mean, “DOOR IS NOT CLOSED”.

FLASH-BACK...
”Thinking “Positively” will make your path easier. Thinking “Negatively” places you on the Dark-Side... It’s scary over there, but that path too can be negotiated... if you are Pure of Heart!”


That, Boys and Girls, is a story for another day!

Besides, I have to work on the "Pure-of-Heart" thing.
 
FIGURE 2

HI TERRY

REFER TO FIGURE 2 STATES THAT
Again, assuming the system is healthy, when the limit switch is OFF, the relay is OFF:

The Normally Opened Contact is OPENED and the LED, at PLC Input-0, is OFF.

The Normally Closed Contact is CLOSED and the LED, at PLC Input-1, is ON.

When the limit switch is ON, the relay is ON:

The Normally Opened Contact is OPENED and the LED, at PLC Input-0, is OFF.

The Normally Closed Contact is CLOSED and the LED, at PLC Input-1, is ON.

PERHAPS THE SECOND PARAGRAPH SHOULD BE REVERSE OF FIRST PARAGRAPH PLEASE CLARIFY

THANKS
PERSPOLIS
 
Last edited:
You are correct, PERSPOLIS

I can only claim that as a draw-back of "cut-n-paste" and poor editing.



The text after Figure 2 in Part-1 should read as follows...

Again, assuming the system is healthy...

When the limit switch is OFF, the relay is OFF:

The Normally Opened Contact is OPENED and the LED, at PLC Input-0, is OFF.
The Normally Closed Contact is CLOSED and the LED, at PLC Input-1, is ON.



When the limit switch is ON, the relay is ON:

The Normally Opened Contact is CLOSED and the LED, at PLC Input-0, is ON.
The Normally Closed Contact is OPENED and the LED, at PLC Input-1, is OFF.


And BTW, the Figure-2 in Part-2 should be identified as Figure-6.
 
Terry Woods said:
The Imaginary Relay model asks that you “Just go with it... and, Have FAITH”.

I thought that's the line you give the kids when they start questioning whether Santa is real or not...
santa8.gif


I didn't know it applied to imaginary relays as well... :D

In any case, well done as always Terry!

beerchug

-Eric
 
Personally Teery, I think you can shorten this. Make it simpler to understand for many. Thats my faith in you.

Its good but its long, you do know what happens when something is long.

BTW: You have probably won the HOW TO contest.
 
But he IS real!

Actually, Terry ole buddy, the way I look at it, a PLC input isn't really an imaginary relay. An input is a real relay, really, but it is really a solid state real relay. The "coil" is the transistor or triac on the input card, and the output sets the satus bit to "0" or "1" in the I/O status register. I imagine you can call the contacts in the ladder logic imaginary, but why make life more complicated? True/False, On/Off, Conducting/Non-Conducting, TomAto/Tomotto, let's call the whole thing off!

The beauty of ladder logic is precisely that it really mimics real relays. If the coil is set the NO contacts conduct and the NC contacts don't. This is all fairly straight forward, and while your comments about nomenclature are right on the mark, that applied to real relay logic and high level language programming as well. I had lots of interesting discussions with rookies drawing JIC relay ladder diagrams on why I wanted them to use "System OK Relay" for a relay where the coil was set on power up and dropped out on failure or power loss.

Really!
 
Imaginary something or other

Terry, did you not get anything for Christmas? That has to be on of the most in-depth treatments of plc stuff I have seen outside of a text book. You really need a hobby, or something! This little computerized whiz is just a simple little thing that turns stuff on and off. Oh yes, it is a computer and does all kinds of really neat other stuff too, but still it is about stuff turning off and on.
People generally make way to much of what a plc is and how complicated it is to understand. When really, a little faith is a good thing and helps in all kinds of ways to understand the complex world we live in. Plcs however are so simple that they actually appear hard to some because of their simplicity. The real trouble comes trying to explain programming instructions that look like relay contacts and aren't. The ---------] [-------- XIC and its counterpart the ---------]/[-------- XIO are the main reason for the confusion all these years and have led engineers and others to try to explain this instruction confusion with such drivel as imaginary relays and other such garbage. When actually we are at a point that working folks in factories are the same ones who go home and surf the internet and deal with spread sheets on the job and at home. Windows is a reality and we need not try and cover up for the plc being a computer any longer as we once thought we had to in the "good old days". I have taken the approach in my class, that I teach twice a year, that my students will be taught that the plc is a computer from the beginning. We concentrate on instructions and what they mean and so that what is connected in the field to the I/O is not a factor to understanding what a given instruction does. So, I am glad you took the time to put a first class presentation together and we shall all be the better for it.
 
XIC (or the corresponding symbol, regardless of brand) is an INSTRUCTION, not a contact. It instructs the processor to check the state of a bit in memory - looking for a 'one'. When I was learning PLC, I actually taught myself to refer to the XIC as the "look for a one" instruction.
XIO is therefor the "look for a zero" instruction.

For folks that INSIST on referring to these 2 instructions as "normally open" and "normally closed", have them draw the ladder logic to "seal in" an output instruction, with a normally open start button and a normally closed stop button.

That single example should break them of the habit and provide the ultimate "aha!" moment.
 
XIC (or the corresponding symbol, regardless of brand) is an INSTRUCTION, not a contact. It instructs the processor to check the state of a bit in memory - looking for a 'one'. When I was learning PLC, I actually taught myself to refer to the XIC as the "look for a one" instruction.
XIO is therefor the "look for a zero" instruction.

For folks that INSIST on referring to these 2 instructions as "normally open" and "normally closed", have them draw the ladder logic to "seal in" an output instruction, with a normally open start button and a normally closed stop button.

That single example should break them of the habit and provide the ultimate "aha!" moment.

I still beg to disagree. I have not only programmed that circuit with ladder logic, I have built it and wired it with old-school physical relays and pushbuttons.
 
For folks that INSIST that the method that helps them understand a concept is the best way for everyone, I say take a deep breath. Different people learn and process information differently. To some people the XIC/XIO construct does a better job explaining the concept. For others the relay model is more intuitive. As far as I'm concerned the universal perfect model has yet to be invented.
 
This thread is hilarious. I will have to read it again if I get a bad case of insomnia
 
I just put random instructions together and get the FAT guy to fix it.
Yes, I do call my Factory Acceptance Tester the FAT guy.
Yes, I do call myself the FAT guy when running a Factory Acceptance Test.
 

Similar Topics

Hi, Can someone briefly explain me what exactly an "imaginary bit" is? Thanks,
Replies
8
Views
2,275
Question to anyone with ideas about my thoughts on upgrading a very vintage timer, which is being used to switch between 2 5hp domestic water...
Replies
14
Views
364
I have an application where I want to use a safety relay in combination with a flame detector as the sensing element. The flame detector has relay...
Replies
23
Views
922
Hi guys, I am looking for a good replacement for an Omron smart relay. A customer of ours has a couple of these and they are beginning to fail. As...
Replies
14
Views
1,088
Back
Top Bottom