+ All Categories
Home > Technology > Plc Programming Fundamentals

Plc Programming Fundamentals

Date post: 06-May-2015
Category:
Upload: idc-technologies
View: 930 times
Download: 15 times
Share this document with a friend
57
Technology Training that Works www.idc-online.com/slideshare Technology Training that Works www.idc-online.com/slideshare Writing Simple PLC Ladderlogic Programs
Transcript
Page 1: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Writing Simple PLC Ladderlogic Programs

Page 2: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Presented by Doctor Steve Mackay Dean of Engineering

of theEngineering Institute of

Technology

Page 3: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

What you will gain from this presentation

• An understanding of the key elements of ladderlogic programs

• Look at simple programs• Examine design and troubleshooting of a PLC

program

Page 4: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Objectives

In this chapter, the following will be covered:

• Introduction to PLC programming• Types of programming languages• Basic programming instructions• Advanced programming instructions

Page 5: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Introduction Whilst on the subject of PLC programming, an

immediate question that comes to mind, is what components would be need to program a PLC?The following components would be required:• Computer with accessories• Programming softwareJust as tools cannot work alone, the same applies to

PLC applications. Hence, a good knowledge of ‘PLC programming (languages)’ is very necessary.

Page 6: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Computer with accessories

As the programming unit is usually taken near a PLC panel, it is better to choose the PC configuration of industrial type so that it withstands the industrial environment easily. Laptops are also a good option and handy option! A PG-PLC communication cable (along with PG unit) is essential for establishing a physical link between the PG and the PLC.

Page 7: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

PLC programming setup

Page 8: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Programming softwareThe programming software allows the programmer / user to perform

the following functions:

• Develop PLC program in selected programming languages.• Check the PLC program for correctness.• Simulate the PLC program.• Download or transfer the PLC program from the programming unit to

the PLC.• Check status of an Online PLC program, running in PLC CPU.• Modify or change the parameters of a PLC program online.• Check status of a PLC and related I/O modules.• Take backups of the PLC program by transferring program from PLC to

PG unit.

Page 9: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

PLC programming steps

To develop a PLC program for any process or system, simply follow the steps given below:

• Understanding the process and define the control

philosophy• Ensure the preparation of a control strategy• Create a flowchart • Implement the flowchart, using selected

programming languages

Page 10: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Understanding process and defining control philosophy

1. Before developing a PLC program for a particular process, it is very important to first understand the process. Right from program development to commissioning, you will need the knowledge of the process you are dealing with.

2. After doing that, develop a ‘Control Philosophy,’ which defines what needs to be done for achieving process control under process limits and serves as a platform for control program.

3. Since each process has different aspects of engineering, such as operation, electrical, instrumentation, mechanical, chemical, etc., it is important to formulate the ‘Control Philosophy’ jointly with people who know and understand these various aspects.

Page 11: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Preparation of control strategy (algorithm)

Once the ‘Control Philosophy’ is formalized, the programmer can start applying his mind at to how to accomplish the tasks mentioned, in the most optimized manner.

1. Firstly, the ‘Control Philosophy’ task is divided into different groups, by studying the sequence of events that take place / happen in a process.

2. Next, the individual group tasks are further sub-divided into parts and a solution (output results) is sought for all the sections. This is referred to as the process of building an ‘Algorithm’ or control strategy.

3. After building the control strategy for the first time, alternative approaches (to obtain similar output results), should also be considered.

Page 12: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Creating a flowchart

Page 13: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Programming languages

The following languages are available for the programming of an application:

1) Ladder diagram2) Function block diagram3) Instruction list4) Sequential function chart5) Structured text

Page 14: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Ladder diagram

Page 15: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Ladder program execution

Page 16: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Basic logic instructions

These instructions are basically representative of the ON/Off status of the inputs and also for changing the output status. They are also referred as ‘Bit’ type instructions and can be written as follows:

1. XIC (Examine if Close)2. XIO (Examine if Open)3. OTE (Turn a bit to ‘True’/’False’)4. OTL (Latch a bit to ‘True’ state)5. OTU (Latch a bit to ‘False’ state)6. OSR (One Shot Rising)

Page 17: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

