Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Contents Page
Blocks for Structured Programming ................................................................................................ 2
Block Overview in STEP 7 ............................................................................................................... 3
Instance Formation of Function Blocks ............................................................................................ 4
Structure of the Multiple Instance Model ............................................................................................. 5
Characteristics of the Multiple Instance Model ................................................................................. 6
Basic Program of the Production Line ............................................................................................. 7
Parameter Description: "FB_Main_Station" (FB 2) Block ............................................................... 9
Parameter Description: "FB_Station" (FB 3) Block ............................................................................. 10
Parameter Description: "FB_Belt" (FB 4) Block ............................................................................. 11
Interconnecting the Blocks (Initial Situation) .................................................................................... 12
Exercise 1: Creating a HW Station and Commissioning the Program ............................................ 13
Task Description: "FB_Sequence" (FB 30) ..................................................................................... 14
Sequential Control of Part Processing using "FB_Sequence" ……………………….…………......… 15
Sequence of Part Processing (According to IEC61131-3) ............................................................... 16
Static Variables of "FB_Sequence" (FB 30) ………………………………………………………….. 17
Parameter Description: "FB_Sequence" (FB 30) Block ................................................................... 18
Exercise 2: Integrating the "FB_Sequence" (FB 30) Block ............................................................. 19
Object-Oriented Programming by Means of Multiple Instances............................................................ 20
Implementing a "Press Line" in STEP 7 ..................................................................................... 21
Task Description: Multiple Instance Model ........................................................................................ 22
Exercise 3: Programming the Processing Time with SFB 4 "TON" ................................................. 23
Task Description: Multiple Instance "FB_Line" (FB 31) .................................................................. 24
Exercise 4: Programming the "FB_Line" (FB 31) .......................................................................... 25
If You Want to Know More ............................................................................................................... 26
Sequence of the Part Processing (According to IEC61131-3) ........................................................ 27
Sequencer: Conversion in STEP 7 (FBD) ....................................................................................... 28
Static Variables of "FB_Sequence" (FB 30) ……………………………………….………………….. 30
Parameter Description: "FB_Sequence" (FB 30) Block ................................................................... 31
Structogram for "FB_Sequence" (FB 30) ....................................................................................... 32
Modularization Abstraction is the basis for solving complex problems, in which we concentrate
of Tasks on the fundamental aspects of a program in every abstraction level and ignore
all the details that are not essential. Abstraction helps us to divide complex tasks
into partial tasks which can then be solved on their own.
Structured STEP7 supports this concept of modularization with its block model. The partial
Programming tasks that result from the division of the entire task are assigned blocks in which
the necessary algorithms and data for solving the partial problems are stored.
STEP7 blocks such as functions (FC) and function blocks (FB) can be assigned
parameters so that the concepts of structured programming can be implemented
with them. This means:
• Blocks for solving partial tasks implement their own data management with
the help of local variables.
• Blocks communicate with the "outside world", that is, with the sensors and
actuators of the process control or with other blocks of the user program,
exclusively through their block parameters. No access to global addresses
such as inputs, outputs, bit memories or variables in DBs can be made from
within the instruction section of blocks.
System function - FB (with memory) stored in the CPU‘s operating system and
block (SFB) callable by the user
System data
- data block for configuration data and parameters
block (SDB)
Blocks in STEP 7 Blocks are, by their function, their structure or their application, limited parts of
the user program. The blocks in STEP 7 can - in keeping with their contents - be
divided into two classes :
• User Blocks: User blocks include Organization Blocks (OB), Function Blocks
(FB), Functions (FC) and Data Blocks (DB).
The programming person stores the program instructions for data
processing or process control in the blocks (OB, FB and FC).
In the data blocks (DB), the programming person can save data that occur
during program execution and then reuse them at a later time.
User blocks are created in a programming device and are downloaded from
there into the CPU.
• System Blocks: System blocks include System Function Blocks (SFB),
System Functions (SFC) as well as the System Data Blocks (SDB).
SFBs and SFCs are used to solve frequently required PLC standard tasks.
They are integrated in the CPU‘s operating system.
SDBs contain parameter assignment data that are evaluated exclusively by
the CPU. SDBs are not created or written by the user program, but by tools
such as HW-CONFIG or NETPRO.
SDBs are created by these tools during saving of the parameter
assignment data - invisible to the user - and downloaded into the CPU.
Downloading is only possible in the STOP mode.
FBx DBy
...
stat Guard FBa
stat Punch FBc Status
z Declaration data
within FBs CALL FBx, DBy of guard
CALL #Guard Guard
(Multi-instances)
Punch
What is an The concept of instantiating function blocks has great importance and makes up
Instance? the essential distinctive criterion to the FCs. The setting up of variables within a
high level language such as "C" under declaration of variable name and data
type in the declaration is called "instantiate" or "instance forming".
Just like variables, function blocks are also "instantiated". Only through this
‘own’ data area, in which the block parameter values as well as the static
variables are stored, does an FB become an executable unit (FB-instance).
The control of a physical process unit, such as a drive or a boiler then takes
place with the help of an FB instance, that is, a function block with an assigned
data area. The relevant data for this process unit are then stored in this data
area.
Instantiating You can create an FB instance, that is, the assignment of its own memory area
in an FB call, in two ways in STEP 7:
• through the explicit declaration of an instance data block when a function
block is called.
• through the explicit declaration of instances of a function block within a
higher-level function block (multiple instance model).
STEP 7 then makes sure that the data area required for the instance is set
up within the data area of the higher-level FB.
FB4 DB10
FB10
... Control
Such as OB1 logic Data
stat Guard FB4
for a for guard
stat Punch FB5
stat Conv. FB2 guard
.
FB5
CALL FB10,DB10
CALL Guard Control Data
.
. logic for punch
for a
CALL Punch punch
.
CALL Conv. Data
FB2
for
Control conveyor
logic
The figure shows a possible technological for a
structure when only a press and a conveyor Instance DB of FB10
conveyor exist.
Multiple Instance In addition to instantiation of function blocks, when you specify an instance
Model DB in an FB call, STEP 7 also supports the explicit declaration of FB instances
within a higher-level function block.
For this purpose, instances of the called function blocks are declared with data
type FB4, FB5 or FB2 using symbolic identifiers (Guard, Punch and Conveyor).
This takes place in the declaration section of the calling FB 10 function block in
the "static variable" section, as illustrated above. Within the higher-level function
block, the individual instances are then called using their symbolic identifier. The
higher-level FB10 function block must, however, be called with its own instance
DB (DB10).
In the creation of the higher-level instance DB, STEP 7 makes sure that the data
areas required for the individual instances are set up in the data area of the
higher-level FB10.
In the call of the individual instances using the symbolic names, the CALL macro
makes sure that the AR2 register is set to the beginning of the data area
assigned to the instance so that the parameters and local variables of the
instance are also accessed during the processing of the called function block.
Benefits The use of the multiple instance model has the following benefits:
• The individual instances do not require their own data block every time.
Within a call hierarchy of function blocks, only one instance DB is used in
the call of the "outer" function block.
• The multiple instance model "welds" a function block and an instance data
area into one object (FB instance), that can also be handled as one unit. The
programming person does not have to take care of the management
(creation, addressing) of the individual instance data areas. He must simply
provide an instance DB for the "outer" FB.
• The multiple instance model supports an object-oriented programming style.
Note:
z Instance data can also be accessed from "outside" of the instance FB.
For example, in OB1: L "Pressline".Press_2.Punch.<Varname>
Benefits of the With the multiple instance model you can store the respective data sections of
Multiple Instance several instances of one and the same call hierarchy in one single DB.
Model That way only one DB is required for several instances.
With the multiple instance model no measures for the administration of local FB
data are necessary except for the assignment of a mutual instance DB.
The multiple instance model supports the concept of object-oriented
programming. Code and data that are needed for the controlling of process units
are summed up in FBs.
If a process unit consists of hierarchical sub units then exactly this structure can
be reflected in the user program by means of the multiple instance model.
The control program can be designed with FB instances the same way as the
machine may consist of components.
STEP7 supports a nesting depth of eight with the multiple instance model.
Prerequisites for To use an FB as a multiple instance without problems, you must adhere to the
Multiple Instances following:
• For the purpose of process control, no direct access to global addresses of
the CPU (such as inputs and outputs) is allowed. Each access to global
inputs and outputs violates the re-usability.
• Communication with the process or with other program sections (FBs)
must be done only using FB parameters.
Only after integration of the FB into a higher-level unit, is the "assignment" of
the FB through the parameter list carried out with the FB call.
• In its own static variables, the FB must "remember" states or other
information about the unit.
Raw "L_Bay3"
"T_Bay3" "T_Bay-LB"
Material "L_Bay2"
"T_Bay2" "L_Bay-LB"
"L_Bay1"
"T_Bay1"
How the Production The production line consists of the processing stations 1 to 3, a main station
Line Works and a conveyor belt. Raw material that is placed on the light barrier of the main
station is processed at the stations in the sequence 3-2-1 (in other words, from
right to left). It is then returned to the main station as a completed part.
Operating Modes • You switch the system on (simulator output Q 4.1) through the simulator
input I 0.0. It is switched off through the N.C. simulator pushbutton I 0.1.
• You can preselect the MANUAL mode (simulator output Q4.2) through the
simulator switch I 0.4 ( = ´0´) and the AUTO mode (simulator output Q4.3)
through the simulator switch I 0.4 ( = ´1´).
• The operating mode that is preselected through the simulator switch I 0.4 is
accepted or switched on through the simulator pushbutton I 0.5.
• When you change the operating mode selection (I 0.4) or switch off the
system (Q 4.1), the operating modes are switched off.
MANUAL Mode In the MANUAL mode (Q 4.2 = 1), you can have the conveyor motor jog to the
right using the simulator pushbutton I 0.2 or to the left using I 0.3.
AUTOMATIC Mode After raw material has been loaded onto the conveyor (at LB) at the main
station and the pushbutton "T_Bay-LB" has been pressed, movement to Station
3 begins. When the raw material arrives at Station 3, the station‘s LED begins to
flash to signal the operator that processing has begun. When processing of the
part is finished at Station 3, the operator acknowledges the completion by
pressing the station‘s pushbutton, "T_Bay3". This starts the movement to
Station 2. Processing at Station 2 and then Station 1 works the same as in
Station 3. After completion at Station 1 has been acknowledged, the finished
part is transported back to the main station for unloading. The flashing LED here
indicates that the completed part can be removed. When the part has been
removed from the light barrier, the LED switches to a steady light thus signaling
that a new piece of raw material can be placed on the conveyor.
out Parameters Sta_ready BOOL Station is enabled and ready for part processing
(is in initial state)
Stop_busy BOOL Request conveyor stop / part is being processed
(only when station activated and proximity sensor
detects part)
Transp_Ready BOOL Request transport / part processing complete
"DB_Belt" "DB_Main_Station"
"FB_Belt" "FB_Main_Station"
Manual_Mode
1 Auto_Mode Enable
Jog_Right 1 Photo_Eye
Jog_Left Pushbutton
Conv_Belt Indicator_Light
Auto_Start_left
Left
Line_Ready 1
Initial Situation The slide above shows the initial situation for processing raw materials:
On the simulator (PLCSIM), the AUTO mode is activated resulting in a 1-signal at
the #Enable inputs of the stations and at the #Auto_Mode input of the "FB_Belt".
As well, in this first program version, all processing stations are simultaneously
switched active through their input #Sta_Activate.
Through the parameter #Sta_Avail, the stations signal their availability (no
operation in progress and proximity switch empty) to the #Line_Ready parameter
of "FB_Main_Station". All stations‘ indication lights signal their availability with a
steady light.
Production Process When raw material is placed on the light barrier of the main station #Photo_Eye,
the flashing #Indicator_Light signals that processing may be started. After pressing
the start #Pushbutton, "FB_Main_Station" requests transport to the left using
#Transp_Req to #Move_Left_Auto of "FB_Belt".
As soon as the raw material reaches the first activated station - and since all
stations are already activated, this is Station 3 (#Prox_Sw) because of the physical
design of the conveyor model - Station 3 requests "FB_Belt" (#Auto_Stop) to stop
the conveyor motor using #Stop_Busy. Simultaneously, the station begins to
process the raw material, which is indicated by a flashing #Indicator_Light. When
the operator acknowledges processing of the raw material using #Pushbutton,
"FB_Station" signals the end of processing using #Transp_Ready and thus
requests "FB_Belt" (#Move_Left_Auto) to transport the finished part to the next
Documentation of the station. Since the #Transp_Ready of the station is connected to #Move_Left_Auto
Production Process of "FB_Belt", the raw material automatically reaches Station 2, which is already
activated, with the next transport.
The production process at station 2 and then 1 works the same as at station 3.
After the completed part has reached the main station, the main station requests
"FB_Belt" to stop the conveyor motor using #Transp_Stop. As well,
#Indicator_Light signals the operator with a flashing light that the part can be
removed from the belt. After the part has been removed, the production line is
once again in the initial situation and new raw material can be processed.
Task First of all, you are to create your own exercise project with the name "My_Project".
Then, copy the S7 program "C2_E1_Start" from the "PRO3_Par" project that is
given into your own project on the CPU of your hardware station.
Become familiar with the previously described initial program for the production line
by checking the described functions.
Notes At this stage, the "FB_Sequence" (FB30) block is not yet integrated into the entire
program and therefore does not fulfill any function as yet. It still has to be
commissioned by you in the following exercise.
In addition to the initial program for the production line, the project "PRO3_Sol" also
contains other S7 programs that contain the sample solutions for the following
configuration exercises.
You can use the sample solutions as help in solving the following configuration
exercises, among other things.
Left
Right
The Function The station sequence 3->2->1 for the processing of parts in the production
Up Until Now line is defined by the program.
Task The station or work sequence in which a raw material is processed in the
production line is to be freely definable for each raw material using
"IW_BCD_Sequence" (BCD thumbwheel IW2 on the simulator). Each piece must
be processed exactly once at every station. This makes exactly 6 different
processing sequences possible (see slide).
The new FB to make the processing sequence flexible must activate the stations
individually according to a predefined sequence because – up until now – when
all stations were activated simultaneously at the beginning of part processing,
Station 3 was always the first processing station.
As well, "FB_Sequence" must now give "FB_Belt" the request for transport left or
right instead of the Station FBs. This is because the "FB_Station" does not
evaluate the predefined work sequence and thus cannot decide whether it is to
request a transport to the left or the right from "FB_Belt". The stations themselves
continue to request the conveyor to stop as soon as they are activated and a
production part reaches the appropriate proximity switch.
Re-usability The newly created "FB_Sequence" (FB 30) function block is to be re-usable.
That is, only local (temp or stat) variables and parameters may be used inside the
FB – no global addresses such as inputs, outputs or bit memories – .
#First_Sta_Activate
#Second_Sta_Activate
#Work_Sequence_132 = true #Third_Sta_Activate
#Go_To_Unload
#Second_Sta_Activate #First_Sta_Activate
#Work_Sequence_213 = true #Third_Sta_Activate #Go_To_Unload
#First_Sta_Activate
#Second_Sta_Activate
#Work_Sequence_231 = true #Third_Sta_Activate
Steps
#Go_To_Unload
#Second_Sta_Activate #First_Sta_Activate
#Work_Sequence_312 = true #Third_Sta_Activate #Go_To_Unload
Sequential The slide shows that the production line part processing follows a strict step
Control System sequence and that it can be divided into steps that are always carried out in the
same sequence.
Steps In the first step (#First_Sta_Activate) the station is always activated - according to
the specified #Work_Sequence - where part processing begins (for example, this
would be Station 2 when #Work_Sequence 2 - 3 - 1 is specified) and transport to
the station is started.
Processing advances to the next step as soon as the station signals the end of
processing or requests a transport.
In the following step (#Second_Sta_Activate) the next station is always activated -
according to the specified #Work_Sequence - (for example, this would be Station 3
when #Work_Sequence 2 - 3 - 1 is specified) and transport to the station is started,
etc.
Actions In every step, actions must be carried out such that a station must be activated and
a transport to the left or right has to be initiated.
The table (at the bottom of the slide) shows, for each #Work_Sequence, in which
step a transport to the left or the right has to be initiated.
T5
S0 Initialization
#Initial_Step
#Main_Station_Transp_Req T1
S1 N #Sta_X_Activate
#First_Sta_Activate
L #Transp_Req_L / R
#Sta_X_Transp_Req T2
S2 N #Sta_Y_Activate
#Second_Sta_Activate
L #Transp_Req_L / R
#Sta_Y_Transp_Req T3
S3 N #Sta_Z_Activate
#Third_Sta_Activate L #Transp_Req_L / R
#Sta_Z_Transp_Req T4
S4
L #Transp_Req_R
#Go_To_Unload
#Main_Station_Transp_Stop T5
S0
Steps The production process is divided into a time-ordered sequence of steps. In the
sequencer program, a step variable of the BOOL data type is declared within the
program for every physical step. That way, every step variable represents a
phase of part processing. In "FB_Sequence" these step variables are named
#Initial_Step, #First_/#Second_/#Third_Sta_Activate, and #Go_To_Unload.
In our example of part processing, the step sequence is strictly linear so that at
any particular time only one step can be active.
In more complex production processes, parallel branches, jumps, and loops are
also possible so that several step variables can also be set simultaneously.
Initial Step The initial step defines the starting point of the sequencer. With #Reset = 1, the
initial step is first of all set without querying for additional conditions.
When the initial step is activated, all other step variables are deactivated or
reset. That is, the sequencer is initialized (action of the initial step). The active
initial step thus supplies the information that no other step is active.
Note You will find the sequencer program in the FBD language at the end of the
chapter.
"FB_Sequence"
Station_1_Transp_Req
First_Sta_Transp
Station_2_Transp_Req
Second_Sta_Transp
Station_3_Transp_Req
Third_Sta_Transp
Transp_Req_R
Transp_Req_L
Sequencer
First_Sta_Activate
Sta_1_Activate
Second_Sta_Activate
Sta_2_Activate
Third_Sta_Activate
Sta_3_Activate
Static In addition to the IN and OUT parameters, the declaration of the following static
Variables (BOOL) variables makes sense:
#Work_Sequence_123 Operation sequence or station sequence 1-2-3
#Work_Sequence_132 Operation sequence or station sequence 1-3-2
#Work_Sequence_213 Operation sequence or station sequence 2-1-3
#Work_Sequence_231 Operation sequence or station sequence 2-3-1
#Work_Sequence_312 Operation sequence or station sequence 3-1-2
#Work_Sequence_321 Operation sequence or station sequence 3-2-1
#First_Sta_Transp Transport request of first station
#Second_Sta_Transp Transport request of second station
#Third_Sta_Transp Transport request of third station
Assignment of The internal static variables are used to "sort" FB input parameters and FB output
Static Variables parameters. Depending on the operation sequence passed, the FB input
parameters #Sta_1/_2/_3_Transp_Req are assigned to the internal, static variables
#First_/Second_/Third_Sta_Transp (transitions), and the internal static variables
(steps) #First_/#Second_/#Third_Sta_Activate are assigned to the FB output
parameters #Sta_1/_2/_3_Activate (actions). Even the control of the FB outputs
#Transp_Req_L/R (actions) depends on the #Work_Sequence passed and must be
implemented with the appropriate logic.
The slide shows an example of how the "sorting" for the operation sequence 2 - 3 -
1 is to be made. The checking of the specified #Work_Sequence can be
programmed using comparison. Their results can be assigned to the static variables
#Work_Sequence_XYZ (BOOL) and be further gated.
In the program section "Sequencer", in which the already "sorted" static variables
are exclusively gated, only one single step series has to be programmed.
Note
When a station requests transport using Station_x_Transp_Req, it is also a signal that it has
completed its part processing.
Task The "FB_Sequence" (FB30) block already exists and all you have to do is
integrate it in the complete program.
What to Do 1. Integrate the FB30 in the complete program. For this, declare temporary
variables in OB 1 to interconnect the FB 30 with the other blocks (see slide).
2. Give the Instance DB 30 the symbolic name "DB_Sequence".
3. Check the functioning of the newly integrated FB 30 by entering various
processing sequences on the BCD thumbwheel "IW_BCD-Sequence" (IW2)
on the simulator (see slide).
Test Follow the control of the processing sequence by monitoring the program
sections of the "sequencer" within FB30 with the test function "Monitor Block".
Example: Pressline
FB: "Pressline"
FB: #Press_1
Press_1 Press_2
FB: #Punch
FB: #Guard
Punch
Guard
FB: #Press_2
FB: #Punch
FB: #Guard
Transport
FB: #Transport
Machine Structure
Logical division of the
program with the help of
FB instances
Process Units Process units are physical objects in the process, such as units of a production
line (transport belt, processing stations) or a complete machine or parts of a
machine (such as the complete press or the punch or the guard of a press).
Process units are used as logical identification criteria. They are, as a rule, of a
hierarchical design. In this way, process units can contain sub-units (for
example, the unit "Press" contains the units "Punch" and "Guard") and may be
configured from smaller sub-units (aggregation).
Object-oriented You can implement an object-oriented programming style with the help of
Programming Style function blocks. The function of a process unit or process sub-unit program is
handled within an FB instance. The division of the user program into units is
achieved by declaring lower-level FB instances within a higher-level FB.
In this way, the same division into process units is achieved in the user program
as in the existing system or machine. This is the concept of object-oriented
programming using aggregation.
Multiple Instance When a multiple instance model is used, the instance DB contains the data for
Model several function blocks of a call hierarchy. The instances of the called function
blocks are declared using symbolic identifiers in the static variable section of
the declaration section of the calling FB.
The FB instance for the highest-level process unit (in this example, FB10
"Pressline") must be called absolutely or symbolically, along with the
specification of its own instance DB (DB10 here).
Declarations In the static variable section of the declaration part of FB10 ("Pressline"), two
instances (variables) of the data type FB1 ("Press") with the names #Press_1
and #Press_2 are declared, as well as an instance of the data type FB2
("Transport") with the name #Transport.
In the declaration part of FB1 both an instance of FB4 ("Punch") with the name
#Punch and an instance of FB5 ("Guard") with the name #Guard are declared.
In the instruction section of FB1 ("Press"), the respective FB instances are then
called using the symbolic names #Punch and #Guard that were declared in the
declaration section.
Note The declaration of an instance in the declaration part of a function block works
only if the FB being used in the declaration already exists.
When designing such a call hierarchy, you must first create those FBs that are
to be called last in the chain.
Multiple Instance DB The multiple instance DB has the same structure as the declaration parts of the
function blocks concerned. If an instance is called in the instruction section, then
it automatically accesses the data in the corresponding section of the instance
DB (see DB10 above).
Main
Conveyor (Load/Unload)
Control Station 1 Station 2 Station 3 Station
Multi - Instances
Left
Right
T_Bay-LB
The Function When a piece reaches an activated station, "FB_Station" (FB 3) initiates
Up Until Now "FB_Belt" (FB 4) to stop the conveyor motor and begin processing the part.
Processing is indicated by a flashing station LED and is acknowledged or ended
by the operator by pressing the station‘s pushbutton.
Then "FB_Station" signals the end of processing using the parameter
#Transp_Ready and simultaneously signals a request for transport to
"FB_Sequence".
Task The three processing stations are to process the part automatically so that a
processing acknowledgement by the operator is no longer necessary.
A #Proc_Time (format Time) is passed to "FB_Station" for this. After this
processing time has run out, "FB_Station" is to signal the end of processing
and/or request transport using the above mentioned parameters.
The "FB_Station" (FB 3) function block that is to be changed is to continue to be
re-usable. That is, the processing time must be implemented inside the FB using
an instance or a static variable of the system function block type (SFB 4,
symbolic name "TON", on-delay timer).
Note If instances of existing FBs or SFBS are called in a function block, then the
instance data required for these are found in the instance data block (multiple
instance) of the calling FB. No additional instance data blocks have to be
created for the called instances (FBs or SFBs). That is, the call is made without
specifying an instance DB.
Main
Conveyor Production Line (Load/Unload)
Control Station
"F B _ L I n e"
"FB_Belt" #Station_1 #Station_2 #Station_3 "FB_Main_Station"
Left
Right
#TON_Delay #TON_Delay #TON_Delay
_Proc. _Proc. _Proc.
TON TON TON L_Bay-LB
T_Bay-LB
Task Since the Stations 1 to 3 physically represent one production line entity in which
parts can be processed in any operation sequence, the functionality of the
production line is now to be summarized within the program in one function
block (FB 31).
Just as in the last exercise where an instance or a static variable of the type
SFB 4 ("TON") was declared in "FB_Station" (FB 3), you must now create an
"FB_Line" (FB 31) and in it declare the instances or static variables #Station_1,
#Station_2, #Station_3 of the type FB 3 and the static variable #Sequence of the
type FB 30.
In OB1 it is then no longer necessary to call the FB 3 once for every station and
FB 30 for controlling the sequence. Instead, "FB_Line" (FB 31) only has to be
called once. It controls the functioning of the production line. Accordingly, the
instance data blocks of the stations and the control of the sequence (DB 30 - DB
33) are also no longer required. Instead, only one multiple instance DB will be
used.
The resulting "FB_Line" (FB 31) thus represents the functionality and the
(multiple) instance DB represents the states of the production line (without the
feed station and without the conveyor control).
Re-usability The new "FB_Line" (FB 31) function block is to be re-usable. That is, no
absolute addresses may be directly used inside the FB - not even to supply
blocks called internally with actual parameters (SFC, SFB, FC, FB).
This makes it necessary to declare input parameters and output parameters in
FB 31 for all the input and output parameters of the three stations as well as the
control of the sequence (see the prevailing calls in OB 1: three calls of FB 3 for
the stations 1 to 3 and one call of FB 30 for the control of the sequence). These
input and output parameters of the higher-level FB 31 then have to be internally
interconnected with the input and output parameters of the called instances
(FBs).
Note The following pages contain either further information or are for reference to
complete a topic.
For more indepth study we offer advanced courses and self-learning mediums.
T5
S0 Initialization
#Initial_Step
#Main_Station_Transp_Req T1
S1 N #Sta_X_Activate
#First_Sta_Activate
L #Transp_Req_L / R
#Sta_X_Transp_Req T2
S2 N #Sta_Y_Activate
#Second_Sta_Activate
L #Transp_Req_L / R
#Sta_Y_Transp_Req T3
S3 N #Sta_Z_Activate
#Third_Sta_Activate L #Transp_Req_L / R
#Sta_Z_Transp_Req T4
S4
L #Transp_Req_R
#Go_To_Unload
#Main_Station_Transp_Stop T5
S0
Steps The production process is divided into a time-ordered sequence of steps. In the
sequencer program, a step variable of the BOOL data type is declared within the
program for every physical step. That way, every step variable represents a
phase of part processing. In "FB_Sequence" these step variables are named
#Initial_Step, #First_/#Second_/#Third_Sta_Activate, and #Go_To_Unload.
In our example of part processing, the step sequence is strictly linear so that at
any particular time only one step can be active.
In more complex production processes, parallel branches, jumps, and loops are
also possible so that several step variables can also be set simultaneously.
Initial Step The initial step defines the starting point of the sequencer. With #Reset = 1, the
initial step is first of all set without querying for additional conditions.
When the initial step is activated, all other step variables are deactivated or
reset. That is, the sequencer is initialized (action of the initial step). The active
initial step thus supplies the information that no other step is active.
S1
#First_Sta_Activate
#First_Sta_Transp_Req T2
S2 N #Sta_Y_Activate
#Second_Sta_Activate L #Transp_Req_L / R
#Second_Sta #Transp
_Activate _Req_L/R
S (other conditions)
Transitions Transitions are step-enabling conditions in which the transition from one step to
the next takes place. Step-enabling conditions can be process signals (for
example, signals from sensors, limit switches etc.) and/or they can result from
logical relationships.
In our example, the step-enabling conditions result from the signals of other FBs
that are passed to the "FB_Sequence" using the IN parameter
(#Stations_Ready, #Main_Sta_Transp_Req, #Main_Sta_Transp_Stop, #Stat_1/
2 / 3_Transp_Req). In the slide, the step-enabling conditions
#First/Second/Third_Sta_Transp_Req are given instead of the
Stat_1/_2/_3_Transp_Req since the sequence of the step-enabling conditions
depends on the operation sequence specified.
Sequencer In the Sequencer program section, the step variables are managed and the user
determines the sequence of the production process. As a rule, a separate
network is created for every step variable.
A step variable is set when the previous step is active AND the transition
associated with this step is fulfilled. At the same time, the previous step is reset
under the same conditions. The querying of the two conditions Previous Step
AND Transition prevents the unwanted activation of a step at the wrong time.
The Sequencer program section is responsible exclusively for the setting and
resetting of step variables, not for the control of process actuators or the
execution of actions.
Command Output In the Command Output program section, the user determines what is to happen
in which step. One or more actions are assigned to each step. The actions can
be given the following properties:
D = delayed (time-delayed after activating the step)
N = not stored (the action is only executed as long as the step remains active)
L = limited (limited to a specific time period even if step is active longer)
#First_Sta
_Activate #First_Sta
_Activate
R
S
#Second_Sta
_Activate
R
#Go_To_Unload R
#Go_To_Unload
S
Significance of the With the initial step, the starting point of the sequencer is defined in the program
Initial Step - in other words, the "step" before Step 1" (here #First_Sta_Activate)
In our example, the parameter #Main_Sta_Transp_Stop corresponds to the
transition to the initial step. This parameter is passed the state ´1´, when a
completed part has been returned to the main station (signal from
"FB_Main_Station").
When the initial step is set, the sequencer is initialized in the program. That is all
other step bits are reset. The active initial step thus supplies the information that
no other step is active, which is an essential condition for the activation of the
first "real" step. The query #initial_step AND #Main_Sta_Transp_Req thus
supplies the exact condition for setting the first "real" step #First_Sta_Activate.
Last Step The last step (#Go_To_Unload) is set when the next to the last step
(#Third_Sta_Activate) is active AND the transition (#Third_Sta_Transp) is
fulfilled.
The last step is reset when the initial step is set with the appropriate transition
(#Main_Sta_Transp_Stop) (see slide, Initial Step)
"FB_Sequence"
Station_1_Transp_Req
First_Sta_Transp
Station_2_Transp_Req
Second_Sta_Transp
Station_3_Transp_Req
Third_Sta_Transp
Transp_Req_R
Transp_Req_L
Sequencer
First_Sta_Activate
Sta_1_Activate
Second_Sta_Activate
Sta_2_Activate
Third_Sta_Activate
Sta_3_Activate
Static In addition to the IN and OUT parameters, the declaration of the following static
Variables (BOOL) variables makes sense:
#Work_Sequence_123 Operation sequence or station sequence 1-2-3
#Work_Sequence_132 Operation sequence or station sequence 1-3-2
#Work_Sequence_213 Operation sequence or station sequence 2-1-3
#Work_Sequence_231 Operation sequence or station sequence 2-3-1
#Work_Sequence_312 Operation sequence or station sequence 3-1-2
#Work_Sequence_321 Operation sequence or station sequence 3-2-1
#First_Sta_Transp Transport request of first station
#Second_Sta_Transp Transport request of second station
#Third_Sta_Transp Transport request of third station
Assignment of The internal static variables are used to "sort" FB input parameters and FB output
Static Variables parameters. Depending on the operation sequence passed, the FB input
parameters #Sta_1/_2/_3_Transp_Req are assigned to the internal, static variables
#First_/Second_/Third_Sta_Transp (transitions), and the internal static variables
(steps) #First_/#Second_/#Third_Sta_Activate are assigned to the FB output
parameters #Sta_1/_2/_3_Activate (actions). Even the control of the FB outputs
#Transp_Req_L/R (actions) depends on the #Work_Sequence passed and must be
implemented with the appropriate logic.
The slide shows an example of how the "sorting" for the operation sequence 2 - 3 -
1 is to be made. The checking of the specified #Work_Sequence can be
programmed using comparison. Their results can be assigned to the static variables
#Work_Sequence_XYZ (BOOL) and be further gated.
In the program section "Sequencer", in which the already "sorted" static variables
are exclusively gated, only one single step series has to be programmed.
Note
When a station requests transport using Station_x_Transp_Req, it is also a signal that it has
completed its part processing.