Diagnosing Cannot Write the Tag Errors and APL_CloseArea Script Faults in WinCC Faceplates

Diagnosing Cannot Write the Tag Errors and APL_CloseArea Script Faults in WinCC Faceplates

In SIMATIC PCS 7 WinCC OS Runtime, the error 'Cannot write the tag (unknown)' occurring when modifying values in APL faceplates (such as PIDConL or MonAn08) via keyboard input (Enter key) is caused by a script execution failure inside the standard input dialog picture (@PG_APL_OA_*.pdl) calling the C-script function APL_CloseArea. This fault typically occurs when a user lacks required operator authorization (Authorization 5 or 6), when faceplate pictures were customized without preserving button permissions, or when an upgraded project retains outdated APL faceplate pictures referencing obsolete tag structures. To diagnose and resolve this, launch the WinCC application diagnostic utility 'apdiag.exe' (located in C:\Program Files (x86)\Siemens\WinCC\uTools) to capture the exact script failure line, verify user authorization levels in WinCC User Administrator, and run the OS Project Editor to deploy updated, consistent APL faceplate system pictures.

Table of Contents

Executive Summary

Operator control and monitoring in SIMATIC PCS 7 relies on standardized Advanced Process Library (APL) faceplates to display process data, adjust setpoints, modify alarm limits, and issue operating commands. When an operator clicks an input field, types an updated numerical value, and confirms the input by pressing the Enter key, the runtime executes an internal script validation handshake to verify permissions, write the target process tag, and dismiss the input popup via APL_CloseArea.

In customized or recently upgraded PCS 7 systems, operators frequently encounter an abrupt runtime error dialog stating: 'Cannot write the tag (unknown)', accompanied by the value failing to write to the controller. Curiously, in many instances, confirming the value using the on-screen 'OK' button via mouse click works, while pressing the physical Enter key triggers the error. This discrepancy stems from differing event execution paths between keyboard event scripts and mouse click scripts in @PG_APL_OA_*.pdl pictures. This technical guide outlines the internal mechanics of APL operator input scripts, demonstrates how to pinpoint script errors using apdiag.exe, and provides a verified resolution procedure to restore reliable faceplate parameter entry.

Architecture and Fundamental Mechanics

The parameter modification pipeline in APL faceplates operates through structured picture windows, tag prefixes, and C-script routines:
1. Input Dialog Architecture (@PG_APL_OA_*.pdl):
* When an operator clicks an editable parameter on a standard faceplate (e.g., setpoint on @PG_PidConL_Standard.pdl), WinCC opens a modal operator area popup picture window (e.g., @PG_APL_OA_Analog100.pdl or @PG_APL_OA_Real.pdl).
* The popup receives the parent block's hierarchical tag prefix via the standard WinCC property TagPrefix (e.g., Plant/Unit/FIC_101.).
2. The Mechanism of Keyboard Event Divergence:
* When an operator confirms an entry using the OK mouse button, the script executes OnClick, which validates user permissions, formats the string into a binary floating-point value, writes the tag via SetTagFloat(...), and calls APL_CloseArea to close the popup.
* When the operator confirms via the physical Enter key, the keyboard event handler on the text input box captures the keystroke and calls an alternative script subroutine.
* If the faceplate was customized (e.g., buttons removed or resized), or if library updates introduced mismatched C-scripts (APL_CloseArea), the keyboard script may attempt to evaluate button permissions on non-existent GUI elements or attempt to write to a tag concatenated with an empty or undefined tag prefix.
* When WinCC Tag Management receives a write request for an unresolvable tag string (e.g., .SP_LiOp without the block prefix), it fails immediately and generates the error prompt: 'Cannot write the tag (unknown)'.
3. Application Diagnostics with apdiag.exe:
* Standard WinCC runtime alarms do not log internal C-script syntax errors or missing tag write exceptions.
* The dedicated Siemens diagnostic tool apdiag (C:\Program Files (x86)\Siemens\WinCC\uTools\apdiag.exe) captures low-level script engine calls, stack traces, and unhandled exceptions in its Output Window, displaying the exact picture file, object name, and failing script line.

Step-by-Step Implementation Procedure

