Impact of Renaming CFC Charts on WinCC OS C-Scripts, VBScripts, and Tag Triggers in PCS 7
Renaming a CFC chart in SIMATIC PCS 7 does NOT automatically update tag references inside WinCC C-scripts, VBScripts, or picture actions during an OS compilation. An OS compile generates and updates the WinCC tag database based on the new chart name (e.g. changing 'OldChart/Valve1.V_Out' to 'NewChart/Valve1.V_Out'), but script code consists of static text strings that the compiler does not parse. Scripts containing hardcoded tag names or tags enclosed in brackets will fail at runtime, and action triggers monitoring deleted tag names will stop firing. To safely rename a CFC chart, engineers must use the WinCC Cross-Reference Editor to locate and update all script references and tag triggers before performing an OS compilation and download.
Table of Contents
- Executive Summary
- Architecture and Fundamental Mechanics
- Step-by-Step Implementation Procedure
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
Executive Summary
During engineering modifications, plant restructuring, or standardization passes in SIMATIC PCS 7, engineers frequently need to rename existing CFC charts to align with revised Plant Hierarchy (TH) or KKS equipment tagging conventions. A dangerous assumption made by automation personnel is that executing a full OS compilation will automatically trace and refactor tag names across custom WinCC C-scripts, VBS actions, and cyclic triggers. In reality, the OS compiler updates only the SQL tag dictionary; any script referencing old tag names immediately fails at runtime, causing silent script execution halts, missing graphic updates, and high CPU loads. This article details script execution mechanics in WinCC, analyzes the risks of chart renaming, and provides a verified refactoring procedure using the WinCC Cross-Reference Editor.
Architecture and Fundamental Mechanics
WinCC Script Compilation Mechanics vs OS Tag Generation:
- How OS Compilation Manages Tag Renaming:
- In PCS 7, process tags in WinCC follow a strict hierarchical naming convention:
Plant_Hierarchy/Chart_Name/Block_Name.Parameter. - When a CFC chart is renamed from
Reactor1_FeedtoReactor2_Feed, the next OS compilation performs two database actions:- It deletes the obsolete tag entries (
Reactor1_Feed/...) from the WinCC tag dictionary. - It creates fresh tag records with the new prefix (
Reactor2_Feed/...).
- It deletes the obsolete tag entries (
-
Dynamic wizard connections and standard APL block icons that reference technological objects update automatically because their interconnections are resolved through the WinCC Object Management database.
-
Why Scripts Fail Silently Post-Compilation:
- In C-actions and Global Scripts, tags are accessed via C-API functions such as
GetTagDouble('OldChart/Block.Out')or#pragma code .... In VBScript, tags are accessed viaHMIRuntime.Tags('OldChart/Block.Out').Read. - The WinCC script engine treats these tag names as opaque literal strings. The OS compiler does not possess a text parsing engine to inspect, refactor, or rewrite source code inside
.pdlgraphics or.fctglobal script files. -
At runtime, calling
GetTagDoubleon a deleted tag returns0.0with Quality CodeBad (0x00). -
Tag Trigger Breakdown:
- Actions configured with 'Tag Trigger' linked to the old tag name fail to execute because the WinCC Event Manager drops triggers tied to deleted tags, permanently disabling dynamic screen logic.
Step-by-Step Implementation Procedure
-
Audit Existing Scripts Using WinCC Cross-Reference Editor:
* Before renaming the CFC chart, open WinCC Explorer on the Engineering Station.
* In the WinCC navigation tree, open the Cross-Reference editor.
* SelectEdit -> Filterand enter the exact name of the CFC chart to be renamed (e.g.OldChart).
* ClickStart Search. Cross-Reference scans all pictures (.pdl), C-actions, VBScripts, and global functions.
* Review the list of script locations, picture names, and trigger definitions where the tag is actively referenced. -
Rename the CFC Chart in SIMATIC Manager:
* In SIMATIC Manager Component View or Plant View, right-click the CFC chart and selectRename.
* Enter the new chart name (e.g.NewChart) adhering to naming rules (no special characters or spaces).
* Perform a quick chart compilation check (Chart -> Compile -> Changes Only). -
Execute Batch Replacement in WinCC Cross-Reference Editor:
* In the WinCC Cross-Reference Editor, selectEdit -> Link / Replace.
* In the 'Search for' field, enter the old tag prefix:OldChart/.
* In the 'Replace with' field, enter the new tag prefix:NewChart/.
* Select all affected PDL pictures and script files, then clickPerform Linking.
* The Cross-Reference utility automatically rewrites the tag strings inside all C-actions and VBS scripts. -
Perform OS Compilation:
* In SIMATIC Manager, right-click the OS project and selectCompile.
* SelectScope: Entire OS(orChanges onlyif supported), and execute compilation.
* Confirm that the OS compilation log reports 0 errors and generates the updated WinCC tag structures. -
Validate Runtime Script Execution via APDIAG:
* Activate WinCC Runtime.
* Open the WinCC diagnostic console by launchingapdiag.exe(located in<WinCC_Path>in).
* In APDIAG, selectOutput Windowto view real-time C-script and VBS error logs.
* Navigate to the screens containing modified scripts; confirm that 0 'Tag not found' or runtime evaluation errors are logged.
Verification
Verify Script Execution and Tag Trigger Integrity:
1. In the WinCC Cross-Reference Editor, run a search for the old chart name; confirm that 0 occurrences remain.
2. In WinCC Runtime, verify that all dynamic graphic objects powered by scripts update their states correctly.
3. In APDIAG Output Window, confirm that no script errors or unresolved tag warnings appear during screen loading.
Limitations and Operational Precautions
Operational Precautions and Scripting Best Practices:
- Avoid hardcoding absolute tag names in custom C-scripts; use dynamic tag prefixing (GetTagPrefix) on picture windows to make faceplates and popups chart-independent.
- Never rename CFC charts while OS Servers are in active production without a synchronized maintenance plan, as delta downloads will temporarily invalidate runtime tags until compilation finishes.
Engineer FAQ
Will an OS compile update tag names inside WinCC C-scripts?
No. The OS compiler updates the WinCC tag dictionary, but it treats C-scripts and VBScripts as unmodifiable text. Tag names inside scripts must be updated manually or via the Cross-Reference editor.
What happens if a script calls a tag from a renamed chart?
The function (e.g. GetTagDouble) fails to locate the tag in the dictionary, returns a default 0.0 value with Bad quality code, and logs a runtime script error in apdiag.
What tool finds all scripts referencing a specific tag in WinCC?
The WinCC Cross-Reference Editor located in WinCC Explorer searches and batch-replaces tag names across all pictures, scripts, and triggers.
Why did an action stop running after renaming a chart?
If the action was configured with a 'Tag Trigger' linked to the old tag, WinCC deleted the trigger when the old tag was removed during OS compilation, disabling the action.
Can I use wildcards when renaming tags in Cross-Reference?
Yes, the Link / Replace dialog in the Cross-Reference editor supports string matching and prefix replacement across multiple project files simultaneously.
Technical References
- SIMATIC HMI WinCC V7.5 WinCC Information System - Scripting
- SIMATIC PCS 7 OS Process Control System V9.0
- Siemens Technical Support Entry ID: 109772961 - Cross-Reference Editor
Related Articles
- Resolving Disabled 'Download Changes' (Delta Download) to OS Server in SIMATIC PCS 7
- Configuring Server View Layout and Screen Resolution in OS Project Editor for Multi-Client Architectures
- Resolving Missing HMI Pictures and Navigation Failures in Multi-Client Multi-Project PCS 7 Systems
- Validating Engineering Standards and Commissioning Multi-Client Mode Across Multiple Projects
Related Tags
- WinCC
- CFC Renaming
- C-Scripts
- VBScript
- Cross-Reference
- Tag Triggers
- OS Compilation
- PCS 7 V9.0