A few years ago I wrote a program for a customer using a flowcharting language.Â It wasnâ€™t just a flowcharting language; the product allows you to use both relay ladder logic and flowcharts.Â But the customer had a software standard that made the use of ladder logic forbidden!
Imagine a simplified example.Â Do you think Bill Gatesâ€™ kitchen has a blender?Â Probably.Â But itâ€™s probably not like the one you or I have.Â Maybe itâ€™s made out of solid gold and maybe it has a nuclear power source, but most of all I imagine it has a fully fledged industrial control system.Â Now, imagine weâ€™re programming the control system for this blender.
Of course it would have the standard start and stop buttons, but this blender is top of the line and absolutely safe.Â It has a sensor to determine if the lid is closed.Â Obviously, if weâ€™re happily blending away and the lid flies off, we need to stop the blender, and it shouldnâ€™t start again until the lid is back on and the start button is pressed.Â After all, we wouldnâ€™t want to endanger Billâ€™s fingers or anything (I happen to know he does a lot of blending).
Many of you have already written this complicated control system in your mind:
Good job!Â No matter what happens, the lid will have to be closed or the motor simply wonâ€™t run.Â Of course, the software specification says that you canâ€™t use ladder logic.
Well, in flowcharting the start and stop logic is simple:
Thatâ€™s pretty simple, but it doesnâ€™t take the lid closed switch into account.Â At first glance, we might have to put the check for the lid closed before every decision block, so we check for the state of the lid switch, then check for the start or stop buttons.Â Do you see how this could get out of hand quickly?
Fortunately, the language offers a solution:
Howâ€™s that?Â While itâ€™s true that if the lid ever comes off, the motor will stop, we have no way to exit gracefully.Â This â€œexception blockâ€, as itâ€™s called, stops whatever you were doing, turns off the motor and starts the whole process over again.Â Iâ€™m sure it would work fine for our simplified example here, but what if we were doing something else later on in the flowchart?Â What if we were tracking parts, or decelerating an unrelated axis?Â In the ladder logic example, the lid switch only disables the motor.Â In the flowchart it stops the logic and then disables the motor.
Of course, to deal with this problem in the complexities of a real machine, you end up writing two different flowcharts: one for the sequence and one for the outputs.
Now take a close look at the right hand flowchart.Â It scans through both decisions on every single scan of the controller.Â Itâ€™s â€œladder logic written sidewaysâ€.Â Itâ€™s simple combinational logic that screams to be rewritten in ladder.
In fact, writing the state logic (like auto mode sequences) in flowchart and the combinational logic (like manual mode and faults) in ladder makes a lot of sense, especially for more complicated machines.Â So why forbid ladder logic?Â Perhaps it was just to force people to start using the flowcharts.
A software standard that bans ladder logic is a bad idea.Â Some logic is more readable as flowcharts, and some is more readable in ladder.Â For years weâ€™ve had to write everything in ladder.Â We were like the little boy who only had a hammer and thought every problem was a nail.Â If that boy suddenly traded the hammer for a screwdriver, was he any better off?
Thanks for finally talking about > Software Standards Run Amok · Contact and Coil < Loved it!