Mode
A very common Ladder Logic Programming Pattern is the Mode Pattern. Most machines have a mode selection mechanism, and the most common modes are Auto(matic) and Manual:
Mode: Auto/Manual
The Auto/Manual Mode pattern above has two useful properties:
- At program start, since the Auto Mode coil will default to Off, Manual Mode will be on
- The system can never be in both Auto Mode and Manual Mode at the same time
The first property is important because we never want a system to start up in Automatic Mode. It’s always safer to start in Manual Mode and have the operator request Auto Mode. The second property is one we want for all Mode systems: only one mode can be active at a time.
There are machines that have more than two modes. The obvious example here is a mechanical press which has modes like Inch, Single, and Continuous, and sometimes several other specialized modes. We sometimes add an Off mode to that, meaning none of the active modes are selected. Even in the case of multi-mode machines, we want the same two properties of the logic: a safe default state, and exclusivity of modes.
Here is a 3-mode machine with an additional Off mode:
Mode: Three Modes and Off
You may have noticed that the Mode pattern is just an extension of the Start/Stop Circuit pattern, just with more start buttons. That’s true, and we’re just enforcing that only one mode can be “started” at a time.
Notice that the Off mode is a pre-requisite to turning on any of the other modes. This ensures that when switching modes there is at least one PLC scan where none of the modes are active (except Off). Some programmers feel this is desirable (though I don’t think it’s a very important aspect). Perhaps you might want to execute some logic between modes, and examining the Off coil is a good way to do that. Note that this doesn’t, by itself, enforce exclusivity. That is, if we started in the Off mode, and if the mode buttons were physical buttons and I held two of them down simultaneously, then it would be possible for the machine to end up in two modes at once. Inserting normally closed contacts from all of the other buttons in each mode rung, combined with the precondition that the Off mode is active, is what enforces exclusivity. If I hold down two buttons, none of the rungs can be active and the machine will stay in the Off mode.
While most modern machines use mode selection through an HMI and some have physical mode pushbuttons, many older machines used a selector switch. In that case one position was usually not wired (typically “Off”), and the other selector switch positions were each wired into an input. In that case you didn’t need to seal in each mode with a branch circuit (because the switch itself “remembers” its selection), but you should do something similar to enforce exclusivity (in case of a wiring short circuit):
Mode: Three Mode plus Off Selector Switch
Note that in this case, one of the 4 coils will always be on, and in the event of a wiring short circuit (where two mode inputs are on) then the machine will default to the Off mode (which doesn’t have to be an Off mode but it should be a “safe” mode like Manual).
[source: http://www.contactandcoil.com/patterns-of-ladder-logic-programming/mode/]