The project is hierarchically structured into several levels by means of structure blocks calling each other.
When a project is processed, a difference is made between classes and instances. Classes are generated during editing operations and contain preset values. Instances are formed when changing over to the Run mode and can be parameterized there.
The project only contains the structure blocks defined. Any function blocks called are stored in the libraries loaded. Linked projects and exported structure blocks permit the use of previously developed algorithms and functions.
The following section contains a more detailed description about the structuring of a project along levels, classes and instances as well as its relations to libraries.
You can get a general overview in our video "Classes and instances".
Video: Classes and instances
- Classes (00:40)
- Instances (01:00)
- Project tree (01:35)
- Run mode (02:28)
- Implement further calls (macro blocks) (05:00)
- Edit and understand macro blocks (05:40)
2 Project levels
A project can be subdivided in any number of hierarchic structures; however, it always comprises not less than two levels, i.e. its configuration and program blocks.
Configuration, program and macro blocks are summarized as structure blocks.
The top level of a project is the configuration (&Main). It facilitates graphic configuration of the target system tasks. The configuration is filled with the program blocks. By determining their priority and cycle time the task management parameters are defined. Connections between the program blocks facilitate the asynchronous data exchange via the target system memory. The number of program blocks is limited by the number of the parallel tasks in the target system (usually 15). A configuration without any program block would generate a program without any tasks and, hence, is of no use. Apart from program blocks, also blocks without any target function, such as parameter and visualization blocks, can be included in the configuration level.
Program blocks form the second level of the project where the functions called by tasks are defined by inserting the relevant blocks and their sequence is established. Parameter blocks determine local, i.e. instance-specific, values for operations. Programs are structured by using macro blocks. They make it easier to call functions which are used repeatedly. Program blocks are flagged with a $ symbol preceding its designation.
Macro blocks can be inserted into program blocks and other macro blocks. However, recursive calling is not permitted. Macro blocks contain sub functions of the programs and relating local parameters. They are no subprograms. During code generation they generate the complete target code for each call.
All project levels may contain visualization blocks (without target function). For exchanging data between project levels, the Input and Output blocks from the Standard Library are used. The Enable block from the same library is used for conditional processing operations of program and macro blocks.
Configuration, program and macro blocks are subsumed under the term of structure blocks.
3 Classes and instances
Program and macro blocks can be called several times within one project. To parameterize these calls in different ways, test.con uses the concept of instantiation. When changing to the Run mode, a new instance of the structure block is formed for each call. Although each instance possesses the same structure (blocks and connections), an individual set of local parameters can be assigned to it. These local instance parameters are defined in the blocks of the structural block and of subordinate levels.
During editing operations only preset values are entered in the parameter dialogs of the blocks. During the first change to run mode they are copied into instance parameters. Thereafter, the instance parameters can be modified in run mode. However, these modifications have no effect on the preset values in the structure block classes.
When changing back to Edit and modifying preset values there, the instance parameters remain unaffected. The instances of newly inserted structure blocks contain the preset values as instance parameters.
When structure blocks are extended by inserting new blocks, the instance parameters of the existing blocks remain unchanged. The newly inserted blocks are initialized based on the preset values.
To match parameters of several instances of one structure block, the Save Parameter and Load Parameter commands in the Structure Block Submenu can be used. The first command serves to write the instance parameters of all blocks contained in the structure block and of the subordinate levels into one file, whereas the second command is used for their read in.
Upon saving the parameters of one instance, subsequently changing to another one and loading the file, both instances exhibit identical parameter sets after this operation.
To facilitate easier differentiation between structure block instances, they can be assigned different names. The context menus for structure blocks in the Run mode contain the Instance Name command. Upon opening the dialog a designation may be entered which appears afterwards in the symbol of the structure block and in the project tree (following two colons).
Instance names are only indicated in the Run mode. An exception is the configuration where the instance name of the programs remains visible even during editing operations.
The configuration is the only structure block which is called only once in a project. The configuration instance can be accessed in both the Edit and the Run modes. The parameters under the configuration serve as global parameters for the other structure block instances.