Resolving PCS 7 APL Trend Not Retaining Archived Values

David Krause11 min read
SCADA ConfigurationSiemensTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Problem Overview

The Siemens PCS 7 Advanced Process Library (APL) faceplate trend view is one of the most frequently used operator diagnostics, displaying the time series of a process tag either from the live connection or from the historical Process Value Archive (PVA). A recurring field complaint is that the trend is plotted correctly while the faceplate is open, but the moment the operator closes the faceplate and reopens it, the curve starts at the current time and only a short sliding window of values is shown. No historical back-fill from the archive is loaded.

The same process tag, when displayed in a manually inserted WinCC Online Trend Control configured with a Process Value Archive tag, works as expected: the curve opens with full historical depth and retains the value when re-opened. This contrast is the single most useful diagnostic clue: the archive connection itself is healthy, the tag is being logged, and the issue is isolated to how the APL faceplate binds the trend to its data source.

Symptom summary: APL trend shows Online values only (default approx. 60 min window). Closing the faceplate drops the buffer. Re-opening restarts the curve at "now". A standalone Online Trend Control bound to the same archive tag shows the full archive history correctly.

Root Cause: TrendProvider Property Default

The APL faceplate is a fully dynamic WinCC picture. Its trend view is a WinCC Online Trend Control instance with a script-driven configuration. Two data sources are possible:

TrendProvider value Source Behavior on faceplate open Behavior when re-opened
1 Process Value Archive Trend loads from archive with configured time range History is preserved; curve starts at the configured back-fill time
2 Online (live tag / connection) Trend shows the in-memory buffer only (default ~60 min) Buffer is lost; curve restarts at "now"

The default value of the internal TrendProvider property in PCS 7 APL revisions is 2 (online). This default is hard-coded into the APL block icons and is also re-applied whenever the global C-script APL_SetTrendProvider is executed. Engineers who migrate from earlier PCS 7 versions or who apply newer APL style updates frequently re-introduce the = 2 default without realizing the side effect on the operator experience.

How the APL Faceplate Binds the Trend Source

When a CFC chart instance is compiled, the APL block icon (for example MOT_SPEED, VALVE_ANA, PID_STD) generates a faceplate picture into the @PCS7_Typicals picture tree. The faceplate contains a WinCC Online Trend Control whose Trend Window properties are configured by C-action at runtime, not at compile time. Two events trigger the binding:

  1. On open: The script reads the block instance's sTrendTag connection (the process tag) and assigns it as a DataSource.
  2. On configuration change: The global script APL_SetTrendProvider (located in the WinCC Explorer under Global Script → C-Editor → Standard Functions) re-applies the TrendProvider value to all currently loaded faceplates.

If APL_SetTrendProvider contains TrendProvider = 2;, every faceplate will be forced to use the live (online) source. Conversely, setting it to TrendProvider = 1; forces the archive source for every faceplate that does not override it locally.

Diagnostic Procedure

Perform the following checks in order before changing any script. Each step confirms one element of the data flow.

  1. Verify archive configuration in WinCC Explorer → Tag Logging → select the relevant archive. The process tag must be present in the archive configuration and have Archiving set to Yes with a sensible acquisition cycle (1 s, 10 s, 1 min, etc.) and a storage cycle matching or slower than the acquisition cycle.
  2. Verify runtime logging: open the WinCC Online Trend Control on a spare picture, insert the same process tag, and confirm the historical curve is drawn. If this fails, the archive itself is broken and the APL faceplate issue is a symptom of a deeper problem.
  3. Inspect APL_SetTrendProvider on the engineering station and the OS server. Open Global Script → C-Editor → APL_SetTrendProvider and search for the assignment to TrendProvider.
  4. Inspect the faceplate instance property: open one of the affected block icons in the CFC/SFC chart, switch to the Block icon tab, and inspect the Faceplate properties. In PCS 7 V9.0 SP3 and later, the TrendProvider is exposed as a configurable faceplate property that can override the global default per instance.
  5. Check the WinCC project version: confirm the OS server is running a compiled OS with the same APL revision as the ES. A mixed ES/OS revision (for example ES V9.1 compiling against an OS V9.0) can silently fall back to the older default of TrendProvider = 2.

