Differentiating Gross and Net Cycle Times of Cyclic Interrupt OBs (OB30-OB38) in SIMATIC PCS 7

Differentiating Gross and Net Cycle Times of Cyclic Interrupt OBs (OB30-OB38) in SIMATIC PCS 7

In SIMATIC PCS 7, the distinction between Gross Cycle Time (Brutto-Laufzeit) and Net Cycle Time (Netto-Laufzeit) for cyclic interrupt organization blocks (OB30 through OB38, such as OB35 at 100ms) is measured inside the CPU kernel and reported via the @CPU_RT diagnostic block using system function SFC 78 (OB_RT). Gross Cycle Time represents the total elapsed wall-clock time from the initial start of the OB to its final completion, including all preemption periods when higher-priority tasks (e.g., OB82 diagnostic interrupts, OB40 hardware interrupts, or higher-priority cyclic OBs) interrupt its execution. Net Cycle Time measures the pure CPU processing time consumed strictly by the code inside that OB, mathematically excluding all interruptions. Comparing both values is vital for diagnosing task starvation vs code execution overload.

Table of Contents

Interrupt Priorities and Preemption in SIMATIC S7-400 Architecture

The operating system of SIMATIC S7-400 and AS 410-5H controllers executes programs according to a deterministic, preemptive priority structure. Organization Blocks are assigned distinct priority classes (ranging from Priority 1 for background OB1 up to Priority 28 for high-speed hardware interrupts).

Cyclic interrupt tasks OB30 to OB38 are typically assigned intermediate priorities (e.g., OB35 at 100ms default priority 12; OB32 at 20ms default priority 15). When a lower-priority task like OB35 is actively executing its CFC runtime groups, the arrival of an OB32 timer tick or an asynchronous fault interrupt (OB82 diagnostic alarm, OB86 rack failure) immediately causes the CPU to suspend OB35, execute the higher-priority task, and then return to resume OB35 where it left off.

Gross vs Net Cycle Time Definitions and Mathematical Relationships

The telemetry collected by the operating system distinguishes pure code execution from preemption overhead:

Metric NameGerman TermExact DefinitionDiagnostic SignificanceNet Cycle TimeNetto-LaufzeitTotal CPU execution time consumed purely by the instructions inside the OBReflects user program size and algorithmic workloadPreemption TimeUnterbrechungszeitTime spent paused while higher-priority tasks executeReflects high-priority interrupt load and bus communicationsGross Cycle TimeBrutto-LaufzeitWall-clock time from start to completion: $\text{Gross} = \text{Net} + \text{Preemption}$Must remain comfortably below the OB execution interval

Diagnostic Rule of Thumb:
- If Net Cycle Time is excessive (e.g., Net = 85ms in a 100ms OB35), the OB contains too many blocks; move charts to slower tasks (OB36/OB38).
- If Net Cycle Time is low (e.g., Net = 8ms) but Gross Cycle Time is high (e.g., Gross = 95ms), the OB is being starved by higher-priority interrupts (e.g., frequent OB82 diagnostics, communication bursts, or overloaded OB32).

Diagnostic Evaluation Using the @CPU_RT Block and SFC 78 (OB_RT)

In SIMATIC PCS 7, the @CPU_RT block queries system function SFC 78 (OB_RT) to retrieve microsecond-accurate metrics for each active organization block:

  • OB35_NET / OB35_R: Reports the net execution time of OB35 as a percentage of the total OB cycle interval.
  • OB35_GRS: Reports the gross execution duration.
  • NETTO_R: Reports overall CPU net runtime percentage consumed by user code versus background idle.

On the PCS 7 Maintenance Station, these metrics populate the AS Asset Management faceplates, providing color-coded warning bars before cycle overruns trigger Organization Block 80 (OB80 - Time Error).

Verification

Verify task execution times and evaluate load balance using these methods:

  1. STEP 7 Module Information: In SIMATIC Manager, select the CPU and press Ctrl+D. Open the Cycle Time tab. Review the recorded minimum, maximum, and average scan times.
  2. CFC Online Inspection: Open the CFC chart containing @CPU_RT. Observe outputs OB35_R and OB35_GRS in real time. Confirm that gross execution remains under 70% of the 100ms limit.
  3. Maintenance Station Validation: In WinCC Runtime, open the CPU diagnostic faceplate. Confirm that CPU load bars display healthy green status without triggering high-load warnings.

Limitations and Operational Precautions

When balancing task execution across cyclic interrupt OBs, observe these operational boundaries:

  • Task Overrun Hazard (OB80): If Gross Cycle Time exceeds the OB sampling interval (e.g., Gross > 100ms for OB35), the CPU raises OB80 (Time Error). If a second overrun occurs before the previous instance finishes, the CPU drops to STOP.
  • Firmware Requirements for SFC 78: As established in S7-400 specifications, SFC 78 requires CPU firmware V4.5+ or an AS 410-5H controller; older legacy CPUs report zero for net cycle metrics.
  • Avoid Diagnostic Bloat: Do not poll SFC 78 at high frequencies in user logic; rely on the automatically generated @CPU_RT block running at standard diagnostic intervals.

Engineer FAQ

What is the maximum recommended Gross Cycle Time for OB35?

Siemens recommends that the maximum Gross Cycle Time of any cyclic interrupt OB should not exceed 70% of its cycle interval (e.g., maximum 70ms for a 100ms OB35) to allow adequate headroom for communication and asynchronous alarms.

Can communication processing stretch the Gross Cycle Time?

Yes. S7 communication and WinCC faceplate queries execute at high priority; heavy communication bursts can significantly increase Gross Cycle Time while Net Cycle Time remains unchanged.

How do I reduce the Net Cycle Time of OB35?

Identify non-critical loops (e.g., slow temperature monitoring or tank level calculations) and move their runtime groups from OB35 (100ms) into slower cyclic tasks, such as OB36 (500ms) or OB38 (1s).

Technical References

Related Articles

Related Tags

  • Cycle Time
  • Gross Time
  • Net Time
  • OB35
  • @CPU_RT
  • SFC 78
6 respuestas