You are on page 1of 16

Programming a

Programmable Logic
Controler (PLC)
Jens Bathelt

Content of Module 3
Lesson 3.1, 1h: deepening Programmable Logic Controlers (PLC)
and explaining Sequential Function Charts (SFC).
Case 3.1, 2h: Programming SFC using SIMATIC S7-Graph
Lesson 3.2, 1h: The remaining four IEC-1131 languages and
State Transition Diagrams (STD)
Case 3.2, 2h: Deepening SFC using SIMATC S7-Graph

Objectives
Understand the principle setup and the properties of a PLC
Distinguish between the different sequential control types and
their characteristics
Classification of the major programming languages (SFC, ST
FBD, IL, LD) concerning their level of programming complexity
Know the elements and properties of SFC
Path step diagram and I/O list

Leadslide
product

gra
tion

requirements

assurance of properties

3D Visualization

sys

ig n
d es

Simulation

tem

tem

int e

sys
Control

domain-specific design
Control
Actors

programming
Sensors

Basic System

modeling and model analysis

E-CAD
M-CAD

Overview of control typs

Electrical controls
(Elektrische Steuerungen)

Logic control
(VerknpfungsSteuerung)

Sequential circuit
(Schaltwerke)

Combinatorial circuit
(Schaltnetze)

Sequential control
(Ablaufsteuerung)

Time bounded
(zeitgefhrt)

Cyclic signal
processing (zyklische
Signalverarbeitung)

Process bounded
(prozessgefhrt)

Event oriented signal


processing (ereignisorientierte
Signalverarbeitung)

Time bounded

SIEMENS TIA Modul C1

Event oriented signal processing


cut-off device
if (start-valve/START-Ventil 1.2 is activated)
Cylinder 1.0 is extended
if (limit switch/Grenztaster 1.3 is reached)
Cylinder 1.0 will be retracted

SIEMENS TIA Modul C1

PLC (Programmable Logic Controller)


PLC Online Tutorial:
http://www.plcs.net/contents.shtml
A PLC (i.e. Programmable Logic Controller) is a device that was
invented to replace the necessary sequential relay circuits for
machine control. The PLC works by looking at its inputs and
depending upon their state, turning on/off its outputs.

http://www.plcs.net/

Examples of machines controlled by a PLC


PLCs are used in many "real world" applications. If there is
industry present, chances are good that there is a PLC present.
If you are involved in machining, packaging, material handling,
automated assembly or countless other industries you are
probably already using them. Even machine tools have a PLC
beside their NC.

Waterjet AB/ BTH, Sweden

SIG/Intelliact AG, Switzerland

PLC History
MODICON 084,
the first practical
programmable
controller (1969).

Matsushita Electric Works


Schweiz AG

Improved
Communication:
PLC PLC

Miniaturization
Soft PLCs

Hardware
1960

Assembler on
manufacturer specific
hardware. 6-12 keys for
each instruction

1970

Analog I/Os
like +/-10V in
addition to the
digital I/Os
(Boolean variables)

1980

1990

Symbolic
programming
on PCs

Software

Five
standardized
programming
languages
IEC 1131-3

http://www.plcs.net/
http://members.aol.com/rewellner/chatterx1/haupt.html

Mechatronic system
Control technology

PLC
Actors

Sensors

Electro mechanical
Border

Basic System
Mechanical design

Material

Information

product

grat
ion

requirements

Energy

desi

Simulation

3D Visualization

gn

syst
em

inte

em
syst

assurance of properties

Control

domain-specific design
Control
Actors

programming
Sensors

Basic System

E-CAD
M-CAD

modeling and model analysis

Main components of a PLC

Input circuit
CPU / Memory
Output circuit

PLC program execution

Eingnge/Inputs:

Sensors

E0.0 E0.1 E0.2 ..


1
0
1
..

Ausgnge/Outputs:

Actors

Check input status

1x

I/O-List

Program

- Inputvariables
- Outputvariables

- Sequential
logic

1x

Update output status

A0.0 A0.1 A0.2 ..


0
1
1
..

Overview of control types


Electrical Controls
(Elektrische Steuerungen)

Logic control
(VerknpfungsSteuerung)

Sequential circuit
(Schaltwerke)

Combinatorial circuit
(Schaltnetze)

Sequential control
(Ablaufsteuerung)

time bounded
(zeitgefhrt)

?
?

Cyclic signal
processing (zyklische
Signalverarbeitung)

process bounded
(prozessgefhrt)

Event oriented signal


processing (ereignisorientierte
Signalverarbeitung)

PLC Sequential Function Charts (SFC)

upload

Programming environment

PLC

The software development process for PLCs


The five IEC 1131-3 (1993) languages arranged according to the
software development process for PLCs:
SFC, Sequential
Function Chart
(AS, Ablaufsprache)

level of language

SFC
high

Fill

Empty

T1
2

ST

ST, Structured Text


C:=A

FBD, Function Block


Diagram
(FUP, Funktionsplan)

AND
A
B

IL, Instruction List


(AWL, Anweisungsliste)
LD, Ladder Diagram
(KOP, Kontaktplan)

LD

low

FBD
C

AND

NOT B

LD
A
ANDN B
ST
C

A B

IL

- --/---------( )

analysis

design

coding

Bonfatti F., Monari P. D. and Sampieri U.: IEC 1131-3 Programming Methodology, CJ International, France, 1997

