Vous êtes sur la page 1sur 20

2/14/2018 4 most popular PLC programming languages nowdays

Industrial Automation

4 most popular PLC programming languages for


implementation of control diagrams

PLCs from different manufacturers can be programmed in various ways.


Popular programming languages for PLCs are ladder diagrams, Function Block
Diagrams (FBD), and statement list.

4 most popular PLC programming languages for implementation of control diagrams (photo credit: Green
Mamba via Flickr)

http://electrical-engineering-portal.com/most-popular-plc-programming-languages 1/20
2/14/2018 4 most popular PLC programming languages nowdays

With a few exceptions, a program written in one format can be viewed in


another.

Popular programming languages for PLCs


Let’s take the discussion on each of popular programming languages for
PLCs:

1. Ladder Diagrams
Example
Video course (Ladder Diagram Basics)
2. Function Block Diagram
Video Course (Function Block Diagram (FBD) programming)
3. Statement List
Video Course (How to use PLCSIM S7-300 STL)
4. Logic Functions
Video course (Logic Gates vs Ladder Logic Circuits)

1. Ladder Diagrams

As an introduction to ladder diagram, consider the simple relay circuit which


contains a coil and contacts as shown in Figure 1.

When a voltage is applied to the input coil, the resulting current creates a
magnetic field. The magnetic field pulls a metal switch (or reed) towards it and
the contacts touch, closing the switch. The contact that closes when the coil is
energized is called normally open (NO).

The Normally Closed (NC) contacts touch when the input coil is not energized.
When the input coil is not energized, the normally closed contacts will be
closed (conducting).

The relay shown in the figure has two contacts: one NO another
NC. When the relay coil is energized, contacts of the relay change
their state, i.e. NO contacts get closed and NC contacts get opened.

http://electrical-engineering-portal.com/most-popular-plc-programming-languages 2/20
2/14/2018 4 most popular PLC programming languages nowdays

The relay arrangement can be shown with the help of different schematic
circuits as shown in Figure 1.

Figure 1 – Simple relay layouts and schematics

Relays are normally drawn in a schematic form using a circle to represent the
input coil. The output contacts are shown with two parallel lines. NO contacts
are shown as two lines, and will be open (nonconducting) when the input is not
energized. NC contacts are shown with two lines with a diagonal line through
them.

Now, if it is required to operate NO (C) contact of this relay, connected to an ac


source, through two input relay contacts, A (NC) and B (NO) then the relay
logic diagram shown in Figure 2 is the most appropriate for a typical logic.

According to the relay logic diagram shown in the figure, activation of the input
relay coil corresponds to the contact B, makes C (output) closed and activation
of the input relay coil corresponds to the contact A, makes C (output) to get
opened.

http://electrical-engineering-portal.com/most-popular-plc-programming-languages 3/20
2/14/2018 4 most popular PLC programming languages nowdays

This sort of arrangement is normally employed in


conventional hard-wired relay logic circuit.

Figure 2 – A simple relay controller and corresponding


ladder-logic

The same scheme can be implemented following ladder logic as shown in


Figure 2. The ladder logic-diagram is the most commonly used method of
programming PLCs. The ladder diagram consists of two vertical lines
representing the power rails. Circuits connected as horizontal lines between two
rails are called rungs of the ladder. Few symbols used to denote ladder logic
inputs and outputs are shown in Figure 3 and 4 respectively.

Taking into consideration these ladder logic symbols, the ladder logic
implemented in Figure 2 mimics the same hard-wired relay logic.

http://electrical-engineering-portal.com/most-popular-plc-programming-languages 4/20
2/14/2018 4 most popular PLC programming languages nowdays

Figure 3 – Ladder logic inputs

Figure 4 – Ladder logic Normal Output

Finally, this ladder logic is inserted as a control program to a PLC where,


input devices, and output devices are arranged in a fashion as illustrated in
Figure 5.

So, the ladder-logic programs are loaded into the PLC, the input and output
devices are connected to I/O modules and then the execution of the program
updates outputs according to the status of inputs.

http://electrical-engineering-portal.com/most-popular-plc-programming-languages 5/20
2/14/2018 4 most popular PLC programming languages nowdays

