WinCC Function Trend Control: Retain Last N Points in X-Y Plot

David Krause11 min read
SiemensTroubleshootingWinCC
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

Overview

The WinCC Function Trend Control in WinCC V7 (and the corresponding object in WinCC Unified) plots a process value (Y) as a function of another tag (X). Unlike the standard Trend Control, the Function Trend Control is intended for X-Y relationships such as characteristic curves, calibration tables, vector plots, and process state visualizations where the abscissa is itself a measured variable rather than wall-clock time.

A common engineering problem on the control-room floor is that the Function Trend Control appears to "forget" older points when the source tags stop updating. The user expects the last N measured (X, Y) pairs to remain visible indefinitely; instead, the curve degenerates to a single dot at the most recent value. The behavior is not a bug — it is a property of the buffering, axis-mode, and replace-on-overflow settings of the control.

This reference explains the root cause, lists every relevant control property, and provides verified configuration sequences for retaining the last 20 (or any fixed number of) value pairs in WinCC V7 SP3/SP4 Function Trend Control and the equivalent object in WinCC Unified V17/V18/V19/V20.

Scope note. The discussion below targets measured-points mode (N most recent samples), not time-range mode (all samples within a moving window). The two modes use different internal buffers and obey different display rules; do not mix them when diagnosing disappearing points.

Problem Description

Symptom observed in the field on WinCC V7:

  • Function Trend Control is configured with two trends (e.g. Trend A = orange, Trend B = green).
  • Source is either an online tag pair or a tag archive pair.
  • Configuration sets the X-Y plot to measured points = 20 pairs per trend.
  • During runtime, when both X and Y tags stop changing, the dots begin disappearing one at a time.
  • After several minutes (or after the configured time range elapses), only the current (X, Y) pair is visible for each trend.
  • If the tags resume updating, the new dots appear at the head of the trend and old dots are not retained.

Expected behavior: the runtime should permanently display the previous 10–20 pairs per trend, regardless of whether the tags are actively changing.

Root Cause Analysis

The Function Trend Control internally maintains a fixed-size ring buffer for each trend. In measured points mode, when no new acquisition cycle produces a new sample, the control does not freeze the existing buffer — depending on the X-axis mode, the buffer is either re-mapped to a moving X window or the existing samples age out of the configured range. The three dominant causes are:

  1. X-axis mode is "Time" or "Time range" with an implicit or explicit moving window. When samples stop arriving, the window continues to slide forward in time, and old points fall outside the visible time range and are discarded.
  2. Source is an archive tag configured with a relative time range (e.g. "last 5 minutes") instead of a measured-points archive query. The archive delivers only samples within the range; once the range has no new samples, the display window empties.
  3. Online tag buffer size or replace policy on the tag itself is set to a smaller value than the trend, so the source produces fewer points than the trend is willing to display.
Key insight. To retain the last N pairs permanently, the X-axis must not be time-relative. Use an index axis (a monotonically increasing counter tag) or a tag-based axis with a fixed lower/upper bound, and source the data from an online tag with an N-element internal buffer.

Prerequisites

  • WinCC V7 SP3 or SP4 (legacy branch) or WinCC Unified V17 / V18 / V19 / V20 (TIA Portal).
  • For V7: Graphics Designer with the Function Trend Control inserted on a process picture (palette → Controls → WinCC Function Trend Control).
  • For Unified: TIA Portal with a Unified PC or Unified Comfort Panel; insert the Function trend control from the toolbox under Controls.
  • Two WinCC tags per trend: one Y tag (the value to plot) and one X tag (the function input). For an index-based axis, an additional monotonic counter tag is required.
  • Tag must be configured with the appropriate update cycle and buffer length (see property reference below).

Configuration — Step-by-Step Procedure (WinCC V7)

Step 1 — Select the X-axis mode

  1. Open the process picture in Graphics Designer.
  2. Double-click the Function Trend Control to open the Configuration dialog.
  3. Switch to the Trends tab and select the trend to fix.
  4. Switch to the X axis tab.
  5. Set Source = Tag (instead of "Time" or "Time range").
  6. Bind the X-axis to either the same X tag used for the function, or to a dedicated index counter tag.

