Sie sind auf Seite 1von 63

Steuerungstechnik

Hochschule Hof
Alfons Goppel Platz 1
95028 Hof

Praktikum zu Grundlagen der Automatisierung


Lab exercises Fundamentals of Automation Technology

Versuche S1P, S2P "Piff-Paff"- Portal


Speicherprogrammierbare Steuerungen
Exercises S1P, S2P "Piff-Paff" - Portal
Programmable Logic Controllers

Prof. Dr.-Ing. V.Plenk


W.Uschold, A.Fielk (V1.0 - WS 2012), W. Uschold (V2.0 - SS 2015)

Version 2.2b
2
Inhaltsverzeichnis
1 Sicherheitshinweise Safety Instructions 5
2 Vorbereitung auf den Versuch
Preparing for the Lab Excercise 6
3 Versuchsaufbau Experimental Set-Up 7
3.1 Entwicklungsrechner / Entwicklungssystem
Development Computer / Development System . . . . . . . . . . . . . . . . . . . 8
3.2 SPS / Verdrahtung PLC / Wiring . . . . . . . . . . . . . 8
3.3 Piff-Paff Portal / Aktoren und Sensoren
Piff-Paff Portal / actuators and sensors . . . . . . . . . . . . . . . . . . . . . . . 15
3.3.1 Sensoren Sensors . . . . . . . . . . . . . . 15
3.3.2 Aktoren Actuators . . . . . . . . . . . . . . 16
4 Programmerstellung Creating the Program 19
4.1 Struktureller Ablauf des Programms
Structure of the program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.2 Einstieg in die Simatic Programmierumgebung
Introduction to the Simatic programming environment . . . . . . . . . . . . . . . . 21
4.3 Ablaufsteuerungen in AWL / FUP
Sequence Control in IL / FBD . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.3.1 Ausgangszuweisungen Setting the outputs . . . . . . . . . 28
4.4 Weg-Schritt Diagramm
Path-Step-Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.5 Die Programmierung der Bausteine
The programming of the program blocks . . . . . . . . . . . . . . . . . . . . . . 30
4.5.1 Einfache Bewegung Simple Movement . . . . . . . . . 34
4.5.1.1 Beobachten und Steuern Monitoring and Controlling . . . . 36
4.5.1.2 Stopp- und Resetfunktion Stop- and Reset-function . . . . 37
4.5.2 Bibliotheksfähigen Baustein erstellen
Creating a library-compatible block . . . . . . . . . . . . . . . . . . . . . 37
4.5.3 Erweiterung der Schrittkette
Extending the step sequence . . . . . . . . . . . . . . . . . . . . . . . . 41
4.5.3.1 Erweitertes Weg-Schritt-Diagramm
Extended path-step-diagram . . . . . . . . . . . . . . . . . . . . 41
4.5.3.2 Erzeugen der Schrittnummer Creating a Step-Number . . . . 42
4.5.3.3 Steuern eines Ausgangs mit Hilfe der Schrittnummer
Controlling an output by means of the step number . . . . . . . . . . 43
4.5.3.4 Stopp und Pause Stop and Pause . . . . . . . . 44
4.5.4 Fehlererkennung Error handling . . . . . . . . . . . 45
4.5.5 Fertiges Programm Finished Program . . . . . . . . . . 46

3
Inhaltsverzeichnis

5 Technische Grundlagen
Technical Base 52
5.1 Prinzipielle Arbeitsweise einer SPS
Working Principles of a PLC . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
5.1.1 Struktur einer SPS Structure of a PLC . . . . . . . . . 52
5.1.1.1 Basiskomponenten einer SPS Basic components of a PLC . . . 53
5.1.1.2 Elektrischer Aufbau einer SPS Electrical Set-Up of a PLC . . . 53
5.1.2 Programmverarbeitung Processing of the Program . . . . . . . 56
5.1.3 Signaleingabe und Signalausgabe Signal Input and Output . . . . . 57
5.1.3.1 Binäre Signale Binary Signals . . . . . . . . . 58
5.1.3.2 Ein-/Ausgabebaugruppen Input- and Output-Modules . . . . 58
5.1.4 Digitale Signale Digital Signals . . . . . . . . . . . 59
5.1.5 Struktur der Steuerungssprache Structure of the Programming Language . . 59
5.1.5.1 Operationsumfang Range of Operations . . . . . . . 59
5.1.5.2 Operandenumfang Range of Operands . . . . . . . 60
5.1.5.3 Adressierung von Eingängen, Ausgängen und Merkern
Adresses for Inputs, Outputs and Flags . . . . . . . . . . . . . . . 61
5.1.5.4 Programmdarstellung Representations for Programs . . . . 63

4
1 Sicherheitshinweise Safety Instructions

Im Interesse Ihrer persönlichen Sicherheit In the interest of your personal safety and
und zur Vermeidung von Beschädigungen to avoid damage or destruction of equip-
bzw. Zerstörungen von Geräten beachten ment, please observe the following instruc-
Sie bitte die folgenden Hinweise: tions:
• Lassen Sie die Verdrahtung vor dem • Have the wiring checked before
Einschalten überprüfen! switching on!
• Achten Sie beim Einstecken der • When inserting a compressed air
Druckluft besonders darauf, dass der hose, make sure that the hose is firmly
Schlauch fest eingerastet ist! engaged!
• Stellen Sie den Druckregler auf einen • Set the pressure regulator to a value
Wert zwischen 2 und 4 bar! between 2 and 4 bar!
• Stecken Sie die Stecker fest in die • Insert the plugs firmly into the sock-
Buchsen, um Wackelkontakte zu ver- ets to avoid loose contacts!
meiden!
• Do not open the flap while a program
• Öffnen Sie die Klappe nicht während is running! Crushing Hazard!
ein Programm läuft! Quetschgefahr!
• Before disconnecting a compressed
• Warnen Sie vor dem Abstecken der air hose, warn people around you and
Druckluft umherstehende Personen hold the hose very tight!
und halten Sie den Schlauch beson-
• First test the program sequence
ders fest!
ONLY on the PC with simulated val-
• Testen Sie den Programmablauf zu- ues
erst NUR am PC mit simulierten ( S7 PLC Simulator / variable table ).
Werten
( S7 PLC Simulator / Variablentabelle
).

5
2 Vorbereitung auf den Versuch
Preparing for the Lab Excercise

Um den Versuch S1P /S2P im gegebe- In order to be able to carry out the exer-
nen Zeitrahmen erfolgreich durchführen zu cise S1P /S2P successfully in the given time
können, wird mit Nachdruck empfohlen, frame, it is strongly recommended to pro-
den Versuch S0 vorher zu bearbeiten. cess the exercise S0 before.
Lesen sie weiterhin die Kapitel 3 und 4 Please read the chapters 3 and 4 at home be-
für eine schnelle Bearbeitung des Versu- forehand. Thus, you will be able to focus on
ches vorher zu Hause durch, da die Zeit für the actual exercise during the lab hours.
die eigentliche Bearbeitung genutzt werden
muss.

Abbildung 2.1: Piff-Paff-Portal

6
3 Versuchsaufbau Experimental Set-Up

Ziel ist es, mit einer S7-SPS eine Steuerung The aim is to develop a control system for
für das „Piff-Paff“-Portal zu entwickeln. the ’piff-paff’ portal with an S7 PLC.
Der Versuch besteht aus den folgenden vier The experiment consists of the following
Hauptkomponenten: four main components:
Entwicklungsrechner: Der PC ist über ei- Development computer: The PC is con-
ne Ethernet-MPI-Schnittstelle mit der nected to the PLC via an Ethernet-
SPS verbunden. Auf dem PC wird die MPI interface. The development en-
Entwicklungsumgebung der SPS aus- vironment of the PLC is executed on
geführt. Programme, die entwickelt the PC. Programs that have been de-
und simuliert wurden, können vom veloped and simulated can be loaded
PC in die SPS geladen werden und from the PC into the PLC and tested.
getestet werden.
SPS: Die Siemens Kompakt-SPS (CPU PLC: The Siemens compact PLC (CPU
313C) ist mit 24 digitalen Eingängen 313C) with 24 digital inputs and 16
und 16 digitalen Ausgängen (+ analo- digital outputs (+ analog inputs and
ge Ein- und Ausgänge) für das Expe- outputs) is ideal for experimentation.
rimentieren ideal geeignet. Die Ein- The inputs and outputs are routed via
und Ausgänge werden über die Ba- the banana jacks. (Fig. 3.1 and Fig.
nanenbuchsen geführt. (Abb. 3.1 und 3.4). In addition, a simple operating
Abb. 3.4). Ausserdem ist noch ein panel is connected, which can be as-
einfaches Tastenfeld angeschlossen, signed the functions Start, Stop and
das mit den Funktionen Start, Stopp Reset.
und Reset belegt werden kann.
Bedienpanel: Hier wird ein Siemens Si- Operating Panel: A Siemens Simatic OP
matic OP Bedienpanel verwendet. operating panel is used here. The pro-
Die Programmierung erfolgt über gramming is done via WinCC flexi-
WinCC flexible. Die Hardwarekonfi- ble. The hardware configuration and
guration sowie die Programmierung the programming of the visualization
der Visualisierung kann direkt im can be started directly in the TIA
TIA-Portal gestartet werden. Da dies portal. However, since this would
jedoch den Rahmen des Praktikums go beyond the scope of the practical
sprengen würde, wird darauf verzich- course, this is not necessary. How-
tet. Es ist jedoch möglich eine einfa- ever, it is possible to create a simple
che Bedienoberfläche am PC zu er- user interface on the PC.

7
3.2 SPS / Verdrahtung PLC / Wiring

stellen.
Piff-Paff Portal: Es handelt sich um eine Piff-Paff Portal: This is a pneumatically
pneumatisch betriebene Anlage, die operated system that can be moved on
auf 3 Achsen bewegt werden kann. 3 axes. A plastic chip can be moved
Über einen Sauger kann ein Plastik- from one of the 4 positions to another
chip von einer der 4 Positionen auf via a suction cup.
eine andere bewegt werden.

3.1 Entwicklungsrechner / Entwicklungssystem


Development Computer / Development System
Der Entwicklungsrechner dient als Editor The development computer serves as an ed-
und Compiler für das SPS-Programm sowie itor and compiler for the PLC program and
als Debug-Anzeige. Die gesamte Funktio- as a debug display. The entire functional-
nalität ist im Programm „TIA-Portal“ inte- ity is integrated in the application software
griert. "TIA-Portal".

3.2 SPS / Verdrahtung PLC / Wiring


Der Betriebszustand der SPS kann über The operating state of the PLC can be se-
einen Kippschalter auf der Frontplatte ge- lected via a toggle switch on the front panel.
wählt werden. Die einzelnen Stellungen ha- The individual positions have the following
ben dabei die folgende Bedeutung: meaning:
STOP: Die SPS wird angehalten, sämtli- STOP: The PLC is stopped, all outputs are
che Ausgänge werden abgeschaltet. switched off.
RUN: (Auch RUN-P) Die SPS wird gest- RUN: (Also RUN-P) The PLC is started,
artet, die Ausgänge werden durch die the outputs are controlled by the soft-
Software gesteuert. Sämtliche Test- ware. All test functions are available
funktionen sind auf dem Entwick- on the development computer.
lungsrechner verfügbar. The operating state of the PLC can
Auch der Betriebszustand der SPS (and should!) also be controlled
kann (und sollte!) vom Entwick- from the development computer.
lungsrechner aus gesteuert wer-
den.
MRES: Über diese Schalterstellung kann MRES: Via this switch position the CPU
die CPU urgelöscht werden. Dadurch can be reset. This deletes all data and
werden alle Daten sowie die Hard- the hardware configuration. The PLC
warekonfiguration gelöscht. Die SPS is reset to the factory setting.