Step 1: Launch and Configure apdiag Application Diagnostics

  1. On the affected OS Client or Single Station workstation, navigate to:
    C:\Program Files (x86)\Siemens\WinCC\uTools\
  2. Right-click apdiag.exe and select Run as administrator.
  3. In the apdiag toolbar, click the Output Window button (or select Output > Output Window).
  4. Position the apdiag Output Window on one monitor while WinCC Runtime is visible on the other.

Step 2: Reproduce the Faceplate Error and Analyze Diagnostic Trace

  1. In WinCC Runtime, open the problematic faceplate (e.g., PIDConL or MonAn08).
  2. Click the setpoint or threshold input field to open the @PG_APL_OA_*.pdl dialog.
  3. Type a numerical value and press Enter on the keyboard.
  4. When the error 'Cannot write the tag (unknown)' appears, immediately inspect the apdiag Output Window.
  5. Locate the error message stack trace:
    * Note the reported script file: e.g., @PG_APL_OA_Real.pdl or @PG_PidConL_Standard.pdl.
    * Note the reported object: e.g., stUser or inValue.
    * Note the specific C-function reported: e.g., APL_CloseArea or SetTagFloat.

Step 3: Verify User Authorization Levels in User Administrator

  1. Open WinCC Explorer on the Engineering Station and launch User Administrator.
  2. Verify that the logged-in user group has both Authorization 5 (Process controlling) and Authorization 6 (Higher process controlling) enabled for that specific plant area.
  3. Check parameter OS_Perm on the AS block in CFC: verify that operator permission bits have not been disabled in controller logic.

Step 4: Re-Deploy Standard APL Faceplates via OS Project Editor

If the error originates from corrupted or modified @PG_... system pictures following a library upgrade:
1. In WinCC Explorer, double-click OS Project Editor.
2. On the Basic Data tab, ensure the checkbox to update system pictures is selected.
3. Click OK to allow the editor to restore all standard @PG_APL_OA_*.pdl and @PG_*.pdl pictures from the global library into the project GraCS directory.
4. This overwrites corrupted script modifications and aligns APL_CloseArea functions with the installed APL version.

Step 5: Compile OS and Download Project

  1. In SIMATIC Manager, perform an OS Compile ('Tags and screen objects', Changes only).
  2. Download the OS project to the target runtime stations.
  3. Test value entry using both keyboard Enter and mouse click.

Verification

  1. In WinCC Runtime, open the target faceplate.
  2. Enter a new value in the setpoint field and press the physical Enter key on the keyboard.
  3. Confirm that the value writes immediately to the controller without error prompts.
  4. Confirm that the input popup window closes smoothly via APL_CloseArea.
  5. Inspect the apdiag Output Window: verify that zero script execution errors or tag write warnings are logged during the transaction.

Limitations and Operational Precautions

  1. Running the OS Project Editor will overwrite custom modifications made directly to system @PG_... pictures; always back up customized screens prior to running the editor.
  2. If custom faceplates are strictly required, author them in separate user-defined picture files rather than modifying standard APL system screens directly.
  3. apdiag.exe consumes CPU resources when tracing is set to maximum verbosity; close apdiag once troubleshooting is finished.
  4. Ensure that the tag being written is not configured as Read-Only in WinCC Tag Management.

Engineer FAQ

Why does the error occur with the Enter key but not with the mouse OK button?

Mouse clicks and keyboard Enter strokes execute separate event handlers in @PG_APL_OA_*.pdl. If custom modifications broke GUI object references, the keyboard script fails while the mouse click script succeeds.

What is the function of APL_CloseArea?

It is a standard APL C-script function that validates whether an operator action has completed, resets focus, and closes modal operator input popup windows.

Where is the apdiag utility located?

apdiag.exe is located in C:\Program Files (x86)\Siemens\WinCC\uTools\ on any PCS 7 ES or OS station.

Can a missing tag prefix cause 'Cannot write the tag unknown'?

Yes. If the TagPrefix property on the picture window is blank or truncated, the script attempts to write to a tag name without the plant hierarchy path, which does not exist in Tag Management.

How do I fix corrupted standard APL faceplate pictures?

Run the OS Project Editor in WinCC Explorer. On the Basic Data tab, ensure standard pictures are selected for update and click OK to restore original factory pictures.

Technical References

Related Articles

Related Tags

  • apdiag
  • WinCC Faceplates
  • APL_CloseArea
  • Tag Writing
  • C-Script
20 respuestas