lecture7 industrial programmable logic controllers plcs

61
Industrial Programmable Logic Controllers (PLCs) Eng. R. L. Nkumbwa Copperbelt University School of Technology 2010

Upload: enercon

Post on 21-Nov-2015

20 views

Category:

Documents


5 download

DESCRIPTION

PPT on PLC

TRANSCRIPT

  • Industrial Programmable Logic Controllers (PLCs)Eng. R. L. NkumbwaCopperbelt UniversitySchool of Technology2010

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Programmable Logic Controllers (PLCs)A programmable logic controller (PLC) is a special purpose computer aimed at implementing control solutions. Historically PLCs have been used mainly for on-off or logic type applications. However, modern PLCs have become increasingly sophisticated and can now cover quite complex control tasks.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Programmable Logic ControllersThese notes emphasize the switching capability of a PLC. However, the reader is urged to think of the dynamics of the underlying system. For example, we recently heard of a seemingly straightforward application of a PLC to a reservoir level control problem. The algorithm had many features but in essence conformed to the rule that if the level was too low then the pumping rate should be increased.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Programmable Logic ControllersThis can be seen as an approximate form of integral control. However, pure integral control when applied to a tank (which is also an integrator) will lead to self sustained oscillations. The reader is encouraged to verify this by drawing a root locus plot for the closed loop poles. The moral of this story is that when implementing a controller in a PLC one needs to consider the combined dynamics of the control law and system. In this way a PLC is no different from any other form of control implementation platform.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Industrial Robustness of PLCsIf you have ever had a personal computer lock-up or reset in the middle of something important you will appreciate that a similar failure in a large industrial application would have severe consequences. A PLC is simply an industrial computer designed to be durable enough to withstand the rigors of industrial applications.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Industrial Robustness of PLCsIt is common in the mining industry to have PLCs on large mobile equipment to monitor and control everything from lights to large electrical drives. The vibration and operating temperature of this environment require the use of specialized control equipment such as PLCs.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Some Physical Tolerances of leading PLC brands

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Typical Areas of ApplicationFor past 30 years PLCs have been in the first level of control because of their ability to run uninterrupted for extended periods of time (usually measured in months or even years). The PLC layer in industrial applications is shown in figure below

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Control hierarchy of PLCs

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Ladder LogicThe remained of this chapter will look at Ladder Logic, which is the most common programming structure used in PLCs. Several examples of common Ladder Logic programs will be demonstrated to show the simple structure of this coding style.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Relay Ladder LogicLadder logic is possibly the simplest programming language. The principle behind the language is illustrated by a simple electrical relay. (Electrical relay logic preceded PLCs as initially all logic was implemented in hard wired panels using actual relays, timer, Counters etc.)

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Simple Relay Circuit

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Circuit representation in Ladder LogicThe above circuit is represented in Ladder logic as shown in figure below (only the low voltage circuit is used in ladder logic diagrams):

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Boolean LogicThe above diagram can be expressed in Boolean logic Motor Coil = Switch, ie if the Switch is on the Motor coil is energized and Motor is activated.All ladder logic takes the form of that shown in Figure above. Thus it connects the positive and neutral rail representing positive and negative power supply to the relay.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Ladder Logic InstructionsThe three most common instructions in ladder logic are:

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*PLC SwitchingThe majority of simple PLC switching tasks can be implemented using these simple instructions. However there exists a set of 60 to 100 individual instructions such as those above which form the complete PLC language. Other functions vary from simple timers and counters to more sophisticated control functions such as PID controllers and advanced arithmetic functions.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Multi Input/Output Rungs

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Multi Input/Output RungsEach of the inputs in series such as S2 and S3 are equivalent to the Boolean AND{.} statement while a Bridge in a rung is seen as an OR{+} statement. In the case shown in Figure above the Boolean expression for the Coil is:

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Multi Output RungsIt is also possible to have multi output rungs provided the OTE instructions are never placed is series, they must always be in parallel and in contact with the Neutral (right) rail, as shown in figure below. (While multi output rungs are necessary in some cases, it is often beneficial to divide the rung into several smaller rungs for the purpose of program clarity)

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Multi Output Rungs

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Start-Stop RungAny large rung can always be broken down into simple Boolean expressions such as for the simple rungs shown above.Just as common electrical relays have auxiliary outputs, which are used for feedback and indication, a similar strategy is used in ladder logic. To demonstrate this point a simple START/STOP rung is examined. Two Push Buttons (PB) are used for the start and stop inputs (Push buttons return a High or Low signal to the PLC only for the duration during which the button is held down), Consider the logic shown in Figure below.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Use of Auxiliary Output

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Push Button ExampleIn this case the push buttons are normally open i.e. they return a low signal in their normal position and a high signal when pressed.Initially assume the Coil output is off, and the Push Buttons (PB) not activated so they are also off. When the Start PB is pressed the top path through the rung is satisfied with start = 1and stop = 0 so the coil is turned ON. Note this also satisfies the bottom path through the rung on the next scan since coil = 1 and stop = 0. When the start button is released the top path through the rung becomes false but the rung is still satisfied by the bottom path, ie the coil remains on after the start PB is released.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Push Button ExamplePressing the stop button (stop =1) breaks the rung so the coil is turned OFF and remains off after the stop button is released.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Other PLC Programming languagesWhile Ladder logic is the most common form of PLC language it is worth noting that other languages do exist which where developed in conjunction with Relay Ladder Logic.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Other LanguagesBlocks are built from small ladder logic subroutines and used through the code as user defined ladder logic instructions, the advantages of this approach is the reduction of repetitive ladder logic code.Sequential Function Chart (SFC) programming is similar to programming by computer flow chart. In SFC the program advances step by step through various blocks (where action happens such as a motor is started). Transition conditions determine when the program advances from one block to another. Both the action blocks and the transition conditions are created using ladder diagrams.Structured text, uses simple instructions common to medium level programming languages: If , While, Then etc.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Other LanguagesNote: Some programming packages allow the user to switch between Relay Ladder Logic and Structured text representations of the code.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*PLC ModulesThe modular nature of PLC components makes the design, instillation and maintenance of the first level of control much simpler. Similar to the peripheral devices, which can be obtained for a personal computer, there are literally thousands of interface modules supported by PLCs.While these modules may be numerous they all have the same function, obtaining or delivering control signals and information between the measurement level and the operator interface level. The modular nature is possibly the greatest strength of PLCs and several common modules will be described below.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Digital Inputs/Outputs (I/O)By far the most common industrial signals used in PLCs are simple digital control signals. Referred to as Digital I/O (Digital input/output), they can be measured in there thousands for substantial industrial plants. They are used to measure an amazing verity of events. The most common digital signal encountered is a simple switch, A switch is nothing more than an electrical switch used to indicate some physical position.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Digital Inputs/Outputs (I/O)Digital I/O signals come in many forms from 12 Volt DC to 240 Volt AC, but the most common industrial signals are 24Volt DC and 120V AC. There are Digital I/O modules to measure all of these signals, an extra variation is the number of signals per module ranging from 8, 16 and 32 etc. Most digital modules have electrical protection usually in the form of optocoupling to prevent damage to the PLC from standard electrical faults.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Analogue Inputs/Outputs (I/O)Analogue signals enter and leave the PLC in voltage and current form, The resolution of most analogue signals is between 11 and 16 bits. While voltage is commonly used in practice it can be sensitive to noise (induced voltages in electrical equipment rooms can be substantial) This makes current control the superior choice. The most common analogue signals appear in the form of a 4-20mA current signal, i.e.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Analogue Inputs/Outputs (I/O)A signal of 4.0mA equates to zero,A signal of 20mA equates to 2048 for an 11 bit input,The reason for the 4.0mA starting point is a fail-safe feature, if the instrument fails or the signal cable is damaged the current falls to zero and the PLC can alarm the operating system of the failure immediately. This fail-safe feature is not possible for voltage signals which pass through zero volts.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Other interface modulesDigital I/O and Analogue I/O signals comprise the vast majority of PLC signals.However, not all devices can be controlled by these simple signals and it is often required that PLCs communicate to foreign instruments using many different communications protocols, Again in most instances there is simply a module predesigned to make this interface possible. Some examples include RS232, RS485, DH485, DH+, Modbus, Ethernet etc.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Memory (Addressing , Internal Registers)The memory in PLCs needs to be predefined by the programmer, similar to defining variables in standard programming. The memory is divided into data files, each data file has a unique number and a character prefix which refers to the type of data. For example, in the Allen Bradley PLC-5 system, we have;

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Allen Bradley PLC-5 System

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Allen Bradley PLC-5 SystemThe ASCII character (or characters) denotes the data area type. Other types of defined words include T-timers, C-counters and S-status registers etc.Note that the Output and Input numbers are dropped from file 0 and 1 respectively, this is because these files are not programmable. Status file 2 (S2:##) is also fixed within Allen Bradley PLCs. (Status bits include such information as arithmetic overflow warnings, communication status and processor time and dates etc)

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Allen Bradley PLC-5 SystemThe internal data areas of Integers and Floating point addresses simply point to a linear memory region. However the Input and Output address actually correspond to a physical address. For example I:12/03 has the format, I:{Rack address}{slot number}/{Input number}. Physically this is the 3rd input on the 2nd slot in the 1st Rack. This input is show below in figure,

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Physical I/O Addressing

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Physical I/O AddressingNote: PLCs usually start counting from zero and use the octal counting system. ie an eight slot rack will have slots numbered from 0 to 7. This is the case for racks, slots and input numbers. So the first possible input would be Rack 0, slot 1 input 0 (Slot 0 in Rack 0 is not available for inputs since it is always reserved for the Central Processing Unit, CPU)

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Addressing FormatThe addressing format has been demonstrated here because in writing a PLC program the address is used by the PLC in the ladder logic. For example, if in the Start /Stop logic of figure (6) the Start PB = I:13/04 and Stop PB = I:13/05 and the output Coil = O:12/03 then the ladder logic would look more like figure below

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Start/Stop Addressing Example

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*PLC Programming ArchitectureA PLC program can be divided into many small subroutines. In this respect PLCs replace function and procedures with subroutines. Each subroutine is executed from top to bottom in a predetermined order. Once all the subroutines have been scanned it simply begins again with the first subroutine. The nature of subroutines makes a modular programming structure possible, It is always beneficial to group segments of code which serve similar purposes.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*PLC Programming ArchitectureFor example a program may be divided in the following way:Subroutine U:20 Pumps sequencing logic file.Subroutine U:21 Pump No.1 alarming and drive file.Subroutine U:22 Pump No.2 alarming and drive file.Subroutine U;23 Pump No.3 alarming and drive file.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*PLC Programming ArchitectureHere subroutine 20 controls the sequencing of 21,22 and 23 while the drive files are virtually identical for each pump by starting and stopping the pump while reporting alarms and the healthy status to file 20. Fault finding problems in the code is greatly simplified when all the code for a faulty device is listed in a single subroutine.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*PLC Programming ArchitectureThe development of a plant wide PLC standard is an essential step in automating a large control system. The benefits are twofold, if the programming standard is well understood many code developers can work on the code producing a uniform control system. The second advantage is that for anyone not involved in the code production only needs to learn one standard to have a good understanding of the program structure of all the plants PLCs.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Commercially Available PLCsThe next slides give details of some commercial available PLCs. The purpose of this is to show the variety of PLCs available on the market.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Allen-Bradley PLCsBelow are AB PlcsNote that AB is part of the Rockwell Automation, a global leading Automation giant.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Siemens Simatic PLCsBelow are Siemens Simantic PLCs

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Modicon TSX PLCsSee Modicon TSX PLC below

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Other PLC TerminologyOn-line: Refers to the program code currently in the PLC memory.Off-line: Refers to the copy of the program code stored on the programming computer.Up-Load: Refers to the act of copying the current On-line code from the PLC to the programming computer . (Note the previous code on the programming computer is lost during this transfer if a copy is not made)Down-Load: Refers to the act of copying the code from the programming computer into the PLCs memory. (note the previous PLC code is lost during this transfer).Note: It is important to realize that changing the On-line program will not change the Off-line program on the programming computer. Invariably at the end of any edit there must follow an Up-load or Down-Load to make the Online and Off-line programs the same.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Other PLC TerminologyRun Mode: The PLC actively scanning the code and driving outputs.Program Mode: The PLC is not being scanned (All outputs disabled)Remote Mode: programming computer can change the PLC between Run and Program.Note: There is a physical key on the front of each PLC processor module, which allows the PLC to be switched between Run, Remote and Program Mode.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Programming ProcedurePLCs are very versatile in the respect that programming changes can be made on-line while the processor is in Run Mode. This is equivalent to making changes in a compiled C program while it is being executed. To introduce programming edits into the existing code while in Run Mode the following procedure is followed.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Programming ProcedureInsert edit rungs into the On-line PLC code (as many changes as required). These edits are effectively invisible to the processor during this stage.Once all edit rungs are entered switch the processor to TEST, during TEST mode any new inserted code is allowed to be scanned along with existing code, if any code is marked for deletion this code is prevented from being scanned at this stage.Once you are confident that the edit rungs are correct Assemble the code which permanently activates new code and permanently removes any code marked for deletion.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Programming Example: Simple start/stop ladder logic.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Programming Example: Simple start/stop ladder logic.This is as it would appear in a windows based programming package. Text in the Yellow and Green boxs is the Address Description and Address Symbol respectively. The symbols often correspond to SCADA (System Control and Data Acquisition) software tags.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*Alternative Start/Stop usingLatch and Unlatch instructions.

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*ReferencesGarry Johnston (2010),University of Newcastle, Australia

    Eng. R. L. Nkumbwa @ CBU 2010

  • Eng. R. L. Nkumbwa @ CBU 2010*

    Eng. R. L. Nkumbwa @ CBU 2010