8
3.2 SPS / Verdrahtung PLC / Wiring

wird auf den Werkszustand zurückge-


setzt.
Der momentane Betriebszustand der SPS The current operating status of the PLC is
wird über eine Reihe von Status-LEDs auf indicated by a series of status LEDs on the
der Frontplatte angezeigt. Von besonderem front panel. The following displays are of
Interesse sind dabei die folgenden Anzei- particular interest:
gen:
DC5V: Die Versorgungsspannung für die DC5V: The supply voltage for the PLC is
SPS liegt an. present.
STOP: Die SPS wurde angehalten und STOP: The PLC has been stopped and is
arbeitet nicht, sämtliche Ausgänge not working, all outputs have been
wurden abgeschaltet. switched off.
RUN: Blinklicht: Die SPS führt die Initia- RUN: Flashing: The PLC is performing the
lisierung durch. Dauerlicht: Die SPS initialization. Continuous light: The
arbeitet, die Ausgänge werden durch PLC is working, the outputs are con-
die Software gesteuert. trolled by the software.
Die SPS besitzt 24 binäre Eingänge, von de- The PLC has 24 binary inputs, 16 of which
nen 16 auf Bananenbuchsen geführt und mit are connected to banana jacks and ad-
den Adressen %I 124.0 bis %I 125.7 ange- dressed with the addresses %I 124.0 to %I
sprochen werden. 125.7.
Liegt am entsprechenden Eingang eine If a voltage of 24V is applied to the corre-
Spannung 24V an, so wird dieser auf lo- sponding input, it is set to logical 1.
gisch 1 gesetzt.
Ist die Spannung am Eingang gleich 0, so If the voltage at the input is 0, the input has
hat der Eingang den logischen Wert 0. Viele the logical value 0. Many sensors are de-
Sensoren sind als einfache Schalter ausge- signed as simple switches and must be sup-
führt und müssen mit 24V vom Netzteil der plied with 24V from the power supply unit
SPS versorgt werden.Das Sensorsignal wird of the PLC.
danach vom Schalter zum Digital-Eingang
an der SPS geführt.
Weiterhin verfügt die SPS über 16 binäre Furthermore, the PLC has 16 binary outputs
Ausgänge, die mit den Adressen %Q 124.0 that are addressed with the addresses %Q
bis %Q 125.7 angesprochen werden. Wird 124.0 to %Q 125.7. If a 1 is assigned to
dem Ausgang eine 1 zugewiesen, liegen an the output, 24V is available at the socket. If
der Buchse 24V an. Falls eine 0 zugewie- a 0 is assigned, 0V is present at the socket
sen wird, so liegen dementsprechend an der accordingly. To close a circuit with the ac-
Buchse 0V an. Um einen Stromkreis mit tuator, the 24V must be fed from the output
dem Aktor zu schließen, müssen die 24V socket to the actuator and from there back
von der Ausgangsbuchse zum Aktor und to the ground connection of the PLC.
von dort zurück zum Masseanschluss der

9
3.2 SPS / Verdrahtung PLC / Wiring

Abbildung 3.1: Frontplatte der SPS


Frontpanel of the PLC

10
3.2 SPS / Verdrahtung PLC / Wiring

SPS geführt werden.


Bei der Bedienung des Tastenfeldes (Abb. When operating the keypad (fig. 3.3), you
3.3) müssen sie darauf achten, dass Start- must take into account that the start and re-
sowie Resetknopf als Schließer arbeiten. set buttons operate as normally open con-
Die Stoptaste hingegen ist als Öffner ange- tacts. The stop button, on the other hand, is
schlossen. connected as a normally closed contact.

Abbildung 3.2: Schema Schließer ←→ Öffner


Schematics normally open ←→ normally closed contact

Dies bedeutet für Sie, dass beim Drücken This means that when you press the start
der Start- sowie der Resettaste ein Signal- and reset buttons, the signal changes from
wechsel von ’0’ nach ’1’ vollzogen wird. ’0’ to ’1’. The stop button has a logical ’1’
Bei der Stopptaste liegt im unbetätigten when it is not pressed, which becomes a ’0’
Zustand eine logische ’1’ an, die beim when the button is pressed.
Drücken der Taste zu einer ’0’ wird.

Abbildung 3.3: Tastenfeld inkl. physikalischer Adressen


Operator panel incl. physical addresses

Bei der Verkabelung der Ein- und Ausgän- When wiring the inputs and outputs, make
ge ist darauf zu achten, dass die jeweili- sure that the respective addresses on the
gen Adressen an der SPS und dem Piff-Paff PLC and the piff-paff portal match. For ex-

11
3.2 SPS / Verdrahtung PLC / Wiring

Portal übereinstimmen. Zum Beispiel Digi- ample Digital Input Byte 0, connection 0 on
tal Input Byte 0, Anschluss 0 auf PP-Portal PP-Portal E0.0, connection 1 on E0.1, etc..
E0.0, Anschluss 1 auf E0.1, usw... (Siehe (See figure 3.4)
Abbildung 3.4)
Um die Übersicht zu wahren, wählen To keep an overview, please choose blue
Sie bitte für Signalverbindungen blaue cables for signal connections and red/black
Kabel und für die Stromversorgung for power supply (fig. 3.5).
rot/schwarz.(Abb. 3.5)
Zusätzlich zur Stromversorgung muss im In addition to the power supply, the sensor
Anschluss noch der Sensor für die Klappe for the flap of the PP portal must be con-
des PP-Portals mit dem Eingang E0.7, so- nected to input E0.7, and the keypad and
wie das Tastenfeld und die DI/DO Baugrup- the DI/DO module must be connected to the
pe mit den dickeren grauen Buskabeln (im thicker grey bus cables (dark blue in the pic-
Bild dunkelblau) verbunden werden. ture).
(Siehe Abbildung 3.5) (see figure 3.5)
LASSEN SIE DIE VERKABELUNG HAVE YOUR WIRING CHECKED BE-
VOR DEM ANSCHALTEN UNBE- FORE POWERING ON!
DINGT ÜBERPRÜFEN!

12
3.2 SPS / Verdrahtung PLC / Wiring

Abbildung 3.4: Verkabelung der Ein- und Ausgänge von SPS und dem Piff-Paff Portal
Wiring the PLC inputs and outputs to the piff-paff portal

13
3.2 SPS / Verdrahtung PLC / Wiring

Abbildung 3.5: Verkabelung der Stromversorgung aller Geräte


Power supply cabling for all devices

14
3.3 Piff-Paff Portal / Aktoren und Sensoren
Piff-Paff Portal / actuators and sensors

3.3 Piff-Paff Portal / Aktoren und Sensoren


Piff-Paff Portal / actuators and sensors

3.3.1 Sensoren Sensors

Die Signale, die der pneumatisch betriebene The signals supplied by the pneumati-
Automat liefert, sind binäre Signale. Die- cally operated automaton are binary signals.
se werden in die SPS eingelesen und kön- These are read into the PLC and can thus
nen so auch auf dem Entwicklungsrechner also be observed on the development com-
beobachtet werden. Diese Signale werden puter. These signals are generated by var-
von verschiedenen Sensoren im Automaten ious sensors in the machine (Figure 3.6).
erzeugt (Abbildung 3.6). Die in untenste- The PLC addresses used in the table below
hender Tabelle verwendeten SPS-Adressen are intended as suggestions. Of course you
sind als Vorschlag gedacht. Sie können die can choose the addresses freely.
Adressen natürlich auch frei wählen.
In der nachstehenden Übersicht werden die The following overview shows the individ-
einzelnen Eingänge der Anschlussbox und ual inputs of the connection box and their
ihre Funktionalität dargestellt: functionality:

SPS- Sensor/Funktion Bemerkung


Eingang
%I 124.0 Endlage rechts Zylinder 1 hat die rechte Endlage erreicht
%I 124.0 end position right cylinder 1 has reached the right end position
%I 124.1 Endlage links Zylinder 1 hat die linke Endlage erreicht
%I 124.1 end position left cylinder 1 has reached the left end position
%I 124.2 Endlage vorne Zylinder 2 hat die vordere Endlage erreicht
%I 124.2 End position front cylinder 2 has reached the front end position
%I 124.3 Endlage hinten Zylinder 2 hat die hintere Endlage erreicht
%I 124.3 rear end position cylinder 2 has reached rear end position
%I 124.4 Endlage unten Zylinder 3 hat die untere Endlage erreicht
%I 124.4 end position down cylinder 3 has reached the lower end position
%I 124.5 Endlage oben Zylinder 3 hat die obere Endlage erreicht
%I 124.5 End position up cylinder 3 has reached the upper end position
%I 124.7 Klappe zu Sicherheitssensor Klappe geschlossen
%I 124.7 flap closed safety sensor flap closed

15
3.3 Piff-Paff Portal / Aktoren und Sensoren
Piff-Paff Portal / actuators and sensors

Abbildung 3.6: Endlagen der Zylinder


End positions of the cylinders

3.3.2 Aktoren Actuators

Das Piff-Paff Portal verfügt über 7 Aktoren, The Piff-Paff Portal has 7 actuators that can
die als binäre Ausgänge an die SPS ange- be connected to the PLC as binary outputs.
bunden werden können. (Abb. 3.8) (Fig. 3.8)
In der nachstehenden Übersicht werden die The following overview shows the individ-
einzelnen Ausgänge des Piff-Paff-Portals ual outputs of the piff-paff portal (again, the
(auch hier sind die Adressen nur ein addresses are only a suggestion) and their
Vorschlag) und ihre Funktionalität darge- functionality:
stellt:

SPS- Ansteuerung/Funktion
Ausgang
%Q 124.0 Zylinder 1 nach links fahren
%Q 124.0 move cylinder 1 left

16
3.3 Piff-Paff Portal / Aktoren und Sensoren
Piff-Paff Portal / actuators and sensors

%Q 124.1 Zylinder 1 nach rechts fahren


%Q 124.1 move cylinder 1 right
%Q 124.2 Zylinder 2 nach vorne fahren
%Q 124.2 move cylinder 2 forward
%Q 124.3 Zylinder 2 nach hinten fahren
%Q 124.3 move cylinder 2 backwards
%Q 124.4 Zylinder 3 nach unten fahren
%Q 124.4 move cylinder 3 down
%Q 124.5 Zylinder 3 nach oben fahren
%Q 124.5 move cylinder 3 up
%Q 124.7 Sauger aktivieren
%Q 124.7 activate suction

Die verwendeten, federlosen 5/2-Wege- The 5/2-way valves used (Fig. 3.7) cannot
Ventile (Abb. 3.7) können während einer be stopped during a movement in progress
laufenden Bewegung nicht angehalten wer- and will continue to move until the end po-
den und werden diese auch ohne Ansteue- sition even without actuation. It is therefore
rung bis zum Ende ausführen. Das Halten not possible to stop at a position other than
auf einer Position abseits der Endlagen so- the end positions or to change the direction
wie eine Änderung der Bewegungsrichtung of movement.
ist somit nicht möglich.

Abbildung 3.7: Ansteuerung der Zylinder über ein 5/2-Wege-Ventil

