STEP 7 Getting Started
A5E00171228-01
10-1
10 Programming a Multiple Instance
10.1 Creating and Opening a Higher-Level Function Block
In Chapter 5 you created a program for controlling an engine with the function
block "Engine" (FB1). When the function block FB1 was called in the organization
block OB1, it used the data blocks "Petrol" (DB1) and "Diesel" (DB2). Each data
block contained the different data for the engines (for example, #Setpoint_Speed).
Now imagine that you require other programs to control the engine for your
automation task; for example, a control program for a rapeseed oil engine, or a
hydrogen engine, etc.
Following the procedure you have learned so far, you would now use FB1 for each
additional engine control program and assign a new data block each time with the
data for this engine; for example, FB1 with DB3 to control the rapeseed oil engine,
FB1 with DB4 for the hydrogen engine, etc. The number of blocks would increase
significantly as you created new engine control programs.
By working with multiple instances, on the other hand, you can reduce the number
of blocks. To do this, you create a new, higher-level function block (in our example,
FB10), and call the unchanged FB1 in it as a "local instance." For each call, the
subordinate FB1 stores its data in data block DB10 of the higher-level FB10. This
means that you do not have to assign any data blocks to FB1. All the function
blocks refer back to a single data block (here DB10).
You should already be familiar with programming in Ladder Logic, Function Block
Diagram, or Statement List (see Chapters 4 and 5) and also symbolic
programming (see Chapter 3).
The data blocks DB1 and DB2 are integrated in DB10. To do
this, you must declare FB1 in the static local data of FB10.
OB1
CALL FB10, DB10
FB10
CALL FB1 (for petrol engine)
CALL FB1 (for diesel engine)
. . .
DB10
"Petrol engine" data
"Diesel engine" data
FB1
"Engine"
FB1
"Engine"
Содержание SIMATIC STEP 7 V5.2
Страница 4: ...Welcome to STEP 7 STEP 7 Getting Started iv A5E00171228 01 ...
Страница 12: ...Introduction to STEP 7 1 6 STEP 7 Getting Started A5E00171228 01 ...
Страница 22: ...Programming with Symbols 3 4 STEP 7 Getting Started A5E00171228 01 ...
Страница 60: ...Creating a Program with Function Blocks and Data Blocks 5 24 STEP 7 Getting Started A5E00171228 01 ...
Страница 76: ...Downloading and Debugging the Program 7 14 STEP 7 Getting Started A5E00171228 01 ...
Страница 88: ...Programming a Shared Data Block 9 4 STEP 7 Getting Started A5E00171228 01 ...
Страница 100: ...Programming a Multiple Instance 10 12 STEP 7 Getting Started A5E00171228 01 ...
Страница 110: ...Appendix A STEP 7 Getting Started A 2 A5E00171228 01 ...