×
Siemens Industry Online Support
Siemens AG
Тип сообщения: Часто задаваемые вопросы ID сообщения: 87668055, Дата сообщения: 31.01.2020
(10)
Оценить

For S7-1200/S7-1500, how do you measure the runtime of the complete program, subprograms or specific organization blocks?

  • Сообщение
  • Относится к продукту(ам)
In STEP 7 (TIA Portal) you use the "RUNTIME" instruction to measure the runtime of the complete program, single blocks or command sequences. With the "RT_INFO" instruction you read out statistics on the runtime of specific organization blocks, communication or the user program.

Description
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 following examples show the calculation of the runtime.

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

Program
Using the "RUNTIME" instruction you measure the runtime of the program, single blocks or command sequences.
If you want to measure the program runtime of single blocks or command sequences, if possible, move your program code to an OB with a higher priority. In this way it will not be interrupted and therefore delayed by communication and other OBs.

Fig. 1 shows how to measure the runtime for a called program block in OB30 with priority 24:

  • 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 "TestBlock" 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 "TestBlock" program block and writes the result (seconds) to the DB variable "runtimeResult".

Fig. 1


Evaluation
To record the runtimes you create a trace with the variable "DB".runtimeResult. For sampling you select OB30.
Fig. 2 shows the recording of the variables. In this example, the runtime of the "TestBlock" program block is between 20.5 and 23 µs.

Note
For the runtime measurement you should disable the program status because it falsifies the measurement result.
To be able to display the current values in the status, the CPU recompiles the displayed program section.
Depending on what is displayed in the editor, the runtime of this subprogram is extended.


Fig. 2

Example 2:
Runtime measurement with the "RT_INFO" instruction for the S7-1500


Program
With the "RT_INFO" instruction you generate statistics on the runtime of specific organization blocks, communication or the user program. Via the "MODE" parameter you define which runtime you want to read out at the "INFO" output. In the following example (Fig. 3) the "RT_INFO" instruction is called for the output of different runtimes in OB1. In the data block, with the variable "obNr" you define the OB for which you want to measure runtimes. With the "mode" variable you select the runtime that you want to measure.

You can measure the following runtimes:

  • MODE = 1     Runtime of a specific OB
  • MODE = 2     Maximum runtime of a specific OB
  • MODE = 3     Minimum runtime of a specific OB
  • MODE = 23   Longest cycle time (OB number not relevant)
  • MODE = 24   Shortest cycle time (OB number not relevant)
  • MODE = 25   Current / last cycle time, or length of the last cycle (OB number not relevant)



Fig. 3 


Evaluation
To record the runtimes you create a trace with the variable "DB".runtimeResult. For sampling you select OB30.
Fig. 4 shows the recording of the variables. In this example, the runtime of the "TestBlock" program block is between 31 and 33 µs.

Note
For the runtime measurement you should disable the program status because it falsifies the measurement result.
To be able to display the current values in the status, the CPU recompiles the displayed program section.
Depending on what is displayed in the editor, the runtime of this subprogram is extended.


Fig. 4

Recommendation
The length of the runtime depends on the CPU used. If you need a short runtime, we recommend using a larger CPU.

The following table gives you an overview of the processing times for bit and word operations:
 

 CPU1511-1 PN
1511F-1 PN
1511T-1 PN 
1513-1 PN
1513F-1 PN 
1515-2 PN
1515F-2 PN
1515T-2 PN 
1516-3 PN/DP
1516F-3 PN/DP 
1517-3 PN/DP
1517F-3 PN/DP
1517T-3 PN/DP
1517TF-3 PN/DP
1518-4 PN/DP
1518F-4 PN/DP
1518-4PN/DP ODK
1518F-4PN/DP ODK 
Processing times
bit operations
 0.06 μs 0.04 μs 0.03 μs 0.01 μs 0.002 μs 0.001 μs
Processing times
word operations
 0.072 μs 0.048 μs 0.036 μs 0.012 μs 0.003 μs 0.002 μs

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


Creation Environment

The screens in this FAQ response were created with STEP 7 (TIA Portal) V15.1.

Указания по безопасности
Для обеспечения и дальнейшего поддержания кибер-безопасности технической инфраструктуры, систем, машин и сетей необходимо внедрить комплексную концепцию информационной безопасности, которая соответствует последним достижениям науки и техники. Продукты и решения Сименс являются всего лишь одним из компонентов такой концепции. Более подробную информацию о кибер-безопасности можно получить здесь
https://www.siemens.com/cybersecurity#Ouraspiration.
Оценить сообщение
без оценки
Вопросы и обратная связь
Что вы хотите сделать?
Примечание: отзыв всегда относится к текущей статье / текущему продукту. Ваше сообщение будет перенаправлено техническим редакторам службы онлайн-поддержки. В течение нескольких дней вы получите ответ, если ваш отзыв содержит вопрос. Если у нас не возникнут вопросы по вашему отзыву, мы не будем вас беспокоить.
Поддержка статистики
Данная функция позволяет выдавать идентификаторы (ID) результата поиска согласно желаемому количеству (формат .txt)

Генерировать список
Копировать URL
Отобразить эту страницу в новом дизайне
Панель управления mySupport