Configuring Value-Axis Trends in WinCC Flexible HMI Systems

David Krause16 min read
HMI / SCADASiemensTutorial / How-to
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: Why Value-Based X-Axis Trends Are Required

Standard HMI trend objects plot process variables against time on the horizontal axis. In converting, extrusion, papermaking, coating, and web-handling lines, this time-base hides the true physical relationship between a quality variable and the consumed material length. The thickness profile versus meters produced is the unit an operator and quality engineer actually use to grade a roll. Plotting thickness versus wall-clock time makes a uniform-speed run appear to drift and makes a slowdown appear as a thickness excursion; both are visualization artifacts, not process faults.

The Siemens WinCC Flexible runtime and its successor WinCC Comfort/Advanced in TIA Portal expose a Tag/Constant selection on the trend x-axis that binds the horizontal axis directly to a PLC tag such as a meter counter. This article walks through the configuration, the required PLC tag types, the log file mechanics, programmatic start/stop of logging, and equivalent implementations on Beijer iX trend viewers, AutomationDirect C-more line trend graphs, and Schneider EcoStruxure Building Operation meter trend logs so the same problem can be solved across mixed-vendor fleets.

Prerequisites: Tags, Firmware, and HMI Platform

Before changing trend configuration, confirm the following items are in place on the engineering station and the runtime station.

Item Requirement Notes
Engineering software WinCC Flexible 2008 SP2/SP3/SP5 or TIA Portal V13 SP1+ with WinCC Comfort/Advanced The x-axis "Mode = Tag" property was introduced in WinCC Flexible 2005; service packs add circular log options and tag-event start/stop behavior.
HMI panel runtime Comfort Panel, Mobile Panel 277, or PC Runtime with matching image version Basic Panels (KP300, KTP series) support value-axis trends only on firmware V13.0.0+ when configured in TIA Portal.
PLC connection MPI / PROFINET / Ethernet with HMI tag DB area mapped to controller tag Meter counter must be reachable through the HMI's configured connection partner.
PLC tag - meters REAL (LREAL on S7-1500) or DINT counter incrementing per encoder pulse WinCC Flexible trend x-axis accepts numeric tags; BOOL, STRING, and WORD are not supported.
PLC tag - thickness REAL in engineering units (mm, µm, g/m²) No scaling at the PLC is required; HMI tag scaling can apply if the controller tag is already in raw counts.
Log destination Internal flash, Multi Media Card, USB, or network path SD / USB write cycles become a maintenance item on 24/7 lines; rotate media annually.
Critical: Trend data is sampled at the HMI tag acquisition cycle, not the PLC scan time. If the meter counter increments by 1 mm per pulse and the HMI polls at 1 s while the line runs at 50 m/min, every sample covers 833 mm of material and the resulting curve will show visible stair-steps. Tighten the acquisition cycle to 100-250 ms for converting lines.

WinCC Flexible Trend View Architecture

A trend view in WinCC Flexible is built from three cooperating objects: one or more trend curves (each bound to a logged tag), the trend view container that defines the visualization area, and the data log that stores the historical samples on the runtime file system. The x-axis is a property of the trend view, not of the curve, so changing it affects every curve in the view.

Under the General node of the Trend View properties, the X-Axis section exposes three settings: Mode (Time / Tag / Constant), Tag (the PLC variable that drives the x position), and Value Range. In Time mode (default), the X axis is a clock interval. In Constant mode, the X axis is a user-defined numeric scale (for example, 0-1000 meters). In Tag mode, the X position of every sample is taken directly from the configured tag value at the moment the sample is logged. Only Tag mode produces a true thickness-vs-meters chart on a continuously running line.

HMI Trend View - X-Axis Mode Selection Time (default) Constant Tag (PLC value) x = t (clock)Sample every 1 s x = fixed scalee.g. 0..1000 m x = PLC tag valuemeters at sample time Pick "Tag" mode to bind x-axis to the meter counter tag.

Configuring the X-Axis as a Value (Tag / Constant Mode)

  1. In the WinCC Flexible project tree, open Trends → Trend Views and double-click the trend view to edit.
  2. In the Properties window, navigate to General → X-Axis.
  3. Set Mode = Tag for a true thickness-vs-meters chart, or Mode = Constant if a static numeric scale independent of the actual line length is acceptable.
  4. Under Tag, click the selector and choose the HMI tag that is linked to the PLC meter counter (REAL or DINT).
  5. Under Value Range, enter the visible X span, e.g. 0-5000 meters for a 5 km run. This is the displayed window only; the underlying log retains every sample.
  6. Configure Y-axis ranges for each curve (thickness and any second trend) under Y-Axis → Value Range.
  7. Compile and download the project; verify the trend view is set to "Display values from data log" rather than "Online" so historical samples are visible after a restart.
  8. On the runtime panel, toggle the LoggingActive tag and confirm that new samples appear at the correct x position.