Der Sauger wird über ein einfaches 3/2- The suction cup is controlled by a simple
Wege-Ventil angesteuert und kann somit 3/2-way valve and can therefore only be
nur ein- oder ausgeschaltet werden. Eine switched on or off. Monitoring is not possi-

17
3.3 Piff-Paff Portal / Aktoren und Sensoren
Piff-Paff Portal / actuators and sensors

Abbildung 3.8: Wertetabelle der Ansteuerung der Zylinder

Überwachung ist nicht möglich, da er über ble as it does not have any sensors.
keinerlei Sensoren verfügt.

18
4 Programmerstellung Creating the Program

Bevor Sie mit der Programmerstellung be- Before you start creating the program, you
ginnen, sollten Sie sich überlegen, welche should consider which inputs and outputs
Ein- und Ausgänge sich auf der Maschi- are on the machine side (actuators and sen-
nenseite (Aktoren und Sensoren) sowie auf sors) and on the user side (switches, keys).
der Benutzerseite (Schalter, Tasten) befin- It is best to create an overview in which you
den. Am besten erstellen Sie sich eine Über- define the inputs and outputs. (Example see
sicht, in der Sie die Ein- und Ausgänge fest- figure 4.1)
legen. (Beispiel siehe Abbildung 4.1
Diese Vorgehensweise erleichtert die Ori- This procedure facilitates orientation when
entierung beim Programmieren der SPS programming the PLC and provides a better
und schafft einen besser Überblick über die overview of the functions. Potential errors
Funktionen. Auch die potentiellen Fehler during testing of the individual functions
beim Testen der einzelnen Funktionen und and the overall process can also be traced
des Gesamtablaufs können somit schneller and eliminated more quickly.
zurückverfolgt und behoben werden.
Das Programm besteht im wesentlichen aus The program essentially consists of the or-
dem Organisationsbaustein 1 (OB1 ) und ganization block 1 (OB1 ) and various func-
diversen Funktionen und Funktionsbaustei- tions and function blocks into which the
nen, in welche die Programmieraufgabe programming task is divided. This is be-
aufgeteilt wird. Dies deswegen, weil es vor- cause it is advantageous to divide larger
teilhaft ist größere Programmieraufgaben programming tasks into individual smaller,
in einzelne kleinere, logisch zusammen- logically connected subtasks.
hängende, Teilaufgaben zu unterteilen. OB 1 is the interface between the user pro-
Der OB 1 bildet dabei sozusagen die gram and the operating system. The calls
Schnittstelle zwischen Anwenderpro- of the individual program blocks (FCs and
gramm und Betriebssystem. Hier stehen die FBs) are located here.
Aufrufe der einzelnen Programmbausteine
( FCs und FBs ).

4.1 Struktureller Ablauf des Programms


Structure of the program
In der Programmierumgegbung des TIA- In the programming environment of the
Portals können in einer Variablentabelle die TIA Portal, the inputs and outputs can be

19
4.1 Struktureller Ablauf des Programms
Structure of the program

Abbildung 4.1: Vorschlag zur Festlegung der Eingänge mit Datentyp


Proposal for defining the inputs with data type

Ein- und Ausgänge mit symbolischen Na- designated with symbolic names in a table
men bezeichnet werden . Damit ist es ein- of variables. This makes it easier to pro-
facher zu Programmieren als mit absolu- gram than with absolute addresses. Since
ten Adressen. Da für eine professionelle professional programming requires the use
Programmierung der Umgang mit symbo- of symbolic names for clarity, maintenance
lischen Namen für die Übersichtlichkeit, and troubleshooting, the symbolic names
Pflege und Fehlersuche unumgänglich ist, should be assigned first.
sollen zunächst die symbolischen Namen
vergeben werden.
Beispiel: Example:
Absolute Adresse: %I 124.0 Absolute Address: %I 124.0
Symbolische Adresse: Endlage rechts Symbolic Address: End position right
Die Aufgabe des Praktikums besteht darin, The task of the lab experiment is to repro-
die Abläufe des Piff-Paff Portals mit der S7- duce the processes of the Piff-Paff Portal
Steuerung nachzubilden. Um alle Abläu- with the S7 control system. In order to be
fe nachvollziehen zu können, sind nachfol- able to reproduce all processes, the indi-
gend die einzelnen Schritte beschrieben. Zu vidual steps are described below. For each
jedem einzelnen Schritt werden dann Infor- individual step, information is then given
mationen gegeben, die für die Umsetzung which is necessary for the implementation
in der S7 notwendig sind. Lesen Sie des- in S7. Therefore please read the following
halb die folgenden Informationen sorgfältig information carefully.
durch.
Für eine optimale Durchführung ist es emp- For an optimal execution it is recommended
fehlenswert einzelne Funktionen zu bear- to edit individual functions and to test them
beiten und sie zunächst separat zu testen. separately first. Also, each input should be

20
4.2 Einstieg in die Simatic Programmierumgebung
Introduction to the Simatic programming environment

Auch sollte jeder Eingang testweise einge- read in for a test and each output should be
lesen und jeder Ausgang einmal angesteuert controlled once to check if the wiring is cor-
werden, um zu überprüfen, ob die Verkabe- rect (an observation table helps here!). This
lung stimmt (dabei hilft eine Beobachtungs- makes troubleshooting much easier. The
tabelle!). So wird die Fehlersuche erheb- use of symbolic addressing also contributes
lich vereinfacht. Auch die Anwendung der to this. If all functions are error-free, they
symbolischen Adressierung trägt dazu bei. can then be combined to form the overall
Sind alle Funktionen fehlerfrei können sie program.
dann zum Gesamtprogramm zusammenge-
führt werden.
Die Stuktur des Gesamtablaufes soll als The structure of the overall process should
AWL bzw. FUP Schrittkette nachgebildet be reproduced as an IL or FBD step se-
werden. Alle anderen Funktionen können in quence. All other functions can be pro-
FUP programmiert werden. grammed in FBD.
Zum Testen des Programms und der There are two ways to test the program
einzelnen Funktionen stehen Ihnen zwei and the individual functions:
Möglichkeiten zur Verfügung:
1. Der Simulator PLCSIM. The simulator PLCSIM.
2. Die SPS. Dabei ist jedoch unbedingt The PLC. However, it is essential
darauf zu achten , dass die Verka- to ensure that the cabling and the
belung sowie der Druckluftanschluss compressed air connection have been
vorher sorgfältig geprüft wurden. carefully checked beforehand.

4.2 Einstieg in die Simatic Programmierumgebung


Introduction to the Simatic programming environment
Erstellen Sie nun mit dem TIA-Portal ein Now create a new project with the TIA Por-
neues Projekt und legen dort den Funkti- tal and create the function block FB1 there
onsbaustein FB1 in der Sprache AWL oder in the IL or FBD language. Enter each cir-
FUP an. Geben Sie in diesem FB jede cuit / step in this FB as a separate network!
Schaltung / jeden Schritt als eigenes Netz- Proceed in the following steps:
werk ein! Gehen Sie dabei in den folgenden
Schritten vor:

1. Starten des TIA-Portals und erstellen Start the TIA Portal and create a new
eines neuen Projekts. project.

21
4.2 Einstieg in die Simatic Programmierumgebung
Introduction to the Simatic programming environment

2. Konfiguration der Hardware: SPS -> Configuration of the hardware: PLC


313C , Version 2.6 -> 313C , Version 2.6

3. Zuerst sollte die MPI-Adresse über- First the MPI address should be
prüft und ein Taktmerkerbyte festge- checked and a flag byte should be re-
legt werden. served for the clock.

22
4.2 Einstieg in die Simatic Programmierumgebung
Introduction to the Simatic programming environment

4. Auch sind die symbolischen Namen The symbolic names must also be
zu erstellen -> Variablentabelle öff- created -> open the variable table and
nen und Namen für die Ein-, Ausgän- assign names for the inputs, outputs
ge und Merker zu vergeben. and flags.

23
4.3 Ablaufsteuerungen in AWL / FUP
Sequence Control in IL / FBD

4.3 Ablaufsteuerungen in AWL / FUP


Sequence Control in IL / FBD
Grundwissen: Basic knowledge:
Um eine Ablaufsteuerung (Schrittkette) in To program a sequence control (step se-
AWL / FUP zu programmieren, müssen ei- quence) in IL / FBD, some important fac-
nige wichtige Faktoren beachtet werden. tors must be considered.
Der Schritt 1 wird als Grundstellung bzw. Step 1 is referred to as the initial position
Initialschritt bezeichnet. Hier werden keine or initial step. No controls required for the
für den Ablauf benötigten Ansteuerungen sequence are executed here. However, this
ausgeführt. Jedoch kann dieser Schritt dazu step can be used to bring the system (cylin-
dienen, die Anlage (Zylinder) in eine defi- der) into a defined basic position and thus
nierten Grundstellung zu bringen und somit mark the step sequence as ready to start.
die Schrittkette als startbereit zu kennzeich- This is followed by the steps that are in-
nen. tended to execute the desired actions/move-
Anschließend folgen die Schritte, die zur ments. The procedure is always based on a
Ausführung der gewünschten Aktionen/Be- simple scheme:
wegungen vorgesehen sind. Dabei wird im-
mer nach einem einfachen Schema verfah-
ren:

Erklärung: Explanation:
Wenn ein Schritt gesetzt werden soll, muss If a step is to be set, the previous step must
der vorhergehende Schritt aktiv sein UND be active AND the step-on condition to the
die Weiterschaltbedingung zum aktuellen current step must be fulfilled.
Schritt erfüllt sein. Similarly, an active step is ended (reset)

24
4.3 Ablaufsteuerungen in AWL / FUP
Sequence Control in IL / FBD

Abbildung 4.2: Einfacher Ablauf dargestellt in Grafcet (ähnlich: Graph)

Analog dazu wird ein aktiver Schritt been- when the next step is set and thus becomes
det (rückgesetzt), wenn der nächste Schritt active.
gesetzt und somit aktiv wird.
Im Vergleich zu S7-Graph (Siehe Abb. 4.2) Compared to S7-Graph (see fig. 4.2) the
wird der Initialschritt jedoch in FUP, bzw. initial step is not automatically set in FBD
AWL nicht automatisch gesetzt. Sie müs- or IL. You have to implement this with a
sen Sie dies mit einigen wenigen Codezei- few lines of code.
len implementieren.
Der OB100 ist ein Baustein, der beim (Neu- The OB100 is a block that is processed ex-
)Start der SPS genau einmal abgearbeitet actly once when the PLC is (re-)started. It
wird. Er wird deshalb zum Beispiel zum In- is therefore used, for example, to initialize
itialisieren von Programmteilen, in unserem program parts, in our case step 1 of the se-
Fall Schritt 1 der Ablaufsteuerung, verwen- quence control.
det.
Erstellen Sie den Organisiationsbaustein Create the organization block OB100, de-
OB100, deklarieren den Initmerker in der clare the init flag in the variable table and
Variablentabelle und programmieren die In- program the initialization in OB100.
itialisierung im OB100.

25
4.3 Ablaufsteuerungen in AWL / FUP
Sequence Control in IL / FBD

Achtung: Es ist sinnvoll den Initmerker Attention: It makes sense to put the
und alle Schrittmerker in den nichtre- init flag and all step flags into the non-
manenten Speicherbereich zu legen. Da- remanent memory area. To do this, check
zu überprüfen Sie in der Gerätekonfigurati- the remanent area in the device configu-
on der CPU den Remanenzbereich und ver- ration of the CPU and change it if neces-
ändern diesen, falls nötig. sary.

Der Initialisierungsmerker muss speichernd The initialization flag must be programmed


programmiert werden, damit er nach dem in a way that it is available to other blocks
Start der CPU anderen Bausteinen zur Ver- after the CPU has been started. This is
fügung steht. Dafür wird die Tatsache aus- done by taking advantage of the fact that

26
4.3 Ablaufsteuerungen in AWL / FUP
Sequence Control in IL / FBD

genutzt, dass alle nichtremanenten Merker- all non-remanent flag bits have the FALSE
bits beim Einschalten der SPS den Zustand state when the PLC is switched on. There-
FALSE haben. Deshalb ist das Einzige, das fore, the only thing that needs to be pro-
im OB100 programmiert werden muss, den grammed in OB100 is to set the initializa-
Initialisierungsmerker zu setzen, wenn die- tion flag when it is FALSE).
ser FALSE ist).

