Resolving PCS7 WinCC CSV Export Sampling Interval Drift
This technical reference documents the resolution of a WinCC/PCS7 V7.0 symptom in which a tag configured for 1-second cyclic archiving exports to CSV with minute-scale, irregular timestamps. The phenomenon is well known on PCS7 V7.0 systems where the Configuration-Database carries a residual VONCHANGE = 2 flag that overrides the Tag Logging Editor setting. It also covers the secondary symptom: missing trend segments after a manual or daylight-saving time shift.
The scope covers WinCC V7.0, PCS7 V7.0, the Tag Logging Editor, the Configuration-Database (WinCC configuration), and Microsoft SQL Server Management Studio (SSMS) for direct database inspection. Operators and commissioning engineers will use this guide to recover deterministic, second-resolution CSV exports from online trend controls.
Problem Summary
Operator presses Save on the trend window toolbar. WinCC Online Trend Control serializes the buffered archive values to a CSV file via the export dialog. The operator expects one row per archive cycle (e.g., 1 000 ms), but the resulting file contains only a few dozen rows per day with timestamp spacing of minutes to tens of minutes. The same tags display correctly on the OS (operator station) at the configured cycle, which makes the symptom localized to the export path.
Two distinct symptoms appear in the field:
| Symptom | Observation | Likely Cause |
|---|---|---|
| Irregular minute-level CSV timestamps | Tag is configured 1 000 ms in Tag Logging Editor, but CSV shows 1 to 35 minute gaps. |
VONCHANGE = 2 residual in dbo.PDE#TAGs; tag is logging on-change instead of cyclically. |
| One-hour gap or duplicated hour after time change | Trend curve shows flat-line segment of exactly 3 600 000 ms after operator shifts system clock or DST rolls. | WinCC archive back-end uses local-time stamps; monotonic archive cycle skipped the transition window. |
Root Cause: VONCHANGE Flag in the Configuration-Database
PCS7 V7.0 stores tag archiving metadata in two locations: the visible Tag Logging Editor (offline, project database) and the runtime Configuration-Database (online, WinCC_<OSName> SQL database). On systems where the project has been migrated across PCS7/V7 versions or where a hot-fix has been applied, the runtime copy may diverge from the offline copy. A divergence where the runtime retains VONCHANGE = 2 but the offline editor shows cyclic continuous causes the symptom.
The VONCHANGE column semantics in dbo.PDE#TAGs are:
| Value | Meaning | Effect on CSV export |
|---|---|---|
| 0 | Cyclical continuous | Row written every archive cycle regardless of value change. Use this for deterministic 1 s CSV export. |
| 1 | On change (analog, with hysteresis) | Row written only when value moves by configured delta. Produces minute-scale irregular rows for slow-moving process values. |
| 2 | On change (binary, no hysteresis) | Row written only on 0->1 or 1->0 edge. Produces sparse rows for stable bits. |
VONCHANGE = 2. Trusting the UI alone is the single most common reason this defect remains unresolved for years.Database-Level Fix: Editing dbo.PDE#TAGs
Use Microsoft SQL Server Management Studio (SSMS) to inspect and correct the runtime flag. Do this on the OS (operator station), not the engineering station.
Prerequisites
- SQL Server sysadmin or db_owner rights on the
WinCC_<OSName>database. - SSMS 2012 or later (any version supporting SQL Server 2008 R2+).
- WinCC Runtime stopped on the OS, or scheduled maintenance window with operator acknowledgement.
- Database backup completed within the last 24 hours.
Step-by-Step Procedure
- Open SSMS and connect to the SQL Server instance hosting the OS archives (typically
\<OSName>\WINCC). - Expand Databases → WinCC_<OSName> → Tables.
- Right-click
dbo.PDE#TAGsand choose Select Top 1000 Rows. - Locate the affected tag row by
TAGNAMEmatching the archive tag name (exact, case-insensitive). - Inspect the
VONCHANGEcolumn. If the value is2or1and the operator requires cyclic export, proceed to step 6. - Confirm that the
ARCHIV_CYCLEcolumn matches the intended cycle (e.g.,1000for 1 s, expressed in the configured time base). - Right-click the row, choose Edit Top 200 Rows, and change
VONCHANGEto0. - Verify any
HYSTERESISvalue: for cyclic continuous archiving it is ignored but should not be NULL. Set to0for cleanliness. - Commit the change (SSMS auto-commits by default in edit mode).
- Restart WinCC Runtime so the altered row is re-read by the Tag Logging runtime.
Reference SQL Script
For multiple tags, execute a batch update with explicit identification:
USE [WinCC_OS1];
GO
UPDATE [dbo].[PDE#TAGs]
SET [VONCHANGE] = 0,
[HYSTERESIS] = 0
WHERE [TAGNAME] IN ('TAG_AI_101', 'TAG_AI_102', 'TAG_TI_201')
AND [VONCHANGE] <> 0;
GO
SELECT [TAGNAME], [VONCHANGE], [HYSTERESIS], [ARCHIV_CYCLE]
FROM [dbo].[PDE#TAGs]
WHERE [TAGNAME] IN ('TAG_AI_101', 'TAG_AI_102', 'TAG_TI_201');
GO
Confirm the SELECT result shows VONCHANGE = 0 for all targeted tags before restarting the runtime.
Tag Logging Editor Verification
After correcting the runtime database, also reconcile the offline project to prevent recurrence on next OS compile.
- In SIMATIC Manager, open the OS project on the engineering station.
- Open WinCC Explorer → Tag Logging.
- Locate each affected archive tag, double-click, and open Properties → Archive.
- Set Archiving type to Cyclical continuous.
- Set Acquisition cycle to the desired value (e.g., 1 s).
- Disable Archive on change if present.
- Save, then perform an OS Compile with Changes only and download to the OS.
VONCHANGE = 0 row, but in-place runtime databases with stale VONCHANGE = 2 values will persist until the next compile. Either route resolves the issue; both together is the most robust procedure.CSV Export Procedure
Once the archive cycle is correct, verify the export by reproducing the operator's workflow:
- Open the Online Trend Control containing the corrected tag.
- Set the time window to a known period (e.g., 5 minutes).
- Click Save → Export → CSV on the trend toolbar.
- Choose Ring buffer / swap file as the data source for online-trend export, not Archive, if you want the in-memory short-term buffer (this is faster for live data).
- Open the resulting CSV in Notepad or Excel and inspect the timestamp column.
- Confirm that the timestamp delta matches the configured cycle (e.g., 1 s).
Excel may reformat the timestamp column on open and obscure the actual frequency. Use Data → Text to Columns with delimiter ; (the WinCC default for German locale projects) or , (English locale) to recover the raw timestamps. A CSV saved from Excel itself is text-only, and any earlier non-text formatting is lost once saved as CSV; always work from a copy if you intend to re-save. For version recovery semantics, see Microsoft Learn: Recover a file accidentally saved as CSV.
Daylight Saving Time and Manual Time Shifts
After the sampling issue is fixed, a second symptom often appears: a flat-line or duplicate-hour segment in the trend when the operator or DST shifts the system clock. WinCC Online Trend Control renders archive values against local time; the archive back-end stores monotonic process time. When local clock is moved, the back-end either skips or duplicates archive rows in the affected window.
Siemens documents the behaviour in the WinCC Online Trend Control FAQ. The supported practices for PCS7 V7.0 are:
- Configure both the OS and the AS time source from the same NTP server or domain hierarchy.
- Disable manual time changes on the OS. Use the operator authorization level "No access" for the WinCC time control dialog.
- Enable Windows automatic DST adjustment, but expect a 1-hour flat-line at the transition (this is the documented behaviour, not a defect).
- If the trend is part of a regulated batch record, archive to the redundant Alarm Logging path which stores UTC and renders locally on display.
For the official Siemens position on daylight-saving handling in WinCC Online Trend Control, refer to entry Siemens Support FAQ 22370189: How is archive data displayed by WinCC Online Trend Control for daylight saving changes?
Archive Cycle Time Base and Unit
WinCC Tag Logging accepts cycle values in the configured time base. The two relevant columns in dbo.PDE#TAGs are ARCHIV_CYCLE (numeric value) and CYCLE_TIME_UNIT (integer code for the unit). Misalignment between these is a second cause of minute-level export even when VONCHANGE = 0.
| Unit Code | Meaning | Value for 1 s | Value for 1 min |
|---|---|---|---|
| 1 | Milliseconds | 1 000 | 60 000 |
| 2 | Seconds | 1 | 60 |
| 3 | Minutes | 0.0167 (rounded to 1 s) | 1 |
| 4 | Hours | 0.000278 | 0.0167 |
If CYCLE_TIME_UNIT = 3 and ARCHIV_CYCLE = 1, the cycle is 1 minute, not 1 second. The Tag Logging Editor rounds the displayed cycle to the nearest unit; the runtime stores the raw values.
Verification Checklist
| Check | Method | Pass Criterion |
|---|---|---|
VONCHANGE is 0 for cyclic tags |
SSMS query on dbo.PDE#TAGs
|
0 for all process-value tags intended to export at fixed cycle. |
ARCHIV_CYCLE and CYCLE_TIME_UNIT match intent |
SSMS query | 1 000 / 2 for 1 s, 1 / 2 for 1 s, etc. |
| Offline Tag Logging Editor agrees | Tag Logging Editor inspection | Archiving type = Cyclical continuous; Acquisition cycle = 1 s. |
| CSV row count over 5-minute window | Export 5-minute trend to CSV | ~300 rows for 1 s cycle, ~30 for 10 s. |
| Timestamp delta in CSV | Open CSV in text editor, inspect two adjacent rows | Delta equals configured cycle within 50 ms. |
| OS time and AS time aligned | Compare WinCC Explorer → Computer → Time | Offset < 1 s. |
| Time synchronization source identical | Windows Time service configuration | Single NTP source or domain hierarchy. |
Troubleshooting Matrix
| Observed Symptom | Likely Column | Likely Value | Fix |
|---|---|---|---|
| Sparse rows, gaps of minutes | VONCHANGE |
2 | Set to 0. |
| Rows exactly 60 s apart | CYCLE_TIME_UNIT |
3 (minutes) | Change to 2 (seconds) and ARCHIV_CYCLE to 1. |
| No rows in CSV despite tag visible online | Tag connection / archive tag not enabled | Archive tag disabled in Tag Logging Editor | Enable archive, recompile OS. |
| CSV shows 1-hour flat-line once per year | DST transition | Local-time stamp | Document as expected; switch to UTC-stamped archive if regulatory. |
| CSV empty after time shift | WinCC archive segment orphaned | Back-end segment ID mismatch | Restart WinCC Runtime; verify segments via WinCC Archive Management. |
| CSV rows correct on operator station, wrong on engineering station | Different OS projects, different runtime DBs | Independent WinCC_<OSName> instances |
Apply fix to each OS independently. |
PCS7 V7.0 Specific Considerations
PCS7 V7.0 uses the WinCC V7.0 runtime engine. Known behaviours relevant to this symptom:
- The OS compile path regenerates the runtime configuration database; in-place edits are wiped on the next compile. Apply the SQL fix as the last step, or include the change in the offline project to make it survive recompile.
- AS-OS coupling via S7-messaging means time on the AS is authoritative for time-stamped events. Mismatched AS time can produce CSV rows stamped at OS time but referencing AS-measured values, which look "drifted" if AS clock drifts.
- The WinCC "Process Historian" component is not available on V7.0 by default; it appears from PCS7 V8.0 onward. The information here applies to the integrated Tag Logging path, not Industrial Information Hub / Process Historian.
Operational Discipline
To prevent recurrence of the sampling-interval drift on PCS7 V7.0 systems, integrate the following checks into the OS commissioning checklist:
- Add a SSMS verification step after every PCS7 migration:
SELECT * FROM dbo.PDE#TAGs WHERE VONCHANGE <> 0and review every row. - Standardize on the
dbo.PDE#TAGsnaming convention in the project glossary so that operators can self-diagnose from CSV output. - Maintain a project-specific time-source policy: single NTP, no manual clock changes on the OS.
- Archive a copy of the post-edit runtime database for the OS maintenance log.
What does VONCHANGE = 2 mean in the PCS7 WinCC runtime database?
VONCHANGE = 2 in the dbo.PDE#TAGs table configures the tag for on-change archiving of a binary or step-quantised signal without hysteresis. The runtime only writes a row when the value flips, which produces sparse minute-scale timestamps for slow or steady process values. Cyclic tags must carry VONCHANGE = 0.
Why does the Tag Logging Editor show "Cyclical continuous" but the CSV still drifts?
The Tag Logging Editor is the offline project view. The runtime configuration database (WinCC_<OSName>) is generated at OS compile time and may diverge due to migration artifacts, hot-fix installations, or manual edits. Inspect the runtime row directly with Microsoft SQL Server Management Studio to confirm the actual VONCHANGE value being applied.
How do I export a WinCC Online Trend to CSV at 1-second resolution?
Verify that VONCHANGE = 0, CYCLE_TIME_UNIT = 2 (seconds), and ARCHIV_CYCLE = 1 in dbo.PDE#TAGs. Restart WinCC Runtime, then use the trend toolbar Save / Export / CSV path. Choose "Ring buffer / swap file" for live data or "Archive" for historical segments. Open the file in a text editor; the timestamp column should show 1-second spacing.
Will setting VONCHANGE = 0 in the SQL database survive an OS compile?
No. The OS compile regenerates the runtime configuration database from the offline project. If the offline Tag Logging Editor still encodes on-change behaviour, the next compile will overwrite the SQL edit. Always reconcile the offline project (set Archiving type to Cyclical continuous) and then perform the OS compile.
Why does my trend show a 1-hour gap after daylight saving time?
WinCC Online Trend Control renders archive values against local time, while the archive back-end stores monotonic process time. When local time shifts by one hour, the back-end skips or duplicates the affected archive rows. This is documented behaviour. To eliminate it for regulated records, use a UTC-stamped archive path or configure the OS and AS from a single NTP source so the transition is consistent.