7.2 The IEC 61131 Standard
The standards that are generally created by international associations and committees play an
important role in the development of all industrial technologies. The standards generally help
in achieving compatibility, transparency, and interoperability across different products; increase
users’ confidence in their products; and help in developing tools and methodologies under a com-
mon umbrella of technological specifications. Thus, the IEC came to address the chaotic situation
in the incompatibility of programming languages for PLCs with the establishment of the open
standard IEC 61131, the first part of which was issued in 1992 and referred to PLCs in general.
The third part of this standard, the so-called IEC 61131-3, was issued in 2003 (second edition)
and referred to the programming languages of PLCs. Nowadays, all major PLC manufacturers
have accepted this standard, and their products are developed accordingly. It must be noted that
the IEC 61131-3 standard, by definition, is not an additional programming language; instead, it
supports modern software engineering methods in order to lead PLC operation in improved lan-
guages and programs, creation of usable and interoperable code, and in easy debugging.
The IEC 61131-3 standard incorporates five different approaches to programming control systems,
and especially for the case of PLCs. Each approach is based on a simple language that targets a par-
ticular type of automation problem or application. These languages can be easily combined to generate
a mixed code, or used in other types of control systems than PLCs, such as smart sensors, program-
mable drivers, process controllers, SCADA software, and so on. The main objective of the standard is
to normalize the existing programming languages, rather than to prevent the possible development of
new languages. Every PLC manufacturer is free to develop either extensions of a language that complies
with the standard, or a new language from scratch if it is deemed necessary. On the other hand, the IEC
61131-3 standard has introduced function blocks that can be programmed in a non-standard language,
such as C
++
. The five embedded languages for the PLCs are the following ones:
1. Ladder Diagram, LD, or LAD—Graphic Language.
A program written in a Ladder Diagram language is similar to the classic wired automa-
tion circuits. It uses logical symbols such as:
X
X
= Open logical contact if the variable X is in a logic “0” (e.g., digital input, output,
logic coil, etc.)
X
X
= Closed logical contact if the variable X is in a logic “0”.
= Internal logic coil or digital output at a logic of “0” or “1” if the logic just before in
the branch (see Figure 7.1) is “0” or “1”, respectively.
The horizontal branches between the two vertical lines at the beginning of the logic and
the end of the logic, presented in Figure 7.1, include logical elements such as the above or
combinations of them which are called “rungs” or “networks” which make up the “ladder”.
274
◾
Introduction to Industrial Automation
Each branch ends on the right side in a single logic coil or output. Some manufacturers allow
the parallelism of two or more logical coils or outputs in the same branch. In addition to the
above simple elements, the LAD language has block symbols
ff
for all the basic functions
that are needed in an automation system, such as timers, counters, arithmetic operations,
etc.
2. Function Block Diagram (FBD)—Graphic Language.
Because there is not a generally established translation of the FBD language, it is possible
to refer to this with the terms “logic components language”, “logic diagram language”,
“logic gates language”, and other similar terms. Literally, the function block diagram lan-
guage contains symbol blocks of functional operations, which implement various functions
from the simple AND function from Boolean algebra up to PID control. Every block has
the name of the function that it implements and accepts on the left side the inputs and on
the right side the output, which carries the result of the function as presented in Figure 7.2.
In fact, both the inputs and the outputs contain an additional set of assistive functions, for
example the output ENO of the block ADD_I for adding integers, that inform us if the
result is out of limits.
The input and output variables of the PLC are connected to the inputs and outputs of
the functional blocks respectively by interconnection lines or are simply declared before
them. The output of a block can be connected to the input of another functional block.
Any interconnection line is directed in the sense that data are transferred from left to right,
while both ends of the interconnection line should be of the same type. This means that the
output of the logical block AND in Figure 7.2, which is a discrete variable (0 or 1), cannot
be connected to the input 1 of the block ADD_I, which should be an integer variable.
3. Instruction List (IL)—Text-Based Language.
The instruction list is a low-level language that looks like the assembly language, but it
is in a higher level than the LAD and FBD, in the case that the classification criterion is
the translation of a program from one language to another. Due to the fact that the pro-
grams from other languages can always be translated into the corresponding IL language
(the opposite is not true), it is considered as the main PLC language. IL is also known as
the statement list (STL) or Boolean language. Because the most basic IL commands are
just the basic functions of Boolean algebra (such as AND, OR, AND NOT, OR NOT, etc.)
abbreviated, the last name will be adopted subsequently as the more descriptive one.
An instruction in the IL language consists of two parts: the operation of the instruction
and the name of the operand for which the function will be implemented, as shown in Figure
7.3. The name of the utilized variable is directly related to the addressing system adopted by
the PLC manufacturer referred to in Section 6.8.3. At the application level, both parts of the
instruction are abbreviated as far as possible, as presented in Figure 7.3. The programming
AND
X
Y
Z
AND
X
Y
Z
ADD_ I
IN1
IN2
EN
OUT
ENO
Result of
addition
Enable
output
EN = enable input
AND
X
Y
Z
ADD_ I
IN1
IN2
EN
OUT
ENO
Do'stlaringiz bilan baham: |