WinCC Internal Tag Runtime Persistence: BOOL Value Not Retained After Runtime Stop
Engineers using SIMATIC WinCC V7 or WinCC Unified to track plant work orders, lockouts, or alarm acknowledgements with internal BOOL tags frequently observe tag values resetting to 0 after stopping or deactivating Runtime. Integer and floating-point internal tags on the same project persist correctly, while BOOL tags appear to ignore the Runtime Persistence setting. This reference documents the underlying behavior of the Runtime Persistence flag, the mandatory interaction with the Start Value property, the data-type-specific retention rules, and the step-by-step configuration procedure that produces reliable persistence on both WinCC V7 and WinCC Unified (TIA Portal V20).
1. Problem Description
A WinCC V7 project contains internal tags (one BOOL used as a work-in-progress indicator and one UINT16 used as a counter) configured with the Runtime Persistence checkbox enabled in the tag properties. After Runtime (RT) is started, the engineer writes 1 to the BOOL and writes a non-zero value to the UINT16. RT is stopped, the project is deactivated, and WinCC Explorer is closed.
When the project is restarted:
- The UINT16 returns the last runtime value (persistence works).
- The BOOL returns to 0 (persistence appears to fail).
This behavior was reproduced on multiple installations running WinCC V7.0 SP2, WinCC V7.0.2.0, and WinCC V7.0.2.1 on Windows XP embedded and Windows 7. It also surfaces on PCS 7 V7.1 SP3 engineering stations that host a WinCC V7 component and on workstations with the SICAM PAS CC add-on installed.
2. Root Cause Analysis
Runtime Persistence was introduced for internal tags in WinCC V7.0 to allow HMI-resident values to survive a Runtime stop, project deactivation, or even WinCC Explorer close-and-exit. The mechanism stores the last runtime value of each persisted tag to the project database on the engineering station/runtime server and re-applies it on the next RT start.
Independent field testing demonstrates that the Runtime Persistence checkbox alone is not sufficient to guarantee retention. The Start Value checkbox must also be enabled, and an explicit initial value must be assigned. Without a defined start value, the persistence layer has no anchor point for the first start and the BOOL variable is re-initialized to its default state (FALSE/0) on subsequent starts.
The reason BOOL tags are reported more often as failing is engineering convention: BOOL tags are frequently left with an undefined Start Value (Start Value checkbox disabled), because the default BOOL semantics of "off / not in use" seem adequate. Floating-point and integer tags used in HMI faceplates are usually configured with explicit Start Values because the engineer is already specifying a valid engineering range.
| Runtime Persistence | Start Value Enabled | Start Value Set | Behavior on RT Restart (Float/Int) | Behavior on RT Restart (BOOL) |
|---|---|---|---|---|
| Off | Any | Any | Default initialization (0 / empty) | Default initialization (FALSE) |
| On | Off | N/A | Last value retained (most installations) | FALSE on some installations / last value on others |
| On | On | Empty | Compiler warning, value may reset | FALSE on most installations |
| On | On | 0 (BOOL) / 0.0 (Float) | Last value retained reliably | Last value retained reliably |
| On | On | 1 (BOOL) / non-zero (Int/Float) | First start uses start value, subsequent starts retain last value | First start uses start value, subsequent starts retain last value |
3. Solution
Configure both the Start Value checkbox and the Runtime Persistence checkbox, then supply a defined initial value (0 or 1 for BOOL; 0 or the expected engineering low-scale value for numeric types). Save the project, recompile, and restart Runtime to verify.
3.1 WinCC V7 Procedure
- Open WinCC Explorer and load the project.
- In the Tag Management editor, right-click Internal Tags and select New Tag or open the existing tag.
- On the General tab, set the data type (Binary Tag for BOOL, Unsigned 16-Bit Value for UINT16, Floating-Point Number 64-Bit IEEE 754 for REAL, etc.).
- Switch to the Limits/Reporting tab (in some service packs this is labeled Properties / Limits/Reporting).
- Locate the Start Value group. Enable the Start Value checkbox.
- Enter the initial value in the adjacent numeric input:
0for a safe default BOOL,1if the tag should start in the active state. - On the same tab, enable the Runtime Persistence checkbox.
- Click Apply then OK. The tag now has a defined anchor value and a persistence directive.
- Repeat for every internal tag that must survive an RT stop.
- Save the project. Right-click the project in the WinCC Explorer tree and select Rebuild to regenerate the RT database.
- Activate Runtime. Change the tag value through a script, a button event, or a faceplate I/O field.
- Deactivate Runtime (do not close WinCC Explorer on the first test).
- Reactivate Runtime and confirm the previous value is restored.
3.2 WinCC Unified (TIA Portal V20) Procedure
In WinCC Unified the persistence behavior is documented as: Internal tags are stored in the memory of the HMI device. Therefore, only this HMI device has read and write access to the internal tags. See the official Siemens TIA Portal V20 - Internal Tags (RT Unified) reference for the canonical definition.
- Open the TIA Portal project and navigate to HMI Tags under the Unified Comfort Panel or Unified PC runtime node.
- Double-click the internal tag to open the tag editor.
- In the Properties inspector, expand the Value group.
- Set Initial Value to a defined value (for BOOL:
trueorfalse; for INT:0or the engineering low scale). - Expand the Persistence group and enable Persistent. In WinCC Unified this is the direct equivalent of the V7 Runtime Persistence checkbox.
- Compile the HMI device (right-click the device > Compile > Software (rebuild all)).
- Download to the panel or start the Unified PC Runtime simulation.
- Modify the tag value via a button configured with the SetTagValue system function or via a script.
- Stop the runtime (or power-cycle the panel) and restart. The previous value will be restored.
4. Why BOOL Behaves Differently
The behavior is not a bug in the BOOL data type - it is a side-effect of the Start Value initialization path. When Start Value is disabled, BOOL defaults to FALSE on each RT start because the runtime initializes the tag using a zero-length memory pattern. Numeric types happen to retain the last-written pattern because the WinCC V7 memory manager treats uninitialized-but-persisted DWORD slots as preserve rather than zero. BOOLs share the same storage slot (a BYTE/DWORD), but the persistence layer flags a BOOL with an undefined Start Value as not initialized and applies the zero-fill default.
Engineering implication: always define a Start Value for any BOOL tag whose state carries semantic meaning (work-in-progress, alarm-acknowledged, valve-open-request). The cost of setting Start Value = 0 is zero; the cost of an undefined BOOL on a power-up race is a missed alarm or an incorrect faceplate state.
5. Verification Procedure
- Create a test project containing one BOOL internal tag and one UINT16 internal tag.
- Enable Start Value = 0 for both and Runtime Persistence for both.
- Start RT. Use the WinCC Tag Simulator or a button script with
SetTagBit/SetTagWordto set BOOL = 1 and UINT16 = 12345. - Stop RT.
- Deactivate the project.
- Close WinCC Explorer completely (verify via Task Manager that CCExplorer.exe is gone).
- Re-open WinCC Explorer, load the project, activate RT.
- Read both tags. Both must equal the last-written value.
5.1 Diagnostic Logging
Enable the WinCC RT diagnostic file to capture persistence events:
- Open WinCC Explorer > Computer node > right-click the local computer > Properties > Runtime tab.
- Check Activate diagnostic file and set the path (default:
C:\Program Files\Siemens\Automation\WinCC\Diagnose\). - Restart RT and review
WinCC_Sys_for lines containing Persistence, Restore, or Tag init..log
6. Architecture and Storage Location
The following SVG diagram shows the persistence storage path for WinCC V7 internal tags on a single-user project and on a client/server project. For WinCC Unified, replace the WinCC V7 database with the Unified runtime memory model documented in the official Siemens reference.
7. Migration to WinCC Unified
When migrating a WinCC V7 project to a Unified Comfort Panel or Unified PC Runtime, the persistence attribute is preserved if the tag is re-imported with the same name and data type. The Start Value mapping is direct: V7's Start Value becomes Unified's Initial Value. V7's Runtime Persistence becomes Unified's Persistent property in the tag inspector.
| WinCC V7 Property | WinCC Unified Property | Default |
|---|---|---|
| Start Value checkbox | Initial Value defined | Off |
| Start Value numeric input | Initial Value | 0 |
| Runtime Persistence checkbox (Limits/Reporting tab) | Persistent (Properties > Persistence) | Off |
| Tag data type (Binary Tag, Unsigned 16-Bit Value, ...) | Data type (Bool, UInt16, ...) | Unsigned 16-Bit Value |
| Limits/Reporting > Substitute value use | Substitute value (Quality Code handling) | Off |
8. Version-Specific Notes
| WinCC Version | Runtime Persistence Available | Start Value Required for BOOL | Notes |
|---|---|---|---|
| V6.2 | No (internal tags) | N/A | Internal tags cannot be persisted. Use archive tags if historical value is required. |
| V7.0 (RTM) | Yes (introduced in V7.0) | Yes (recommended) | First version with persistence; BOOL behavior varies by installation. |
| V7.0 SP2 | Yes | Yes | Confirmed on Windows XP embedded single-user projects. |
| V7.0.2.0 | Yes | Yes | Reported issue: BOOL does not retain last value even with both checkboxes set. |
| V7.0.2.1 | Yes | Yes (mandatory for BOOL) | BOOL persists correctly when Start Value = 0 is explicitly set. |
| PCS 7 V7.1 SP3 with WinCC V7 component | Yes | Yes | Apply same configuration pattern as standalone WinCC V7. |
| TIA Portal V20 / Unified PC Runtime | Yes (Persistent property) | Yes (Initial Value) | Documentation: Internal Tags (RT Unified) |
9. Edge Cases and Field-Proven Caveats
- Client/Server projects: Runtime Persistence applies to the server's project database. Clients read the persisted value from the server on connect, but the persistence write is performed only on the server. Verify the server (not just the client) is configured with the tag's persistence enabled.
- Redundant server pairs: When a WinCC V7 redundant server pair fails over, the preferred server's persisted values are used. If both servers have diverged, manual archive synchronization is required.
- SICAM PAS CC add-on: Power-utility substation projects frequently use SICAM PAS CC on top of WinCC V7. Persistence behaves identically, but the add-on writes its own process tags that are not affected by Runtime Persistence - they must be tracked through SICAM PAS configuration.
- Tag rename: Renaming a persistent tag creates a new tag identity; the old persistence record is orphaned. The renamed tag will start from its Start Value.
- Data type change: Changing BOOL to UINT16 or vice versa resets the persistence slot. The tag starts from Start Value.
- Project duplication: Copying a project duplicates the persistence database. Both projects will then retain their own values independently.
- Multiple RT instances: Running RT twice on the same project (e.g., test and production) corrupts the persistence file. Use separate project folders.
- Power loss mid-write: The persistence layer commits to the SQL database on RT stop, not on every value change. A hard power loss before RT stop reverts to the last successful commit.
10. Troubleshooting Matrix
| Symptom | Likely Cause | Action |
|---|---|---|
| BOOL always 0 after RT restart, INT/REAL persist | Start Value checkbox disabled | Enable Start Value, enter 0 or 1, save, rebuild |
| All tags reset to 0 after RT restart | Runtime Persistence checkbox disabled | Enable on Limits/Reporting tab |
| Tags reset after Windows reboot but persist after RT stop | SQL Server service not running or database detached | Verify SQL Server (WINCC) service is auto-start; check C:\Program Files\Microsoft SQL Server\MSSQL.x\MSSQL\Data\<ProjectName>.mdf
|
| Tags persist on dev station but not on target runtime PC | Project not fully downloaded; RT database out of sync | Right-click project > Download > Full download (not delta) |
| BOOL persists but value flips to 0 randomly | Script writing 0 on every RT start (init script) | Inspect Global Script RT init for unconditional tag writes |
| Persisted value older than expected after restart | Two RT instances wrote to the same database | Run only one RT per project folder; archive or delete stale MDF |
| Persisted value lost after project deactivation but not after RT stop | Deactivation triggers different commit path | Use RT stop (deactivate) consistently; check WinCC version-specific behavior |
11. Frequently Asked Questions
Why does my BOOL internal tag reset to 0 every time Runtime starts, while my integer and floating-point tags retain their last values?
The BOOL tag most likely has the Runtime Persistence checkbox enabled but the Start Value checkbox disabled. In WinCC V7 the persistence layer requires a defined Start Value as the anchor for the first RT start. Without it, BOOL defaults to FALSE on restart. Enable Start Value, enter 0, save, and rebuild the project. Floating-point and integer tags appear to persist without a Start Value only because their default memory pattern (0.0 / 0) coincidentally matches an undefined state in many installations, masking the underlying configuration gap.
Does Runtime Persistence work on Windows 7 / Windows 10 / Windows 11 with WinCC V7?
Yes. Runtime Persistence depends on the WinCC V7 SQL Server database (WINCC instance), not the host operating system. It is verified on Windows XP embedded, Windows 7, and Windows 10 / 11 with WinCC V7.0 SP2, V7.0.2.0, V7.0.2.1, and the WinCC component of PCS 7 V7.1 SP3. The host OS only affects SQL Server service startup behavior; configure the WINCC SQL service to Automatic and Delayed Start.
Can I persist internal tags across a Windows reboot or a panel power-cycle?
Yes. On WinCC V7 the persistence is committed to the project database when Runtime is deactivated (via the Deactivate Runtime button) or when WinCC Explorer exits cleanly. A hard power loss before deactivation may revert to the last successful commit. On WinCC Unified (TIA Portal V20), persistence is held in non-volatile storage of the HMI device, so a power-cycle restores the last value if the Persistent property is enabled. See the official Internal Tags (RT Unified) reference for the Unified storage model.
What is the difference between Runtime Persistence and Substitute Value in WinCC V7?
Runtime Persistence stores the last value written by RT so it survives an RT stop. Substitute Value is applied when the tag's quality code indicates a bad/missing value (e.g., PLC connection lost). The two settings are independent: you can have a persisted BOOL with no substitute value, or a non-persisted tag with a substitute value of 1. For alarm-tracking BOOLs, configure both: Start Value = 0, Runtime Persistence = ON, and an appropriate substitute value for fail-safe behavior.
Is Runtime Persistence available in WinCC V6.2 or earlier?
No. Runtime Persistence for internal tags was introduced in WinCC V7.0. On WinCC V6.2 the only way to retain a value across an RT stop was to use an archive tag or to write the value to a file via a Global Script C / VB action. If you must maintain a V6.2 system with persistent BOOL state, write the BOOL to a binary file on RT stop and read it back on RT start using the Write/Read C-script functions.
Do I need to enable Runtime Persistence on the client or only the server in a WinCC V7 client/server project?
Enable Runtime Persistence on the server. Clients consume tag values from the server and do not write to the persistence database. The server commits the persisted values on RT deactivation. If a client also runs an RT instance locally (e.g., a stand-alone client with its own project copy), that instance must also have Runtime Persistence enabled on its own project database.