Chapter III PLC programming

advertisement
APPLICATION OF PLC IN INDUSTRIAL AUTOMATION
Chapter III
PLC programming
IEC 61131-3 standard
In order for the modern programming tools to enable development of a wide range of software
solutions at a low cost, they should fill some requirements. Often simultaneous use of several
PLC programming languages is needed to control efficiently the large amount of different
processing hardware. For ease of development and modification of the programs features such
as Offline testing and simulation, Online modifications in PLC and reverse documentation of
the programs from PLC are necessary. The PLC program blocks should be reusable and the
programming systems with open interfaces should be used. With the introduction of the
international standard IEC 61131 a large step in covering these requirements has been made.
The goal of this standard is to decrease costs for training, costs of creating larger programs
and implementing more complex programming systems.
As it is a very detailed standard, the programming systems cannot implement all of it. Instead,
the standard uses feature tables with requirements, where the manufacturer should mark
whether their tools fulfill these and to which extent. Many PLC vendors support this standard
but the level of compliance varies greatly. Since the standard is relatively new and achieving
full compliance is a large task, the majority of vendors do not completely implement all the
features in the standard.
Part 3 of the standard (IEC 61131-3) addresses the programming languages by coordinating
widely used languages into a harmonized version with future possibilities and tendencies in
mind [11].
The Program Organization Unit (POU)
In IEC 61131-3 the blocks from which programs and projects are built are called Program
Organization Units (POUs), which correspond to program blocks, organization blocks,
sequence blocks and function blocks of the conventional programming world [12]. One very
important goal of the standard is to limit the variety of block types and simplify their usage.
The three POU types declared in the standard are Function (FUN), Function Block (FB) and
Program (PROG).
Function is a POU that can have assigned parameters but has no static variables, i.e. no
memory – with same input parameters it always has the same output value.
Function block has static variables (memory) and its output depends on the state of its
internal and external variables, which values are kept between executions of the function
block. These are the main building blocks for PLC programs.
A Program is a type of POU that represents the main program. Several main programs can be
executed simultaneously in a multitasking-capable PLC. All variables assigned to physical
APPLICATION OF PLC IN INDUSTRIAL AUTOMATION
addresses (e.g. PLC inputs and outputs) must be declared here, in other aspects it behaves like
an FB.
To prepare programming for S7-300 and S7-400 series the PLC firm Siemens developed a
programming tool named STEP 7 [9]. In the programming environment STEP 7 the POUs are
arranged in a slightly different way. The Function (FC) is the same, but the Function block
(FB) has an assigned data storage area - instance Data block (DB), which is already an
integral part of the Function Block in IEC 61131-3. Instead of Program in the standard IEC
61131-3, STEP 7 named Organization block (OB), which is cyclically called by the PLC
operating system and forms the interface between the user program and the operating system
of a controller.
OBs provide structured means to handle the processing requirements of a program. They
provide an interface between the PLC operating system and the user program. OBs are written
by the user but called by the PLC operating system based on certain conditions. For example,
on each CPU startup (switching to the RUN mode), OB 100 or OB 101 are called up. The
operating system responds to specific events by calling a specific OB. An overview of the
different type OBs according to their function and triggering conditions is given in Table 3.1.
Table 3.1. Organization blocks in STEP 7
OB type
Normal cyclical
processing
Time-of-Day
interrupts
Time-Delay
interrupts
Cyclic interrupts
OB no.
1
Hardware
interrupts
Multi-Computing
interrupt
40 – 47
Redundancy Error
interrupts
70 - 73
Asynchronous
Error interrupts
Background
Processing
CPU Startups
80 - 87
Synchronous Error
interrupts
121 - 122
10 - 17
20 - 23
30 – 38
60
90
100 -101
Call event and application description
Called after each CPU startup and thereafter, cyclically, to
process the main user program.
Called at user configured time-of-day interrupt, to process the
user code that must be processed at a specific date-and-time.
Called after user defined delay expires, to handle the program
parts which must be processed after the time delay expires.
Called cyclically at defined intervals (e.g. 500 ms), to handle
code (e.g. PID loops) that must be processed at precise intervals.
Called when any of the assigned process or module-generated
interrupts occurs, to process the user programmed service routine
Called on an interrupt, which is generated by any of the CPUs in
a multiple CPU configuration, to process a user defined
synchronized response.
Called upon occurrence of a redundancy error in an S7-400 H
system (one PLC has several CPU modules), to process the user
programmed response.
Called at occurrence of a system-related error (e.g. power supply
fault, or module failure), to process user defined service routine.
Called to process non-critical code, when the actual cycle time of
the current cycle is less than user defined minimum cycle.
Called at each CPU start-up and prior to calling OB 1, to process
initialization code that must be executed once at each start-up.
Called at occurrences of program related runtime errors, to
process the user-programmed service routine for synchronous
errors.
STEP 7 Function blocks (FB) are intended for generating algorithms where the generated or
used data must be available from one call of the block to another. To handle this requirement
APPLICATION OF PLC IN INDUSTRIAL AUTOMATION
an instant data block (DB) must be assigned to each FB in STEP 7. Several data blocks can be
assigned to one FB if needed.
In addition, by user employed blocks (OB, FB and FC), STEP 7 has three types of System
blocks (SFB, SFC and SDB), which are an integrated part of the PLC, but may still be called
from the user program. System blocks solve many commonly required tasks and functions;
therefore these blocks reduce the program development time significantly. The user cannot
change and see the System block in the existing program.
A FC does not require a data block as memory storage; however it can access a global DB for
reading and writing data. In an FC you can only define temporary variables. In STEP 7 both
FB and FC can be called from FBs, FCs and OBs (Fig. 3.1).
STEP 7 User Program
S7 Operating
system
Detect
Power Up
Call Main
Cycle
OB 100 – OB 101
Start Up Program
OB 1
Main
Program
FC 1
FB 50
FB 2
Organization Block
Error/Fault
detected
Process Fault
Service Routine
Interrupted
FC 3
Organization Block
Interrupt
detected
Process Interrupt
Service Routine
Interrupted
FC 4
Process
PII/PIQ
Block
End
Fig. 3.1. Cyclical program processing in Siemens PLC
FB 5
FC 30
APPLICATION OF PLC IN INDUSTRIAL AUTOMATION
Each block consists of networks. The maximum number of networks in a block is 999. In
the STL language every network can contain a maximum number of 2000 command
lines.
In S7-300 and S7-400 PLC the normal cyclical program processing is handled by OB 1.
After switching on power and switching the CPU to the RUN mode, the OB 1 is called and
processed on each PLC cycle until the CPU is stopped or power removed. Since it is operated
continuously, most of the other blocks have to be called from OB 1. If the block was called by
OB 1 and the block completes its execution, then the program control is passed back to OB 1.
PLC uses priority levels – if an OB with higher priority level is called, then the lower priority
level OB is interrupted. An overview of this cyclical processing handling is shown in Fig. 3.1.
Data types used in PLC
IEC 61131-3 defines a set of standardized data types (Table 3.2) called Elementary data types,
which are characterized by their number of bits and their possible value range. In addition to
these, user-defined derived data types can be created and used in the same way as Elementary
data types.
Table 3.2. Elementary data types of IEC 61131-3
Boolean
Signed integer
BOOL
BYTE
WORD
DWORD
LWORD
INT
SINT
DINT
LINT
Unsigned
integer
UINT
USINT
UDINT
ULINT
Real
REAL
LREAL
Time, duration, date
and character string
TIME
DATE
TIME_OF_DAY
DATE_AND_TIME
STRING
The elementary data types used during PLC programming in STEP 7 are given in Table 3.3
[13]. Some of the types listed as elementary data types in IEC 61131-3 are actually called
complex data types in STEP 7. These allow defining variables of other data types and are
made of more than one data element. STEP 7 also has parameter data types, which allow
timers, counters and blocks to be used as formal parameters in FC or FB.
Table 3.3. Data types in STEP 7
Type and
Size
Formatdescription
in bits
options
BOOL (Bit)
1
Boolean text
BYTE (Byte)
8
WORD (Word)
16
Hexadecimal
number
Binary number
Hexadecimal
number
BCD
Decimal
number
unsigned
Range and number notation
(Lowest to highest values)
TRUE (signal “1”)/FALSE (signal
“0”)
B#16#0 to B#16#FF
Example
2#0 to 2#1111_1111_1111_1111
W#16#0 to W#16#FFFF
2#0001_0000_0000_0000
W#16#1000
C#0 to C#999
B#(0,0) to B#(255,255)
C#998
B#(10,20)
TRUE
B#16#10
APPLICATION OF PLC IN INDUSTRIAL AUTOMATION
Type and
Size
description
in bits
DWORD (Double
32
word)
INT (Integer)
16
DINT (Int, 32 bit)
32
REAL (Floatingpoint number)
S5TIME
(Simatic-Time)
32
TIME
(IEC-Time)
32
DATE
(IEC-Date)
TIME_OF_DAY
(Time)
CHAR
(Character)
16
16
32
8
Formatoptions
Binary number
Hexadecimal
number
Decimal
number
unsigned
Decimal
number signed
Decimal
number signed
IEEE floatingpoint number
S7-Time in
steps of 10 ms
Range and number notation
(Lowest to highest values)
2#0 to
2#1111_1111_1111_1111_1111_1111
_1111_1111
DW#16#0000_0000 to
DW#16#FFFF_FFFF
B#(0,0,0,0) to B#(255,255,255,255)
Example
-32768 to 32767
1
L#-2147483648 to L#2147483647
L#1
Upper limit: +/-3.402823e+38
Lower limit: +/-1.175495e-38
S5T#0H_0M_0S_10MS to
S5T#2H_46M_30S_0MS and
S5T#0H_0M_0S_0MS
IEC-Time in
-T#24D_20H_31M_23S_648MS to
steps from 1ms, T#24D_20H_31M_23S_647MS
integer signed
IEC-Date in
D#1990-1-1 to D#2168-12-31
step of 1 day
Time in steps
TOD#0:0:0.0 to TOD#23:59:59.999
of 1ms
ASCII´A´, ´B´ etc.
Characters
2#1000_0001_0001_1000
_1011_1011_0111_1111
DW#16#00A2_1234
B#(1,14,100,120)
1.234567e+13
S5T#0H_1M_0S_0MS
S5TIME#1H_1M_0S_0MS
T#0D_1H_1M_0S_0MS
TIME#0D_1H_1M_0S_0MS
DATE#1994-3-15
TIME_OF_DAY#1:10:3.3
´B´
Addressing of variables according to STEP 7
Variables are declared together with a data type as placeholders in PLC memory for
application-specific data. To better understand addresses and the program, symbolic
addressing is used. This makes it possible to assign a symbolic name to a certain absolute
address. Global symbols are declared in the STEP 7 symbol table and can be used in all
blocks of a user program. The name in the symbol table must be unique, it must appear only
once in the table. Local symbols are declared in the declaration part of a block (OB, FC and
FB). They can be used only within a given block and the same symbolic name can be used
again in another block (it must be declared there again).
APPLICATION OF PLC IN INDUSTRIAL AUTOMATION
Slot No.
1
2
PS 307
CPU 314
SF
DC24V
SIEMENS
4
8
SM 322
SM 322
DO 16xDC 24V
DO 16xDC 24V
9
10
SM 332
SM 331
AI
AO
8x12Bit
4x12 Bit
SF
DC5V
STOP
7
SM 321
DI 16xDC 24V
RUN
VOLTAGE
SELECTOR
6
SM 321
DI 16xDC 24V
FRCE
230
5
SM 321
DI 16xDC 24V
PUSH
0
0
0
0
0
1
1
1
1
1
2
2
2
2
2
3
3
3
3
3
4
4
4
4
4
5
5
5
5
5
6
6
6
6
6
7
7
7
7
7
0
0
0
0
0
1
1
1
1
1
2
2
2
2
2
3
3
3
3
3
4
4
4
4
4
5
5
5
5
5
6
6
6
6
6
7
7
7
7
7
SF
RUN
STOP
MRES
SIMATIC
S7-300
Modules
PS
CPU
SM
SM
SM
SM
SM
SM
SM
SM 321
DI 16xDC 24V
0
1
2
3
4
5
6
7
0
1
2
3
Address 0.0
Address 0.7
Address 1.0
Address 1.7
4
5
6
7
Fig. 3.2. Addressing Siemens S7-300 PLC modules
The slot numbers in the rack of an S7-300 PLC simplify the addressing of I/Os - the position
of the module in the rack determines the first address on a module [14]. Slot 4 is the first slot
that can be used for I/O modules. Therefore a digital input (DI) module in slot 4 begins with
the byte address 0. It must be noted that when 16-channel DI/DQ modules are used, two byte
addresses are lost in every slot. Therefore, the next DI/DQ module address begins with byte 4.
The principle of module addressing of S7-300 is shown in Fig. 3.2.
APPLICATION OF PLC IN INDUSTRIAL AUTOMATION
Addressing S7 memory areas
S7 PLCs have memory areas that can be accessed in the user program. In S7-300 these areas
include input image (I), output image (Q), bit memory (M), peripheral input (PI), peripheral
output (PQ), local (L), timer (T) and counter (C) memory areas.
Each memory area is organized into bytes and allows access to a bit, a byte (8 bits), a word
(16 bits) and a double word (32 bits). A double word therefore accesses 4 bytes from byte n to
byte n+3. A bit address is always referenced with the unique symbolic identifier based in the
memory area followed by the byte and the bit number separated by a period (for example
I 28.3). If the location is a byte, word or double word the letters B, W or D are added to the
memory identifier (e.g. IB 7, IW 7, ID 7). All memory areas except the local memory may be
accessed from any block. The placement of data in memory is shown in Fig. 3.3. From this
image it is clearly seen that care has to be taken in order to unintentionally overwrite data in
the wrong bytes. To bring an example, by using input image IW 0 and IW 1 in a program and
giving IW 0 a value, then IW 1 value changes even though the program does not change it.
Therefore IW 2 has to be used instead of IW 1 in the program.
Fig. 3.3. The placement of data in memory
Prior to each program cycle the CPU reads the status of digital inputs and stores the
information in the process image of inputs (PII). Also, during each cycle the CPU determines
the status of each output and stores it in the process image of outputs (PIQ) and transfers it in
the end of the cycle to the outputs to reflect the program results.
The peripheral memory (PI/PQ) allows data to be read and written directly from and to the
module. By this the delay with the updates of I/O data at the end of each cycle is eliminated.
The peripheral memory can also be used to read data from analogue modules and write to
them – analog modules are not read or written automatically between cycles.
The timer memory (T) area of STEP 7 memory stores each timer in one word location and
contains both the time base and time preset value. From the first location, timers are addressed
T0, T1 and so on. The counter memory area (C) holds counter instructions and are similarly
addressed: C0, C1 and so on. Counter and timer addresses may be used in bit operations the
check current status and in word operations to check the remaining time or current count
value.
One timer memory area should be used only once with a timer. If the memory area is given to
another timer, then it can happen that both timers will not work or they behave unexpectedly.
This applies also to the counter memory area.
Local memory (L) is used for handling temporary local variables and when the block
terminates, it is available to the next called block and the temporary data is overwritten.
Addressing is similar to input and output memory (e.g. L 31.5, LB 3, LW 3, LD 3).
APPLICATION OF PLC IN INDUSTRIAL AUTOMATION
PLC programming languages
IEC 61131-3 provides five programming languages for PLC suitable for different tasks.
IL (Instruction List) is a low-level machine-oriented language offered by most of the
programming systems. It is universally usable and often employed as a common intermediate
language to which the other
Operation,
Operand,
Label
Comment
languages are translated. IL is a
variable
command
line-oriented
language.
An
instruction, which is an executable
M001:
A
I 0.0
//Part present
command for the PLC, is described
A
M 3.7
//Drill OK
in exactly one line. It consists of the
S
Q 0.1
//Drill
elements shown in Fig. 3.4. An
instruction starts with an operation Fig. 3.4. Structure of an IL (also STL)
or command and one or several Operands, separated by commas. Instructions may be
preceded by a label followed by a colon. The label acts as a jump address. If a comment is
used, then it must represent the last element of the line. A
comment is introduced via the string “(*”, and ended by the
string “*)”. In STEP 7 two slashes “//” are used to show where
the comment starts in the line.
Labels are necessary to enable jumps in program execution
from lines elsewhere in the program. It is not actually approved
in the standard, but this is allowed in many programming
systems to improve the readability.
In STEP 7 the language is called Statement List (STL). An
example is given in Fig. 3.5.
ST (Structured Text) is a high-level language for control tasks
and complex mathematical calculations. Its advantages over IL
are very compressed formulation of the programming tasks,
clear construction of the program in statement blocks and powerful constructs to control the
command flow. An ST algorithm is divided into several steps (Statements), which are used to
compute and assign values, to control the command flow and to call or leave a POU. Unlike
in IL a statement in ST can be extended over several lines or several statements can be written
on a single line.
Fig. 3.5. Sample of STEP 7
STL language
The standard also allows use of other
programming languages (like C++) if they
fulfill some basic requirements set in the
standard.
Q 4.0 := I 0.0 AND I 1.1 OR NOT I 0.1
IF Q 4.0 == 1 THEN GOTO M001
ELSE Q 1.0 = NOT Q 4.0;
END_IF;
M001 MW 2= 1+MW 2;
In STEP 7 this language is called
Fig. 3.6. Sample of STEP 7 SCL language
Structured Control Language (SCL). It
resembles programming language PASCAL (Fig. 3.6).
APPLICATION OF PLC IN INDUSTRIAL AUTOMATION
FBD (Function Block Diagram) is a graphical connection of arithmetic, Boolean or other
functional elements and function blocks. It originally came from the field of signal
processing, where integer or real values are important. It has become established as a
universally usable language for PLC.
The code part written in FBD is divided into sections known as networks, which is helpful to
structure the control flow of a POU. The graphical elements of an FBD network include
rectangular boxes and control flow
statements connected by horizontal
and vertical lines (Fig. 3.7).
Unconnected inputs can have
variables or constants attached to
them or remain open.
Fig. 3.7. Sample of STEP 7 FBD
language
FBD uses horizontal and vertical connection lines, which can be split into several
connections. It is not allowed to connect multiple outputs with one input, because it would
make an inconsistency. In order to control program execution, there are calls for leaving the
POU and for changing the sequence of processing networks.
A network in FBD is evaluated by the following rules:
1. Evaluate all inputs before executing the element.
2. The evaluation of an element is not completed until all outputs are evaluated.
3. The evaluation of a network is not completed until all outputs of all elements of the
network are evaluated.
LD (Ladder Diagram) is a graphical connection of Boolean variables, comparable to earlier
relay controls and represents energy flow in electrical circuit diagrams. This programming
language is mainly designed for processing Boolean signals (TRUE / FALSE). Rails bound an
LD network on the left and right. From the left rail, “powered” by logic signal state “1”,
power reaches all connected elements. Depending on their state, the elements either allow the
power to pass to the following elements or interrupt the flow.
Like FBD, LD has vertical and horizontal lines to connect elements, it also includes crossing
points. A contact performs a logic operation on the value from the incoming line and the value
of the associated variable. The type of logic operation depends on the type of the contact. The
value calculated as a result is given to the right connecting line.
All variables are of the data type Boolean (TRUE / FALSE) and the corresponding
connections only transmit Boolean values.
APPLICATION OF PLC IN INDUSTRIAL AUTOMATION
Fig. 3.8. Sample of STEP 7 LAD language
In STEP 7 its abbreviated form is LAD (Ladder Logic). An example is shown in Fig. 3.8.
SFC (Sequential Function Chart) is for breaking the application control task into smaller
units and controlling their execution. Graphical program representation clearly describes the
program flow and is therefore an important tool for structuring PLC programs. Using SFC, it
is possible to design sequential and parallel processes of an application.
The execution of smaller program units (e.g. processes, tasks) depends both on the conditions
defined by the program and the behavior of the I/Os. The units themselves are programmed in
one of the other languages of IEC 61131-3. Processes with a step-by-step behavior are
especially suitable to be programmed in SFC.
The first level of structuring on SFC is the network which is made from elements called steps
and transitions (Fig. 3.9). A step can be active or inactive. When it is active, the associated
instructions are executed until the step becomes inactive. The changing of the status of the
step is defined by a transition
condition, which is a Boolean
expression. If the transition
condition becomes TRUE, then
the following step is activated
and the previous step is
deactivated. With the triggering
of a transition, the ”active“
attribute is passed on from the
active step to its successor or
successors and therefore moves
through the steps making up
the network. This attribute may
be split up in case of parallel
branches and be reassembled
when the parallel branch is
terminated.
Fig. 3.9. Sample of STEP 7 S7GRAPH language
In STEP 7 this language is
called
a
graphical
programming language (S7GRAPH).
APPLICATION OF PLC IN INDUSTRIAL AUTOMATION
The standard version of Siemens PLC programming tool STEP 7 comes with standard
languages like STL, FBD and LAD. Other languages like SCL and S7-GRAPH have to be
bought separately.
Programming by configuring with IEC 61499
The data flow and logical execution sequence can be programmed and documented with the
graphical languages of IEC 61131-3 (LD; FBC, SFC) but it is also necessary to be able to
display the topological distribution of programs (control units), their general configuration
and interconnections to other parts of a distributed automation project in a graphical manner.
This is done at a higher and more abstract level than the programming of POUs.
The tools for configuring complex distributed applications are called configuration editors.
Program parts are combined from larger units by interconnection of function blocks. Complex
distributed automation tasks have an extensive communication and execution structure where
intensive data exchange takes place between geographically separate control units. To do this,
programs are assigned to tasks of network nodes and the inputs and outputs of programs are
interconnected.
Creating distributed automation solutions, i.e. configuring function blocks for physically
different and geographically separate hardware and synchronizing their execution, is the
subject of the standard IEC 61499 [15].
In order to describe the interactions between program parts and elements of control hardware
within a distributed automation system, IEC 61499 uses a model with several hierarchical
levels:
• System
• Device
• Resource
• Application
• Function block
In a real automation environment several control units (devices) execute applications in
parallel and make up a system. A device consists of its application programs, an interface to
the communications network, an interface to the automation process and the device hardware
on which the resources run.
A resource represents an independent executable unit with parameters. Several resources can
run on each device. A resource consists of function blocks, which exchange event and data
information using special interfaces. The service interface function block is formed from the
interfaces to the automation process and the communication network. The other type – user
defined FBs – makes up the actual algorithm.
The application level forms the real programming level because this is where the source FBs
are interconnected with one another, independently of the resources on which they run.
Therefore it describes the application, which may be distributed between several resources.
APPLICATION OF PLC IN INDUSTRIAL AUTOMATION
The function blocks are the smallest program units. In IEC 61499 they generally consist of
two parts:
1. Execution control: creation and processing of events with control inputs and outputs
2. Algorithm (user program) with data inputs and outputs and internal data
The (process, task) algorithm is programmed in the languages defined in IEC 61131-3 and the
control part is programmed using a state diagram in SFC. Execution control charts (ECCs)
control the execution times of the algorithm or parts of it depending on the actual state and
incoming events.
Creating a PLC program – the phase model
The PLC program creation (phase model) consists of the following phases (Fig. 3.10) [8]:
• Specification: description of the task
• Design: description of the solution
• Realization: implementation of the solution
• Integration/commissioning: incorporating into environment and testing the solution
1.
Specification
2.
Design
3.
Realization
4.
Commissioning
• Verbal description of control task
• Technology, positional sketch
• Macrostructure of the control program
• Function chart based on IEC 60848
• Logic chart with symbols of the
IEC 60617
• Function table
• Definition of the software modules
• Parts list and circuit diagram
• Programming in LAD, FBD, STL, SCL
and S7-GRAPH
• Simulation of the program work
• Design of the system
• Testing the program work
Fig. 3.10. The phase model of program creation
Phase 1: Specification (Problem formulation)
Here a detailed description of the task is created. This shows any conflicting requirements or
specifications, which are either misleading or incomplete. The final results of this phase are:
• verbal description of the control task,
• structure/layout,
APPLICATION OF PLC IN INDUSTRIAL AUTOMATION
•
rough structuring of the solution.
Phase 2: Design (Concrete form of the solution concept)
A concept of a solution is developed based on the results from the first phase. It should
describe the behavior of the control system and be independent of the technical realization.
The function chart (GRAFCET) fulfills these requirements. The solution can be refined step
by step until all details are included. If the control task is complicated, it is divided into
individual modules, which implement the job steps of the control system. These can be
special functions such as the realization of an interface for visualization or communications
systems [8].
Phase 3: Realization (Programming of the solution concept)
The translation of the solution concept into a control program is done by the programming
languages defined in IEC 61131-3 (SFC, FBD, LD, IL and ST). The control systems that are
operating in a time and logic process can easily be programmed in SFC. The LD, FBD and IL
are the programming languages suitable for the formulation of basic operations and for
control systems, which can be described by simple logic operations or Boolean signals. The
high-level language ST is mainly used to create software modules of mathematical content,
such as for the description of control algorithms [8].
As far as the PLC or the PLC programming software support this, the control programs or
parts of a program created so far should be simulated before commissioning. This permits the
detection and elimination of errors right at the initial stage. This can be much more difficult
and costly later.
Phase 4: Commissioning (Construction and testing of the control task)
Here the interaction between the automation system created in the first three steps, and the
actual connected plant is tested. Like before, when the tasks are complex and complicated,
this should be done systematically, step by step. If this is done correctly, faults in the control
program and furthermore in the system can easily be found and removed.
An important and crucial component of a system is documentation. It is an essential
requirement for the maintenance and expansion of a system in the future. Documentation,
including the control programs, should be available both on paper and on a data storage
medium for the convenience of use and backup purposes. The documentation consists of the
document of the individual phases, printouts of the control programs and of any possible
additional descriptions concerning the control program, like [8]:
• problem description
• positional sketch or technology pattern
• circuit diagram
• terminal diagram
• printouts of control programs
• list of I/Os
• any additional documentation
APPLICATION OF PLC IN INDUSTRIAL AUTOMATION
Self check
1. Which of these are Program Organization Units of IEC 61131 (multiple answers)?
a. Data Block
b. Function
c. Function Block
d. Organization Block
e. Program
2. Siemens S7-300 PLC program has to be written at least in … to be executed by the
PLC.
a. OB 1
b. FB 1
c. OB 101
3. What is the address of the first input in a digital input module placed into slot 7 on a
S7-300 rail in case only 16-channel modules are used?
a. I 3.0
b. I 7.0
c. I 12.0
4. How much space does a double word take up in memory?
a. 1 bit
b. 8 bits
c. 16 bits
d. 32 bits
5. In PLC program are defined two memory variables MW 0 and MW 1 as WORD. If
variable MW 0 value changes in the program, then the MW 1 value …
a. changes also, because these variables do not have a common memory area.
b. remains as before.
c. changes also, because these variables have a common memory area.
6. Connect programming languages of IEC 61131 and their STEP 7 counterparts:
IEC61131
STEP 7
a. Structured text
1. Statement List
b. Sequential Function Chart
2. Structured Control Language
c. Instruction list
3. S7-GRAPH
7. On the lower figure a program in … is presented.
a. LAD language
b. FBD language
c. SCL language
d. ST language
8. Function Block Diagram is …
a. a graphical PLC programming language based on electrical circuit diagrams.
b. a low-level machine-oriented PLC programming language.
c. a graphical PLC programming language based on logical function block
diagrams.
Download