• Describing process control using state diagrams

• Conversion of state diagrams to ladder logic

• MCR blocks


• Be able to construct state diagrams for a process.

• Be able to convert a state diagram to ladder logic directly.

• Be able to convert state diagrams to ladder logic using equations.

A system state is a mode of operation. Consider a bank machine that will go through very carefully selected states. The general sequence of states might be idle, scan card, get secret number, select transaction type, ask for amount of cash, count cash, deliver cash/return card, then idle.

A State based system can be described with system states, and the transitions between those states. A state diagram is shown in Figure 11.1 A State Diagram. The diagram has two states, State 1 and State 2. If the system is in state 1 and A happens the system will then go into state 2, otherwise it will remain in State 1. Likewise if the system is in state 2, and B happens the system will return to state 1. As shown in the figure this state diagram could be used for an automatic light controller. When the power is turned on the system will go into the lights off state. If motion is detected or an on push button is pushed the system will go to the lights on state. If the system is in the lights on state and 1 hour has passed, or an off push button is pushed then the system will go to the lights off state. The else statements are omitted on the second diagram, but they are implied.


Figure 11.1 A State Diagram

The most essential part of creating state diagrams is identifying states. Some key questions to ask are,

1. Consider the system,

What does the system do normally?

Does the system behavior change?

Can something change how the system behaves?

Is there a sequence to actions?

2. List modes of operation where the system is doing one identifiable activity that will start and stop. Keep in mind that some activities may just be to wait.

Consider the design of a coffee vending machine. The first step requires the identification of vending machine states as shown in Figure 11.1 Definition of Vending Machine States. The main state is the idle state. There is an inserting coins state where the total can be displayed. When enough coins have been inserted the user may select their drink of choice. After this the make coffee state will be active while coffee is being brewed. If an error is detected the service needed state will be activated.


Figure 11.1 Definition of Vending Machine States

The states are then drawn in a state diagram as shown in Figure 11.1 State Diagram for a Coffee Machine. Transitions are added as needed between the states. Here we can see that when powered up the machine will start in an idle state. The transitions here are based on the inputs and sensors in the vending machine. The state diagram is quite subjective, and complex diagrams will differ from design to design. These diagrams also expose the controller behavior. Consider that if the machine needs maintenance, and it is unplugged and plugged back in, the service needed statement would not be reentered until the next customer paid for but did not receive their coffee. In a commercial design we would want to fix this oversight.


Figure 11.1 State Diagram for a Coffee Machine