Upload
others
View
6
Download
0
Embed Size (px)
Citation preview
Getting started with theGetting started with the
TEP PLC
2
TEP PLC
IntroductionBack in the 1960s industrial automation was achieved using
complicated networks of relays, timers and other dedicated
hardware blocks. If you’re not familiar with a relay, it is
simply an electromagnet (essentially a coil of wire), next
to a simple mechanical contact, albeit a magnetic one (see
Figure 1). When current is passed through the coil, a contact
that is normally closed is physically moved to open (or vice
versa). Relays are available in other confi gurations too, but the
principle is the same. By connecting relays together in various
ways, logical decisions can be made. For example, connect the
normally open contacts of two relays in series and the coils
of both relays must be energised before electrical current can
fl ow, say, to a motor (see Figure 2).
One particularly heavy user of this kind of control was the US
automotive industry. In a typical US car factory you would
fi nd, racks upon racks of relays clicking away, connected by
a rat’s nest of cables. The maintenance of such systems alone
must have been a nightmare. Imagine it’s time to “re-program”
for the yearly model change-over. Not an enviable task.
Figure 1: An illustration
of a Relay. The relay has
a common pin (COM)
that is connected to the
normally closed (NC)
contact when the coil is
off, and connected to
the normally open (NO)
contact when the coil
is on.
3
TEP PLC
It was the cost incurred and time lost in updating these relay
based control systems that prompted the industry to issue a
call to the engineers and technologists of the day to design
something better. Among others, Bedford Associates of Mas-
sachusetts approached the US automotive industry with what
they called the Modular Digital Controller (MODICON).
This system proved the favourite with the industry (over
other computer based systems being proposed), and the
MODICON 084 was the world’s fi rst commercially produced
Programmable Logic Controller (PLC).
The new PLCs could be programmed using a graphical
language, known as Ladder Logic, which was based on the
diagrams used to describe the old relay-based systems. This
meant that plant engineers could easily adapt to using PLCs,
and was perhaps one of the main reasons for the PLC’s
success over other systems. We will take a closer look at
Ladder Logic later.
Today, PLCs are ubiquitous: if you can see industrial activity,
you can bet a PLC is not far away. There are now many
Figure 2: AND logic with
relays
4
TEP PLC
manufactures of PLCs and, while there are subtle variations
between brands, they all operate in broadly the same way. The
PLC reads the state of its inputs, processes the Ladder Logic
program, and sets its outputs according to the result. Some
PLCs have a number of inputs and outputs built in, while
others are simply the processing unit to which additional
modules can be attached, be they inputs, relay based outputs,
motor controllers and so on.
The TEP PLC Hardware
Figure 3: Overview of
the TEP PLC hardware
5
TEP PLC
The TEP PLC hardware has been designed to be simple
as possible while maintaining the important aspects of an
industrial PLC. Connections to the inputs and outputs are
made via the screwless terminals (see Figure 4), allowing
quick modifi cation to wiring. Onboard push buttons provide
an easy way of modifying the input states without connecting
switches or other input devices. LED indicators show the
current state of both inputs and outputs. Together, these
features allow easy experimentation to aid the learning
process.
Power ConnectionsThe TEP PLC is powered by a 12V mains adaptor (included).
The 12V power supply plugs into the standard DC power
connector on the side of the PLC. This 12V supply powers
the internal PLC electronics, but it can be used with input and
output devices and so is also available at three locations via
the screwless terminals (one next to each input bank and one
next to the output terminals).
N.B. When powering external devices using the onboard
12V supply, care must be taken not exceed the rated output
current of the mains adaptor (allowing 500mA for the internal
electronics).
Figure 4: Inserting wire
into screwless terminal.
The wire can be freely
inserted while pushing
down on the orange
lever. Releasing the lever
will grip the wire. You
may fi nd it helpful to use
a small screwdriver to
move the lever.
6
TEP PLC
OutputsThe TEP PLC has a total of eight outputs. Each output can be
connected to via a pair of screwless terminals. The outputs are
electrically isolated from the internal electronics, hence, no
power is provided directly from outputs. The pair of terminals
are connected internally to the normally open contacts of
a relay. When the output is on, the relay contacts close and
there is an electrical connection between the two terminals.
When the output is off, there is no continuity between the two
terminals. Each output can simply be thought of as a switch.
The outputs are also isolated from each other, so can be used
to switch different power supplies or signals.
The simplest method of powering a device from the PLC uses
an output to switch the on-board 12V supply. For example,
if the output device is a 12V motor, the onboard 12V supply
(located next to the output terminals) can be wired through
one of the outputs to the motor (see Figure 5).
See Figure 6 and Figure 7 for additional examples of devices
connected to the PLC outputs.
Figure 5: A motor
connected to Output 1,
using the onboard 12V
supply for power.
7
TEP PLC
InputsThe PLC offers eight optically isolated inputs. An input is
sensed as being on when a small current is passed between
the common terminal and the input terminal (in either
direction). Achieving this can be as simple as wiring a switch
between 12V and the input, and wiring common to 0V (see
Figure 8). The system also allows transistor based sensors,
like opto-switches to be directly connected to the PLC. The
inputs are confi gured as two banks of four, with a common
terminal for each bank (COMA and COMB).
An opto-isolator is made from an LED (Light Emitting
Figure 6: A LED
powered by the onboard
12V supply. The LED is
connected in series with
a 1k resistor.
Figure 7: An output
wired to control a 3V
motor. The power is
provided externally by
two AA cells.
8
TEP PLC
Diode) and a photosensitive transistor, both encapsulated in
an opaque material. When current passes through the LED,
light shines on the photo-transistor and it turns on. In the TEP
PLC the opto-isolators accept current in either direction, so the
common terminal for a bank can be connected to 0V or 12V.
Expansion Ports and Slave PortsThe TEP PLC is equipped with four expansion ports to allow
future input and output modules to be connected. Possible
modules include temperature sensors, motor controllers,
analogue to digital converters and so on. Pending future
software updates, an additional PLC can also be connected as
a slave device, doubling the number of inputs and outputs.
Ladder Logic and SoftwareBasic software is included with the TEP PLC allowing easy
creation of Ladder Logic programs and provides a one-step
method of programming over USB. The software is free of
charge and any updates can be downloaded from the product
page on the Teaching Resources website (go to www.mutr.
co.uk and search for Programmable Logic Controller).
The main screen of the software consists of a Tool Box where
the various Ladder Logic symbols can be found; a Log area
which provides information about the PLC connection and
Figure 8: A push-to-
make switch connected
to an input.
9
TEP PLC
error feedback; a design area where the Ladder Logic Program
is written; and a menu bar giving access to File operations,
unlimited undo/redo and PLC programming operations (see
Figure 9).
To install the software, run setup.exe from the supplied CD
and follow the on-screen instructions. For guidance on using
the software, please review Tutorial 1.
Figure 9: TEP PLC
Application
10
TEP PLC
Ladder LogicBefore we take a look at a Ladder Logic program, let’s
familiarise ourselves with two important symbols (Figure 10
and Figure 11):
If we wanted to draw an unconnected relay with these symbols
it might look something like Figure 12.
If we pass a current through the coil, from A to B, the
normally open contact will be closed connecting C to D.
Although almost all the symbols used in a Ladder Logic
program don’t represent real relays, it is useful to know their
origin, and in some sense can be thought of as parts of virtual
relays.
In a Ladder Logic program, the LOAD symbol (or normally
open contact symbol) can be used to read an input, and the
OUT symbol (or relay coil symbol) can be used to change the
state of an output.
Figure 10: This is the
symbol that represents
normally open contact,
or “switch” within a relay.
It is known as the LOAD
symbol in Ladder Logic.
Figure 11: This
symbol represents the
electromagnet, or coil
in a relay. It is known
as the OUT symbol in
Ladder Logic.
Figure 12: Symbolic
relay.
11
TEP PLC
The basic output of a PLC is usually a simple relay, with the
normally open contact exposed to the outside world. To close
the contact the coil must be energised, hence the OUT symbol
(or coil symbol) is used to change the state of the output from
within a program.
The input of a PLC is usually not a relay, but an optically
coupled switch (or opto-isolator). An opto- isolator is made
from an LED (Light Emitting Diode) and a photosensi-
tive transistor, both encapsulated in an opaque material.
When current passes through the LED, light shines on
the photo-transistor and it turns on. This arrangement is
very similar to current passing through the coil of a relay,
causing the normally open contact to close (compare the
LED with the coil and the photo-transistor with the normally
open contacts). Hence, it is the LOAD symbol (normally
open contact symbol) that reads the state of an input (or its
photo-transistor). Figure 13 shows a simplifi ed diagram of a
PLC, highlighting how Ladder Logic symbols relate to the
electronics inside.
Figure 13: Illustration
showing how Ladder
Logic relates to the
internal electronics of
a PLC.
12
TEP PLC
Figure 14 shows one of the simplest Ladder Logic programs
you could create. Let’s fi rst analyse the program in terms of
relay symbols. The normally open contact symbol on the left
represents the state of INPUT1, and can be thought of as a
switch (the photo-transistor) that is closed when the input
is on. The coil symbol on the right represents the coil in the
output relay, OUTPUT1. The Ladder Logic diagram can be
thought of as a kind of circuit diagram, when the input is on,
the normally open contact is closed, current is allowed to fl ow
from left to right and the output relay is energised. Programs are
constructed as a series of rungs and hence resemble a ladder.
Figure 14: Simple Ladder
Logic diagram
13
TEP PLC
In modern Ladder Logic, instead of thinking about current
fl owing through the diagram, we tend to think of symbols in
the program as being logically true or false. The normally
open contact symbol is called LOAD. In the above case the
state of INPUT1 is loaded (the LOAD symbol will be true if
the input is on and false of the input is off). The coil symbol
is known as OUT. An OUT symbol “looks” for a path of true
symbols to the left hand side. If there is a continuous path of
true symbols before the OUT symbol, the OUT symbol itself
is true and OUTPUT1 is turned on. These basic concepts and
additional functions of the TEP PLC will be explored in the
tutorials that follow.
Despite its age, Ladder Logic is still the standard
programming language of PLCs. TEP’s implementation of
this graphical language, with intuitive names like INPUT1,
OUTPUT3 and TIMER1, means that you can be up and
running in no time (while simultaneously learning skills
applicable to the real world).
14
TEP PLC
Tutorial 1: Simple Logic with Inputs and OutputsThis fi rst tutorial will cover the use of the TEP PLC software
while demonstrating some simple Ladder Logic. If you have
not already done so, install the software by running setup.exe
from the CD included.
• Run the software in the usual way. Once loaded, you will see the main screen (see Figure 9), with a Tool Box and design area.
• Go to the File menu and select New (before you can start creating Ladder Logic program you need to start a new document).
The Tool Box has a selection of various Ladder Logic symbols
as well as a cursor icon at the top. The current tool/symbol
is drawn in blue. Left clicking in the design area will place
the currently selected Tool Box symbol in the Ladder Logic
program. If the cursor is the current tool, symbols can by
selected in the design area (currently one at a time) and
deleted by pressing the delete key (or selecting Delete from
the Edit menu).
• Select the LOAD symbol from the Tool Box by left clicking on it.
• Move the mouse cursor to the upper left location in the Ladder Logic program and left click to place the LOAD symbol. The cursor position is always shown by a blue square.
15
TEP PLC
• Next select the OUT symbol from the Tool Box (again by left clicking).
• Move to the upper right location in the Ladder Logic program and left click to place the OUT symbol.
Whenever an OUT symbol (or similar symbol) is placed on
the right hand side of the Ladder Logic program, the software
should automatically fi ll a horizontal connection to the left. If
it does not, you will need to manually connect the LOAD and
OUT symbols by selecting the Horizontal symbol from the
Tool Box and fi lling the space between LOAD and OUT.
16
TEP PLC
Now we have the structure of our fi rst Ladder Logic program
in place, we need to set the properties of the LOAD and OUT
symbols. In this case we want LOAD to load the state of
INPUT1 and OUT to change the state of OUTPUT1.
• Right click on the LOAD symbol, from the submenu Inputs, choose INPUT1.
• You should see the text under the LOAD symbol change from UNSET to INPUT1.
17
TEP PLC
• Repeat the same steps on the OUT symbol, selecting OUTPUT1 from the submenu Outputs.
If you make any mistakes you can undo and redo your changes
by selecting Undo or Redo from the Edit menu.
Your fi rst Ladder Logic program is now complete. At this
point you might want to save the program.
18
TEP PLC
It’s now time to test the program. First we need to set up the
hardware.
• Connect the 12V power supply to the PLC (the red Stopped LED should light).
• Connect the PLC to the computer with the USB cable. You should see the message “PLC Connected” appear in the Log window and the green USB LED on the PLC should light.
We are ready to send the Ladder Logic program to the PLC.
• From the PLC menu select Program PLC. If there are no errors you should see a message in the Log window informing you that the PLC was successfully programmed.
After the PLC has been programmed, the software automati-
cally sets the PLC running. You should see the green Running
LED light. To start and stop the program you can press the
Run/Stop button on the PLC, or select Run PLC or Stop PLC
from the PLC menu.
In this Ladder Logic program the LOAD symbol reads the
state of INPUT1 (the LOAD symbol will be true if the input is
on and false otherwise). The OUT symbol “looks” for a path
of true symbols to the left hand side of the rung, if there is a
continuous path of true symbols, the OUT symbol is also true
and OUTPUT1 is turned on.
• Try pressing the onboard button associated with
19
TEP PLC
INPUT1, you should see the LED indicators for INPUT1 and OUTPUT1 light.
• Try pressing another input button.
The TEP PLC stores the program in internal memory so it can
run without being connected to the computer. The program
will also be preserved if power to the PLC is disconnected.
Before we conclude this tutorial, let’s try a couple more simple
Ladder Logic programs.
• Select the LOAD symbol in the Tool Box and place it next to the existing LOAD symbol (it will overwrite the Horizontal symbol).
• Right click on the new LOAD symbol and set it to read the state of INPUT2.
20
TEP PLC
Can you predict how the program will behave?
Now, the OUT symbol will only “see” a continuous path of
true symbols to the left hand side, if both LOAD symbols are
true (INPUT1 and INPUT2 are on).
• Select Program PLC from the PLC menu once more. The PLC will be programmed and start running.
• Press the buttons for INPUT1, INPUT2 and INPUT1 and INPUT2 simultaneously. Does the logical AND condition work as you expect?
Lastly, let’s modify the Ladder Logic program so OUTPUT1
is turned on if INPUT1 OR INPUT2 are on.
• Select the cursor icon from the Tool Box.
• Left click on the LOAD INPUT2 symbol so it becomes highlighted.
21
TEP PLC
• Press delete (or select Delete from the Edit menu).
• Select the Horizontal symbol from the Tool Box.
• Place a Horizontal connection in the gap next to the remaining LOAD symbol.
• Select the LOAD symbol from the Tool Box and place it directly beneath the existing LOAD symbol.
• Right click on the new LOAD symbol and set it to load the state of INPUT2.
• Select the Vertical symbol from the Tool Box.
• Place the Vertical symbol so both LOAD symbols are connected to the OUT symbol in parallel.
There are now two alternative paths to the OUT symbol,
through LOAD INPUT1 or LOAD INPUT2.
• Send the program to the PLC and test to see if it behaves as you expect.
In this tutorial you have covered: general use of the TEP
PLC software; creating simple Ladder Logic programs;
downloading and running programs on the hardware; creating
simple logical conditions in Ladder Logic.
This concludes the tutorial.
22
TEP PLC
Tutorial 2: Latching using an Internal RelayIn this tutorial we will cover Internal Relays and introduce the
LOADBAR symbol.
Knowledge of the TEP PLC software is assumed (covered in
Tutorial 1).
An Internal Relay can be thought of as virtual relay within the
PLC. The OUT symbol can be used to change the state of the
Internal Relay and the LOAD symbol can be used to read the
state.
In the follow example, we will use an Internal Relay to form
a latch.
• Create a new Ladder Logic document.
• Place two LOAD symbols, an OUT symbol and connect them as shown in the screenshot below:
23
TEP PLC
• Right click the top LOAD symbol and select INPUT1.
• Right click on the OUT symbol and select INTERNAL1 from the Internal Relays submenu.
• Right click on the lower LOAD symbol and select INTERNAL1.
When the above Ladder Logic program is run, to begin with
the internal relay, INTERNAL1, is off. If INPUT1 is also
off, there is no path of true symbols to the OUT symbol. If
INPUT1 is on, the LOAD INPUT1 symbol is true, there is a
path of true symbols to the OUT symbol and INTERNAL1
is turned on. Once INTERNAL1 is on, there will always be
a path to the OUT symbol through the LOAD INTERNAL1
symbol and INTERNAL1 will remain on (even when the state
of INPUT1 is off again).
24
TEP PLC
Before we can test this program we need to add another rung
of Ladder Logic to show the state of INTERNAL1 on an
output.
• Replicate the second rung shown below:
• Send the program to the PLC. You should fi nd that OUTPUT1 becomes latched on when the INPUT1 button is pressed. At the moment there is no way to reset the state of OUTPUT1 (apart from resetting the PLC).
We will now introduce a new symbol called LOADBAR.
The LOADBAR symbol is very similar to the LOAD symbol
except its true and false states are inversed. If LOADBAR
loads a state of something that is on, it will take on a false
value and vice versa.
To add a reset feature to our program, we need to break the
25
TEP PLC
path of true symbols formed by the latch condition.
• Add a LOADBAR symbol and set it to load INPUT2, as shown below:
When INPUT2 is off, the LOADBAR symbol is true and
the path through either LOAD symbol is not interrupted. If
INTERNAL1 is on (latched) and INPUT2 is turned on, the
path of true symbols is interrupted by the false LOADBAR
symbol and INTERNAL1 is turned off.
• Send the program to the PLC and test the behaviour.
In the next tutorial we will look at an easier way to accomplish
latching.
26
TEP PLC
Tutorial 3: Set and Reset (Scan Cycle and Timings)In this tutorial we will take a look at the SET and RESET
symbols, and discuss how the PLC scans the ladder logic.
The SET and RESET symbols are similar to the OUT symbol
in that they change the state of a relay. When the SET symbol
is true (when there is a path of true symbols from the left hand
side of the rung) the output or relay it refers to is turned on.
Unlike the OUT symbol, when the SET symbol is false (when
the path of true symbols is no longer present), it does not turn
the relay off. The RESET symbol will turn a relay off if it is
true, but not change the state of a relay if it is false.
• To see SET and RESET in action, reproduce the Ladder Logic program below:
The top rung connects LOAD INPUT1 with SET OUTPUT1,
27
TEP PLC
and the bottom rung connects LOAD INPUT2 with RESET
OUTPUT1.
• Send the program to the PLC. You should fi nd that OUTPUT1 turns on when INPUT1 is turned on, and the output should stay on until INPUT2 is turned on.
• Try pressing both INPUT1 and INPUT2 at the same time. Should the output be on or off?
To understand what will happen we need to know how the
PLC runs the program.
The PLC is constantly scanning the Ladder Logic program.
At the beginning of each scan the PLC loads the state of the
inputs into memory. The PLC then analyses all the Ladder
Logic from left to right and top to bottom. Finally, the PLC
sets the outputs of the PLC according to the result from the
program. In our program the last rung of Ladder Logic to be
analysed resets OUTPUT1, so if both inputs are on, the output
will remain off.
PLCs repeat the scan after a fi x time interval. The scan time
for the TEP PLC is 10ms (or 100 scans every second). It is
important to note the scan time of a PLC, as an input pulse
shorter than this time can be missed by a scan.
This concludes the tutorial.
28
TEP PLC
Tutorial 4: CountersA counter is a device within the PLC that can be used to
keep track of the number of times an event occurs. There are
32 counters within the TEP PLC. Each counter can store a
number between 0 and 65,536. There are three output style
symbols associated with counters: COUNT UP, COUNT
DOWN and COUNTER RESET. The counter symbols operate
when they change from being false to true (i.e. on the rising
edge). When this transition occurs: COUNT UP increases
the current number stored by 1; COUNT DOWN decreases
the current number store by 1; COUNTER RESET resets the
current stored number to zero. Like relays, counters can also
be on or off. The state of a counter is determined by whether
its currently stored number is above or below a preset value. If
it is above or equal to, the counter is on, otherwise it is off.
• To demonstrate the use of counters, enter the program below:
29
TEP PLC
All three counter symbols act on COUNTER1 and their
preset value is left at the default (10). To show the state of
COUNTER1 on an output, we need to add an additional rung.
• Add the rung below, connecting LOAD COUNTER1 to OUT OUTPUT1.
• Send the program to the PLC.
• Press the INPUT1 button 10 times; you should fi nd OUTPUT1 turns on.
• Experiment with INPUT1, INPUT2 and INPUT3 to see the effects of the different counter symbols.
To change the preset value of a counter, right click on both COUNT
UP and COUNT DOWN and select Set value... from the menu.
30
TEP PLC
This concludes the tutorial.
31
TEP PLC
Tutorial 5: TimersThe TEP PLC currently provides 32 on-delay timers. On-delay
means the timer symbol must be true for a preset time before
the timer itself turns on. Let’s start with a simple example.
• Enter the program as shown below:
When LOAD INPUT1 becomes true, TIMER1 starts running.
We have left the preset for the timer at 100 (times are
measured in hundredths of a second, so a preset of 100 equates
to 1 second). After 1 second has passed TIMER1 turns on and
the second rung turns OUTPUT1 on.
• Send the program to the PLC.
• Press and hold the INPUT1 button; after one second you should fi nd OUTPUT1 turns on.
• Release the INPUT1 button; output one should turn off.
32
TEP PLC
The timers are not cumulative, so if you hold the button for
INPUT1 down for half a second and let go, the timer will reset
to its initial state.
Like counters, the preset value can be changed by right
clicking and selecting Set value... from the menu.
Now let’s try a more complicated program. Say we want an
output to turn on one second after an input turns on, and we
want it to stay on for one second after that.
We don’t want to have to hold down the input while this takes
place so we are going to use an internal relay to “remember”
that the input was momentarily on. We are also going to use
two separate timers, one to time the delay before the output
turns on and one to run for the time we want the output to
remain on.
33
TEP PLC
• Enter the program shown below:
The fi rst rung of the program uses a SET symbol to turn on
INTERNAL1 when LOAD INPUT1 is true. This means we
don’t have to hold the button for INPUT1 down.
The second rung connects LOAD INTERNAL1 to TIMER1.
Once INTERNAL1 has latched on, TIMER1 will run and will
turn on after 1 second has passed.
Once TIMER1 is on, the third rung turns on OUTPUT1 and
also starts TIMER2 running.
Finally, TIMER2 is on (having run for one second) and the
fourth rung turns off INTERNAL1 (using a RESET symbol).
LOAD INTERNAL1 (in the second rung) becomes false
and turns off TIMER1. LOAD TIMER1 (in the third rung)
becomes false turning off OUTPUT1 and TIMER2. The PLC
has returned to its original state.
34
TEP PLC
This concludes the tutorial.
35
TEP PLC
Future Proof and Giving FeedbackTEP has produced an inexpensive, user friendly PLC,
designed from scratch for education. In the future, we hope to
make available expansion modules to enhance the capabilities
of the hardware, and provide additional software features free
of charge. Updates will be available from the product page on
the Teaching Resources website (go to www.mutr.co.uk and
search for Programmable Logic Controller).
Desktop engineering kits that are compatible with the TEP
PLC will also be available on the Teaching Resources website.
Kits include a sweet dispenser, mini printing press and a
thread cutter.
Any feedback regarding your experiences with the TEP PLC
or suggestions for the future will be gratefully received. These
can be sent to Teaching Resources Limited, or emailed directly
Teaching Resources Ltd.Unit 10,The IO Centre,Lea Road,Waltham Cross,Herts,EN9 1AS
Tel. 01992 716052www.mutr.co.uk