Plc in Industry

Embed Size (px)

Citation preview

  • 8/8/2019 Plc in Industry

    1/10

    S u m m a r vThe concep t of an embedded programmable logic controller (PL C) as parr of a much larger suite ofdedicated control software to provide a flexible I/O interface for industrial m icroprocessor controlsystems is considered. The use of such a system allows modification of the system operation by semi-skilled staff without compromising the integrity of the system software. The embedded PLC can alsobe used to control the overall function of a large system of dedicated so ftware and hardw are.Many indu smal control systems are produced in relatively small numbers and often each system willbe produced to a slightly different specification. The area where the specification is most likely tochange is in the interface to other plant. Change s in the system operation are also likely to occur,particularly near the interface to other plant. This can cause considera ble time and expense in hardwareand software modifications and makes system maintenance and spares provisioning difficult.Where the num bers are very sm all (e.g. 1- 10)the stand-alone programmable logic controller is o-ftenan ideal solution as program development is simple and modifications, to allow for small variations,are easily incorporated. The relay-ladder langua ge used is designed to enable electrical circuitdesigners to be able to w rite programs as they would design a relay control unit. A wide variety ofproprietary interface units are available, off-the-shelf, for PLCs including plant mimic-displays via aterminal or personal com puter (P C). However the cost rapidly increases if such a sophisticated userinterface is required.For large num bers of systems, where the functions of the controller can be precisely de fined , anem bed ded microprocessor based control system is often the most cost effective solution. This isparticularly the case when the user interface requires character or graphic displays and the entry of anumber of numeric settings. A certain degree of flexibility can be built-in by the use of plug-in I/ocards (for hardware) and configuration tables for the software. However if software modifications arefrequently required to cop e with chan ges in specification from system to system the unit cost rapidlyescalates. Maintenance and documentation of the installed systems also becomes a problem as "small"

    changes to the software function can often require significant re-structuring. Skilled programmers arerequired to implement software changes to large (10,OOO to 100,OOO lines of code) embedded systems;a "small" change often requires detailed knowledge of the entire system which may have been writtenby a team of programmers.It is in this area hat an embedded PLC may be used to overcome many of these problems. Withoutdetailed kno wledge o f the system so ftware it is possible to alter the function of a system and the detailsof how it interfaces with other plant. This is achieved by allowing the user to alter the program ru n bya PLC task incorporated within the system software. The task may be implemented with reasonableefficiency as an interpreter which allows the system programm er to control closely what can be doneby the PLC program. The relay ladder programming language used in PLC s is easy to understand andcan be understood by electrical technicians or similar staff because it mimics the operation of a relaycircuit. Also the language executes without branches, loops, or backward jum ps ensuring that aprogram executes from beginning to end in a predictable time period.A brief description of the relay ladder language, hardware configuration, and performance of a stand-alone PLC is now given. An examp le of a system using an embedded PL C is then discussed. Thib i bused to indicate how the embedded PLC interfaces with the remainder of the system software. Theway in which the system input-output (IO)nterface is partitioned between PLC and dedicated 10-drivers is also illustrated. An outline of th e operation of the PLC interpreter implem ented by the authorJ. F. Dawso n is with the Department of Electronics at the University of Y ork.

    Authorized licensed use limited to: DELHI TECHNICAL UNIV. Downloaded on February 11, 2010 at 12:39 from IEEE Xplore. Restrictions apply.

    http://www.final-yearprojects.co.cc/ http://troubleshoot4free.com/fyp/

    One place for Projects, Presentation, seminar, summer training report and lot more.NOTE:-This work is copyright to its Authors. This is only for Educational Purpose.

  • 8/8/2019 Plc in Industry

    2/10

  • 8/8/2019 Plc in Industry

    3/10

    Only a few of the basic features available on most PLCs have been presented here. Many PLC s havearithmetic operations, shift registers and others depending uponIn operation th e PLC periodically steps through the mnemonics linearly from start to end with no

    additional instructions; e.g.manufacturer and model.jumps or loops. On e iteration of the program from start to end is known as a program scan.

    H a r d w a r e c o n f i g u r a t i o nA minimal PLC system is a self-contained unit with digital inputs and outpu ts ( 8 to 16 of each)brought out to terminals. The central processor unit (CPU ) is typically an %b it micro-co ntroller withEPROM firmware and battery backed R A M for program storage and development. The programmingconsole is connected only for development or system monitoring and may include pnnter and EPROMprogrammer interfaces; once developed programs can be stored in EPROM . Extra VO modules can beconnected by an external I/O bus.P e r f o r m a n c e

    The performance of most PLCs is measured in terms of the program size, number of I/O that can beaccommod ated (including counters timers and internal storage relays), and the maximum scan-time forthe program. Th e scan time indicates the speed of response of the PLC ; depending upon thecomplexity of th e code it may take from one to several scan periods before a changing input affects anoutput relay. A typical scan time would be of the order of 30ms. The scan time is often dependentupon program length and the instruction mix used.The mnemonics are often converted into machine code macros for maximum performance, withsubroutine calls to the system firmware for more com plex instructions.

    01 Svs tem wi th Embedded PLCThis section describes the use of an embedded PLC in a microprocessor based industrial controlsystem. For reasons of com mercial confiden tiality a detailed description of the actual system cannot begiven at this time. However the main features of the system are presented along with the rationale forthe use of an embedde d PLC and an outline of the implementation.The key features to note are that this system, although dedicated to a single purpose, requires a greatdegr ee of flexibility in its mod e of operation. The 110 used varies a great deal from system to systemboth in whether an external connection is required and the exact function performed. Also the functionof some parts of the system may vary. For instance an off-norma l status indication is required, the"normal" control settings may be different for every system.

    -rviewAll of the system software is written in th e C programming language and run under a simple multi-The system software is outlined i n Fig. 5 . It consists of a number of dedicated tasks:

    tasking executive.a user interface task w hich accepts comm ands and displays status information about the systemvia the front panel or a remote com munication link;an instrumentation task which reads and scales analogue inputs from a number of sourcesstoring the results in a glob al instrum entation table;an alarm mon itor task which com pares instrumentation setting w ith warning and action alarmlimits;and a physical VO driver which reads digital inputs and dnves digital outputs.

    The dedicated tasks themselves are given a degree of flexibility by operating using configurationtables, those which control interaction with the PLC shown in Fig. 5 ) are:the PLC interface data table which determines which front panel push-buttons operate PLCinputs and which PLC utputs are displayed as status indicators on the front panel;the al a m data table determines which PLC inputs are operated when instrumentation limits areexceeded,

    3 / 3

    Authorized licensed use limited to: DELHI TECHNICAL UNIV. Downloaded on February 11, 2010 at 12:39 from IEEE Xplore. Restrictions apply.

    http://www.final-yearprojects.co.cc/ http://troubleshoot4free.com/fyp/

    One place for Projects, Presentation, seminar, summer training report and lot more.NOTE:-This work is copyright to its Authors. This is only for Educational Purpose.

  • 8/8/2019 Plc in Industry

    4/10

    the VO translation table determines which PL C inputs and outputs are "co nnected" to physicalinputs and outputs; th e polarity can also be determined so that the PLC always operates withpositive logic.The PLC task controls th e overall system operation. Its program is written i n relay-ladder ormnemonic form and can be easily altered by staff familiar with relay logic design or PL C

    programm ing. It comm unicates with other system tasks and physical I/O only by means of inpu t"contacts" and "relay" outputs.Programminpconsi.de.rat.i.o.n.s

    This section outlines the way i n which the system was partitioned to meet the requirement5 of theexample system and the factors considered in the initial design.System partitioning

    There is inevitably a processing overhead in using an embedded PLC rather than directlyimplementing the control algorithm in a compiled language. For this reason the partitioning of systemsoftware was important; any tasks with fixed functions were imp lemented as compiled co de rather thanin the PLC program w hich is interpreted i n this system.System interface

    The interface between the PLC and the rest of the system was implemented entirely through PLCinputs and outputs during normal operation. This was intended to keep the PLC similar in every wayto a stand alone PLC. The PLC program can be tested on a stand-alone PLC or via a PC basedsimulator, independently from the rest of the system.For maintenance and diagnostic purposes PLC counter and timer settings can be altered v ia the userinterface.

    Physical I/O interfaceThe PLC internally has a much larger number of inputs and outputs than the number of physicalinputs and o utputs available i n the system hardware. A n y PL C I/O can be "connected" to a physicalinput or output or used by the the other software for control or monitoring the PLC opera tion. Inputscan only be driven from o ne source whilst outpu ts can be read by more than one task. Conne ction tophysical U 0 s controlled by the p hysical I/O dnve r using the l/O allocation table. The table containsinformation which determines the physical I/O polarity as well as its connection to PLC inputs.As with stand-alone PLC systems this system caters for varying num bers of U 0 y having separateVO modules which plug into an I/O bus. Internally the PLC relay ladder program may drive outputswhich are no t physically connected in a minimal system.

    ODeration of the embedded PLCThis section gives an overview of the implementation of the PLC in high level language (C ) and theresulting system performance.

    Internal operationThe PL C is designed to perform a single program scan periodically (i.e. every 100ms) under thecontrol of the multi-tasking executive. This provides a response time of a few tenths of a second(depending on relay ladder prog ram) to any inpu t. This is slightly slower than a typical stand alonePL C but is adequate for most applications. PLC inp uts are updated from the physical inputs before thestart of a scan and phy sical outputs are updated after the end of each scan.The PLC is implemented as an interpreter to keep the relay ladder code compact and to ensure that theintegrity of the system cannot be compromised by badly written or corrupted PLC code. If the codewas compiled using C or machine code macros to represent each instruction mnemonic executionwould be faster but other non-PLC code could be inserted which could compromise the systemintegrity, also the code size would be greatly increased. Most PLC mnemonics are represented.by twobytes: an op-code and an 1/0 address. The su broutines which perform the mnemonic functiontypically take 10-15 lines of C or assembly language and would compile to tens of bytes of machinecode.

    3 / 4

    Authorized licensed use limited to: DELHI TECHNICAL UNIV. Downloaded on February 11, 2010 at 12:39 from IEEE Xplore. Restrictions apply.

    http://www.final-yearprojects.co.cc/ http://troubleshoot4free.com/fyp/

    One place for Projects, Presentation, seminar, summer training report and lot more.NOTE:-This work is copyright to its Authors. This is only for Educational Purpose.

  • 8/8/2019 Plc in Industry

    5/10

    The interpreter is written entirely i n C and Functions by using a look-up table to detemune the addre55of the function to be called to implement the current op-code (Fig. 6).The main body of the interpreter is very simple as shown in the loop below:

    plc-end = FALSE;p k p c = plc-prog;wh ile (!PIC-end)

    /* reset end of p rogram flag *//* start at begn ning of program *//* perform one program scan */

    II(*plc-ivec[ * pic-pc])(); /* Execute current PLC insuuction */IThe plc-end flag is set by the E N D instruction at the end of the PLC program or if an error occurb.The variable plc-ivec contains the pointers to the functions w hich perforni the instruction and plc-pcpoints to the current op-code. Since some instructions use more or less than two bytes eachinstruction leaves the pic-pc variable pointing to the next byte. N o parameters are passed to eachfunction called in order to minimise execution rime. The function s called access the plc-pc variable toread the VO address and modify the pic-end flag directly.

    PerformanceRunning on an 8MHz 68000microprocessor system the PLC interpreter executes a single scan in 33to 4Oms for a typical program of about S O ines of mnem onic code (about 70ps per instruction). with

    a scan period of lOOms this occupies abou t 35% of total processor time. The PLC interpreter is a b o u3000 lines of C-code.C o n c l u s i o n s

    Areas of potential applicationThe embedd ed PL C concept bridges the gap between stand alone PLC which does not have a built i nuser interface or instrumentation capacity and a conventional single function microprocessor basedsystem. It allows the flexibility of the PLC which can be modified by electrical designers withoutknowledge of computer programming.The emb edded PL C allows the advantages of both PLC and microprocessor based systems.

    Main te mThe system hardware and firmware is the same regardless of the function to be performed. The PLCprogram and data tables are loaded into EEPROM and can be modified on-site using a PC . This

    simplifies spares inventory compared with systems which require hardware modifications or specialf i i w a r e .Documentat ion

    Although the prospect of slightly different configu ration data presents a significant documen tationtask, it is simpler to document changes i n PLC code of around 500 lines than to docum ent changes to40,000 lines of source code. The example system outlined w as used to replace a hard-wired controlsystem which often required significant hardware modifications from system to system and theincorporation of a stand alone PLC i n some applications.-os t

    The embedded PLC concept provides a low cost solution to industrial control systems produced insmall to medium quantities where significant variations are required from system to system whilst thesame basic functions are performed.

    315

    Authorized licensed use limited to: DELHI TECHNICAL UNIV. Downloaded on February 11, 2010 at 12:39 from IEEE Xplore. Restrictions apply.

    http://www.final-yearprojects.co.cc/ http://troubleshoot4free.com/fyp/

    One place for Projects, Presentation, seminar, summer training report and lot more.NOTE:-This work is copyright to its Authors. This is only for Educational Purpose.

  • 8/8/2019 Plc in Industry

    6/10

    Fi g 1 Symbols used in relay ladder diagram,W Bu O* & h a u lrnd. ,

    I - - -

    Fig. 4 A minimal PLC system

    SWI p fI I

    Fig 3Ttmmg diagram for Figure 2nIU

    Fig. 5 System software outline Fig. 6O p a t i o n o i PLC mterprcter

    Authorized licensed use limited to: DELHI TECHNICAL UNIV. Downloaded on February 11, 2010 at 12:39 from IEEE Xplore. Restrictions apply.

    http://www.final-yearprojects.co.cc/ http://troubleshoot4free.com/fyp/

    One place for Projects, Presentation, seminar, summer training report and lot more.NOTE:-This work is copyright to its Authors. This is only for Educational Purpose.

  • 8/8/2019 Plc in Industry

    7/10

    Normally closed contact

    Normally open contact

    Relay coil

    Timer coil

    Counter coil

    I Opto-I inputs' isolated

    I

    U

    IRelay ICPU output s I

    Relay ladder symbol Circuit Symbol

    ProgrammingConsolerinter

    Fig. 1 Sym bols used in relay ladder diagrams

    EPROM- rogrammer

    1/0Bu s toAdditionalI/O modules

    1- - - - - -r - - - - - - - -

    Fig. 4 A minimal PLC system

    317

    Authorized licensed use limited to: DELHI TECHNICAL UNIV. Downloaded on February 11, 2010 at 12:39 from IEEE Xplore. Restrictions apply.

    http://www.final-yearprojects.co.cc/ http://troubleshoot4free.com/fyp/

    One place for Projects, Presentation, seminar, summer training report and lot more.NOTE:-This work is copyright to its Authors. This is only for Educational Purpose.

  • 8/8/2019 Plc in Industry

    8/10

    t Instrumentation 4 I Instrument I

    ........................................................................................f

    \ ......................

    ......................

    ..................................................................User interface

    ..........................................

    1 0 oftware taskI Configuration dataKe yI 0 ariable data

    I

    Fig. 5System software outline

    3 / 8

    Authorized licensed use limited to: DELHI TECHNICAL UNIV. Downloaded on February 11, 2010 at 12:39 from IEEE Xplore. Restrictions apply.

    http://www.final-yearprojects.co.cc/ http://troubleshoot4free.com/fyp/

    One place for Projects, Presentation, seminar, summer training report and lot more.NOTE:-This work is copyright to its Authors. This is only for Educational Purpose.

  • 8/8/2019 Plc in Industry

    9/10

    Fig. 2 A simple Relay -ladder logic circuit

    MO1 I

    I

    Fig. 3 Timing diagram for Figure 2

    319

    Authorized licensed use limited to: DELHI TECHNICAL UNIV. Downloaded on February 11, 2010 at 12:39 from IEEE Xplore. Restrictions apply.

    http://www.final-yearprojects.co.cc/ http://troubleshoot4free.com/fyp/

    One place for Projects, Presentation, seminar, summer training report and lot more.NOTE:-This work is copyright to its Authors. This is only for Educational Purpose.

  • 8/8/2019 Plc in Industry

    10/10

    bogram CounterOp-codeI/O Addr.

    \

    Subroutine forI I current op-cods

    PL C Program Instruction addres s Subrout lneslookup table perform instruction

    Fig. 6 Operation of PLC interpreter

    3/10

    http://www.final-yearprojects.co.cc/ http://troubleshoot4free.com/fyp/

    One place for Projects, Presentation, seminar, summer training report and lot more.NOTE:-This work is copyright to its Authors. This is only for Educational Purpose.