introduction to programmable logic controllersrev2

Upload: bd9051

Post on 13-Apr-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    1/43

    Introduction to Programmable Logic

    Controllers

    Figure 1PLC

    Introduction

    PLC Background

    A programmable logic controller is unit of hardware used to control and automate

    industrial processes. Programmable Logic Controllers (PLCs) are often defined as

    miniature industrial computers that contain hardware and software that is used to perform

    control functions. TheThefirst PLC was developed to help General Motors eliminate

    traditional rela!based machine control sstems. "n large applications where thousands of

    realrelasma e#ist$ wiring and troubleshooting could be %uite complicated &'.

    "n*+, -edford Associates$ a compan in -edford$ MA$ developed a devicecalled a Modular igital Controller for General Motors. The M/"C/0$ as it was

    1nown$ was an electronic device$ not a mechanical one$ it was perfect for GM2s

    re%uirements$ as well as for man other manufacturers and users of control e%uipment.

    3ith less wiring$ simpler troubleshooting$ and eas programming$ PLC technolog

    caught on %uic1l &'.

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    2/43

    A PLC has three main

    aspects4the inputs and outputs and

    the control program. The inputs are

    connected to sensors that inform

    the PLC about the environment.

    The program uses a set of logical

    instructions that drives the outputs

    based on the inputs. The outputs

    are connected to the devices

    that need to be controlled. "n

    figure 5 above$ the PLC has

    eight inputs and four outputs.

    There are two basic tpes of Programmable Logic Controllers4 a single bo# tpe

    and a modular or rac1 tpe. The bo# tpe is smaller and used for simpler control

    situations. "t is supplied as an integral compact pac1age$ compete with power suppl$

    processor$ memor and input output units. &6' 7ome of the most basic of theses onl

    have ' outputs. The

    tpicall can have from ' to

    '8 inputs and outputs.

    epending on si9e and

    functionalit the can cost

    between :88 and :888.

    -o# tpe PLCs have

    limited e#pansion

    capabilities.

    The modular tpe consists of a central rac1 that house various hand pic1ed

    modules that are appropriate for each control situation. A large variet of modules e#ist

    that satisf man needs such as power supplies$ processors$ analog input and outputs$

    digital input and outputs$ and communications. ";/ modules can alwas be added after

    the unit it installed to suit new needs. Power supplies can be upgrade to meet new power

    Figure 2

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    3/43

    re%uirements. Also the ";/ modules can be much more speciali9ed than that of the bo#

    tpe PLCs.

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    4/43

    house needs to be converted into three phase power via a converter. Above is a picture of

    a popular phase converter4 the Phase!/!Matic. 7ome of the e%uipment is located in the

    garage and some in the basement. Therefore$ the three phase power needs to be available

    at both locations. Conse%uentl$ the converter needs to have start and stop controls at

    both locations.

    The converter has three contacts. Two are connected to the 558 >AC source. The

    other is connected to a starting capacitor and a push button. 3hen the power is switched

    on nothing immediatel happens. The ?!phase converter has a motor that needs to be

    started via a starting capacitor. After the motor has started onl the 558 >AC source is

    re%uired for continued operation. 3hen ?!phase power is no longer needed$ the process is

    stopped b disconnecting power.

    @owever$ this is onl the basic concept of operation. The process should simpl

    have one button for start and one button for stop at each location. This means that a timed

    rela will ta1e the place of the momentar push button$ and a rela latching sstem is

    need instead of a the power switch. "n this wa$ the sstem can operate using push

    buttons.

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    5/43

    PL7 relate this figure to the previous one

    A rela is a device that responds to a voltage change b activating a switch. 3hen

    the input is energi9ed with a voltage a current will flow thought the coil and cause it to

    become magneti9ed. Magnetic force will pull the contact close and thus close the circuit.

    3hen the input voltage ta1en awa the magnet will de!activate and the contact will open

    again. A rela and a contactor basicall serve the same function. The name contactor is

    simpl used for high current.

    -elow is a picture of the main control bo# for the converter with the components

    labeled. This is how the control mechanism is put together without a PLC. The power

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    6/43

    switch and momentar push button have been replaced with start and stop buttons. The

    operational logic is performed b the start rela and a time dela rela.

    -elow is a bloc1 diagram that shows the manner in which each device is

    connected to each other. The wiring should loo1 a little comple# and confusing. The

    bloc1s in ellow represent Bela logic. The light blue bloc1s are output devices. The

    wiring would be much simpler with a PLC. The 5!pole contactor controls the power

    suppl to the converter. The !pole contactor controls the starting capacitor. The Bemote

    lamp is a indicator light at the remote location. 3hen lit it indicate that the converter is

    operating

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    7/43

    -elow is a schematic of how devices would be connected if a PLC was used for

    control. 0ote how simple the wiring becomes. 3hen using a PLC$ phsical wiring poses

    much less difficult. Conse%uentl$ this helps avoid problems and speeds installation. The

    inputs are on the left and the outputs are on the right. 0otice how the PLC too1 the place

    of two relas$ the start rela and the timed rela. - replacing these two components the

    PLC has alread almost paid for itself.

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    8/43

    7o wh are PLCs so useful= 3ell for e#ample$ s7uppose there is a process where

    there is a pressure build up. A solenoid is powered to 1eep a valve shut. Dver time a

    pressure sensor is tripped$ a solenoid

    is de!activated for 8 seconds. That

    in turn allows the valve to open and

    the pressure to be released. After 8

    seconds$ power is restored to the

    solenoid and the valve is closed. (A

    solenoid is solenoid is a magnetic switch that closes a circuit. "t is often used as a another

    tpe of rela.) Also suppose that the process needs to count how man times the solenoid

    is de!activated. 3ithout a PLC the process would follow this diagramthe diagram above.

    The pressure sensor would feed information in a timer and a counter (two separate unites

    of hardware). -ut what if the process included 8 sensors and 8 solenoids= 3ed need

    8 timers and 8 counters. Thats a lota large amountof hardwarethat ta1es up room on

    the factor floor. And Moreover$ if a manual release button and other safet sensors were

    also needed$ the situation can become comple# and involve a large amount of hardware.

    "f an one unit failed the whole sstem would have to be shut down$ the fault found and

    then fi#ed. -efore PLCs$ however$ this is how it was done.

    "nstead of a large amount of

    devices and the resulting complicated

    wiring$ one piece of hardware$ a PLC

    can ta1e the place of all 58 the timers

    and counters. "t can simulate all the

    necessar logic within its

    programming. And if the PLC brea1s$

    it is easil replaced.

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    9/43

    PLCs replace all the wiring and individual pieces of hardware li1e counters$

    timers and relas. -efore PLCs were used the wiring$ configuring and troubleshooting all

    these components would often get ver complicated. 3ith a PLC$ all wiring is done in

    softwarewhere it is drawn clearl and much easier to understand. This adds an additional

    benefit were if a change was needed to be made$ no disconnecting of hardware would be

    re%uired. 0o one would have to disconnect wires and move around hardware. That can be

    ver time consuming and tedious. /nl the PLCs program would need to be updated and

    then loaded into the PLCs memor.

    Typical PLC Applications

    PLCs are implemented in a variet of control operations from large to small.Carwashes are a popular use for PLCs because it involves intricate use of sensors and

    motors$ but also has the need for relativel comple# logic. Carwashes have several wash

    tpes that use or doesnt use certain features. Dach car wash can be a ver uni%ue and

    involved process$ but it is greatl simplified when done in the PLCs software as opposed

    to a hardware implementation.

    PLCs are used for sorting pac1ages on a conveor b operating a diverter. /ne

    conveor can move man tpes of pac1ages. A sensor can detect a pac1age tpe and a

    series of diverters can sort them at the end of the belt. "n this wa$ one conveor can be

    used instead of man. -ut the PLC is fle#ible$ it can be reprogrammed if and when the

    sorting tas1 changes or if enhanced operation is needed.

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    10/43

    PLCs are used to operate greenhouse irrigations sstems. "t can be used to control

    how often and the amount of water distributed to certain areas. "t can control a large

    amount of valves to certain areas and is fle#ible as the greenhouses needs change.

    Lumber mills use PLCs to control the main saw and loading of wood while

    various sensors ensure safe operation so that people and e%uipment are not harmed. A

    lumber mill saw is ver e#pensive and man precautions must be ta1en to ensure that

    nothing goes wrong when moving lumber through the mill.

    PLCs can withstand the hash condition desert conditions while controlling an oil

    recover process. Temperatures can get higher than 58 degrees

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    11/43

    Consider the e#ample of a light bulb. "f it can onl be turned on or off$ it is logical

    control. "f the light can be dimmed to different levels$ it is continuous. Continuous values

    seem more intuitive$ but logical values are preferred because the allow more certaint$

    and simplif control. As a result most controls applications (and PLCs) use logical inputs

    and outputs for most applications &.

    @ere are some tpical input voltage values for PLCs &4

    5!5' >dc

    88!58 >ac

    8!+8 >dc

    5!5' >ac;dc

    6 >dc (TTL)

    588!5'8 >ac

    ', >dc

    5' >ac

    There are man trade!offs when deciding which tpe of input cards to use &.

    C voltages are usuall lower and therefore safer (i.e.$ 5!5'>).

    C inputs are ver fast$ AC inputs re%uire a longer on!time.

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    12/43

    5!', >dc

    6>dc (TTL)

    5?8 >ac

    The PLCs CP is protected

    b /ptoisolators. That is it is

    electricall isolated from its inputs

    and outputs. The /ptoisolators

    uses a LD and photo sensor to

    conve voltage information. 3hen a

    digital pulse passes through theLD$ a pulse of infrared radiation is

    produced &65. This pulse is detected b the phototransistor and gives rise to a voltage in

    that circuit. The gap between the LD and the phototransistor give electrical isolation

    &65. This wa if there is a large voltage spi1e$ the PLC will not be damaged.

    The terms sourcing and sin1ing are used to describe the wa in which C devices

    are connected to a PLC &65. An input or output said to be sourcing when it uses a PLC as

    its power source. PLCs often provide power for the output devices connected to it. An

    input or output said to be sin1ing when it provides its own power for operation. /ften

    sensors are used as sin1ing inputs. 3hen discussing sourcing and sin1ing we are usuall

    referring to the output of the sensor that is acting li1e a switch &. "n fact$ the output of

    the sensor is normall a transistor that will act li1e a switch (with some voltage loss). A

    P0P transistor is used for the sourcing output$ and an 0P0 transistor is used for the

    sin1ing input &. 3hen discussing these sensors the term sourcing is often interchanged

    with P0P$ and sin1ing with 0P0 &.

    7ome PLC haves communications inputs and outputs. This can be serial or

    parallel cables or even the abilit to communicate on an Dthernet. "s useful in large

    controls situations where man PLCs in remote locations are controlled b one master

    PLC.

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    13/43

    Basic PLC Operationmaye a sususection

    A PLC wor1s b continuousl running a

    program that chec1s the inputs and then updates

    the outputs. The process of the PLC runningthought its program is called scanning. 7canning

    speed depends on the program si9e and e#ecution

    time. The total time for a PLC to chec1 the inputs$

    run the program and update the outputs is called

    the ccle time. Tpical ccle times are 8 ms to

    88 ms. Dver ccle the inputs are chec1 and

    saved to memor. Then the program is run using

    the status of the saved inputs. After the program is done the outputs are updated and the

    ccle starts again.

    PLC Programming

    Programming Introduction

    The main method for PLC programming is called ladder logic. "ts not the usual

    tpe of programming such as -A7"C$ C or assembl. "t is a graphical programming

    language that uses graphical smbols to provide the PLC with the logical instructions

    needed to perform control operations. Learning how to use and implement PLCs is

    basicall learning ladder logic.3hen PLCs first arrived the were made to replace rela

    hardware. "t was preferred that a minimum about of retraining would be necessar for the

    engineers and trades people to operate and implement the PLCs. As a result$ ladder logic

    was developed to mimic rela logic. Ladder logic programs resemble rela logic

    schematics. -elow is the rela logic diagram for the ?!phase controller. (7hould " redraw

    this with Autoshapes as "ve done in the PowerPoint presentation=)0o. Leave it as is. "t

    is the perfect e#ample of how ideas get started

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    14/43

    -elow is the ladder logic for the PLC implementation of the ? phase converter

    controller. The two diagrams have man similarities.

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    15/43

    3hen PLCs first arrived the were made to replace rela hardware. "t waspreferred that a minimum about of retraining would be necessar for the engineers and

    trades people to operate and implement the PLCs. As a result$ ladder logic was developed

    to mimic rela logic. Ladder logic programs resemble rela logic schematics.

    Lets start the introduction to ladder logic b comparing it to a circuit diagram.

    @ere is a simple circuit for operating an electric motor. 3hen the button is pushed the

    circuit will close and cause the rela to activate to the

    motor. 3hen the button is released$ the circuit will open

    and the motor will stop. "n the lower part of the figure is

    the same operation in ladder logic. Power is said to

    flow from the left power rail to the right rail. This

    small diagram is actuall a ver small ladder logic

    program where -utton is assigned a PLCs input and

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    16/43

    Motor is assigned to the PLCs output. "t is important to note that ladder logic is not a

    circuits schematic and ladder logic does not show the relative positions of components to

    each other as a circuits diagram does. An important distinction is that a ladder logic

    program is a set of logical instructions and not a wa to phsicall connect components.

    Terms and Symols

    Ladder logic is so named because the

    diagram loo1s li1e a ladder. Dach step in the

    program is called a rung. The vertical lines on

    the left and right are the power rails. Dach

    rung defines one operation in the control

    process. The ladder diagram is read from left

    to right and from top to bottom. Dach rung

    starts with one or more inputs and ends with at

    lease one output.

    There are %uite a few manufacturers of PLCs. Dach has its own brand of ladder

    logic programming. Though the are all ver similar and if ou can program in one

    manufactures ladder logic language it is eas to use

    them all. @ere are a few standard smbols. The

    power rails$ the open and closed contact and the

    output device. Power is alwas said to flow from left to

    right. Power flows though an open or closed contact

    depending on input conditions. And if power can get to

    an output device it turns on. Contacts are alwas on

    the left side of the ladder and output devices are

    alwas on the right side.

    The contacts and the output device can either be real input and output connections

    on the PLCs or the can be special functions in the ladder program. A contact is assigned

    to a device that is part of the control process through an address. "t alwas follows the

    state of the device it is assigned too. "t can be assigned to an input$ an output or even a

    variable in the PLCs memor. A contacts assigned device can be a push button$ a

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    17/43

    temperature sensor$ a motor or even a bit mar1er or counter that onl e#ists in the PLCs

    memor.

    3hen programming in ladder logic$ the snta# for the address of contacts and

    output devices depends on the particular brand of ladder logic being used. "n the figurebellow are some e#ample of addressing schemes for various PLC brands and models.

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    18/43

    As an e#ample$ consider a motor operated b a button.

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    19/43

    addresses to output $ 5$ ?$ respectivel. The words below each element such as motor

    or on lamp are comments and onl on function to e#plain the diagram.

    Basic Logic

    -elow is a ladder logic rung called a seal!in!circuit. 3hen A is activated it will

    cause the output - to turn on. - will remain on regardless of an further input$ thus it is

    Isealed!inJ.

    7ometimes ou need a machine to 1eep running even after the start button has

    stopped being depressed. This re%uired a method called latching. Consider a PLC with

    two buttons wired to its inputs and a motor wired to on of its outputs. "f the PLC is

    programmed with the ladder logic in

    the figure on the right it will wor1 as

    follows. 3hen the start button is

    pressed the motor will turn on and

    will sta on if the button is released.

    The contact labeled motor will

    follow the state of the output device labeled motor. Therefore b pressing the start button$

    the Motor contact will also activate. 3hen the start button is released$ the motor will sta

    active because of the motor contact on the lower rung will still be in the on state. The stop

    button must be used to turn the motor off b causing its contact to open. This is versimilar to a seal!in!circuit but with the additional option of deactivating the circuit. 0ote

    that if both buttons are pressed simultaneousl the motor will not turn on.

    Latching an also be done

    b using more advanced ladder

    logic commands. The figure to

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    20/43

    the right is a ladder logic program that uses thesetand resetcommands to achieve

    latching. This ladder logic is e%uivalent to the previous figure. 3hen the on button is

    press it will all power flow through the motor device with the 7 in the center. The 7

    stands for set. This will cause the motor to sta active unless power is allowed to flow

    though the motor device with the B in the center. The B stands for reset. As before$ in

    the event that both buttons are pressed simultaneousl the motor will not be active.

    There are man control situations re%uiring outputs to be activated based on

    certain conditions.

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    21/43

    !OT #ate

    $OR #ate

    The following figure shows a conveor belt that can be activated electricall.

    Thereare two push button switches at the beginning of the belt4 7 for 7TABT and 75 for

    7T/P. There are also two push button switches at the end of the belt4 7? for

    7TABT and 7' for 7T/P. "t ispossible to start or stop the belt from either end.

    Also$ sensor 76 stops the belt when an item on the belt reaches the end.

    The following is the ladder logic need to control the belt from either end. The ladder logic

    is in shorthand notation where the right power rail is implied but not drawn. The two

    ladder logic sections can be Foined together for the complete program. 0otice /B gates

    are being used.

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    22/43

    Internal Relays

    Bela logic was so named because instead of relas being used for remote

    switching of large current devices$ the were used for logical operations. A PLC replaces

    these logical relas with internal relays that e#ist onl in the PLC software. A variet of

    other terms are often used to describe these elements$ e.g. auxiliary relays, markers,

    flags, coils, bit storage &5'. "n the Allen -radle Pico Controllers$ the term markeris

    used and its address uses the notation M$ M5$ etc. "nternal relas addressed differentl

    to distinguish them from e#ternal relas or an other element in the ladder logic program.

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    23/43

    Consider the ladder logic program below. A sstem is to activated when two

    different sets of input conditions are reali9ed. This could be programmed as an A0

    logic gate sstem however$ if a

    number of inputs have to be

    chec1ed in order that each of the

    inputs conditions can be reali9ed$ it

    ma be simpler to use an internal

    rela. Also if the result of M

    needs to be used more than once

    in the ladder program$ an internal

    relas would be more succinct.

    "nternal relas can also be used with the set and reset commands.

    "f the power suppl is cut off from a PLC while it is being used$ all the output

    relas and internal relas will be turned off. Thus when power is restored$ all the

    contacts associated with those relas will be set differentl from when the power was on.

    Thus$ if the PLC was in the middle of some se%uence of controls action$ it would resume

    at a different point in the se%uence. To overcome this problem$ some internal relas have

    batter bac1!up so that the can be used in circuits to ensure a safe shutdown of plant in

    the even of a power failure and so enable it to restart in an appropriate manner. 7uch

    batter!bac1ed relas retain tier state of activation$ even when the power suppl of off.

    The relas is said to have been made retentive. 7uch a feature on a PLC will be in its

    documentation where it will specif that batter bac1ed internal relas lie in a certain

    address range$ i.e. M8!M6$ etc &5'.

    The following figure shows a conveor belt that is e%uipped with two

    photoelectric barriers (PD- and PD-5) that are designed to detect the direction in which

    a pac1age is moving on the belt. Dach photoelectric light barrier functions li1e a normall

    open contact.

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    24/43

    Timers

    As part of its CP$ a PLC has a control cloc1 that can be used to time events and

    deliver output when certain timer parameters are met. The timers can be represented in

    ladder logic as output devices with corresponding contacts or as bloc1 functions. 0otice

    that the ladder logic programs on the left and rightbelow are them same perform the same

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    25/43

    function. The left one uses output devices or coils and the right one uses bloc1 functions.

    The e#actl stle of timer will depend on the manufacturer and brand of the PLC that the

    ladder logic development program is used for.

    "n Pico7oft$ the output device and contact method is emploed. There are man

    tpes of timers for PLCs. The two most basic tpes are the on-delayand the off-delay

    timer. 3ith an on!dela timer$ once the timer coil gains power$ its corresponding contact

    will not turn on immediatel. "nstead a timer will start and once it is complete onl then

    will the timer contact be in its active state. Antime the timer coil looses power$ the timer

    is reset and the timer contact also loose power.

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    26/43

    button is pressed and held a 6 second on!dela timer will start. 6 seconds later the motor

    will then activate.As soon asAn time the button is released the motor will stop.The

    ladder logic for this operation is below. An on!dela timer is used because it delaysmotor

    from turning on.

    An off!dela timer wor1s

    b delaing the deactivation of a

    device. Consider a motor that isactivated b a button. 3hile the

    button is held the motor starts

    immediatel and runsuntil the

    button is released$.when it is

    released the motor stops. "t is

    re%uired that two lamps

    indicating the status of the motor

    be lit. @owever it ta1es a few

    seconds for the motor to stop

    spinning so the on lamp should

    remain lit for a set amount of time after the button is released. /ne lamp indicates the

    motor is off$ the other indicates it is on. @owever$ when the button is released the motor

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    27/43

    still spins for a few seconds. The on!lamp should sta on during this time. Therefore$an

    off!dela is needed for the onlamp so that it stas illuminated a few seconds after the

    on button is releasedis delaed in turning off. The ladder logic for this operation is above.

    0otice in rung '$ the off lamp is programmed to simpl do the opposite of the on lamp. "n

    this e#ample$as soon as the timer output device$ T$ has power flow$ its associated

    contact goes into the on state. 3hen the output device T loose power however$ the T

    contact remains in the on state for a few second while the timer is counting down.

    "n addition to these two basic tpes of timers there are others. A retentivetimer

    retains its timer even after its coil loose power flow.

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    28/43

    Counters

    A counteris

    used to count and store

    the number of

    occurrences of an input

    signal. Li1e a timer$ a

    counter can be

    represented b an

    output device and contact pair or a bloc1 function. A counter is set to some preset

    number value and when this value of input pulses has been receivedit will operate its

    associated contacts. There are two tpes of counters4 up!counters and down!counters. An

    up!counter starts a 9ero and count up to a preset limit. A down!counter starts a preset

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    29/43

    limit and counts down to 9ero. 3hen the counter reaches the set value$ its contacts are

    activated. Counters also have a reset coil that when activated re!initiali9ed the current

    count value.

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    30/43

    Comparison Instructions

    Ladder logic for PLCs often includes instructions that can compare two values

    and operate a contact based on the result. "f the two values are "0 and "05 the can be

    compared as follows4

    "0 is e%ual to "05

    NO "0 is not e%ual to "05

    O "0 is greater than "05

    N "0 is less than "05

    O "0 is greater than or e%ual to "05

    N "0 is less than or e%ual to "05

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    31/43

    "n this case$ function bloc1s are used as the graphical smbol in the ladder logic.

    The input values "0 and "05 can be programmed directl in to the comparer or the

    can be ta1en form other elements in the ladder program such as timers and counters.The following figure shows a sstem with two conveor belts and a temporar

    storage area in between them. Conveor belt delivers pac1ages to the storage area. A

    photoelectric barrier at the end of conveor belt near the storage area determines how

    man pac1ages are delivered to the storage area. Conveor belt 5 transports pac1ages

    from the temporar storage area to a loading doc1 where truc1s ta1e the pac1ages awa

    for deliver to customers. A photoelectric barrier at the end of conveor belt 5 near the

    storage area determines how man pac1ages leave the storage area to go to the loading

    doc1. A displa panel with five lamps indicates the fill level of the temporar storage

    area.

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    32/43

    0otice in this e#ample a bloc1 counter$ C$ is used. 3hen the counter has reached its

    limit the output H on the bloc1 will activate. A comparer can use values from C> and

    -C from the counter to compare values. C> is the values of the counter and -C is the

    counter value in binar coded decimal.

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    33/43

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    34/43

    PLC Example

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    35/43

    As before a Mmanual shut off can

    be added to the sstem as well as a safet

    sensor. 0otice that the manual release and

    safet sensor are programmed as normall

    open. This is so if there is an problem

    with the sstem or the safet sensor or

    shut off the solenoid will lose power and

    the pressure release valve will open

    causing the process to fail safe.

    Ladder logic is alwas drawn in the

    wa the device is preferred to fail. @ere if the

    7safet 7sensor or Mmanual shut off

    components fail or if the PLC fails the

    7solenoid will be de!activated. This is the

    safest wa for the process to fail because the

    pressure value will open if there is an

    problem. @ere is the/n the right is thewiring

    schematic for the PLC. 0otice that the safet

    sensor and manual shut off are wired such that the are usuall in an on state. 3hen these

    two devices are activated the cause an open and the PLC detects that these devices are in

    the off state. This is so if there is an problem with these input devices$ it is more li1el

    that the will fail open and thus de!activate the solenoid and vent pressure. 3hen

    programming a PLC$ contacts should alwas be programmed to be normall in the state

    ou want them to fail in.

    And of course as before the process can become large if more sensor and

    solenoids were re%uired. The PLC program would have to be repeated for each sensor!

    solenoid pair and more input and output device would be wired to the PLC.

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    36/43

    %ixer Example

    As an e#ample$ cConsider an industrial mi#er a where a drum is to be filled with

    li%uid. After it is full$ a heater is used to heat the li%uid until it reaches a certain

    temperature. Then the drum is to rotated for 8 minutes$ then the process stops@ere -elow is the se%uential function

    chart for this process. 7

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    37/43

    @ere is/n the right isthe wiring diagram

    for the mi#er. As alwas all the inputs and

    output are wired directl to the PLC. The

    operating logic is all stored in the PLC as a

    ladder logic program. 7o based on the inputs of

    the start button$ the level full floater and the

    temperature sensor the PLC will decide when to

    turn on the pump$ heater and motor.

    @ere /n the right is the ladder

    logic for the pump and the heater. /nce

    the start button is pressed the pump will

    sta on until the li%uid is at the re%uired

    level. This is done through latching with

    the Pump contact. 3hen the floater is

    activated$ it will stop the pump at the

    re%uired level. /nce the level switch is

    active the pump will be shut off and the

    heater will be activated. The li%uid will be

    heated until the temperature switch is

    triggered. There the heater is latched so

    even if the li%uid level goes down it will

    still be heated until the re%uired temperate

    is reached. The temperature reached

    contact is not assigned to an input or

    output of the PLC. -ut instead to an

    internal output devicerelathat onl e#ists

    in the PLCs memor. "n total$the ladder logic program has five rungs. 0otice for 7tate ?$

    at the top$ once the Temperature sensor is tripped it will activate the Temperature

    reached output device. This device onl e#ists in the PLCs memor and acts as a

    variable. /nce active it latches its self to the on state. This insures that the timer is onl

    activated once and the heater doesnt turn bac1 on if the li%uid cools. /nce the timer is

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    38/43

    activated it will cause the 8 minutes timer

    contact to close and the mi#ing motor to

    turn on. The motor will operate for 8

    minutes and then stop.

    Program "esign

    7ince Ladder ladder logic is essentiall a computer program it is subFect to bugs

    and faults. "n the industrial environment process and operator safet are primar conerns.

    Therefore an program needs to be tested for accurac and robustness. 3hen writing

    programs a fail!safe design should be emploed. Programs should be designed so that

    the chec1 for problems$ and shut down in safe was. Most PLCs also have imminent

    power failure sensors. These sensors should be used to shut down the sstem safel

    whenever danger is present. Proper programming techni%ues and modular programming

    will help detect possible problems on paper instead of in operation. Careful effortshould

    be ta1en to write modular well designed programs that arepredictable. Theprogram

    should also be inaccessible to unauthori9ed persons. Programs should also chec1 for

    sstem / at start!up. PLCs have built in functions for error and failure detection that

    should be used to 1eep the sstem safe. &

    Time chec1s can also be built into the ladder logic program. This is where

    additional ladder rungs might be includes so that when a function starts a timer is started.

    "f the function does not complete when the timer finishes a fault is signaled. The function

    might be the moving of a piston or filling a drum with li%uid. Man PLCs have a simulate

    mode where the installed program can be run and inputs and outputs simulated so that

    the can be chec1ed. PLC ladder logic software can test against programming snta#

    errors.

    7tatus lamps can be used to indicate the last outputthat has been set during a

    process which has come to a halt. This techni%ue is called last output set. 7uch lamps are

    built into the program so that as each output occurs a lamp comes on. The lamps on thus

    indicate which outputs are occurring. The program has to be designed to turn off previous

    status lamps and turn ona new status lamp as each new output is turned on. &65

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    39/43

    3here there is concern regarding safet in the case of a fault developing$ chec1s

    ma be constantl used to detect faults. /ne techni%ue is replication checkswhich

    involves duplicating$ i.e. replicating$ the PLC sstem. This could mean that the sstem

    Fust repeats ever operation twice and if it gets the same result it is assumed there is no

    fault. This procedure can detect transient faults. A more e#pensive alternative is to have

    duplicate PLC sstems and compare the results given b the two sstems. "n the absence

    of a fault the two results wouldbe the same$ a fault showing up as a difference. &65

    /ne method of testing is called forcing.This is where input states are forced to

    certain states in software. Programming errors can sometimes be found b forcing inputs

    at various stages in the ladder program. Most PLCs will allow a user toforce inputs and

    outputs. This means that the can be turned on$ regardless of the phsical inputs and

    program results. This can be convenient for debugging programs$ and$ it ma1es it eas to

    brea1 and destro thingsQ 3hen forces are used the can ma1e the program perform

    erraticall. The can also ma1e outputs occur out of se%uence. "f there is a logic problem$

    then these dont help a programmer identif these problems. &

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    40/43

    5. Modular testing ! small segments of the program can be written$ and then tested

    individuall. "t is much easier to debug and verif the operation of a small

    program.

    ?. Code review ! review the code modules for compliance to the design. This should

    be done b others$ but at least ou should review our own code.

    '. Modular building ! the software modules can then be added one at a time$ and the

    sstem tested again. An problems that arise can then be attributed to interactions

    with the new module.

    6. esign confirmation ! verif that the sstem wor1s as the design re%uires.

    +. Drror proofing ! the sstem can be tested b tring e#pected and une#pected

    failures. 3hen doing this testing$ irrational things should also be considered. This

    might include unplugging sensors$ Famming actuators$ operator errors$ etc.

    R. -urn!in ! a test that last a long period of time. 7ome errors wont appear until a

    machine has run for a few thousand ccles$ or over a period of das. &

    Program testing can be done on machines$ but this is not alwas possible or desirable.

    "n these cases simulators allow the programs to be tested without the actual machine.

    The use of a simulator tpicall follows the basic steps below.

    . The machine inputs and outputs are identified.

    5. A basic model of the sstem is developed in terms of the inputs and outputs. This

    might include items such as when sensor changes are e#pected$ what effects

    actuators should have$ and e#pected operator inputs.

    ?. A sstem simulator is constructed with some combination of speciali9ed software

    and hardware.

    '. The sstem is verified for the e#pect operation of the sstem.

    6. The sstem is then used for testing software and verifing the operation. &

    Ladder logic can do much more than what has been shown so far. "t can utili9e

    registers and bits to store and move data. There are data comparison functions such as

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    41/43

    chec1ing for e%ual to$ less than or greater than. There are arithmetic operations such as

    addition$ subtraction and multiplication. There are functions that can transform number to

    different bases or formats. 7ome PLCs can provide P" (proportional integral derivative)

    calculations to control a variable simpl b being provided the necessar parameters.

    Conclusion

    At this point (ma1e it impersonal) should reali9e how PLCs can solve man

    problems in industr. PLC7 are fle#ible and can be reapplied to control other sstems

    %uic1l and easil. The are cost effective for controlling comple# sstems. The posses

    high computational abilit that allows more sophisticated control through ladder logic.

    Trouble shooting aids ma1e programming easier and reduce downtime. Beliable

    components ma1e PLCs li1el to operate for ears before failure. &

    Eou should also reali9e that right now$ if ou had a PLC and enough ladder logic

    1nowledge ou could construct a sophisticated machine with little problem as far as

    operational logic is concerned.

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    42/43

    Sources

    Source

    Number Description1 PLC book http://claymore.engineer.gvsu.edu/!ackh/books/plcs

    " PLC #ebsite http://###.plcs.net/

    $ PLC tutorial http://###.plcs.net/chapters/#hatis1.htm

    % &uick PLC description http://support.automationdirect.com/docs/#hatisaplc

    ' PLC (istory http://###.so)tplc.com/history.php

    * +nline ,ncyclopedia http://en.#ikipedia.org/#iki/Programmable-logic-con

    PLC online orum http://###.plctalk.net/0anda/

    Course e2ample http://claymore.engineer.gvsu.edu/!ackh/eod/egr%'

    4 Course e2ample http://###.pueblocc.edu/tec/auto-3"$.htm

    13 Course e2ample http://###.cede.psu.edu/Student5uide/,,6""3.htm

    11 Course e2ample http://###.tech.mtu.edu/courses/eet$$3/,,6$$371" Course e2ample http://###.ute2as.edu/cee/pete2/training/courses/ipl

    1$ PLC simulation so)t#are http://###.tri8plc.com/trilogi.htm

    1% PLC simulation so)t#are http://###.ab.com/plclogic/pico/picoso)t.html

    1' 9itsubishi http://###.meau.com/eprise/main/sites/public/P+D

    1* 6oshiba http://###.tic.toshiba.com/productgroups.php

  • 7/27/2019 Introduction to Programmable Logic ControllersRev2

    43/43

    $4 PLC intro http://###.canadu.com/h!html/plcs18%.html

    %3 6; vs PLC http://###.tetragenics.com/?rticles/6;vsPLC.htm

    %1 Ladder Logic Adeas http://2tronics.com/toshiba/Ladder-logic.htm

    %" Ladder Logic editor http://home.scarlet.be/dc11cd/dciplc.html

    %$ Ladder Logic e2amples http://###.ibiblio.org/obp/electricCircuits/Digital/DA5

    %% PLC tutorial site http://###.plcman.co.uk/%' Antro to A,C *11$1 http://###.plcopen.org/6C1/intro-iec-*11$18.htm

    %* A,C *11$18$ ?& http://###.holobloc.com/stds/iec/sc*'b#gt)$/html/)

    % 6hread on PLC Scan time http://###.plctalk.net/0anda/sho#thread.php