Project structure
This section describes how to create a project structure, as shown in the following illustration.
Initialization of the project structure begins in the MAIN program of the automation station.
The first step is to determine how many levels are to be mapped in the project.
The project structure is not only used to organize a project, but also to process a BAS (user address key).
The levels of the project structure are therefore described with the initialization of the function block FB_BA_CarelessDPAD.
The function block is called in the MAIN program of the automation station. A more detailed description of BAS processing can be found in the chapter DPAD.
The graphics in this description refer to the standard TF8040 PLC.
The building, floor, technical systems, plant, aggregate and function levels are generated within the sample PLC.
The initialization of the project structure (PS) is started in MAIN. A level within the project structure is represented by a folder. A folder is created by an instance of the function block FB_BA_View.
There may be further subfolders or objects within a folder. Objects are created using the function blocks from the chapter Objects of the Tc3_XBA library.
The project structure is edited by creating and concatenating folders. The concatenation is done by assigning a parent to each folder within the FB_BA_View.
The parent is assigned by transferring the symbol name of the next higher FB_BA_View in the project structure to the variable iParent.
The sample shows that the levels Building to Trade are created in the MAIN program.
There are the trades Heat supply systems, Automation, General, Ventilation system and Room automation.
The parent of all trades is F01. This creates the five subfolders for the trades below the F01 floor folder.
One method of creating a level of the project structure is to call a FB_BA_View directly in the Main program.
In our sample, this is implemented with the Building and Floor levels.
In the function blocks for the trades Heat supply systems, Automation, General, Ventilation systems and Room automation, the folders are created by calling a function block, which also represents a folder.
However, these folders are created because the function blocks ACE, BAG, ACS, HTG and Rome all inherit from the function block FB_BA_View.
This is done with the EXTENDS operator.
Here is a sample of the function block Heating supply systems.
The function block FB_BA_Heating is a folder and at the same time an FB within which all plants of this trade, e.g. heating circuits, can be called.
This mechanism of creating folders by inheriting from FB_BA_View continues down to the deepest structures of the project structure.
In the case of heating circuit HTC01, which is called within FB HTG, the parent of the function block is the one in which HTC01 itself is called.
In this case, the parent of the heating circuit is initialized with the THIS^ operator.
This rule continues through to the heating circuit aggregates and the objects they contain.
Please note the following when creating the project structure:
- The concatenation of all folders and objects of the PS must be closed.
- All mechanisms of the base framework will not work otherwise!
- All function blocks that map a folder within the project structure and in turn call function blocks from sublevels must inherit from FB_BA_View.
- The FB_BA_View must be called with the Super^ operator at the beginning of the function block.
- The execution order in the CFC must be observed.
- All function blocks whose parent is the function block within which it is called must receive the parameter THIS^ as parent.
- All function blocks from the template Repository with parameters must be called within the declaration area of VAR_INPUT_CONSTANT.