Tag type rule: If the meter counter is a DINT and the HMI tag is configured as REAL, the runtime will reject the binding with Event Log entry "Trend X-axis: invalid tag type". Either keep the tag as DINT (acceptable for axes) or add a MOVE / REAL_CAST in the PLC to mirror the counter into a REAL tag dedicated to the trend.

Setting Up the Trend Tags and PLC Variables

The PLC-side tag is the source of truth for the x-axis position. The recommended pattern is to increment a non-resettable LREAL / DINT in the line encoder OB and expose a scaled REAL to the HMI. A minimal SCL example for an S7-300/1500:

// SCL - Cycle OB
// Inputs
"line_encoder_pulse" : BOOL;   // 1 pulse per 5 mm
"line_speed_m_per_min" : REAL; // from drive

// Statics / DB tags
"MeterCounter_m" : LREAL;      // monotonic, written to HMI
"Thickness_um" : REAL;         // from gauge

// Increment counter per pulse
IF "line_encoder_pulse" AND NOT "line_encoder_pulse_prev" THEN
    "MeterCounter_m" := "MeterCounter_m" + 0.005;
END_IF;
"line_encoder_pulse_prev" := "line_encoder_pulse";

// HMI tag scaling (optional)
"MeterCounter_HMI" := REAL_TO_REAL("MeterCounter_m");
"Thickness_HMI"   := "Thickness_um" / 1000.0; // to mm

On the HMI side, declare the tags with the following configuration:

HMI tag PLC address Type Acquisition cycle Log file
MeterCounter_HMI DB100.DBD 0 (REAL) REAL 250 ms MeterLog.csv
Thickness_HMI DB100.DBD 4 (REAL) REAL 250 ms ThicknessLog.csv
LoggingActive DB100.DBX 8.0 BOOL 100 ms -

Both logs share the same x-axis because they are written from the same trend view. A single trend view can carry multiple curves; if the thickness curve is plotted in Y1 and the meter value in Y2 the operator still sees two graphs on a value-driven axis. Where the meter counter is incremented inside a fast OB (e.g. OB35 at 1 ms) the DB value can be read by the HMI at any rate without losing encoder pulses; the HMI acquisition rate only sets the x-axis sampling, not the counter precision.

Multi-Curve Display: Thickness and Meters

If the goal is to show thickness vs. meters (one curve) and a second plotted quantity (line speed, position feedback, roll diameter, etc.), enable two trend curves under the same trend view. WinCC Flexible assigns curve colors in the order they appear in the curves list. A typical mapping:

  • Curve 1 → Thickness (Y1-axis, µm or mm, color green)
  • Curve 2 → Line speed m/min (Y2-axis, color blue) - secondary quality indicator
  • X-axis → Tag = MeterCounter_HMI (Mode = Tag, value range 0-10000 m)
Subtle behavior: When X-axis Mode = Tag is used, every curve in the trend view uses the same x-axis value at each sample. Mixing Tag mode and Constant mode within a single view is not supported. If two scales are needed (e.g. meters and yards), use a small conversion script to republish one of the scales into a second HMI tag and bind the second trend view to that.

Log File Management: Size, Circular, and Append Modes

WinCC Flexible stores trend data in *.csv files on the configured storage medium. The behavior of an existing log when a new run begins is controlled at log creation time and cannot be changed at runtime.

Mode Behavior on data log open Best used when
Append New samples are written at the end of the existing log file. Long-term reporting; one CSV per line per month.
Overwrite The log file is cleared and started fresh. Shift report; last shift visible only.
Circular The file holds a fixed number of segments; the oldest segment is overwritten when full. Continuous 24/7 lines; bounded storage on flash media.

Capacity planning uses the simple formula:

file_size_kB  ~= segments x segment_size_kB
samples       = segments x samples_per_segment
retention_h   = samples / (3600 / acquisition_cycle_s)

Defaults: 4 segments of 32 kB = 128 kB, ~2 500 samples per segment on a 32-bit log. At 1 s acquisition cycle this is ~42 minutes of history per segment, 2 h 48 min total. For a 12 h shift at 250 ms cycle expect ~21 MB across all logs. To inspect the amount of free storage at runtime, use a script bound to a button that calls FSInfo() on the storage path. The procedure is documented in the WinCC Flexible Scripting manual.

