Mechatronics Training Guide Introduction to Programmable Logic Controllers (PLCs)
Festo Learning Systems www.festo.com/uslearningsystems 866.661.7496 631.404.3182
Introduction to Programmable Logic Controllers (PLCs) Training Guide
Intended Use This station has been developed and produced solely for vocational and further training purposes in the field of automation and technology. The company undertaking the training and/or the instructors is/are to ensure that trainees observe the safety precautions described in the manuals provided. Festo Didactic herewith excludes any liability for damage or injury caused to trainees, the training company, and/or any third party, which may occur if the system is in use for purposes other than purely for training, unless the said damage/injury has been caused by Festo Didactic deliberately or through gross negligence. Order No.:
XXXXXX
Update:
08/2010
Authors:
Frank Ebel, Markus Pany Revised by Tony Oran, Mark Adrian, Cristobal Jimenez
Graphics:
Doris Schwarzenberger, Albert Sigel
© Festo Corporation, 2010 Internet: festo.com/uslearningsystems e-mail:
[email protected] Address: 395 Moreland Road; Hauppauge, NY 11788 The copying, distribution, and utilization of this document, as well as the communication of its contents to others without express authorization, is prohibited. Offenders will be held liable for the payment of damages. All rights reserved, in particular the right to carry out patent, utility model, or ornamental design registration. Copyright permission form for electronic version of manual available upon request.
TABLE OF CONTENTS Getting Started .............................................................................................................. 1 Training Contents ......................................................................... Error! Bookmark not defined. Course Objectives: ...................................................................................................................... 4
Programmable Logic Controller............................................................................. 7 Introduction to Programming ..................................................................................................... 9 Ladder Diagram ....................................................................................................................... 9 Function Block Diagram .......................................................................................................... 9 Statement List ....................................................................................................................... 10 Structured Text (ST) .............................................................................................................. 10 What is a PLC? ........................................................................................................................... 11 Parts of a PLC ........................................................................................................................ 12 Construction of a PLC ............................................................................................................ 13 Fixed I/O PLC ......................................................................................................................... 13 Modular PLC .......................................................................................................................... 13 Program Execution on a PLC ................................................................................................. 14 Scan cycle ............................................................................................................................ 14 I/O Connections .................................................................................................................... 15 Sequence Control Systems ................................................................................................... 15 PLC Programming Using STL ................................................................................................. 17 STL Element Hierarchy .......................................................................................................... 17 STEP Instruction .................................................................................................................... 18 Sentences .............................................................................................................................. 18 Comparison to Ladder Diagrams .......................................................................................... 18 Sample STL Program ............................................................................................................. 19 Step Execution Rules ............................................................................................................. 21 Basics of I/O Communication.................................................................................................... 22 Lesson Summary ...................................................................................................................... 25 Lesson 5 Review ........................................................................................................................ 27
Glossary ......................................................................................................................... 31 Index ............................................................................................................................... 37
Getting Started
©2010, Festo Didactic
Page 1
Getting Started
Getting Started • Training Contents • Important Notes • Responsibilities of the Instructor • Responsibilities of Trainees • Safety • Warranty and Liability • Intended Use
©2010, Festo Didactic
Page 1
Getting Started Important Notes The basic requirement for safe use and trouble-free operation of the MPS® (Modular Production System) is to observe the fundamental safety recommendations and regulations. The safety recommendations in particular must be observed by anyone working on the MPS®. Furthermore, the rules and regulations for the prevention of accidents applicable to the place of use must be observed.
Responsibilities of the Instructor The operating authority undertakes to ensure that the MPS® is used only by persons who: • Are familiar with the basic regulations regarding operational safety and accident prevention and who have received instructions in the handling of the MPS®. • Have read and understood the safety and the cautionary notes in this manual. Safety-conscious working of the persons should be regularly evaluated.
Responsibilities of Trainees Prior to beginning work, all persons assigned to working on the MPS® have a duty to: • Read the section on safety and the cautionary notes in this manual. • Observe the basic regulations regarding operational safety and the prevention of accidents.
Safety The MPS® is designed according to state-of-the-art technology and in compliance with recognized safety regulations. However, when using the system, there is, nevertheless, a risk of physical or fatal injury to the user or third parties or of damage being caused to the machinery or other material assets. The MPS® is to be used only: • For its intended purpose. • In absolutely safe conditions. ©2010, Festo Didactic
Faults impairing safety must be rectified immediately! Page 2
Getting Started General • •
Trainees must work on the station only under the supervision of an instructor. Observe the data in the data sheets for the individual components, in particular, all notes on safety!
Electrics • •
Wire up or disconnect electrical connections only when power is disconnected! Use only low voltages of up to 24 V DC.
Pneumatics • • • •
Do not exceed the permissible pressure of 8 bar (800 kPa). Do not switch on compressed air until you have established and secured all tubing connections. Do not disconnect air lines under pressure. Pay particular attention when switching on the compressed air. Cylinders may advance or retract as soon as the compressed air is switched on.
Mechanics • •
Securely mount all components on the plate. Do not attempt manual intervention unless the machine is at rest.
Warranty and Liability In principle, all Terms and Conditions of Sale apply. These are available to the operating authority upon conclusion of the contract. Warranty and liability claims for persons or material damage are excluded if these can be traced back to one or several of the following causes: • Use of the MPS® not in accordance with its intended purpose. • Incorrect assembly, commissioning, operation, and maintenance of the MPS®. • Operation of the MPS® using faulty safety equipment or incorrectly fitted or nonoperational safety or protective devices. • Non-observance of notes in the manual regarding transport, storage, assembly, commissioning, operation, maintenance, and set up of the MPS®. • Unlawful constructional modifications on the MPS®. • Inadequate monitoring of components subject to wear. • Repairs carried out incorrectly. • Catastrophes as a result of foreign bodies. Festo Didactic herewith rules out any liability for damage or injury to trainees, the training company, and/or other third parties which may occur during the use/operation ©2010, Festo Didactic
Page 3
Getting Started of the system other than purely in a training situation, unless such damage has been caused intentionally or due to gross negligence by Festo Didactic.
Intended Use This system has been developed and produced exclusively for vocational and further training in the field of automation and technology. The training authority and/or the instructors is/are to ensure that trainees observe the safety precautions described. The use of the system for its intended purpose also includes: • Following all advice in the manual. • Carrying out inspection and maintenance work.
Course Objectives • • • • • •
Explain the function of a ladder diagram. Explain the function of a block diagram. Describe Statement List and Structured Text. Explain the function of a Programmable Logic Controller (PLC). Describe the parts of a PLC. Describe I/O connections.
©2010, Festo Didactic
Page 4
Getting Started
Do not use the worksheets in this workbook. Print the worksheets from the Training Guide CD included in the back of this book. Additional resources can be found on the CD included with the MPS station. ©2010, Festo Didactic
Page 5
Getting Started
©2010, Festo Didactic
Page 6
Lesson Programmable Logic Controller Lesson Objectives: • Explain the function of a ladder diagram. • Explain the function of a block diagram. • Describe Statement List and Structured Text. • Explain the function of a Programmable Logic Controller (PLC). • Describe the parts of a PLC. • Describe I/O connections. • Develop a PLC program using Statement List Language (STL). • Complete an input and output map of the signals from the PLC to the control panel. • Explain the relationship between the outputs of a PLC and the actuators they serve.
©2010, Festo Didactic
Page 7
Average Lesson Time:
15 Hours
In this lesson, students will learn the fundamentals of programming using Ladder Diagrams, Statements Lists, Structured Text, and Function Blocks. Students will also learn to program using STL (Statement List Language). In addition, students will identify inputs and outputs of the MPS® station and control panel. Students will learn about the relationships between: • • •
The outputs of a PLC and the actuators they serve. The sensors and the inputs of a PLC. The signals from the PLC to the control panel.
Terminology Algorithm Backplane Banana Connector Central Processing Unit (CPU) Coil Element Control Logic Digital I/O Ethernet Field Bus Fixed I/O PLC FST Function Block Diagram IEC 61131-3 Input Module Ladder Diagram Logic Diagram Modular PLC NOP NPN Controller Operand
©2010, Festo Didactic
Operating Output Module Pascal PLC Relay PNP Controller Profibus-DP Programmable Logic Controller (PLC) Relay Coil Scan Scan Cycle Scan Time Sequential Function Chart Sinking I/O Circuits Sourcing I/O Circuits Statement List Language (STL) Step Instruction Structured Text (ST) SysLink Connector
Page 8
Lesson 5: Programmable Logic Controller Introduction to Programming The IEC standard 1131-3 defines five programming languages. Although these languages differ greatly in their functionality and structure, they are nevertheless regarded as one language family by IEC 1131-3, with general structural and configuration elements (variable declaration, organization units such as function blocks and modules, etc.). These languages can be used in any combination within a PLC project. The unification and standardization of these five languages represent a compromise of historical, regional, and industry-specific requirements. Provision has been made for future expansion (such as the function block principle or the language resource Structured Text) and for essential matters relating information technology (data types etc.). The language elements are explained with the help of processing procedures during the production of valves. Two sensors are used to detect whether a correctly drilled workpiece is available at the processing position. If the valve to be processed is of type A or type B – this is set via two selector switches – then the cylinder advances and presses a sleeve into the hole.
Ladder Diagram
The ladder diagram is a graphic programming language derived from the circuit diagram representation of directly wired relay controls. A ladder diagram consists of power rails on the left- and right-hand side of the diagram, which are connected via rungs by means of switching elements (normally open contacts, normally closed contacts) and coil elements.
Function Block Diagram
In the function block diagram, the functions and function blocks are represented graphically and interconnected into networks. The function block diagram originates from the logic diagram for the design of electronic circuits.
©2010, Festo Didactic
Page 9
Lesson 5: Programmable Logic Controller
Statement List
Statement list is a textual, assembler type language, typified by a simple machine model (process with only one register). A statement list is made up of control instructions consisting of an operator and operand. LD OR AND AND ST
Part_TypeA Part_TypeB Part_present Dr ill_OK Sleeve_in
With regard to philosophy of languages, the ladder diagram, function block diagram, and statement list are defined in the manner in which they are used in PLC technology nowadays. They are, however, limited to basic functions with regard to their elements. This is where they mainly differ from the currently existing company dialects. The high performance of these languages is due to the unlimited use of functions and function blocks.
Structured Text (ST)
Structured text is a high-level language based on Pascal consisting of expressions and instructions. In the main, instructions are defined as follows: Selection instruction such as IF...THEN...ELSE etc., repeat instructions such as FOR, WHILE etc., as well as function block invocations. Example: Sleeve_in:=(Part_TypeA OR Part_TypeB) AND Part_present AND Drill_OK; Structured text facilitates the formulation of numerous applications which exceed pure control technology, such as algorithm problems (high-order computing algorithms, etc.) and data management (data analysis, dealing with more complex data structures, etc.).
©2010, Festo Didactic
Page 10
Lesson 5: Programmable Logic Controller What is a PLC?
A programmable logic controller (PLC) is a specialized computer to perform logic functions for machine control. For example, let us assume that we have a drill press that needs to turn on only when there is a part in the press and the operator has one hand on each of the two start switches. The logic functions to make sure that all such conditions are met before starting the press can be implemented using a PLC. Until early 1970s, such logic functions for machine control were implemented using relays. Machines had huge wiring panels with hundreds of relays. The panels were designed by engineers and were wired by electrical technicians. The drawings given to the technicians were called ladder diagrams since they resembled ladders. The ladder showed all the switches, sensors, motors, valves, relays, etc., that were used in the control system. Output devices, such as motors or valves, were connected to the contacts of the relays. The figure below shows such a ladder diagram with switches S1, S2, S3 and relay coils CR1 and CR2. The diagram implements the following control logic: RUNG 1: ELSE RUNG 2:
IF S1 OR S2 is pressed THEN activate CR1 IF both S2 AND S3 are pressed THEN activate CR2
Neutral Rail
Power Rail S1 RUNG 1
CR1 S2 RUNG 2
S2
S3
CR2
The main disadvantage of the relay panels was the failure of the relays. Even a very good relay has a life of about one million cycles. In some high speed machines this may mean only six months of use. The maintenance of the panels was very time consuming ©2010, Festo Didactic
Page 11
Lesson 5: Programmable Logic Controller and sometimes impossible due to the complexity of the panel and all the intermediate undocumented changes made to it. Also, if a change in the product required change of the operation sequence of the machine, the panels pretty much had to be rewired. This was a major expense, and production time was lost while the system was shut down for rewiring. With the introduction of PLCs starting in the early 1970s, most of these problems were solved. In a PLC, the control logic (ladder diagram) is implemented in software, making it very easy to modify. The wiring of the field devices, such as the switches, sensors, motors, etc. is greatly simplified through the input/output (I/O) interface of the PLC. In addition, because a PLC is a computer, it is capable of not only performing relay switching tasks but also performing other tasks such as counting, calculating, and handling analog signals.
Parts of a PLC
As mentioned earlier, a PLC is a specialized computer. The following table compares parts of a PLC to those of a personal computer (PC): Parts of a PLC
Parts of a PC
Central processing unit (CPU)
Central processing unit (CPU)
Input module(s)
Keyboard and mouse
Output module(s)
Monitor
Power supply
Power supply
Backplane
Motherboard
Programming device As the table indicates, a PLC is very much like a PC except it has specialized input and output modules. Unlike the keyboard and mouse of a PC, the inputs to the PLC come from field devices, such as sensors and switches, through its input module(s). In a PC the output is sent to a monitor for the user to see. The PLC outputs are sent to field devices, such as motors, relays, valves, etc., through its output module(s). Since the PLC does not have a keyboard or a monitor, a device with a keyboard and monitor is required for programming. In most of today’s PLCs, a PC is connected to the PLC as a programming device.
©2010, Festo Didactic
Page 12
Lesson 5: Programmable Logic Controller PLC Power supply
Input module
Central processing unit (CPU)
Output module
Pilot light Relay coil
Motor Input devices (switches, limit switches, sensors, etc.)
Output devices (motors, relays, motor starters, pilot lights, etc.) PC as a programming device
Construction of a PLC
There are two ways in which PLCs are constructed: • Fixed I/O • Modular PLC Fixed I/O PLC Fixed I/O is typically available in small PLCs that come in one package. These types of PLCs are sometimes called brick PLCs because of their small size.
Example of a fixed I/O PLC.
Modular PLC Modular PLCs consist of a CPU module, rack, power supply, and I/O modules in components purchased separately. They greatly increase the ability to custom configure a PLC for a more complex control application. The PLC can be configured to have different types of I/O modules such as digital I/O, analog I/O, communication interface modules, and intelligent I/O with a built-in CPU for high-speed frequency counting.
©2010, Festo Didactic
Page 13
Lesson 5: Programmable Logic Controller
Communication
Output
Input
Power supply
Input
Processor
Program Execution on a PLC
A PLC connects input field devices to output field devices through a ladder logic program implemented in software. For example, in the case of the implementation below, the output relay coil 2 (CR2) is energized only if both switches S2 and S3 are pressed. PLC Power supply
S1
S2
S1
CR1
CR1
Input module
S2 S2
S3
Output module
CR2
S3
CR2
Scan cycle During each operating cycle, the processor: 1. Reads all inputs. 2. Runs the ladder program once to determine the changes in the states of the output devices based on the control logic described by the ladder program and the states of the input devices. 3. Energizes or de-energizes the output devices accordingly. This process is known as a scan. Because the inputs can change at any time, the PLC must repeat this process continuously. Scan time varies with program content and length. A single scan can take anywhere from 1 to 20 ms. If an input changes its state faster than the scan time, then the PLC will most likely miss the changes.
©2010, Festo Didactic
Read inputs
Update outputs
Run program
Page 14
Lesson 5: Programmable Logic Controller I/O Connections
PLC I/O and most field devices can be classified into two types (1) Sinking or (2) Sourcing. The difference is in the construction of the internal circuitry and the type of transistor used. • Sourcing I/O circuits supply (source) current to sinking field devices. • Sinking I/O circuits receive (sink) current form sourcing field devices. Therefore, when connecting a field device such as a proximity sensor to a PLC I/O: • Sourcing field devices must be connected to sinking PLC I/O and • Sinking field devices must be connected to sourcing PLC I/O. The diagram below shows a typical wiring scheme for a sinking input module and a sourcing output module. In case of the input, current is supplied from the field device (switch and the power supply) to the sinking input module. On the other hand, the sourcing output module supplies current to the sinking field device (pilot light). In this case, the power is provided by the external power supply connected to the output module. VDC
S1
1 2 3
Output module DC power supply
1 2 3 Pilot light
Input device DC power supply
GRD GRD Sinking Input module
Sourcing Output module
Sequence Control Systems
Sequence control systems are processes executed in several, clearly separate steps. In such systems, progression from one step to the next occurs only when enabling conditions of the current step are fulfilled. For example, a stamping machine may go through the following sequence of five steps to complete its operation on a part: 1st Check initial part position. 2nd Clamp part. 3rd Stamp part. 4th Unclamp part. 5th Eject part.
©2010, Festo Didactic
Page 15
Lesson 5: Programmable Logic Controller Such sequential operations can be represented by a sequential function chart as follows:
1
Receive part from a feeder 1.1: Part present, stamping, clamping and ejection cylinders retracted
S
2
Clamp part
2.1: Part present and clamped
S
3
Stamp part
3.1: Part stamped
S
4
Unclamp part
4.1: Stamping and clamping cylinders retracted
S
5
Eject part
5.1: Part ejected
A • • •
sequential function chart contains: Steps Transitions between steps and Actions. Step Transition Step
Receive part from a feeder
1
1.1: Part present, stamping, clamping and ejection cylinders retracted
2
S
Clamp part
Action
Steps represent the sequence of the operation. Transitions describe the condition for moving from one step to the next. Actions are commands executed by a sequence controller (PLC).
©2010, Festo Didactic
Page 16
Lesson 5: Programmable Logic Controller In the above two steps, execution moves from the first step to the second step of the operation only if the “part positioned” condition is met. If the positioning of the part is monitored by a sensor, this would imply that the sensor must be triggered to move to the second step. PLCs are widely used in industry to implement such sequential operations. Can you see a resemblance between the sequential function chart shown on the previous page and the PLC scan cycle?
PLC Programming Using STL
As mentioned in Section 2.1, PLCs were developed in the early 1970s in response to the need for quick change over time and ease of maintenance of automated equipment. Prior to the PLCs, automation was implemented using relays and ladder logic wiring diagrams. Initially, PLCs were programmed using a graphical language (ladder diagram programming) that looked like the ladder diagrams. This made transition from the relay implemented control boards to the PLCs very easy. In fact, ladder diagram programming remains one of the most widely used PLC programming languages today. Another PLC programming language is Statement List (STL) Language. STL language allows the programmer to solve control tasks using simple English statements to describe the desired operation of the controller. STL Element Hierarchy STL programs consist of “steps”. Each step can contain one or more sentences. Each sentence contains a conditional and an executive part. STEP 1 SENTENCE 1 Conditional part THEN Executive part SENTENCE 2 Conditional part THEN Executive part STEP 2 SENTENCE 1 Conditional part THEN Executive part SENTENCE 2 Conditional part THEN Executive part
©2010, Festo Didactic
Page 17
Lesson 5: Programmable Logic Controller STEP Instruction The STEP instruction is used to mark the beginning of a logical block of program code. Each step may be assigned an optional label or a name. It is important to note that the program execution will wait at a step until the conditions are true, at which time the actions will be performed. Only then will the program proceed to the next step. Sentences The Sentence forms the most basic level of program organization. Each sentence is constructed as an “IF … THEN…” statement with a conditional and an executive part. If the conditional part is true then the executive part is performed. For example, IF THEN
I1.0 O1.2
SET
This sentence will set (turn on) output O1.2 if the input I1.0 is true. It is also possible to make logical combinations. For example, IF
THEN
AND AND SET RESET
I1.0 I2.1 O2.2 O1.2 O3.0
N
This sentence will turn output O1.2 ON and output O3.0 OFF if input I1.0 is ON and I2.1 is OFF and output O2.2 is ON. Comparison to Ladder Diagrams Consider a rung in a ladder diagram that turns output O2.6 ON whenever input I1.0 is ON: I1.0
O2.6
The equivalent STL sentence would be: IF I1.0 THEN SET O2.6 PSE ©2010, Festo Didactic
Page 18
Lesson 5: Programmable Logic Controller OTHRW
RESET PSE
O2.6
The PSE instruction causes the program to be executed continuously by returning to the beginning of the sentence. Note that the OTHRW (otherwise) command was used to turn the output OFF if I1.0 is OFF. Sample STL Program In this sample, an STL program will be developed for a stamping machine. Assume that the following is the I/O map of the machine: Input/Output Terminal
Description
I0.0
Part in position
I0.1
Clamping cylinder extended
I0.2
Clamping cylinder retracted
I0.3
Stamping cylinder extended
I0.4
Stamping cylinder retracted
I0.5
Ejecting cylinder extended
I0.6
Ejecting cylinder retracted
O1.0
Extend clamping cylinder
O1.1
Extend stamping cylinder
O1.2
Extend ejecting cylinder
In this example it is also assumed that STEP 1 of the operation (Receive part) is accomplished by receiving a part from a part feeder and is not an action by the stamping machine controller. Following is an STL program corresponding to the sequential function chart of the stamping machine.
©2010, Festo Didactic
Page 19
Lesson 5: Programmable Logic Controller STEP 1 IF THEN
NOP RESET RESET REST
O1.0 O1.1 O1.2
SET
I0.0 O1.0
AND
I0.1 I0.0
SET
O1.1
RESET RESET
I0.3 O1.1 O1.0
AND SET JMP TO
I0.4 I0.2 O1.2 1
STEP 2 IF THEN STEP 3 IF THEN STEP 4 IF THEN STEP 5 IF THEN
In the above program STEP 1 used the “NOP” (No Operation) instruction. When used in the conditional part of a sentence, the NOP instruction constructs a sentence that is always true. In other words, the executive part of the sentence is performed in any case. STEP 1: Initializes the stamping machine by retracting the ejection and by clamping and stamping cylinders. In this state the machine waits until a part is received from a part feeder. STEP 2: Checks to see if a part is present. If so, the clamping cylinder is extended to clamp the part. STEP 3: If a part is present and clamped, then the stamping cylinder is extended to stamp the part. STEP 4: If the stamping cylinder is at its extended state, it is assumed that a part has just been stamped. The stamping cylinder is retracted, and the part is unclamped. ©2010, Festo Didactic
Page 20
Lesson 5: Programmable Logic Controller STEP 5: If both the stamping and the clamping cylinders are retracted, then the ejection cylinder is extended to eject the part. To continue the operational cycle, program execution jumps to (JMP TO) STEP 1. Note that in each step the transition condition preceding the step in the sequential function chart can become the conditional part of the sentence in that step. For example, the transitional condition: “Part present, stamping, clamping, and ejection cylinders retracted” preceding STEP 2 in the sequential function chart becomes the conditional part of the IF … THEN … sentence in STEP 2 of the STL program (“stamping, clamping, and ejection cylinders retracted” condition is implied from STEP 1). Step Execution Rules It is important to note that the program execution will wait at a step until the conditions are true at which time the actions will be performed. Only then will the program proceed to the next step. The following flowchart shows basic step execution rules: First or previous sentence in STEP X
Conditional part true ?
No
Yes Action
Is this the LAST sentence of STEP X ?
No
No
Yes
Go to NEXT STEP
©2010, Festo Didactic
Is this the LAST sentence of STEP X ?
Yes Next sentence of STEP X
Return to TOP of STEP X
Page 21
Lesson 5: Programmable Logic Controller Basics of I/O Communication In general, there are different possibilities to communicate within automated systems. Please refer to the graphics to see the different levels and Field bus systems.
AS-I Profibus-DP Digital I/O Ethernet
= = = =
Actuator Sensor Interface Process Field Bus Distributed Periphery Binary in- and outputs TCP/IP protocol Industrial Ethernet
The standard communication within our systems is the I/O communication. Please refer to the next pages to get some more information.
©2010, Festo Didactic
Page 22
Lesson 5: Programmable Logic Controller 1. Example shows the 1-bit bidirectional I/O communication between two 24 VDC, PNP controllers:
2. Example shows the 1-bit bidirectional I/O communication between a 24 VDC, PNP and a 12 VDC, PNP controller:
©2010, Festo Didactic
Page 23
Lesson 5: Programmable Logic Controller 3. Example shows the 1-bit bidirectional I/O communication between a 24 VDC, PNP and a 12 VDC, NPN controller:
©2010, Festo Didactic
Page 24
Programmable Logic Controller Lesson Summary • A Programmable Logic Controller (PLC) is a specialized computer to perform logic functions for machine control. • Until the 1970s logic functions for machine control were implemented using relays. A wiring diagram that resembled a ladder was used by electricians to build machine control panels with relays. • Maintenance of relay-based control panels was very difficult. Also, if a change was required due to changes in the product, the production down time was too long to rewire the panels. • In a PLC, the control logic (ladder diagram) is implemented in software, making it very easy to modify. • A PLC contains a CPU, I/O modules, power supply, backplane, and a programming device. • PLCs are constructed in two ways: (1) fixed I/O and (2) modular. • In a PLC scan cycle, the controller reads all inputs, runs the ladder diagram once, and energizes or de-energizes the output devices. • PLC I/O and most field devices can be classified into sinking and sourcing types. • Sourcing field devices must be connected to sinking PLC I/O. Similarly, sinking field devices must be connected to sourcing PLC I/O. • The FEC34 PLC in the Distribution Station has 12 inputs and 8 outputs, consisting of 2 relays and 6 transistors. The inputs are the sinking type, and the transistor outputs are the sourcing type. • Sequence control systems are processes executed in several, clearly separate steps. • A sequential function chart contains steps, transitions, and actions. • STL is a PLC programming language which allows the programmer to solve control tasks using simple English-like statements. • STL programs consist of steps and sentences. • In an STL program, execution will wait at a step until the conditions are true at which time the actions will be performed. Only then will the program proceed to the next step. • Festo PLCs are programmed using FST programming software. FST provides an integrated environment with editing, communication, debugging, and online features. • An FST project contains all necessary components of a PLC program and documentation. • A program is a list of STL statements for the controller to perform a control task. FST has various online and debugging features, such as online I/O display, online mode of the STL editor, and compilation for syntax checking. ©2010, Festo Didactic
Page 25
Programmable Logic Controller
©2010, Festo Didactic
Page 26
Student Name: ________________________________
Date: ___________________
Lesson 5 Review 1.
A PLC is:
2.
A ladder diagram shows:
3.
A PLC consists of the following main parts: a) b) c) d) e) f)
4.
A PLC scan consists of the following steps: a) b) c)
5.
PLCs are constructed in two ways:
6.
The difference between them is:
©2010, Festo Didactic
Page 27
Student Name: ________________________________ 7.
Date: ___________________
A normally open switch is to be connected to a PLC as an input device. Complete the wiring diagram for the following PLCs: Generic PLC
1 2 3
FEC32 PLC
E1.3 E1.2 E1.1 E1.0
Four Sinking Inputs
E0.7 Eight Sinking Inputs
GRD
Sinking Input module
E0.1 E0.0 24V GRD
24VDC Sensor Supply
FEC34 Input module
8.
Explain the difference in the wiring:
©2010, Festo Didactic
Page 28
Student Name: ________________________________ 9.
A pilot light is to be connected to a PLC as an output device. Complete the wiring diagram for the FEC34 PLC, if the light is connected to: Transistor-based output
Relay-based Outputs
Relay-based output
C-
C-
C+
C+
A0.7
A0.7
Transistor-based Outputs
10.
Date: ___________________
Transistor-based Outputs
A0.3 A0.2 A0.1 A0.0
Relay-based Outputs
A0.3 A0.2 A0.1 A0.0
C0
C0
FEC34 output module
FEC34 output module
Explain the difference in the wiring:
©2010, Festo Didactic
Page 29
Student Name: ________________________________ 11.
Date: ___________________
Complete the ladder diagram below to implement the following control logic: RUNG 1:
IF S1 is pressed OR S2 AND S3 are pressed THEN activate CR1
ELSE RUNG 2:
IF both S2 AND S3 are pressed THEN activate CR2 AND CR3
Where S1, S2 and S3 are normally open switches, CR1, CR2 and CR3 are relay coils. Neutral Power Rail Rail RUNG 1
RUNG 2
©2010, Festo Didactic
Page 30
Appendix Glossary Algorithm: A list of well-defined instructions for completing a task. Starting from an initial state, the instructions describe a computation that proceeds through a welldefined series of successive states, eventually terminating in a final ending state. Allen-Bradley controller: This is one example of a PLC (Programmable Logic Controller). The three most common Allen-Bradley Controllers are: MicroLogix (ML1200, ML1500), Control Logix, and SLC (SLC500). Other manufacturers of PLCs are Festo, Siemens, Mitsubishi, Omron, and more. Backplane: A circuit board that connects several connectors in parallel to each other, so that each pin of each connector is linked to the same relative pin of all the other connectors, forming a bus. It is used as a backbone to connect several printed circuit boards together to make up a complete system. Banana connector: A banana connector (commonly banana plug for the male, banana jack for the female) is a single-wire (one conductor) electrical connector used for joining wires to equipment. The plugs are frequently used to terminate patch cords for electronic test equipment. Central processing unit (CPU): An electronic circuit that can execute computer programs which are actually sets of instructions. The CPU is essentially the “brains” of a system. Coil element: An electromagnetic coil (or simply a "coil") is formed when a conductor (usually a solid copper wire referred to as the coil element) is wound around a core or form to create an inductor or electromagnet. One loop of wire is usually referred to as a turn, and a coil consists of one or more turns. For use in an electronic circuit, electrical connection terminals called taps are often connected to a coil. Coils are often coated with varnish and/or wrapped with insulating tape to provide additional insulation and secure them in place. A completed coil assembly with taps, etc., is often called a winding. Control console: The control unit of a mechanical, electrical, or electronic system. Control logic: This is the part of a software architecture that controls what the program will do. This part of the program is also called the controller. Before the ©2010, Festo Didactic
Page 31
instruction reaches the control logic, it is translated into binary through an instruction decoder or "decode unit." Digital I/O: The jack where an input/output device is physically connected to a PLC. The input relays transfer signals to the internal relays. The output relays signals to external output devices. Ethernet: A family of frame-based computer networking technologies for local area networks (LANs). It is standardized as IEEE 802.3. The combination of the twisted pair versions of Ethernet for connecting end systems to the network, along with the fiber optic versions for site backbones, is the most widespread wired LAN technology. Festo controller: Festo Programmable Logic Controller. Field bus: A family of industrial computer network protocols used for real-time distributed control, now standardized as IEC 61158. A complex automated industrial system — such as a manufacturing assembly line — usually needs an organized hierarchy of controller systems to function. In this hierarchy there is usually a Human Machine Interface (HMI) at the top, where an operator can monitor or operate the system. This is typically linked to a middle layer of programmable logic controllers (PLC) via a non time critical communications system (e.g. Ethernet). At the bottom of the control chain is the fieldbus which links the PLCs to the components which actually do the work, such as sensors, actuators, electric motors, console lights, switches, valves, and contactors. Fixed I/O PLC: A PLC (Programmable Logic Controller) that has the processor and a fixed amount of Inputs and Outputs all combined in one unit. An example would be a Festo FEC or an Allen-Bradley ML1500. FST programming software: Festo PLC Software. Function block diagram: A diagram that describes a function between input variables and output variables. A function is described as a set of elementary blocks. Input and output variables are connected to blocks by connection lines. An output of a block may also be connected to an input of another block. Function block diagram is one of five languages for logic or control configuration supported by standard IEC 61131-3 for a control system such as a Programmable Logic Controller (PLC). GXIEC programming software: Mitsubishi PLC Programming Software. IEC 61131-3: The third part of the open international standard IEC 1131. Part 3 of IEC 1131 deals with programming languages and defines two graphical and two textual PLC programming language standards: • Ladder diagram (LD), graphical ©2010, Festo Didactic
Page 32
• • • •
Function block diagram (FBD), graphical Structured text (ST), textual Instruction list (IL), textual Sequential function chart (SFC) has elements to organize programs for sequential and parallel control processing.
Input module: The part of the PLC that allows input signals to be connected to the PLC’s processor. Ladder diagram: A graphical diagram based on the circuit diagrams of a relay-based logic. Ladder logic: A programming language that represents a program by a graphical diagram based on the circuit diagrams of relay-based logic hardware. It is primarily used to develop software for Programmable Logic Controllers (PLCs) used in industrial control applications. The name is based on the observation that programs in this language resemble ladders, with two vertical rails and a series of horizontal rungs between them. Logic diagram: A graphical representation of a program using formal logic. Mitsubishi/MELSEC controller: Mitsubishi manufactured processor driven device that uses logic-based software to provide electrical control to machines. Modular PLC: A PLC configuration in which each component is split into a separate NOP: No Operation (computer processor instruction) NPN controller. NPN controller: With NPN logic, switching is from – via the load to +. The reason for this is partly historical but also safety related. With NPN logic, there is a large number of terminals connected directly to the + conductor. If there is a short circuit from one of these terminals to a housing or –, no output will then work. If the same thing happens with PNP logic, the output transistor concerned will be destroyed; but all the other inputs and outputs will continue to work. Operand: An operand is a quantity on which an operation is performed. Operating: To act effectively; produce an effect; exert force or influence. Output module: A device that performs a mechanical action after receiving the electrical signal to do so from the PLC output modules. Pascal: An imperative and procedural programming language designed in 1968/9 and published in 1970 by Niklaus Wirth as a small and efficient language intended to ©2010, Festo Didactic
Page 33
encourage good programming practices using structured programming and data structuring. PLC board: Festo PLC board with DIN rail, terminal block sheet metal for mounting the PLC and cables. PLC program: Any component of a PLC software ladder program. Programming components do not physically exist but are representations used by the PLC software. PLC relay: Hard-wired physical devices that transfer electrical signals from input devices to output devices. PLCs use software to digitally simulate these connections. PNP controller: DC input modules allow us to connect either PNP (sourcing) or NPN (sinking) transistor type devices to them. In a regular switch (i.e., toggle or pushbutton, etc.) it typically does not matter whether it is wired as NPN or PNP. We should note that most PLCs are using a sensor is used (photo-eye, prox, etc.), the output configuration is important. The difference between the two types is whether the load (the plc) is switched to ground or positive voltage. An NPN type sensor has the load switched to ground whereas a PNP device has the load switched to positive voltage. Profibus-DP: This is the Siemens Brand name for their industrial network. Profibus (Process Field Bus) is a standard for field bus communication in automation technology and was first promoted in1989 by BMBF (German department of education and research). Profile plate: The anodized aluminum profile plate is used for mounting all components of the MPS® stations. Both sides are slotted so, if necessary, parts can be mounted on both sides. The slots are compatible with the ITEM profile system. The board is supplied with caps for the sides. The profile plate 350/700 has a hole with a diameter of approximately 5 cm for the I/O cable that connects the PLC board to the station. Programmable logic controller (PLC): A processor driven device that uses logicbased software to provide electrical control to machines. RS232 cable: PC Serial Port Communications standard for serial binary data signals connecting between a DTE (Data Terminal Equipment) and a DCE (Data Circuitterminating Equipment). Relay coil: A relay is an electrically operated switch. Electric current through the coil of the relay creates a magnetic field which attracts a lever and changes the switch contacts. The coil current can be on or off so relays have two switch positions and they are double-throw (changeover) switches.
©2010, Festo Didactic
Page 34
Reset sequence: This is the process that is followed to reset the memory on a PLC. RS Logix programming software: Allen Bradley Proprietary PLC programming software. RS422 programming cable: Allen Bradley PC Communications cable. Scan: One complete cycle of a PLC checking inputs, executing its programs, and updating the status of its outputs. Scan cycle: The time it takes to determine the status of input devices (update input image table), interpret the logic (solve ladder logic), and update output devices. Scan time: The time it takes for a controller to scan all the logic before updating its input (and output) image table. Sequential function chart: Sequential function chart (SFC) is a graphical programming language used for PLCs. It is one of the five languages defined by IEC 1131-3 standard. Main components of SFC are steps with associated actions, transitions with associated logic conditions, and directed links between steps and transitions. Siemens controller: A Siemens manufactured processor driven device that uses logicbased software to provide electrical control to machines. Sinking I/O circuits: A sinking digital I/O circuit provides a ground. Sourcing I/O circuits: A sourcing digital I/O circuit provides a voltage source. Statement List Language (STL): STL corresponds to the Instruction List language defined in the IEC 61131-3 specification. It is utilized in Siemens PLCs. STEP 7 programming software: Siemens PLC programming software. Step instruction: A step instruction is a method of executing a computer program one step at a time to determine how it is functioning. This might be to determine if the correct program flow is being followed in the program during the execution or to see if variables are set to their correct values after a single step has completed. Structured text (ST): Structured text is one of the 5 languages supported by the IEC 61131-3 standard. It is designed for programmable logic controllers (PLCs). It is a high level language that is block structured and syntactically resembles Pascal.
©2010, Festo Didactic
Page 35
SysLink connector: Festo’s brand name for IEEE-488 Connectors. IEEE-488 is a short-range, digital communications bus specification that has been in use for over 30 years. Originally created for use with automated test equipment, the standard is still in wide use for that purpose. Terminal block: The terminal block connects the PLC cable to individual functions on the station.
©2010, Festo Didactic
Page 36
INDEX Index C
P
Commissioning ..................................................3
Power supply ................................................... 25 Program execution ......................................... 14 Programmable Logic Controller ...... 11–14, 25
F Fixed I/O ...........................................................13 Fixed I/O ...........................................................13 Function block diagram ...................................9 I IEC 1131-3 ..........................................................9 L Ladder diagram .......................... 9, 11, 12, 18, 25 N NOP instruction ...............................................20
©2010, Festo Didactic
S Safety ................................................................... 2 Scan cycle ......................................................... 14 Sentence ........................................................... 18 Sequence control systems ................ 15–17, 25 Sinking I/O....................................................... 15 Sourcing I/O .................................................... 15 Statement list .................................................. 10 Statement List Language ............................. 17 Step execution rules ............................................. 21 STEP instruction.............................................. 18 STL.................................................................. 19, 25 Structured text ................................................ 10
Page 37