WHAT IS A PLC????

‡PLC- Programmable Logic Controller ‡It is a digital electronic device that uses a programmable memory to store instructions and to implement functions such as logic, sequencing, timing, counting and arithmetic in order to control machines. ‡Used for logical and switching operations.
CONTROL PROGRAM

PLC
INPUTS FROM DEVICES OUTPUTS TO DEVICES

SPECIFIC FEATURES OF A PLC
‡ Rugged and designed to withstand vibrations, temperature, humidity and noise. ‡ Interfacing for inputs and outputs is inside the controller - Possible to modify a control system without having to rewire the connections to the input and output devices ‡ Easily programmable.

ARCHITECTURE OF A PLC..

BASIC STRUCTURE
‡ CPU- controls and processes all the operations within the PLC. ‡ Clock( 1 to 8 MHz ) determines operating speed and provides timing and synchronization for all elements. ‡ Bus carries information to and from the CPU, memory and i/o units. ‡ Memory : * ROM- permanent storage of operating system and fixed data * RAM- memory for user s program( battery is used to prevent loss of data when power goes off) * Temporary Buffer- stores for i/o channels

Some important terms
‡ PROGRAM STEP: It is an instruction for some event to occur. (ex) examine the state of A

‡ PROGRAM TASK: Consists of a number of steps. (ex) examine the state of A, examine state of B, if both A and B are closed energize solenoid P.

INPUT/OUTPUT
‡ provides interface between the system and the outside world. ‡i/o units can vary from small keyboards with LCDs to those using a visual display unit (VDU) with keyboard and screen display. ‡i/o channels provide signal conditioning and isolation functions so that sensors and actuators can be directly connected to them. ‡Common input voltages- 5V and 24V.
INPUT CHANNEL

‡Common output voltages 24V and 240V

TYPES OF OUTPUT
Three types: 1. Relay type of output 2. Transistor type of output 3. Triac type of output

RELAY TYPE OF OUTPUT
‡Signal from the PLC output is used to operate a relay. ‡So, it is able to switch currents of the order of a few amperes in an external circuit. ‡Relay isolates the PLC from the external circuit . ‡Advantage: Can be used for both d.c. and a.c. switching. ‡Disadvantage: relatively slow.

TRANSISTOR TYPE OF OUTPUT
‡Uses a transistor to switch current through the external circuit. ‡In fig (a), using the conventional flow of currents from +ve to ve, an output device receives current from output module called Sinking. ‡In fig (b), the current flows from output module to an output loadcalled sourcing. ‡Optoisolators provide isolation between the external circuit and the PLC. ‡Advantage: faster switching action. ‡Disadvantage: only for d.c.

SINKING

SOURCING

TRIAC TYPE OF OUTPUT
‡ Used to control external loads which are connected to the a.c. power supply.

‡ Optoisolators are used to provide isolation.

INPUT/OUTPUT PROCESSING
The sequence followed by a PLC when carrying out a program is as follows: 1. Scan the inputs associated with one rung of the ladder program. 2. Solve the logic operation involving those inputs. 3. Set/reset the outputs for that rung. 4. Move on to the next rung and repeat the operations 1,2 and3. 5. Move on to the next rung and repeat the operations 1,2 and3. 6. Move on to the next rung and repeat the operations 1,2 and3. and so on until the end of the program.

Note: Each rung of the ladder program is thus scanned in turn.

TYPES OF I/O PROCESSING
Two types: 1. Continuous updating 2. Mass input/output copying

CONTINUOUS UPDATING
‡ CPU scans the input channels in order. ‡ Each input point is examined individually and its effect in the program is determined. ‡ built-in delay (3ms)- ensures only valid input signals are read by the microprocessor( avoids reading the same input twice). ‡ A number of inputs may have to be scanned, each with a 3ms delay, before the program has the instruction for a logic operation to be executed and an output to occur. ‡ Outputs are latched- so they retain their status until the next updating. ‡ Disadvantage: longer time.

MASS I/O COPYING
‡ To allow more rapid execution a specific area of RAM is used as a buffer store between the control logic and the i/o unit. ‡ Each i/o unit has an address in the memory. 1. At the start of a program cycle- CPU scans all inputs and copies their status into the i/o address in RAM. 2. During execution - the stored input data is read from the RAM. 3. After execution - the outputs are stored in the reserved i/o section of RAM. 4. At the end of a program outputs are transferred from RAM to output channels. ‡ The outputs are latched so that they retain their status until the next updating.