Figure 5 – A PLC illustrated with relays

Many relays also have multiple outputs and this allows an output relay to also
be an input simultaneously.

The circuit shown in Figure 6 is an example of this and it is called a seal-in


circuit. In this circuit, the current can flow through either branch of the circuit,
through the contacts labelled A or B.

The input B will only be on when the output B is on. If B is off, and A
is energized then B will turn on. If B turns on then the input B will turn

http://electrical-engineering-portal.com/most-popular-plc-programming-languages 6/20
2/14/2018 4 most popular PLC programming languages nowdays

on, and keep output B on even if input A goes off. After B is turned on,
the output B will not turn off.

Figure 6 – A seal-in circuit

Note! If A is closed, the output B will turn on, and


input B will also turn on which will keep output B on
permanently – until power is removed.

Another example of ladder logic can be seen in Figure 7. To interpret this


diagram, imagine that the power is on the vertical line on the left-hand side,
called hot rail. On the right-hand side is the neutral rail.

In the figure there are two rungs, and on each rung there are
combinations of inputs (two vertical lines) and outputs (circles). If
the inputs are opened or closed in the right combination, the power
can flow from the hot rail, through the inputs, to power the outputs,
and finally to the neutral rail. An input can come from a sensor, switch,
or any other type of sensor.

An output will be some device outside the PLC that is switched on or off, such
as lights or motors. In the top rung, the contacts are normally open and
normally closed, which means if input A is on and input B is off then power will
flow through the output and activate it.
http://electrical-engineering-portal.com/most-popular-plc-programming-languages 7/20
2/14/2018 4 most popular PLC programming languages nowdays

Any other combination of input values will result in the output X being off.

Figure 7 – A simple ladder logic diagram

Note! Power has to flow through some combination


of the inputs (A, B, C, D, E, E, F, G and H) to switch
on outputs (X, Y)

Go back to contents ↑

Example //

Try to develop (without looking at the solution) a relay-based controller that


will allow three switches in a room to control a single light.

Solution

http://electrical-engineering-portal.com/most-popular-plc-programming-languages 8/20
2/14/2018 4 most popular PLC programming languages nowdays

There are two possible approaches to this problem. The first assumes that any
one of the switches on will turn on the light, but all three switches must be
off for the light to be off. The ladder logic is shown in Figure 8.

Figure 8 – Ladder logic to controlling one light with three switches

The second solution assumes that each switch can turn the light on or off,
regardless of the states of the other switches. This method is more complex
and involves thinking through all of the possible combinations of switch
positions.

You might recognize this problem as an exclusive or problem. The ladder logic
is as shown in Figure 9.

http://electrical-engineering-portal.com/most-popular-plc-programming-languages 9/20
2/14/2018 4 most popular PLC programming languages nowdays

Figure 9 – Ladder logic to controlling one light in a different way with three switches

Note! It is important to get a clear understanding of


how the controls are expected to work. In this
example, two radically different solutions were
obtained based upon a simple difference in the
operation.

Go back to contents ↑

Ladder Diagram Basics #1

http://electrical-engineering-portal.com/most-popular-plc-programming-languages 10/20
2/14/2018 4 most popular PLC programming languages nowdays

Ladder Diagram Basics #1

Ladder Diagram Basics #2 (Safety Control Circuit)

Ladder Diagram Basics #2 (Safety Control Circuit)

http://electrical-engineering-portal.com/most-popular-plc-programming-languages 11/20
2/14/2018 4 most popular PLC programming languages nowdays

Ladder Diagram Basics #3 (2 Wire & 3 Wire Motor Control Circuit)

Ladder Diagram Basics #3 (2 Wire & 3 Wire Motor Control Circuit)

Go back to contents ↑

2. Function Block Diagram

Function Block diagram (FBD) is used for PLC programs described in terms of
graphical blocks. It is described as being a graphical language for depicting
signal and data flows through Inputs blocks, these being reusable software
elements.

A function block is a program instruction unit which, when


executed, yields one or more output values. Thus, a block is
represented in a manner shown in Figure 10 with the function name
written in the block.

