0% found this document useful (0 votes)
280 views31 pages

PLC 2

The document provides information about Programmable Logic Controllers (PLCs). It discusses the main components of a PLC including the CPU, I/O system, power supply, and memory. It describes the common hardware configurations and components of PLCs. It also explains the basic operations of a PLC including the input scan, logic scan, and output scan cycles. Programming methods for PLCs including ladder logic are also summarized.

Uploaded by

Biniam Haddis
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
280 views31 pages

PLC 2

The document provides information about Programmable Logic Controllers (PLCs). It discusses the main components of a PLC including the CPU, I/O system, power supply, and memory. It describes the common hardware configurations and components of PLCs. It also explains the basic operations of a PLC including the input scan, logic scan, and output scan cycles. Programming methods for PLCs including ladder logic are also summarized.

Uploaded by

Biniam Haddis
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 31

Programmable Logic Controllers (PLC)

Introduction A PLC is a computer type device used to control industrial process such as conveyor systems, food processing machinery, auto assembly e.t.c. The advent of the PLC began in the 1970s, and has become the most common choice. PLCs have been gaining popularity on the factory floor and will probably remain predominant for some time to come.

Most of this is because of the advantages they offer.


1. 2. 3. 4. 5. 6. Cost effective for controlling complex systems. Flexible and can be reapplied to control other systems quickly and easily. Computational abilities allow more sophisticated control. Troubleshooting aids make programming easier and reduce downtime. High reliability components. Small space requirement

PLC HARDWARE
Many PLC configurations are available, even from a single vendor. But, in each of these there are common components and concepts. The most essential components are:

CPU (Central Processing Unit)


This is the brain of PLC that retrieves, decodes, processes and Stores information. It also executes the control program stored in the PLCs memory. It functions much the same way as the CPU of regular computer, except that it uses special instructions and coding to perform its function.

I/O (Input / Output) system


It is the section of PLC to which all the field devices are connected. (Field devices such as switches, push buttons, sensors, motors, lamps etc) The I/O system physically carries out the control commands from the PLC. The I/O can be considered as the arms and legs of the PLC.

Power Supply
It provides the required voltage and current to the PLC This can be built into the PLC or it can be an external unit. Common voltage levels required by the PLC (with and without the power supply) are 24Vdc, 120Vac, 220Vac.

Indicator lights Indicate the status of the PLC including power on, Running mode, Pause mode
and Fault. These are essential when diagnosing problems

Memory : To store control programs and temporary data


The I/O system consists of two important parts:

1-The Rack : is an enclosure with slots in it that is connected to the CPU


2- I/O Modules:- I/O Modules are devices with connection terminals to which the field devices are wired. - Each I/O module is securely installed in a slot in the rack. The rack and I/O modules together form the interface between the field devices and the PLC.

Input Modules
In smaller PLCs the input modules are normally built in and are specified when purchasing the PLC. In larger PLCs the inputs are provided as a separate module, or cards, with 8 or 16 inputs of the same type on each card. Input modules can be analogue or digital. The typical ranges for input voltages, and is roughly in order of popularity: 12-24 Vdc, 100-120 Vac, 10-60 Vdc, 12-24 Vac/dc, 5 Vdc (TTL), 200-240 Vac, 48 Vdc, 24 Vac For PLC input cards, an external power supply is needed to supply power for the inputs and sensors. The example in figure below shows how to connect an AC input card to field devices.

Push button
Temperature switch

Fig: Hardware connection

Fig: Program representation

PLC input modules must convert a variety of logic levels to the 5Vdc logic levels used on the data bus. This can be done with circuits similar to those shown below. Basically the circuits condition the input to drive an optocoupler. This electrically isolates the external electrical circuitry from the internal circuitry. Other circuit components are used to guard against excess or reversed voltage polarity.

Fig. 2: DC input module

Fig.3 : AC input module

Output Modules
As with input modules, external power supplies are connected to the output card and the card will switch the power on or off for each output. Outputs must convert the 5Vdc logic levels on the PLC data bus to external voltage levels. It use an optocoupler to switch external circuitry. This electrically isolates the external electrical circuitry from the internal circuitry. Other circuit components are used to guard against excess or reversed voltage polarity.

