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 October 9th, 2002, 05:32 AM   #1
s_viswesh
Member
India

s_viswesh is offline
 
Join Date: Oct 2002
Posts: 13
Unhappy Update/evaluation of internal relays/contacts...PLEASE HELP

Hi,

I understand that all physical inputs are scanned during the "input scan" before the "program scan" phase.
But is this true for internal relay, contacts & registers also?

i.e.(1) Are internal relays energised during "Output scan phase" or do they get energised immediately as the rung logic goes true?

2) The state of contacts corresponding to internal relays: Is it checked only at the beginning of the program or is it checked each time the element is encountered?

The "How a ladder is scanned" topic in your contents seems to suggest that internal contacts are checked each time they are encountered in a rung. Your help will be highly appreciated.


regards
Viswesh
  Reply With Quote
Old October 9th, 2002, 06:17 AM   #2
paraffin power
Member
England

paraffin power is offline
 
paraffin power's Avatar
 
Join Date: Aug 2002
Location: Manchester
Posts: 439
Hi
Internal relays (flags) are energised immediately on rung execution.
Physical outputs are energised in the process output image immediately, but the actual outputs are written at the end of the scan.
Flag status is interrogated each time it is encountered, not just at the beginning of the scan.

Hope this helps
  Reply With Quote
Old October 9th, 2002, 11:05 AM   #3
Eric Nelson
Lifetime Supporting Member + Moderator
United States

Eric Nelson is offline
 
Eric Nelson's Avatar
 
Join Date: Apr 2002
Location: Randolph, NJ
Posts: 4,346
Viswesh, you posted the same question in 2 threads. I answered your question in the OTHER one, then found this one...

beerchug

-Eric
  Reply With Quote
Old October 9th, 2002, 12:05 PM   #4
s_viswesh
Member
India

s_viswesh is offline
 
Join Date: Oct 2002
Posts: 13
Hi "paraffin power",

Thanks for your reply.
Is what you said true for all PLC softwares or the behaviour could be different in different softwares? i.e.Is it a charecteristic of a PLC program?

What about the contacts corresponding to physical outputs?
Are they also evaluated each time they are encountered? But I think even if they are evaluated each time, they wont change state in the middle of a program, because the outputs are anyway updated only at the end. right?

thanks a lot. I'm very glad I found this forum on PLC.

regards
viswesh
  Reply With Quote
Old October 9th, 2002, 12:14 PM   #5
paraffin power
Member
England

paraffin power is offline
 
paraffin power's Avatar
 
Join Date: Aug 2002
Location: Manchester
Posts: 439
All traditional plcs follow this format.
Contacts from outputs are evaluated each time they are encountered, but the actual output is only updated at the end of scan. The process output image can change many times within the scan, but the last state before updating the outputs will be the output's 'actual' state.
  Reply With Quote
Old October 9th, 2002, 12:22 PM   #6
Jay Anthony
Member
United States

Jay Anthony is offline
 
Jay Anthony's Avatar
 
Join Date: Apr 2002
Location: Dallas, TX
Posts: 645
Quote:
What about the contacts corresponding to physical outputs?
Are they also evaluated each time they are encountered? But I think even if they are evaluated each time, they wont change state in the middle of a program, because the outputs are anyway updated only at the end. right?
He just doesn't get it, does he?

All inputs, outputs, internal coils and contacts are sampled throughout the scan and registered to the image table. An output that is energized in Rung 1 is immediately available in Rung 2.
Don't confuse the image table with the I/O table which is normally updated at the bottom of scan.
Quote:
Is what you said true for all PLC softwares or the behaviour could be different in different softwares? i.e.Is it a charecteristic of a PLC program?
All PLCs are created equal with respect to above. (Boy, am I opening up another thread!)

  Reply With Quote
Old October 9th, 2002, 12:26 PM   #7
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
Eric Nelson nailed it - if you understand what he said, don't let me confuse you. What follows is my traditional "overkill" approach - if you're still confused, maybe more words will help.

Processor scan sequence.