Solution A: Switch the Global Default to Archive

This is the simplest fix and is appropriate when the operator philosophy is all APL trends show archive history.

  1. Open the OS server project in WinCC Explorer on the engineering station.
  2. Navigate to Global Script → C-Editor.
  3. Open the standard function APL_SetTrendProvider.
  4. Locate the line similar to: SetPropWord(lpszPictureName, "Control1", "TrendProvider", 2);
  5. Change the value from 2 to 1:
SetPropWord(lpszPictureName, "Control1", "TrendProvider", 1);
  1. Compile the OS server. Do not skip compilation; the change is in the runtime project, not the source.
  2. Download the OS to the target server and activate runtime.
  3. Open any APL faceplate, close it, re-open it, and confirm the historical curve is back-filled from the archive.
Bulk effect: Modifying the global C-script applies the new default to every APL faceplate in the project. For plants where some loops need online-only behavior (for example, fast safety loops that must not show stale data), use Solution B instead.

Solution B: Override TrendProvider Per Faceplate Instance

For mixed plants, configure the property at the faceplate instance level.

  1. In the CFC/SFC chart, double-click the block icon of the affected instance.
  2. Open the Block icon tab and click the faceplate configuration button (PCS 7 V9.0+ uses the Faceplate properties dialog).
  3. Set TrendProvider to 1 (Archive) for the loops that need historical back-fill.
  4. Leave it at 2 (Online) for fast safety or interlock loops where archived values would mislead the operator.
  5. Recompile the OS and download.

Per-instance overrides survive recompilation of the global C-script, so this is the recommended pattern for large retrofit projects.

Solution C: Switch the Trend Time Range

If the global default must remain 2 (online only) for plant-policy reasons, an alternate remedy is to enlarge the in-memory buffer of the WinCC Online Trend Control so the curve looks "deep" even though it is not coming from the archive.

  1. Open the APL faceplate master picture (typically @Faceplate_Master.pdl in the Master data folder of the OS project).
  2. Open the embedded Online Trend Control and change the Time range from the default 60 min to the desired window (commonly 8 h or 24 h).
  3. Save and recompile the OS.
Limitation: the buffer is still RAM-only. On a server restart, on a picture change of the area that owns the faceplate, or after a redundant server failover, the curve resets to "now". Use this option only for non-critical loops and only when archive storage costs are a concern.

Archive Configuration Checklist

Even with the correct TrendProvider = 1 setting, the APL faceplate will not draw history if the archive configuration is wrong. Verify the following on the OS server:

Item Required setting Where
Tag is in archive configuration Tag present, <Online> column ticked WinCC Explorer → Tag Logging → Archive configuration
Archiving enabled Yes, with cycle matching acquisition Tag properties → Archive
Archive is online Status indicator green WinCC Explorer → Tag Logging → Status
Segment size / path Free disk > 20 % of segment size Tag Logging → Archive configuration → Paths
Time base of OS server Synchronized with ES and clients OS server control panel → Time
Redundant server pairing Both partners archive independently Redundancy → Server data

Verification Tests

After applying the fix, run the following three operator-style tests:

  1. Reopen test: open the faceplate, wait 30 s, close it, wait 5 min, reopen it. The trend must show values for the closed period.
  2. Server failover test: on a redundant OS server pair, force a failover while the faceplate is closed. After the standby takes over, reopen the faceplate and confirm the curve is continuous.
  3. Time range test: in the trend view, scroll the time axis back to 24 h and confirm the archive contains the expected density of points. Missing data indicates an acquisition/storage cycle mismatch.

Troubleshooting Matrix

Symptom Likely cause Fix
Trend shows only the last ~60 min after reopening faceplate TrendProvider = 2 (online default) Change APL_SetTrendProvider to 1 or set per-instance override
Standalone Online Trend Control works, APL trend does not Faceplate-specific binding, not archive Apply Solutions A or B above
Even with TrendProvider = 1 the curve is empty Tag not in archive configuration Enable archiving in Tag Logging
Curve is correct on server A, empty on server B Archive not replicated or segment path missing Check redundancy and archive paths on both partners
After OS download, old behavior returns OS was not fully recompiled after script change Full OS compile, not incremental; re-download
Trend freezes at one timestamp on failover AS-OS time drift > 1 s Synchronize time via NTP on all servers and AS stations
Operator reports stale values after long downtime Archive segment archived to slow storage Check swap-in/swap-out path and segment retention