Functional blocks can have standard functions, such as those of the logic
gates or counter or timers or have functions defined by the user, e.g. a block
to obtain an average value of inputs.

http://electrical-engineering-portal.com/most-popular-plc-programming-languages 12/20
2/14/2018 4 most popular PLC programming languages nowdays

Figure 10 – Function block

Go back to contents ↑

Function Block Diagram (FBD) programming – First lesson

In this video you will learn the basics of programming PLCs with Function Block
Diagramming (FBD) language. FBD is a graphical language, in which you deal
with the blocks and connection between the blocks.

CODESYS: Function Block Diagram (FBD) programming - First lesson

How to create and use Function blocks in the project

In this video you will learn how to create customized function blocks in the
project and call them in the main program.
http://electrical-engineering-portal.com/most-popular-plc-programming-languages 13/20
2/14/2018 4 most popular PLC programming languages nowdays

CODESYS: How to create and use Function blocks in the project

Go back to contents ↑

3. Statement List

In statement-list programming approach, an instruction set similar to assembly


language for a microprocessor is used. Statement lists, available on few brands
of PLCs, are the most flexible form of programming for the experienced
user but are by no means as easy to follow as ladder diagrams or logic
symbols.

Figure 11 shows a simple operation in ladder-diagram form for a Mistsubishi


PLC. The equivalent statement list would be as shown in Table 1.

http://electrical-engineering-portal.com/most-popular-plc-programming-languages 14/20
2/14/2018 4 most popular PLC programming languages nowdays

Figure 11 – Mitsubishi ladder diagram

Equivalent statement list for Figure 11

Go back to contents ↑

How to use PLCSIM S7-300 STL LESSON 1 Tutorial

In this lesson we discuss about STL Program and concept of RLO&STA.


Detailed information about RLO and STA is explained along with simulation.

http://electrical-engineering-portal.com/most-popular-plc-programming-languages 15/20
2/14/2018 4 most popular PLC programming languages nowdays

How to use PLCSIM S7-300 STL LESSON 1 Tutorial

PLCSIM S7 300 STL LESSON 2 Tutorial…automation in plant

In this lesson we will learn how to write a PLC program using an “S7 300” PLC
and “STEP 7” software.

http://electrical-engineering-portal.com/most-popular-plc-programming-languages 16/20
2/14/2018 4 most popular PLC programming languages nowdays

PLCSIM S7 300 STL LESSON 2 Tutorial...automation in plant

Go back to contents ↑

4. Logic Functions

There are many control situations requiring actions to be initiated when a


certain combination of conditions is realised. Thus, for an automatic drilling
machine, there might be a condition that the drill motor is to be activated when
limit switches are activated that indicate the presence of the workpiece and the
drill position as being at the surface of the workpiece.

Such situation involves the AND logic function, condition A and


condition B having both to be satisfied for an output to occur. Similarly,
other situations may demand to implement logics like OR, NOT,
NAND, NOR, XOR.

The electric circuit, truth table, ladder diagram and functional block diagram for
different logics are presented in Table 2.

http://electrical-engineering-portal.com/most-popular-plc-programming-languages 17/20
2/14/2018 4 most popular PLC programming languages nowdays

Table 2 – Characteristics for different logics

http://electrical-engineering-portal.com/most-popular-plc-programming-languages 18/20
2/14/2018 4 most popular PLC programming languages nowdays

Go back to contents ↑

Logic Gates vs Ladder Logic Circuits

Logic Gates vs Ladder Logic Circuits

Go back to contents ↑

Reference // Electrical and electronics measurements and instrumentation by


Prithwiraj Purkait, Budhaditya, Santanu Das and Chiranjib Koley (Get
paperback at Amazon)

About Author
http://electrical-engineering-portal.com/most-popular-plc-programming-languages 19/20
2/14/2018 4 most popular PLC programming languages nowdays

Edvard Csanyi

Electrical engineer, programmer and founder of EEP. Highly specialized for


design of LV/MV switchgears and LV high power busbar trunking (<6300A) in
power substations, commercial buildings and industry fascilities. Professional in
AutoCAD programming. Present on Google+

http://electrical-engineering-portal.com/most-popular-plc-programming-languages 20/20

Vous aimerez peut-être aussi