Volume 3 No.4, Spring 2000 

ISSN# 1523-9926

 

Teaching PLC Programming to Technology Students

by

Rick Miller
Associate Professor

rickie_miller@yahoo.com
EET and CNS Dept.
Ferris State University
Big Rapids, MI

 


ABSTRACT 

There are four potential problems in teaching PLC programming to technology students:

This paper presents a method  for overcoming these problems using a computer program called PLC Simulator Ver. 6.0 that simulates PLCs on a personal computer.
 

INTRODUCTION

Methods for teaching PLCs often begin with an introduction to relay logic using "ice cube" relays mounted on an aluminum chassis with lights to simulate outputs and switches to simulate inputs.  The students are first given a simple ladder diagram and pictorial of a process being controlled.  The students wire up the relays and demonstrate that the control works by moving the switches in the correct sequence and watching the output lights.  Then the students are asked to design their own ladder logic for a slightly more complicated example. In this way the students learn about ladder logic, normally open contacts, normally closed contacts; and a little about pneumatics, hydraulics, and motor control depending on the examples used.

If actual PLCs are available, the students then move on to using PLCs with simulation I/O (input/output) cards. Simulation I/O cards provide switches for input into the PLC and lights for outputs from the PLC.  The switches can represent pushbuttons, selector switches, limit switches, etc. The outputs can be imagined to control pilot lights, solenoids, motor starters, etc.

The students first learn how to program the PLC using a personal computer or dedicated programmer, then basic PLC instructions such as relays, timers, counters, latch relays, master control relays, etc.  They also learn about input and output addressing and see that the PLC program can respond to switch input from the outside world and can provide outputs to actuate devices external to the PLC.  The students are then given a simple ladder diagram and pictorial of a process being controlled (often the same process previously controlled by relays).  The students program the ladder logic and demonstrate that the control works by moving the switches in the correct sequence and watching the output lights.  Then the students are asked to design their own ladder logic for slightly more complicated examples that may involve timers and counters and demonstrate them by moving the switches in the correct sequence to activate the outputs at the correct time.

The problems with the instruction described above are; 1) the processes being controlled are paper projects, and it takes a lot of concentration and imagination to "walk" the machine being controlled through its sequence of operation, and 2) when confronted with a more complicated control problem, the students often get bogged down writing the program and resort to  using trial and error methods.
 

USING PLC SIMULATOR VER. 6.0

To overcome the problems described above, I wrote a Windows based computer program called PLC Simulator Ver. 6.0 that simulates a PLC on a personal computer. This program solves the three basic problems of 1) PLCs not being readily available, 2) not having anything to control with the PLCs and, therefore, having to resort to "paper projects", and 3) students not being familiar with the type of machinery controlled by PLCs.

The program has three screens that the students can program:
    1)  the Main screen showing rungs of inputs, relays, timers, counters, etc. in ladder logic format.
    2)  the I/O Connections screen showing inputs and outputs connected to PLC I/O cards.
    3)  the Machine Layout screen showing animated pushbuttons, photoeyes, cylinders, solenoids, conveyors, pilot lights, etc.  that move in response to the ladder logic being run.  The following figures show the three screens.

Main Screen



 

I/O Connections Screen



 

Machine Layout Screen

The program has two modes of operation; program mode and run mode:

In program mode, the students program the ladder logic on the Main screen just like they would if the computer was connected to an actual PLC. They also connect inputs and outputs to the PLC I/O cards on the I/O screen and "build" the machine being controlled on the Machine layout screen.

In run mode, the rungs of ladder logic are solved just like in a real PLC, the I/O Connections screen shows which inputs and outputs have been actuated, and the Machine Layout screen components move in response to the ladder logic being solved.  Inputs such as pushbuttons can be actuated by pressing their assigned key on the computer keyboard or by clicking on them.

The fourth problem, the students needing a structured approach for writing the PLC program, is solved by presenting a  method called Structured PLC Programming.  This method is described below.
 

III. Structured PLC Programming
The process of designing control for automated machinery depends on the individual designer and his/her experience. In addition, most companies have their own standards for control components and their own methods of control. For these reasons, there is no one recognized standard way of designing control.

In order to provide some guidance to students new to designing automated control, however, a method called Structured PLC Programming is presented. This method is simply a tool for designing control, and does not exactly fit into all control applications.  It can, however, provide a systematic approach to designing control. As a person becomes more experienced in designing automated control, they usually develop their own methods and procedures unique to them and the type of control they design.

Structured PLC Programming can be broken into 6 distinct steps. To illustrate the 6 steps, the Stamping Station process shown below will be used:

Stamping Station