PROGRAMMING
Ladder diagrams‡ writing a program in a similar manner to drawing a switching circuit. ‡ Two vertical lines- power rails. ‡ Horizontal rungs of the ladder between the 2 linescircuit connections. ‡ Inputs must always precede outputs. ‡ There must be atleast one output on each line. ‡ Each rung should start with an input(s) and end with an output. ‡ The inputs and outputs are numbered- notations as given by the manufacturer.

Contd ..

LADDER SYMBOLS

LADDER DIAGRAM

EXAMPLES OF LADDER DIAGRAMS
EXAMPLE-1:
Output from the PLC is to energize a solenoid when a normally open start switch is connected to the input is activated by being closed.

QUESTION:

SOLUTION:

‡ EXAMPLE-2:
On-off temperature control in which the input goes from low to high when the temperature sensor reaches the set temperature.
QUESTION: SOLUTION:

LOGIC FUNCTIONS
‡ The logic functions can obtained by a combination of switches. ‡ The following few slides shows how ladder programs can be written for such combinations.

AND Logic

RELAY LADDER DIAGRAM

LOGIC LADDER DIAGRAM

OR Logic

RELAY LADDER DIAGRAM

LOGIC LADDER DIAGRAM

NOR Logic

RELAY LADDER DIAGRAM

LOGIC LADDER DIAGRAM

NAND Logic

RELAY LADDER DIAGRAM

LOGIC LADDER DIAGRAM

XOR Logic

LOGIC LADDER DIAGRAM

COMBINATION OF AND & OR
‡ Situation: A normally open switch A must be activated and either of two other, normally open, switches B and C must be activated for a coil to be energized.

RELAY LADDER DIAGRAM

LOGIC LADDER DIAGRAM

SAMPLE APPLICATION OF LOGIC GATES ..
Consider the requirement for there to be an output to the solenoid controlling the valve that will open a shop door when the shopkeeper has closed a switch to open shop and a customer approaches the door and is detected by a sensor which then gives a high signal.
SHOP OPEN SWITCH Off Off On On SHOP DOOR SYSTEM CUSTOMER APPROACHING SENSOR Off On Off On TRUTH TABLE SOLENOID OUTPUT Off Off Off On

It is seen that it is an application of an AND gate

LATCHING
‡ Used in situations where it is necessary to hold a coil energized, even when the input which energized it ceases. ‡ Latch circuit- a self maintaining circuit which, after being energized remains in that state until another input is received.
‡When input 1 is energized and closes, there is an output. ‡However, when there is an output, a set of contacts associated with the output is energized and closes. ‡These contacts OR the input 1 contacts. ‡Thus, even if input 1 contacts open the circuit will still maintain the output energized. ‡The only way to release the output is by operating the normally closed contact input2.

LATCHING CIRCUIT

EXAMPLE OF LATCHING CIRCUIT
The requirement for a PLC to control a motor so that when the start signal button is momentarily pressed the motor starts and when the stop switch is used the motor switches off, signal lamps indicating when the motor is off and when on.
UNSAFE SYSTEM SAFE SYSTEM

If there is a PLC failure then the motor cannot be stopped.

NC switch in output and then the PLC program being programmed as NO and being switched as it finds the contacts closed.

SEQUENCING
Consider the requirement for a ladder program for a pneumatic system with double solenoid valves controlling two double-acting cylinders A and B if limit switches a-, a+, b-, b+ are used to detect the limits of the piston rod movements in the cylinders and the cylinder activation sequence A+B+A-B- is required.

MNEMONICS
‡ It is an alternate way of entering a program. ‡ Consists of codes corresponding to each ladder element. ‡ Enter these into the programming panel. ‡ It is then translated into machine language. ‡ The mnemonics used in Mitsubishi F series PLCs is as shown in the following slide.

MITSUBISHI MNEMONICS
FUNCTION MNEMONICS LD OUT AND OR I I ORI ANI LDI ANB ORB RST SHF K END Start a rung with an open contact An output A series element and so an AND logic instruction Parallel elements and so an OR logic instruction A NOT logic instruction Used in conjunction with other instructions to indicate the inverse An OR NOT logic function An AND NOT logic function Start a rung with a closed contact AND used with two subcircuits OR used with two subcircuits Reset shift register/counter Shift Insert a constant End ladder

AND system
Step 0 1 2 Instruction Notation LD AND OUT X400 X401 Y430

OR system
Step 0 1 2 Instruction Notation LD OR OUT X400 X401 Y430

NOR system
Step 0 1 2 Instruction Notation LDI ANI OUT X400 X401 Y430