Als Abschluss muss der Initialisierungs- Finally, the initialization flag must be reset,
merker noch zurückgesetzt werden, da der otherwise the flag would permanently acti-
Merker sonst dauerhaft Schritt 1 aktivieren vate step 1. This must be done in the main
würde. Dies muss im Hauptprogramm, oder program or in the block containing the step
in dem Baustein, der die Schrittkette ent- sequence. As an exception, here we will use
hält, geschehen. Hierzu benutzen wir aus- the output of the SR block that is activated
nahmsweise den Ausgang desjenigen SR- when the CPU is started to set the initializa-
Bausteins, der beim Starten der CPU mit tion flag. In this case it is "Schritt1". There
dem Initialisierungsmerker gesetzt wird. In we reset the init flag with the command R
diesem Fall ist es „Schritt1“. Dort setzen "‘Reset output"’.
wir den Init-Merker mit dem Befehl R
„Ausgang rücksetzen“ zurück.
Achtung: im Schrittketten-FB nicht, wie Attention: do not work with absolute ad-
hier im Beispiel, mit absoluten Adressen ar- dresses in the step sequence FB, as in the
beiten! example here!

27
4.3 Ablaufsteuerungen in AWL / FUP
Sequence Control in IL / FBD

Diese Operation setzt den Initialisierungs- This operation resets the initialization flag
merker der Schrittkette zurück. (Im Beispiel of the step sequence. (In the example,
bleibt Schritt1 solange gesetzt, bis er von Schritt1 remains set until it is reset by
Schritt2 zurückgesetzt wird) Schritt2)
Sie haben nun eine Möglichkeit kennen- Now you have learned about a possibility to
gelernt eine Initialisierung von bestimmten initialize certain variables when the PLC is
Variablen beim Einschalten der SPS durch- switched on. For example, variables could
zuführen. Es könnten damit z.B. auch Va- be set/reset, preset with values, etc.
riablen gestzt / rückgesetzt, mit Werten vor-
belegt... werden.
Auf den neueren SPSen von Siemens steht On the newer PLCs from Siemens you have
Ihnen für derartige Aufgaben auch der Sy- access to such tasks, the system flag "First
stemmerker „First Scan“ zur Verfügung. Scan" is also available.

4.3.1 Ausgangszuweisungen Setting the outputs

Die jeweiligen Ausgangszuweisungen müs- The respective output assignments must be


sen, immer getrennt von den einzelnen programmed, always separate from the
Schritten, entweder im Schrittkettenbau- individual steps, either in the step se-
stein, in (vorzugsweise) einem eigenen FC, quence block, in (preferably) a separate FC,
oder im OB1 programmiert werden. or in OB1.
In genanntem Beispiel wären dies: In the above example these would be:

1. Schritt2: Z1 nach rechts fahren Schritt2: Drive Z1 to the right

2. Schritt3: Z1 nach links fahren Schritt3: Drive Z1 to the left

28
4.3 Ablaufsteuerungen in AWL / FUP
Sequence Control in IL / FBD

Wichtig ist in diesem Zusammenhang noch, In this context it is important that if an


dass, falls ein Ausgang in mehreren Schrit- output is addressed in several steps (e.g.
ten angesprochen wird (z.B. ’Z3 nach un- ’Move Z3 down’ when picking up and
ten fahren’ beim Aufheben und Ablegen putting down the chip), it is assigned only
des Chips), dieser mit einer ODER Ver- once with an OR operation, because oth-
knüpfung nur einmal zugewiesen wird, da erwise different controls would overwrite
sich unterschiedliche Ansteuerungen sonst each other, because instructions in the pro-
gegenseitig überschreiben würden, denn im gram that are ’down’ will to overwrite in-
Programm weiter „unten“ stehende Anwei- structions that are ’up’!
sungen überschreiben weiter „oben“ ste-
hende!

Als Besonderheit ist in dieser Abbildung zu A special feature of this illustration is that
sehen, dass auf die einzelnen Bits (Schritte) the individual bits (steps) of the step se-
des Schrittketten-FB über dessen Instanz- quence FB are accessed via its instance

29
4.5 Die Programmierung der Bausteine
The programming of the program blocks

DB zugegriffen wird! DB!


Jeder Ausgang sollte im Programm nur Each output should only be addressed
ein einziges Mal angesprochen wer- only once in the program!
den!

4.4 Weg-Schritt Diagramm


Path-Step-Diagram
Um sich einen anschaulichen Überblick In order to get a clear overview of the steps,
über die Schritte, deren Ausgangszuwei- their initial assignments and the associated
sungen und die dazugehörigen Weiter- step-on conditions, the creation of a path-
schaltbedingungen zu verschaffen, ist das step-diagram is a useful tool. (See figure
Anfertigen eines Weg-Schritt-Diagramms 4.3)
ein nützliches Werkzeug. (Siehe Abbildung
4.3)
In nachfolgendem Diagramm ist die Bewe- The following diagram shows the move-
gung des Aus- und wieder Einfahrens des ment of extending and retracting cylinder
Zylinders Z1 dargestellt. Z1.
Dabei wird der Chip nicht bewegt und auch The chip is not moved and the suction cup
der Sauger nicht angesteuert. is not activated.
Hier wird von einer Grundstellung in den Here, a initial position in the end positions
Endlagen links, hinten und oben ausgegan- left, back and up is assumed.
gen.
Im Schritt 1 (Initialschritt) wird auf die Be- In Schritt1 (initial step) the system waits
nutzereingabe ’Start’ gewartet. Anschlie- for the user input ’Start’. Then cylinder 1
ßend fährt der Zylinder 1 nach rechts bis moves to the right until it reaches the end
in Endlage. Ist diese erreicht, fährt der Zy- position. Once this is reached, the cylinder
linder wieder zurück in die Ausgangspositi- returns to the starting position and is thus
on und ist somit wieder startbereit für einen ready to start a new sequence.
neuen Ablauf.

4.5 Die Programmierung der Bausteine


The programming of the program blocks
Dieser Abschnitt beinhaltet die Program- This section contains the programming of
mierung der Funktionen des Piff-Paff- the functions of the Piff-Paff-Portal.
Portals.

30
4.5 Die Programmierung der Bausteine
The programming of the program blocks

Abbildung 4.3: Weg-Schritt-Diagramm Beispiel

Sie könnten das gesamte Programm na- Of course you could just write the whole
türlich einfach in den OB1 schreiben - program into OB1 - it would work. But
es würde funktionieren. Jedoch wären kei- no parts of the program would be reusable!
ne Programmteile wiederverwendbar! Die The programming of the step sequence is
Programmierung der Schrittkette erfolgt therefore carried out in a function block
deshalb in einem Funktionsbaustein (FB). (FB). In contrast to a simple function (FC),
Ein FB hat, im Gegensatz zu einer einfa- an FB has a "memory". This memory is an
chen Funktion (FC), ein „Gedächtnis“. Die- instance data block (DB) that is assigned to
ses Gedächtnis ist ein Instanzdatenbaustein the FB. With the help of this data block it is
(DB) der dem FB zugeordnet ist. Mit Hil- possible to store data beyond the process-
fe dieses Datenbausteins ist es möglich Da- ing time of the function block. The data
ten über die Bearbeitungsdauer des Funkti- stored here is also valid outside of the func-
onsbausteins hinaus zu speichern. Die hier tion block call. For example, the ambient
abgelegten Daten sind auch außerhalb des temperature, test values or the active steps
Bausteinaufrufs gültig. So kann man z.B. of a sequence control can be stored in this
die Umgebungstemperatur, Prüfwerte, oder data area and accessed at any time.
aber auch die aktiven Schritte einer Ablauf-
steuerung in diesen Datenbereich ablegen
und jederzeit darauf zugreifen.

31
4.5 Die Programmierung der Bausteine
The programming of the program blocks

Die Variablendeklaration in FBs erfolgt in- The variable declaration in FBs is done
nerhalb des Bausteins über die Deklarati- within the block via the declaration table
onstabelle des FB. Die hier deklarierten Va- of the FB. The variables declared here re-
riablen ergeben die Struktur des Instanz- sult in the structure of the instance DB! In
DB! Im Programm des FB werden nur bau- the program of the FB only variables inter-
steininterne Variablen verwendet. So wird nal to the block are used. This makes the
die Schrittkette universell einsetzbar und step sequence universally applicable and
wiederverwendbar. reusable.

Erstellen Sie nun den Funktionsbaustein Now create the function module FB1 in the
FB1 in der Erstellsprache FUP. FBD creation language.

32
4.5 Die Programmierung der Bausteine
The programming of the program blocks

Der Funktionsbaustein muss danach im The function module must then be called in
übergeordneten Baustein aufgerufen wer- the higher-level module.
den.
In diesem Fall im OB1. Dazu ziehen Sie den In this case in OB1. To do this, drag the
Baustein FB1 per „Drag & Drop“ in den block FB1 via "‘Drag & Drop"’ into OB1.
OB1. Lassen Sie den Instanzdatenbaustein Have the instance data block created auto-
automatisch erstellen. matically.
Achtung: Ihr Baustein wird weniger Attention: Your block will have fewer in-
Schnittstellenvariablen haben als der un- terface variables than the block below.
tenstehende Baustein. Diese werden erst These will be created bit by bit!
nach und nach erstellt!

33
4.5 Die Programmierung der Bausteine
The programming of the program blocks

4.5.1 Einfache Bewegung Simple Movement

Erstellen Sie im FB1 eine passende Schritt- Create a suitable step sequence in FB1 to let
kette um das Piff-Paff Portal eine einfache the piff-paff portal perform a simple move-
Bewegung ausführen zu lassen. (Zum Bei- ment. (For example, simply let cylinder 1
spiel lassen Sie den Zylinder 1 einfach nur move to the right and then to the left again).
nach rechts und anschliessend wieder nach (See figure 4.4)
links fahren.) (Siehe Abb. 4.4)
Verwenden Sie nur bausteininterne Va- Use only module-internal variables.
riablen. Declare each step in the FB as a static
Deklarieren Sie jeden Schritt im FB als BOOL variable. Furthermore you still need
statische BOOL-Variable. Weiterhin benö- inputs at the FB, such as "Start"’, "Stop"’,
tigen Sie noch Eingänge am FB, wie z.B. "Continue1"’, "Continue2"’, in order to be
„Start“, „Stopp“, „Weiter1“, „Weiter2“, um able to create the advance conditions for the
die Weiterschaltbedingungen für die einzel- individual steps). . .
nen Schritte anlegen zu können). . .
Auf die einzelnen „Schritte“ können Sie The individual "steps" can also be accessed
auch außerhalb des FB zugreifen (Abb. outside the FB (fig. 4.5) by accessing the
4.5), indem Sie auf die Variablen des variables of the instance DB, or by creating
Instanz-DB zugreifen, oder eine INT- an INT variable "step number" (FB-Out),
Variable „Schrittnummer“ (FB-Out) erstel- or by declaring FB-Out interfaces for each
len, oder für jeden Schritt FB-Out Schnitt- step.
stellen deklarieren.
Zum Test Ihrer Funktion können Sie den To test your function you may use the PLC
PLC Simulator nutzen. Simulator.

