You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old September 9th, 2006, 01:23 PM   #1
bobby1234
Member
United States

bobby1234 is offline
 
Join Date: Jun 2006
Location: houston
Posts: 12
Rung scanning - fundamental question

Hello everyone,

I have a fundamental question about typical A/B PLC rung scans.

Consider the following:

A B
---][-------()---

From what I have understood it means the following:

IF A = true THEN
B = true;
ELSE IF A = false THEN
B = false;
END IF;

So that means that each rung actually implies two statements:
one when A will be true and the other when A is false.

So if B is true above this rung somewhere and when the processor reaches this rung and A is false, IT WILL SET B TO FALSE.

Please tell me if I am wrong because this is an important point. I have a background in higer level programming (C, VB.NET, C#) and in those languages, true and false conditions have to be explicitly defined. False conditions are not evaluated so if A is false then nothing will happen to B, if it set to 1 above this rung, B will remain 1. If B is 0, it will still be 0. It seems that this is a very big and fundamental difference between ladder language programming and higher level programming.

Please advise.

Thanking you all,
Bobby1234
  Reply With Quote
Old September 9th, 2006, 01:43 PM   #2
randylud
Member
United States

randylud is offline
 
randylud's Avatar
 
Join Date: Oct 2002
Location: Greensboro,NC
Posts: 933
You are correct in your thinking about the single rung you posted. The input bit condition you defined as A controls the on and off state of the output bit condition B. If A is true, then B will be true and if A is false, then B will be false. This is a universal truth and global as far as its effect in the PLC program and memory. PLCs and ladder logic programming are really very simple but powerful nonetheless.
__________________
Thunder is good, thunder is impressive; but it is lightning that does the work!
Mark Twain-8/28/1908
  Reply With Quote
Old September 9th, 2006, 01:59 PM   #3
Ron Beaufort
Lifetime Supporting Member
United States

Ron Beaufort is offline
 
Ron Beaufort's Avatar
 
Join Date: Jul 2002
Location: Charleston, SC
Posts: 5,320
Greetings bobby1234,



my distinguished colleague Randy has already given you the correct answer ... but if you’re looking for more detail, then “Step 2” in this post may help ...



and if you’re looking for the “just-turn-on-it-but-don’t-turn-it-off” equivalent in ladder logic, then take a careful look at the Latch instruction used in Rung 0003 of this post ...



hope this helps ... and yes, you’re right ... there are some big differences between “higher languages” and “ladder logic” ... and much debate about which is the “better” of the two ...

and a slightly more accurate way of phrasing your original “statement” would be:

IF A = 1 THEN 
LET B = 1
ELSE IF A = 0 THEN
LET B = 0
END IF





the distinction between “true” and “1” - and the distinction between “false” and “0” might seem to be minor issues - but they have MAJOR implications in many cases ...
__________________

2-B ?
Best regards, ----+----] [----+------------( )----
Ron | |
PLC Training Boot Camp | 2-B |
+----]/[----+

I once was lost, but now am found, was blind, but now I see.


Last edited by Ron Beaufort; September 9th, 2006 at 02:07 PM.
  Reply With Quote
Old September 9th, 2006, 02:05 PM   #4
SimonGoldsworthy
Member
United Kingdom

SimonGoldsworthy is offline
 
SimonGoldsworthy's Avatar
 
Join Date: Mar 2005
Location: England
Posts: 1,079
Although I'm not familiar with A/B processing rules, I've commented here as bobby1234 has posted a step 7 related question.

Note that block containing that rung must be called and there must be no jumps around that rung of logic. If the rung is not executed then the coil would stay at the last state it was processed.

Edit: surely the high level statement would be:

b:=a;

Last edited by SimonGoldsworthy; September 9th, 2006 at 02:07 PM.
  Reply With Quote
Old September 9th, 2006, 02:29 PM   #5
Ron Beaufort
Lifetime Supporting Member
United States

Ron Beaufort is offline
 
Ron Beaufort's Avatar
 
Join Date: Jul 2002
Location: Charleston, SC
Posts: 5,320
Greetings Simon,

Quote:

surely the high level statement would be:

b:=a;
certainly you're correct ... but many (most?) people who are just beginning to learn ladder logic programming don't instinctively recognize it that way ...

by stating it the way I did, I've set the stage for teaching a "latch" rung as:

IF A = 1 THEN 
LET B = 1
END IF



and also for teaching an "unlatch" rung as

IF A = 1
THEN LET B = 0
END IF



the “A = B” approach, while perfectly valid for the original rung, doesn’t lend itself very well at all to the upcoming lessons of latches and unlatches ...

my favorite approach to teaching this stuff is to (hopefully) give one cohesive line of explanation which will work for all (or at least for most) situations ...
__________________

2-B ?
Best regards, ----+----] [----+------------( )----
Ron | |
PLC Training Boot Camp | 2-B |
+----]/[----+

I once was lost, but now am found, was blind, but now I see.


Last edited by Ron Beaufort; September 9th, 2006 at 03:26 PM.
  Reply With Quote
Old September 9th, 2006, 02:43 PM   #6
SimonGoldsworthy
Member
United Kingdom

SimonGoldsworthy is offline
 
SimonGoldsworthy's Avatar
 
Join Date: Mar 2005
Location: England
Posts: 1,079
bobby1234 - when you posted A/B in the original post, did you mean Allen Bradley or were you simply referring to the A and the B in your ladder logic ?
  Reply With Quote
Old September 9th, 2006, 03:13 PM   #7
bobby1234
Member
United States

bobby1234 is offline
 
Join Date: Jun 2006
Location: houston
Posts: 12
Thank you for your quick responses. This was one of the questions that was really bothering me. And it is good have gurus here that can show me the way . I have read the posts in this forum and there are some very good responses. I especially like your "overkill" approach Ron Beaufort. It can really clear up a lot of issues.

Simon Goldsworthy, thank you for your post for the Siemens PLC. Currently I am working on Siemens but I am very familiar with A/B PLCs because I wrote HMI software before that interacted with A/B PLCs. I am doing PLC programming nowdays. As such I wanted to clear my basics. I have responded to the your post at the other thread.

Once again, thank you randylud, Ron Beaufort and Simon Goldsworthy! I really appreciate that.
  Reply With Quote
Old September 9th, 2006, 05:02 PM   #8
SimonGoldsworthy
Member
United Kingdom

SimonGoldsworthy is offline
 
SimonGoldsworthy's Avatar
 
Join Date: Mar 2005
Location: England
Posts: 1,079
Ron, I was swayed by bobby1234's background of C which was making me think of the short but sweet answers!

A latch or Set would be

B:=A OR B;

An unlatch or Reset would be

B:=B AND NOT A;
  Reply With Quote
Old September 9th, 2006, 05:35 PM   #9
Terry Woods
Member
United States

Terry Woods is offline
 
Join Date: Apr 2002
Posts: 3,170
In terms of the original question...

"Normal" Ladder Outputs are "LOOKING" for a reason to BE ON!

If that reason exists, then the Output will be ON. If not, it will be OFF.

What that means is... if you have a rung where any number of branches indicates that the output should be off, and at the same time, you have at least one branch which indicates that the output should be on... the output WILL be ON!

In most PLCs the Output is indicated by a positive assertion, symbolically, ---(...). In some PLCs, the Output might also be indicated by a negative assertion, namely, ---( / ).

In the case of the negative assertion, the output is LOOKING for a reason to be OFF.

In that case, if you have a rung where any number of branches indicates that the output should be on, and at the same time, you have at least one branch which indicates that the output should be off... the output WILL be OFF!
  Reply With Quote
Old September 9th, 2006, 06:06 PM   #10
Peter Nachtwey
Member
United States

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: Vancouver, WA, US
Posts: 6,553
Simon is actually the closest to the truth. If you program a S7 can convert the LAD to STL you will see. The condition is evaluated to a true or false and that result is store in the output(s).

A simple example as bobby1234 presents would not be converted to an if then else.

Simon is also right about how a latch and unlatch is done. The computers inside the PLC do not have latch and unlatch instrucitons. They do have AND, OR and NOT instructions.

So how does Phil do it on his PLC simulator?
  Reply With Quote
Old September 9th, 2006, 06:11 PM   #11
PeterW
Member
Canada

PeterW is offline
 
Join Date: Jun 2006
Location: Edmonton
Posts: 2,515
Of course.. and then you have Modicon........
  Reply With Quote
Old September 9th, 2006, 08:30 PM   #12
Sergei Troizky
Member
Canada

Sergei Troizky is offline
 
Join Date: Oct 2004
Location: Montreal
Posts: 686
Quote:
Originally Posted by bobby1234
Hello everyone,
Quote:
Originally Posted by bobby1234

I have a fundamental question about typical A/B PLC rung scans.

Consider the following:

A B
---][-------()---

From what I have understood it means the following:

IF A = true THEN
B = true;
ELSE IF A = false THEN
B = false;
END IF;

So that means that each rung actually implies two statements:
one when A will be true and the other when A is false.

No. For coil output it will be:
IF A = true THEN
B = true;
ELSE B = false;
END IF;

So if B is true above this rung somewhere and when the processor reaches this rung and A is false, IT WILL SET B TO FALSE.
Correct.

Please tell me if I am wrong because this is an important point. I have a background in higer level programming (C, VB.NET, C#) and in those languages, true and false conditions have to be explicitly defined. False conditions are not evaluated so if A is false then nothing will happen to B, if it set to 1 above this rung, B will remain 1. If B is 0, it will still be 0. It seems that this is a very big and fundamental difference between ladder language programming and higher level programming.
Not always. For coils and many instructions false conditions ARE evaluated.

Bobby1234

..
  Reply With Quote
Old September 10th, 2006, 10:53 AM   #13
Ron Beaufort
Lifetime Supporting Member
United States

Ron Beaufort is offline
 
Ron Beaufort's Avatar
 
Join Date: Jul 2002
Location: Charleston, SC
Posts: 5,320
if this is the ANSWER, what the heck does the QUESTION look like? ...

Greetings to one and all ...



first a note to my former (and even future) students who might be reading this thread ...



Quote:
relax, ladies and gentlemen ... all is well ... nothing has changed ... the same rules that I taught you are still fully in effect ... the methods of rung and program analysis that we covered in the class still work flawlessly for all of the Allen-Bradley PLC processors that we covered ... again I say, relax ... now think back to the first morning of class ... remember how I fully explained a foolproof step-by-step method of analyzing and interpreting each of these basic ladder instructions: XIC, XIO, OTE ... and I showed you how to work out the “one/zero” status for any (I repeat ANY rung) regardless of how convoluted and complicated the branching structure of that rung might appear on the screen ... remember how we covered “double-coils”, and other points of confusion, and how each of those issues would affect the operation of the program ... now remember a day or two later when I covered the same type of foolproof step-by-step analysis for the OTL and OTU instructions ... and you learned about the safety implications of those “retentive” instructions ... all of that knowledge remains unchanged ... do not fear ... just think back and convince yourself ... remember the first morning of the class and how I gave you the “Golden Nugget of Truth” ... remember how I led you on the “Path of Enlightenment” ... and then remember what happened next ... I (the good instructor) suddenly became the EVIL instructor ... (shades of Socratic irony) ... I began “explaining” these very same basic concepts in the “old” ways that you (the students) had been hearing around the plant for years ... I began using the same incorrect terminology that you had “learned” from other sources before the class began ... and I put one “curveball” program after another - after another - after another - on the board for you to consider and discuss... and I “explained” the operation of these rungs to you using the fundamentally FLAWED methods that others before me had used in their ill-fated attempts to educate you in the mysteries of PLCs ... in short, I did everything within my diabolical power to confuse you ... and so - the stage was finally set ... I then sent you (the students) up to the whiteboard armed only with a marker - and with the knowledge that I had given you ... I forced you to analyze each of those convoluted, twisted, complicated, sadistic, devil-spawned rungs ... I watched closely as you worked step-by-step through the method of analysis that I had taught you ... and I cheered inwardly (and at times outwardly) when you knocked my “meant-to-be-confusing-curveball” questions right out of the proverbial ballpark ... I proved to myself - and (more importantly) to you - that you actually KNEW and fully UNDERSTOOD, at long last, the knowledge that had been eluding you throughout all of those many weary years of PLC confusion ... yes ... you (the good students) where able to CORRECT me (the evil instructor) when I tried to contradict the “Golden Nugget of Truth” ... you (the good students) were able to LEAD me (the evil instructor) when I tried to stray from the “Path of Enlightenment” ... remember ... you (each and every one of you) plucked the pebble from my hand - and, in so doing, you claimed at last the awesome potential that had always dwelt within you ... remember ... and rest assured, none of that has changed ...


as I said, that was for my students ... now for the rest of you guys ...



stop it ... you’re scaring the children ...



this would be a good place for a cute little smiley-face - but somehow I just can’t force myself to use those things ... but, of course, I’m just joking with you ...



yes, all of the things that are being said in this thread are basically correct ... and yes, the methods that you’re using to explain the operation of the PLC are fundamentally sound and valid ... but personally, I don’t use these particular methods of explaining the basic operation of the PLC in the technician-level classes that I teach ... remember that most of my students don’t sit in front of a computer and work on PLCs every day ... instead, most of these people have screwdrivers in their back pockets and they only touch the software once or twice a month - and in some cases, only once or twice a year ... what I teach them in a one-week class HAS to be something that they’ll fully understand, and will be able to remember, and will feel CONFIDENT in applying once they’re back on the job ... and what I teach them has to WORK every time they use it ... and we’ve only got one single solitary week to start with XIC, XIO, and OTE - and go all the way through BTR and BTW for analog signals ... “intense” and “demanding” are the most polite ways that most students describe this five-day period - so please don’t get the impression that the material is somehow “watered down” in any way ... in many (most?) cases we go much deeper into the “nuts-and-bolts” than this thread has been going ... consider this: the original rung (in the first post) only had TWO very simple instructions ... what happens when you take a confused beginner and try to teach him/her anything much beyond that basic rung - using some of the “teaching” techniques that have been offered in this thread? ... most of us know the answer to that question from bitter personal experience ... basically you get a student who has “learned” a lot of perfectly valid knowledge - but has absolutely no systematic method of applying that knowledge to the "get-the-machine-fixed" problems that occur out in the field ... I’ve got to send my students back to their bosses with something useful to “hang-their-hats-on” ... so let’s continue the discussion - but rest assured, there are other ways of explaining the same fundamental concepts that we’re dealing with here ... personally I like variety ... but keep in mind that not all students respond to the same material in the same way ... one size does NOT fit all ... and my method of explanation may vary ...

PS Edit: just in case I failed to make my primary point ... no, I do NOT use the IF...THEN...ELSE method of explanation in my classes ... but I certainly have no problems with discussing it ...

party on ...
__________________

2-B ?
Best regards, ----+----] [----+------------( )----
Ron | |
PLC Training Boot Camp | 2-B |
+----]/[----+

I once was lost, but now am found, was blind, but now I see.


Last edited by Ron Beaufort; September 10th, 2006 at 11:09 AM.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Rslogix5 plcdb222 LIVE PLC Questions And Answers 21 September 29th, 2006 09:32 AM
Simple question regarding rung branches Bobby Stacks LIVE PLC Questions And Answers 1 May 27th, 2005 09:28 AM
Fundamental question about automation huynt LIVE PLC Questions And Answers 30 April 2nd, 2005 10:01 PM
Start of Scan Beryl LIVE PLC Questions And Answers 31 September 25th, 2003 10:11 AM
PLC Rung Scanning ControlLogix LIVE PLC Questions And Answers 2 February 4th, 2003 08:22 AM


All times are GMT -5. The time now is 09:41 PM.


.