Sie sind auf Seite 1von 94

Mechatronics

Programmable Control Systems Higher


5789

September 1999

HIGHER STILL

Mechatronics
Programmable Control Systems
Higher

Support Materials

ACKNOWLEDGEMENT The Higher Still Development Programme gratefully acknowledges Bytronic International Ltd for permission to reproduce the LADSIM screenshots. Every attempt has been made to trace copyright owners. The Higher Still Development Programme apologises for any omission which, if notified, it will be pleased to rectify at the earliest opportunity.

This publication may be reproduced in whole or in part for educational purposes provided that no profit is derived from the reproduction and that, if reproduced in part, the source is acknowledged.

Course: Unit:

Mechatronics Higher Programmable control Systems

Teacher/Lecturer guide to Support Materials

DET Mechatronics (H) Programmable Control Systems: Lecturers Notes

DET Mechatronics (H) Programmable Control Systems: Lecturers Notes

INTRODUCTION

This document has been written to provide exemplar support materials for the teaching and learning of Programmable Control Systems which is a component unit of the Mechatronics course at Higher. The Mechatronics course comprises 4 units of study as detailed: Introduction to Mechatronics Systems (40 hours) Programmable Control Systems (20 hours) Robotics and Automated Systems (40 hours) Mechatronics Case Study (20 hours)

This document must be read in conjunction with: The appropriate unit specification Appendix A

DET Mechatronics (H) Programmable Control Systems: Lecturers Notes

LEARNING APPROACH Aims The overall aims of this unit are: To allow the student to develop an understanding of control systems involved in mechatronic systems. To enable the student to develop and evaluate software to control the behaviour of a mechatronic system.

These aims are fulfilled by the stated Outcomes within the Unit Specification Wherever appropriate the associated Outcome and PC coverage will be stated within the materials presented. Target Group While entry is at the discretion of the centre, students would normally be expected to have attained one of the following: Standard Grades in Mathematics and either Technological Studies or Physics at grade 2 or above or equivalent NC modules an Intermediate 2 course in Technological Studies or Electronic and Electrical Fundamentals an Intermediate 2 Scottish Group Award in an appropriate area.

DET Mechatronics (H) Programmable Control Systems: Lecturers Notes

Teaching and Learning Approaches Suggested methods have been listed within the Subject Guides. A characteristic lesson plan would be as outlined in the following diagram.

Teacher/ Lecturer Involvement

Very High

Very Low

Brief lecture covering theoretical aspects

Tutorials/Practical Worksheets towards equipment familiarisation

Example or Demonstration (If applicable)

Programming and Problem Solving practice

A S S E S S M E N T

Use of Material The Environment. The teaching and learning for this Mechatronics unit needs to be within a workshop environment; ideally such as described in the Subject Guides for Mechatronics (H) and (AH). (Refer to Appendix B in the Subject Guide.) The level to which each individual establishments present situation agrees with the described environment will vary widely. It is recommended that all establishments delivering the Mechatronics courses aspire to such an environment in order to make the learning experience for all concerned non-abstract and real.

DET Mechatronics (H) Programmable Control Systems: Lecturers Notes

Theoretical Aspects Every effort has been made to make the theoretical aspects as generic as possible in order to be of maximum use to each establishment, given the varying resources across centres. The teaching pack has only been developed to the Ladder diagram stage using an exemplar restricted subset of functions typically found in any commercial PLC referred to as PLCSIM as adopted for use in the external assessment. (See Table 1.1 in the students notes) Programming and Practical Aspects This will be very dependent on the centre facilities. When programming and practical work is involved the worksheets will only refer to LADSIM (see under Other Required Resources) for simulation. A cross-reference between PLCSIM and LADSIM is provided in Appendix B. It would be helpful for individual centres to extend this further into centre specific equipment that is intended for use. If alternative equivalent equipment is used these will need to be developed into the activities by the centre. The candidate would need to be appropriately supervised and trained in the safe operation of the alternative equipment. Content This support material comprises: Students notes: Section 1 Student notes Tutorials covering theoretical aspects of notes Activity worksheets related to the chosen equipment on site to be used as the learning vehicle. Students notes: Section 2 Student notes covering theory and a suggested problem solving strategy Tutorials covering theoretical aspects of notes Activity worksheets related to the chosen equipment on site to be used as the learning vehicle. Worksheets would need to focus on the solution of simple, well defined problems which allow practice in the solving of problems Exemplar Problems with solutions

DET Mechatronics (H) Programmable Control Systems: Lecturers Notes

Other Required Resources In order to gain full advantage of the teaching packs other specialised resources will be required. These are: A PLC simulation program for practising/learning programming A PLC and hand held controller for realistic activities The packs are written for the use of: A PLC simulator program LADSIM (A Demonstration program from Bytronic *) Throughout the materials will be annotated at appropriate points to refer to the particular Outcome and PC which is being covered. Assessment Links Assessment level questions and activities will be clearly identified and have a close tie-in with the Assessment materials as available from the Higher Still National Assessment Bank. Further details may be obtained from: Bytronic International Ltd The Courtyard Reddicap Trading Estate Sutton Coldfield West Midlands B75 7BU Tel: +44 (0121) 378 0613 Fax: +44(0121) 311 1774 Email: mail@bytronic.co.uk *A Demonstration program for programming PLCs in which all saving and printing of programs has been disabled.

DET Mechatronics (H) Programmable Control Systems: Lecturers Notes

APPENDIX A Mechatronics

Recommended Resources. (For complete Course) This unit should be taught, wherever possible, in a practical or laboratory context. There should be a variety of technologies available such as: Electro-pneumatic Electro-hydraulic Advanced manufacturing system CNC machines Robots Computer/Microcontroller controlled systems PLC controlled systems Computers with simulation packages for Pneumatic, Hydraulic and PLC systems. Ready built operational mechatronic systems such as program controlled conveyor systems, electro-pneumatic sorters, pick and place robots. Sensor Subsystems capable of sensing Light, Temperature, Movement and others which can be readily connected to above systems. Actuator Subsystems capable of causing Light, Temperature, Movement and others which can be readily connected to above systems. A fully supportive comprehensive data library. Full Internet access

DET Mechatronics (H) Programmable Control Systems: Lecturers Notes

APPENDIX B The Tables (a) and (b) below give a cross-reference for PLCSIM to LADSIM. Note the slight differences in the operation of the Timer function. Functions PLCSIM LADSIM Function Name Normally Open Contact Normally Closed Contact
OUT

Output

TMR K=

TIMER Preset

TIMER (See Notes 1and 2) END

END

RES

Reset for LADSIM Timer function

(a) Notes: 1) The Timer function of PLCSIM will reset on the loss of continuity in the rung. 2) The Timer function of LADSIM will require the use of a Reset function with the appropriate T address to reset.

DET Mechatronics (H) Programmable Control Systems: Lecturers Notes

Operands PLCSIM X Y M T K (X 0.1) LADSIM I O F T PRESET (x 1) TYPE I/P Terminal Contact O/P Terminal Contact Marker/Auxiliary Contact TIMER CONSTANT

DET Mechatronics (H) Programmable Control Systems: Lecturers Notes

10

(b) Simulation of a PLCSIM timer using LADSIM In order to effectively simulate the timer operation as described in the support notes using LADSIM, do the following: note the logic function in the I/P zone of the rung feeding the LADSIM timer. use the inverse of this logic function in another rung to feed the required LADSIM reset function for the timer.

In this way whenever the continuity of the timer rung is lost the timer will immediately be reset to start again as required.

DET Mechatronics (H) Programmable Control Systems: Lecturers Notes

11

Mechatronics Higher Programmable Control Systems Students Notes: Section 1

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

INTRODUCTION TO PROGRAMMABLE CONTROL SYSTEMS What is a System? A System can be thought of as a co-ordinated arrangement of parts which work together to achieve a specific purpose or output. A Mechatronics System can be thought of as the above, where the parts are mechanical, electrical and computers operating from software. All systems have inputs and outputs. The inputs are taken into the system, processed according to what the system does, then passed on to produce the desired output or outputs. Further detail on systems may be obtained by referring to the course unit Introduction to Mechatronics Systems Control of a System Sometimes, due to external factors, the system output may not be exactly as desired. In this case the system operation needs an element of control in order to modify its behaviour to achieve the desired output. Control can be achieved by various methods such as: Human Interaction Automation Program control

