GeertVc
Hi,

I'm trying to learn as much as possible about PLCs nowadays.  I found some interesting schemes on the inet and I have a question about one of them.

Below is the ladder scheme where all three inputs I01/I02/I03 are all set to FALSE in the simulator:

test_plc_i01_false.png

As you can see, none of the input switches allows logical continuation from left to right since they're all set to FALSE and they are all 3 MAKE types.
Next, as you can see, both memory M01 and memory M02 switches on the second rung are green.  That seems correct to me since the M01 coil in rung 1 is not energised and the switch is a BREAK type (negated).  Same for M02 since the coil in rung3 is not energised.
From what I understand about PLC, that looks OK so far.

However, when I change I01 from FALSE to TRUE, then I see the following output in the simulator:

test_plc_i01_true.png

It's logical that rung 2 is now completely green.  I01 is set to TRUE, so it does allow logical continuation from left to right.  And since M01 and M02 didn't change state and they allow logical continuation from left to right if their input is 0 (which is still the case since coils M01 and M02 are still not energised), we have coils Q01 and Q02 energised.

But what surprises me is that Q01 in rung 3 is not changed to green!  I understand that, since I03 is still FALSE, rung 3 is not completely green and so M02 is still not energised, but I thought that Q01 would be indicated as green (just like the contacts M01 and M02 were in the first image), since coil Q01 in rung 2 is energised.  Should this not be going hand in hand?  Or am I missing something here?  Bit puzzled/confused...
Reply 0 0
thiagoralves
This is the biggest fallacy of beginners in ladder logic. If you want a good advice to start programming in ladder logic, here it is: never (N E V E R) reuse coils in your program. Ladder logic is cyclic, and I/O evaluations only happens at the end of the cycle. So, in your program, the second rung (I02) sets Q01 to true, but the third rung (I03) sets it back to false. Since it all happens internally in memory, what you see in the end is that Q01 never switch state at all, as its final state is given at the end of the cycle (end of third rung), which means it remains false every cycle.

One thing you must understand is that when a rung is not activated, it does not mean that the state of coils will remain whatever they were before. A deactivated rung means that all coils connected to it will be set to false. This is exactly what is happening in your program. Q01 is set to false by I03.

To fix this logic you can either declare internal coils that will be responsible for activating Q01, and then OR them all together in the end, or you can use Set/Reset coils instead. Those type of coils (Set/Reset) are the only ones that can be reused in the program, because they take an action, not a state. Once a coil is Set, it will remain true until it is Reset. Those are actions that will happen when the rung connected to them are true. If the rung is false, the action will simple not occur, and the coil will keep its previous state.
Reply 0 0
Reply