Step 2 — Configure the measured-points buffer

  1. In the same Configuration dialog, open the trend's Curve tab.
  2. Set Display values = Measured points.
  3. Set Number of measured points = 20 (or your desired N).
  4. Confirm that Source / Data source is set to Online, not Archive, for this scenario.

Step 3 — Verify the tag buffer

  1. Open Tag Management in WinCC Explorer.
  2. Select the Y tag and the X tag used by the trend.
  3. In the Properties dialog, confirm Update cycle matches the desired sampling rate.
  4. Confirm that the tag is not declared with "read-only archive" semantics that would prevent buffer accumulation.

Step 4 — Replace-policy check

  1. In the trend's Curve tab, locate Replace old values when buffer is full.
  2. Set it to Yes. The ring buffer must wrap so that the last N values are kept indefinitely.
  3. Save, compile, and start Runtime.

Configuration — Step-by-Step Procedure (WinCC Unified)

  1. In the Unified screen, select the Function trend control.
  2. In the properties pane, expand Trends > [Trend N].
  3. Set Source type = Tag (not "Log tag").
  4. Bind Y value to the process tag and X value to the X-axis tag (or the index counter).
  5. Set Number of measured points = 20.
  6. Set Replace old values = true.
  7. Set the X-axis Mode to Value range or Tag (never Time).
  8. Compile and load the project.

Property Reference — Function Trend Control

Property Location in V7 Config dialog Required Value Effect
Display values Trend → Curve Measured points Buffer holds last N samples, not a time window.
Number of measured points Trend → Curve 20 (or N) Size of the ring buffer per trend.
Source / Data source Trend → Curve Online Use live tag buffer; archives use time-window semantics.
Replace old values when buffer full Trend → Curve Yes Ring-buffer wrap; otherwise buffer stops accepting new samples.
X axis → Source Trend → X axis Tag Decouples display from wall-clock; fixes the X range.
X axis → Tag Trend → X axis Index counter or fixed-bound tag Drives the abscissa with a non-aging value.
X axis → Lower/Upper bound Trend → X axis 0 / 20 (when using index) Window must contain at least N samples to avoid clipping.
Time range / Time axis Trend → X axis Disabled or "Tag" mode Removes the moving window that causes disappearing points.

Online Tags vs Archive Tags — Which to Use

Source Retention of last N when tags idle Recommended?
Online tag, X axis = Tag, Measured points, Replace = Yes Yes — buffer persists until overwritten by new sample Yes — primary recommendation
Online tag, X axis = Time, Measured points No — X window slides; points leave visible range No
Archive tag, Time range query No — query window slides forward in time No
Archive tag, fixed start/stop query Yes if query is static and the archive holds the data Acceptable for historical review, not for live retention
Caution. Archive tag sources in WinCC V7 typically deliver a sliding time window. The disappearing-dot symptom is a direct consequence of using a time-relative archive query to drive a measured-points trend. Switch the data source to Online for fixed-N retention.

Common Configuration Mistakes

  1. Leaving the X axis in Time mode. The most common cause; even measured points appear to age out because the visible time window advances.
  2. Setting a fixed time range on a measured-points trend. The two are mutually exclusive interpretations of the buffer; mixing them produces the disappearing-dot symptom.
  3. Using a "relative time range" on the archive query. Replace it with a static query or move to online tags.
  4. Leaving "Replace old values when buffer is full" off. The trend freezes once the buffer is full; new samples are dropped silently.
  5. Counter tag wraps or resets. If the index counter is reset to zero, the trend will re-plot the early samples and discard the late ones. Use a 32-bit or 64-bit counter that monotonically increases across the full session.
  6. Different update cycles for X and Y. Mismatched cycles cause unaligned (X, Y) pairs; configure identical cycles on the tag properties.