Consider the example of a simple system as illustrated in Figure 1.1 where it is required to have the room at a comfortable temperature by using a 2 bar electric fire.

Figure 1.1

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

The system is the room and the electric fire The input is the fire control for switching the bars on and off The output is the temperature of the room. Consider when we have a fair day that the room is comfortably warm operating with the fire on one bar. Consider, now that the weather changes to be cold. The room temperature would then begin to cool down below the comfortable temperature. The system output has become unacceptable, so control must be applied to change the system output. Let us examine each of the control methods mentioned: HUMAN INTERACTION: The person in the room would feel uncomfortable and switch on the second bar of the electric fire. AUTOMATION: The temperature of the room would be measured by means of a sensor and the input would automatically be adjusted to compensate for any variation from the desired comfortable temperature. Further detail on Automated systems may be obtained by referring to the course unit Robotic and Automated Systems PROGRAM CONTROL: A program written for a computer would control the temperature of the room. This program would instruct the computer what to do in the various situations in order to achieve the desired output. The actions of the program would merely mimic the actions as stated above. This note will focus on the elements of program control and various ways in which this can be achieved.

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

The Programmable Control System In a Programmable Control System the computer becomes an integrated part of the complete system which controls the complete system by following directed instructions as written into a program by the user. The controlled system and the computer are now sub-systems of the complete programmable control system. This idea is illustrated in Figure 1.2.

Inputs

Controlled System

Outputs

Computer

Programmable Control System

User written Program

Figure 1.2 Various types of computer are used to fulfil the roll of the programmable sub-system as shown in Figure 1.2. This note will investigate 3 types: Personal Computer based (PC) Programmable Logic Controllers (PLCs) Microcontroller based

with a view to their physical attributes, ease of change, ease of use, expansion capability, maintenance and cost.

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

Programmable Sub-System Types. All of these are computers which have four basic operational parts as illustrated in Figure 1.3

Memory Block

Inputs

Input Interface

Central Processor

Output Interface

Outputs

Figure 1.3 This structure is discussed in detail within the course unit Introduction to Mechatronic Systems Personal Computer based (PC) Physical Attributes This type of computer will be the type that most people would immediately relate to as shown in Figure 1.4

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

Figure 1.4

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

This shows a typical desktop computer. This type of computer has basically been designed for maximum human interaction. A keyboard is connected as input for human operation and a monitor has been connected to an output for display. Other types of devices usually associated with this set-up would be a mouse and a printer. When used as part of a programmable control system, additional special purpose Input/Output (I/O) interface cards would be required in order to connect the computer to the system which requires programmable control. It can also be appreciated that this system can be rather large and fragile and would not be suitable in any programmable systems sited in small spaces and harsh environments. Ease of change for different task With the great wealth of programming languages available the programming of the system could be made simple provided the programming language is chosen to suit the application. However, if the language is chosen unwisely then the programming could be rather unfriendly and difficult to achieve. Typical I/O processing functions which are Logic such as AND, OR and Sequential such as counting and timing can incur several lines of programming. The hardware would involve special purpose I/O cards. Ease of use This will depend on the User friendly attributes of the programming environment. Expansion capability By way of expansion capabilities this system would allow for great expansion capability in terms of I/O and memory. Maintenance Due to the fragile nature of the construction regular maintenance would be advisable Cost Cost is dependent on the specifications of the complete system. This could be high but with improving technology the cost is on a downward trend

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

Programmable Logic Controllers (PLCs) Physical Attributes These devices could be described as A computer in a box or The Industrial Computer. A typical PLC is shown in Figure 1.5. Supply Input Signal Inputs

24V Out

Signal Output s Figure 1.5

This type of computer has been designed for operation within an unfriendly environment. The PLC has a rugged construction that can tolerate a certain amount of abuse. Connections of inputs and outputs have been simplified by provision of inbuilt interface circuitry and an auxiliary supply. This allows for simplicity in installation. The example shown in Figure 1.5 illustrates what is typically referred as a Brick PLC other larger types are also available which are Rack mounted to provide for better expansion capabilities. Ease of change for different task This is largely down to the programming. Programming is very user friendly usually carried out using ladder diagram programming. This type of programming is graphical in nature and bears a strong similarity to the ladder type electrical wiring diagrams, a familiar sight to electrical technicians. Programming is usually achieved through a detachable hand programmer although remote programming can be carried out by connection to a PC. Typical I/O processing functions such as Logic, Counters and Timers are accommodated by simple to use special purpose commands. Helpful program debug operations are also incorporated.

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

Ease of use The I/O is simple and direct due to in-built interfaces and auxiliary supply. Expansion capability In terms of expansion capabilities the PLC is usually easy to expand by simply purchasing special purpose I/O units which the manufacturer will provide for connection to the existing PLC system. Maintenance Program debug facilities are provided. Maintenance free adopting a replace complete unit strategy. Cost This is variable, as it is dependent on the size of the PLC. These can be very cheap. Microcontroller based Physical Attributes These devices could be described as A computer in a chip. A typical microcontroller may look as shown in Figure 1.6. The popular term for this device is the PIC (Peripheral Interface Controller).

Figure 1.6 These devices are very small and rugged. Sometimes the term Embedded is used to describe a system using this type of computer. The installation is very simple adopting an Install and leave alone approach. It is not unusual to find these devices in household appliances such as Washing machines and video recorders etc. giving these devices the high-tech operation that we tend to take for granted nowadays.

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

10

Manufacturers make these devices with varied capabilities i.e. varied memory capacity, analogue I/O etc. Ease of change for different task The programming of these devices can be very difficult without specialised knowledge and specialised equipment. Due to the program being resident in the memory of the chip on Read Only Memory (ROM), the program is often referred to as firmware i.e. being somewhere between hardware and software. The program, once written using the specialised equipment, must be fully checked for correct operation before being committed to firmware for final use. Ease of use This is simply a case of install and leave alone. The user will have no reason to even be aware of the presence of this device. Expansion capability There is generally no expansion capability to this basic system. Due to the fact that the system is programmed once, installed and left alone, it is often referred to as A Dedicated System. Maintenance The system should be maintenance free. Cost The cost would be low as the specialised chip to have been prepared due to the large demand in the market.

Now do Tutorial 1 questions 1-7. This will test your knowledge for 0.1 PC(a)

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

11

THE SOFTWARE DEVELOPMENT ENVIRONMENT A Software Development Environment is a complete set of hardware and software tools which allows the programmer maximum flexibility when developing a program for use in a target system. This is the type of specialised equipment that would be required to develop the program for the microcontroller based programmable control system as mentioned previously. The programmer needs to be confident that the developed program will operate 100% correctly under all possible input conditions before being committed to the permanence of the microcontroller chip. The Software Development Environment is basically a powerful computer with 3 main functional parts which give the programmer maximum interaction with the system. These are: The Editor The Simulator The Emulator

This is illustrated in Figure 1.7.

Editor

Software Development Environment

Simulator

Emulator

Figure 1.7

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

12

The role which each of these functional parts play will now be described. The Editor This allows the programmer to create and modify fully functional programs. Editors can be of several forms depending on the type of information being edited. Forms may be Binary, Text or Graphical. Facilities are provided for insertion/deletion/moving of information as desired. Facilities are also provided for debugging of programs by insertion of software breaks (Forced stops anywhere in program) in order to allow investigation into system status, and single stepping of program operation. The Simulator This is a piece of software which allows the programmer to simulate the running of the program without the need for the target system. The simulator will usually display on-screen graphics of the operation. These simulators are huge programs, in their own right which take time to operate and cannot give true real time performance. The Emulator This is a piece of hardware which resides within the development system which can be made to emulate (mimic) the characteristics of the target system. Connection is made to the target system via an Emulation Probe which plugs into the target system IC socket thereby substituting for the computer chip and using the actual system inputs and outputs. This allows for the operation of the program in a real time situation. A much more realistic situation.