34
4.5 Die Programmierung der Bausteine
The programming of the program blocks

Abbildung 4.4: Ein Ausschnitt der Schrittkette im FB


A section of the step sequence in the FB

35
4.5 Die Programmierung der Bausteine
The programming of the program blocks

Abbildung 4.5: Ausgangszuweisung durch Zugriff auf FB-Variablen (in separatem FC)
Setting the outputs by accessing the FB-Variables (in separate FC)

4.5.1.1 Beobachten und Steuern Monitoring and Controlling

Zum Beobachten oder Steuern Ihrer Varia- To monitor or control your variables you
blen kann innerhalb Ihres Simatic Projekts may use the simulator PLCSIM or the
der Simulator PLCSIM, oder die SPS (MPI- PLC (MPI interface!) within your Simatic
Schnittstelle!) verwendet werden. project.

Merker können auch direkt im Programm Flags can also be controlled directly in the
gesteuert werden. (markieren -> rechte program. (mark -> right mouse button ->

36
4.5 Die Programmierung der Bausteine
The programming of the program blocks

Maustaste -> Steuern . . . ) Steuern. . . )


Vorteilhaft ist häufig auch eine Beobach- An observation table is often also advanta-
tungstabelle! geous!
Anschließend können Sie bei laufendem Si- Afterwards you can observe the status of
mulator, oder laufender SPS den Status Ih- your variables while the simulator or PLC
rer Variablen über die Schaltfläche „Beob- is running by clicking the button "Observe
achten Ein / Aus“ (Brille) beobachten. On / Off" (glasses).

4.5.1.2 Stopp- und Resetfunktion Stop- and Reset-function

Weitere Funktionen die Sie implentieren Other functions that you should implement
sollten, ist das Anhalten und das Zurückset- are stopping and resetting the sequence to a
zen der Kette in einen definierten Zustand. defined state. This is to be done via a stop
Dies soll über eine Stopp- und eine Reset- and a reset function.
funktion geschehen.
Die Schrittkette soll damit aus jedem Zu- The step sequence should thus be able to be
stand (einwandfrei laufender Betrieb, beim stopped from any state (fault-free operation,
Einschalten, oder aber auch in einem un- when switching on, or in an unknown error
bekannten Fehlerzustand) angehalten und state) and returned to the initial position.
wieder zurück in die Grundstellung versetzt
werden können.
Gleichzeitig sollen alle anderen aktiven At the same time, all other active steps
Schritte zurückgesetzt werden. should be reset.
Implementieren Sie diese Funktionen in Ih- Implement these functions in your step se-
ren Schrittkettenbaustein FB1. quence block FB1.
3. Anhalten des Ablaufs (Stopp) Stop the sequence (stop)
4. Rücksetzen aller anderen Schritte Reset all other steps (Reset)
(Reset)
5. Schritt 1 aktivieren (Reset) Activate step 1 (Reset)
6. In Grundstellung fahren (Reset) Move to home position (reset)

4.5.2 Bibliotheksfähigen Baustein erstellen


Creating a library-compatible block

Um Ihren AWL / FUP Schrittketten FB To be able to use your IL / FBD step se-
auch auf anderen Systemen nutzbar machen quence FB on other systems, it is use-
zu können, ist es sinnvoll den Baustein bi- ful to program the block as a library. A

37
4.5 Die Programmierung der Bausteine
The programming of the program blocks

bliotheksfähig zu programmieren. Ein Bau- block is library-compatible if it does not ac-


stein ist dann bibliotheksfähig, wenn er auf cess any global variables, inputs, outputs or
keine globalen Variablen, Eingänge, Aus- flags. This also includes timers and coun-
gänge oder Merker zurückgreift. Dazu ge- ters.
hören auch Timer und Zähler.
Zu diesem Zweck können Sie alle im Bau- For this purpose you can create all vari-
stein benötigten Variablen als bausteininter- ables required in the block as block-internal
ne IN, OUT, INOUT, TEMP oder STAT Va- IN, OUT, INOUT, TEMP or STAT vari-
riablen in der Schnittstellenliste des jewei- ables in the interface list of the respective
ligen Bausteins anlegen. Es dürfen inner- block. Absolute addresses (inputs, flags,
halb des Bausteins keine absoluten Adres- outputs. . . ) may no longer be used within
sen (Eingänge, Merker,Ausgänge. . . ) mehr the block!
verwendet werden!
IN: Eingang; Variablen die der Baustein für IN: Input; variables the block needs for its
seine Funktion benötigt function
OUT: Ausgang; Variablen die der Baustein OUT: Output; variables that the block
anderen Bausteinen zur Verfügung stellt makes available to other blocks
IN_OUT: Variablen die sowohl Ein- als IN_OUT: Variables that are both input and
auch Ausgang sind. (Umrechnen eines Wer- output. (Convert a value and write back to
tes und zurückschreiben auf die gleiche Va- the same variable; not relevant in this lab
riable; in diesem Versuch nicht von Bedeu- exercise)
tung)
TEMP: temporäre Variablen, die nur wäh- TEMP: temporary variables, which are
rend des Bausteinaufrufs aktiv sind - der only active during the block call - the con-
enthaltene Wert ist nur 1 Zyklus lang gültig. tained value is only valid for 1 cycle. Suit-
Geeignet für z.B. Zwischenergebnisse. . . able for e.g. intermediate results. . .
STAT: statische Variablen, die über den STAT: static variables that are stored be-
Bausteinaufruf hinaus gespeichert werden. yond the block call.
Hier gehören Schritte, Timer, Zähler, Flan- Steps, timers, counters, edges . . . belong
ken. . . hin. here.
Werden Schnittstellen, oder Variablen ge- If interfaces or variables are changed, you
ändert, müssen Sie den FB1 neu im OB1 must include FB1 in OB1 again or update
einbinden, bzw. den Aufruf aktualisieren. the call. (Fig. 4.6)
(Abb. 4.6)

38
4.5 Die Programmierung der Bausteine
The programming of the program blocks

Abbildung 4.6: Ein Ausschnitt aus dem Aufruf des bibliotheksfähigen FB1 im OB1
A detail of the call of the library-compatible FB1 from OB1

39
4.5 Die Programmierung der Bausteine
The programming of the program blocks

Abbildung 4.7: Der FC-Ausgangszuweisungen im OB1. Die Zuordnung der Ausgänge


erfolgt über die Variablen des Instanz-DB der Schrittkette (Abb. 4.5).
The FC for output assignments. The outputs are assigned with reference
to the variables in the instance-DB of the step-sequence (Figure 4.5)

40
4.5 Die Programmierung der Bausteine
The programming of the program blocks

4.5.3 Erweiterung der Schrittkette


Extending the step sequence

Erweitern Sie nun Ihre Schrittkette soweit, Now extend your step sequence so that the
dass der Chip von einer Position einmal chip is moved from one position once in a
im Kreis gefahren wird und auf die selbe circle and then is put back to the same po-
Position zurückgelegt wird. Sinnvoll ist es sition. It makes sense to take a short break
dabei, beim Aufnehmen und Ablegen des when picking up and putting down the chip.
Chips eine kurze Pause einzulegen. Ver- Use an IEC-TON timer (switch-on delay)
wenden Sie dafür einen IEC-TON Timer for this purpose, which you call directly in
(Einschaltverzögerung), den Sie direkt im OB1.
OB1 aufrufen.
(Dies deshalb, da auf älteren CPUs IEC- (This is because on older CPUs IEC timers
Timer in FBs nicht deklariert werden kön- cannot be declared in FBs!)
nen!)
Der Ausgang des Timers (TRUE, wenn The output of the timer (TRUE, if time has
Zeit abgelaufen) ist die Weiterschaltbedin- expired) is the condition to enter the next
gung! step!

Abbildung 4.8: Ein Beispiel für den Aufruf eines IEC-Timers


An example for calling an IEC-Timer

4.5.3.1 Erweitertes Weg-Schritt-Diagramm


Extended path-step-diagram

Erstellen Sie nun ein Weg-Schritt- Now create a path-step diagram for the new
Diagramm für die neuen Bewegungen movements (fig. 4.9)
(Abb. 4.9)
Erweitern Sie anhand Ihres neuen Dia- Use your new diagram to extend the step
gramms den Schrittkettenbaustein FB1 um sequence block FB1 by the additional steps
die zusätzlichen Schritte und passen auch and also adjust the output assignments.
die Ausgangszuweisungen an.

41
4.5 Die Programmierung der Bausteine
The programming of the program blocks

Abbildung 4.9: Weg-Schritt-Diagramm Vorlage

4.5.3.2 Erzeugen der Schrittnummer Creating a Step-Number

Um z.B. den jeweils aktiven Schritt an For example, to display the active step on a
einem Panel anzuzeigen, oder auch zum panel or to control the outputs, it is some-
Ansteuern der Ausgänge, ist es manchmal times useful to have the step number avail-
sinnvoll die Schrittnummer zur Verfügung able.
zu haben.
Die Erzeugung der Schrittnummer kann The generation of the step number can be
in FUP mit einem MOVE-Baustein reali- realized in FBD with a MOVE block which
siert werden, welcher an den Ausgang jedes is switched to the output of each step SR
Schritt-SR-Gatters geschaltet wird. (Abb. gate. (Fig. 4.10)
4.10)

Abbildung 4.10: Erzeugen der Schrittnummer im FB (VAR-Output Typ: Integer)


Creating the Step Number in the FB (VAR-Output Type: Integer)

4.5.3.3 Steuern eines Ausgangs mit Hilfe der Schrittnummer

42
4.5 Die Programmierung der Bausteine
The programming of the program blocks

Controlling an output by means of the step number

Hat nun der FB die Schrittnummer als Out- If the FB now has the step number as an
Parameter, können auch die Ausgänge mit Out parameter, the outputs can also be con-
deren Hilfe angesteuert werden. Dazu wer- trolled with the help of this number. For this
den „Vergleicher“ benötigt. (Abb. 4.11) purpose, „Vergleicher“ are required. (fig.
4.11)

Abbildung 4.11: Ansteuern von Ausgängen mit Hilfe der Schrittnummer


Controlling outputs by means of the step number

43
4.5 Die Programmierung der Bausteine
The programming of the program blocks

4.5.3.4 Stopp und Pause Stop and Pause