Fig.4: Electronic out put module Fig.5: relay type output module

PLC Memory
The memory system in the PLC stores both the control program and the data from the equipments connected to it.

Old PLCs use RAM for the program and ROM to store the basic operating system for the PLC.
Originally PLC vendors used RAM with a battery so that the memory contents would not be lost if the power was lost. This method is still in use, but is losing favor. EPROMs have also been a popular choice for programming PLCs. The EPROM is programmed out of the PLC, and then placed in the PLC. When the PLC is turned on the ladder logic program on the EPROM is loaded into the PLC and run. This method is very reliable, but the erasing and programming technique can be time consuming. EEPROM memories are a permanent part of the PLC, and programs can be stored in them like EPROM. Memory costs continue to drop, and newer types (such as flash memory) are becoming available, and these changes will continue to impact PLCs.

PLC Memory Organization


The memory in a PLC is organized by data type as shown in the figure . There are two fundamental types of memory used in Allen-Bradley PLCs - Program and Data memory.

Program File-0 is used for program and password information. SFC programs must be in program File-1. The main program will be stored in program File -2. All other program files from 3 to 999 can be used for subroutines. This is where the variable data is stored that the PLC program operates on. Fig.6: Memory organization

PLC OPERATION

All PLCs have four basic stages of operations that are repeated many times per second.

SELF TEST - Checks to see if all cards(modules) are error free, reset watch-dog timer,
etc. (A watchdog timer will cause an error, and shut down the PLC if not reset within a short period of time - this would indicate that the ladder logic is not being scanned normally).

INPUT SCAN - Reads input values from the input cards, and copies their values to
memory. (the physical input values are copied into memory). This makes the PLC operation faster. There are special PLC functions that read the inputs directly, and avoid the input tables.

LOGIC SCAN/solve - Based on the input table in memory, the program is executed

one step at a time, and outputs are updated. (When the ladder logic is scanned it uses the values in memory, not the actual input or output values). (When the outputs to a PLC are scanned they are copied from memory to the physical outputs). These chips then drive the output devices.

OUTPUT SCAN - The output table is copied from memory to the output chips.

Fig.7: PLC scan cycle

Initially when turned on the first time it will check its own hardware and software for faults. If there are no problems it will copy all the input and copy their values into memory, this is called the input scan. Using only the memory copy of the inputs the ladder logic program will be solved once, this is called the logic scan. While solving the ladder logic the output values are only changed in temporary memory. When the ladder scan is done the outputs will updated using the temporary values in memory, this is called the output scan. The PLC now restarts the process by starting a self check for faults. This process typically repeats 10 to 100 times per second as is shown in figure below

The Logic Scan


Consider the ladder logic in figure below, the ladder logic will be interpreted left-toright, top-to-bottom, The ladder logic scan begins at the top rung, At the end of the rung it interprets the top output first, (3) Then the output branched below it, (4) On the second rung it solves branches, before moving along the ladder logic rung,

Fig.8: ladder logic execution sequence

PLC STATUS
On the front of the PLC there are normally limited status lights. Common light indicators are:

Power - this will be on whenever the PLC has power Run - this will often indicate if a program is running, Stop it indicates that the plc is doing nothing (stop mode). Fault - this will indicate when the PLC is experienced a major hardware or software problem. These lights are normally used for debugging.
Limited buttons will also be provided for PLC hardware. The most common will be: A start/stop switch: used to switch off when maintenance is being conducted, and back to run when in operation. This switch normally requires a key to keep unauthorized personnel from altering the PLC program or stopping execution. Almost all PLCs never have an on-off switch or reset button on the front.

Programming PLC
The control program is the software program in the PLCs memory that consists of one or more instructions which accomplished certain task.

The user or system designer is usually the one who develops the control program.
Basic PLC programming styles: Ladder logic (LD), Function Block diagram (FBD), Statement List (SL), Structured Text(ST), Sequential Function Charts (SFC)

1- Ladder Logic
Ladder logic is the main and easiest programming method. Ladder logic programs are modeled from relay logic. In relay logic each element in the ladder will switch as quickly as possible. But in a program elements can only be examined ones at a time in a fixed sequence.

