This document provides an introduction to programmable logic controllers (PLCs). It discusses the history of process control from manual to hard-wired logic to electronics control. PLCs were developed to provide flexibility through software programming rather than physical wiring. The key components of a PLC system including input modules, the central processing unit (CPU), output modules, and power supply are described. Examples of common PLC vendors and applications in various industries are also provided.
1. 1
A
TRAINING REPORT
On
PLC
Submitted to Kurukshetra University in partial fulfillment of the
requirement for the award of the degree of
B.TECH.
in
ELECTRONICS & COMMUNICATION ENGINEERING
Submitted By
ABHISHEK ATTRI 4109203
ASHU DHIMAN 4109217
DEPTT. OF ELECTRONICS & COMMUNICATION ENGINEERING
YAMUNA INSTITUTE OF ENGINEERING & TECHNOLOGY
GADHOLI, YAMUNANAGAR-135003
2012-13
2. 2
LIST OF CONTENTS
Title Page No.
CHAPTER-1 INTRODUCTION TO PROGRAMMABLE LOGIC CTRL 1-14
1.1 Process Control 1
1.2 Automation 1
1.3 History of Process Control and Automation 3
1.3.1 Manual Control 3
1.3.2 Hard Wired Logic Control 3
1.3.3 Electronics Control 3
1.4 Programmable Logic Controller 4
1.5 Advantages of PLC 5
1.6 Application of PLC Systems 6
1.7 PLC System of Various Vendors 7
1.8 Building Blocks of PLC System 8
1.9 Functions of Various Blocks 9
1.10 Working of Plc 11
CHAPTER-2 TERMINOLOGY & S7-200 MICRO/WIN PLC BASICS 15-21
2.1 Terminology 15
2.1.1 Discrete Inputs and Outputs 15
2.1.2 Analog Inputs and Outputs 16
2.2 S7 Micro PLCs 17
2.2.1 S7-200 Features 19
2.2.2 Power Sources 19
2.2.3 Expansion Modules 21
CHAPTER-3 PROGRAMMING A PLC 22-48
3.1 Step 7-Micro/WIN 22
3.2 Step 7-Micro/WIN Window Components 22
3.2.1 Instruction Tree 24
3.2.2 Status Chart 25
3.2.3 Example of Status Chart 25
3.3 Program Editor Window 27
3.4 Comparison of Editors: LAD, FBD, STL 29
3. 3
3.4.1 Ladder Logic Editor 30
3.5 Simatic Lad Instructions: 33
3.5.1 Simatic Lad Bit Logic Instructions 33
3.5.2 Simatic Lad Timer Instructions: 39
3.5.3 Simatic Lad Counter Instructions 42
3.6 Analog Inputs and Outputs 47
CHAPTER-4 CASE STUDY OF PLCs 49-52
4.1 Case Study 1 49
4.2 Case Study 2 50
4.3 Case Study 3 52
BIBLIOGRAPHY 53
4. 4
LIST OF FIGURES
Title Page No.
Figure 1.1 Process control 1
Figure 1.2 History of Control Process 2
Figure 1.3 Shows PLc 4
Figure 1.4 Siemens PLC 7
Figure 1.5 Modicon PLC 7
Figure 1.6 Ge Fanuc PLC 8
Figure 1.7 Building block of PLC 9
Figure 1.8 Example of PLC 11
Figure 1.9 Shows Input Signal 12
Figure 1.10 Processing of signals 13
Figure 1.11 Storing of Results 13
Figure 1.12 Sending Process 14
Figure 2.1 Discrete Input to PLC 15
Figure 2.2 Analog Input to PLC 16
Figure 2.3 CPU 17
Figure 2.4 PLC Scan 17
Figure 2.5 Basic Requirements 18
Figure 2.6 S7 MICRO PLC 18
Figure 2.7 Power Supply 20
Figure 2.8 Mode Switch and Adjustment 20
Figure 2.9 Optional Cartridges 21
Figure 2.10 Input and Output Devices 21
Figure 2.11 Expansion Modules 21
Figure 3.1 NO& NC 34
Figure 3.2 Output bit Logic 35
Figure 3.3 Set-Reset Bit Logic 36
Figure 3.4 Set-Reset 38
Figure 3.5 ON Delay Timer 39
Figure 3.6 OFF Delay Timer 40
Figure 3.7 On-Delay Timer Retentive 41
Figure 3.8 UP-Counter 42
6. 6
LIST OF TABLES
Title Page No.
Table 2.1 Model Description 19
Table 2.2 Features of S7-200 19
Table 3.1 Timer Type 39
7. 7
PREFACE
Training is an integral part of B.Tech and each and every student has to undergo the training for
6 weeks in a company.
This record is concerned about our practical training during the Summer Vacations of 4th
year.
We have taken our Practical training in PLC FROM INDUSTRIAL AUTOMATION
TRAINING CENTRE , PANCHKULA. during this training; we got to learn many new things
about the industry and the current requirements of companies. This training proved to be a
milestone in our knowledge of present industry. Every say and every moment was an experience
in itself, an experience which theoretical study can’t provide.
8. 8
ACKNOWLEDGEMENT
It is my pleasure to be indebted to various people, who directly or indirectly contributed in the
development of this work and who influenced my thinking, behavior and acts during the course
of study.
I express my sincere gratitude to Dr. Rajiv Khanduja worthy Principal for providing me an
opportunity to undergo summer training at INDUSTRIAL AUTOMATION TRAINING
CENTRE , PANCHKULA
I am thankful to Er. Manpreet Singh, H.O.D., ECE Deptt. for his support, cooperation, and
motivation provided to me during for constant inspiration, presence and blessings.
I also extend my sincere appreciation to Er. Sunil Panjeta, Coordinator who provided his
valuable suggestions and precious time in accomplishing my training report.
ABHISHEK ATTRI : 4109203
ASHU DHIMAN : 4109217
9. 9
DECLARATION
We, ABHISHEK ATTRI: 4109203, ASHU DHIMAN: 4109217, B.Tech (Semester- VII) of the Yamuna
Institute of Engg. & Technology, Gadholi (Yamuna Nagar) hereby declare that the Training Report
entitled “Programmable Logic Controler (PLC) ” is an original work and data provided in the study is
authentic to the best of my knowledge. This report has not been submitted to any other Institute for
the award of any other degree.
PLACE ABHISHEK ATTRI : 4109203
DATE ASHU DHIMAN: 4109217
This is to certify that above statement made by the candidate is correct to the best of my knowledge.
Approved by:
Er. Sunil Panjeta Er. Manpreet Singh
( Coordinator ) ( H.O.D., ECE Deptt. )
11. 11
CHAPTER 1
INTRODUCTION TO PROGRAMMABLE LOGIC
CONTROLLER
1.1 PROCESS CONTROL
The process of recognizing the state of the process at all times, analysis the information according
to the set rules and guidelines and accordingly actuate the control elements is referred to as
process control.
Figure 1.1 Process control
In the control of process all these actions can be taken manually with human involvement or in
semiautomatic or fully automatic manner.
1.2 AUTOMATION
Automation is basically the delegation of human control functions to technical equipment aimed
towards achieving
Higher productivity
Increase quality of end product
Efficient usage of energy and raw material
Improved safety in working conditions………….etc.
Automation is encompassing virtually every walk of life from agriculture to space technology.
Recognizing the status Process the
information
Actuate the control
elements
Rules and guidelines
13. 13
1.3 HISTORY OF PROCESS CONTROL AND AUTOMATION
The various methods adopted for process control and automation are as follows:
1.3.1 MANUAL CONTROL
1. In this all the actions related to process control and automation are taken care by operators.
2. One of the major drawbacks of this method is the likely human errors and consequently its
effects on final product.
3. The manual control has its own limitations with regards to mass production techniques and
hence this method cannot provide the consumer with quality goods at an affordable price. The
safety or efficient use of raw material and energy are all subject to the correctness and accuracy
of human action.
1.3.2 HARD WIRED LOGIC CONTROL
This was considered to be the first step towards automation.
Here the contractor and relays together with timers and counters were used in achieving the
desired level of automation.
Although this method served the purpose of many year, it had certain limitations as listed
below
Bulky and complex wiring
Involves lot of rework to implement change in control logic.
The work can be started only when the task is full defined and this leads to longer
project time…………….etc.
1.3.3 ELECTRONICS CONTROL
With the advent of electronics, the logic gates started replacing the relays and contractors in
the control circuits.
The motorized timers were replaced by electronics timers…..etc.
With incorporation of these changes we got the benefits of
Reduce space requirements
Energy saving
Less maintenance and hence greater reliability….etc
However even with electronics, the implementation of changes in the control logic as well as
reducing the project time was not possible.
14. 14
This method of control and automation was also popular for quite some time.
1.4 PROGRAMMABLE LOGIC CONTROLLER
With the coming of microprocessor and associated peripheral chips, the whole process of
control and automation underwent a radical change.
Instead of achieving the desired control or automation through physical wiring of control
devices, in PLC it is achieved through program o say software.
As the desired logic control is achieved through a ‘program’, these controllers are referred to
as Programmable Logic Controllers.
The programmer controllers have in recent years experienced an unprecedented growth as
universal element in industrial automation. It can be effectively used in applications ranging
from simple control like replacing small number of relays to complex automation problem.
The important advantages listed in the following points will explain the reasons for the
popularity of PLCs in control and automation tasks.
Figure 1.3 shows PLc
1.5 ADVANTAGES OF PLC:
1. Reduced Space
15. 15
PLCs are fully solid state and hence extremely compact as compared to hard-wired
controller where in electromechanical devices are used.
2. Energy saving
Average power consumption is just 1/10th
of power consumed by an equivalent relay logic
control
3. Ease of maintenance
Modular replacement
Easy trouble shooting
Error diagnostics with programming unit.
4. Economical
Considering one time investment: PLC is most economical system.
Cost of PLC recovers with in a short period(Low pay back period).
5. Greater Life and Reliability
Static devices hence lesser number of parts, reduces wear and tear.
In the case of hard-wired logic, the control hardware is either electromechanical or
pneumatic and therefore it is more prone to faults due to wear and tear of moving parts
resulting in lesser ON TIME of system.
6. Tremendous Flexibility
To implement changes in control logic no rewiring is required so considerable time is
saved.
PLC can carry out complex functions such as generation of time delays.
“ON line” (i.e. without disturbing the process) as well as “off line” programming is
possible.
High processing speed and great flexibility in the processing of both analog and digital
signals
7. Shorter Project Time
16. 16
The hard wired control system can be constructed only after the task is fully defined. In the PLC,
however, the construction of the controller and wiring are independent of control program
definition. This means that the total hardware is standard and desired control is achieved through
program.
8. Easier storage Archiving and Documentation
This is due to its compatibility with PC-AT, Printer and Floppy Disk…….etc
1.6 Application of PLC Systems
In Industry, there are many production tasks which are of highly repetitive nature. Although
repetitive and monotonous, each stage needs careful attention of operator to ensure good
quality of final product.
Many times, a closed supervision of processes cause high fatigue on operator resulting in loss
of track of process control.
Sometimes it is hazardous also as in the case of potentially explosive chemical processes.
Under all such conditions we can use PLCs effectively in totally eliminating the possibilities
of human error.
Some of the capabilities of PLC are as follows;
Logic control
Coordination and communication
Operator control
Signaling and listing…….etc.
In short, whenever sequential logic control and automation is desired the PLCs are best suited
to meet the task. It includes simple interlocking functions to complicated analog signal
processing to PID control action in closed loop control etc.
Few example of industries where PLCs are used for control and automation purpose are listed
below:
Tyre industry, Blender reclaimer, Bulk material handling system at ports, ship unloaded, Wagon
loaders, Steel plants, Blast furnace charging, Brick molding press in refractories, Galvanizing
plant, Diary automation, Pulp factory, Printing industry……..etc.
17. 17
Today the PLCs are used for control and automation job in single machine and it increases up to
full automation of manufacturing/testing process in a factory.
1.7 PLC SYSTEM OF VARIOUS VENDORS:
SIEMENS
S7-200,300,400 & 1200
Figure 1.4 Siemens PLC
ALLEN BRADLY
Micrologix 1000,1200,1500
SLC s101, s102, s103
ABB
MODICON
Nano micro premium quantum
Figure 1.5 Modicon PLC
18. 18
GE FANUC PLC
Figure 1.6 GE FANUC PLC
1.8 BUILDING BLOCKS OF PLC SYSTEM
The PLC is basically a programmed interface between the field input elements like limit
switches, sensors, transducers, push buttons etc and the final control elements like solenoid
valves, dampers, drivers, LEDs, hooters etc.
This interface called as Programmable Logic Controller consists of the following
1. Input modules
2. CPU with processor and Program memory
3. Output module
4. Bus system
5. Power supply
19. 19
Figure 1.7 Building block of PLC
1.9 FUNCTIONS OF VARIOUS BLOCKS
Input Modules
The input module act as an interface between the field control inputs and the CPU.
The voltage or current signals generated by the sensors, transducers, limit, switches, push
button etc are applied to the terminals of the input module.
The input module helps in the following way:
It converts the field signal into the standard control signal for processing by PLC.
The standard control signal delivered by input module could be 5v or 9v whereas
the field signal received by it, could be 24V DC, 230V AC or 115V AC.
If required, it isolates the field signal from the CPU.
It sends one input at a time to CPU by multiplexing action.
Depending upon the nature of input signal coming from the field the input module could be:
Analog input module
Digital input module
The typical analog current input module 4-20 mA and analog voltage input module is 0-
10V.
The typical digital input modules are 24V DC, 115V AC and 230V AC.
CENTRAL PROCESSING UNIT
20. 20
The Central Processing Unit or CPU consist of the following blocks:
Arithmetic Logic Unit (ALU)
Program memory
Process image memory (i.e. internal memory of CPU)
Internal timers and counters
Flags.
The heart of CPU is its microprocessor/microcontroller chip.
The working of CPU is fully controlled by the instructions/ program stored in ‘user program
memory’.
The user program directs and control the CPU’s working.
This program is prepared by the user based on the control logic required for the control and
automation tasks.
ARTHEMATIC LOGIC UNIT (ALU)
ALU is the “organizer” of the PLC.
The following operations are carried out by ALU:
It organizes the input of external signals and data.
It performs logic operation with data.
It performs calculation.
It organize the output of the result.
OUTPUT MODULE
The output module act as a link between the CPU and the output devices located in the field.
The field device could be relays, contactors, lamps, motorized potentiometers, actuators,
solenoid valves, dampers etc. these devices actually control the process.
The output module converts the output signal delivered by CPU into an appropriate voltage
level suitable for the output field device.
Thus the output module on receiving signal from the processor switches voltage to the
respective output terminals.
Like input module output module could be analog or digital.
BUS SYSTEM
21. 21
Bus system is a path for the transmission of signals. In the programmable controller, it is
responsible for signal exchange between processor and input/outpt modules.
The bus comprises of several signal lines.
There are three buses in PLC:
Address bus which enables the selection of memory location
Data bus which carries the data from module to processor and vice versa.
Control bus which transfer control and training signal.
POWER SUPPLY
The power supply module generates the voltages required for the electronic module of the
PLC from the main supply.
In the simple example shown below, pushbuttons (sensors) connected to PLC inputs are
used to start and stop a motor connected to a PLC output through a motor starter (actuator).
No programming device or operator interface are shown in this simple example.
Figure 1.8 Example of PLC
1.10 WORKING OF PLC
Bringing input signal status to the internal memory of CPU.
As mentioned earlier, the field signal are connected to the input module. At the output of input
module the field status converted into the voltage level required by the CPU is always available.
At the beginning of each cycle the CPU brings in all the field input signals from input module
and stores into its internal memory as process image of input signal. This internal memory of the
CPU is called PII, means Process Image Input.
22. 22
The programmable controller operates cyclically meaning when complete program has been
scanned; it starts again at the beginning of the program.
Figure 1.9 shows input signal
Processing of signal using Program
Once the field input status is brought into the internal memory of CPU i.e. in PII, the execution
of user program begins, statement by statement. Based on the user program the CPU performs
logical and arithmetical operations on the data from PII. It also processes times and counters as
well as flag states.
Field
Signal
s
INPUT
MODULE
CPU
PII PIQ
I/O BUS
INTERNAL
TIMERS
INTERNAL
23. 23
Figure 1.10 Processing of signals
Storing the results of processing in the internal memory
The result of the user program scan are then stored in the internal memory of CPU. This internal
memory is called Process Output Image.
Figure 1.11 Storing of results
Sending process output image to output module
At the end of the program run i.e. at the end of scanning cycle, the CPU transfers the signal states
in the process image output to the output module and further to field controls.
CPU
PII PIQ
CPU
PII PIQ
CPU
PII PIQ
OUTPUT
MODULE
Field
Signal
s
26. 26
CHAPTER 2
TERMINOLOGY AND S7-200 MICRO/WIN PLC BASICS
2.1 Terminology
Developing an understanding of PLCs requires learning some basic terminology. This section
provides an overview of commonly used PLC terms, beginning with the terms sensor
and actuator.
Sensors are devices that convert a physical condition into an electrical signal for use by a
controller, such as a PLC. Sensors are connected to the input of a PLC. A pushbutton is one
example of a sensor that is often connected to a PLC input. An electrical signal indicating the
condition (open or closed) of the pushbutton contacts is sent from the pushbutton to the PLC.
Actuators are devices that convert an electrical signal from a controller, such as a PLC, into a
physical condition. Actuators are connected to the PLC output. A motor starter is one example
of an actuator that is often connected to a PLC output. Depending on the status of the PLC output,
the motor starter either provides power to the motor or prevents power
from flowing to the motor.
Figure 2.1 Discrete Input to PLC
2.1.1 Discrete Inputs and Outputs
Discrete inputs and outputs, also referred to as digital inputs and outputs, are either on or off.
Pushbuttons, toggle switches, limit switches, proximity switches, and relay contacts are examples
of devices often connected to PLC discrete inputs. Solenoids, relay and contactor coils, and
indicator lamps are examples of devices often connected to PLC discrete outputs. In the on
condition, a discrete input or output is represented internal to the PLC as a logic 1. In the off
condition, a discrete input or output is represented as a logic 0.
27. 27
2.1.2 Analog Inputs and Outputs
Analog inputs and outputs are continuous, variable signals. Typical analog signals vary from 0
to 20 milliamps, 4 to 20 milliamps, or 0 to 10 volts. In the following example, a level transmitter
monitors the level of liquid in a storage tank and sends an analog signal to a PLC input. An
analog output from the PLC sends an analog signal to a panel meter calibrated to show the .level
of liquid in the tank. Two other analog outputs, not shown here, are connected to current-to-
pneumatic transducers that control air-operated flow control valves. This allows the PLC to
automatically control the flow of liquid into and out of the storage tank
Figure 2.2 Analog Input to PLC
CPU
The central processor unit (CPU) is a microprocessor system that contains the system memory
and is the PLC’s decisionmaking unit. The CPU monitors inputs, outputs, and other
variables and makes decisions based on instructions held in its program memory.
Figure 2.3 CPU
28. 28
PLC Scan
The PLC program is executed as part of a repetitive process referred to as a scan. A PLC scan
starts with the CPU reading the status of inputs. Next, the application program is executed. Then,
the CPU performs internal diagnostics and communication tasks. Finally, the CPU updates the
status of outputs. This process repeats as long as the CPU in the run mode. The time required to
complete a scan depends on the size of the program, the number of I/Os, and the amount of
communication required.
Figure 2.4 PLC Scan
Basic Requirements
Throughout this course we will be using the S7-200 PLC for specific examples of PLC concepts.
The S7-200 PLC is used for this purpose because of its ease of use and wide-spread
application. The items shown in the following illustration are needed to create or change an S7-
200 PLC program. The program is created using STEP 7-Micro/WIN programming software,
which runs on a Windows-based personal computer (Win2000, Windows XP, and higher
operating system). A special cable is needed when a personal computer is used as
a programming device. Two versions of this cable are available. One version, called an RS-
232/PPI Multi-Master Cable, connects a personal computer’s RS-232 interface to the PLC’s
RS-485 connector. The other version, called a USB/PPI Multi- Master Cable, connects a personal
computer’s USB interface to the PLC’s RS-485 connector.
SF/DIAG
29. 29
Figure 2.5 Basic Requirements
2.2 S7 MICRO PLCs
The s7-200 micro PLCs is the smallest member of the SIMATIC S7 family of programmable
controllers. The central processing unit (CPU) is internal to the PLC. Input and output (i/o) are
the system control points. Input monitor field devices, such as switches and sensors. Output
control other devices, such as motors and pumps. The programming port is the connection to the
programming device.
Figure 2.6 S7 MICRO PLC
MODELS: There are four S7-200 CPU types: S7-221, S7-222, S7-224, S7-226, AND S7-226XM
and three power supply configurations for each type.
30. 30
Table 2.1 Model Description
The model description indicates the type of CPU, the power supply, the type of input, and the
type of output.
2.2.1 S7-200 Features The S7-200 family includes a range of CPUs which provide a variety of
features to aid in designing a cost-effective automation solution. The accompanying table
provides a summary of the major features, many of which are covered in this report.
Table 2.2 Features of S7-200
2.2.2 Power Sources Depending on the CPU model, an S7-200 CPU is powered from either a
24 VDC or a 120 to 240 VAC power supply. For example, an CPU 221 DC/DC/DC model is
powered from a 24 VDC power supply and a CPU 222 AC/DC/Relay model is powered from a
120 or 240 VAC power supply.
31. 31
Figure 2.7 Power Supply
Mode Switch and Analog
Each S7-200 CPU has a mode switch with three positions, Adjustment RUN, STOP, and
TERM. When the mode switch is in the RUN position, the CPU is in the RUN mode and
executing the program, unless a fault has occurred. When the mode switch is in the STOP
position, the CPU is in the STOP mode and not executing the user program. When the mode
switch is in the TERM position, the programming device can select the operating mode.
Figure 2.8 Mode Switch and Adjustment
Optional Cartridges
S7-200 CPUs support an optional memory cartridge that provides portable EEPROM storage
for the user program. The cartridge can be used to copy a program from one S7-200 PLC to a
like S7-200 PLC. Two memory cartridge sizes are available,
32. 32
64k and 256k bytes.
Figure 2.9 Optional Cartridges
Inputs and Outputs
Input devices, such as switches, pushbuttons, and other sensors are connected to the terminal
strip under the bottom cover of the PLC.
Figure 2.10 Input and Output Devices
2.2.3 Expansion Modules S7-200 PLCs are expandable by adding expansion modules.
Expansion modules with inputs and/or outputs are connected to the base unit using a ribbon
connector.
Figure 2.11 Expansion Modules
34. 34
CHAPTER 3
PROGRAMMING A PLC
3.1 STEP 7-Micro/WIN
STEP 7-Micro/WIN is the software used with the S7-200 PLC to create a user program. STEP
7-Micro/WIN programs consist of a number of instructions that must be arranged in a logical
order to obtain the desired PLC operation. STEP 7-MicroWIN programming software can be run
off line or online. Off-line programming allows the user to edit the program and perform a
number of maintenance tasks. The PLC does not need to be connected to the programming device
inthis mode.
3.2 STEP 7-Micro/WIN Window Components
Navigation Bar Presents groups of pushbutton controls for programming features:
35. 35
"View"—selects this category to display pushbutton controls for the Program Block, Symbol
Table, Status Chart, Data Block, System Block, Cross Reference, and Communications.
"Tools"—select this category to display pushbutton controls for the Instruction Wizard, Text
Display Wizard, Position Control Wizard, EM 253 Control Panel, and the Modem Expansion
Wizard.
3.2.1 INSTRUCTION TREE
37. 37
Window allows you to track the status of program inputs, outputs, or variables by putting them
into the chart. You can create multiple status charts in order to view elements from different
portions of your program. Each status chart has its own tab in the Status Chart window.
Chart Status Displays status data in a table: Each row specifies a PLC data vlaue to monitor.
You assign a memory address, format, current value, and new value (if using the write
command).
Click on the Status Chart button on the Navigation Bar.
Select the View>Component>Status Chart menu command.
Open the Status Chart Folder in the Instruction Tree , then double click on a Chart icon.
3.2.3 Example of status chart:
Opening a status chart window is not the same thing as turning one on. You can open a chart to
edit or examine it, but unless you issue a Single Read command (from the Debug menu or
toolbar) or turn on Chart Status (from the Debug menu or toolbar) no status information is
displayed in the Current Value column.
When you use the Single Read feature (available only when Chart Status is turned off) to examine
a status chart, the current values from the PLC are collected and displayed in the Current Value
column, but they are not updated as the PLC executes your program. When you turn on Chart
Status (from the Debug menu bar or toolbar), the current values from the PLC are collected on a
continuous loop basis.
When changes are received from the PLC, the Current Value column is updated. You can use
the New Value column to assign (write or force) a value that you specify. If the New Value field
is empty and a value exists in the Current Value field, then the current value is forced.
38. 38
Building a Chart
In a status chart, you can enter addresses or defined symbol names to monitor or modify values
from your program. Timer and counter values can be displayed as either bits or words. If you
display a timer or counter value as a bit, the output status is displayed (output on or off). If you
display a timer or counter value as a word, the current value is used.
To build a status chart, follow these steps.
Enter the address (or symbol name) for each desired value in the Address field. Most of
the memory types listed in PLC Memory Address Ranges are valid, with the exception
of Data Constants, Accumulators, and High-Speed Counters. To edit an address cell use
the arrow keys or mouse to select the cell that you want to edit.
If you begin typing, the field clears and the new characters are entered.
If you click the mouse or press the "F2" key, the field becomes highlighted and you can
use the arrow keys to move the editing cursor to the place that you want to edit.
OR
Highlight a section of program code, right-click to bring up a pop-up menu, and choose the
command Create Status Chart. The new chart contains an entry for each unique operand in the
selected region for which status can be gathered. The entries are placed in the order of their
39. 39
occurrence in the program, and the chart is given a default name. The new chart is added after
the last tab in the status chart editor.
If the element is a bit (I, Q, or M, for example), the format is set as bit in the Format column. If
the element is a byte, word, or double word, select the cell in the Format column and double-
click or press the SPACEBAR or ENTER key to cycle through the valid formats until the
appropriate one is displayed.
To insert an additional row, use the Edit menu or right-click on a cell in the Status Chart to bring
up a pop-up menu, and choose the menu command Insert>Row. The new row is inserted above
the current location of the cursor in the Status Chart. You can also place the cursor in any cell of
the last row and press the DOWN ARROW key to insert a row at the bottom of the Status Chart.
3.3 Program Editor Window
Contains the Local Variable Table and the program view for the editor (LAD, FBD, or STL) that
you are using for this project. You can drag the split bar to expand the program view and cover
up the Local Variable Table if desired. When you create subroutines or interrupt routines in
addition to the main program section (OB1), tabs appear at the bottom of the program editor
window. You can click on the tabs to move between the subroutines, interrupts, and OB1.
The Program Editor Window includes the following components:
40. 40
Gutter
The gutter is the gray area located on the left side of the program editor window that displays the
following margin indicators.
Ruler
The ruler is displayed at the top of the program editor window and shows the width of the print
area using the current page setup. The ruler can display either Metric or English units depending
on the regional settings.
POU Comments
The POU comments are displayed before the first network in the POU and provide additional
capability for detailed POU comments. You can have a maximum of 4096 characters for each
POU comment.
Network Number
The network number is used to define the individual networks. Numbering is automatic and
ranges from 1 to 65536 (max. WORD size). You can change the font size and style.
Network Title
The network title is displayed next to the network keyword and number. You can have a
maximum of 256 characters for each title.
41. 41
Network Comments
The network comments are displayed under the network title and provide the additional
capability for detailed network comments. You can have a maximum of 4096 characters for each
network comment.
3.4 Comparison of Editors: LAD, FBD, STL
The SIMATIC S7-200 CPUs offer many types of instructions that allow you to solve a wide
variety of automation tasks. There are two basic instruction sets available in the S7-200 CPU:
SIMATIC
IEC 1131-3
STEP 7-Micro/WIN provides different editor choices that allow you to create control programs
with these instructions.
The type of editor that is best for your programming needs (Statement List, Ladder Logic, or
Function Block Diagram)
The following instruction set and editor combinations are possible:
SIMATIC instruction set with LAD, FBD, or STL editor
This topic describes the three program editors:
Ladder Logic
Function Block Diagram
Statement List
But in this we have only use ladder logic and explain only the Ladder Logic because rest of the
two languages are used in the higher level in modern industries.
42. 42
3.4.1 Ladder Logic Editor
The STEP 7-Micro/WIN Ladder Logic (LAD) editor allows you to build programs that resemble
an electrical wiring diagram. Ladder programming is the method of choice for many PLC
programmers and maintenance personnel; it is an excellent language for beginning programmers.
The ladder programs allow the CPU to emulate the flow of electric current from a power source
through a series of logical input conditions that in turn enable logical output conditions. The logic
is separated into networks. The program is executed as dictated by the program, one network at
a time, from left to right and then top to bottom. Once the CPU has reached the end of the
program, it starts over again at the top of the program.
The figure below shows an example of a ladder program.
Contacts – represent logic input conditions analogous to switches, buttons, internal conditions
and so on.
Coils – usually represent logic output results analogous to lamps, motor starters, interposing
relays, internal output conditions and so on.
Boxes – represent additional instructions such as timers, counters, or math instructions.
43. 43
The main points to consider when you select the LAD editor are:
·Ladder logic is easy for beginning programmers to use.
·Graphical representation is often 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.
Menu Bar Allows you to perform operations using either a mouse or keystrokes. You can
customize the Tools menu to add your own tools.
Toolbars Provides easy mouse access to the most commonly used STEP 7-Micro/WIN
operations. You can customize the content and appearance of each of the toolbars.
44. 44
Upload (File > Upload)
Use one of the following methods to upload project components from the PLC to a STEP 7-
Micro/WIN program editor:
Click the Upload button.
Select the menu command File > Upload.
Press the shortcut key combination CTRL+U.
To upload (PLC to Editor), PLC communication must be operating properly. Make sure your
network hardware and PLC connector cable are working. Select the blocks you want (Program
Block, Data Block, or System Block). The program components you select for uploading are
copied from the PLC to the currently open project. You can then save the uploaded program.
Click the Options button to display and set download options. The Upload Download Manager
window helps you control the Upload, Download, Clear, and Program Memory cartridge
operations.
46. 46
1.) Standard Contact Bit Logic:
figure 3.1 NO& NC
One of the most confusing aspects of PLC programming for first-time users is the relationship
between the device that controls a status bit and the programming function that usesa status bit.
Two of the most common programming functions are the normally open (NO) contact and the
normally closed (NC) contact.
The Normally Open contact is closed (on) when the bit is equal to 1.
The Normally Closed contact is closed (on) when the bit is equal to 0.
2.) Push Button:
Push button means when we have press the button then output (lamp) will glow and if we release
the button remain glow is called push button.
EXAMPLE:
1. Lamp should glow when ON push button is pressed and it should remain in ON condition even
if push-button is released.
2. Lamp should go OFF when the OFF push-button is pressed and it should remain in OFF condition
even when pressure is released.
3. Lamp should remain OFF when both the ON and OFF push button are pressured simultaneously.
47. 47
3.) Output Bit Logic:
Coils represent relays that are energized when power flows to them. When a coil is energized, it
causes a corresponding output to turn on by changing the state of the status bit controlling that
output to 1. That same output status bit may be used to control normally open and normally
closed contacts elsewhere in the program.
Figure 3.2 Output bit logic
EXAMPLE:
48. 48
4.) Set, Reset (N Bits) Bit Logic
The Set (S) and Reset (R) instructions set (turn on) or reset (turn off) the specified number of
points (N), starting at the specified address (Bit). You can set or reset from 1 to 255 points.
Figure 3.3 Set-Reset bit logic
49. 49
5.) SET-RESET (SR)
The Set Dominant Bistable (SR) is a latch where the set dominates. If the set (S1) and reset (R)
signals are both true, the output (OUT) will be true. The Bit parameter specifies the Boolean
parameter that is set or reset. The optional output reflects the signal state of the bit parameter.
The following is a Truth Table for the Set Dominant Bi stable Instruction:
Instruction S1 R OUT
SR 0 0 Previous state
0 1 0
1 0 1
50. 50
1 1 1
In this case set has the priority.
Figure 3.4 Set-Reset
EXAMPLE :
Lamp should glow when the set switch is made ON and it should remain in glowing condition
even when the switch is made off.
Lamp should go OFF when the Reset Switch is made ON and it should remain in off condition
even when the Reset Switch is made OFF.
Lamp should glow when both the set and reset switches are made ON simultaneously.
3.5.2 SIMATIC LAD Timer Instructions:
51. 51
1,) On-Delay Timer Timers
The On-Delay Timer (TON) instruction counts time when the enabling input is ON. When the
current value (Txxx) is greater than or equal to the preset time (PT), the timer bit is ON. The On-
Delay timer current value is cleared when the enabling input is OFF.This timer continues
counting after the Preset is reached, and it stops counting at the maximum value of 32767.TON,
TONR, and TOF timers are available in three resolutions. The resolution is determined by the
timer number as shown in the chart below. Each count of the current value is a multiple of the
time base.
Figure 3.5 ON Delay Timer
Table 3.1 Timer Type
EXAMPLE:
Lamp should glow when start switch S1 is made ON.
Lamp should not remain in glowing condition longer than 15 second.
52. 52
Lamp should go off immediately when start switch s1 is made off or reset switch S2 is made ON
even before the expiry of 15 second time.
2.) Off-Delay Timer
The Off-Delay Timer (TOF) is used to delay turning an output OFF for a fixed period of time
after the input turns OFF. When the enabling input turns ON, the timer bit turns ON immediately,
and the current value is set to 0. When the input turns OFF, the timer counts until the elapsed
time reaches the preset time. When the preset is reached, the timer bit turns OFF and the current
value stops counting. If the input is OFF for a time shorter than the preset value, the timer bit
remains ON. The TOF instruction must see an ON to OFF transition to begin counting.If the TOF
timer is inside an SCR region and the SCR region is inactive, then the current value is set to 0,
the timer bit is turned OFF, and the current value does not count.TON, TONR, and TOF timers
are available in three resolutions. The resolution is determined by the timer number as shown in
the chart below. Each count of the current value is a multiple of the time base. For example, a
count of 50 on a 10-ms timer represents 500 ms.
Figure 3.6 OFF Delay Timer
53. 53
3.) On-Delay Timer Retentive
The Retentive On-Delay Timer (TONR) instruction counts time when the enabling input is ON.
When the current value (Txxx) is greater than or equal to the preset time (PT), the timer bit is
ON.The current value of the Retentive On-Delay timer is maintained when the input is OFF. You
can use the Retentive On-Delay timer to accumulate time for multiple periods of the input ON.
A Reset instruction (R) is used to clear the current value of the Retentive On-Delay timer.This
timer continues counting after the Preset is reached, and it stops counting at the maximum value
of 32767.
Figure 3.7 On-Delay Timer Retentive
EXAMPLE:
Lamp should glow after a delay of 25 sec when start switch S1 is made ON and Should remain
in glowing condition even the switch s1 is made off.
Lamp should go off immediately when reset switch s2 is made ON.
54. 54
3.5.3 SIMATIC LAD Counter Instructions
1.) Up Counter
The Count Up (CTU) instruction counts up from the current value each time the count-up input
CU makes the transition from off to on. When the current value (Cxxx) is greater than or equal
to the Preset Value (PV), the counter bit (Cxxx) turns on. The counter is reset when the Reset
(R) input turns on, or when the Reset instruction is executed. The counter stops counting when
it reaches the maximum value (32,767).Counter ranges: Cxxx=C0 through C255
Figure 3.8 UP-Counter
55. 55
4.) Down Counter
The Count Down (CTD) instruction counts down from the current value of that counter each time
the count down input CD makes the transition from off to on. When the current value Cxxx is
equal to zero, the counter bit (Cxxx) turns on. The counter resets the counter bit (Cxxx) and loads
the current value with the preset value (PV) when the load input (LD) turns on. The Down
Counter stops counting when it reaches zero, and the counter bit Cxxx turns on.Counter ranges:
Cxxx=C0 through C255
Figure 3.9 Down counter
EXAMPLE:
1. A Solenoid S, is to go ON when count C goes up to 22, and when count D goes down from 37 to
0 and when E goes up to 8. Furthermore, if count F goes down from 17 to 0 at any time, the
solenoid is to be kept from operating, one stop button reset the entire PROCESS, including the
solenoid being OFF.
57. 57
4.) Up/Down Counter
Figure 3.10 UP-Down Counter
The Count Up/Down (CTUD) instruction counts up each time the count-up input CU makes the
transition from off to on, and counts down each time the count-down input CD makes the
transition from off to on. The current value Cxx of the counter maintains the current count. The
preset value PV is compared to the current value each time the counter instruction is executed.
Upon reaching maximum value (32,767), the next rising edge at the count-UP input causes the
current count to wrap around to the minimum value (-32,768). On reaching the minimum value
(-32,768), the next rising edge at the count-DOWN input causes the current count to wrap around
to the maximum value (32,767).When the current value Cxx is greater than or equal to the preset
value PV, the counter bit Cxx turns on. Otherwise, the counter bit turns off. The counter is reset
when the Reset (R) input turns on, or when the Reset instruction is executed. The CTUD counter
stops counting when it reaches PV. Counter ranges: Cxxx=C0 through C255
EXAMPLE:
1. Use input-0 to count-up a counter C1 and count-down C1 using input-1, when the counter value
is more than 10, output should get ON and if the value is less than 10, it should get OFF, reset
the counter using input 2.
58. 58
4. Call Subroutine
Figure 3.11 Subroutine
The Call Subroutine (CALL) instruction transfers control to the subroutine (SBR_n). You can
use a Call Subroutine instruction with or without parameters. After the subroutine completes its
execution, control returns to the instruction that follows the Call Subroutine. The maximum limit
of input/ output parameters for each subroutine call is 16. If you attempt to download a program
that exceeds this limit, an error is returned.
If you have assigned a symbolic name to your subroutine, such as USR_NAME, this symbolic
59. 59
name appears in the Subroutine folder of the Instruction Tree. Assignment of parameter values
to local memory in the subroutine is as follows.
1. Parameter values are assigned to local memory in the order specified by the CALL with
parameters starting at L.0.2. One to eight consecutive bit parameter values are assigned to a
single byte starting with Lx.0 and continuing to Lx.7.3. Byte, word, and double word values
are assigned to local memory on byte boundaries (LBx, LWx, or LDx).In the Call Subroutine
instruction with parameters, parameters must exactly match the variables defined in the local
variable table of the subroutine. The parameters must be arranged in order with input parameters
first, followed by input/output parameters, followed by output parameters.
3.4 Analog Inputs and Outputs
Many PLCs also work with analog I/O devices. Analog devices use signals that are continuously
variable within a specified range, such as 0 to 10 VDC or 4 to 20 mA.
60. 60
Analog signals are used to represent variable values, such as speed, rate of flow, temperature,
weight, level, etc. In order to process an input of this type, a PLC must convert the analog
signal to a digital value. S7-200 PLCs convert each analog voltage or current value into a 12-bit
digital value. Digital values from analog inputs are stored in addressable memory for use by the
user program. Similarly, the user program can place digital values in addressable memory
locations for conversion to analog values for the designated
analog outputs. The only S7-200 CPU model with analog I/O points on board is CPU 224XP,
which has 2 analog inputs and 1 analog output. However, analog I/O points can be added using
expansion modules for any CPU other than CPU 221. CPU 222 allows
for 2 expansion modules and the remaining CPUs allow for 7 expansion modules.
Expansion modules are available with 4 or 8 analog inputs, 2 or 4 analog outputs, or 4 analog
inputs and 1 analog output. In addition, expansion modules are available for use with
thermocouples or RTD type sensors which sense the temperature at a specific point in a machine
or process.
Figure 3.12 Analog Expansion Module
62. 62
CHAPTER 4
CASE STUDY OF PLCs
4.1 Case Study 1 :
The temperature in the process is to be maintained between 95 degree Celsius to 105 degree
Celsius.
The actual value of temperature is available in MW20.
The status of temperature in the process is indicated by lamp (q4.0)
When the lamp is steady ON, means the temperature is within the limit.
When the lamp is flashing slowly (1 HZ), means the temperature is less than the lower limit (95
degree Celsius).
When the lamp is flashing fast (10 Hz), means the temperature is more than the upper limit (105
degree Celsius)
Write a program to fulfill this need using comparison function and test the logic using table.
63. 63
4.2 Case Study 2:
If my water level is greater than 30 L my outlet valve should open.
If water open level is less than 30 L inlet valve should open
When water is at 30 L a churner should mix the water for 20 second.
After that outlet valve should open for 25 second
The whole process should take 5 times and the process end LED should glow.
65. 65
4.3 Case Study 3:
When START Push button is pressed an input pulse should come after every 10 seconds and a
lamp should go ON after 5 input pulses.
67. 67
BIBLIOGRAPHY:
1. USER MANUAL: Standard software for S7 and M7, STEP 7
2. Master index, STEP 7
3. Programming sequential control system
4. Manual: S7-200 Programmable Controller, Hardware and Installation
5. Programming Manual: System Software for S7-200
6. “Configuring Process Diagnostics for LAD”
7. STEP 7 Standard Function, Part 2
8. Reference Manual: Standard Software for S7-200
9. http://www.automation.siemens.com/_en/s7-200/index.htm