Verification Steps

  1. Start Runtime; populate the trend with live data for at least 2N cycles so the buffer wraps.
  2. Stop updating the source tags (e.g. by disabling the PLC update or forcing the tags in Tag Simulation).
  3. Wait 5–10 minutes (longer than any time range you might have left enabled).
  4. Confirm that the last 20 pairs are still visible for each trend.
  5. Resume tag updates and confirm that new samples appear at the head and the oldest 20 are evicted in order.
  6. Open the trend's online diagnostics in WinCC Explorer → Graphics → right-click the picture → Properties of Function Trend Control; verify the buffer fill level reports the configured N.

Workarounds for Legacy Projects That Cannot Switch to Online Tags

If the project is bound by archived data (regulatory retention, historian requirements), retain the archive source but add a thin online shadow:

  1. Create a small set of online tags that mirror the last N samples of each archived trend using a C or VBS action in the WinCC Global Script runtime.
  2. Configure the Function Trend Control to read the online shadow tags with the X-axis in Tag mode.
  3. Schedule a periodic script that copies the newest N archive samples into the shadow tags on a 1 s cycle.

This is functionally identical to keeping the data on online tags and avoids the time-window problem of the archive query.

Compatibility Notes

Version Behavior of measured points with archive source Behavior with online source + Tag X axis
WinCC V7.0 / V7.0 SP1 Time-windowed; N not retained when idle Retains N as long as buffer is allocated
WinCC V7.2 / V7.3 / V7.4 Time-windowed; N not retained when idle Retains N with Replace = Yes
WinCC V7.5 SP2 Time-windowed; same behavior Retains N; adds online shadow API
WinCC Unified V17 / V18 Log tag mode is time-windowed by default Tag mode retains N when Replace = true
WinCC Unified V19 / V20 Log tag mode remains time-windowed Tag mode retains N; richer trigger options

For property-level documentation in WinCC V7, refer to the official manual Properties of the Function Trend Control - WinCC. For Unified, the equivalent reference is Function trend control (RT Unified) - WinCC Unified and the related Trend control (RT Unified) - WinCC Unified.

Field Commissioning Checklist

  • Function Trend Control inserted on the runtime picture with two configured trends.
  • Y tags exist in WinCC tag management and have the correct update cycle (typically 500 ms or 1 s for slow processes).
  • X-axis mode is Tag, not Time.
  • Display values = Measured points; Number = 20.
  • Replace old values = Yes.
  • Data source = Online (unless the archive shadow workaround is in use).
  • Tag X lower/upper bound set wide enough to display 20 pairs without clipping.
  • Verification: stop updates, wait, confirm last 20 pairs are still visible.

Why do my plotted points disappear one by one when the tags stop updating?

The Function Trend Control is in measured-points mode but the X-axis is set to Time or the source is an archive with a relative time range. The visible window advances in time, so old (X, Y) pairs fall outside the visible range even though the buffer has not been cleared. Switch the X-axis to Tag mode and the data source to Online.

What is the difference between measured points and time range in Function Trend Control?

Measured points holds the last N samples in a ring buffer regardless of when they arrived. Time range holds every sample within a moving or fixed time window. Use measured points when you need a fixed-N history; use time range when you need a calendar-aligned view.

Can I use archive tags and still retain the last 20 pairs?

Not directly. Archive tag sources are time-windowed in WinCC V7 and Unified. Use a Global Script or a small online shadow tag array to mirror the newest N archive samples, then drive the Function Trend Control from the shadow tags with the X-axis in Tag mode.

What does "Replace old values when buffer is full" actually do?

It enables ring-buffer wrap. When the N-element buffer is full, the next incoming sample overwrites the oldest sample, so the trend continues to scroll instead of freezing. With it disabled the buffer stops accepting new samples once full.

Does this also apply to WinCC Unified?

Yes. In WinCC Unified V17–V20 the same logic applies: set Source type = Tag, Number of measured points = 20, Replace old values = true, and X axis Mode = Value range or Tag. See the Unified manual for property names that differ slightly from V7.

Back to blog