XIC (Examine if Close)

Page 18: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

XIO (Examine if Open)

Page 19: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

OTE (Turn a bit to ‘True’/’False’)

Page 20: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

OTL (Latch a bit to ‘True’ state)

Page 21: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

OTU (Latch a bit to ‘False’ state)

Page 22: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

OSR (One Shot Rising)

Page 23: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Timers

Timers and counters are some of the most frequently used instructions in a program. Unfortunately, very few people know about the different type of timers that are available and how these variations actually work.

Once fully understood, they definitely play a vital role in effective programming

Page 24: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Timer related general terms • Timer Address: Each timer is given a unique address in the software.

Timers have an area reserved for them in the memory of your CPU. Generally, PLCs have 128 or 256, or more number of timers available, depending on the PLC’s make.

• Enable: This is a timer input signal that enables the timer. Generally, it is given through an input signal or a bit.

• Preset Time Value: This is the target time by which the event ‘On/Off’ has to be delayed.

• Accumulated Time Value: This shows the current timer value once timer is started.

• Timer Base: This is the value of time (usually indicated in milli-seconds or seconds) by which the timer increments during running.

Page 25: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

TON (On Delay Timer)

Page 26: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

TOF (Off Delay Timer)

Page 27: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

RTO (Retentive Timer)

Page 28: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Counter The Counter is an instruction, which performs the ‘counting pulses of

inputs in a program’.It functions very similarly to hardware timers, from an operation point

of view. It measures the pulses of an input signal and, according to its type of action, is classified as:

• Up Counter (Increments the count on receiving pulse input).• Down Counter (Decrements the count on receiving pulse input).• Up-Down Counter (Increments as well as Decrements the count on

receiving pulse input).

Page 29: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Counter related general terms Counter Address: Each counter is given a unique address in the software. Counters have an area reserved for

them in the memory of the CPU. Generally, PLCs have 128 or 256 or more counters, depending on the PLC manufacturer.

Counter Value: A 16-bit word is reserved for each counter in the system data memory. This is used for storing the counter value (for the counter numbered from 0 to 999) in binary code.

