introduction a plc

Upload: rolando-mamani-cruz

Post on 13-Apr-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/26/2019 Introduction a PLC

    1/25

    Introduction to PLCs 1

    Introduction to PLCs

    Industrial Control Systems

    This is the first part of the Industrial Controls course. In this part we will discuss

    the architecture and use of Prtogrammable Logic Controllers (PLCs).

    Allen Bradley has donated several PLC-5 and SLC-500 systems to the University ofAkron. Allen Bradley is a very popular architecture and widely used in industry.

    For these two reasons we will center all of the lectures and laboratories around the

    Allen Bradley architecture and instruction set.

  • 7/26/2019 Introduction a PLC

    2/25

    Introduction to PLCs 2

    Overview

    Boolean Logic Logic in C

    Meaning of Programmable

    Alternate Forms used by PLC

    History

    Modern PLC

    As electrical engineering or computer engineering students you have had exposure

    to programmable logic in Switching and Logic and in Programming for Engineers

    or Introduction to Computer Science. We will discuss both of these approach in

    today's lecture.

    For field programming with industrial strength interfaces the PLC is unrivaled. We

    will discuss why this is so in today's lecture.

    A historical perspective helps in understanding why the PLC have their architecture

    and instruction set.

    A quick look at the systems to be used in this course will make that first laboratoryexercise a little more relaxing.

  • 7/26/2019 Introduction a PLC

    3/25

    Introduction to PLCs 3

    Example

    There are two pumps referred to as pump1 and pump2 in a controlsystem. Between the two pumps is a tank. The tank has a

    normally closed float switch at the top of the tank called below1.

    The tank has a normally open switch at the bottom of the tank

    called below2.

    Control the level in the tank so that is remains between the

    bottom and the top by controlling the two pumps

    Consider the example below as a starting point to investigate different styles of

    programmable logic.

    There are two pumps referred to as pump1 and pump2 in a controlsystem. Between the two pumps is a tank. The tank has a normally closed float

    switch at the top of the tank called below1. The tank has a normally open

    switch at the bottom of the tank called below2.

    Control the level in the tank so that is remains between the bottom

    and the top by controlling the two pumps

    This problem is referred to as the twin-pump problem or twin-pump example.

  • 7/26/2019 Introduction a PLC

    4/25

    Introduction to PLCs 4

    Boolean Logic

    was = between

    between = below1 AND NOT below2

    turn1 = ( NOT turn1 AND was AND NOT between ) OR

    ( turn1 AND ( NOT was OR ( was AND between) ) )

    pump1 = NOT was OR ( between AND turn1 )

    pump2 = NOT was OR ( between AND NOT turn1 )

    One way to represent control logic isvia Boolean logic or equations.

    One why to represent the logic that solves the twin-pump problem is in the form of

    Boolean equations. These equations can then be used to construct a dedicated

    circuit in discreet gates, programmable logic device (PEEL), or a VLSI circuit.

    This logic can be translated to configuration files using WinPLACE or VHDL if this

    device is to be implement in a programmable logic device such as a PEEL or a Field

    programmable Gate Array.

    There is a history implied in this set of statements. After the second statement is

    executed, was is the previous value of between and between is the present value. In

    a hardware device this would be accomplished using some form of memory element

    such as a flip flop. In a PLC this would be accomplished with an internal contact

    and internal coil. The coil would only change after each scan of the logic iscompleted. More about this in a future lecture.

  • 7/26/2019 Introduction a PLC

    5/25

    Introduction to PLCs 5

    Meaning of Programmable

    the logic can be readily altered, the size of the logic subsystem can vary,

    the size of the logic component can belarge, and is not subject to "hard" limits,

    the logic can be defined in the field, in away appropriate to the user of theembedded system.

    The P in PLC stands for programmable. What does this imply?

    The logic can be readily altered. In a PLD using WinPLACE or VHDL we can

    change the equations. We can add additional equations or combine existingequations. The software then produces a configuration file which changes how the

    outputs are changed relative to the inputs. In a PLC the programming is

    accomplished via a set of data structures and how they are interpreted.

    The size of the logic subsystem can change. With PLDs the complexity of the

    equations can be increased. This may lead to a higher percentage of the system

    resources being used. When the utilization exceeds 100%, a larger device must be

    used. In a PLC when the utilization exceeds the existing capacity, the data

    structures must be repartitioned. If this still does now provided enough space morememory is added to the system. Often by purchasing a larger more costly module.

    The size of the component in theory is not subject to a hard limit. The practicality

    of the matter is that cost may force a hard limit.

    The device must be programmable by the end user in the field. In a PLD this is

    done in a programmer or insuti. In a PLC the program is downloaded from a

    computer via a serial cable or over the internet.

  • 7/26/2019 Introduction a PLC

    6/25

    Introduction to PLCs 6

    C Language

    readfloats( int *bw1, *bw2 ) {readfloats( int *bw1, *bw2 ) {

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

    }}

    main() {main() {

    int below1, below2, between, was, turn1,int below1, below2, between, was, turn1,

    pump1, pump2;pump1, pump2;

    while (1) {while (1) {

    was = betweenwas = between

    between = below1 && ! below2;between = below1 && ! below2;

    readfloats( &below1, &below2 );readfloats( &below1, &below2 );

    turn1 = ( ! turn1 && was && ! between ) ||turn1 = ( ! turn1 && was && ! between ) ||

    ( turn1 && ( ! was || ( was &&( turn1 && ( ! was || ( was &&

    between) ) );between) ) );

    pump1 = ! was || ( between && turn1 );pump1 = ! was || ( between && turn1 );

    pump2 = ! was || ( between && ! turn1 );pump2 = ! was || ( between && ! turn1 );

    }}

    }}

    Another way to represent programmablelogic is in a high level language

    The twin-pump problem could also be solved using a C program on an embedded

    microcomputer. The example on the above slide solves the problem. Notice that

    history is again used. This is accomplished by the fact that statements are executes

    in sequence.

    With C, a function must be used to read the inputs and write the outputs at two

    different locations in the code. With the PLD, the inputs are always present on the

    input pins. The equations are evaluated concurrently and then update the outputs.

    The inputs and outputs are often held in a stable condition by flip-flops.

    With a PLC all of the inputs are read and placed in a table. The logic is evaluated

    and the output of each equation is written to an output table. After all the logic has

    been evaluated, the end of the ladder, the output table is written to the outputmodules. This read, evaluate, write sequence then allows the PLC to mimic the

    PLD and the C program.

  • 7/26/2019 Introduction a PLC

    7/25

    Introduction to PLCs 7

    Logic In C

    BitwiseBitwise OperationOperation LogicalLogical

    && ANDAND &&&&

    || OROR ||||

    ~~ NOTNOT !!

    ^ XORXOR NoneNone

    C supports both bitwise and logicalBoolean operators.

    C and hardware description languages allow the equations to be expressed as either

    bitwise operators or logical operators.

    PLCs allow the same thing and they can be expressed in:

    Relay Ladder Logic

    Sequential Function Charts

    Structured Text

    We will discuss these three language or representation in lectures latter on in the

    course.

  • 7/26/2019 Introduction a PLC

    8/25

    Introduction to PLCs 8

    Alternate Forms

    Relay Ladder Logic Sequential Function

    Charts

    Special PLC Languagesuch as StructuredText

    Graphical representations of these alternate forms are shown in the above slide. The

    meaning of these forms will be discussed latter on in the course. We will also

    concern ourselves with how to enter these forms using the software tool RSLogix.

  • 7/26/2019 Introduction a PLC

    9/25

    Introduction to PLCs 9

    IEC 1131-3 Standard

    Standard specifies five programminglanguages

    Structured Text (supported by AB)

    Function Block Diagram

    Ladder Diagrams (supported by AB)

    Instruction List Programming

    Sequential Function Charts (supported byAB)

    At one time each vendor of PLCs would develop their own set of languages that

    could be used to program the device. To allow some uniformity between platforms

    the International Electrotechnical Commission (IEC) developed and published the

    IEC 1131-3 standard. Most PLCs adhere to this standard in that they support one or

    more of the representations. As an example Allen Bradley supports three out of the

    five languages. We will learn a little about all three of these languages. The

    laboratory exercises will use two of the languages (Ladder Diagram and Sequential

    Function Charts).

  • 7/26/2019 Introduction a PLC

    10/25

    Introduction to PLCs 10

    Structured Textwas := between;was := between;

    between := below1 AND NOT below2;between := below1 AND NOT below2;

    turn1 := ( NOT turn1 AND was AND NOT between ) ORturn1 := ( NOT turn1 AND was AND NOT between ) OR

    ( turn1 AND ( NOT was OR ( was AND between)))( turn1 AND ( NOT was OR ( was AND between)));

    pump1 := NOT was OR ( between AND turn1 );pump1 := NOT was OR ( between AND turn1 );

    pump2 = NOT was OR ( between AND NOT turn1 );pump2 = NOT was OR ( between AND NOT turn1 );

    The above is an example of structured text. Structured text comes the closes to the

    PLDs hardware description language and the C language example. This form is the

    most natural for students without ladder diagram experience. This is because they

    have had experience with PLDs and C language.

  • 7/26/2019 Introduction a PLC

    11/25

    Introduction to PLCs 11

    Sequential Function Chart

    Graphical representation of logicstructure in design

    Must have ladder diagram orstructured text inside each step

    Step

    Step

    Transition

    The above example is sequential function charts. This form is easy for those that

    like flowcharts and Algorithmic State Machine (ASM) charts. You most likely have

    had experience with both of these.

  • 7/26/2019 Introduction a PLC

    12/25

    Introduction to PLCs 12

    Ladder Logic

    below1 below2 between

    between was

    turn1 wasbetween turn1

    turn1 was

    was between

    Ladder diagrams are the most alien to electrical engineering and computer

    engineering students. Because we have yet to use ladder diagrams to represent

    programmable logic. But ladder diagrams are the most popular among practicing

    engineers for historic reasons. The lectures will present ladder diagrams first and

    then structured text and sequential function charts will be discussed.

    It is my contention that most of the problems with PLC programs are because of the

    limited capabilities of ladder diagrams. I will try to make you a user of the more

    advanced languages of structured text and sequential function charts.

  • 7/26/2019 Introduction a PLC

    13/25

    Introduction to PLCs 13

    History

    Electromechanical Relay Racks High Documentation Cost

    High Fabrication Cost

    High Debugging and Modification Costs

    Solid State Relays (too unreliable)

    Programmable Controllers (PC) ->

    Programmable Logic Controller (PLC)

    Originally all logic was implemented using electromechanical relays. The relays

    predate electronics. Once solid state electronics was developed many vendors tried

    unsuccessfully to migrate systems from relays to solid state relays. The problem

    with solid state relays were:

    The technology was unproven

    Not enough of the high in the slide above were reduced to low with the

    use of solid state relays

    The industrial control industry is a mature field that does not except change

    without over whelming benefit

    Following solid state relays came the PC or programmable controllers.When IBM introduced the IBM PC the PC term for programmable

    controllers was often confused with personal computer. Programmable

    Controllers were changed in name only to Programmable Logic Controllers

    or PLCs. PLC is just the modern name for PC.

  • 7/26/2019 Introduction a PLC

    14/25

    Introduction to PLCs 14

    Modern PLC

    Power supply (for electronics only) Processor (embedded controller)

    I/O Rack

    I/O Modules

    Digital (AC, DC)

    Analog (ADC, DAC)

    Special (PID, BCD, )

    The modern PLC has several components in the system. The power supply only

    supplies power to the processor and the electronics in the I/O modules. The

    external components such as heaters, position sensors, and the like need their own

    external supply

    The processor module contains the brains or the embedded controller. The

    processor contains the logic and the ability to evaluate the logic.

    The I/O rack holds the power supply, processor, and I/O modules. The rack is a

    chassis with a backplane.

    There are a large number of I/O modules available for any given PLC. We will useseveral different type in the laboratory exercises. The I/O modules translate the real

    world voltages and currents in the voltages and current suitable for the VLSI

    processor chips in the processor module

  • 7/26/2019 Introduction a PLC

    15/25

    Introduction to PLCs 15

    I/O Modules

    N.O.

    N.C.

    Input Output

    Device

    The power supply for the PLC only supplies power to the electronics. It is the

    responsibility of the user to provide power from an external source for the input and

    output modules. Lets assume that the input module is for AC power and the output

    is for AC power. The normally opern (N.O.) and normally closed (N.C.) switches

    would be connected between the HOT bus and the input module node. The input

    module would then have a common node connected to the NEUTRAL: bus. If

    the input module senses a voltage relative to the neutral that is above a specified

    threshold the input is sensed as a logic 1 or is on. Else the input voltage is below

    the threshold voltage the input is a logic 0 or is off.

    For the AC output module the node acts as an AC switch. If a logic 1 is written to

    the node, the switch is closed and hot bus is connected to one side of the device, i.e.

    lamp. The other side of the device is connected to the neutral bus. This applied hotto neutral voltage across the device.

    The hot bus could be replaced with a positive DC voltage and the neural with DC

    ground, if the modules are DC input and DC output modules. If both AC and DC

    modules are used, two external supplies at a minimum are needed.

  • 7/26/2019 Introduction a PLC

    16/25

    Introduction to PLCs 16

    AB PLC-5 & SLC 500

    Data File Type O or Output Image (File #0)

    I or Input Image (File #1)

    S2 or Status (File #2)

    B3 or Bit Data (16 bits per word) (File #3)

    T4 or Timer (File #4)

    C5 or Counter (File #5)

    R6 or Control (File #6)

    The memory in an AB PLC are grouped in to block of memory called files. The

    first 8 files (file 0 through file 7) are assigned by default. You will be exposed to

    some of these file types in the laboratory exercises. Others you will only read

    about.

    O is for the outputs

    I is for the inputs

    S is for the processor status bits

    B is for internal inputs and outputs, those not associated with an Input or

    Output module

    T is for timers

    C is for counters

    R is for control registers used with some instructions

  • 7/26/2019 Introduction a PLC

    17/25

    Introduction to PLCs 17

    AB PLC-5 & SLC 500

    Data File Type N7 or Integer (File #7)

    F8 or Floating-Point (File #8)

    Dn or BCD (None)

    An or ASCII (None)

    Additional Files (n = #9 to #999)

    Size and number of types limited by

    memory size

    N is for numbers of integers

    F is for floating point numbers

    D is for Binary Coded Decimal numbers

    A is for ASCII (American Standard Code for Information Interchange)

    The size and number of files is limited by the memory size in the processor.

    These may be changed from there default size using programming tools. In

    fact the file types may be associated with other file numbers if you so desire.

  • 7/26/2019 Introduction a PLC

    18/25

    Introduction to PLCs 18

    AB PLC-5 & SLC 500

    Program Files System File 0

    System File 1

    Program File 2

    Program Files 3 to 255

  • 7/26/2019 Introduction a PLC

    19/25

    Introduction to PLCs 19

    AB PLC-5 & SLC 500

    I/O Address O:rg/00 to 17

    r = rack number

    g=group number (position in rack)

    Node number in octal (PLC-5)

    Terminal number in decimal (SLC 500)

    I:rg/00 to 17

    S:e/b

    e element number

    b bit number 0 to 15 in decimal

    Each node of each input or output module must be numbered or have an address.

    For the PLC-5 family the numbers are expressed in octal. For the SLC 500 family

    the numbers are expressed in decimal. The rack number is the chassis number. The

    group number relates to the modules position in the rack (chassis). The node

    number related to the relative position of a terminal within a module.

  • 7/26/2019 Introduction a PLC

    20/25

    Introduction to PLCs 20

    AB PLC-5 & SLC 500

    Xf:n X is other file types

    f is file number do not need to use default

    if default used; then can be omitted

    n element number in file

    The address for the other files is of the form Xf:n. X is a letter that is unique to the

    file type such as F for floating-point numbers. The f is the file type which is 8 for

    floating-point numbers bt default. The n is a unique number starting at 0. Each

    n uses a given number of bytes in memory. If n numbers are skipped, that

    block of memory is wasted, that is not used.

  • 7/26/2019 Introduction a PLC

    21/25

    Introduction to PLCs 21

    Micrologix & Pico Controllers

    Allen Bradley has several different families of PLC. For small dedicated

    application there are the Picologix and Micrologix family of devices. With these

    devices the power supply, processor and input output modules are all integrated into

    one systems. If you run out of inputs or outputs you must buy another Pico

    Controller or Micrologix device. The devices themselves are not expandable.

  • 7/26/2019 Introduction a PLC

    22/25

    Introduction to PLCs 22

    SLC 500 Chassis

    For larger applications, the SLC 500 family can be used. The SLC 500 chassis

    allows one to place a processor in the first slot and various input and output modules

    in the other slots. You can pick and choose which module goes into which of the

    remaining slots. This flexibility comes at the higher cost per node over the

    Micrologix of Picologix cost per node.

  • 7/26/2019 Introduction a PLC

    23/25

    Introduction to PLCs 23

    SLC-500 Modules

    The above slide shows a typical SLC 500 system with the power supply to the far

    left. The processor is to the right of the power supply. Five modules of either the

    input type or the output type are to the processors right. There are larger chassis

    for the SLC 500 family that allow more modules.

  • 7/26/2019 Introduction a PLC

    24/25

    Introduction to PLCs 24

    PLC-5

    The PLC-5 family is older and more mature then the SLC-500 family. It also uses a

    power supply, chassis, processor and I/O module architecture.

  • 7/26/2019 Introduction a PLC

    25/25

    Introduction to PLCs 25

    PLC-5 Processors

    As the processor number increases several things change in the processor. The

    memory size increases. The communication capabilities increase. The processor

    speed increases.