Fields of application for the PLC languages


LD: Derived from the pre-PLC relay based controls. For instance
used for the tool handling in the FANUC machine control
ST: Good for former C programmers
FBD: Drawing functions blocks to express logics (like and/or/not)
analog to signal flows observed in electronic circuit diagrams
(Stromlaufplan).
IL: Old language, many experienced users, a lot of generated
code in use in industry, hard to maintain, hard to read for
externals, hard to handle in larger projects, fast, minimal
memory usage, no programming structure.
SFC: chemistry

SFC basics

Initial step

Transition 0
Step

FILL

Action name

Transition
Action: SFC, ST,
FBD, IL or LD

condition

Transition 1
2
Transition 2

Empty

Action identifier:
- S: Set output (1)

- R: Reset output (0)


- ...

SFC basics

loop

and

or

SFC properties
Graphical language (not like C)
Derived from Petri Nets
Transition conditions do lead to a sensor
Petri Net example

Actions do lead to an actuator

http://www.ento.vt.edu/~sharov/PopEcol/lec1/petrinet.html

SIEMENS: GRAPH
The IEC standard does support a language mix: SFC for the toplevel structure and for instance ST as an action inside of a SFC
action box

Animated 3D Model of the cutting device

Cutting device (Abschervorrichtung)

Cyl. C
Clamping
Cyl. A
Holding

Cyl. D
Cutting

Cyl. B Feeding
Cylinder A extends and holds the bar material

A:1

Cylinder B extends and feeds the material to the limit stop

B:1

Cylinder C extends and clamps the bar material in the cutting device

C:1

Cylinder A retracts (releases the hold) and cylinder D extends (cutting)

A:0 & D:1

Cylinder B retracts (the feeding unit moves back) and cylinder D retracts

B:0 & D:0

Cylinder C retracts and releases the clamping

C:0

Path-step diagram for the cutting device


Step
State
AND
connection of
2 signals

Current state
Signal

Limit switch

Cylinder A extends and holds the bar material

A:1

Cylinder B extends and feeds the material to the limit stop

B:1

Cylinder C extends and clamps the bar material in the cutting device

C:1

Cylinder A retracts (releases the hold) and cylinder D extends (cutting)

A:0 & D:1

Cylinder B retracts (the feeding unit moves back) and cylinder D retracts

B:0 & D:0

Cylinder C retracts and releases the clamping

C:0

Cyl. C
Clamping
Cyl. A
Holding

Cyl. D
Cutting

Cyl. B Feeding

path-step diagram: signal modeling


Sensors are connected via input variables to the signal lines.

Ordinary
signal line

Branching

Or
condition

And
condition

I/O list for the cutting device

The I/O list is listing all In- and Outputs used in the control:

Cyl. C
Clamping

Cyl. D
Cutting

Cyl. A
Holding

A/S
S0
S1
S2
S3
S4
S5
S6
S7
S8
A0
A1
A2
A3

Variable Name
di_start
di_cylA_home
di_cylA_work
di_cylB_home
di_cylB_work
di_cylC_home
di_cylC_work
di_cylD_home
di_cylD_work
do_cylA_valve
do_cylB_valve
do_cylC_valve
do_cylD_valve

Comment
Start button
Limit switch cyl. A home
Limit switch cyl. A work
Limit switch cyl. B home
Limit switch cyl. B work
Limit switch cyl. C home
Limit switch cyl. C work
Limit switch cyl. D home
Limit switch cyl. D work
Control valve for cylinder
Control valve for cylinder
Control valve for cylinder
Control valve for cylinder

Cyl. B Feeding

A
B
C
D
SIEMENS TIA Modul C1

FAQ: The terms analog and digital I/O in the PLC world
Digital outputs
Analog I/Os

Q: Input or Output? A: Always from the controls point of view!


Q: Analog or Digital? A: The signal from or to the control is binary (digital) or a
floating point value like 3.12435 (analog)

I/O list: bits and bytes


Naming convention(sample):

di_xxx
do_xxx
ai_xxx
ao_xxx

//digital input
//digital output
//analog input
//analog output

f.i.
f.i.
f.i.
f.i.

for
for
for
for

a limit switch
simple pneumatic cylinder
a temperature sensor
a motor

PLC byte interface for the communication with actuators and


sensors:
0.0
0.1
0.2
0.3
1 Byte
0.4
0.5
[4 Bytes (DoubleWord)
o
i
0.6
Analog I/O (float in C)]
a
d
0.7
1.0
1.1 1 Bit
[Digital I/O (bool in C++)]
..

SFC in SIEMENS..
..for the
cutting
device

Cyl. C
Clamping
Cyl. A
Holding

Cyl. B Feeding

SIEMENS TIA Modul C1

Cyl. D
Cutting

Objectives
Understand the principle setup and the properties of a PLC
Distinguish between the different sequential control types and
their characteristics
Classification of the major programming languages (SFC, ST
FBD, IL, LD) concerning their level of programming complexity
Know the elements and properties of SFC
Path step diagram and I/O list

Introduction Case 3.1


SIMATIC video

English settings in SIMATIC !


SIMATIC
Optionen
Einstellungen
Sprache ENGLISCH (BausteinBlock,..)
Mnemonics ENGLISCH (IE, QA,..)

You might also like