For simplicity’s sake, the following discussion is based on an Allen-Bradley SLC-5/04. The scan sequence of most other processors is identical or very similar. This discussion is limited to discrete (off or on) signals associated with modules located in the same chassis with the processor. In other words, with “local I/O”. We are not using Immediate Input or Immediate Output instructions in this simple discussion. We are not using Jumps (to Labels) or Subroutines in this simple discussion. In other words, we are trying to keep this discussion as simple as possible.

Mentally divide the processor SCAN into three separate steps.

Step 1 - update the input image table. In this step, the processor checks each input address in the following manner: If there IS a signal present at the input module screw, put a “1” in the bit associated (by its address) with that screw. If there is NOT a signal present at the input module screw, put a “0” in the bit associated (by its address) with that screw. Specific definition: input bits are bits whose addresses begin with the letter “I”.

Step 2 - execute the ladder logic. In this step, the processor executes the rungs one at a time, in order, going from top to bottom. If the instructions on a rung command the processor to turn ON a particular bit, then the processor will place a “1” in that bit. If the instructions on a rung command the processor to turn OFF a particular bit, then the processor will place a “0” in that bit. It does NOT matter whether the particular bit being controlled is an output bit - or an internal bit - or even (believe it or not) an input bit. The processor will write the commanded “1” or “0” instantly - before moving on to the next instruction. The processor scans ALL of the ladder rungs before it goes on to the next step.

Step 3 - send the output image table to the output modules. In this step, the processor takes the “1” or “0” contents of the output bits and sends this information to the output modules. At this point, any real-world outputs which are marked with “1” are turned ON.
Any real-world outputs which are marked with “0” are turned OFF. Specific definition: output bits are bits whose addresses begin with the letter “O”.

Now the processor goes back to Step 1 - and starts the scan over again.

Elaborating on Step 2 - Suppose that the conditions on a rung at the top of the ladder command the processor to turn ON a particular output bit. But then the conditions on a rung at the bottom of the ladder command the processor to turn OFF the SAME output bit. (Normally this would be an error in programming). Question: will the real-world output (example: a lamp) be ON - or will it be OFF - or will the lamp FLICKER on and off very rapidly? Answer: the real-world output will be OFF. This is because the last rung which executed caused the processor to write a “0” into the output bit. And remember, the processor does not actually send the contents of the output table to the output modules until Step 3 - at the end of the scan. Yes, the processor DID change the contents of the output bit to a “1” when the first rung executed - but the output module had no way of knowing about that intermediate ON condition. Simply put: the processor controlled the bit - but the processor didn’t tell the output module about the bit’s ON/OFF status until after all of the ladder rungs were scanned.

Where most people go wrong: They confuse the INSTRUCTIONS (XIC, XIO, OTE, etc.) in the ladder program with the actual BITS in the processor’s memory. Bits and instructions are NOT the same thing.

Basic idea: a BIT is a box in the processor’s memory. This box can hold either a “1” or a “0”.

Basic idea: the INSTRUCTIONS in the ladder program are called “instructions” for a reason. They literally are instructions FROM (you) the programmer TO the processor. These instructions tell the processor to “examine a bit to see if it contains a 1” or to “examine a bit to see if it contains a 0” or to “go write a 1 or a 0” into a particular bit. The processor obeys these instructions instantly as soon as the rungs are executed. Specifically, the processor does exactly what the ladder commands it to do and “examines a bit” or “writes to a bit” instantly - whether the bit in question is an output bit (example: O:2/0) or an internal bit (example: B3/0) or even an input bit (example: I:1/0) makes no difference.

On the other hand, the processor only communicates with the input modules BEFORE any of the ladder rungs are executed. And further, the processor only communicates with the output modules AFTER all of the ladder rungs are executed.

I think that I have answered your question. If not, please post again with any specific questions which remain, and I will try again as my work schedule permits.

Secret handshake: reread the description above - and every time you see the word “bit”, substitute the word “box”. This rings the bell for many people.

Finally, if you are trying to write your own program to execute ladder logic, try double-clicking the rung numbers in RSLogix. This will give you a simple way of analyzing the exact order in which the processor executes the instructions on any particular rung. This should be very helpful when you start working with multiple branches.
__________________

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.

  Reply With Quote