Wenn Sie Ihr Programm fertiggestellt und Once you have finished and successfully
erfolgreich getestet haben (der Chip wird tested your program (the chip is sucked in
angesaugt und einmal im Kreis gefahren), and moved in a circle once), you can now
können Sie dieses nun um die „Stopp“ bzw. extend it with the "stop" and "pause" func-
„Pause“ Funktionalität erweitern. tionality.
Stopp: Programmablauf und alle Bewegun- textbfStop End program and all move-
gen beenden, weiter mit Reset / Neustart. ments, continue with Reset / Restart.
Pause: Drücken -> Programm anhalten, Pause: Press -> Stop program, end all
alle Bewegungen beenden, weiter mit er- movements, continue by pressing "Pause"
neutem Drücken von „Pause“. (Auch der again. (The key switch is also suitable for
Schlüsselschalter eignet sich für diese this functionality)
Funktionalität)
Benutzen Sie für diese zusätzlichen Funk- Use the elements of the operator panel for
tionen die Elemente des Bedienfeldes. these additional functions.
Tipp: In die Taster sind auch Lämp- Tip: The push buttons also have built-in
chen eingebaut, welche der Anzeige von lights which can be used to indicate oper-
Betriebszuständen dienen können! (Siehe ating states! (See fig. 4.12)
Abb. 4.12)

Abbildung 4.12: Das Tastenfeld mit den Bedienelementen


The operator panel with keys and lights

44
4.5 Die Programmierung der Bausteine
The programming of the program blocks

4.5.4 Fehlererkennung Error handling

Nur wenn Ihr Programm bereits alle bis Only if your program already fulfils all
jetzt geforderten Anforderungen erfüllt the requirements demanded so far (com-
(vollständiger Ablauf, Stopp, Pause, Reset) plete sequence, stop, pause, reset) and there
und noch Zeit vorhanden ist (das richtig is still time (the correctly functioning se-
funktionierende Ablaufprogramm hat Vor- quence program has priority!), you should
rang!), sollten Sie sich diesem Punkt wid- devote yourself to this task.
men.
Leider sind bei einer Ablaufsteuerung Feh- Unfortunately, errors cannot be ruled out in
ler nicht ausgeschlossen und einige viel- a sequence control and some may already
leicht bereits aufgetreten. In diesem Teil des have occurred. In this part of the lab exer-
Praktikums sollen mögliche Fehler erkannt cise possible errors shall be recognized and
und darauf reagiert werden. reacted to.
Der offensichtlichste Fehler, der auftreten The most obvious error that can occur is
kann ist das Öffnen der Klappe. Die Schritt- opening the flap. The step sequence should
kette soll angehalten werden und ein Feh- be stopped and an error flag should be set.
lermerker gesetzt werden. Erst nach einer Only after confirmation by the operator may
Bestätigung des Bedieners darf der Ablauf the sequence be continued.
wieder fortgeführt werden.
Bitte beachten Sie Folgendes: Please note the following:
Wird gerade eine Bewegung nach vorne If a forward movement is in progress and
ausgeführt und Sie öffnen die Klappe, wird you open the flap, the entire unit will jam
sich die gesamte Einheit an der Klappe ver- against the flap. It is therefore advisable not
klemmen. Es ist deshalb sinnvoll beim Öff- only to stop the step sequence when open-
nen der Klappe nicht nur die Schrittkette ing the flap, but also to immediately initiate
anzuhalten, sondern sofort auch eine Bewe- a movement backwards.
gung nach hinten einzuleiten.
Als weiterer Fehler soll erkannt werden, ob A further error is to be detected: whether a
eine Bewegung in einer bestimmten Zeit movement was executed correctly within a
korrekt ausgeführt wurde, denn es könnte certain time, because a compressed air line
ja z.B. eine Druckluftleitung geplatzt sein. could have burst, for example. A single
Eine einzelne Bewegung dauert bei einem movement takes about 0.5 seconds at a set
eingestellten Druck von ca. 2 bar ungefähr pressure of about 2 bar. If such a movement
0,5 Sekunden. Falls eine solche Bewegung is not completed after a certain time (e.g. 2
nicht nach einer bestimmten Zeit (z.B. 2 Se- seconds), an error flag should be set. Here,
kunden) abgeschlossen ist, soll ein Fehler- too, the process should not be continued un-
merker gesetzt werden. Auch hier soll der til the operator has confirmed.
Ablauf erst nach einer Bestätigung des Be-
dieners wieder fortgeführt werden.

45
4.5 Die Programmierung der Bausteine
The programming of the program blocks

Hinweis: Zur Erkennung eines Timeout- Note: To detect a timeout error, please use
fehlers verwenden sie bitte (für jeden (for each step) a delayed IEC timer "TON"
Schritt) einen einschaltverzögerten IEC- or S-7 timer "S_ODT". (Which, however,
Timer „TON“ oder S-7 Timer „S_ODT“. only work within the FB on the newer 1500
(Welche aber innerhalb des FB nur auf den PLCs)
neueren 1500er SPSen funktionieren) Therefore only the following is possible on
Deshalb ist auf der 313C nur Folgendes the 313C:
möglich:

1. Entweder die Verwendung von IEC- Either the use of IEC timers outside
Timern außerhalb des bibliotheksfä- the library-compatible FB. (at least 2
higen FB. (mindestens 2 nötig) required)

2. Übergeben von S7-Timern als Input- Transferring S7 timers as input vari-


Variablen des Schrittketten-FB. ables of the step sequence FB.

Nur so kann die Schrittkette wiederver- Only in this way can the step sequence
wendbar bleiben! remain reusable!
(Zur Erläuterung der Timer-Funktion zie- (For help on using the timer function, drag
hen Sie den Timer ins Programm, markieren the timer into the program, mark it and
ihn und drücken F1) press F1)
Zusätzlich dazu müssen Sie noch Ihre In addition to this you must extend your
Weiterschaltbedingungen im Schrittketten- switching conditions in the step sequence
baustein FB1 um eine interne Fehlervaria- block FB1 by an internal error variable so
ble erweitern, damit ein auftretender Fehler that an occurring error interrupts the pro-
den Ablauf unterbricht. cess.
Zum Testen der Fehler können Sie: To test the error handling you can:

1. die Klappe öffnen um den ’Feh- open the flap to trigger the ’er-
ler_Klappe’ auszulösen. ror_flap’.

2. den Luftdruck am dafür vorgesehe- Reduce the air pressure at the actuator
nen Stellglied verringern. provided for this purpose.

4.5.5 Fertiges Programm Finished Program

Haben Sie alle vorherigen Punkte abge- If you have worked through all the previ-
arbeitet, sollte Ihr Programm es ermögli- ous points, your program should allow you
chen: to:
• den Chip im Kreis zu fahren. move the chip in circles.
• das Programm anzuhalten oder zu to stop or pause the program.
pausieren.

46
4.5 Die Programmierung der Bausteine
The programming of the program blocks

• Fehler erkennen zu können. to be able to detect errors.


Das komplette Programm sollte in etwa The complete program should contain
folgende Bausteine enthalten: approximately the following modules:

Zusätzlich hier noch eine Übersicht der Additionally here is an overview of the
wichtigsten Bausteine: most important modules:

Bitte beachten Sie dass Ihre Bausteine da- Please note that your blocks may differ
von abweichen können. Diese Übersicht ist from this. This overview is only an exam-
nur ein Beispiel! ple!
• Der Aufruf der Schrittkette. (Abb. The call of the step sequence. (Fig.
4.13) 4.13)
• Ein Ausschnitt aus dem Programm An excerpt from the program in the
im Schrittketten-FB. step sequence FB.
Gut zu sehen ist die Einfachheit des You can clearly see the simplicity
Programms und der völlige Verzicht of the program and the complete
auf globale Variablen im FB.(Abb. omission of global variables in the
4.14) FB.(Fig. 4.14)
• Der Timer für die Wartezeit The timer for the waiting time when
beim Aufnehmen und Ablegen picking up and dropping the chip and

47
4.5 Die Programmierung der Bausteine
The programming of the program blocks

des Chip und der Aufruf des calling the output assignment FC (fig.
Ausgangszuweisungs-FC.(Abb. 4.15)
4.15)

48
4.5 Die Programmierung der Bausteine
The programming of the program blocks

Abbildung 4.13: Der fertige Schrittkettenbaustein im OB1


Calling the finished step sequence FB from OB1

49
4.5 Die Programmierung der Bausteine
The programming of the program blocks

Abbildung 4.14: Ein Ausschnitt aus dem Schrittketten-FB mit Kommentaren.


Details from the step sequence FB

Abbildung 4.15: Ein Timer (in OB1) und die Ausgangszuweisungen


OB1: a timer and writing the outputs

50
4.5 Die Programmierung der Bausteine
The programming of the program blocks

Als weitere Aufgabe für Fortgeschritte- Another task for advanced students:
ne:
Rufen Sie Ihren Schrittketten-FB ein zwei- Call your step sequence FB a second time
tes Mal auf, um den Chip einmal „linksher- to be able to move the chip once "left
um“ und als zweite Möglichkeit „rechtsher- around"’ and as a second possibility "right
um“ bewegen zu können. around"’.
Tipp: Benutzen Sie den Freigabeeingang Tip: Use the enable input (EN) of the
(EN) der Bausteine, um die Ausführung ge- blocks to lock the execution mutually.
genseitig zu verriegeln.
Eine andere Möglichkeit die Aufgabe zu Another way to solve the problem is to
lösen ist, die Weiterschaltbedingungen und change the switching conditions and output
Ausgangszuweisungen so abzuändern, dass assignments to allow operation in both di-
ein Betrieb in beide Richtungen möglich rections.
wird.

51
5 Technische Grundlagen
Technical Base

5.1 Prinzipielle Arbeitsweise einer SPS


Working Principles of a PLC

5.1.1 Struktur einer SPS Structure of a PLC

Der elektrische Aufbau einer SPS besteht The electrical structure of a PLC consists of
aus den Funktionsgruppen einer Informa- the functional groups of an information pro-
tionsverarbeitung. Die zu steuernde Anla- cessing system. The system to be controlled
ge liefert über Sensoren Eingabesignale an supplies input signals to the input unit of the
die Eingabeeinheit des Automatisierungs- automation device via sensors. These sig-
gerätes. Diese Signale werden fortlaufend nals are continuously processed by the con-
durch das im Programmspeicher des Auto- trol program stored in the program memory
matisierungsgerätes hinterlegte Steuerungs- of the automation device. The result of the
programm verarbeitet. Das Ergebnis der processing is output via the output unit of
Verarbeitung wird über die Ausgabeeinheit the automation device to the actuators or fi-
des Automatisierungsgerätes an die Akto- nal control elements of the plant to be con-
ren oder Stellglieder der zu steuernden An- trolled in the form of output signals.
lage in Form von Ausgangssignalen ausge-
geben.
Aus den verschiedenen Basiskomponen- The mode of operation of a programmable
ten einer SPS und deren zyklischen Akti- logic controller is derived from the various
vierung ergibt sich die Arbeitsweise einer basic components of a PLC and their cycli-
Speicherprogrammierbaren Steuerung. cal activation.
Dabei werden zunächst im Schritt „Ein- At first the current process values are
gabe“ die aktuellen Prozesswerte aufge- recorded in the step "Input" and copied into
nommen und in das interne Prozessabbild the internal process input image. On the
kopiert. Auf der Basis dieses Prozessab- basis of this process image, the entire PLC
bilds wird anschließend im Schritt „Ver- program is then processed once in the "Pro-
arbeitung“ das gesamte SPS-Programm cessing" step in the control unit, whereby
im Steuerwerk einmal abgearbeitet, wo- the process output image is changed accord-
bei dabei das Prozessabbild der Akto- ing to the specifications of the PLC pro-
ren entsprechend den Festlegungen des gram. In the "Output" step, the process out-

52
5.1 Prinzipielle Arbeitsweise einer SPS
Working Principles of a PLC