NAND system
Step 0 1 2 Instruction Notation LDI ORI OUT X400 X401 Y430

XOR system
Step 0 1 2 3 4 5 Instruction Notation LD ANI LDI AND ORB OUT Y430 X400 X401 X400 X401

TIMERS
‡ Used to carry out tasks which involve time delay and time counting. ‡ A timer circuit is specified by stating the interval to be timed and the conditions or the events that are to start and/or stop the timer. ‡ They are commonly regarded as relays with coils which, when energized, result in the closing or opening of input contacts after some preset time.

DELAY-ON TIMERS
‡ This timer waits for a fixed delay period before turning on. ‡ When there is an input, the timer is energized and starts timing. After some preset time the contacts associated with the timer close and the output occurs.

Part of program involving delay-on timer Delay-on timer

DELAY-OFF TIMERS
‡ A timer which switches off an output after a time delay. ‡ When the input contacts are momentarily closed the output is energized and the timer started. ‡ The output contacts latch the input and keep the output on. ‡ After a preset time of the timer, the timer comes on and breaks the latch circuit, so switching the output off.

CASCADED TIMERS
‡ To give larger delay times that which is not possible by just one timer timers are linked together. ‡ They are called cascaded timers.

ON-0FF CYCLIC TIMER
‡ Used to cause an output to go on for a certain time and then off for a certain period and repeat this cycle.

INTERNAL RELAYS
‡ Also called as auxiliary relay or marker. ‡ They behave like relays with their associated contacts, but in reality are not actual relays but simulations by the software of the PLC. ‡ Some have battery back-up to ensure a safe shut-down of plant in the event of a power failure. ‡ Useful in implementation of switching sequences.

INTERNAL RELAYS FOR MULTIPLE INPUT CONDITIONS
‡ Excitation of output depends on two different input arrangements. ‡ First rung- one input arrangement to control the cool IR1. ‡ Second rung- other input arrangement to control coil IR2. ‡ The contacts of the two relays are then put in an OR situation to control the output.

Contd ..
‡ Using Mitsubishi code:
Step 0 1 2 3 4 5 6 7 8 9 Instruction notation LD OR OUT LD AND OUT LD OR OUT END X400 X401 M100 X402 X403 M101 M100 M101 Y430

INTERNAL RELAYS FOR MULTIPLE OUTPUTS
‡ When the start contacts are closed, the internal relay is activated and latches the input. ‡ It also starts output 1 and makes it possible for outputs 2 and 3 to be activated.

APPLICATION OF INTERNAL RELAYS-1
‡ To automate a pneumatic circuit (2 cylinders) in which double solenoid valves are used in the sequence A+B+B-A-.

APPLICATION OF INTERNAL RELAYS-2
‡ Used for resetting a latch.
‡When the contacts of input 1 are momentarily pressed then the output is energized. ‡The contacts of the output are then closed and so the latch the output. ‡The output can be unlatched by the internal relay contacts opening. ‡This will occur if input2 is closed and energizes the coil of the internal relay.

BATTERY BACKED INTERNAL RELAY
‡ When the contacts of input1 close, the coil of battery backed internal relay is energized. ‡ This closes the relay contacts and so even if contacts of the input open as a result of power failure the relay contacts remain closed. ‡ (i.e) the output controlled by the internal relay remains energized, even when there is a power failure.

COUNTERS
‡ Used when there is a need to count a specified number of contact operations. ‡ Two types: * Down- counter: the counter counts from present value to zero(events are subtracted from the set value) and when zero is reached its contact state changes. * Up-counter: counts up to the preset value (events are added until the number reaches the set value) and when this is reached its contact changes state.

SAMPLE COUNTING PROGRAM
‡ K10 indicates that the contact state changes on the 10th pulse. ‡ When input1 closes momentarily, the counter is reset to set value. ‡ Then the number of pulses resulting from the contacts of input2 closing and opening are counted. ‡ When it reaches the set value(10), the counter contact closes. ‡ The output is thus switched on after 10 pulses. ‡ If the contacts of input1 are momentarily closed during the count, the counter will reset to 10.

Contd
‡ In Mitsubishi code:
Step 0 1 2 3 4 5 6 Instruction LD RST LD OUT K LD OUT Notation X400 C460 X401 C460 10 C460 Y430

SAMPLE APPLICATION OF COUNTERS
‡ Consider the problem of the control for a machine which is required to direct 6 items along one path for packaging in a box, and then 12 items along another path for packaging in another box.

