but don’t forget the SAFETY issue ...
Greetings to all,
besides all of the other aspects of “to latch or not to latch” being discussed here, one EXTREMELY important characteristic of latches which has not been specifically mentioned is the “retentive” nature of these beasts ...
these guys did mention something about the subject in passing ...
from Rube in post #3:
The use of latches is, in a lot of cases, the preference of the programmer. Now, there are times when one is more sensible than the other, and some instances where one is necessary.
from Rick Densing in post #8:
I try to only use latches when I want info to be retained through power cycles.
from ArikBY in post #11:
I use latch&Unlatch with AB because that the only option AB offer for retentive relaye when the power is go off&on. ... You also need to unlatch all when the power go on or under certain conditions.
let’s take a look at this in more detail ...
suppose that programmer Sam likes the “seal-in” type of construction ... and Sam has programmed the saw in the figure below ...
suppose that programmer Greg likes the “latch/unlatch” type of construction as his personal favorite ... and Greg has programmed the grinder in the figure below ...
[attachment]
and both machines having been working fine for a very long time now ... the start buttons start ... the stop buttons stop ... the boss is making money ... what more could we ask for? ...
now suppose that while the saw and the grinder are both happily running along, the electrical power to the building suddenly dies ... naturally all of the machinery comes to a halt ... the question is, folks: “what is going to happen when the power eventually comes back on?” ...
well, the saw motor will NOT start back up automatically ... BUT (and here’s the punch-line) ... the grinder motor WILL start back up just as soon as the power comes back on ... and that could be a BIG safety issue ...
now ... I know that I’m going to get a bunch of posts saying stuff like: “well you should have OTHER things (mechanical interlocks, etc., etc., etc.) to prevent the grinder from coming back on” ... I’m not going to debate all of that ... the major point here, folks, is that there are some BIG differences between the way “seal-in” constructions and “latch/unlatch” constructions behave ... the example above is meant to demonstrate that concept in an easy-to-visualize way ...
the book says that the latches are “retentive” but doesn’t do much in the way of explaining (from a safety standpoint) just what the term “retentive” means ... basically it means that you can write a program using latches and unlatches which will perform flawlessly in the shop ... and work perfectly when you commission the machine ... and function faultlessly when the customer accepts the machine and puts it into use ... BUT ... if you haven’t adequately considered the “retentive” nature of the latch/unlatch construction, then you could conceivably have a ticking time-bomb on your hands ...
now I know that some people don’t like latches ... and some even flatly refuse to use them at all ... but now let’s go one step further and think about this next angle ...
suppose that we use a Recirculation Pump for our next example ... suppose that this particular recirculation pump is necessary to keep our nuclear reactor cool ... now if we were to unwisely use the “seal-in” approach to program its control, then every time the electrical power flickered, someone would need to go over and press the start button to bring the pump back on again ... so this would be a natural place to use a “latch/unlatch” construction ... because the latches are “retentive” ... they “retain” their ON status when the processor is power-cycled ... so a latched-on construction would definitely be a better (SAFER) way to program our recirculation pump ...
and please, folks, don’t jump on my case about how to REALLY control a nuclear power plant ... we all know that I’m just trying to come up with some interesting examples to illustrate these programming concepts ...
next ... a basically true story ... suppose that a customer has programmed his lumber mill using seal-in rungs to help the processor “remember” where the logs are located ... so when a log moves past Limit Switch A, he seals-in bit B3/22 ... this means there is a log in position A ... when the log moves past Limit Switch B, he unseals bit B3/22 ... this means that Position A is empty and ready for the hydraulic ram to feed in another log ... now suppose that the ram has just shoved a log into Position A ... so bit B3/22 is set (1) ... but then the power to the plant flickers ... what happens to B3/22? ... since he’s using a seal-in rung construction, B3/22 gets reset (0) ... oops! ... the PLC thinks that Position A is empty ... the hydraulic ram shoves in an extra log and does about $4,000 damage to the saw ...
this would have been a good place to have used a “latched-on” type rung construction ...
and so in summation ... in addition to all of the perfectly valid “keep the controls together” and “latches and unlatches are neater than seal-ins” and “seal-ins are easier to troubleshoot” arguments, there ARE some important SAFETY issues to consider when deciding whether “to latch or not to latch” ...
finally ... for those who want to dig even deeper into this subject, much of what I’ve included here (and much more) can be found in this
previous thread about “pre-scan” ... for inquiring minds, it might make for some interesting reading ...