Interpreting APL ErrorNum = -1 in SIMATIC PCS 7 - Default Unexecuted State and Interrupt OB Assignment

Interpreting APL ErrorNum = -1 in SIMATIC PCS 7 - Default Unexecuted State and Interrupt OB Assignment

In SIMATIC PCS 7 Advanced Process Library (APL V8.0 through V9.1), when a technological block (MotL, VlvL, PIDConL, MonAnL) displays an output value of ErrorNum = -1 in online monitoring (or S7-PLCSIM), it signifies that the block algorithm has never executed. In APL block architecture, ErrorNum is initialized in instance data memory to -1 during operating system startup. Upon its first successful cyclic execution sweep, the block algorithm executes and updates ErrorNum to 0 (healthy / no error) or a positive integer ($> 0$, representing a specific algorithmic or parameter fault). If ErrorNum persists at -1, it proves that the block's runtime group is not being executed by the CPU, typically because the block was placed into a disabled runtime group (EN = 0), assigned to an uncalled organization block (e.g., OB1), or the CPU is in STOP.

Table of Contents

The Operational Role of ErrorNum in the Advanced Process Library

In SIMATIC PCS 7, blocks belonging to the Advanced Process Library (APL) feature standardized diagnostics across all equipment classes. A central component of this diagnostic suite is the integer output parameter ErrorNum.

The ErrorNum parameter provides numeric fault classification for abnormal algorithmic states that do not necessarily arise from hardware failures (which are handled via Bad = 1 and CSF = 1). For example, in an analog monitoring block (MonAnL), ErrorNum indicates invalid limit configurations (e.g., high alarm limit set lower than low alarm limit). In a PID controller (PIDConL), it indicates mathematical anomalies such as division by zero or negative integration times.

Why ErrorNum = -1 Indicates an Unexecuted Block State

Understanding the execution lifecycle of an S7 function block clarifies why -1 appears during initial engineering:

ErrorNum ValueOperational MeaningCPU Execution Status-1 (Default)Unexecuted / UnprocessedBlock code has not executed since CPU startup or instantiation0Healthy / No ErrorBlock is actively executing cyclically; all parameters and algorithms valid> 0 (e.g., 1, 2, 3)Parameter / Calculation FaultBlock is executing, but an invalid configuration or calculation error exists

During CPU startup (OB100 initialization sweep), the operating system loads the default data block values defined in the block type. For all APL blocks, the initial value of ErrorNum is hardcoded to -1. On the very first cyclic interrupt sweep (e.g., in OB35), the internal block logic evaluates inputs and sets ErrorNum = 0. If ErrorNum remains frozen at -1, the block code is physically not running.

Diagnosing and Restoring Runtime Group Execution in CFC

To resolve ErrorNum = -1 and restore active block execution, execute this troubleshooting workflow in the CFC Editor:

  1. Inspect Block Header in CFC: In the CFC editor, inspect the top-right header of the block symbol. The green or gray bar displays the execution container (e.g., OB35/1). Confirm that an organization block number is shown.
  2. Open the Run Sequence Editor: Select Options -> Edit Run Sequence (Ctrl+F5).
  3. Check Enable State (EN): Expand the target cyclic OB (e.g., OB35). Locate the runtime group containing the block. Verify that the enable flag (EN) for the runtime group and the block itself is Checked (EN = 1). If EN = 0, the CPU bypasses execution entirely.
  4. Verify Organization Block Execution: If the block is placed in an unusual OB (e.g., OB30 or OB1), verify in HW Config that the cyclic interrupt is configured to execute. S7-400 CPUs do not call cyclic OBs whose interval is set to 0.
  5. Check CPU Operating State: Confirm in SIMATIC Manager or S7-PLCSIM that the controller is in RUN mode. If the CPU is in STOP, cyclic interrupt OBs are never called, leaving all blocks at their default -1 state.

Verification

Verify active block execution and error clearing using these checks:

  1. CFC Online Test: In the CFC editor, turn on online test mode (Test -> Open). Observe ErrorNum. Confirm that the value transitions from -1 to 0.
  2. Algorithm Execution Validation: Toggle an input command (e.g., ManModOp = 1). Confirm that the block processes the command and updates output AutAct / ManAct in real time.
  3. Parameter Fault Test: Intentionally set an invalid parameter (e.g., enter high alarm PV_AH_Lim = 10.0 and low alarm PV_AL_Lim = 50.0). Confirm that ErrorNum immediately transitions from 0 to a positive integer (e.g., 1), proving active algorithmic monitoring.

Limitations and Operational Precautions

When evaluating block execution status, observe these operational principles:

  • Conditional Runtime Groups: If runtime groups are dynamized with boolean logic on their EN input (conditional execution), ErrorNum will freeze at its last evaluated state when EN = 0. If EN was 0 at startup, it remains -1.
  • OS Compile Independence: The fact that an OS compilation succeeds with zero errors has no bearing on whether a block is executing; AS-OS Engineering compiles static database attributes, not dynamic CPU execution schedules.
  • S7-PLCSIM Simulation: In S7-PLCSIM, ensure the CPU toggle switch is set to RUN or RUN-P; leaving it in STOP is a frequent reason new engineers observe ErrorNum = -1.

Engineer FAQ

Does ErrorNum = -1 trigger an alarm on the WinCC faceplate?

No. ErrorNum = -1 indicates that the block has not executed; since the block is inactive, it cannot communicate alarm messages via Alarm_8P. The faceplate will typically display disconnected or grayed-out indicators.

Where can I find the meaning of positive ErrorNum values?

Select the technological block in CFC and press F1. The context-sensitive help manual lists the precise table of positive error numbers and their parameter causes for that specific block type.

Can a block execute if its chart is not part of a runtime group?

No. In SIMATIC S7 controllers, code only executes if it is placed inside a runtime group assigned to an Organization Block (OB). Unassigned blocks remain dead code in memory.

Technical References

Related Articles

Related Tags

  • ErrorNum
  • APL
  • Runtime Groups
  • OB35
  • Execution State
  • S7-PLCSIM
6 respuestas