â€œWhy do you engineers insist on using sequencers in your PLC programs?â€
Mike asked that question the last time I was over at the local washing machine manufacturer.Â Mike works in the maintenance department there.Â As usual, a five minute job had turned into over two hours of frustration, and I just happened to be the sympathetic shoulder.
First, let me disclose a little known secret about how washing machines work.Â You see, early in the days of washing machines, certain garments, usually socks, ended up getting wrapped around the spindle causing a jam, and this eventually causes the motor to overheat and burn out.Â Frustrated by this problem for over a decade, manufacturers finally solved this problem by incorporating a device known affectionately in the industry as a â€œsock shredderâ€.Â When wayward socks start to get tangled around the spindle, the extra torque on the motor activates a torsion bar that engages a spinning cutting head that pulverizes the sock into fine enough fibers that most of it simply gets carried away in the rinse cycle.Â Even though companies were worried about the backlash from customers, the initial consumer trials showed that most people were rather ambivalent about the missing socks, so the device is now incorporated into every washing machine on the market today.
(Not only did the laundry industry benefit from this innovation, but sock manufacturers reported a 62% rise in demand over a 5 year period, unprecedented in the undergarments industry both before and since.)
Anyway, back to Mike and his frustration.Â Apparently the plant had received complaints that a few washing machines were experiencing premature failure of the motor.Â Apparently the machines had left the plant without the sock shredders installed.Â Mike explained to his boss that it would be easy to install a photoeye that checked for the presence of the sock shredder at the spindle insert station, and stop the inserter if the sock shredder wasnâ€™t detected.
After wiring in the photoeye, Mike went online with the PLC, started looking for the output that actuated the inserter cylinder but was surprised to discover it wasnâ€™t referenced as a coil.Â As you can probably guess by now, the outputs were being driven by a sequencer instruction.
PLCs first appeared in the 60â€™s.Â While most historians believe that PLCs were intelligently designed, a few skeptics maintain that they evolved from less advanced technologies.Â But I digressâ€¦
Back in prehistoric times (before PLCs), machines used mechanical drum sequencers (just like the valve timing in older automobiles) to sequence the actions of the machine.Â The drum triggered electrical cam switches that would turn on outputs in the correct sequence to operate the machine.Â When PLCs first hit the market, the PLC designers thought it would be a good idea to create a “sequencer” instruction that would mimic the operation of the drum sequencer to make it easy for machine manufacturers to convert their existing machines over to PLCs.Â That was decades ago.Â So, why are engineers still using sequencers?
Machine builders use sequencers because they’re building a machine with a standard operation and it’s easy to go straight from a timing diagram to a sequencer.Â (Some programmers will tell you that sequencers use less PLC memory, but with the price of memory these days, thatâ€™s not a valid excuse.)Â Of course, when the machine hits the plant floor and needs to be modified, the presence of sequencer instructions frequently triggers severe hair loss in the maintenance department.
Sequencers can easily be replaced with logic made up of contacts and coils.Â Each step can be represented by a single coil that is sealed in when the step is complete.Â I find it convenient to also use a second coil for each step called â€œstep in progressâ€, which is equivalent to â€œprevious step complete and current step not completeâ€.
Use the â€œstep in progressâ€ coils to drive the outputs directly.Â The logic goes from obfuscated to obvious.
Steps donâ€™t have to be numbered either.Â With tag based PLC processors you can create steps called Lather, Rinse, and Repeat.Â Then if you need to add a new step called Scrub between Lather and Rinse, thereâ€™s no awkward shuffling of step numbers.
For Mikeâ€™s sake, donâ€™t use sequencers!