The Schneider EcoStruxure Building Operation trend log types documentation describes the same three log strategies (append / overwrite / circular) under slightly different names (Continuous, Fixed, Custom), confirming that this is an industry-standard convention rather than a Siemens peculiarity.

Starting and Stopping Logging Programmatically

It is rarely useful to log when the line is stopped: the chart fills with a flat trace that obscures the previous run. Two ways to gate logging cleanly:

  1. Tag event "Change value": bind the LoggingActive BOOL to a trend-view event with the action "Start/Stop logging". The trend object exposes this action directly without scripting.
  2. Button with VBScript: on the Press event of a button call HMIRuntime.Trends.Item("TrendView_1").StopLogging and .StartLogging respectively. Use a single toggle button and check .IsLogging first.
' VBScript on a button "Start/Stop Logging"
Dim oTV
Set oTV = HMIRuntime.Trends.Item("TrendView_1")
If oTV.IsLogging Then
    oTV.StopLogging
    SmartTags("BtnLoggingText") = "Start"
Else
    oTV.StartLogging
    SmartTags("BtnLoggingText") = "Stop"
End If

After the line stops, leave the log closed for the rest of the shift so the operator can scroll back through the last complete run. Reopening mid-shift starts a new file (Append) or replaces it (Overwrite) per the chosen mode. The Schneider Geo SCADA trend x-axis documentation confirms the same operational pattern, with the X-axis representing an interval that the operator can pause and resume independently of the data acquisition process.

Open/close side effect: When a log file is closed, WinCC Flexible draws a bold vertical separator in the trend view at the close point. This is normal and indicates the end of the contiguous sample range, not a process event. It is also the cue operators use to identify where one run ends and the next begins when reviewing historical files.

Cross-Platform Implementations

For fleets that include non-Siemens HMIs, the same value-axis concept exists but the configuration names differ.

Platform Object X-axis binding Reference
Siemens WinCC Flexible / TIA WinCC Trend View Property "X-Axis → Mode = Tag" WinCC Flexible user manual, "Displaying process values"
Beijer Electronics iX Developer Trend Viewer Settings → TimeAxis / X Source = Tag in the trend viewer configuration iX 2.51 Reference - Trend Viewer
AutomationDirect C-more Line Trend Graph Time-based natively; for value-axis overlay use chart recorder mode with a counter tag and a calibrated grid C-more Help - Line Trend Graph Object
Schneider EcoStruxure Building Operation Meter Trend Log Built-in meter function handles rollover; logged on schedule (e.g. 1st of month) WorkStation - Configuring a Meter Trend Log; Trend Log Types
Schneider Geo SCADA (ClearSCADA) Trend X-axis is an interval of time by default; a "Pen" can be plotted against an expression that uses an external integer tag for x value via the Advanced view Geo SCADA - Trend X-Axis

Across all platforms the same engineering rules apply: the x-axis source tag must be monotonic within the visible window, samples must be timestamped server-side (not HMI-side) for cross-HMI comparison, and the storage path must have sufficient free space for the configured retention. The C-more Line Trend Graph documentation is explicit that the object continuously monitors an assigned tag, which is the same data-acquisition model WinCC Flexible uses internally.

Verification and Acceptance Test Procedure

  1. With the line stopped, force the meter counter to 0 from the PLC and the thickness to a known value (e.g. 25.0 µm). Confirm one sample is logged at x = 0.
  2. Drive the line at 10 m/min for 2 minutes. Confirm 20 m of x-axis distance is logged and 120 samples are present (one per second at 1 s acquisition cycle).
  3. Reduce line speed to 0 (stop) and verify the chart x-axis no longer advances - distinct from the time clock which would continue.
  4. Toggle LoggingActive to 0; verify no new samples are written. Toggle to 1; verify logging resumes.
  5. Open the *.csv log file from the storage path with a text editor; verify the x column is the meter value, not a timestamp.
  6. Force-close and reopen the log file; confirm in Append mode the new samples are written after the existing file, and in Circular mode the oldest samples are overwritten.
  7. Reboot the HMI panel and confirm the trend redraws the historical curve from the persistent storage.
  8. Export the *.csv to Excel and plot the x-axis column vs. the y column; the curve should match what the trend view shows on the panel.

Acceptance passes only when the operator can scroll back to the start of the last run, see thickness as a function of meters produced, and identify the moment of stop without ambiguity. Document the test results in the SAT (Site Acceptance Test) protocol and retain the *.csv file as evidence.

Troubleshooting Matrix

