Update/evaluation of internal relays/contacts...PLEASE HELP

s_viswesh

Member
Join Date
Oct 2002
Posts
13
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
 
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
 
Viswesh, you posted the same question in 2 threads. I answered your question in the OTHER one, then found this one... :rolleyes:

beerchug

-Eric
 
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
 
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.
 
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.
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!)

:mad:
 
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.
 
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.
 
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.
 
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
 
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
 
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.
 
Last edited:
s_viswesh said:
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.
 
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.
 

Similar Topics

Hi All, we've recently upgraded from FTView SE v10 to v12. Since the upgrade we've been having a problem where the HMI is slow to update tags in...
Replies
0
Views
41
Hi, I have an iFIX 5.5 project (Windows 7) that needs to be updated to version 6.5 (Windows 10). iFIX communicates with the "Siemens Industrial...
Replies
1
Views
145
Hi I have a number of the older PanelView Plus 600 HMI's (2711P-T6C20D, Ser D) that I want to update to the latest firmware. I believe that the...
Replies
10
Views
391
Spoke to a few outlets including Emerson and some distributors. Apparently updating firmware on subsequent modules past the CPU still uses...
Replies
1
Views
350
Hello everybody. I encountered a problem - I don’t know how to update the firmware on the Mitsu MR-J5-40G-N1 (ethercat) servo amplifier. My...
Replies
2
Views
265
Back
Top Bottom