Now do Tutorial 1 questions 8-12. This will test your knowledge for 0.1 PC(b)

This note will now continue with the study of Programmable Control Systems focussing on the Programmable Logic Controller (PLC) as the programmable subsystem.

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

13

The Programmable Logic Controller A typical PLC was illustrated in Figure 1.5 (page 8). It can be seen that there are basically four connection areas to and from the PLC. These are: Installation of the PLC Let us now look more closely at the role these connections play with regards to the installation of the PLC into a Programmable Control System. The Supply Input This is basically the main supply for the internal operation of the PLC. Depending on the PLC model this supply may be AC mains or a low voltage DC supply 24V Out This is an internally generated supply to aid in the connection of the Inputs. This supply is typically 24V and its use is optional. Signal Inputs The PLC will be connected to sensors and switches to obtain signals which will be processed through the users written program to generate the desired output signals. Each input terminal is normally given an identification address such as X0, X1, etc. This address is used within the users program when an operation is required on that input. Signal Outputs The generated output signals will be routed from these terminals to operate actuators or displays as required of the Programmable Control System. Each output terminal is normally given an identification address such as Y0, Y1, etc which is used within the users program when required. Some of these output terminals may be different common return connections to allow for the driving of outputs requiring different supplies. The Supply Input 24V Out Signal Inputs Signal Outputs

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

14

A Typical Installation A typical small installation is shown in Figure 1.8. This installation is simplistic. For professional safe installation reference would be made to the manufacturers instructions and guidelines.

SW 1
Supply Input

SW 2
Signal Inputs

L N E

S/S X0 X1

COM2

Y4 Y5

24V Out

Signal Outputs

Motor

Bulb

12V Supply

Figure 1.8 Each of the four connection areas have been implemented as described above. Note also:

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

15

The 24V supply is connected to provide a current flow through the external switches SW1 and SW2 connected to X0 and X1 into the PLC circuitry and back from the S/S (Source/Sink) terminal. An external higher current supply of 12V is being used to drive the output devices through Y4 and Y5.

The installation of Figure 1.8 would allow the user written program to control the process inputs as connected by addressing the terminals X0 and X1 and drive the outputs connected by addressing Y4 and Y5. This is illustrated in Figure 1.9.

X0 X1

User Written Program

Y4 Y5

Figure 1.9 Modes of Operation Any PLC has several modes of operation, but the 2 main modes are: Program Run

How these modes are switched in depends on the PLC model. Program This is the mode of operation when the programming unit is connected to the PLC and the program is being entered into the PLC memory. Run This is the mode of operation when the PLC is repeatedly scanning through the user program and responding to the inputs to produce the desired outputs. The time taken for one scan of the user program is referred to as the Scan Time. In this mode of operation the programming unit may usually be disconnected if desired.

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

16

Programming the PLC In the initial conception of PLCs one of the main design criteria was to make the programming of these systems as simple as possible. To satisfy this requirement a unique graphical method was developed called LADDER PROGRAMMING. This method has the advantage of having a strong one to one relationship with the ladder type electrical diagrams with which electrical technicians are already familiar. Other more traditional, less friendly type methods of programming are nevertheless still used at times, notably, that of using mnemonics similar to Assembly Language such as LD , OR, OUT , etc in what is variably called STATEMENT, MNEMONIC, TEXT or LOGIC INSTRUCTION PROGRAMMING No matter what method of programming is used, the inevitable variations between manufacturers occur. These variations usually appear as differences in the graphic symbols and mnemonics; the user must simply cope. Recently there has been a move towards standardising methods of programming. The standard, when introduced, will be known as IEC 1131. The idea is that all manufacturers will then use the same programming format for all PLC equipment. In these notes only ladder programming will be considered. We will now proceed to study the basic layout of a ladder program. The Layout of a Ladder Diagram Program The Ladder Diagram Program (usually shortened to Ladder Program or Ladder Diagram) consists of 3 basic parts as shown in Figure 1.10. These parts are: The Supply Lines The Test or Condition Zone The Output Zone

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

17

Supply Lines

Test or Condition Zone

Output Zone

Figure 1.10 Let us consider each part of Figure 1.10 in turn THE SUPPLY LINES Also sometimes called the Bus lines. These are represented by the thick vertical lines and are usually 24v with the 24v line being on the left and 0v on the right. The scanning process of the PLC occurs from top left to bottom right. ( Just as you read the lines of text on a page). THE TEST OR CONDITION ZONE This is the bigger left-hand area between the supply lines. In this area the programmer would insert various optional symbols (see Table 1.1 under the heading PLC Functions) which represent tests or conditions which must be met (give a logical true ) in order for power to pass to the corresponding output. THE OUTPUT ZONE This is the smaller right hand area between the supply lines. In this area the programmer would insert various optional symbols which represent outputs and functions which the particular PLC is capable of performing, such as OUT, TIMER, etc (see Table 1.1 on page 18 under the heading PLC Functions) When a complete horizontal path is created between the supply lines this is called a RUNG. So each rung consists of a test or condition section on the left and an output to the right. Power flow is from the left to the right, once the test or condition is met, then that corresponding output will operate.

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

18

Now do Tutorial 2 questions 1-5.

PLC Functions When writing a PLC program various process functions are available which will operate on the inputs to produce the desired outputs. These process functions are each given a symbol in the ladder diagram. The data, which the function operates on, is called the operand or address. Various different types of operand are used dependent on the source of the data. More detail will be provided on this later. An exemplar subset typically found in any commercial PLC is listed in Tables 1.1(a) and (b). We will refer to this set of functions as PLCSIM and will use these in class work for writing PLC programs. Function Type Function Symbol Function Name Normally Open Contact Normally Closed Contact Output
OUT

Function Operand X,Y,M,T

Input

Input

X,Y,M,T

Output Output TIMER Process END


TMR K=

M,Y

TIMER (Requires K=? x0.1s) END

T,K
END

END

Table 1.1(a)

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

19

Note: For meaning of Function Operand see following Table:

OPERAND X

RANGE 0-7

TYPE I/P Terminal Contact

0-7

O/P Terminal Contact

0-49

Marker/Auxiliary Contact

0-49

TIMER

Any Integer Value x 0.1S

CONSTANT

Table 1.1 (b) A typical ladder diagram is illustrated in Figure 1.11 which uses 3 of the PLC functions in two rungs.

X0

Y0
OUT

RUNG 1 RUNG 2

END

Figure 1.11 RUNG 1 comprises: A normally open contact with an operand X0 An output with an operand Y0

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

20

RUNG 2 comprises: The end of program function.

Details of the operation of the various functions will be investigated later, but a basic appreciation of the operation of the program of Figure 1.11 is possible due to the graphical nature of ladder diagrams. Consider RUNG 1: When the operand X0 is not activated the normally open contact function will break the path of the power flow to the output function Y0. When the operand X0 is activated the normally open contact will close and make a path for power flow to the output function Y0. X0 is an I/P terminal contact so any device (such as a switch) connected to this terminal contact of the PLC will be responsible for activating the normally open contact function. Y0 is an O/P terminal contact so any device (such as a motor) connected to this terminal contact of the PLC will be operated in response to the operation of the program. Consider RUNG 2: The END function here indicates the end of the user program and causes the scan of the user program to start again. Let us now consider a programming example very similar to the program in Figure 1.11. EXAMPLE A. The program of Figure 1.11 is to be used for the installation of Figure 1.8. The requirement is for the switch SW2 to control the motor. Note that SW2 is connected (assigned) to X1 of the PLC and the motor is connected (assigned) to Y4 of the PLC. All that is required is to change the program operands (addresses) from X0 to X1 and Y0 to Y4 giving the program of Figure 1.12.

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

21

X1

Y4
OUT

RUNG 1 RUNG 2

END

Figure 1.12