SHIFT REGISTERS
‡ A number of internal relays are grouped together to form a register. ‡ Provides storage area for a series sequence of individual bits. ‡ A 4-bit register can be formed using 4 internal relays, an 8-bit using 8. ‡ The bits can be shifted along by one bit when there is a suitable input to the register. ‡ (ex) initially an 8- bit register might have:
1 0 1 1 0 1 1 0 1 1 0 0 1 1 0

then there is an input of a 0 shift pulse: 0 1 with the result that all the bits shift along one place and the last bit overflows.
0

INPUTS TO SHIFT REGISTERS
‡ Three inputs 1. To load data into the first element of the register (OUT) - a logic level 0 or 1 is loaded into the first element of the shift register. 2. As the shift command(SFT) a pulse moves the contents of the register along one bit at a time, the final bit overflowing and being lost. 3. For resetting(RST) a pulse of a closure of a contact resets the register contents to all 0s.

SAMPLE PROGRAM - SHIFT REGISTER
Step 0 1 2 3 4 5 6 7 8 9 10 Initially 10000000 then 11000000 11 etc. 20 21 LD OUT M147 Y437 Instruction Notation LD OUT LD SFT LD RST LD OUT LD OUT LD OUT X400 M140 X401 M140 X402 M140 M140 Y430 M141 Y431 M142 Y432

MASTER CONTROLS
‡ A whole block of outputs can be simultaneously turned off or on by using the same internal relay contacts in each output rung so that switching it on or off affects every one of the rungs. ‡ An alternate way of programming to achieve the same effect is to use a master relay.

SAMPLE PROGRAM MASTER RELAY
‡ When there is an input to close input1 contacts, then master relay MC1 is activated and then the block program rungs controlled by the relay follows. ‡ MCR - The end of a master relay controlled section. ‡ If there is an input to input2 , then master relay MC2 is activated and the rungs controlled by that master relay follow. ‡ If there are no inputs to both 1 and 2 then the rung that follows in the program is that for input9 controlled output Out6.

JUMPS
‡ Used in conditional situations. ‡ Enables program to be designed so that if a certain condition exists then a section of the program is jumped. ‡ An example is as follows.

DATA HANDLING
‡ Some situations arise where a group of bits have to be handled. ‡ (ex) a sensor supplies an analogue signal which is converted to, say, an 8-bit word before becoming an input to a PLC. ‡ The operations that may be carries out with a PLC on data words normally include: 1. Moving data. 2. Comparison of magnitudes of data, (i.e.)greater then, equal to or less than. 3. Arithmetic operations such as addition and subtraction. 4. Conversions between binary coded decimal (BCD), binary and octal.

DATA REGISTERS
‡ Data instructions also require memory addresses. ‡ The locations in the PLC memory allocated for data are termed as data registers. ‡ Each data register can store a binary word of usually, 8 or 16 bits. ‡ Addresses are given as D0,D1,D2 and so on. ‡ A 8-bit word means that a quantity is specified to a precision of 1 in 256, a 16-bit a precision of 1 in 65536. ‡ Each instruction has to specify 1. the form of the operation 2. the source of the data used in terms of its data register 3. the destination data register of the data.

DATA MOVEMENT
‡ 1. 2. 3. ‡ For data movement, the instruction will contain Move data instruction The source address of the data The destination address of the data The following is the ladder rung to transfer data from D1 to D2.
Step 0 1 2 3 Instruction LD MOV D1 D2 Notation X300

DATA COMPARISON
COMPARISON Less than Equal to Less than or equal to Greater than Greater than or equal to Not equal to SYMBOL < = <= > >= <> CODE LES EQU LEQ GRT GEQ NEQ

The comparison instruction consists of: 1. Comparison instruction 2. The source address of the data 3. Destination address

(ex) to see if D1 is greater than D2
Step 0 1 2 3 Instruction Notation LD > D1 D2 X300

SAMPLE APPLICATION OF DATA COMPARISON
‡ Comparison might be used when signals from two sensors are to be compared by the PLC before action is taken. ‡ (ex) an alarm might be required to be sounded if a sensor indicates a temperature above 80oc and remain sounding until temperature falls below 70oc

ARITHMETIC OPERATIONS
‡ The instruction to add or subtract consists of: 1. The instruction. 2. The register containing the address of the value to be added or subtracted. 3. The address of the value to which the addition or from which the subtraction is to be made. 4. The register where the result is to be stored. ‡ It may be used to alter the value of some sensor input value, perhaps a correction or offset term or alter the preset values of timers or counters. ‡ The following shows the form used for the ladder symbol for addition with OMRON.