Preset Value: The preset value (0...999) is specified in BCD at the "PV" input, as a constant (C#...)• in BCD format via a data interface.

Count Up: When the RLO (result of logic operation) at the "CU" input changes from "0" to "1", the current counter reading is incremented by 1 (upper limit = 999).

Count Down: When the RLO at the "CD" input changes from "0" to "1", the current counter reading is decremented by 1 (lower limit = 0).

Set Counter: When the RLO at the "S" input changes from "0" to "1", the counter is set to the value at the "CV" input.

Reset Counter: When RLO equals “1” at the ‘Reset Counter’ input, the counter is set to zero. If the Reset condition is still fulfilled, the counter cannot be set and counting is not possible.

Page 30: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

C-UP (Up Counter)

Page 31: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

C-DN (Down Counter)

Page 32: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

C-UD (Up-Down Counter)

Page 33: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Program flow control instructions

The further we delve into a program segment, the more likely it is that we may need to execute an instruction (or a group of instructions) based on certain condition.

That purpose is solved by ‘Program Flow Control’ instructions.These instructions can be classified broadly as per the following

function:

• To control execution of sub-routines within the main program.• To control execution of instructions within sub-routines.

Page 34: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

JU (Jump Unconditional)

Page 35: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

JC (Jump if "RLO" bit =1)

If an un-conditional ‘Jump’ instruction is used, the called set of instructions will execute each time. However, it may not always be necessary to execute the set of instructions each time. To avoid doing this, conditions are formulated for the execution of instructions, and those conditions are grouped together to generate a ‘RLO’ (Result of Logic Operation).

Page 36: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

JCN (Jump if "RLO" bit =0) This is very similar to the conditional jump instruction ‘JC’. The only

difference is that it executes the related block, but only when ‘RLO’ is zero.

If the instruction ‘JCN’ is used in the main program of the example shown in Fig. 8.9, then block (subroutine) PB10 will be executed only when the ‘RLO’ before the ‘JC’ instruction is at logic ‘0’.

If the ‘RLO’ is not at logic ‘0’; then block (subroutine) PB10 will not be processed or executed in that program cycle. The program execution in OB1 (main block) will continue further.

Once again, it must be stressed that ‘RLO’ is the result of logic operations that happened just before ‘JCN’ instruction.

Page 37: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Master Control (MC)

Page 38: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Data load and transfer instructions

Page 39: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

LOAD (LD)

This is a very commonly used instruction for ‘getting’ the data in an accumulator or a temporary storage area.

It is basically used for ‘collecting’ the data from an Input image table (PII), accumulator and data registers. This instruction is used along with the reference of the location from where the data has to be collected.

Page 40: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

TRANSFER (T)

This instruction is used, in conjunction with the ‘LOAD’ instruction, to transfer data collected to another place. It is basically used for ‘transferring’ the data in between the accumulator, data registers and the output image table (PIQ).

Similarly to the ‘LOAD’ instruction, it is also used along with a reference of the location to where the data has to be transferred.

Page 41: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

MOVE (MOV)

Page 42: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Arithmetic or math instructions In general, it will be found that all PLCs makes always include the

following math functions:

• Addition - The capability to add one data register to another. It is commonly called the ‘ADD’ instruction.

• Subtraction - The capability to subtract one data register from another. It is commonly called the ‘SUB’ instruction.

• Multiplication - The capability to multiply one data register with another. It is commonly called the ‘MUL’ instruction.

• Division - The capability to divide one data register into another. It is commonly called the ‘DIV’ instruction.

Page 43: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

ADDITION (ADD)

Page 44: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

SUBTRACTION (SUB)

Page 45: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

MULTIPLICATION (MUL)

Page 46: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

DIVISION (DIV)

Page 47: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

System Programming and Implementation

Page 48: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Objectives

In this chapter, the following topics will be dealt with:

• Introduction to system programming• Formulating I/O list• Developing program• Program testing and simulation

Page 49: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Introduction PLC programming has been dealt with, in detail, in the previous chapter. Attention will

now be focussed on how to perform a PLC project’s system programming, and implement it successfully. To do this in a systematic manner, one needs to understand the following strategies.

• Taking process inputs• Creating I/O list• Deciding hardware configuration of the PLC system• I/O address assignment• Developing program structure• Tips for developing a PLC program• Program verification and simulation• Creating documentation

Page 50: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Taking process inputs While taking process input’s (information), we should get information

about following:

• The battery limits of process we are supposed to control.• Control philosophy and other process related documentation. • Total electrical equipment list with detail specifications.• Total instrument list with detail specifications.• Abnormal conditions for process and individual equipment.• Different operating modes for process and equipment and their

significance.• Physical layout of PLC, operator stations and process.• Specific requirement about voltage levels for field devices.• Elements to be hardwired. • Operator station requirements.

Page 51: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Creating I/O list

Page 52: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Deciding hardware configuration of PLC system

• The following deciding factors should also be taken into consideration while going for PLC configuration:

• Physical layout of process equipment (decides whether to go for local I/Os or remote I/Os).

• Specifications of instruments and other devices.• Nature and volume of process (decides type of CPU and I/Os to be used).• Voltage standards (decides type of modules and PLC interrogation voltages).• Communication requirement of PLC (decides CPU, communication modules,

communication medium).• Future expansion in process (CPU and interface cards should accommodate further

expansion).• Compatibility with operator stations.• Technical competitiveness.• Readily available spares.• After sales technical support.

Page 53: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Typical PLC Hardware configuration

Page 54: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

I/O addressing

Page 55: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Developing program structureTry to focus on individual pieces one by one. Ask the following questions

to yourself:

• What is the physical division of piece of process?• What are the inputs for this piece of process?• What are the outputs for this piece of process?• What other information required?• What is the sequence of operation?

When you start thinking about these questions, keep the piece of process at the centre, and you are gradually moving towards the solution.

Page 56: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare

Hot slab rolling process

Page 57: Plc Programming Fundamentals

Technology Training that Workswww.idc-online.com/slideshare

Thank You For Your Interest

If you are interested in further training, please visit:

IDC Technologies Short Courses:Two-day practical courses available to the public:

http://www.idc-online.com/slideshare


Recommended