PLC Operands (See also Associated Contacts) It has been illustrated in Example A that the operands on which the various functions operated were X1 and Y4. The condition of the I/P terminal contact X 1 was operated on by the Normally Open contact function to change the condition of the O/P terminal contact Y4. As shown in Table 1.1(b), any operand called X refers to an I/P terminal contact of the PLC. So, any external input device, such as a switch, connected to this terminal of the PLC will change the condition of the operand by activating the contact. This provides I/P from the outside world. Likewise any operand called Y refers to an O/P terminal contact of the PLC. So, any external output device, such as a motor, connected to this terminal of the PLC will be controlled by the PLC ladder diagram. This provides O/P to the outside world. Other types of operand as illustrated in Table 1.1(b) are M, T and K. An M operand referred to as a Marker/Auxiliary contact is basically the condition of a memory location within the PLC which would be activated by an appropriate marker/auxiliary O/P. This is merely a software function which does not have any connection with I/O devices. A T operand referred to as a Timer operand is a memory location within the PLC which is activated by the operation of the Timer function. The K operand is simply a constant integer number which is included to define the time duration of the Timer function as illustrated. E.g. a time of 10 s would require K=100

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

22

Now do Tutorial 2 questions 6-10.

Now do Activity 1 which will: Introduce the use of a PLC Simulation Program Demonstrate some ladder diagrams in operation
Basic Rules for Ladder Programs Although ladder programming is intended to be simple, like any other high level programming language some basic rules apply. Some differences occur with different manufacturers, nevertheless the more common rules are: 1) Every rung must have at least one output. 2) No contacts to be inserted in the rung after the output i.e. no contacts allowed in the output zone. 3) The numerical assignments for the inputs (contacts) and the outputs form an important part of the ladder diagram and must not be omitted. 4) No bridging contacts across the rungs are allowed. 5) Special functions such as Timers, Counters must have all their parameters specified.

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

23

When programming PLCs or PLC simulators, any breach of these rules usually results in one of several responses (You may have already experienced this): An error message Non-acceptance of the I/P (usually with an audible tone) Non operation of what appears to be an error free program

Associated Contacts The idea of associated contacts is not new, but merely a software mimicry of the well-established relay operation where a coil is controlled to activate associated contacts. All contacts within the test or condition zone of the ladder diagram are associated with a function which activates them. The operand letter used denotes the activating function. Reference to Table 1.1(b) lists the operands used in this pack. E.g. Any operand T(0 49) are timer contacts that are acivated by the operation of any of 50 possible timers T0 to T49. Any operand X(0 7) are I/P terminal contacts that are activated by any external I/P event connected to the PLC I/P terminals X 0 to X 7. Any operand Y(0 7) are O/P terminal contacts that are activated simultaneously with any external event programmed to happen at the PLC O/P terminals Y0 to Y7. Any operand M(0 49) are marker/auxiliary contacts that are activated simultaneously with the condition of 50 memory locations M0 to M49 within the PLC. Great flexibility is available in the programming because associated contacts may be repeated as often as desired in a ladder program as illustrated in Figure 1.13. Figure 1.13 shows three T0 associated contacts, two normally open and one normally closed, all activated together to affect the condition of three separate rungs and their O/Ps. The range and variation of operands and functions of any manufacturers PLC is clearly stated in the specification.

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

24

X0

T0 TMR K= 500 Y0
OUT

T0

T0 T0

Y1
OUT

Y2
OUT

END

Figure 1.13 Description of PLC Functions Normally Open and Normally Closed Contacts These names come from switching mechanisms before PLCs were ever thought of. A Normally Open (NO) contact will be open when not activated (operated) and will close when activated. A Normally Closed (NC) contact will be closed when not activated (operated) and will open when activated. If the operating agent (actuator or whatever) of these contacts is common then these functions are the logical inverse of each other. This basic idea is illustrated in Figures 1.14 (a) and (b) which show the ladder diagram and a switch wiring diagram. X0 Y0
OUT

Device 1 SW0

X0

Y1
OUT

END

Device 2 (b)

(a) Figure 1.14


DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

25

With reference to figure 1.14 (a) clearly the output terminals of the PLC Y0 and Y1 would operate as the inverse of each other. In figure 1.14 (b) the switch SW0 would switch the devices 1 and 2 so that their operations would operate inversely. i.e. Output This function merely outputs to the appropriate PLC terminal/Marker and activates the associated contacts simultaneously when continuity is achieved through the I/P zone of the rung. With reference to figure 1.14 (a) the O/P Y0 output terminal would be operated when the normally open contact X0 closed, being activated by the switching device connected to the appropriate I/P terminal of the PLC. Timer This function becomes operational when there is continuity through the I/P zone of the rung and begins a timeout of a set duration of time as adjusted by the K value. The K value determines the number of 0.1 s intervals until timeout. When timeout occurs the timer associated contacts are activated to alter the conditions of the rungs into which they are placed. If the continuity of the timer rung is lost during the timeout interval the timer will immediately reset. After timeout occurs the resetting of the timer will be achieved by the breaking of the rung continuity. With reference to figure 1.13 above, the timer T0 will begin a timeout interval of 50 s when the X0 contact is activated to cause rung continuity. After 50 s the O/Ps Y0 and Y2 will switch on due to the associated normally open contacts activating to close and cause continuity. The Y1 O/P will switch off due to the normally closed contact activating to open and breaking the rung continuity. End This PLC function signifies the end of the users program and causes an immediate rescan of the user program. This helps to achieve higher speed of operation. Not all PLCs provide this function. If this function is not available, or simply not used the complete memory capacity for the user program will be scanned and operation will be slower.
Device 1 =Device 2

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

26

Description of a Ladder Program At this point it would be advantageous to have a detailed look at a ladder program and analyse the operation on a rung by rung basis. The ladder program for analysis is illustrated in Figure 1.15. This program brings all the functions described previously into action. It is assumed that the installation of figure 1.8 is in place.

X0 From figure 1.8: X0 = SW1 X1 = SW2 Y4 = Motor Y5 = Bulb X0

Y5

Y4
OUT

Rung 1

T0

TMR K= 50

Rung 2

X0

T0

Y5
OUT

Rung 3

END

Rung 4

