How do you process the data from the temporary variables of an organization block in order to determine the cycle time of OB1, for example?
The OBs have a fixed basic set of variables in which the system enters start data of the block and information about causes of errors / error points. As user you can evaluate this data and respond to it in various ways. By declaration the tags are "temporary variables", which means that they can be accessed only in the block in which they are declared. You can add your own self-defined entries to the basic set of temporary variables.
For example, you can determine the cycle time with the temporary variables of OB1. Various local data words are queried in this process. The parameters are already stored in the declaration part of OB1. The table below describes an example of how to determine the cycle time.
|Establish time of previous cycle||L
|Local data word 6|
|Specify minimum cycle time||L
|Local data word 8|
|Output longest cycle time||L
|Local data word 10|
You can change the variable names in the declaration part of the OB without the content being changed. To ensure faster processing and improve your understanding of the program you should always process the data of the declaration part of an OB "always" symbolically as follows:
- In the instruction part you enter the command with which you wish to process the variable.
- Enter the name of the variable. You can do this without the " # " character at the beginning if the name doesn't correspond to a reserved code word (e.g. OB1_Variable1) and is also not used in the symbol table. Otherwise enter a " # " character in front of the variable name in the instruction part.
Fig. 01 shows an example of querying the cycle time with changed temporary variables from Table 01. All the times are integer values and the values read out are local variables of OB1.
- In you change the name of the variable in the declaration part, then the name changes in the instruction part are changed automatically by the system.
- A list of reserved code words is available under the menu command Help > Help Topics, index entry "Reserved Code Words".
Another way of determining the cycle time is via the menu "PLC > Diagnostics/Setting > Module status..." in the SIMATIC Manager. The measured and parameterized cycle times are displayed in the "Scan Cycle Time" tab.