Duplicate Coils

Home / Micro800 / Micro800 Programming

Description
Several students experienced issues with duplicate coils, or duplicate destructive bits, in the Ladder Diagram (LD) program. Here is why duplicate coils can create issues with your PLC program.

Actual lab assignment was performed with an Allen-Bradley Micro820 PLC and the Factory IO simulation software.


Transcript
(00:01) okay I want to make a video to help explain what we were kind of seeing in the lab last night and this was a great situation to have uh happened it was kind of unintentional um but at the same time uh it’s a very good lesson in PLC programming and and that is the idea of having duplicate coils in the same program meaning that on two separate rungs we’re we’re basically controlling the same coil so here we have conveyor B coil to turn on and then also in rung two we have conveyor B and this was the way that um a lot of you did this and to be quite
(00:47) honest this was actually a very good attempt this was you know based on what you’ve done in the previous labs and kind of just leaving it you know to you to to kind of figure out you went this way and and quite honestly this was was good thinking um in in trying to program this but what was unknown to you is that there’s a little bit of a um uh there’s there’s a little bit of an issue here um and it’s interesting because the PLC the microwave 20 actually let us do this it let us put the coil twice in the same program and it let us download
(01:26) it to the controller and it did not create an error um it wasn’t considered an illegal uh operation it didn’t even warn us of the fact that there was duplicate coils there there’s another term for this you’ll find perhaps in some documentation and that is uh it’s called a destructive bit which is an interesting um term but a duplicate destructive bits some programming software will would actually have warned us of this condition and in some software it might have actually prevented us from doing it without overriding a setting but the
(02:05) microwave 20 just let us do it with new issues so let’s talk about a little bit about why this is a problem which some of you have saw this last night so first it kind of goes back to some Basics and that is the idea of the sweep right we talked about this a few weeks ago and that is how does the PLC actually operate so it operates on a on a a sweep so at the top of the sweep the first thing we do is we scan the inputs coming from the field or the inputs in the input table then we go into solving the logic and in the last part of the sweep we we
(02:47) write to the outputs and then we repeat this cycle over and over and over again you know in the order of you know a cycle is you know in the order of you know just a few milliseconds depending on the size of the program so this sweep is happening you know multiple times a second so fast that we can’t even really discern what’s happening we can’t really see it necessarily um in the logic playing out it’s happening so fast so what that means back on our on our program is that um once we come to that solving of the logic
(03:28) what really happens in the controller is we start with run one and we go top to bottom left to right so so when this program starts and it’s running it goes to room one it scans across from left to right to try to solve the logic or find a true path to get you know from from here to the other side of the rung essentially and if there’s no true path you know then basically these two outputs would be um not on so it would still be zero then it goes to the next row wrong two and it scans across left to right does the same
(04:08) thing we’ve got a branch here right so it tries to go this path it finds no way you know there’s no path all the way to the coil it comes to the branch and finds no path so these two coils are therefore turned off as well right that’s fairly straightforward but let’s look at the situation that we were facing last night so the the concept was that we had you know two main functions to our program one was when we when we turn on the start switch we’re going to move the box down the conveyor a we’re going to turn on conveyor a and
(04:42) conveyor B at the same time until it got down to the photo I and told the stop then second part of the program was when you turned on the load switch it was going to have to turn on conveyor B and the load conveyor so conveyor B was going to be having it was going to be controlled by two different um kind of pieces of logic shall we sing and the reason for that was because we had to activate the B conveyor to kind of push the Box off the off the the conveyor if we didn’t turn on the B conveyor the box would not move onto the
(05:20) load conveyor so a little bit of an unintended consequence again um when when I kind of Drew this up but um what what happened here is a great lesson so most of you did what kind of what I have on the screen here where rung one was the start switch uh going through the um the at entry you know wait you know basically the start switch and then the conditional of if the photo I at the uh at the transfer entry was activated or not and then that would turn on both conveyoring conveyor and conveyor B and we would kind of latch in on itself we could pick
(06:02) either a or b or some people put a and b in series with each other um a little bit redundant that’s why I have to do that you could kind of just pick one but I picked conveyor a here to kind of latch it in since conveyor B was in parallel you know anytime a is on well therefore B would have to be on right um so when we put the start switch on and if the photo eye condition was you know true then we can basically pass through and turn on conveyors A and B until the Box reached the photo line all right then run two was when we turned on
(06:37) the load switch the second switch uh we would basically go into uh we would start the load conveyor and we would start conveyor B also and we would move the Box onto the load conveyor until it reached the the sensor that detected the box was fully onto the load conveyor or the transfer transfer conveyor I should say and we would latch this in with the load conveyor motor again could have had a gold conveyor and conveyor b or conveyor B here but I chose the load conveyor for this example um to match it in right because
(07:14) basically these two would turn on so the problem we were experiencing last night was that [Music] um at certain times conveyor B would actually not be energized even though you would think that it would have been and here’s kind of why so I’m going to use so built into the mic into the CCW software is a micro 800 simulator so we actually can can test and do some things without actually having to have a real controller in the software so so the micro 800 simulator um these are the inputs on the top and these are the outputs on the bottom but
(07:52) I went ahead and used the exact same um tags that you would have had in your lab last night so embedded i o uh embedded input 0 0 for the start switch embedded input for one for the load switch and in the Bool in zero and out zero one to to match what the factorio scene would have used so let’s go with condition one condition one is I’m going to start the uh the conveyor a and conveyor V motor to move the box down so I’m going to turn on the switch by just clicking my simulator input that turned on the start switch
(08:35) and we see that we have conveyor aeon but conveyor B is not energized so the reason for that is going back to how we solve the logic right so we start with rung one we go left to right then when we come to rung two we go left to right well rung two basically is saying because the logic on rung two the load switch is not on and we don’t have the the latch so therefore rung two is telling conveyor B that your condition is false you should be off rung one is saying you should be on but rung two is saying you should be off
(09:25) and being that rung two is the last rung in the program that’s kind of the one that wins out in that it’s actually saying you should be off so rung one quickly said you should be on but instantly when it got to rung two solving rung two logic it said you should be off uh so they kind of oppose each other and therefore that’s where the destructive bit terminology kind of comes in is it kind of cancel each other out or to destroy each other in this case um so again it allows you to do this so this is one of those things to always
(10:02) have to be mindful of is that it does allow you to do this but as you can see it can kind of create some significant Havoc um in the program now let me go ahead and uh I’m going to turn off my start switch and I’m going to toggle this tag off so I broke the latch basically and everything’s turned off now let me turn on the load switch so the load switch is uh input one now when I turn on the load switch look what happens the be conveyor turned on but also the B conveyor turned on up here in rung one it shows it as being
(10:45) energized even though nothing here is true oh that should be allowing it to turn on right now but again because of the way we solve our logic rung one then to rung two well rung 2 says you’re on so when it comes back to the top of the sweep again it says Oh wrong uh you know conveyor B you’re on so um so it’s showing that it’s energized so really it got down to the fact that you know duplicate coils are are just bad programming practice uh again not illegal um and allowed in in the program but can definitely um create situations that we don’t want
(11:33) to see happen so what is the solution to this problem um it’s actually quite straightforward what we what we would have to do is instead of trying to do these two rungs in in this manner we would actually have to have a separate rung that would control just conveyor a only and then a separate rung that would just control conveyor B only and basically this logic that would be controlling conveyor B up here in room one and this logic that’s controlling conveyor B in rung two basically would would be copied into this new rung and we’d be kind of in
(12:17) parallel right so we have two paths that could turn on conveyor B path one would be kind of this situation path two could be this situation so being that that is considered an or right you know path one or path two would allow conveyor B to be turned on uh that would be a parallel basically a parallel Branch so we would have a parallel branch that would have conditional Logic for you know for this first condition with the start switch and then we’d have uh the second parallel the parallel path that would have the logic you know when this when
(12:55) the load switch was told to be turned on and then we’d probably have a third run of course that would also control the load conveyor you could potentially do the load conveyor um well I would do it separate I was going to say you could potentially do it in parallel but no um that would not really work so we want to have the Logan bear in its own third separate rung as well so uh it’s basically long story short you know although this looks nice and was very concise approach and just two rungs and and pretty straightforward
(13:31) um sometimes we we want to see our logic kind of broken out into separate uh rungs even though it takes more programming um you know it just sometimes it’s a cleaner way to go so rung one be all the controls from conveyor a run two would be all the controls for conveyor B run three would be all the controls for the load conveyor and then of course being that we also have to do the load conveyor again and the um the left or right conveyor depending on which direction we move the Box in we probably have a fourth rung
(14:09) that would be controlling um those those left and right conveyors as well okay so um hopefully this helps explain a little bit more so next time in the lab uh we’ll come back into this and then we’ll kind of go back to the drawing board so to speak and see if you can uh redesign the program and get around this this situation with the duplicate coils