Symptom Likely cause Fix
X-axis shows time even though Mode is Tag Trend view cached the previous project, or Value Range settings override tag binding Recompile and download the entire project (not delta); restart the runtime
Trend view shows single dot at x = 0 X-axis tag is not updating, or HMI tag acquisition cycle is too slow Check HMI tag status in the diagnostic view; reduce cycle to 250 ms
Event log: "Trend X-axis: invalid tag type" Bound a BOOL or STRING tag to the x-axis Re-bind to REAL / DINT / INT; mirror in PLC if conversion is needed
Bold vertical line through the chart Log file was opened/closed; not a fault Leave log open for the duration of the run, or document the line as a run boundary marker
No historical data after restart Storage path points to volatile memory or storage was cleared Configure persistent storage (SD / USB / HDD) and verify the path in the runtime settings
X-axis range changes every shift Value Range bound to a tag accidentally Set Value Range to fixed constants; only Mode = Tag should bind to the meter tag
Two curves show different x-axis positions Different trend views used Combine into a single trend view so the x-axis is shared
DINT meter counter rolls over at 2 147 km DINT overflow on long-running lines Switch to LREAL for the meter tag; never reset on power-cycle
Stair-step pattern on the chart Acquisition cycle too slow relative to line speed Reduce cycle to 100-250 ms; verify HMI tag polling rate vs. drive encoder rate
Excel export of CSV has wrong x-axis units Decimal separator mismatch (locale-dependent comma vs. period) Configure Windows regional settings to English (United States) before export, or pre-process the CSV with a script

Field-Commissioning Notes

On converting lines, commissioning engineers frequently need to verify both the x-axis source and the sampling integrity. A pragmatic field test is to draw a thickness step change on the gauge (e.g. move a calibration shim under the sensor) while the line is running at constant speed and constant meter increment. The step should appear at the exact meter position where the shim passed under the sensor; any horizontal offset indicates lag in the gauge signal or in the HMI tag acquisition.

For S7-1500 systems, prefer LREAL for the meter counter because DINT rolls over at 2 147 483 647 m (~2 147 km). A long-running line will silently wrap and the chart will look correct locally but will show wrong x-values for samples taken after the rollover. Use LREAL (or a non-resettable REAL pair) for the trend x-axis and reset only via a dedicated engineering command, never via machine power-cycle.

Document the storage path, file naming convention, and the open/close policy in the Functional Design Specification so that maintenance can rotate logs without consulting engineering. Most field incidents with this feature come from operators opening the log to inspect a defect and then closing it before the next run starts, which fragments the dataset into multiple *.csv files. The standard remedy is to add a single button labeled "Pause / Resume Logging" that toggles LoggingActive without closing the file.

For mixed-vendor HMI fleets, mirror the meter counter into a vendor-neutral location (a shared OPC UA server or a Modbus holding register) so the same physical value drives the x-axis on a Siemens, Beijer, and Schneider panel simultaneously. This also gives the historian a single source of truth for the x-axis, which simplifies cross-panel reporting.

FAQ

Can the X-axis of a WinCC Flexible trend view be bound to a PLC tag other than a meter counter?

Yes. The X-axis accepts any numeric HMI tag (REAL, LREAL, DINT, INT). Production examples include a piece counter, a reel length counter, a batch number scaled as REAL, and a temperature setpoint for ramp/soak profiles. The X-axis always reflects the tag value at the moment the sample is logged, so the tag must change monotonically or it will plot backwards.

Why does my X-axis show a flat line when the line is stopped?

The PLC meter counter stops incrementing when the encoder stops. Because the X-axis is bound to that counter, every sample is logged at the same x-value, which produces a vertical stack. This is the correct behavior and confirms that the binding works. To freeze the chart for inspection, stop logging via the LoggingActive tag or a button while the line is stopped.

How much storage does a 12-hour shift at 250 ms acquisition cycle consume?

With two logged tags (thickness and meter) at 250 ms cycle: 12 h x 3600 s x 4 samples/s = 172 800 sample rows. Each row stores two REAL values plus a one-byte timestamp flag in the CSV, roughly 24 bytes per row. Total ~4.1 MB per shift. On a 1 GB SD card this allows ~240 shifts before rotation, more than enough for a typical retention policy.

Can I mix Tag mode and Constant mode curves in the same trend view?

No. The X-axis mode is a property of the trend view, not of an individual curve. If both a tag-driven X-axis and a constant-scale X-axis are needed, use two separate trend views placed side by side on the screen, each with its own data log, and let the operator compare them visually.

What happens to the trend data when the panel reboots?

Data logs stored on internal flash or on a Multi Media Card persist across reboots. The trend view will redraw the historical curve from the CSV file the next time it opens. If storage is on a USB stick that is removed at reboot, the data is lost - log to a fixed internal path for unattended operation, and rotate the SD/USB media only during scheduled maintenance windows.

Back to blog