SPS-Programms verändert wird. Im Schritt put image is transferred to the individual ac-
„Ausgabe“ erfolgt die Übertragung des tuators thus influencing the process before
Prozessabbilds auf die einzelnen Aktoren the next PLC cycle begins.
mit einer entsprechenden Beeinflussung des
Prozesses, bevor ein nächster SPS-Zyklus
beginnt.

5.1.1.1 Basiskomponenten einer SPS Basic components of a PLC

Eingabe: Verantwortlich für das Einlesen Input: Responsible for reading the process
der Prozesswerte über einzelne Sen- values via individual sensors and in-
soren und Eingangs-Module sowie put modules and the conversion of
die Umsetzung dieser Werte in das in- these values into the process input
terne Prozessabbild. image.
Verarbeitung Die Daten aus dem Pro- Processing The data from the process im-
zessabbild werden von der Kom- age is processed by the component
ponente „Verarbeitung“ entsprechend "Processing" according to the con-
dem, im SPS-Programm festgelegten trol behavior defined in the PLC pro-
Steuerungsverhalten verarbeitet und gram.
verändert.
Ausgabe: Die Komponente Ausgabe Output: Via the assigned output modules
übernimmt, über die zugeordneten and actuators the Output maps the
Ausgangs-Module und Aktoren, die process output image to the corre-
Abbildung des Prozessabbilds auf sponding process values.
die entsprechenden Prozesswerte.

5.1.1.2 Elektrischer Aufbau einer SPS Electrical Set-Up of a PLC

Abbildung 5.1 zeigt schematisch den Auf- Figure 5.1 schematically shows the struc-
bau einer SPS. Die einzelnen Komponenten ture of a PLC. The individual components
erfüllen dabei die folgenden Funktionen: perform the following functions:
Steuerwerk: Das Steuerwerk gibt nach Control Unit: The control unit emits an re-
dem Anlegen der Netzspannung set impulse after the mains voltage
einen Richtimpuls ab: Die nichtre- is applied: The non-remanent coun-
manenten Zähler, Zeitglieder und ters, timers and flags as well as the
Merker sowie der Akku und das battery and the process image are set
Prozessabbild werden auf Null to zero. For program processing, the
gesetzt. Zur Programmbearbeitung control unit "reads" one program line
„liest“ das Steuerwerk, von vorne after the other, starting from the be-
beginnend, eine Programmzeile nach ginning. The control unit executes

53
5.1 Prinzipielle Arbeitsweise einer SPS
Working Principles of a PLC

der anderen. Entsprechend den dort the program according to the instruc-
stehenden Anweisungen führt das tions given there.
Steuerwerk das Programm durch.
Merker: Merker sind Speicherelemente, in Flags: Flags are memory elements in
denen sich das Steuerwerk Signalzu- which the control unit "remembers"
stände „merkt“ (speichert). (stores) signal states.
Prozessabbild: Das Prozessabbild ist ein Process Image: The process image is a
Speicherbereich, in dem sich das memory area in which the control
Steuerwerk die Signalzustände der unit remembers the signal states of
binären Ein- und Ausgänge merkt. the binary inputs and outputs.
Akku: Der Akkumulator ist ein Zwischen- Accumulator: The accumulator is a buffer
speicher, über den z.B. Zeitglieder memory, which is used to charge time
und Zähler geladen oder arithmeti- elements and counters or to perform
sche Operationen durchgeführt wer- arithmetic operations, for example.
den.
Zeitglieder, Zähler: Zeitglieder und Zäh- Timers, Counters: Timers and counters
ler sind Speicherbereiche, in de- are memory areas in which the con-
nen sich das Steuerwerk Zahlenwerte trol unit remembers (stores) numeri-
merkt (speichert). cal values.
Bussystem: Programmspeicher, Steu- Bus System: Program memory, control
erwerk und Peripheriebaugruppen unit and peripheral modules (inputs
(Eingänge und Ausgänge) sind in and outputs) are connected to each
der SPS durch einen Bus mitein- other in the PLC by a bus. A bus
ander verbunden. Ein Bus besteht consists of collective lines, via which
aus Sammelleitungen, über die data is exchanged. The control unit
Daten ausgetauscht werden. Das organizes the data transfer on these
Steuerwerk organisiert die Daten- lines.
übertragung auf diesen Leitungen.
Programmspeicher: Bei Speicherpro- Program Memory: With programmable
grammierbaren Steuerungen ist logic controllers, the control program
das Steuerungsprogramm in einem is stored in a special electronically
speziellen elektronisch lesbaren readable memory. If a read-write
Speicher abgelegt. Wird ein Schreib- memory (RAM) is used, its contents
Lese-Speicher (RAM) verwendet, can always be changed quickly, e.g.
kann dessen Inhalt immer wieder when commissioning a controller.
schnell verändert werden z. B. bei In the event of a power failure, the
Inbetriebnahme einer Steuerung. contents in the RAM are retained if a
Bei Netzspannungsausfall bleibt der buffer battery is inserted.
Inhalt im RAM erhalten, wenn eine
Pufferbatterie eingesetzt ist.

54
5.1 Prinzipielle Arbeitsweise einer SPS
Working Principles of a PLC

Leistungsfähigkeit einer SPS : Performance of a PLC :


Zykluszeit: umfasst die Zeit eines voll- Cycle Time: comprises the time of a com-
ständigen SPS-Zyklus von der Einga- plete PLC cycle from Input, process-
be über die Verarbeitung bis hin zur ing and output
Ausgabe
Reaktionszeit: Zeitspanne, die notwen- Reaction time: Time period required un-
dig ist, bis eine Eingangsänderung ei- til an input change results in a corre-
ne entsprechende Ausgangsänderung sponding output change.
zur Folge hat.
Since the change of an input signal
Da die Änderung eines Eingangs- does not necessarily occur exactly at
signals nicht unbedingt genau zum the time of the start of an input, it can
Zeitpunkt des Beginns einer Einga- only be guaranteed for the following
be erfolgt, kann erst für den folgen- PLC cycle that a change of the output
den SPS-Zyklus garantiert werden, value results via the processing of the
dass über die Verarbeitung des SPS- PLC program.
Programms eine Änderung des Aus-
gangswertes resultiert.

Abbildung 5.1: Automatisierungsgerät


Automation Device

55
5.1 Prinzipielle Arbeitsweise einer SPS
Working Principles of a PLC

5.1.2 Programmverarbeitung Processing of the Program

Eine Speicherprogrammierbare Steuerung A programmable logic controller (PLC)


(SPS) arbeitet die vom Anwender getrof- processes the individual specifications
fenen, individuellen Festlegungen für das made by the user for the control behaviour.
Steuerungsverhalten ab. Diese Programma- This program processing takes place in the
barbeitung erfolgt im Speicherbereich der memory area of the PLC.
SPS.
Das SPS-Programm wird im Programm- The PLC program is kept in the program
speicher gehalten und besteht aus einer memory and consists of a sequence of in-
Abfolge von einzelnen Anweisungen. Da- dividual instructions. In general, a distinc-
bei kann man allgemein zwischen Steue- tion can be made between controllers which
rungen unterscheiden, die den Programm- locate the program memory in the work-
speicher im Arbeitsspeicher ansiedeln und ing memory and buffer the contents of the
den Inhalt des Programmspeichers über ei- program memory via a battery, while other
ne Batterie puffern, während andere Steue- controllers use non-volatile storage media
rungen nichtflüchtige Speichermedien (z.B. (e.g. EPROM, Memory Card. . . ) to pro-
EPROM, Memory Card. . . ) einsetzen, um tect the program memory against loss of its
den Programmspeicher gegen den Verlust contents.
des Inhalts abzusichern.
Die Erstellung des SPS-Programms erfolgt The PLC program is usually created in a
in der Regel im Programmiergerät außer- programming device outside the PLC. Pro-
halb der SPS. Die Programmierung erfolgt gramming is done with one or more pro-
mit einer oder mehrerer Programmierspra- gramming languages1 .
chen1 .
Die Prozessanbindung einer SPS wird über A PLC is connected to the process via
E/A-Module realisiert. Diese Module sind I/O modules. These modules are normally
im Normalfall über einen herstellerspezifi- connected to the PLC via a manufacturer-
schen Bus an die SPS angebunden. specific bus.
Die Programmverarbeitung einer SPS er- The program processing of a PLC takes
folgt zyklisch2 (Abbildung 5.2). Einmal im place cyclically2 (Illustration 5.2). Once
Zyklus wird ein Prozessabbild aller Eingän- per cycle the process inputs image is taken
ge übernommen. Das Programms wird An- read. The program is executed instruction
weisung für Anweisung und abgearbeitet, by instruction and processed, any output
eventuelle Ausgabewerte werden in einem values are stored in a process output image.
Prozessabbild der Ausgänge gespeichert. Once per cycle, the process output image is
1 Die eingesetzten Sprachen sind inzwischen inter- 1 The languages used are now internationally stan-
national nach der Norm IEC 61131-3 weitge- dardized to a large extent according to the IEC
hend standardisiert 61131-3 standard
2 Nach Din 61131-3 sollte man die Anwenderpro- 2 According to Din 61131-3, the user programs

gramme in Bausteine schreiben, die die SPS should be written in blocks that the PLC man-
selbst verwaltet. ages itself.

56
5.1 Prinzipielle Arbeitsweise einer SPS
Working Principles of a PLC

Einmal im Zyklus wird das Prozessabbild output to the outputs.


der Ausgänge an die Ausgänge ausgege-
ben.
Die Zeit, die für einen Programmdurchlauf The time required for one program run is
benötigt wird, heißt Zykluszeit. called cycle time.

Abbildung 5.2: Programmverarbeitung


Processing of the Program

5.1.3 Signaleingabe und Signalausgabe Signal Input and Output

Die SPS kann nur elektrische Signale er- A PLC can only read and write electrical
kennen und ausgeben. Signals.

57
5.1 Prinzipielle Arbeitsweise einer SPS
Working Principles of a PLC

5.1.3.1 Binäre Signale Binary Signals

Signale sind die Träger von Informationen. Signals are the carriers of information. A
Ein binäres Signal kann nur eine von zwei binary signal can only carry one of two pos-
möglichen Informationen tragen: sible pieces of information:
Die binäre Null „0“ oder die binäre Eins The binary zero "‘0"’ or the binary one
„1“ "‘1"’
Ein Signal heißt binär, wenn es nur zweier A signal is binary if it is capable of only two
Werte fähig ist. Für den Fall, dass ein Steue- values. If a control input remains uncon-
rungseingang unbeschaltet, d.h. spannungs- nected, i.e. de-energized (so-called open in-
los bleibt (sog. Offener Eingang), gilt der put), the signal state "‘0"’ applies.
Signalzustand „0“.
Da die meisten Geber und Aktoren in steue- Since most sensors and actuators in con-
rungstechnischen Anlagen schaltende Ele- trol systems are switching elements, their
mente sind, lassen sich deren Schaltzustän- switching states ( OFF or ON ) can be di-
de ( AUS bzw. EIN ) den binären Signa- rectly assigned to the binary signals (0 or
len (0 bzw. 1) direkt zuordnen. Die SPS 1). The PLC only perceives the voltages
nimmt nur die durch die Schalter geschalte- switched by the switches. The different ef-
ten Spannungen wahr. Die unterschiedliche fects of normally closed and normally open
Wirkung von Öffner- und Schließerkontak- contacts must be taken into account when
ten muss bei der Programmerstellung be- creating the program.
dacht werden.