Features of Ladder Logic


The various instructions are represented by graphic symbols and include three basic forms. Contacts represent logic input conditions such as switches, buttons, sensors or internal conditions. Coils usually represent logic output results such as lamps, motor starters, interposing relays, or internal output conditions. Boxes represent additional instructions, such as timers, counters, or math instructions. Consider these main points when you select the LAD editor: Ladder logic is easy for beginning programmers. Graphical representation is easy to understand and is popular around the world. The LAD editor can be used with both the SIMATIC and IEC 1131-3 instruction sets. You can always use the FBD or STL editor to display a program created with LAD editor

Fig.9: Relay logic

FIG.10: Ladder Logic

FIG. 11:Field device connection to PLC

Similarities of ladder logic and relay logic

2- Instruction List Programming (IL)


IL programming uses very simple instructions similar to mnemonic programming languages (assembly language programming). It can be derived from ladder logic. Consider the ladder logic that contains four inputs, and one output. The equation can then be directly converted to instructions. Example-1
LD I0.0 LD I0.1 O Q0.0 = Q0.0

Example-2

LD I0.0 AND (I0.1 OR(I0.2 ANDN I0.3)) ST Q0.0

To compare with assembly language format The program begins at the START: label. At this point the first value is loaded, and the rest of the expression is broken up into small segments.

Exercise-1: Convert the following ladder logic in to IL program

Exercise-2: Write the ladder diagram programs that correspond to the following Boolean programs. (a)
LDN AN A LD A OLD = I0.2 I0.3 I0.4 I0.5 I0.6 Q0.1

(b)

LD A LD A OLD =

I0.1 I0.2 I0.4 I0.5 Q0.0

(c)

LDN A LD O A OLD = AN =

I0.1 I0.2 I0.4 I0.3 I0.5 Q0.2 I0.6 Q0.3

3- Function Block Diagram (FBD)


FBD is a graphical dataflow programming method. The primary concept behind a FBD is data flow. In these types of programs the values flow from the inputs to the outputs, through function blocks. A sample FBD is shown in figure below.

Fig. Simple comparison program

In the program
The inputs N7:0 and N7:1 are used to calculate a value sin(N7:0) * ln(N7:1). The result of this calculation is compared to N7:2. If the calculated value is less than N7:2 then the output Q:000/01 is turned on, otherwise it is turned off.

4- Structured Text (ST)


ST is a BASIC like programming language. The functions used in FBD programs are equivalent to the set used in Structured Text (ST) programs. Example-1. Consider the addition function shown in the figure below. The ST function on the left adds A and B, and stores the result in O. The function block on the right is equivalent. By convention the inputs are on the left of the function blocks, and the outputs on the right.

Example-2. Some functions allow a variable number of arguments. In Figure 21.4 there is a third input to the ADD block. This is known as overloading.

When developing a complex system it is desirable to create additional function blocks. This can be done with other FBDs. Figure below shows a divide function block created using ST. In this example the first statement declares it as a FUNCTION_BLOCK called divide. The input variables a and b, and the output variable c are declared. In the function the denominator is checked to make sure it is not 0. If not, the division will be performed, otherwise the output will be zero.
FUNCTION BLOCK divide VAR_INPUT a:INT; b:INT; END_VAR VAR_OUTPUT c:INT; END_VAR IF b<>0 THEN c: = a/b; ELSE c:=0; END_IF END_FUNCTION_BLOCK

LATCHES, TIMERS AND COUNTERS


LATCHES A latch is like a sticky switch - when pushed it will turn on and stick in place, it must be pulled to release it and turn it off. A latch in ladder logic uses one instruction to latch, and a second instruction to unlatch. Example: Consider the ladder logic shown below

Fig. Timing diagram The output with an L inside will turn the output Qo on when the input Io becomes true (at t= T1). Qo will stay on even if Io turns off (at t= T2). Output Qo will turn off when input I1 becomes true (at t= T3)and the output with a U inside becomes true. If an output has been latched on, it will keep its value, even if the power has been turned off.

