Industry Online Support
Technical Forum
4/16/2012 2:26 PM | |
Joined: 9/27/2006 Last visit: 4/28/2024 Posts: 12257 Rating: (2665)
|
Hello boaz; To create a multi-instance datablock for an FB, the instanceFBs you call inside the new FB must have declarations of static varaibles. To understand this, have a look at the example in chapter 10 of the manual "Working with Step 7", called "Programming Multiple Instances": Working with Step 7: http://support.automation.siemens.com/WW/view/en/45531551 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)... To call FB1 as a "local instance" of FB10, in the variable detail view a static variable must be declared with a different name for each planned call of FB1. Here, the data type is FB1 ("Engine"). Hope this helps, Daniel Chartier |
Last edited by: dchartier at: 4/16/2012 2:27 PMLast edited by: dchartier at: 4/16/2012 2:27 PM |
|
This contribution was helpful to1 thankful Users |
Follow us on