Figure 1.15 Initially, all the contacts are non-activated so all the rungs are open. Rung1: ` Rung 2: Rung 3: When X0 is activated by operating SW1 this rung will operate the O/P Y4 and switch on the Motor through the normally closed contact Y5. When X0 is activated the timer will start a timeout interval of 5 s. X0 will activate and close but the rung will still be open due to the normally open contact T0.

When the timer function times out the associated contact T0 will activate. Rung 3: Rung 1: Rung 4: The normally open contact T0 activates and operates the O/P Y5 and the Bulb will switch on. The operation of the O/P Y5 will simultaneously activate the associated contact Y5 and switch off the O/P Y4. This simply indicates the rescan of the user program.

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

27

The above description assumes that the switch SW1 remains operated throughout and does not use SW2. The overall operation from a system point of view is: Operation of SW1 switches on the motor for a duration of 5 s after which the motor switches off and the bulb switches on.

Now do Tutorial 3

Now do Activity 2

which will: Further test your knowledge of ladder programs. Use the cross reference of Appendix C to convert to LADSIM. Allow you to confirm the operation of ladder diagram of figure 1.15 and alter the operation by simple editing. Prepare you for O.1 PCs (c) and (d)

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

28

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 1

29

Mechatronics Higher Programmable Control Systems Students Notes: Section 2

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

PROBLEM SOLVING FOR PLC IMPLEMENTATION Approach to Problem Solving A basic coping strategy is required to deal with the situation of implementing a required task using a PLC. The approach taken here is the common Divide and Conquer technique. This means to split the given problem into several smaller parts and solve each of the smaller problems, then piece these together to arrive at a complete solution. The process of splitting the problem into these smaller parts is called the analysis stage. Problem Analysis All the problems will initially split into two parts that deal with the What is involved? and When it will happen? of the operations, these are: The Logic of the switching operations The sequencing of the operations

Each of these will be dealt with separately. The Logic of the Switching Operations The basic familiar logic functions will come into play at this stage. The only Logic functions that will be required are: NOT (Inversion) - This has already been met in Outcome 1 AND OR

With regards to Ladder Programming that is required for PLC implementation we must look at how these basic logic functions are achieved in terms of the contacts within the I/P zone of a ladder diagram rung. Definition of the Logic Levels Variation can occur in this matter depending on the manufacturer, as a result much confusion can arise. Before the logic functions can be investigated in any detail it is necessary to define the meaning of the logic levels Logic 0 and Logic 1 for these notes in terms of the I/Ps and the O/Ps. I.e. For the I/P and O/P zones of the ladder diagram.

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

For the I/P Zone: Logic 0 will mean the non-activation of a contact. Logic 1 will mean the activation of a contact. For any normally closed contact logic 0 will mean that the contact in question will be closed and logic 1 (activation) will cause the contact to open. For any normally open contact logic 0 will mean that the contact in question will be open and logic 1 (activation) will cause the contact to close. For the O/P Zone: Logic 0 will mean that there is no continuity between the supply lines and the O/P in question is switched off. Logic 1 will mean that there is continuity between the supply lines and the O/P in question is switched on. The NOT Function (Also refer to Normally Open and Normally Closed Contacts in Outcome 1) Logic functions are fully defined using truth tables that define what the O/P must be for every possible condition of the I/P(s). The truth table for the NOT function for an I/P A and an O/P Z along with the logic expression is illustrated in Figure 2.1.

A Z 0 1 1 0 Figure 2.1

Z =A

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

The first line indicates that the condition of I/P contact A being a logic 0 (nonactivation) must provide continuity to switch on the O/P Z. This may be achieved by the non-activation of the normally closed contact. The second line indicates the activation of the normally closed contact breaking the continuity and switching the O/P Z off. The rung of the ladder diagram would be illustrated as in Figure 2.2.

Z
OUT

Figure 2.2

Note here that the logic expression closed contact. Conclusion:

Z =A

has been satisfied by a single normally

When an inverted function is required to be implemented within any logic expression the normally closed contact will provide the function.

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

The AND Function The truth table for the AND function for two I/Ps A and B and O/P Z along with the logic expression is illustrated in Figure 2.3.

A B Z 0 0 0 0 1 0 1 0 0 1 1 1 Due to the fact that there are 2 I/Ps involved there are 4 possible combinations of the I/Ps. In general the number of combinations = 2n where n is the number of I/Ps. The last line indicates that both the contacts A and B must be activated to provide continuity to switch on the O/P Z. The other lines indicate that non activation of any of the contacts A or B will break the continuity and switch off the O/P Z. Conclusion: This may be achieved by the series connection of two normally open contacts. The rung of the ladder diagram performing the logical AND function of the two I/Ps is shown in Figure 2.4. Figure 2.3

Z = A.B

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

Z
OUT

Figure 2.4 The OR Function The truth table for the OR function for two I/Ps A and B and O/P Z along with the logic expression is illustrated in Figure 2.5.

A B Z 0 0 0 0 1 1 1 0 1 1

Z= A+ B

Figure 2.5

1 1 The last three lines indicate that either of the contacts A and B must be activated to provide continuity to switch on the O/P Z. The first line indicates that only non activation of both of the contacts A and B will break the continuity and switch off the O/P Z.

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

Conclusion: This may be achieved by the parallel connection of two normally open contacts. The rung of the ladder diagram performing the logical OR function of the two I/Ps is shown in Figure 2.6. A Z
OUT

Figure 2.6 Any Combinational Logic Function Any combinational logic function as expressed by a truth table may be written down as a combination of the AND, OR and NOT functions in what is called a Sum of Products expression. Consider the example as illustrated in Figure 2.7.

A B Z 0 0 0 0 1 1 1 0 1 1 1 0 Figure 2.7

Z = A.B + A.B
Row 2 Row 3

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

The implementation of this logic function can be sketched out in terms of a parallel connection (OR) of series connected (AND) contacts. Whenever the inversion is required the normally closed contact would be used as shown in the previous note. The contacts connected in the required manner is illustrated in the rung of Figure 2.8.

Z
OUT

Figure 2.8 This logic function may be recognised as the exclusive OR function. I.e. EXOR.

Now do Tutorial 4.

Now do Activity 3

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

Other Issues related to the Logic Switching Operation Before any truth tables or logic expressions may be obtained as above other issues must be resolved. These are: The number of I/Ps and O/Ps involved The dependency i.e. which I/Ps affect which O/Ps Is latching required?

Each of these issues will be considered in turn The I/Ps and O/Ps Normally referred to as the I/O. It is convenient to split the I/O into Hardware I/O which are devices connected to the terminals of the PLC and Process I/O which are internal software functions of the PLC. With reference to Table 1.1(b) for the PLCSIM subset programming language as listed in Outcome 1, the operands X and Y would be hardware I/O and the operands M and T would be process I/O. Any hardware I/O identified would immediately be assigned appropriate I/O terminals of the PLC. Any process I/O identified would be assigned to the appropriate processes of the PLC. Dependency This is simply a case of listing the O/Ps and all the I/Ps which become involved with that O/P switching. The Latching Action The latching action is the process of an O/P remaining switched on even after the initial activation has been removed (non-activated) with a separate different event causing the switch-off or unlatch. This is achieved by the O/P holding itself on through its own associated contact and a separate normally closed series connected contact breaking the continuity. See Figure 2.9 for details of the contact arrangements.

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

10

X0

X1

Y0
OUT

Y0

Figure 2.9

When X0 is activated the contact X0 will close and make continuity through X0, X1 and switch on Y0. When Y0 is on the associated contact Y0 will activate to close and retain continuity through Y0, X1 and hold Y0 on through its own associated contact regardless of the condition of X0. Only the activation of X1 to break the continuity will switch off (unlatch) Y0. Note: Some PLCs have the latch process as an internal function with separate latch and unlatch actions but these must be used with great care as the condition of these latches are sometimes retained even after power is lost. This can give rise to dangerous situations when power is re-established With regards to the question Is latching required? . For any particular O/P, once the O/P has been switched on by some action simply immediately undo the action and consider if you require the O/P in question to remain on or if it is okay for the O/P to immediately switch off again. If latching is required the logic for the rung may be split into two parts as illustrated in Figure 2.10 which is a development of the basic latch connection of Figure 2.9. It is understood that the Latch on logic is normally open and the Latch off logic is normally closed.

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

11

Latch on Logic

Latch off Logic

Output

Output Associated Contact Figure 2.10

The logic problems may then be treated in the same way as described previously with a truth table for the Latch on logic and the Latch off logic. The Sequencing of the Operations This is the matter of when the operation is to occur in relation to the overall problem. This will be picked up from the worded specification and graphically stated by means of a flowchart. Only four flowchart symbols will be used for these notes as follows: This symbol will be used for termination stating start or stop

This symbol will be used for a process as stated from the problem.

This symbol will be used for a decision which will be a YES/NO answer to a question in terms of the problem with two possible outcomes for progression depending on the answer.

This symbol is a flowline with the arrow indicating the direction of flow through the flowchart from the start.

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

12

The flowcharting graphically illustrates the basic overall sequencing of the required operations. It may be recalled from Outcome 1 that the scanning of a ladder diagram (how the PLC looks at the user program) occurs from top left to bottom right at a very fast rate. It is not always absolutely necessary, but in general, the sequencing of the events required by the problem will be laid out in the ladder diagram with due consideration of this scanning sequence. Earlier events in the problem will appear first in the ladder diagram. When flowcharting the question of an initial condition of the system (starting point) arises. This is sometimes stated in the problem, if not then an initial condition must be assumed and stated. In this initial condition all sensors are assumed to be in the non-activating condition with regards to the PLC. Any change to the sensor condition will then activate the appropriate contacts of the PLC ladder diagram. The statements and questions in the flowchart should be in terms of the problem; with this in mind the flowchart should be the first item on the agenda after reading over the problem. Review of Problem Analysis At this stage we have dealt with all the issues related to problem analysis. A brief summary of these steps in order is: 1) Read over the problem and sketch a simple flowchart of the required sequencing of the operations required. State the initial condition of the system. 2) Use the flowchart to list and categorise all the I/Ps and O/Ps involved into hardware I/O and process I/O. Assignments of the I/O to the PLC can also be made. 3) Consider the dependency i.e. Take each O/P in turn and decide which I/Ps would be involved with the switching of that O/P. Try to decide at this stage if latching is required of the O/P. If latching is required the logic will then split into Latch on logic and Latch off logic as previously explained. 4) Sketch a truth table for each O/P which will define the logic expression. 5) Sketch the rung for each O/P with the contact arrangement that will satisfy the logic expression for that O/P.

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

13

Example Problems We will now work through an example control problem following the recommended steps of problem analysis as stated. Problem A The roller door of a warehouse as shown in Figure 2.11 is to be controlled using a PLC The various sensor devices and actuator are illustrated. Each of the sensors give a logic signal dependent on their condition. Two wires Forward and Reverse control the direction of the reversible motor.

Ultrasonic Detector

Reversible Motor

Infra-red Sensor

Upper Limit Switch

Lower Limit Switch

Figure 2.11

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

14

The basic operation required is as follows: Assume that the door is initially closed. When an approaching moving vehicle is sensed by the ultrasonic detector, the roller door should be raised all the way to the top where it will be stopped by the upper limit switch. Assume motor to require operation in the forward direction. When the vehicle is inside as sensed by the infra-red sensor, the roller door should be lowered all the way to the bottom where it will be stopped by the lower limit switch. NB: Assume only the basic operation as described above with no additional refinements. Solution for A 1) The initial condition of the system is door closed with no vehicle present. See flowchart overleaf. 2) Hardware I/O I/P I/P I/P I/P O/P O/P Where: LLS ULS USD IRS F R PLC Assignments X0 X1 X2 X3 Y0 Y1

LLS is Lower limit switch ULS is Upper limit switch USD is Ultrasonic detector IRS is Infra-red sensor F is Motor forward R is Motor reverse

Note that in this case there is no Process I/O to list.

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

15

Start

Door Closed

Vehicle Present?

No

Yes
Raise Door

No
Upper limit reached?

Yes
Stop Door

Vehicle inside?

No

Yes
Lower Door

No
Lower limit reached?

Yes

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

16

3) O/Ps F R I/Ps involved USD, ULS IRS, LLS Latched? (Y/N) Y Y

Note: If unsure of an I/Ps involvement that I/P should be included. 4) USD 0 0 1 1 ULS 0 1 0 1 FLon 0 0 1 1 FLoff 0 1 0 1

Where: Comments:

FLon is the Forward latch on signal FLoff is the Forward latch off signal

In the initial condition all the inputs will be in a certain condition which will depend on the operation of that sensor. Regardless of this, this condition is the non-activated condition. Any change will then activate the associated contact in the PLC ladder program. The truth table forces the designer to carefully consider every possible I/P combination, even those that appear to be physically impossible (Technically known as cant happen conditions). These conditions can be assigned an O/P value so as to simplify the logic if safe to do so. In this problem the occurrence of the situation of USD, ULS = 1,1 would depend on the range of coverage of the USD.

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

17

IRS 0 0 1 1

LLS 0 1 0 1

RLon 0 0 1 1

RLoff 0 1 0 1

Where:

RLon is the Reverse latch on signal RLoff is the Reverse latch off signal

From the above truth tables: FLon = USD Comments: From the note on latching it must be borne in mind that the latch on logic expressions are the sets of contacts which take the place of the Latch on logic in Figure 2.10. Similarly the latch off logic expressions are the sets of contacts which take the place of the Latch off logic in Figure 2.10. 5) The full ladder diagram for the PLC program may now be sketched up in terms of the PLC assignments made earlier. FLoff = ULS RLon = IRS RLoff = LLS

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

18

X2

X1

Y0
OUT

Y0

X3

X0

Y1
OUT

Y1

END

This proposed ladder diagram may be fully tested using the LADSIM PLC simulator.

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

19

Problem B A control system for separating boxes of acceptable height from an assortment which are loaded onto the left side of the conveyor by a suitable handling system is illustrated in Figure 2.12. This system is to be controlled using a PLC.

S1 S0

Spring return Pneumatic Cylinder

Conveyor S2 Accept Figure 2.12 The initial condition is: No boxes Conveyor running Both collection boxes Accept and Reject empty Cylinder retracted The system operation is as follows: A box is placed on the conveyor that continually runs in the direction shown carrying the box to the sensors S0 and S1which measure the height of the box. This is done on the basis of which combination of sensors are activated. An acceptable box will activate S0 but not activate S1, a reject box will either, not activate any of the sensors S0 and S1, or will activate both sensors. The combination of S0, S1 is retained in electronic memory until a new box arrives. Reject boxes are to be passed to the Reject box at the end of the conveyor and accepted boxes are to be redirected to the Accepted box by the activation of the spring return pneumatic cylinder. The activation of the pneumatic cylinder is done by a timeout of 5 s once an accepted box is detected. If either of the collection boxes signal that they are full through the sensors S2 or S3 then the conveyor will be stopped and an alarm will be sounded to alert the operator. The operator will then proceed to empty the boxes and re-initialise the system. S3 Reject

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

20

NB: Assume only the basic operation as described with no additional refinements Solution for B 1) The initial condition is: No boxes Conveyor running Both collection boxes Accept and Reject empty Cylinder retracted

Start

Initial Condition

Box Arrives

Ye s

Too Small?

No
Pass to Reject box Start and wait for 5 s Timeout Activate cylinder to redirect into Accept box

Too Large?

Ye s No
Reject box full?

No

Ye s
Sound the alarm and stop conveyor

Accept box full?

Ye s

No

Stop

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

21

2) Hardware I/O I/P I/P I/P I/P O/P O/P O/P Where: S0 S1 S2 S3 CON CYL ALA PLC Assignments X0 X1 X2 X3 Y0 Y1 Y2

S0, S1, S2 and S3 are as described in the problem CON is Conveyor CYL is Cylinder ALA is Alarm

Process I/O I/P O/P 3) O/Ps CON CYL ALA T0 T0 T0

PLC Assignments Timer Function (K = 50)

I/Ps involved S2, S3 T0 S2, S3 S0, S1

Latched? (Y/N) N N N N

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

22

4) S2 0 0 1 1 S3 0 1 0 1 CON 1 0 0 0 ALA 0 1 1 1

S0 0 0 1 1

S1 0 1 0 1

T0 0 0 1 0

T0 0 1

CYL 0 1

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

23

From the above truth tables:


CON =S2.S3

ALA = S2 + S3

T0 = S0.S1

CYL = T0

5) X2 X3 Y0
OUT

X2

Y2
OUT

X3

X0

X1

TMR K= 50

T0

T0

Y1
OUT

END

This proposed ladder diagram may be fully tested using the LADSIM PLC simulator.

Now do Tutorial 5 which will prepare you for Outcome 2.

DET Mechatronics (H) Programmable Control Systems: Students Notes Section 2

24

TUTORIAL SHEETS

DET Mechatronics (H) Programmable Control Systems: Students Notes: Tutorial Sheets

DET Mechatronics (H) Programmable Control Systems: Students Notes: Tutorial Sheets

TUTORIAL 1. Assessment Level questions are denoted by a ASS symbol.

1) Describe what the meaning of the term System is as applied to Mechatronics. 2) State 3 methods by which a system may be controlled. 3) Sketch a block diagram of a typical Programmable Control System. 4) State 3 methods of achieving programmable control of a system. ASS ASS ASS 5) Write a short paragraph that compares each of the programmable system types with regards to physical attributes. 6) Write a short paragraph that compares each of the programmable system types with regards to ease of change and use. 7) Write a short paragraph that compares each of the programmable system types with regards to expansion capability, maintenance and cost. 8) Which component parts of the software development environment are software and hardware? 9) Which type of programmable system would be programmed using a software development environment? ASS ASS ASS 10) Write a short paragraph that describes the function of the Editor within the software development environment. 11) Write a short paragraph that describes the function of the Simulator within the software development environment. 12) Write a short paragraph that describes the function of the Emulator within the software development environment.

DET Mechatronics (H) Programmable Control Systems: Students Notes: Tutorial Sheets

TUTORIAL 2. Assessment Level questions are denoted by a ASS symbol.

1) State 4 basic connection areas which would be involved in a PLC installation. 2) State the 2 main modes of a PLC operation. 3) State 2 Programming methods when programming a PLC. 4) Sketch the basic layout of a Ladder Diagram illustrating: The Supply (Bus) lines The Test or Condition Zone The Output Zone

5) Describe what is meant by the following terms in relation to PLCs: (a) The Rung Of a Ladder Diagram (b) The Scan Time of the PLC 6) Using the PLCSIM symbols sketch the following ladder diagrams which have 2 rungs: (a) A normally open contact with the operand X1 controlling an O/P with the operand Y2. (b) A normally closed contact with the operand X4 controlling an O/P with the operand Y3. 7) With reference to the installation of Figure 1.8 in your notes sketch a 2 rung ladder diagram which uses SW1 to control the Bulb. 8) From the list of operands given state which operands would directly connect with an I/P device or an O/P device. Operands: M1, Y3, T5, Y1, X4, M5, X0 9) State the operands as required in (a) to (d). The first one is done for you as an example. (a) A marker contact of address 6 = M6 (b) An O/P terminal of address 2 (c) A timer contact of address 10 (d) An I/P terminal of address 0 10) If the timer function required a time of 1 minute and 15 seconds, what value of K would be required?

DET Mechatronics (H) Programmable Control Systems: Students Notes: Tutorial Sheets

TUTORIAL 3. Assessment Level questions are denoted by a ASS symbol.

1) Describe the meaning of the following associated contacts: (a) X3 (b) Y4 (c) M2 (d) T1

2) State the condition of a normally closed contact when: (a) Activated (b) Non-activated

3) 3) State the condition of a normally open contact when: (a) Activated (b) Non-activated

4) State the logical relationship between a normally open contact and a normally closed contact with the same address. 5) Describe the operation of the ladder program of Figure Q5 on a rung by rung basis. X0 Y0
OUT

Y0

T0 TMR K= 100 Y1
OUT

T0

X0

Y2
OUT

END

Figure Q5 (The operation will be verified in Activity 2)

DET Mechatronics (H) Programmable Control Systems: Students Notes: Tutorial Sheets

TUTORIAL 4. Assessment Level questions are denoted by a ASS symbol.

1) Write down the logic expressions in a Sum of Products manner for the truth tables (a) to (d). (a) A 0 0 1 1 B 0 1 0 1 Z 1 0 0 1 (b) A 0 0 1 1 B 0 1 0 1 Z 1 1 1 0

(b) A 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 C 0 1 0 1 0 1 0 1 Z 0 0 1 0 0 1 1 0

(d) A 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 B 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 C 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Z 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0

2) For each of the truth tables in Q 1 sketch the required connection of contacts into a rung of a ladder diagram. (The operation of these truth tables will be verified in Activity 3)

DET Mechatronics (H) Programmable Control Systems: Students Notes: Tutorial Sheets

TUTORIAL 5. Assessment Level questions are denoted by a ASS symbol.

The proposed solutions should be fully documented as detailed in the support notes. The operation of the proposed solutions may be verified using LADSIM ASS 1) The Figure Q1 illustrates a control system for the weighing of various packages in a warehouse. The system is to be controlled using a PLC.

Package s

LS1

LS2

Belt 1

Belt 2

S1

S2

Weigh er

Figure Q1 The system consists of two separate conveyor belts used for transporting the packages, Belt 1 and Belt 2. Separate motors drive these conveyors. To simplify handling in the warehouse, all packages transported are weighed. This is accomplished using an automatic weigher with memory. The weigher is placed at the beginning of Belt 2. Under normal conditions, Belts 1 and 2 are started when switch S1 is operated. When a package reaches the weigher, a limit switch LS1 then stops both belts. After weighing, which takes 10 s, Belt 2 is started again and runs until the package reaches limit switch LS2. Here the weight is printed on the package, and it is then removed by hand. When the package is removed from LS2, both belts will start again to deliver the next package to the weigher. During peak hours the packages are not weighed and the Belts are controlled entirely by S2. When S2 is operated, both Belts are run until the package reaches LS2. As the packages are taken off, the belts will deliver more packages.

DET Mechatronics (H) Programmable Control Systems: Students Notes: Tutorial Sheets

ASS

2) Figure Q2 illustrates a control system for mixing accurate solutions of chemical. This system is to be controlled using a PLC.

Chemica l Containe r V1 Filtered Water HL S V2 Read y

Manual dispense tap

LLS Mixer Figure Q2 The operation is as follows: Assume an initial condition as illustrated in Figure Q2. Chemical solution to required dilution is available for dispensing through the tap and the Ready indicator is on. If LLS is operated due to low level of solution, the Ready indicator should go off and the valve V1 should open to fill the tank with fresh filtered water up to the level as sensed by HLS. At this point V2 is operated to deposit an accurate measure of the powdered chemical. The Mixer will then switch on for a duration of 15 s, then the Ready indicator will switch on to signal the availability of more solution.

DET Mechatronics (H) Programmable Control Systems: Students Notes: Tutorial Sheets

ACTIVITY WORKSHEETS

DET Mechatronics (H) Programmable Control Systems: Students Notes LADSIM Instruction Booklet

DET Mechatronics (H) Programmable Control Systems: Students Notes LADSIM Instruction Booklet

ACTIVITY WORKSHEET 1. Aim: There are two aims: To give the student some initial hands on experience of using the PLC simulator program. To facilitate this a number of ladder programs are provided to work with. To demonstrate, on a simple appreciation level, the operation of these ladder programs. A Computer with the simulator LADSIM installed. The Simulator LADSIM Instruction Booklet

Equipment Required:

Documentation Required: Procedure:

Note: You will be required to constantly refer to the LADSIM instruction booklet whilst following this procedure 1) Load LADSIM 2) Enter the ladder program (a). 3) Run the ladder program to simulate the operation by activating the software simulated switches by mouse clicks. 4) Answer the questions relating to the operation of the program in the Comments and Conclusions section that follows. 5) Stop the ladder program and start a new ladder program. 6) Repeat 2) to 5) for the remaining programs. 7) Exit LADSIM.

DET Mechatronics (H) Programmable Control Systems: Students Notes LADSIM Instruction Booklet

I0

O0

I0

O1

(a)

(b)

I0

I1

O0

I1 I2

O0

(c)

(d)

I0 O0

I1

O0

I0

T1 TMR

Pr =20

T1

O0

(e) I1 T1
RES

(f)

DET Mechatronics (H) Programmable Control Systems: Students Notes LADSIM Instruction Booklet

I0

T1 TMR

Pr = 30

T1

O0

T1

O1

I1

T1
RES

. Comments and Conclusions.

(g)

These questions are based merely on observational points and only require short answers. This will help in understanding ladder programs on an appreciation level. The detailed operation of the ladder diagram functions will be covered in the notes. REFERRING TO LADDER PROGRAM (a) Q1) When is the output O0 operated? (You may recognise this program as the one briefly described in the note prior to this activity) REFERRING TO LADDER PROGRAM (b) Q2) When is the output O1 operated? REFERRING TO LADDER PROGRAM (c) Q3) What condition of I0 and I1 is required for the output O0 to operate? Q4) What happens to the output O0 if either I0 or I1 is not activated?

DET Mechatronics (H) Programmable Control Systems: Students Notes LADSIM Instruction Booklet

REFERRING TO LADDER PROGRAM (d) Q5) State all the conditions of I1 and I2 for the output O0 to operate. Q6) What happens to the output O0 if both I1 and I2 are not activated? REFERRING TO LADDER PROGRAM (e) Q7) What action is required to operate the output O0? Q8) What action is required to switch off the output O0? REFERRING TO LADDER PROGRAM (f) Q9) How long is the timed delay from the activation of I0 for the output O0 to switch on? (Time this with your watch). Reset the timer function by activating I1. REFERRING TO LADDER PROGRAM (g) Q10) (i) What happens to the outputs after 30 s? (ii) Give a reason for this action. Reset the timer function by activating I1.

DET Mechatronics (H) Programmable Control Systems: Students Notes LADSIM Instruction Booklet

ACTIVITY WORKSHEET 2. Aim: There are three aims: To use the cross reference of Appendix C to convert from PLCSIM to LADSIM To verify the operation of the ladder programs of figure 1.15 (From the notes) and figure Q5 (From Tutorial 3) To prepare the student for O.1 PCs (c) and (d) A Computer with the simulator LADSIM installed. The Simulator LADSIM Instruction Booklet Cross reference Appendix C Procedure: Note: You may require to refer to the LADSIM instruction booklet whilst following this procedure 1) Prepare the ladder program of Figure 1.15 from the notes for LADSIM using the cross reference of Appendix C. Use an additional switch for any timer resets as required. 2) Load LADSIM 3) Enter the prepared ladder program from 1) 4) Run the ladder program to simulate the operation by activating the software simulated switches by mouse clicks and verify the operation. 5) Alter the time from 5 s to 15 s for Figure 1.15 and confirm the changed operation. 6) Stop the ladder program and start a new ladder program. 7) Repeat 1) to 4) for the ladder program of Figure Q5 from Tutorial 3 8) For the ladder program of Figure Q5 change the operation of Y2 to operate inversely to Y1 under the control of the timer contact instead of X0 and confirm the changed operation. 9) Exit LADSIM.

Equipment Required:

Documentation Required:

DET Mechatronics (H) Programmable Control Systems: Students Notes LADSIM Instruction Booklet

ACTIVITY WORKSHEET 3. Aim: To confirm the logic of the truth tables given in Tutorial 4 A Computer with the simulator LADSIM installed. The Simulator LADSIM Instruction Booklet

Equipment Required:

Documentation Required: Procedure:

Note: You may require to refer to the LADSIM instruction booklet whilst following this procedure 1) State the assignments made for I/O for the truth table Q 1 (a) A= B= Z=

2) Sketch the required ladder diagram in terms of LADSIM. 3) Load LADSIM 4) Enter the prepared ladder program from 2) 5) Run the ladder program to simulate the operation and confirm the logic of the Q 1 (a) truth table. 6) Repeat the above procedure for the remaining truth tables. 7) Exit LADSIM.

DET Mechatronics (H) Programmable Control Systems: Students Notes LADSIM Instruction Booklet

Simulator LADSIM Instruction Booklet

DET Mechatronics (H) Programmable Control Systems: Students Notes LADSIM Instruction Booklet

DET Mechatronics (H) Programmable Control Systems: Students Notes LADSIM Instruction Booklet

LADSIM
A PLC SIMULATOR. It is assumed that the user has some basic prior knowledge of Ladder Diagram Program layout. This knowledge can be gained from referring to the notes before using the simulator. Introduction. This program is capable of allowing the user to enter, run and test Ladder Diagram Programs as written for PLCs. The inputs can all be excited in the software by simple click actions of the mouse. Outputs can be observed on simple on-screen indicators. A Graphic display of the ladder diagram program is provided along with on-screen status of contacts, timers, etc. If so desired, a board providing physical I/O can be included in the setup and controlled by the user program. This brief note is intended as a simple set of instructions as to how to operate the program quickly and effectively. Other capabilities are not covered by this brief introduction eg Labelling. This and other capabilities are left to the user for further investigation if time allows. The computer is assumed to be running under Windows 95 although LADSIM will run under Windows 3.1x. The Save and Print facilities in this Demo version have been disabled. The note is sectioned off into the simpler common actions which will be required at various times.

SIMPLY CHOOSE THE ACTION YOU WISH TO PERFORM AND READ ON..................!

ACTIONS COVERED: LOAD LADSIM ENTER a ladder program EDIT an existing ladder program RUN a ladder program STOP a ladder program START a new ladder program EXIT LADSIM

DET Mechatronics (H) Programmable Control Systems: Students Notes LADSIM Instruction Booklet

LOAD LADSIM Simply switch on the computer and wait for Windows 95 to boot up. Choose Start/Programs/Bytronic/LADSIM The PLC simulation program will be loaded with the screen as illustrated in Figure 1

Figure 1 This screen is called the ladder diagram editor screen. This comprises of a tool bar with icons for various operations which read from left to right as: New ladder diagram/Open a ladder diagram/Save a ladder diagram/Print a ladder diagram/I/O comments/ Rung comments. The Save and Print options are grayed out due to being disabled. Three windows are also present to allow for the entering and editing of ladder programs.

DET Mechatronics (H) Programmable Control Systems: Students Notes LADSIM Instruction Booklet

ENTER A LADDER PROGRAM The ladder diagrams are entered by a click and drag technique by choosing the required PLC function from the larger controls window onto the rung 0 in the ladder logic diagram window. On release of the left mouse button the following window of Figure 2 pops up which will allow you to give the function the desired operand (address) by clicking in the appropriate place and clicking OK.

Figure 2. Repeat for each of the function symbols on the rung. If the ladder diagram rung contains any branches the following procedure would apply. Select Add Branch from the smaller Controls window and follow the on-screen prompts given at the bottom of the screen.

DET Mechatronics (H) Programmable Control Systems: Students Notes LADSIM Instruction Booklet

The example of Figure 3 illustrates a rung with 2 normally open contacts connected in series to control an O/P. It is required to insert a normally open contact in parallel with normally open contact I1.

Figure 3. The on-screen prompt is instructing what to do to indicate where the branch is to begin. On following this instruction and the instructions which follow to complete the insertion of the branch by: Clicking between I0 and I1 to indicate beginning of branch Clicking to the right of I1 to indicate the end of the branch

Will result in a response similar to that shown in Figure 4.

DET Mechatronics (H) Programmable Control Systems: Students Notes LADSIM Instruction Booklet

Figure 4. All that remains is to simply to click and drag the normally open function to the branch for insertion in the normal way resulting in the response similar to Figure 5.

Figure 5.

DET Mechatronics (H) Programmable Control Systems: Students Notes LADSIM Instruction Booklet

When a rung is completed and further rungs are to be done simply click on add rung in the smaller Controls window and a new blank rung will appear to work on. EDIT A LADDER PROGRAM Editing facilities are all accessed via the smaller controls window and following the on screen prompts which appear on the bottom of the screen or in a small window. Most of these are self-explanatory but Edit Control and Delete Control refers to any change required of the control functions in any of the rungs. RUN A LADDER PROGRAM
This refers to the simulation of an entered/loaded ladder program and observing the operation.

This is activated by clicking on the Simulate button in the smaller controls window. This immediately results in a response similar to Figure 6 which shows the Debugging Simulator window and the Rung Viewer window of Figure 7.

Figure 6

DET Mechatronics (H) Programmable Control Systems: Students Notes LADSIM Instruction Booklet

Figure 7 The bottom left of the Simulator Window illustrates cassette style buttons to control the running of the simulation. Their operation is highlighted when the mouse pointer is pointing at them. Various I/Ps and O/Ps are also accessible. The I/Ps are initially shown non-activated (all I/Ps of Figure 6 are non-activated) and can be controlled manually by clicking to activate them. The status of Timers, Counters, Outputs, Flags and Registers is also available to view. The operation of the ladder program is also highlighted on the Rung Viewer window of Figure 7. STOP A LADDER PROGRAM This refers to the stopping of the simulation run and reverting back to the ladder diagram editor screen. Simply click on the cassette style button entitled Stop(Small square) START A NEW LADDER PROGRAM Simply click on the New Diagram icon to the left on the tool bar at the top. This will highlight when the mouse pointer is over the icon. The present ladder diagram will be lost. EXIT LADSIM Either click on the top right X or choose EXIT from the drop down menu under FILE

DET Mechatronics (H) Programmable Control Systems: Students Notes LADSIM Instruction Booklet

DET Mechatronics (H) Programmable Control Systems: Students Notes LADSIM Instruction Booklet

10

Das könnte Ihnen auch gefallen