Version-Specific Notes

PCS 7 V8.2 / V9.0: The APL_SetTrendProvider C-script is delivered in the master data library. After an APL style update, Siemens typically resets the value to 2. Compare the project copy against the reference master and re-apply 1 if the plant policy is archive-by-default.

PCS 7 V9.1 / V9.1.1: The TrendProvider became a configurable faceplate property in the block icon editor. Per-instance overrides are first-class citizens and are stored in the CFC chart, which is the recommended pattern for new projects.

PCS 7 V10.0 (TIA-based): The script name is preserved for compatibility, but the trend binding also accepts a TrendSource tag attribute on the HMI tag itself. Engineering is performed in the TIA Portal HMI part; the C-script approach still works for migrated projects.

Field-Proven Caveats

  • The C-script change is in the OS runtime project. Editing the source on the ES is necessary but not sufficient; the OS must be compiled and downloaded.
  • On a redundant OS server pair, the script must be edited on both server projects. Master/server synchronization only replicates runtime data, not project source.
  • If the plant uses Load Online Changes (incremental download), the C-script edit requires a full OS compile and download. The compiler will issue a warning when a global script has changed.
  • Do not change the TrendProvider at runtime via a button or faceplate script. The runtime value is overwritten by the global C-script on every picture change, so a runtime override is lost.
  • For regulated or validated plants (FDA, GAMP), document the TrendProvider change in the change control record. The default is a functional behavior, not a cosmetic setting, and is in scope for validation impact assessments.

Related Settings Worth Auditing

While reviewing APL_SetTrendProvider, audit the following adjacent APL globals for consistency:

  • APL_SetTrendTag: binds the trend's process tag to the faceplate instance. If this is broken, the curve plots the wrong variable or nothing at all.
  • APL_SetTrendColor: defines the per-instance color. Useful when multiple blocks are overlaid in a single faceplate view.
  • APL_OpenFaceplate: the script that opens the faceplate picture. Its TrendProvider argument determines whether the per-instance override is honored.

FAQ

Why does my APL faceplate trend reset to the current time every time I close and reopen it?

The TrendProvider property of the embedded Online Trend Control is set to 2 (online), which only buffers the last ~60 min in memory. Change the value to 1 in the global C-script APL_SetTrendProvider (or override it on the specific block icon) to bind the faceplate trend to the Process Value Archive so historical values are back-filled on every reopen.

Where do I find the APL_SetTrendProvider script in PCS 7?

It is located in the OS project on the engineering station under WinCC Explorer → Global Script → C-Editor → Standard Functions. The relevant line is typically SetPropWord(lpszPictureName, "Control1", "TrendProvider", 2);. Edit it, fully recompile the OS, and download it to the OS server. On a redundant server pair, edit and download the change on both server projects.

The standalone WinCC Online Trend Control shows archive history correctly, but the APL faceplate does not. What does that mean?

It confirms the archive, the tag logging configuration, and the connection are healthy. The fault is isolated to the APL faceplate binding, almost always the TrendProvider property defaulting to 2. Fixing the C-script (or per-instance override) restores the archive binding without any change to the archive configuration itself.

Can I keep the global default at online (2) and still have archive history on selected loops?

Yes. In PCS 7 V9.0 SP3 and later, TrendProvider is exposed as a configurable faceplate property on each block icon. Set it to 1 (archive) on the loops that need history, and leave the global default unchanged. Per-instance overrides survive recompilation of the global C-script, which is the recommended pattern for mixed plants.

After changing APL_SetTrendProvider and downloading, the trend is still empty. What should I check next?

Verify that the process tag is in the archive configuration with archiving enabled, the archive segment path has free disk space, the OS server time is synchronized with the AS, and the OS was fully compiled (not just incrementally). On redundant server pairs, also confirm the script change was downloaded to both partners and that the archive is online on the partner that the operator is currently connected to.

Back to blog