Beruflich Dokumente
Kultur Dokumente
Hochschule Hof
Alfons Goppel Platz 1
95028 Hof
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.
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.
8
3.2 SPS / Verdrahtung PLC / Wiring
9
3.2 SPS / Verdrahtung PLC / Wiring
10
3.2 SPS / Verdrahtung PLC / Wiring
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.
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
14
3.3 Piff-Paff Portal / Aktoren und Sensoren
Piff-Paff Portal / actuators and 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:
15
3.3 Piff-Paff Portal / Aktoren und Sensoren
Piff-Paff Portal / actuators and sensors
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
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.
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
Ü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 ).
19
4.1 Struktureller Ablauf des Programms
Structure of the program
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.
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
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
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
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.
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.
28
4.3 Ablaufsteuerungen in AWL / FUP
Sequence Control in IL / FBD
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
30
4.5 Die Programmierung der Bausteine
The programming of the program blocks
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
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
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)
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
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)
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
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
40
4.5 Die Programmierung der Bausteine
The programming of the program blocks
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!
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
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)
42
4.5 Die Programmierung der Bausteine
The programming of the program blocks
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)
43
4.5 Die Programmierung der Bausteine
The programming of the program blocks
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)
44
4.5 Die Programmierung der Bausteine
The programming of the program blocks
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)
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.
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
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
49
4.5 Die Programmierung der Bausteine
The programming of the program blocks
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
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.
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.
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
55
5.1 Prinzipielle Arbeitsweise einer SPS
Working Principles of a PLC
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
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
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.
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
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.
59
5.1 Prinzipielle Arbeitsweise einer SPS
Working Principles of a PLC
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).
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.
61
5.1 Prinzipielle Arbeitsweise einer SPS
Working Principles of a PLC
62
5.1 Prinzipielle Arbeitsweise einer SPS
Working Principles of a PLC
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.
63