Problem Statement: Combining Hysteresis and Time-Based Archiving in WinCC
In a PCS7 power plant application, the control room operator requires that an analog process value (for example, a slowly drifting temperature or a noisy flow signal) be archived under two distinct conditions simultaneously:
- Change-driven archiving – record the value into the Tag Logging archive database only when it deviates from the last archived value by more than a defined percentage, e.g. ±2 %.
- Time-driven archiving – record a sample at a fixed interval (e.g. once every minute, or once every two minutes) regardless of whether the change threshold has been crossed.
The intent is to suppress the storage of redundant samples on a high-noise signal while still guaranteeing a minimum chronological trace for diagnostics, trend reconstruction, and regulatory evidence logging. The same requirement exists in legacy Teleperm XP installations, where the archiving subsystem natively supports both an absolute change threshold and a guaranteed logging interval on the same point.
The constraint in WinCC Tag Logging is structural: each archive tag accepts exactly one archiving method – either a hysteresis-controlled event, a fixed acquisition cycle, or a non-cyclic on-demand event. There is no single archive tag that natively supports both "archive on change with hysteresis" and "archive at fixed interval" at the same time.
The standard, field-proven workaround is to define two archive tags that point to the same process tag and configure each archive tag with a different archiving strategy. The two resulting archive rows are then interpreted by the trend, alarm, or external historian consumer as a single logical point.
timestamp as the primary key and to apply a deduplication rule that retains the change-driven record whenever both records fall within the same timestamp window.WinCC Tag Logging Model: Acquisition, Archiving, and Events
Before configuring the dual-tag solution it is necessary to understand the three orthogonal parameters that WinCC Tag Logging exposes for every archive tag. The terminology differs between WinCC V7 (classic) and WinCC Professional (TIA Portal), but the underlying model is identical.
| Parameter | WinCC V7 (Classic) | WinCC Professional / TIA Portal | Function |
|---|---|---|---|
| Acquisition cycle | Acquisition cycle (Tag Management → Tag) | Acquisition cycle (PLC / tag properties) | How often the WinCC runtime reads the raw value from the AS / PLC. |
| Archiving cycle / event | Archiving cycle / Event-driven | Archiving cycle / Event-based archiving | How often (or under what condition) the value is written to the archive database. |
| Hysteresis | Tag Logging → Archive tag → Properties → Hysteresis | Archive tag → Archiving settings → Hysteresis | Defines a dead band around the last archived value. A new value is archived only when the deviation exceeds the threshold. |
How the Hysteresis Mechanism Works
When the archiving method is set to Event-driven with hysteresis, the WinCC runtime compares every newly acquired value (sampled at the acquisition cycle) with the last value that was actually written to the archive. The comparison rule is:
archive_now = ABS( current_value - last_archived_value ) >= hysteresis_value
If the inequality is true, the current value is appended to the archive; if false, the value is discarded. The hysteresis value can be expressed as:
- Absolute – a fixed engineering-unit span (e.g. 1.5 °C, 0.2 bar).
- Relative – a percentage of the last archived value or the configured measurement range, e.g. ±2 %.
The hysteresis check is evaluated at the acquisition cycle rate, not at the archiving cycle rate, so the fastest possible detection latency is one acquisition cycle. If the acquisition cycle is 500 ms and the hysteresis is ±2 %, a 2 % step in the process is detected within 500 ms; a 1.9 % drift is not archived at all until a subsequent cycle pushes the deviation past the threshold.
The Single-Archive-Tag Constraint
For every archive tag, the WinCC Tag Logging editor allows exactly one selection under Archiving → Method:
- Cyclic, with a configurable archiving cycle (1 s, 2 s, 5 s, 10 s, 1 min, … user-defined).
- Event-driven, with a Boolean trigger tag or a script.
- Event-driven with hysteresis (the subject of this article).
- On change (without explicit hysteresis – effectively zero hysteresis).
The two archive tags coexist in the same Tag Logging database. They share the same source process tag, but they produce independent time-stamped records. From a runtime CPU and storage standpoint the overhead is approximately 2× the storage of a single tag and a negligible CPU cost (one extra comparison per acquisition cycle), because the underlying PLC connection is reused.
Dual-Archive-Tag Solution: Step-by-Step Configuration
Prerequisites
- PCS7 V9.x or higher, or any WinCC V7.x / WinCC Professional installation that uses Tag Logging as the process-value archive.
- A WinCC process tag that is already configured in the Tag Management, e.g.
Plant_H1_FT_0231_PV, with a known acquisition cycle (typical: 500 ms, 1 s, 2 s). - Editor access to the Tag Logging configuration (WinCC Explorer → Tag Logging, or TIA Portal → HMI tags → Archive tags).
- If the data will be consumed externally, the WinCC Archive Connector must be installed and licensed as part of the WinCC DataMonitor option.
Step 1 – Create the First Archive Tag (Change-Driven, ±2 % Hysteresis)
- Open Tag Logging in the WinCC Explorer (or the equivalent editor under TIA Portal).
- Right-click the destination archive (typically
PROCESS_VALUE_ARCHIVE) and select Add Archive Tag. - Assign a descriptive name, e.g.
PV_FT_0231_Hyst, and bind it to the WinCC process tagPlant_H1_FT_0231_PVvia the Tag drop-down. - Set the Acquisition cycle to match the underlying process tag's cycle (e.g. 1 s).
- Under Archiving → Method, select Event-driven with hysteresis.
- Set the Hysteresis field to
2and the unit to % (relative to the last archived value). For absolute mode, set the value to the engineering-unit span, e.g.0.4bar. - Confirm the entry and recompile / activate the runtime.
Step 2 – Create the Second Archive Tag (Time-Driven, 1-Minute Cycle)
- In the same archive, add a second archive tag, e.g.
PV_FT_0231_Time, and bind it to the same process tagPlant_H1_FT_0231_PV. - Set the Acquisition cycle to the same value as in Step 1 (it is mandatory that both archive tags read identical raw values).
- Under Archiving → Method, select Cyclic and set the Archiving cycle to
1 minute(or2 minutesif the operator requirement is the longer interval mentioned in the field report). - Confirm the entry. Do not enable hysteresis on this tag – the cyclic method already guarantees the time-based sample.
Step 3 – Verify Tag Logging Compilation
- Open the Tag Logging diagnostics view in the WinCC Explorer.
- Right-click the archive and select Check Compilation. Both archive tags must compile without warnings.
- Activate the runtime. The Tag Logging runtime log (
TagLogRT.txt) will show one line per archive tag, e.g.Archive tag PV_FT_0231_Hyst registeredandArchive tag PV_FT_0231_Time registered.
Step 4 – Confirm the Two Streams at Runtime
Open the Tag Logging – Online Trend viewer and add both archive tags to a single trend window. The expected behaviour is:
- The
_Hysttrace shows step-like samples, each separated from the previous by at least ±2 % of the last archived value. - The
_Timetrace shows one sample per minute on a regular grid, even when the_Hysttrace is quiet. - When the process actually changes by more than 2 %, the
_Hysttrace writes an extra record while the_Timetrace continues to write on its 1-minute grid – the two records will be within a few hundred milliseconds of each other at the same time.
PCS7-Specific Configuration Notes
Within a PCS7 project, archive tags are typically generated automatically by the CFC / SFC compile step using the AS process tag list. The PCS7 Add-on OS Project Editor creates the WinCC archive structure based on the CFC chart's signal category. For the dual-tag approach to work cleanly inside PCS7:
- Configure the signal in the CFC as a standard analog measurement (e.g.
MEAS_MONorCTRLblock output). - After the OS compile, manually add the second archive tag in the WinCC Explorer. PCS7's auto-generation only creates one archive tag per process tag, so the time-driven companion must be added by the engineer.
- Mark both archive tags as belonging to the same archive segment in the Tag Logging editor to ensure consistent partitioning when the archive is rotated to a long-term storage (e.g. the standard PCS7 1-year process-value archive).
- For redundant OS pairs (OS Server A / OS Server B in a PCS7 plant bus), the Archive Connector on the standby server will mirror the active server's archive, including both records.
_Hyst and the _Time streams are restored without any additional engineering effort, provided that the underlying process tag is in the synchronised tag list.Exposing the Combined Archive via the WinCC Archive Connector
The WinCC Archive Connector is part of the WinCC DataMonitor option and is the recommended method for granting external applications read access to the Tag Logging database through the standard WinCC OLE DB provider. The connector abstracts the underlying database (Microsoft SQL Server, in the case of PCS7 V9 and WinCC V7.5+) and presents a stable schema to consumers.
| Connector Setting | Recommended Value | Comment |
|---|---|---|
| Time base | UTC | All archive consumers must agree on the time base. Mixing UTC and local time causes duplicate-key errors when the two streams merge. |
| Time range filtering | Disabled by default; enable per query | The connector should not pre-filter the time range – let the consumer apply the filter to capture both streams. |
| Tag name filter | Use the common prefix PV_FT_0231_
|
Selects both _Hyst and _Time in a single query. |
| Read mode | Snapshot + History | Allows both real-time and historical access. |
A typical consumer query written against the OLE DB provider to merge the two streams looks like the following SQL pattern (executed by an external historian or Excel pivot on the archive database):
SELECT [Timestamp], [Value], 'Hyst' AS Source
FROM dbo.PV_FT_0231_Hyst
WHERE [Timestamp] BETWEEN @Start AND @End
UNION ALL
SELECT [Timestamp], [Value], 'Time' AS Source
FROM dbo.PV_FT_0231_Time
WHERE [Timestamp] BETWEEN @Start AND @End
ORDER BY [Timestamp];
Downstream consumers that require a single value stream (e.g. an OPC UA Historical Access server) can apply a deduplication window of one second: the latest record in the window wins. This eliminates the visual duplication of the two streams in trend views and reports.
Comparison with Teleperm XP Archiving
| Feature | Teleperm XP | WinCC Tag Logging |
|---|---|---|
| Single point, two archiving rules | Native – multiple "event handlers" per point | Not native – requires two archive tags |
| Change-driven + hysteresis | Yes, with absolute or relative threshold | Yes, per archive tag |
| Guaranteed time-driven sample | Yes, parallel to the change rule | Yes, via second archive tag |
| Configuration file | Resource text file (point definition) | Tag Logging database (binary / SQL) |
| Number of database rows per point | Single merged stream | Two independent streams |
For migration projects from Teleperm XP to PCS7 / WinCC, the engineering effort of the dual-tag workaround is small (approximately 30 minutes of work per affected point) and is a one-off cost that does not affect the runtime behaviour visible to operators.
Verification, Commissioning, and Operational Diagnostics
Functional Verification Checklist
- Compile – both archive tags must compile without warnings.
-
Runtime registration –
TagLogRT.txtmust contain one registration line per archive tag. -
Step response – apply a simulated step of ±3 % on the process tag; the
_Hystarchive must contain exactly one record at the time of the step, and the_Timearchive must contain one record within the next 1-minute boundary. -
Steady state – leave the process constant for 10 minutes; the
_Timearchive must contain 10 records, the_Hystarchive must remain empty. -
Sub-threshold noise – apply a noise signal with peak-to-peak amplitude of 1.5 %; the
_Hystarchive must remain empty, the_Timearchive must contain one record per minute.
Diagnostic Tools and Files
-
TagLogRT.txt– runtime log of the Tag Logging subsystem. Located in the WinCC project directory under<ProjectName>/<ComputerName>/Logs/. -
CCAlgRt.log– alarm logging runtime log; useful if the archive tag is also exposed as an alarm source. - WinCC Tag Logging – Online Trend – native viewer for verifying the two streams in the WinCC Explorer.
- DataMonitor Web – browser-based view of the same archive, useful for remote commissioning from the engineering station.
- SQL Server Management Studio – direct query of the underlying Tag Logging tables when the Archive Connector is not available.
Common Field Issues and Resolutions
| Symptom | Likely Cause | Resolution |
|---|---|---|
| Time-driven archive produces 0 records after commissioning | Archiving cycle set to a longer interval than the runtime test window; or the process tag has not been triggered by the AS yet | Reduce the archiving cycle to 5 s for the FAT, then restore the production value |
| Hysteresis archive overwrites the same value repeatedly | Relative hysteresis calculated against a near-zero archived value | Switch to absolute hysteresis or scale the process tag to a normalised range |
| Trend view shows duplicated samples at the same timestamp | Two archive tags both write at the same instant when the process changes by more than 2 % on a 1-minute boundary | Apply the deduplication window in the consumer (see OLE DB query above) |
| Archive stops after PCS7 OS switch-over | The second archive tag was not included in the OS Server's project synchronisation list | Add the second archive tag to the OS project editor and re-deploy both servers |
| Storage fills up unexpectedly | Each archive tag writes a separate row; combined rate is roughly the sum of the two streams | Increase the hysteresis to 5 % if the process allows, or switch the time-driven archive to a longer interval (e.g. 5 min) |
Parameter Reference Summary
| Parameter | Archive Tag 1 (Change-Driven) | Archive Tag 2 (Time-Driven) |
|---|---|---|
| Name (example) | PV_FT_0231_Hyst |
PV_FT_0231_Time |
| Bound process tag | Plant_H1_FT_0231_PV |
Plant_H1_FT_0231_PV |
| Acquisition cycle | 1 s (must match Tag 2) | 1 s (must match Tag 1) |
| Archiving method | Event-driven with hysteresis | Cyclic |
| Hysteresis value | 2 % (relative) or 0.4 bar (absolute) | N/A |
| Archiving cycle | N/A (event-driven) | 1 minute (or 2 minutes per source) |
| Expected storage | Sparse – only on change | Dense – one row per cycle |
Best Practices for Production Deployments
-
Name both archive tags with a common prefix (e.g.
PV_FT_0231_HystandPV_FT_0231_Time) so the Archive Connector filter pattern and SQL queries are simple wildcards. - Apply identical acquisition cycles to both archive tags to ensure that the time and the change events see the same source values.
- Document the deduplication rule in the engineering HMI documentation so future modifications know that the two streams are intentional.
- Re-evaluate the hysteresis value after one month of operation. The source value of ±2 % is a rule of thumb – adjust to the actual process noise level so that 95 % of the values are within the dead band and the archive does not become a noise record.
- For regulatory logs, keep the time-driven archive at 1 minute and never lower the hysteresis below the meter's repeatability specification.
- For performance logs, a 2-minute time-driven archive with a ±1 % hysteresis is usually sufficient and halves the storage cost.
Can a single WinCC archive tag archive on hysteresis and on a fixed cycle at the same time?
No. Each archive tag in WinCC Tag Logging accepts exactly one archiving method: cyclic, event-driven with hysteresis, or on-change without hysteresis. The standard workaround is to create two archive tags bound to the same process tag, one configured for hysteresis and one for the fixed cycle.
What happens if the relative hysteresis is set to 2 % but the process value hovers near zero?
The relative hysteresis is calculated against the last archived value. When the archived value is small, the absolute dead band becomes a fraction of an engineering unit and the hysteresis check effectively becomes a no-op. Switch to an absolute hysteresis (engineering-unit span) or scale the process tag to a normalised range so the 2 % threshold is meaningful at all operating points.
Will the duplicate records from the two archive tags double the storage cost?
Approximately yes. The hysteresis-driven stream is sparse and contributes only on process changes, while the time-driven stream contributes one row per archiving cycle. The combined storage is roughly the time-driven volume plus a small overhead for the change events. In a typical 1-minute time-driven archive with ±2 % hysteresis on a slowly drifting signal, the combined volume is between 1.0× and 1.1× of the time-driven volume alone.
How are the two archive streams read by an external historian?
The recommended method is the WinCC Archive Connector included with the WinCC DataMonitor option. The connector exposes the Tag Logging database through the WinCC OLE DB provider. External consumers issue a single SQL query that uses UNION ALL on both archive tag tables and orders the result by timestamp, optionally with a deduplication window of one second.
Is the dual-tag pattern supported in PCS7 OS redundancy?
Yes. The two archive tags are bound to the same WinCC process tag, which is in the synchronised tag list of the OS Server pair. After a switch-over, the new active server rebuilds the archive from the synchronised segments, and both the hysteresis and the time-driven records are restored without additional engineering.