Programming A Multiple Instance - Siemens SIMATIC STEP 7 V5.2 Getting Started

Table of Contents

Advertisement

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).
OB1
CALL FB10, 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).
STEP 7 Getting Started
A5E00171228-01
The data blocks DB1 and DB2 are integrated in DB10. To do
this, you must declare FB1 in the static local data of FB10.
FB10
CALL FB1 (for petrol engine)
CALL FB1 (for diesel engine)
. . .
FB1
"Engine"
FB1
"Engine"
DB10
"Petrol engine" data
"Diesel engine" data
10-1

Advertisement

Table of Contents
loading

Table of Contents