Old October 10th, 2002, 03:52 AM   #8
Gerry
Member
New Zealand

Gerry is offline
 
Join Date: Jun 2002
Location: Auckland
Posts: 1,142
Quote:
All traditional plcs follow this format.
Contacts from outputs are evaluated each time they are encountered, but the actual output is only updated at the end of scan. The process output image can change many times within the scan, but the last state before updating the outputs will be the output's 'actual' state.
Which brand and model do you consider to be the standard for the "tradition"?
As far as I know, the first 'thing' that was called a 'PLC' was the Allen-Bradley 1774. A-B even registered the trademark. FYI, it definitely did NOT work as you describe. Indeed, any A-B system using remote I/O does not work the way you describe, nor does any ControlLogix system.
  Reply With Quote
Old October 10th, 2002, 03:56 AM   #9
paraffin power
Member
England

paraffin power is offline
 
paraffin power's Avatar
 
Join Date: Aug 2002
Location: Manchester
Posts: 439
And do you think that he is using a 1774?
  Reply With Quote
Old October 10th, 2002, 04:03 AM   #10
Gerry
Member
New Zealand

Gerry is offline
 
Join Date: Jun 2002
Location: Auckland
Posts: 1,142
Well, it seems to me he's not using anything. Rather, he's trying to brew his own. Problem is, he doesn't seem to know diddly about what he's trying to duplicate.

Forget about the 1774 - synchronous I/O scan is not universal.
  Reply With Quote
Old October 10th, 2002, 05:07 AM   #11
PLucas
Member
England

PLucas is offline
 
PLucas's Avatar
 
Join Date: Apr 2002
Location: Gillingham Kent
Posts: 1,743
Ron Beaufort

I thought your description of a processor scan sequence was superb and very easy to follow.

In fact I have done a straight copy and paste and printed out your description to give to our apprentice who cannot seem to grasp the basic concept of PLC scans. I have tried to explain to him how it works, but I am not very good at explaining tech stuff, even if I know how they work.

your post hit's the nail on the head in laymans terms as well!

This could save me a lot of time and effort in the future when, no doubt, I am quizzed about how a PLC works.

I have marked my print out copyright of Ron Beaufort.

Paul
  Reply With Quote
Old October 11th, 2002, 05:08 AM   #12
s_viswesh
Member
India

s_viswesh is offline
 
Join Date: Oct 2002
Posts: 13
Hi,

Thanks for all the replies.
The doubt originally arose from this situation:

LADDER1 :

| I:1 O:1
|---||-------()---------
|
| O:1 O:2
|---||-------()---------

So my doubt was
(a)will O:1 & O:2 both get activated at the end of scan1
OR
(b)O:1 gets activated at end scan1 & O:2 at end of scan2.

(These 2 cases might not be significantly different from a physical point of view,
since the scan rate is very high. But this matters to me when I see it from an implementation
point of view i.e. creating my own PLC compiler & interpreter.)

From Ur explanation I conclude that case(a) is true?
But Intuitively I feel that it should be case(b).
(consider that this is a physically wired system with physical relays)



LADDER2 :

| I:1 B3:1
|---||-------()---------
|
| B3:1 B3:2
|---||-------()---------

What about this ladder2, where B3:1, B3:2 are internal relays.

LADDER3 :

| I:1
|---||-------(R2 = 10)---------
|
| I:1
|---||-------(R3 = R2)---------

(a)R3 = 10 at end of scan1;
OR
(b)R3 = 0 at end of scan1 & R3 = 10 at end of scan2;

(Please see my new post in the "Open source PLC project thread" also)


regards
Viswesh
  Reply With Quote
Old October 11th, 2002, 08:38 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
Yo, Viswesh,

In Ladder 1:

Suppose that I:1 is OFF - for many scans. Both O:1 and O:2 are also OFF during these scans. Then suppose that I:1 comes ON for "this" scan. Both O:1 and O:2 will be ON at the end of "this" scan.

In Ladder 2:

Suppose that I:1 is OFF - for many scans. Both B3:1 and B3:2 are also OFF during these scans. Then suppose that I:1 comes ON for "this" scan. Both B3:1 and B3:2 will be ON at the end of "this" scan.