5.1.3.2 Ein-/Ausgabebaugruppen Input- and Output-Modules

Die Eingabeeinheit einer SPS hat die Auf- The input unit of a PLC has the task of
gabe, die angelegten Steuersignale an die transferring the applied control signals to
Verarbeitungseinheit zu übergeben. Bei den the processing unit. In most input units,
meisten Eingabeeinheiten wird der Signal- the signal status of the inputs is indicated
zustand der Eingänge durch Leuchtdioden by LEDs.
angezeigt.
Die Ausgabeeinheit bereitet die von der The output unit prepares the signals sup-
Verarbeitungseinheit gelieferten Signale plied by the processing unit. A voltage
auf. Eine extern an die Ausgabeeinheit applied externally to the output unit is
gelegte Spannung wird bei Ausgangssignal switched through by the output unit when
„1“ von der Ausgabeeinheit durchgeschal- the output signal is "1". Switching through
tet. Das Durchschalten kann entweder can be done either with relays or electron-
mit Relais oder elektronisch erfolgen, ically, whereby galvanic isolation is pro-
wobei bei den meisten Ausgabebaugruppen vided for most output modules. The signal
eine galvanische Trennung vorgenommen states of the outputs are indicated by LEDs
wird. Die Signalzustände der Ausgänge in many output units.

58
5.1 Prinzipielle Arbeitsweise einer SPS
Working Principles of a PLC

werden bei vielen Ausgabeeinheiten durch


Leuchtdioden angezeigt.

5.1.4 Digitale Signale Digital Signals

Wenn man mehrere binäre Signale zusam- If several binary signals are combined, they
menfasst, ergeben diese nach einer be- result in a digital signal according to a cer-
stimmten Zuordnung (Code) ein digitales tain assignment (code). While a binary sig-
Signal. Während ein binäres Signal nur das nal only allows the acquisition of a bivalent
Erfassen einer zweiwertigen Größe ermög- quantity, a number or digit can be formed
licht, kann man durch Bündeln von Binär- as digital information by combining binary
stellen z.B. eine Zahl oder Ziffer als digi- digits. Four binary digits are required to
tale Information bilden. Um die Ziffern 0 represent the digits 0 to 9. One binary digit
bis 9 darstellen zu können, sind vier Binär- is called 1 bit. If 8 bits are combined to form
stellen erforderlich. Eine Binärstelle wird 1 a data or information unit, this is called a
Bit genannt. Werden 8 Bit zu einer Daten- "byte". A byte is always an 8-bit word. The
oder Informationseinheit zusammengefasst, digital signals occupy many inputs or out-
so spricht man von einem „Byte“. Ein Byte puts of the input/output modules.
ist immer ein 8-Bit-Wort. Die digitalen Si-
gnale belegen viele Eingänge bzw. Ausgän-
ge der Ein-/Ausgabebaugruppen.

5.1.5 Struktur der Steuerungssprache Structure of the Programming


Language

Das Programm einer Speicherprogram- The program of a programmable logic con-


mierbaren Steuerung besteht aus einer Fol- troller consists of a sequence of control in-
ge von Steueranweisungen. structions.
Eine Steueranweisung gliedert sich in den A control instruction is divided into the
Operationsteil und den Operandenteil (Ab- operation part and the operand part (Fig-
bildung 5.3). Der Operandenteil besteht aus ure 5.3). The operand part consists of the
dem Operanden-Kennzeichen der Datenfor- operand identifier of the data format speci-
matangabe und dem Parameter. fication and the parameter.

5.1.5.1 Operationsumfang Range of Operations

Der Operationsumfang einer Steuerungs- The scope of operations of a control lan-


sprache beschreibt, welche Anweisungen guage describes which instructions (com-
(Befehle) dem Anwender für die Signal- mands) are available to the user for sig-
verarbeitung und die Programmorganisati- nal processing and the program organiza-

59
5.1 Prinzipielle Arbeitsweise einer SPS
Working Principles of a PLC

Abbildung 5.3: Struktur einer Steueranweisung


Structure of a Program Instruction

on zur Verfügung stehen. tion.


Die Operationen zur Signalverarbeitung un- The signal processing operations are di-
tergliedern sich in Anweisungen für bitver- vided into instructions for bit process-
arbeitende Operationen und wortverarbei- ing operations and word processing opera-
tende Operationen. tions.

5.1.5.2 Operandenumfang Range of Operands

Nachdem mit dem Operationsteil einer After the operation part of a control instruc-
Steueranweisung die auszuführende Opera- tion has been used to determine the oper-
tion bestimmt wurde, müssen nun im Ope- ation to be executed, the data required for
randenteil die dazu erforderlichen Daten this must now be specified in the operand
genannt werden. part.
Daten für signalverarbeitende Operationen Data for signal processing operations are
heißen Operanden. Daten für programmor- called operands. Data for program orga-
ganisatorische Operationen heißen Sprung- nizational operations are called jump ad-
adressen oder Marken (Abbildung 5.4). dresses or labels (Figure 5.4).

Abbildung 5.4: Struktur der Operanden


Structure of the Operands

60
5.1 Prinzipielle Arbeitsweise einer SPS
Working Principles of a PLC

Der Parameter besteht bei Eingängen (I), For inputs (I), outputs (Q) and flags (M) the
Ausgängen (Q) und Merkern (M) aus ei- parameter consists of a byte address and a
ner Byteadresse und einer Bitadresse. Zu ei- bit address. One byte address consists of 8
ner Byteadresse gehören 8 Operanden mit operands with the bit addresses 0 . . . 7. Byte
den Bitadressen 0 . . . 7. Byteadresse und address and bit address are separated by a
Bitadresse sind durch einen Punkt getrennt. dot. These "physically" existing addresses
Diesen „physikalisch“ vorhandenen Adres- are preceded by a % as identification (e.g.
sen wird als Kennung ein % vorangestellt %I0.0). The use of local data (%L) is pos-
(z.B.%I0.0). Die Verwendung von Lokal- sible, but is not recommended (optimized
daten (%L) ist möglich, es wird aber da- access not possible).
von abgeraten (optimierter Zugriff nicht
möglich).
Bei Zählern und Zeitgliedern besteht der With counters and timers the parameter
Parameter aus einer fortlaufenden Zahl. consists of a continuous number.
Marken kennzeichnen bei verzweigten Pro- In branched programs, labels indicate the
grammen die Fortsetzungsstelle. Die hinter continuation point. The marker behind the
dem Sprungbefehl stehende Marke nennt jump command indicates the jump destina-
das Sprungziel. tion.

5.1.5.3 Adressierung von Eingängen, Ausgängen und Merkern


Adresses for Inputs, Outputs and Flags

Speicherprogrammierbare Steuerungen Programmable logic controllers can process


können Daten vom Format data of the format
• Bit • bit
• Byte • byte
• Wort (16 bit) • word (16 bit)
• Doppelwort (32 bit) • double word (32 bit)
verarbeiten. Es bestehen folgende Möglich- The following possibilities exist for ad-
keiten der Adressierung von Eingängen, dressing inputs, outputs and flags:
Ausgängen und Merkern:
• bitweise • bit by bit
Einzel-Eingänge: %I 0.7 . . . %I 0.0, Single inputs: %I 0.7 . . . %I 0.0, %I
%I 1.7 . . . %I 1.0 1.7 . . . %I 1.0
Einzel-Ausgänge: %Q 0.7 . . . %Q Single outputs: %Q 0.7 . . . %Q 0.0,
0.0, %Q 1.7 . . . %Q 1.0 %Q 1.7 . . . %Q 1.0
Einzel-Merker: %M 0.7 . . . %M 0.0, Single flags: %M 0.7 . . . %M 0.0,
%M 1.7 . . . %M 1.0 %M 1.7 . . . %M 1.0

61
5.1 Prinzipielle Arbeitsweise einer SPS
Working Principles of a PLC

• byteweise • byte by byte


Eingangsbyte %IB0 umfaßt die Ein- Input byte %IB0 comprises the inputs
gänge %I 0.7 . . . %I 0.0 %I 0.7 . . . %I 0.0
Eingangsbyte %IB1 umfaßt die Ein- Input byte %IB1 comprises the inputs
gänge %I 1.7 . . . %I 1.0 %I 1.7 . . . %I 1.0
Ausgangsbyte %QB0 umfaßt die Output byte %QB0 comprises the
Ausgänge %Q 0.7 . . . %Q 0.0 outputs %Q 0.7 . . . %Q 0.0
Ausgangsbyte %QB1 umfaßt die Output byte %QB1 comprises the
Ausgänge %Q 1.7 . . . %Q 1.0 outputs %Q 1.7 . . . %Q 1.0
Merkerbyte %MB0 umfaßt die Mer- Flag byte %MB0 comprises the flags
ker %M 0.7 . . . %M 0.0 %M 0.7 . . . %M 0.0
Merkerbyte %MB1 umfaßt die Mer- Flag byte %MB1 comprises the flags
ker %M 1.7 . . . %M 1.0 %M 1.7 . . . %M 1.0
• wortweise • by word
Eingangswort %IW0 umfaßt die Ein- Input word %IW0 comprises the in-
gänge %I 0.7 . . . %I 0.0, %I 1.7 . . . %I puts %I 0.7 . . . %I 0.0, %I 1.7 . . . %I
1.0 1.0
Ausgangswort %QW0 umfaßt die Output word %QW0 comprises the
Ausg. %Q 0.7 . . . %Q 0.0, %Q 1.7 output word %QW0. %Q 0.7 . . . %Q
. . . %Q 1.0 0.0, %Q 1.7 . . . %Q 1.0
Merkerwort %MW0 umfaßt die Mer- Flag word %MW0 comprises the
ker %M 0.7 . . . %M 0.0, %M 1.7 flags %M 0.7 . . . %M 0.0, %M 1.7
. . . %M 1.0 . . . %M 1.0
Das Wort hat eine Länge von 16 Bit, The word has a length of 16 bits,
die von rechts nach links durch die which are marked from right to left
Bitadressen 0 . . . 15 gekennzeichnet by the bit addresses 0 . . . 15. It must
sind. Dabei muß beachtet werden, be ensured that the left byte always
dass immer das linke Byte die nied- has the lower byte address, which is
rigere Byteadresse hat, die bei Zu- identical to the word address when 2
sammenfassung von 2 Byte zu einem bytes are combined into one word.
Wort mit der Wortadresse identisch
ist.
• doppelwortweise • double word
Vier Bytes oder zwei Worte kön- Four bytes or two words can be com-
nen zu einem Doppelwort zusam- bined into a double word. A double
mengefasst werden. Ein Doppelwort word therefore has a length of 32 bits.
hat demnach eine Länge von 32 In the case of a double word, the word
Bit. Auch bei einem Doppelwort be- or byte on the left with its lowest ad-
stimmt das links stehende Wort bzw. dress also determines the address of
Byte mit seiner niedrigsten Adresse the corresponding double word.
die Adresse des entsprechenden Dop-
pelwortes.

62
5.1 Prinzipielle Arbeitsweise einer SPS
Working Principles of a PLC

5.1.5.4 Programmdarstellung Representations for Programs

Für die Programmdarstellung gibt es die For the program representation, there are
in Abbildung 5.5 dargestellten nach IEC the possibilities shown in figure ??, which
61131-3 standardisierten Möglichkeiten. are standardized according to IEC 61131-
3.

Abbildung 5.5: Programmiersprachen


Programming Languages

63

Das könnte Ihnen auch gefallen