Professional Documents
Culture Documents
Laboranleitung AUT Versuch 3 en
Laboranleitung AUT Versuch 3 en
Laboranleitung AUT Versuch 3 en
Module 1
Description of the plant
Topic:
1 DESCRIPTION OF THE PLANT .....................................................................................................2
1.1 OVERVIEW .....................................................................................................................................2
1.2 MODULES ......................................................................................................................................2
1.3 SENSORS UND MOTORS..................................................................................................................7
2 DEFINITION OF INPUT AND OUTPUT VARIABLES ..................................................................10
Module 1 Page 2 of 11
On the rear panel (from the left) there is a 24V DC power supply, a terminal strip with 104
terminals, ten relays and two terminal blocks for the inputs and outputs of the controller.
1.2 Modules
1.2.1 Feeder
At the rear end of each block is a magnet. A reed relay is mounted in such a way that it de-
tects this magnet when the chain is in the waiting position to push the next workpiece out of
the feeder.
Transverse to the movement direction of the workpieces is a light barrier which switches to '1'
when no workpiece is left in the feeder.
On the left side of the tower is a control panel with six illuminated buttons. The LEDs in the
buttons can be controlled independently of the button actuation.
On each conveyor belt are two sensors for detecting the workpieces. They are located at the
beginning of the belt and directly in front of the machine.
Module 1 Page 4 of 11
1.2.3 Drill
Figure 4 Drill
The drill has two motors. The first rotates the tool and is connected in such a way that it can
only rotate in one direction. The second one raises and lowers the machine head. It is con-
nected by two relays in order to reverse the polarity of the voltage on the motor and thus
reverse the movement direction. When moving in one direction, only one relay is active. This
makes the control of the relays very simple.
The module only provides feedback to the controller via two mechanical limit switches. They
are fixed at the lower and upper end of the machine stand. They can be moved vertically and
should not be mistaken for mechanical stops. If programmed incorrectly, the tool may collide
with a workpiece. The movement upwards is not limited, so the machine head would fall out.
Module 1 Page 5 of 11
As with the drill, two mechanical limit switches are fixed at the lower and upper end of the
machine stand. Incorrect programming also has the same consequences here.
There is also an identical mechanical switch for the position of the tool changer. This switch
is activated every time a tool points downwards. This means that it cannot determine which of
the three tools is pointing downwards.
The position switch for the tool is mounted in such a way that the tool is exactly vertical when
the changer is turned to the right and stops immediately when the switch is actuated. If, on the
other hand, the tool changer is rotated to the left, the motor must not be stopped until the
switch has been exited again after being actuated. This is caused by the fact that the switch is
activated over a certain rotation range.
Module 1 Page 6 of 11
As with the previous machines, there are two mechanical limit switches at the lower and up-
per end of the machine stand. In addition, there are mechanical limit switches at the front and
back positions of the machine stand on the machine bed. When each of these switches is actu-
ated, the program must ensure that the critical motor is safely switched off.
1.2.6 Storage
Figure 7 Storage
The storage at the end of the production line can hold four workpieces. At the beginning of
the storage is a reflection light barrier which detects a workpiece positioned vertically above
it. Each workpiece that moves over the sensor generates a '1' pulse. If the storage is full, the
last workpiece lies directly above the sensor and thus generates a permanent '1' signal.
Module 1 Page 7 of 11
1.3.7 Motors
Figure 14 shows the drive mechanism of the conveyor belts. Figure 15 shows a motor for
moving a machine and its associated gear for rotational speed reduction.
Module 1 Page 10 of 11
Module 2
Control design and analysis with SIPN
Topic:
1 THE CONTROL CONCEPT ............................................................................................................2
2 THE PLC AS CONTROL DEVICE ..................................................................................................3
3 THEORETICAL BASICS .................................................................................................................3
3.1 PETRI NETS ...................................................................................................................................3
3.2 SIGNAL INTERPRETED PETRI NETS (SIPN) ......................................................................................4
3.3 CONDITIONS FOR CORRECT SIPN ...................................................................................................6
3.4 REACHABILITY GRAPH ....................................................................................................................7
3.5 ANALYSIS WITH REACHABILITY GRAPH .............................................................................................9
4 RECOMMENDATIONS FOR SIPN DESIGN ................................................................................11
Module 2 Page 2 of 12
In this laboratory, control algorithms for a given production plant are to be designed. The de-
scriptions of the individual control parts as well as information about their desired behavior
are required for this purpose.
Module 2 Page 3 of 12
3 Theoretical basics
Within the framework of this laboratory test, control algorithms are to be developed. Since the
tasks to be solved are mostly concurrent processes, Petri-nets can be used to create the algo-
rithms, which also allow an analysis of the modelled algorithm. In particular, so called signal
interpreted Petri nets (SIPN) are used, which have a strong relation to industrially used tech-
nical languages.
3.1 Petri nets
Petri nets are assigned to the class of so-called bipartite digraphs. Bipartite means that there
are two disjoint subsets of nodes (places, transitions), where nodes of one subset are connect-
ed with nodes of the other subset by edges. Digraphs are also called directed graphs. A
distinction is made between the edges leading to a transition (pre-edges) and the edges leading
away from a transition (post-edges). Places can be marked with so-called tokens, whereby in
this laboratory experiment only binary markings of places is considered. The tokens are
switched/fired by the transitions through the net. The following rules apply to the firing of
transitions, which describe if a transition is enabled and the behavior when firing a transition:
(R1) Strong concession rule
A transition is ready to fire (enabled) if all places connected by pre-edges have at least
one token and if none of the places connected by post-edges would have more than one
token after the firing of the transition.
The following semantics of the Petri-net can be specified by the binary marking: A marked
place corresponds to a fulfilled condition, an unmarked place corresponds to an unfulfilled
condition for the occurrence of an event. The firing of a transition can be seen as an event,
Module 2 Page 4 of 12
which can occur if all pre-conditions are fulfilled. During firing, all post-conditions are ena-
bled. The term condition/event net is therefore frequently used in the literature. In the
literature there are a number of other types of Petri nets, which are not relevant for this labora-
tory experiment.
3.2 Signal interpreted Petri nets (SIPN)
In control engineering, the semantics described above can be concretized as follows: Condi-
tions are interpreted as control situations that can be enabled (marked) or disabled. The
operative part of control is expressed in the fact that in every situation certain actions must be
executed by the control device and that the occurrence of events can be explicitly expressed as
a function of certain signals. A distinction is made between internal (timers) and external (in-
put signals) events. Therefore, SIPNs describe control algorithms for the controller by
extending the syntax of the Petri-nets mentioned above.
In general, SIPN can be integrated into the theory of interpreted Petri nets (IPN). IPN are al-
ways binary marked Petri nets. As a special form of IPN, the input and output variables of the
control algorithm in the SIPN are treated by interpretation (syntax extension) of the net-
elements place and transition.
In this laboratory timed signal interpreted Petri-nets (tSIPN) are used [REF GEORG].
A tSIPN is defined as a 10-Tuple SIPN = (P, T, F, m0, I, O, ϕ, ω, Ω, τ) with
(P, T, F, m0) a normal Petri-net with places P, transitions T, directed arcs F and a Boolean
initial marking m0. |P|, |T|, |F| > 0
I a set of binary input signals with |I| > 0
O a set of binary output signals with I ∩ O = ∅, |O| > 0
ϕ a mapping that assigns a switching condition ϕ(ti) = boolean function in I to each transi-
tion ti ∈ T
ω a function that assigns an output ω(pi) ∈ (0, 1, -)|O| to each place pi out of P. "-" means
"not defined".
Ω the output function which combines the output functions of all marked places to the
total output of the SIPN: Ω: m → (0, 1, -, c)|O|. The total output can have the following
values: zero (0), one (1), not defined (-) or contradictory defined (c).
τ a mapping that links each edge fi ∈ (P × T) ∩ F that goes from a place to a transition to
a time delay τi ∈ R0+. With fi = (pj, tk), τi is the minimum time the token must spend in
place pj before tk can fire.
4. The firing process is continued until a stable marking is reached (i.e. no transition can fire
without changing the input signals).
When a stable mark is reached, the output signals are recalculated by function Ω.
The firing process can be accomplished by the algorithm in figure 2.
3.2.2 Semantic
Places have action character: If they are marked, they influence the process via outputs or
provide the operator with information. At the same time, they have a static character, since the
marking is associated with a time duration. If a fixed time relationship is required, the mini-
mum duration for marking a place can be determined by the pre-edge time rating τ.
On the other hand, transitions have a transfer character, they receive information from the
process or the operator via input signals. Each transition is assigned a firing condition, which
is a Boolean function of the input variables.
The firing itself is time-free, in other words infinitely short.
With each marking of the SIPN, each individual marked place with its output function influ-
ences the total output of the net. The output of a SIPN results from the overlapping (product)
of the output functions of simultaneously marked places. The output variables are assigned
either the value one or the value zero. If, on the other hand, an output variable is not ad-
dressed, its value is initially undetermined. Figure 3 shows an example of a SIPN:
Module 2 Page 6 of 12
S1
A1=1;
τ = 2,1 sec
T1 T3
/E1 ∨ /E2 E1 ∧ E2
S2 S3
A2=1; A1=1; A4=1;
T2 S5 T4
E1 A3=1; E1
S4
A1=1;
T5
E1
Figure 3 tSIPN
In the case that E0.2 and E0.3 are fulfilled simultaneously, an undetermined switching
would be possible. A possible solution is the introduction of a disjunctive switching condi-
tion, e.g. SB(T2) = E0.3 ∧ E0.2 .
Two additional conditions often imposed on SIPN are deadlock freedom and reversibility:
Deadlock free
Usually control algorithms are designed in cyclic form. Alternatively, it is possible to de-
sign a control algorithm with start and end positions that are not identical. It must not
happen that the token in a marked place, which is not the end place, can never be removed,
because its following transition never becomes fireable/enabled. The algorithm would get
stuck in this situation. Two types of deadlock can be distinguished here: A partial deadlock
would only affect this one transition, which can never fire. On the other hand, a total dead-
lock describes the state in which no transition can fire in the entire Petri net.
Reversibility
Reversibility means that the algorithm can reach its initial state again. This is an important
condition to check if a restart within the system is possible.
Example:
P1 P2
T1 T2 T3
P3
P6
T4 T5
P4 P5
T6
100001
t2
t4
001001 000101
t5 t1 t1
101000
t4 100100
000011
t1 t5 t2
t3
100010 001100 010100
t5
t2 t4
001010 000110
t3
t6
t3 t1 t4
010001 110000
t3 t2
010010 011000
t5
Example:
t1→t2→t3→t4: i3∧i1
ω(p3): o3 = 1 ω(p5)=(1,0,-)
Deadlocks
Livelocks
Reversibility
EG contains no deadlocks,
EG contains exactly one livelock,
Initial marking m0 is contained in this one livelock
Module 2 Page 11 of 12
Rest
START
Fast heating up to 180° C
Fill with 10° C/min
Fill level
Mix 180° C reached
reached
Heat 5 min
Figure 8 Hierachy
If the heating place of the main net is marked, the corresponding subnet is processed, i.e. the
grey input place "Fast heating up to 180°C with 10°C/min" is marked. The algorithm has to
first pass through the subnet. Only when the starting position "heating up to 200°C with
1°C/min" is marked, the transition "200°C reached" is concessioned/enabled in the main net.
It is therefore a kind of macro technique.
Concurrent actions in the Petri-net can also increase transparency if they are used wisely. Ac-
tions that are enabled parallel to a certain process with a constant value should therefore be
listed in the control algorithm. The rotation of the turntable serves as an example, see figure 9.
The transparency is created by graphical visualization of the actual control process. In gen-
eral, this means that the active output of the SIPN can be read directly and easily at the
marked positions in any state (which corresponds to the marking of the SIPN).
Module 2 Page 12 of 12
~ ~
S1 S1
T1 T1
Start button pressed Start button pressed
E0.1 E0.1
S2 S4
Turntable motor on S2
Turntable motor on Turntable rotates
A1.4=1; A1.4=1;
T2 T2
Turntable not in position Turntable not in position
NOT E2.2 NOT E2.2
S3
Turntable rotates to position S3
A1.4=1; Turntable rotates to position
T3 T3
Turntable in position Turntable in position
E2.2 E2.2
S4 S5
Turntable motor off Turntable motor off
A1.4=0; A1.4=0;
~ ~
Figure 9 Net section without concurrency, net section with concurrency
Pre-edges time rating is to be used if and only if a process cannot be completely observed by a
sensor. A transition with time-valuated pre-edges is ready for operation when the concession
and synchronization rules have been fulfilled and the time duration τ specified at the edge has
passed. An example of such a process is the baking of a cake. The corresponding algorithm is
shown in figure 10. Since you usually don't have a sensor that recognizes that the cake is
baked, you stop baking after a certain time (here: τ = 45 time units). Then the oven door will
be opened.
~
S1
Bake cake
τ = 45
T1
S2
Open oven door
~
Figure 10 Pre-edge time rating
Control of a production plant with PLC
Authors: Georg Frey and Stéphane Klein
Translation: Marcel Krames and Raphael Fritz
Supervision: M.Sc. Raphael Fritz
Module 3
Simatic STEP7
Topic:
1 GENERAL INFORMATION ABOUT PLC-PROGRAMMING WITH STEP7 ................................. 2
2 DESCRIPTION OF PROGRAMMING LANGUAGES .................................................................... 2
2.1 IL, FBD, LD ................................................................................................................................ 2
2.2 S7-Graph.................................................................................................................................... 5
Module 3 Page 2 of 6
mainly of Boolean algebra formulas. Counters, time elements or algebraic operations can be
implemented additionally.
For programming, exactly one network has to be provided for each output or flag (Boolean
variable) if it is an assignment, and exactly two if the output or flag is to be set and reset as
stored. A network corresponds to the condition for an action in the form of an AND/OR in-
struction. An assignment means that the output is only assigned with ' 1' as long as the
condition for the output is fulfilled. If the output is set stored, it keeps the '1' signal until the
reset condition is fulfilled. A network is required for the set and reset conditions.
As already mentioned, if you program several assignments of an output at different points that
contradict each other, the signal that was generated during the last assignment is transferred to
the output. Since this may lead to errors, the rule mentioned above should be followed. How-
ever, this also means that if the set and reset conditions are fulfilled simultaneously for one
output, the action behind the other in the program sequence is valid. Therefore, normally the
set network is written before the reset network so that a reset priority is given.
For the use of timers, the following time elements are common:
1. Switch-on delay:
The time starts with a positive edge at the input of the timer. After the time has elapsed,
the output becomes '1'. With a negative edge at the input, the output becomes '0' again. If
the negative edge at the input comes before the time has elapsed, the output remains at '0'.
2. Switch-off delay:
The output immediately switches to '1' if there is a positive edge at the input. The time
starts at the negative edge at the input of the timer. After the time has elapsed, the output
becomes '0' again.
3. Impulse:
If the edge at the input is positive, the output immediately goes to '1' and the timer starts.
After the time has elapsed, the output becomes '0' again. If the negative edge at the input
comes before the time has elapsed, the output immediately returns to '0.
There are also three different types of counters: the forward counter, the reverse counter, and
a counter with one input for forward counting and one for reverse counting. Counting always
starts with a positive edge at the counting input. All counters have two outputs at which the
current counter value is present, one as a dual number and the other as a decimal number. Fur-
thermore, they have a binary output which is only '0' if the counter value is '0', and otherwise
'1'. Besides the counter inputs, there is also a reset input and two inputs to preset the counter
to a certain value.
Because of the faster entry, it is advised to enter the program in IL. However, the view in the
program editor should be changed from time to time to the other two languages in order to
understand them as well. For reasons of conversion, it is important to make sure that there is
only one assignment, one set command or one reset command in each network. The pro-
gramming of timers and counters alone is easier in the other two languages and should be
implemented there. This also has the advantage that the program can always be displayed in
all three languages. To do this when entering the program in IL, the instruction NOP (no op-
eration) has to be used instead of the unused inputs and outputs for timers and counters.
examples. Instead of the absolute addresses, the symbolic addresses will appear in the pro-
gram to be written.
It should always be ensured that the parentheses are correctly placed, otherwise the program
would not be able to be displayed in the other languages either.
Every line at the beginning of a network or a parenthesis has to be started with U, UN, O or
ON. Beginning with U or O has no influence on the function.
Like inputs, the signal states of outputs, flags, counters (e.g. Z1) and timers (e.g. T1) can also
be read.
Negated operand:
Module 3 Page 5 of 6
The assignment is represented by open and closed round parentheses on the right side. For set
and reset operations, these parentheses contain the letters 'S' or 'R'.
Z_VORW Z_RUECK
ZV Q ZR Q
S DUAL S DUAL
ZW DEZ ZW DEZ
R R
ZV and ZR are the counting inputs. At input ZW, the number (e.g. C#5 for the number 5) is
entered which is to be loaded into the counter when a positive edge at input S is detected. As
long as a '1' signal is connected to the reset input R, the counter is kept at '0'. Q is the binary
output. The current counter value is present at DUAL and DEZ as a dual or decimal number.
R Q R Q R Q
Input S has to be connected to the signal that starts the timer. The time duration is entered at
input TW (e.g. S5T#500MSnfor the value 500ms). The outputs and the reset input have the
same functions as the counter.
2.2 S7-Graph
The step chain in the S7-Graph is processed as follows: The program starts in a so-called ini-
tialization step, which is specially marked in the editor (double frame). Each step is followed
by a transition with a corresponding condition. If the condition is fulfilled, the next step be-
comes active by executing the actions of this step. Only one step can be active at one time.
Conditions must be programmed as AND/OR instructions in the ladder diagram (LD).
Branches can be made after a step, so alternative branches must always begin with a transi-
tion. After a transition, it is possible to insert a jump that has to lead to a step.
The following operations are sufficient for the program to be written:
N The output or flag is only '1' when the step is active
S The output or marker is set to '1' and remains '1' even beyond the step
R A set output or flag is reset again
D The output or marker becomes '1' with a time delay and goes back to '0' when
leaving the step (for entering the time see example)
Module 3 Page 6 of 6
CALL Block call that is executed cyclically when the step is active
S0 CALL Block call that is executed only once when the step is exited
Figure 1 shows an example of an S7-Graph program. It has nothing to do with the program to
be written and only serves to understand the structure of a step chain. The two arrows in the
program represent a jump. The arrows always show the destination or source address.
Module 4
Description of the control system
Topic:
1 INFORMAL DESCRIPTION OF THE ENTIRE PROGRAM ............................................................2
1.1 PROGRAM STRUCTURE ...................................................................................................................2
1.2 DEFINITION OF OPERATING STATES .................................................................................................2
1.3 DESCRIPTION OF THE PROCESS IN AUTOMATIC MODE .......................................................................2
1.4 DESCRIPTION OF THE PLANT BEHAVIOUR IN THE OTHER OPERATING MODES ......................................4
2 SUBDEVISION INTO DIFFERENT PROGRAM MODULES ..........................................................6
2.1 OVERVIEW OF THE MODULE STRUCTURE .........................................................................................6
2.2 DEFINITION OF INTERFACE VARIABLES AND LOCAL VARIABLES ...........................................................7
3 EXACT TASK DESCRIPTION OF THE INDIVIDUAL MODULES ...............................................14
3.1 MODE .........................................................................................................................................14
3.2 FEEDER.......................................................................................................................................14
3.3 DRILL ..........................................................................................................................................15
3.4 VMILL ..........................................................................................................................................15
3.5 HMILL ..........................................................................................................................................16
3.6 STORAGE ....................................................................................................................................17
Module 4 Page 2 of 17
Hand- Pause-
mode mode
The main program consists only of the block calls of the six mentioned program modules. It is
written in IL (instruction list). The calls are made cyclically in the order from left to right. The
module Mode is to be programmed in sequential function chart and calls in the relevant steps
the modules Hand-mode or Pause-mode.
Operation
T10
T11
T12
T13
T14
T15
T16
T17
T18
T19
T20
T21
T1
T2
T3
T4
T5
* T6
T7
T8
T9
Conveyor
Lower Drill
Drill
Raise Drill
Drill on
Drill off
Conveyor
Lower Mill
Vertical Mill
Raise Mill
Rotate Mill
Mill on
Mill off
Conveyor
*
Lower Mill
Horizontal Mill
Raise Mill
Mill forward
Mill back
Mill on
Mill off
Figure 1 Gantt-Chart for automatic mode
1.4.2 Pause-mode:
Already running cycles are finished and then the machine is stopped. One of the cycles is the
transport of a workpiece from one sensor to the next or out of the feeder. A processing cycle
on the machine is considered to be completed, except after machining has been finished, at the
following points: In the case of the drill, when the machine head is at the upper end position
after the first drilling operation and the workpiece has already been moved further; In the case
of the vertical mill, when the machine head is at the upper end position and the tool has been
changed; In the case of horizontal mill, when after the first processing step the machine head
is at the bottom and front and the workpiece has already been moved further.
Module 4 Page 5 of 17
1.4.3 Clear-mode:
The machines continue to run all possible operations of the automatic mode. The only differ-
ence is that the feeder does not push any more workpieces onto the conveyor belt.
1.4.4 Stop-mode:
All motors will be stopped immediately..
1.4.5 Hand-mode:
Since the control system cannot detect which of the three tools of the vertical mill is pointing
downwards, there has to be a possibility to operate the tool changer manually. This is possible
in the Hand-mode by pressing the INIT-button. The tool is already changed for the first time
when the button is pressed in Stop-mode, which leads to the Hand-mode.
Module 4 Page 6 of 17
Vertikale Fräse Vertical Mill Vmill Controls the vertical mill with convey-
or belt
Horizontale Fräse Horizontal Mill Hmill Controls the horizontal mill with con-
veyor belt
The modules only communicate with each other via global variables. These variables contain
information on the operating status of the plant, the initial position of the machines and the
presence of a workpiece in a machine module.
In addition, the inputs and outputs are always allocated to only one module. For example, the
sensors at the transitions between the conveyor belts are always allocated to the next module.
The information that a workpiece has reached the next conveyor belt is therefore not received
directly by the module from the sensor, but only via the variable that indicates that a work-
piece is located in the next module. This simplifies the fault detection in case this sensor is
defective.
Module 4 Page 7 of 17
The local variables, if available, are listed in a third table. With Step7 it is possible to define 5
different types of local variables. They differ in the direction in which they are transferred
from one program to another, or whether they are only used in the program in which they are
defined.
In this program only variables of the types IN and STAT are used.
These three variables exist in the two subprograms Mode_Hand and Mode_Pause. The pro-
grams flash the LEDs INIT and START with the help of the local variables.
E 1.3 drill_bottom Drill head is at lower limit Drill head is not at lower limit
0.0 (stat) neues_teil There is a workpiece on the conveyor belt which does not yet have a
hole or where the first hole has just been drilled and the machine
head is on its way up.
0.1 (stat) ein_loch There is a workpiece in front of the drilling machine which has a
hole or where the second hole has just been drilled and the machine
head is on its way up.
0.2 (stat) zwei_loecher There is a workpiece in front of the drill that has two holes but has
not yet been transported to the end of the conveyor belt.
E 2.3 vmill_bottom Mill head is at lower limit Mill head is not at lower limit
M 2.6 vmill_init_state Vertical mill not in initial posi- Vertical mill in initial position
tion
M 2.7 vmill_cleared At least one workpiece in front Vertical mill cleared
of the vertical mill
A 2.2 vmill_motor_up Motor up off Motor up on
A 2.6 vmill_change_left Motor tool changer left off Motor tool changer left on
A 2.7 vmill_change_right Motor tool changer right off Motor tool changer right on
0.0 (stat) neues_teil There is a workpiece on the conveyor belt that does not yet have a
hole.
0.1 (stat) bearbeitung There is a workpiece in front of the machine that is still being pro-
cessed, or that is already finished, but has not yet been removed.
0.2 (stat) zaehler There is a workpiece on the conveyor belt where not all holes have
been drilled.
0.3 (stat) drehen The machine head was at the lower end position, and the next time
the upper limit position is reached, the tool changer has to be rotated.
0.4 (stat) hand The tool is changed because the INIT button was pressed in Stop- or
Hand-mode.
E 3.0 hmill_back Mill head is at back limit Mill head is not at back limit
E 3.1 hmill_front Mill head is at front limit Mill head is not at front limit
E 3.2 hmill_top Mill head is at upper limit Mill head is not at upper limit
E 3.3 hmill_bottom Mill head is at lower limit Mill head is not at lower limit
Address Variable name Bedeutung der binären Null Meaning of binary one
M 3.6 hmill_init_state Horizontal mill not in initial posi- Horizontal mill in initial posi-
tion tion
M 3.7 hmill_cleared At least one workpiece in front of Horizontal mill cleared
the horizontal mill
A 3.0 hmill_motor_back Motor backwards off Motor backwars on
(stat) bearbeitung There is a workpiece in front of the machine that is still being
processed, or the finished workpiece is just being transported to
the warehouse.
E 3.6 storage_sensor No workpiece above the sensor Workpiece above the sensor on
on storage storage
3.1.2 Hand-Mode
The INIT-button (init_button) can be used to switch from the Stop-mode to the Hand-mode
(init_signal flashes). The first time the button is pressed, a tool change is executed on the ver-
tical mill. In Hand mode, the tool changer is moved one position further each time the INIT-
button is pressed. In order to execute the tool change, the signal tool_changer is set to '1' by
the module Mode as long as the INIT-button is pressed. It is only possible to return from
Hand-mode to Stop-mode by pressing the STOP-button (stop_button).
3.1.3 Init-Mode
If the START-button (start_button) is pressed in Stop-mode, the plant moves to the initial
position (init_mode and init_signal are '1'). When all modules are in the initial position (all
init_state variables are set to '1'), the plant automatically switches to Automatic-mode.
3.1.4 Automatic-Mode
In Automatic-mode, the variable automatic_mode and the output start_signal are '1'.
3.1.5 Pause-Mode
If the START button is pressed in the Automatic-mode, the plant switches to the Pause-mode
(pause_mode is '1' and start_signal flashes). By pressing the START button again, the plant
can be returned to the Automatic-mode.
3.1.6 Claer-Mode
By pressing the CLEAR STOP-button (clear_button) in Automatic-mode, the Clear-mode is
initiated. This is not possible in the Pause-mode. In Clear-mode, the plant is still processing
the workpieces on the conveyor belts. However, no new workpiece is pushed out of the feeder
(clear_mode and clear_signal become '1'; automatic_mode remains at '1'). When all modules
are empty (all cleared variables are set to '1'), the plant switches to the Stop-mode.
3.2 Feeder
Independently in which mode the plant operates, the LED FEEDER EMPTY (feeder_signal)
is switched on after 500ms if the signal feeder_empty has a positive edge. It switches off when
this signal has a negative edge.
3.2.1 Init-Mode
If the variable init_mode is set to '1', the system checks whether the conveyor chain of the
feeder is in one of its defined positions (feeder_ready). Otherwise, the feeder is moved to that
position (feeder_motor). Reaching the initial position is indicated by the variable
feeder_init_state.
Module 4 Page 15 of 17
3.2.2 Automatic-Mode
In Automatic mode, it is checked whether the next module is empty (drill_cleared), and if so,
a workpiece is pushed out of the feeder (feeder_motor). First of all, it is of course checked
whether there are still workpieces in the feeder (feeder_empty is '0'). The signal feeder_ready
reports to the controller whether the workpiece is completely pushed out of the feeder.
3.2.4 Stop-Mode
If the variable stop_mode has a positive edge during the push-out cycle, the motor of the con-
veyor chain is stopped immediately.
3.3 Drill
3.3.1 Init-Mode
In the Init-mode (init_mode is '1') the drill is moved to its initial position. It is assumed that
there are no more workpieces on the conveyor belt. The initial position is reached when the
drill head is in the upper end position (drill_top is '0') and is indicated by the variable
drill_init_state. The module now also sets the variable drill_cleared, so that the module Feed-
er knows that there is no workpiece on the belt of the drill at the first start of the Automatic-
mode.
3.3.2 Automatic-Mode
If a workpiece is at the beginning of the conveyor belt (drill_entrance), the drill_cleared vari-
able is reset. Then the new workpiece is transported to the first working position
(drill_position). After arriving there, the processing begins. The tool motor of the drill (drill-
ing_motor) starts running. At the same time the drill head moves downwards
(drill_motor_down) to the lower limit position (drill_bottom) and moves upwards again
(drill_motor_up) to the upper limit position (drill_top). At this moment the tool motor also
stops. Then the conveyor belt transports the workpiece just forward until the drill_position
signal has become '0'. The workpiece is now in the second working position in which the en-
tire drilling process is repeated. Once the processing cycle has finished, the system checks
whether the next module is empty (vmill_cleared). If yes, the workpiece is transported to the
end of the conveyor (vmill_cleared has become '0'). After reaching this point, the variable
drill_cleared is set again.
3.3.3 Pause-Mode
When the pause_mode signal has a positive edge, the current step will still be executed and
then all motors will be stopped. The Automati-mode resumes seamlessly as soon as the varia-
ble pause_mode has returned to '0'. The processing of the workpiece can only be interrupted
after it has been transported to the second working position.
3.3.4 Stop-Mode
If the stop_mode signal has a positive edge, all motors are stopped immediately.
3.4 Vmill
3.4.1 Init-Mode
In the Init-mode (init_mode is '1') the vertical mill is moved to its initial position. It is as-
sumed that there are no more workpieces on the conveyor belt. The initial position is reached
Module 4 Page 16 of 17
when the milling head is in the upper limit position (vmill_top is '0') and any tool points
downwards (vmill_tool_ready is '0'). The initial position is indicated by the variable
vmill_init_state. The module now also sets the variable vmill_cleared so that the module Drill
knows at the first start of Automatic-mode that there is no workpiece on the conveyor belt of
the vertical mill.
3.4.2 Automatic-Mode
If a workpiece is at the beginning of the conveyor belt (vmill_entrance), the variable
vmill_cleared is reset. Then the new workpiece is transported to the working position
(vmill_position). After arriving there, the processing begins. The tool motor of the milling
machine (vmilling_motor) starts running. At the same time the milling head moves down-
wards (vmill_motor_down) to the lower limit position (vmill_bottom) and moves upwards
again (vmill_motor_up) to the upper limit position (vmill_top). At this moment the tool motor
also stops. Then the tool is changed in right-hand rotation (vmill_change_right). The entire
milling process, including the tool change, is now repeated twice. Once the processing cycle
has finished, the system checks whether the next module is empty (hmill_cleared). If yes, the
workpiece is transported to the end of the conveyor belt (hmill_cleared has become '0'). After
reaching this point, the variable vmill_cleared is set again.
3.4.3 Pause-Mode:
When the pause_mode signal has a positive edge, the current step will still be executed and
then all motors will be stopped. The Automati-mode resumes seamlessly as soon as the varia-
ble pause_mode has returned to '0'. The processing of the workpiece can only be interrupted
directly after a tool change.
3.4.4 Stop-Mode:
If the stop_mode signal has a positive edge, all motors are stopped immediately.
3.5 Hmill
3.5.1 Init-Mode
In the Init-mode (init_mode is '1') the horizontal mill is moved to its initial position. It is as-
sumed that there are no more workpieces on the conveyor belt. The initial position is reached
when the milling head is in the upper limit position (hmill_top is '0') and the machine stand is
in the back limit position (hmill_back is '0'). It is indicated by the variable hmill_init_state.
The module now also sets the variable hmill_cleared so that the module Vmill knows that
there is no workpiece on the conveyor belt of the horizontal milling machine at the first start
of automatic operation.
3.5.2 Automatic-Mode
If a workpiece is at the beginning of the conveyor belt (hmill_entrance), the variable
hmill_cleared is reset. Then the new workpiece is transported to the working position
(hmill_position). After arriving there, the processing begins. The tool motor of the milling
machine (vmilling_motor) starts running. At the same time the milling head moves down
(hmill_motor_down) to the lower limit position (hmill_bottom) and then the machine stand
moves forward (hmill_motor_front) to the front limit position (hmill_front). Then the convey-
or belt transports the workpiece just forward until the signal hmill_position has become '0'.
The workpiece is now in the second working position. Now the machine stand moves back
again (hmill_motor_back) to the back limit position (hmill_back) and then the milling head
moves up (hmill_motor_up) to the upper limit position (hmill_top). The tool motor also stops
at this moment. If the processing cycle has finished, the system checks whether the storage is
Module 4 Page 17 of 17
full. If not (storage_full is '0'), the workpiece is transported to the end of the conveyor belt
(storage_entrance). After reaching this point, the variable hmill_cleared is set again.
3.5.3 Pause-Mode
When the pause_mode signal has a positive edge, the current step will still be executed and
then all motors will be stopped. The Automati-mode resumes seamlessly as soon as the varia-
ble pause_mode has returned to '0'. The processing of the workpiece can only be interrupted
after it has been transported to the second working position.
3.5.4 Stop-Mode
If the stop_mode signal has a positive edge, all motors are stopped immediately.
3.6 Storage
Independently in which mode the plant operates, the variable storage_entrance is set syn-
chronously with the sensor signal (storage_sensor). In addition, a timer is started with each
positive edge of this sensor signal. If the time has elapsed and the sensor signal is still at '1',
the variable storage_full is set to '1'. If the sensor signal has a negative edge, the variable re-
turns to '0'. The LED STORAGE FULL (storage_signal) is controlled synchronously with the
variable storage_full.
Control of a production plant with PLC
Module 5
Implementation of SIPN in control languages
Topic:
1 INTRODUCTION AND EXAMPLE ..................................................................................................2
2 IMPLEMENTATION IN CONTROL LANGUAGES .........................................................................3
2.1 SEQUENTIAL FUNCTION CHART – SFC............................................................................................3
2.2 TEXTUAL LANGUAGES ....................................................................................................................4
2.3 GRAPHICAL LANGUAGES ................................................................................................................7
3 LITERATURE ................................................................................................................................11
Module 5 Page 2 of 11
Figure 1 SIPN
PROGRAM Main
VAR_GLOBAL
e1 AT %IX0.1 : BOOL ;
e2 AT %IX0.2 : BOOL ;
e3 AT %IX0.3 : BOOL ;
e4 AT %IX0.4 : BOOL ;
a1 AT %QX0.1 : BOOL ;
a2 AT %QX0.2 : BOOL ;
a3 AT %QX0.3 : BOOL ;
a4 AT %QX0.4 : BOOL ;
END_VAR
S1
e1 & e4
S2 N a1 S3 N a2
e2 & ¬e3
e2 & e3 S4 N a3
e2 & e3
S5
S5.T=20s
S6 N a4
e1
RET
END_PROGRAM
2.2 Textual Languages
For each place Pi of the SIPN a variable Pi is defined. In the definition of this variables, the
initial marking of the net is entered. In addition, a Boolean variable stable whose initial value
is 1 is defined. This variable is used to check whether the marking reached is stable or not. In
the variable definition the timers are also defined, but only the type of the timer (TON,
TOFF).
After the variable definition, the defined timers are called. The variable to be used as input
and the value of the time delay are defined here.
After defining the variables and calling the timers the code is introduced. First each transition
is coded. Here it is checked that all pre-places are marked, that all post-places are empty and
that the firing condition is fulfilled. If this Boolean expression is true, the pre-places are reset
and the post-places are set. At the same time, the stability variable is reset. After coding the
transitions, the system checks whether the state is stable. If no, the transitions are calculated
again to see if another evolution is possible.
If a stable marking is reached, the defined variable is loaded for each place and the corre-
sponding output signals are set or reset.
Module 5 Page 5 of 11
Label_1: LD stable
JMPCN Label_1
LD 1
S stable (* Place P1 *)
LD P1
(* Transition T1 *) R a1
LD P1 R a2
ANDN P2 R a3
ANDN P3 R a4
AND e1
AND e4 (* Place P2 *)
R P1 LD P2
S P2 S a1
S P3 (* Place P3 *)
R stable LD P3
S a2
(* Transition T2 *) R a3
LD P2 R a4
ANDN P4 (* Place P4 *)
AND e2 LD P4
ANDN e3 R a2
R P2 S a3
S P4 R a4
R stable (* Place P5 *)
LD P5
(* Transition T3 *) R a2
LD P4 R a3
ANDN P5 R a4
AND e2 (* Place P6 *)
AND e3 LD P1
R P4 R a2
S P5 R a3
R stable S a4
(* Transition T4 *) RET
Module 5 Page 6 of 11
END_PROGRAM
2.2.2 Structured Text – ST
VAR_GLOBAL (* Tranisition T5 *)
e1 AT %IX0.1 : BOOL ; IF P5 & NOT P6 & T_1.Q THEN
e2 AT %IX0.2 : BOOL ; P5:=0 ;
e3 AT %IX0.3 : BOOL ; P6:=1 ;
e4 AT %IX0.4 : BOOL ; stable := 0 ;
a1 AT %QX0.1 : BOOL ; END_IF ;
a2 AT %QX0.2 : BOOL ;
a3 AT %QX0.3 : BOOL ; (* Tranisition T6 *)
a4 AT %QX0.4 : BOOL ; IF P2 & P5 & NOT P1 & e1 THEN
END_VAR P5:=0 ;
VAR P6:=1 ;
P1 : BOOL := TRUE ; stable := 0 ;
P2 : BOOL := FALSE ; END_IF ;
P3 : BOOL := FALSE;
P4 : BOOL := FALSE; IF stable = 0 THEN JMP label_1 ;
P5 : BOOL := FALSE; END_IF ;
P6 : BOOL := FALSE;
stable : BOOL := TRUE ; IF P1 THEN
T1 : TON ; a1 := 0 ;
END_VAR a2 := 0 ;
a3 := 0 ;
CAL T1 (IN:=P5, PT:=T#20s) a4 := 0 ;
END_IF ;
Label_1
IF P2THEN
stable := 1 a1 := 1 ;
END_IF ;
(* Tranisition T1 *)
IF P1 & NOT P2 & NOT P3 & e1 & e4 IF P3 THEN
THEN a2 := 1 ;
P1:=0 ; a3 := 0 ;
P2:=1 ; a4 := 0 ;
P3:=1 ; END_IF ;
stable := 0 ;
END_IF ; IF P4 THEN
a2 := 0 ;
(* Tranisition T2 *) a3 := 1 ;
IF P3 & NOT P4 & e2 & NOT e3 THEN a4 := 0 ;
P3:=0 ; END_IF ;
P4:=1 ;
stable := 0 ; IF P5 THEN
END_IF ; a2 := 0 ;
a3 := 0 ;
(* Tranisition T3 *) a4 := 0 ;
IF P4 & NOT P5 & e2 & e3 THEN END_IF ;
P4:=0 ;
P5:=1 ; IF P6 THEN
stable := 0 ; a2 := 0 ;
END_IF ; a3 := 0 ;
a4 := 1 ;
(* Tranisition T4 *) END_IF ;
IF P3 & NOT P5 & e2 & e3 THEN
P3:=0 ; RET ;
P5:=1 ;
stable := 0 ; END_PROGRAM ;
Modul 7 Seite 7 von 110
PROGRAM Main
VAR_GLOBAL
e1 AT %IX0.1 : BOOL ;
e2 AT %IX0.2 : BOOL ;
e3 AT %IX0.3 : BOOL ;
e4 AT %IX0.4 : BOOL ;
a1 AT %QX0.1 : BOOL ;
a2 AT %QX0.2 : BOOL ;
a3 AT %QX0.3 : BOOL ;
a4 AT %QX0.4 : BOOL ;
END_VAR
VAR
P1 : BOOL := TRUE ;
P2 : BOOL := FALSE ;
P3 : BOOL := FALSE;
P4 : BOOL := FALSE;
P5 : BOOL := FALSE;
P6 : BOOL := FALSE;
stab : BOOL := TRUE ;
T1 : TON ;
END_VAR
| |
START:
| stab |
+----------------------------------------------------(S)--+
| |
(* Transition T1 *)
| |
| P1 P2 P3 e1 e4 P1 |
+--| |--|/|--|/|--| |--| |------------------------+--(R)--+
| | |
| | P2 |
| +--(S)--+
| | |
| | P3 |
| +--(S)--+
| | |
| | stab |
| +--(R)--+
| |
(* Transition T2 *)
| |
| P3 P4 e2 e3 P3 |
+--| |--|/|--| |--|/|-----------------------------+--(R)--+
| | |
| | P4 |
| +--(S)--+
| | |
| | stab |
Modul 7 Seite 8 von 11
| +--(R)--+
| |
(* Transition T3 *)
| |
| P4 P5 e2 e3 P4 |
+--| |--|/|--| |--| |-----------------------------+--(R)--+
| | |
| | P5 |
| +--(S)--+
| | |
| | stab |
| +--(R)--+
| |
(* Transition T4 *)
| |
| P3 P5 e2 e3 P3 |
+--| |--|/|--| |--| |-----------------------------+--(R)--+
| | |
| | P5 |
| +--(S)--+
| | |
| | stab |
| +--(R)--+
| |
(* Transition T5 *)
| |
| P5 P6 T1.Q P5 |
+--| |--|/|--| |----------------------------------+--(R)--+
| | |
| | P6 |
| +--(S)--+
| | |
| | stab |
| +--(R)--+
| |
(* Transition T6 *)
| |
| P2 P6 P1 e1 P2 |
+--| |--| |--|/|--| |-----------------------------+--(R)--+
| | |
| | P6 |
| +--(R)--+
| | |
| | P1 |
| +--(S)--+
| | |
| | stab |
| +--(R)--+
| |
| stab |
+--|/|----->>START |
| |
(* Place P1 *)
| |
| P1 a1 |
+--| |--------------------------------------------+--(R)--+
| | |
| | a2 |
| +--(R)--+
| | |
| | a3 |
| +--(R)--+
| | |
Modul 7 Seite 9 von 11
| | a3 |
| +--(R)--+
| |
(* Place P2 *)
| |
| P2 a1 |
+--| |-----------------------------------------------(S)--+
| |
(* Place P3 *)
| |
| P3 a2 |
+--| |--------------------------------------------+--(S)--+
| | |
| | a3 |
| +--(R)--+
| | |
| | a4 |
| +--(R)--+
| |
(* Place P4 *)
| |
| P4 a2 |
+--| |--------------------------------------------+--(R)--+
| | |
| | a3 |
| +--(S)--+
| | |
| | a4 |
| +--(R)--+
| |
(* Place P5 *)
| |
| P5 a2 |
+--| |--------------------------------------------+--(R)--+
| | |
| | a3 |
| +--(R)--+
| | |
| | a4 |
| +--(R)--+
| |
(* Place P6 *)
| |
| P6 a2 |
+--| |--------------------------------------------+--(R)--+
| | |
| | a3 |
| +--(R)--+
| | |
| | a4 |
| +--(S)--+
| |
RET
END_PROGRAM
For each place of the SIPN a memory (RS Flip-Flop) is used, whose initial state corresponds
to the initial marking of the place. An AND-gate is used for each transition, since the transi-
tion can only fire if it is concessioned and the firing condition is fulfilled. In the presented
implementation, the weak concession rule is used. The transition gates are then connected to
the places they set or reset.
Each output signal is the result of an OR-operation of the different places where it is set. In
this example, each signal is set in only one place, but generally there should be an OR-gate in
front of each output.
Modul 7 Seite 11 von 11
PROGRAM Main
VAR_GLOBAL
e1 AT %IX0.1 : BOOL ;
e2 AT %IX0.2 : BOOL ;
e3 AT %IX0.3 : BOOL ;
e4 AT %IX0.4 : BOOL ;
a1 AT %QX0.1 : BOOL ;
a2 AT %QX0.2 : BOOL ;
a3 AT %QX0.3 : BOOL ;
a4 AT %QX0.4 : BOOL ;
END_VAR
T1 P1
e1 & S a1
&
R
T2
P2
e2 & S a2
&
R
T3
P3
& S
e3 & a3
≥1 R
T4
P4
& S
e4 a4
R
P5
T5 ≥1 S
TON
IN Q R
t#20s PT
T6
P6
& S
&
R
RET
END_PROGRAM
3 Literature
[IEC 61131-3] IEC, International Standard 61131-3, 2nd Ed., Programmable Controllers -
Programming Languages, 1999.
[Modul 2] G. Frey und S. Klein: Steuerungsentwurf mit SIPN. Laborunterlagen, Technische
Universität Kaiserslautern, 2003.
[Modul 3] G. Frey und S. Klein: Simatic STEP 7. Laborunterlagen, Technische Universität
Kaiserslautern, 2003.