CODE CONVERSIONS
‡ All internal operations in the CPU of a PLC are carried out using binary numbers. ‡ So when input is a decimal, conversion to binary required. ‡ Also when a decimal output is required, conversion from Binary to decimal is needed. ‡ (ex) following is the rung employed in conversion from BCD to binary.

ANALOG INPUT/OUTPUT
‡ Many sensors generate analog signals and many actuators require analog signals. ‡ Thus, some PLCs have A-D converter fitted to input channels and DA converter fitted to output channels. ‡ (ex) speed control of a motor so that its speed moves up to its steady value at a steady rate. The program is as shown below:

Contd
‡ A PLC equipped with analog input channels can be used to carry out a continuous control function, (i.e) PID control. ‡ To carry out proportional control on an analog input the following set of operations can be used: 1. Convert the sensor output to a digital signal. 2. Compare the converted actual sensor output with the required sensor value (i.e) the set point and obtain the difference(error). 3. Multiply the error by the proportional constant Kp. 4. Move this result to the D-A converter output and use the result as the correction signal to the converter.

SAMPLE APPLCATION OF ANALOG I/O
‡ Temperature controller. ‡ The input could be from a thermocouple, which after amplification is fed through an A-D converter into the PLC. ‡ The PLC is programmed to give an output proportional to the error between the input from the sensor and the required temperature. ‡ The output word is then fed through a D-A converter to the actuator, a heater, in order to reduce the error. (program in next slide).

TEMPERATURE CONTROL

SELECTION OF A PLC
‡ Criteria to be considered are as follows: 1. What i/o capacity is required, (i.e) the number of i/o, capability of expansion for future needs. 2. 3. 4. What types of i/o are required, (i.e) isolation, onboard power supply for i/o, signal conditioning. What size of memory is required? This is linked to the number of i/o and the complexity of program used. What speed and power is required for the CPU? This is linked to the number of types of instruction that can be handled by a PLC. As the number of types increases , a faster CPU is required. Likewise, the greater the number of i/o to be handled the faster the CPU required.

PROBLEMS ..
1. What are the logic functions used for switches (a) in series (b) in parallel? 2. Draw the ladder rungs to represent (a). Two switches are NO and both have to be closed for a motor to operate. (b). Either of two NO switches have to be closed for a coil to be energized and operate an actuator. (c). A motor is switched on by pressing a spring-return push-button start switch, and the motor remains on until another spring-return push-button stop switch is pressed.

3. Write the program instructions corresponding to the latch program shown below.

4. Write the program instructions corresponding to the program shown below and state how the output varies with time.

5. Write the program instructions corresponding to the program shown below and state the results of inputs to the PLC.

6. Devise a timing circuit that will switch an output on for 1s then off for 20s, then on for 1s, then off for 20s and so on. 7. Devise a timing circuit that will switch an output on for 10s and then switch it off.

8. Devise a circuit that can be used to start a motor and then after a delay of 100s start a pump. When the motor is switched off there should be a delay of 10s before the pump is switched off. 9.Devise a circuit that could be used to start with a domestic washing machine to switch on a pump to pump water for 100s into the machine, then switch off and switch on a heater for 50s to heat the water. The heater is then switched off and another pump is to empty the water from the machine for 100s.

10. Devise a circuit that could be used with a conveyor belt which is used to move an item to a work station. The presence of the item at the work station is detected by means of breaking a contact activated by a beam of light to a photo sensor. There it stops for 100s for an operation to be carried out before moving on and off the conveyor. The motor for the belt is started by a normally open start switch and stopped by a normally closed switch.

11. How would the timing pattern for the shift register in the figure (a) change if the data output X400 was of the form as shown in fig (b)?

Fig (b)

Fig (a)

12. Explain how a PLC can be used to handle an analog input. 13. Devise a system, using a PLC, which can be used to control the movement of a piston in a cylinder so that when a switch is momentarily pressed, the piston moves in one direction and when a second switch is momentarily pressed the piston moves in the other direction. ( hint: you might consider using a 4/2 solenoid controlled valve).

14. Devise a system, using a PLC, which can be used to control the movement of a piston in a cylinder using a 4/2 solenoid operated pilot valve. The piston is to move in one direction when a proximity sensor at one end of the stroke closes contacts and in the other direction when a proximity sensor at the other end of the stroke indicates the arrival there.

Sign up to vote on this title
UsefulNot useful