| TheLearningPit |
Traditionally ladder logic programs have been written by thinking about the process and then beginning to write the program. This always leads to programs that require debugging. And, the final program is always the subject of some doubt. Structured design techniques, such as Boolean algebra, lead to programs that are predictable and reliable. The structured design techniques in this and the following chapters are provided to make ladder logic design routine and predictable for simple sequential systems.
Most control systems are sequential in nature. Sequential systems are often described with words such as mode and behavior. During normal operation these systems will have multiple steps or states of operation. In each operational state the system will behave differently. Typical states include start-up, shut-down, and normal operation. Consider a set of traffic lights - each light pattern constitutes a state. Lights may be green or yellow in one direction and red in the other. The lights change in a predictable sequence. Sometimes traffic lights are equipped with special features such as cross walk buttons that alter the behavior of the lights to give pedestrians time to cross busy roads.
Sequential systems are complex and difficult to design. In the previous chapter timing charts and process sequence bits were discussed as basic design techniques. But, more complex systems require more mature techniques, such as those shown in See Sequential Design Techniques. For simpler controllers we can use limited design techniques such as process sequence bits and flow charts. More complex processes, such as traffic lights, will have many states of operation and controllers can be designed using state diagrams. If the control problem involves multiple states of operation, such as one controller for two independent traffic lights, then Petri net or SFC based designs are preferred.
A typical machine will use a sequence of repetitive steps that can be clearly identified. Ladder logic can be written that follows this sequence. The steps for this design method are;
2. Write the steps of operation in sequence and give each step a number.
3. For each step assign a bit.
4. Write the ladder logic to turn the bits on/off as the process moves through its states.
5. Write the ladder logic to perform machine functions for each step.
6. If the process is repetitive, have the last step go back to the first.
Consider the example of a flag raising controller in See A Process Sequence Bit Design Example and See A Process Sequence Bit Design Example (continued). The problem begins with a written description of the process. This is then turned into a set of numbered steps. Each of the numbered steps is then converted to ladder logic.
A Process Sequence Bit Design Example
A Process Sequence Bit Design Example (continued)
The previous method uses latched bits, but the use of latches use is often discouraged. A more common method of implementation is shown in See Process Sequence Bits Without Latches.
Process Sequence Bits Without Latches
Timing diagrams can be valuable when designing ladder logic for processes that are only dependant on time. The timing diagram is drawn with clear start and stop times. Ladder logic is constructed with timers that are used to turn outputs on and off at appropriate times. The basic method is;
2. Identify the outputs that are time dependant.
3. Draw a timing diagram for the outputs.
4. Assign a timer for each time when an output turns on or off.
5. Write the ladder logic to examine the timer values and turn outputs on or off.
Consider the handicap door opener design in See Design With a Timing Diagram that begins with a verbal description. The verbal description is converted to a timing diagram, with t=0 being when the door open button is pushed. On the timing diagram the critical times are 2s, 10s, 14s. The ladder logic is constructed in a careful order. The first item is the latch to seal-in the open button, but shut off after the last door closes. auto is used to turn on the three timers for the critical times. The logic for opening the doors is then written to use the timers.
· Timing diagrams can show how a system changes over time.
· Process sequence bits can be used to design a process that changes over time.
· Timing diagrams can be used for systems with a time driven performance.
1. Write a ladder logic program to extend and retract a cylinder after a start button is pushed. There are limit switches at the ends of travel. If the cylinder is extending if more than 5 seconds the machine should shut down and turn on a fault light. If it is retracting for more than 3 seconds it should also shut down and turn on the fault light. It can be reset with a reset button.
2. Write ladder logic that will give the following timing diagram for B after input A is pushed. After A is pushed any changes in the state of A will be ignored.
3. Design ladder logic for the timing diagram below. When an input A becomes active the sequence should start.
4. Use the timing diagram below to design ladder logic. The sequence should start when input A turns on. A may only be on momentarily, but the sequence should execute anyway.
5. A wrapping process is to be controlled with a PLC. The general sequence of operations is described below. Develop the ladder logic using process sequence bits.
1. The folder is idle until a part arrives.
2. When a part arrives it triggers the part sensor and the part is held in place by actuating the hold actuator.
3. The first wrap is done by turning on output paper for 1 second.
4. The paper is then folded by turning on the crease output for 0.5 seconds.
5. An adhesive is applied by turning on output tape for 0.75 seconds.
6. The part is release by turning off output hold.
7. The process pauses until the part sensors goes off, and then the machine returns to idle.
6. Design ladder logic for the timing diagram below. When an input `A' becomes active the sequence should start.
7. A wrapping process is to be controlled with a PLC. The general sequence of operations is described below. Develop the ladder logic using process sequence bits.
1. The folder is idle until a part arrives.
2. When a part arrives it triggers the `part' sensor and the part is held in place by actuating the `hold' actuator.
3. The first wrap is done by turning on output `paper' for 1 second.
4. The paper is then folded by turning on the `crease' output for 0.5 seconds.
5. An adhesive is applied by turning on output `tape' for 0.75 seconds.
6. The part is release by turning off output `hold'
7. The process pauses until the `part' sensors goes off, and then the machine returns to idle.
8. A PLC is to control an amusement park water ride. The ride will fill a tank of water and splash a tour group. 10 seconds later a water jet will be ejected at another point. Develop ladder logic for the process that follows the steps listed below.
1. The process starts in `idle'.
2. The `cart_detect' opens the `filling' valve.
3. When the tank is `full' the `filling' valve closes.
4. After a delay of 30 seconds from the start of the filling of the tank the tank `outlet' valve opens.
5. When the tank is empty the `outlet' valve is closed.
6. After a 10 second delay, from the tank outlet valve opening, a water `jet' is opened.
7. After `2' seconds the water `jet' is closed and the process returns to the `idle state.