Step 1) Develop a Sequence of Events and Home Position:
Many automated machines perform sequential events that are repeated each time the machine goes through a cycle. These machines are sometimes called "state machines" because they move from one state to the next. A listing of their sequential events is called the Sequence of Events. In developing the Sequence of Events, it will become obvious that certain inputs such as limit switches will be needed to indicate the state of the machine (i.e.: where the machine is). The actuation of these limits should be included in the Sequence of Events. It will also become obvious that certain outputs such as solenoids and motor starters will need to be energized to make the machine "move" through its cycle.

In addition to the Sequence of Events, it is usually a good idea to define a "home" or starting position for the machine, and require that it return to this starting position before another cycle can be initiated.

Refer to the Stamping Station process shown above. When the start pushbutton is pressed, the conveyor starts moving  parts to the right until one of them actuates the photoeye.  When the photoeye is actuated, the cylinder comes down and stamps the part.  When the cylinder is back up, the conveyor starts moving again to bring in the next part. The classic problem that structured PLC programming solves in this example is, "How do we re-start the conveyor when we are "sitting" on the input (photoeye LS-3) that stopped the conveyor?"

Following is the Home Position and Sequence of Events for the Stamping Station process.

Home Position
1. Stamping cylinder is up. (LS-1 made)
2. Photoeye is not actuated. (LS-3 released).

Sequence of Events
1. Start pushbutton is pressed momentarily.
2. Conveyor starts.
3. LS-3 makes.
4. Conveyor stops
5. Stamping cylinder starts down.
6. LS-1 opens
7. LS-2 makes.
8. Stamping cylinder goes back up.
9. LS-2 opens.
10. LS-1 makes.
11. Conveyor re-starts.
 

Step 2) Establish the I/O and their addresses:
In order to program the ladder logic of the PLC, each input and output needs to have a name or address. The address of each input and output is established by connecting each input and output to a particular place on a PLC I/O card as shown on the I/O Connections screen. By doing this, each input or output will have a distinct address so it can be programmed into the ladder logic. In order to keep this example simple, we have used the input and output names as their address. In an actual PLC, the address of each input and output will depend on the specific PLC being used and the point to which they are connected on the I/O cards.  The I/O Connections screen is shown below.

I/O Connections Screen


Step 3) List all actions the control system must take:
List in order all actions which the control system must take. Include energization and de-energization of pilot lights, solenoids, motors, timers, and counters as actions. Following is a list of all actions for the Stamping Station. process.

Start the conveyor

Stop the conveyor

Energize the stamping cylinder

De-energize the stamping cylinder

Re-Start the conveyor
 

Step 4) List the conditions for each action:
Above each control action statement, list all the conditions which mush be present to initiate each action.  The conditions are shown below in italics:

start button is momentarily pressed, LS-1 is made, LS-3 is released
Start the conveyor

LS-3 is made
Stop the conveyor and energize the stamping cylinder

LS-2 is made
De-energize the stamping cylinder

LS-1 is made
Re-Start the conveyor

LS-3 is released
Reset for another cycle
 

Step 5) Program a step relay for each action:
Program a relay output for each action. These relays are sometimes called "internal relays" or "step relays" because they step the machine through its sequence and do not need to be outputs that go to an output card.

Here are the general rules for programming step relays:
A.  The listed conditions (shown in italics above) are programmed to energize the step relay.

B.  Each step relay's initial conditions also include a normally open contact from the previous step relay.

C.  Each step relay seals itself on.

D.  The last step relay, Reset, does not seal itself on and a normally closed contact from it is used to break the seal-in of the previous step relays.

Rungs 1 through 3 of the ladder logic below show the following step relays and their use:
   cr1: Start the conveyor
   cr2: Stop the conveyor and energize the stamping cylinder
   cr3: De-energize the stamping cylinder
   cr4: Re-start the conveyor
   reset: Reset for another cycle
Note the programming structure shown described above.

Stamping Station Ladder Logic

    


  


Step 6) Program each actual machine output, timer, and counter:
Program each actual machine output (solenoid, motor starter, pilot light, etc.) and each timer and counter. Place the step relay contacts in each output rung as required for proper energization and de-energization. Typically, one step relay starts the output and another stops the output.

See rung 4 above for this program structure. Notice that:
    cr1 starts the conveyor,
    cr2 stops the conveyor,
    cr4 restarts the conveyor,
    cr2 energizes the stamp cylinder, and
    cr3 de-energizes the stamp cylinder.

It has been found that students are anxious to program the ladder logic for a process and are somewhat reluctant to take the time to apply the 6 step Structured PLC Programming process.  Much like writing a computer program, students are reluctant to first design the program using flow charts.  They soon find, however, that if they do use the Structured PLC Programming process, they save time in the long run by eliminating much trial and error work.
 

PROGRAM AVAILABILITY

PLC Simulator Ver. 6.0 is available on CD-ROM and includes 19 exercises and 20 sample programs. You can download a free demo version at http://www.netonecom.net/~rmiller/knoware.html or email Rick Miller at rickie_miller@yahoo.com (be sure to underline between rickie and miller) for more information.


 
 
Return to This Issues Home Page