In Ladder 3:

Answer: Suppose that R2 and R3 are both equal to 0. Suppose that I:1 is OFF - for many scans. Then suppose that I:1 comes ON for "this" scan. Then R3 will equal 10 at the end of "this" scan.

Secret handshake: A PLC is a COMPUTER. There is nothing inside the PLC which looks like ladders, rungs, open contacts, closed contacts, coils, etc. On the other hand, What IS inside the PLC is logic which looks something like this (using the two rungs of your Ladder 1 for an example):

IF I:1 = 1 THEN
LET O:1 = 1
ELSE IF I:1 = 0 THEN
LET O:1 = 0
END IF
END IF

IF O:1 = 1 THEN
LET O:2 = 1
ELSE IF O:1 = 0 THEN
LET O:2 = 0
END IF
END IF

The PLC's programming software makes this "computer geek talk" look like ladders, rungs, open contacts, closed contacts, coils, etc.

Now, are you sure you really need to build your own PLC to scan Ladder Logic? If I understand your project correctly, you might just be better off to simply program the necessary control logic in a structured text format - which I assume you are much more familiar with.

Hope this helps.

PS - If you are trying to use Allen-Bradley type addressing - you have some minor problems. For example: the address B3:1 is the address of a sixteen-bit WORD. I think the address you were trying for is B3/1 - this is the address of a single internal bit. This exact same bit could also be addressed as B3:0/1 - meaning bit number 1 within the word B3:0. Of course, if you're building your own processor, you can number the addresses anyway that you want. I've only mentioned this minor problem to help you when you read the Allen-Bradley documentation. Let me know if you need more information on this.
__________________

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; October 11th, 2002 at 09:29 AM.
  Reply With Quote
Old October 11th, 2002, 09:25 AM   #14
Allen Nelson
Member
United States

Allen Nelson is offline
 
Join Date: Apr 2002
Location: West Chester, PA
Posts: 1,368
Quote:
Originally posted by s_viswesh
Hi,

Thanks for all the replies.
The doubt originally arose from this situation:

LADDER1 :
| I:1 O:1
|---||-------()---------
|
| O:1 O:2
|---||-------()---------


So my doubt was
(a)will O:1 & O:2 both get activated at the end of scan1
OR
(b)O:1 gets activated at end scan1 & O:2 at end of scan2.
Unfortunately, it depends on the PLC brand. If it's an AB, GE, Siemens, AD, or almost any other, the answer is 'a' - both ON on scan 1.

If it's a Modicon, then the answer is 'b' - O:1 on scan 1, O:2 on scan 2 (although the addressing nomencalture would be 00001 and 00002 - you example is closest to AB's addressing nomenclature).

Just thought I'd muddy the waters a bit. I think the best thing for you to do is to get PHIL's BOOK if you really want to understand how a PLC thinks.
__________________
©¿©¬
  Reply With Quote
Old October 11th, 2002, 07:42 PM   #15
Jim Dungar
Member
United States

Jim Dungar is offline
 
Join Date: Apr 2002
Location: WI
Posts: 1,152
Modicon

To keep the waters muddy, Modicon does not always scan weird.

Their IEC programming software (Concept) scans left to right, top to bottom when in the IEC Ladder Logic language.

Thier 984 Ladder Logic is broken into networks (7 lines by 10 columns, effectively one page on the computer screen). Each network is solved top to bottom, left to right.
  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
Internal Tags in Winccc duncan LIVE PLC Questions And Answers 0 February 23rd, 2005 11:38 PM
omron internal vs. external I/O's Ken44 LIVE PLC Questions And Answers 5 February 13th, 2005 09:39 AM
Setting Internal Tag "Start Values" in WinCC Rusty_K LIVE PLC Questions And Answers 4 April 2nd, 2004 06:03 AM
Slc 150 Internal Transformer DOOMINATOR LIVE PLC Questions And Answers 1 July 30th, 2003 01:18 PM
Internal contacts/bits update...PLEASE HELP... s_viswesh LIVE PLC Questions And Answers 1 October 9th, 2002 10:59 AM


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


.