plc programming fundamentals
TRANSCRIPT
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
Writing Simple PLC Ladderlogic Programs
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
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
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
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.
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.
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
PLC programming setup
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.
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
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.
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.
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
Creating a flowchart
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
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
Ladder diagram
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
Ladder program execution
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)
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
XIC (Examine if Close)
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
XIO (Examine if Open)
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
OTE (Turn a bit to ‘True’/’False’)
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
OTL (Latch a bit to ‘True’ state)
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
OTU (Latch a bit to ‘False’ state)
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
OSR (One Shot Rising)
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
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.
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
TON (On Delay Timer)
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
TOF (Off Delay Timer)
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
RTO (Retentive Timer)
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).
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.
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
C-UP (Up Counter)
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
C-DN (Down Counter)
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
C-UD (Up-Down Counter)
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.
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
JU (Jump Unconditional)
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).
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.
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
Master Control (MC)
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
Data load and transfer instructions
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.
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.
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
MOVE (MOV)
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.
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
ADDITION (ADD)
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
SUBTRACTION (SUB)
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
MULTIPLICATION (MUL)
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
DIVISION (DIV)
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
System Programming and Implementation
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
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
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.
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
Creating I/O list
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.
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
Typical PLC Hardware configuration
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
I/O addressing
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.
Technology Training that Workswww.idc-online.com/slideshare Technology Training that Workswww.idc-online.com/slideshare
Hot slab rolling process
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