×
Siemens Industry Online Support
Siemens AG
Entry type: FAQ, Entry ID: 245243, Entry date: 02/12/2007
(3)
Rate

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?

  • Entry
  • Associated product(s)

Instructions:
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.
 

Cycle time Commands   Query
Establish time of previous cycle L

T

#OB1_PREV_CYCLE

MW 0

Local data word 6
Specify minimum cycle time L

T

#OB1_MIN_CYCLE

MW 2

Local data word 8
Output longest cycle time L

T

#OB1_MAX_CYCLE

MW 4

Local data word 10
Table 01

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:

  1. In the instruction part you enter the command with which you wish to process the variable.
  2. 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.


Fig. 01

Notes:

  • 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.


Fig. 02

Security information
In order to protect plants, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art industrial security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about industrial security, please visit
http://www.siemens.com/industrialsecurity.