Flip-Flops
Latches are not used universally by all PLC vendors, others such as Siemens use flip-flops. These have a similar behavior to latches, but the different is that flipflop is an output block that is connected to two different logic inputs. The first rung shown has an input Io connected to the S setting terminal. The second rung has an input I1 connected to the R resetting terminal.

Operation When Io goes true the output value Q will go true. When I1 goes true the output value Q will be turned off. The output Q will always be the inverse of Q. Notice that the S and R values are equivalent to the L and U values of Latch.

TIMERS
There are four fundamental types of timers 1. On delay timer (TON) :- An on-delay timer will delay for a set of times (before turning on) after a line of ladder logic has been true, but it will turn off immediately. 2. Off-delay timer (TOF):- An off-delay timer will turn on immediately when a line of ladder logic is true, but it will delay before turning off. 3. Retentive on-delay timer (RTO):- A retentive on-delay timer will sum all of the on times for a timer, even if the preset time is not elapsed. 4. Retentive Off-delay timer (RTF):- A retentive off-delay timer will sum all of the off times for a timer, even if the preset time is not elapsed.

Note: A non-retentive timer will start timing the delay from zero each time.

TON - timer

The timing diagram below illustrates the operation of the TON timer with a 4 second on-delay. Whenever the timer input (Io) is true the EN enabled bit for the timer will also be true. But the DN bit value will remain off until the accumulator value is equal to the preset.

The first time Io is true, it is only true for 3 seconds (before turning off), after this the value resets to zero. (Note: in a retentive time the value would remain at 3 seconds.) The second time Io is true, it is on for more than 4 seconds. After 4 seconds the DN bit turns on. But, when Io is released the accumulator resets to zero, and the DN bit is turned off.

RTO- timer The timer in the figure below is identical to that in the previous figure, except that it is retentive. The most significant difference is that when the input Io is turned off the accumulator value does not reset to zero, it rather store the current time value. When Io is on for the second time, the accumulator continues counting from this value. As a result the DN bit will be set when the preset time is elapsed, and the timer does not turn off after it turns on. A reset instruction is required that will allow the accumulator to be reset to zero.

Exercise: Draw the ladder logic and timing diagram of 1. Off-delay non retentive timer 2. Off-delay retentive timer

COUNTERS There are two basic counter types: 1. count-up (CTU) 2. count-down (CTD) 1- CTU

Timing diagram with n=3

When the input Io goes true the accumulator value will increase by 1 (no matter how long the input is true). If the accumulator value reaches the preset value (n)the counter DN bit will be set. (The count can continue above the preset value). The instruction requires memory in the PLC to store values and status, in this case is C5:0 (C5: indicates that it is counter memory). If input I1 goes true the value in the counter accumulator will become zero.

2- CTD
Count-down counters are very similar to count-up counters. Exercise: Draw some ladder logic for CTD with time diagram and explain its operation based on the time diagram. (Use n=4 pulses )

Important :- Both CTU and CTD can be used on the same counter memory
location. Example: Consider the figure below.

Input I/1 drives the count-up instruction for counter C5:1. Input I/2 drives the count-down instruction for the same counter location. The preset value for a counter is stored in memory location C5:1 so both the count-up and count-down instruction must have the same preset. Input I/3 will reset the counter.

Problem
1. Develop the ladder logic that will turn on an output light, 15 seconds after switch Io has been turned on. 2. Develop the ladder logic that will turn on a light, after switch I1 has been closed 10 times. Push button B will reset the counters. 3. A motor will be controlled by two switches. The Go switch will start the motor and the Stop switch will stop it. If the Stop switch was used to stop the motor, the Go switch must be thrown twice to start the motor. When the motor is active a light should be turned on. The Stop switch will be wired as normally closed. 4. A conveyor is run by switching on or off a motor. We are positioning parts on the conveyor with an optical detector. When the optical sensor goes on, we want to wait 1.5 seconds, and then stop the conveyor. After a delay of 2 seconds the conveyor will start again. We need to use a start and stop button - a light should be on when the system is active

Problem
Design a PLC program and prepare a typical I/O connection diagram and ladder logic program that will correctly execute the hardwired control circuit given below

Solution-1

Solution-2

You might also like