Today’s post is in response to Dave Tompkins, who posted a request for help last week for an application. Since he posted it on one of my series posts on ladder logic (204: Auto Sequences) I decided to frame it as a continuation on the 300 series.
“I am looking for a ladder diagram, 1 motor 2 contactors fast/slow, auto control where the motor runs for 2 mins in slow, when timed out the motor runs fast for 5 mins. manual control, when motor can be started in either fast or slow & latches in until the timer times out, also need the motor to run fast in inch mode when the 2 inch buttons are pressed, can anyone assist please.”
An important part of writing code for an application is determining specifics of what the customer wants. In this case, since Dave is not here where I can ask him questions, I will have to assume anything that is unclear.
One question I would have is what PLC is being used? Most ladder logic is pretty similar from platform to platform, but addressing and instruction sets vary widely. Since I have Allen-Bradley’s ControlLogix software handy, I will be using that. A useful side benefit of this platform is that since it is tag based, Dave can assign whatever addresses he wants to the tagnames.
I’ve started here by defining the outputs. This format is similar to what I covered in my 202:Outputs post from a couple of years ago. This is not the only way to approach programming, but it’s a pretty good one for discrete machinery. Note that all states of the motor control are pretty well defined here, though faults, control and system modes are defined in other routines. As an added safety, if the slow output is somehow turned on it will disable the fast, and vice-versa. *This does not apply if outputs are forced!
This is the timer control part of the application. I used On Delay timers for these: a couple of notes. There is nothing here to prevent someone for taking the system out of Auto or Manual mode and ending the cycle early. If you want to prevent this, it should be done in the System Routine.
I also have not indicated where the Inch_2HandCtrl (“Inch Two Hand Control Command”) bit came from. Ideally, this would be either a hardware-based anti-tie-down relay or a software anti-tie-down routine. For more information on this, Google it or I’d be happy to write a post on it later. Do NOT do this:
In most cases this is not legal unless safety isn’t an issue. If the controlled devices are behind a light curtain or door you might be able to get away with it; the point is, someone could tape down one of the pushbuttons and operate it with one hand. Kind of defeats the purpose of a “2 Hand” control, doesn’t it?
I am including Faults in this post to elaborate on the 203:Faults post from a couple of years ago.
Again, note that there is nothing here about how the fault is acknowledged or reset, or how it is combined with other faults to create a system level fault.
This post took me about three hours to write today. The program itself took about an hour because I had to create all of the tags, set up a new processor and I/O structure and various other things. Much of the rest of the time was spent typing and doing screen captures of the logic for import.
The reason I mention this is that there are not a lot of good examples of ladder logic online, even on PLC manufacturer’s websites. This is because most programmers don’t have the extra time to type all of this up and post it; there are some really helpful folks on places like www.plctalk.net and other sites, but most of them are paid well for their time and can only go so far. This may help explain why people don’t always get answers to more complex ladder logic or application questions. Since I write a blog anyway, I am happy to cover it this time. Hope this helps!