Siemens Industry Online Support
Siemens AG
Entry type: FAQ Entry ID: 87668055, Entry date: 03/10/2014

With S7-1200/S7-1500, how do you measure the total cycle time of an organization block?

  • Entry
  • Associated product(s)
In STEP 7 (TIA Portal), you measure the runtime for a program in an OB with the instructions "RUNTIME" and "RT_INFO".

The "RUNTIME" instruction is in the "Basic Instructions > Program Control Instructions" palette and the "RT_INFO" instruction is in the "Advanced Instructions > Diagnostics" palette. The examples below show the calculation of the runtime.

Example 1: Runtime measurement with the "RUNTIME" instruction for the S7-1200/S7-1500

Figure 1 shows you the calculation of the runtime for a called program block:

  • The first call of the "RUNTIME" instruction sets the starting point for the runtime measurement and saves this as a reference for the second call in the DB variable "Memory".
  • Then the "LoadModule" program block is called.
  • When the block has been processed, the "RUNTIME" instruction is called a second time. This second call calculates the runtime of the "LoadModule" program block and writes the result (seconds)to the DB variable "RunTimeResult".

Fig. 1

Example 2: Runtime measurement with the "RT_INFO" instruction for the S7-1500
With the "RT_INFO" instruction you generate statistics on the runtime of specific organization blocks of communication or of the user program. Via the "MODE" parameter you define which runtime you want to read out at the "INFO". In the example below (Fig. 2) the "RT_INFO" instruction for the output of four different runtimes called four times in one SCL program.

  • MODE:= 1 (runtime of a specific OB)
  • MODE:= 2 (maximum runtime of a specific OB)
  • MODE:= 3 (minimum runtime of a specific OB)
  • MODE:= 25 (current / last cycle time or duration of the last cycle)

Fig. 2

Evaluation of the cycle time with the temporary variables
Alternatively, with the S7-1500, you can also determine the cycle time via the temporary variables in the OB "Main" [OB1]. For this you have to change the block access beforehand in the Properties, because this method is not possible with optimized block access.

  1. Right-click the OB "Main" and in the pop-up menu you select "Properties...".
  2. Go to the "Attributes" tab and disable the "Optimized block access" attribute (remove check mark).
  3. Click OK and also confirm the next message with OK.

Now, as for STEP 7 V5.x, you have the temporary variables available for calculating the cycle time. You can determine the following cycle times with the temporary variables of the OB "Main".

  • PREV_CYCLE: Output the time of previous cycle.
  • MIN_CYCLE: Output the minimum cycle time.
  • MAX_CYCLE: Output the longest cycle time.

Fig. 3 shows you the calculation of the cycle time with the temporary variable "PREV_CYCLE".

Fig. 3

The parameters are already stored in the declaration part after the change of block access. You can also change the variable names in the declaration part of the OB without the content being changed.

Further Information
More information on runtime measurement is available in the manual under:

Creation Environment
The screens in this FAQ response were created with STEP 7 (TIA Portal) V14.

Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit
Support to the statistics
With this function the IDs found are listed according to number (format .txt).

Generate list
Copy URL
Display page in new design
mySupport Cockpit