Configuring Trend View Value Selection in WinCC Advanced TIA

David Krause14 min read
HMI ProgrammingSiemensTutorial / 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

Configuring Trend View Value Selection in WinCC Advanced TIA Portal

This reference describes how to implement operator-selectable trend channels and runtime-adjustable axis scaling on a WinCC Advanced (TIA Portal V13 SP1 Update 5) HMI running on a SIMATIC KTP400 Basic Panel. Two field-proven methods are documented: a multi-overlay trend view with visibility animation, and a single-trend view with conditional tag-gating logic. Both methods respect the runtime limits of the WinCC Advanced Trend View control, which differ significantly from the WinCC Professional Trend Control.

1. Overview

The WinCC Advanced Trend View is a passive display control. It does not natively expose channel-enable flags per trend. Unlike WinCC Professional, where individual trend pens can be toggled through the Trend Control API, the Advanced control renders only the trends that are statically configured at compile time. Two architectural responses are possible:

  • Visibility gating: Stack multiple Trend View objects, each with one pen, and animate the Visible property of each object through an HMI tag driven by an operator selector.
  • Value gating: Use a single Trend View with all pens, and copy the source process value into the trend tag only when the operator has enabled that channel; otherwise write 0 (or hold the last value) to the trend tag.

Both approaches preserve the trend buffer and time axis. The choice between them depends on panel size, screen real estate, and the number of channels the operator must inspect concurrently.

Reference: Configuring a trend view for a data log (Panels, Comfort Panels, RT Advanced, RT Professional).

2. Prerequisites

Item Specification
Engineering software STEP 7 / TIA Portal V13 SP1 Update 5 (or compatible V13 SP1 update)
HMI runtime WinCC Advanced V13 SP1 Update 5 (target: SIMATIC Panels)
Panel KTP400 Basic (4-inch, monochrome or color; resistive touch, 320x240 px)
Panel image WinCC V13 SP1 Update 5 or later image matching the engineering suite
Tags External PLC tags + internal HMI tags for selectors, scale begin/end, and visibility
Licensing WinCC Advanced (the Basic package does not include the full Trend View editor; verify license in TIA Portal > Project tree > Runtime settings)
Connection PROFINET or MPI/PPI between PLC and KTP400
License check: On KTP400 Basic the Trend View is supported in the WinCC Advanced runtime; however the operator-selectable visibility pattern documented here is implemented entirely with standard tag animations, so no additional optional package is required.

3. Architecture: Selector, Visibility, and Scale Tags

Before touching the Trend View, define the tag schema. The pattern below scales to N trend channels. Only the first five are shown; extend as required.

Tag name Type Direction Purpose
ProcessValue_1...ProcessValue_5 REAL (Float) PLC → HMI Source values from the controller
TrendValue_1...TrendValue_5 REAL (Float) HMI internal Value actually bound to the trend pen (post-gate)
TrendSel_1...TrendSel_5 BOOL HMI internal Operator ON/OFF selector per channel
Trend_LeftY_Start REAL HMI internal Dynamic start value of left Y axis
Trend_LeftY_End REAL HMI internal Dynamic end value of left Y axis
Trend_RightY_Start REAL HMI internal Dynamic start value of right Y axis
Trend_RightY_End REAL HMI internal Dynamic end value of right Y axis
Trend_TimeX_Start DATE_AND_TIME HMI internal Time-axis start (cyclic trends only)
Trend_TimeX_End DATE_AND_TIME HMI internal Time-axis end (cyclic trends only)

The minimum panel memory footprint per channel is 8 bytes (REAL) + 1 bit (BOOL) + 4 bytes (REAL gate logic) when using the value-gate method. On a KTP400 with 1 MB project memory, plan for 32 trend channels maximum to stay below the 70% utilization threshold Siemens recommends for archive stability.

4. Method 1 — Multi-Trend Overlay with Visibility Control

This method is preferred when the operator benefits from comparing values on a single y-axis grid (e.g., temperature vs. pressure against the same time line). Stack one Trend View per channel in screen coordinates (0,0) through (W,H), all of identical size. The Visible property of each object is animated by the corresponding TrendSel_n tag.

4.1 Step-by-step

  1. Open the screen where the trend will sit. Insert the Trend View five times (one per channel) and align them pixel-perfectly on top of each other. Tip: Use the Arrange > Align > Centered (vertical and horizontal) context menu items.
  2. For each instance, open Properties > Trend > Trend type. Select Cyclic real time for live data or Data log for historical.
  3. Bind the value source of the n-th Trend View to TrendValue_n. The internal trend tag is bound, not the raw process value; this isolates the gate logic from the pen binding.
  4. Open Properties > Appearance > Visible for the n-th Trend View. In the animation dialog, select the TrendSel_n tag, set the trigger to Change, and the action to Visible = (tag value = 1).
  5. Repeat for all five stacked objects.
Z-order matters: The first Trend View placed on the screen is rendered at the back. The last placed sits on top. Place the most important channel last so its gridlines are not occluded. A second method is to make all five objects transparent except their trend line; in WinCC Advanced the Background → Border and Background → Pattern properties accept visibility animations in the same way.

4.2 Performance on KTP400

Each Trend View on a Basic panel redraws the full grid on every acquisition cycle. Five stacked views therefore execute five times the pixel work per cycle. With a 1-second acquisition and 5 channels, the panel CPU will be 8-12% busier than a single-view configuration. If you observe Response time of operator input > 1.5 s, drop acquisition to 2 s or use Method 2.

5. Method 2 — Single Trend with Value-Gate Tag Logic

This method is preferred when screen space is constrained or when more than four channels are required. The operator toggles a Boolean per channel; an HMI-side script (or scheduled task) copies the process value into TrendValue_n only when enabled, otherwise holds the value at 0.

5.1 Tag-gate scheduled task

Create a scheduled task in the HMI (TIA Portal > HMI device > Schedules > Add new) with a 500 ms trigger. Use VBScript inside the scheduled task to update the trend tags. A minimal implementation:

' Scheduled task body - runs every 500 ms ' Inputs: ProcessValue_1..5 (PLC), TrendSel_1..5 (BOOL), TrendValue_1..5 (REAL) If SmartTags("TrendSel_1") = True Then SmartTags("TrendValue_1") = SmartTags("ProcessValue_1") Else SmartTags("TrendValue_1") = 0.0 End If If SmartTags("TrendSel_2") = True Then SmartTags("TrendValue_2") = SmartTags("ProcessValue_2") Else SmartTags("TrendValue_2") = 0.0 End If ' ... repeat for channels 3, 4, 5 ... If SmartTags("TrendSel_5") = True Then SmartTags("TrendValue_5") = SmartTags("ProcessValue_5") Else SmartTags("TrendValue_5") = 0.0 End If
Cycle-time caveat: Scheduled tasks on WinCC Advanced panels have a minimum resolution of 100 ms and execute on the panel's user-task thread. If the task is delayed by a value-change event from a higher-priority tag, the trend will momentarily show a stale value. Do not rely on this method for closed-loop trending where missed samples cause an alarm.

5.2 Single-trend view binding

  1. Insert a single Trend View on the screen.
  2. Add five trend pens. Bind each pen's Source to the corresponding TrendValue_n tag.
  3. Configure one color per pen (Properties > Trend > Pen n > Line color). The operator identifies enabled channels by color and selector state.
  4. Drive the selector booleans from five toggle buttons. Configure each button to write its own TrendSel_n tag.

When a channel is disabled, the pen continues to draw — but at value 0, so the line drops to the bottom of the chart. To avoid visual confusion, animate the Pen color property of the trend so the disabled pens are rendered in light gray.

6. Configuring Dynamic Y-Axis Scale via Tags

Open the Trend View properties and expand Left value axis (or Right value axis). Each axis exposes four properties:

Property Data type Purpose
Begin value REAL Minimum value displayed on the axis
End value REAL Maximum value displayed on the axis
Begin value, tag TAG (REAL) HMI tag that overrides Begin value at runtime
End value, tag TAG (REAL) HMI tag that overrides End value at runtime

To allow the operator to change scale, assign the HMI tags Trend_LeftY_Start and Trend_LeftY_End to the Begin value, tag and End value, tag properties respectively. Two numeric I/O fields on the screen write into these tags. As soon as the tag value changes, the trend redraws within the new range.

Auto-scale fallback: If you want the operator to switch between fixed and auto-scaled axis, expose a third Boolean Trend_AutoScale. Animate Begin value, tag with the expression (Trend_AutoScale ? 0 : Trend_LeftY_Start). The Advanced Trend View auto-scales only when both the begin and end tag are assigned to a tag whose value is 0 and 0 (or empty), so the cleanest approach is a fourth tag Trend_AutoScale_On that, when true, sets both begin and end to 0 internally via the same scheduled task as Section 5.1.

7. Configuring X-Axis (Time Axis) Scale via Tags

The X axis on a Cyclic real time trend is dynamic: its start and end are tags of type DATE_AND_TIME (8 bytes, BCD-encoded). On a Data log trend, the X axis is bound to the log's own timestamp; tag-driven scaling is not supported on this trend type.

Trend type X-axis tag-driven scaling Y-axis tag-driven scaling Visibility animation per pen
Cyclic real time Yes Yes (left and right) Yes (one pen per object)
Data log No (log-defined window) Yes (left and right) Yes (one pen per object)

For cyclic real-time trends, open Properties > Time axis > Begin/End, tag and assign the DATE_AND_TIME tags Trend_TimeX_Start and Trend_TimeX_End. The minimum window on a KTP400 is 1 minute; the maximum is bounded by the trend's Number of values and acquisition rate. With 1000 values at 1 s, the maximum window is ~16 minutes.

8. Trend Type Constraints: Cyclic Real-Time vs Data Log

The choice of trend type drives the entire feature set available to the operator. The constraints below are observed in WinCC Advanced V13 SP1 Update 5 and confirmed against the official Siemens documentation.

Feature Cyclic real time Data log
Live update Yes No (historical only)
Dynamic X-axis scaling Yes (DATE_AND_TIME tag) No (fixed log window)
Dynamic Y-axis scaling Yes (REAL tag) Yes (REAL tag)
Storage back to flash No (volatile ring buffer) Yes
Acquisition trigger source Cyclic — fixed Cyclic or on-change
Suitable for value-gate method Yes (preferred) Yes (with log reset)

Reference: Siemens TIA Portal V20 documentation: Configuring a trend view for a data log.

9. KTP400-Specific Performance Considerations

The KTP400 Basic has the lowest CPU budget in the Comfort/Basic line. Limits that matter for this configuration:

  • Concurrent animations: Maximum 50 simultaneously animated properties per screen. Five visibility animations plus four axis-tag animations is well within budget.
  • VBScript scheduled-task budget: Total scheduled-task CPU share is limited to 30%. The 500 ms script in Section 5.1 costs ~3% with five channels.
  • Display refresh: The Trend View does not use double-buffering; at 1 s acquisition with five pens, faint flicker is normal. Set Appearance → Update to Cyclic in background if the operator reports ghost lines.
  • Trend buffer: Maximum 1,000,000 values per trend across all pens. Plan acquisition period and trend duration accordingly.

10. Step-by-Step Implementation Guide (Combined Method)

This procedure produces a single screen with five operator-selectable trend pens, both Y axes tag-scaled, and a date-driven X axis. Estimated build time: 45 minutes.

10.1 Create the tag schema

  1. In the project tree, expand HMI Tags. Add the 19 tags listed in Section 3.
  2. For ProcessValue_1..5, set the Connection property to the PLC. For all others, set Connection to Internal tag.
  3. For Trend_TimeX_Start/End, set the data type to Date and time.

10.2 Build the trend view

  1. Insert a Trend View object. Size it to fill the upper 80% of the screen.
  2. Open Properties > Trend > Trend type and select Cyclic real time.
  3. Add five pens. Bind each to TrendValue_n. Assign distinct colors (e.g., red, green, blue, orange, magenta).
  4. Set Properties > Trend > Trend → Index to Time axis.
  5. Set Time axis → Acquisition cycle to 1000 ms.
  6. Set Time axis → Begin, tag to Trend_TimeX_Start and End, tag to Trend_TimeX_End.
  7. Set Left value axis → Begin, tag to Trend_LeftY_Start and End, tag to Trend_LeftY_End.

10.3 Build the selector panel

  1. Place five toggle buttons in a vertical column to the right of the Trend View.
  2. Each button's Tag property writes its TrendSel_n tag. Set Mode to Toggle.
  3. Add a small color square next to each button. Animate the Background color with: (TrendSel_n ? PenColor_n : 0xC0C0C0).

10.4 Build the scale panel

  1. Place two numeric I/O fields at the bottom of the screen.
  2. Bind one to Trend_LeftY_Start, the other to Trend_LeftY_End. Set Field type to Input/output.
  3. Add an Auto scale toggle bound to Trend_AutoScale.

10.5 Add the gating scheduled task

  1. Open HMI device → Schedules. Add a new schedule with a 500 ms trigger.
  2. Set the event to Updated. Paste the VBScript from Section 5.1.
  3. Compile and download the project to the panel.

11. Verification and Commissioning Tests

Run the following tests after download. Record results in the FAT/SAT protocol.

Test Procedure Pass criterion
Channel enable Toggle TrendSel_3 on. Observe the screen. Pen 3 line is visible within 1 s.
Channel disable Toggle TrendSel_3 off. Observe the screen. Pen 3 line drops to 0 within 1.5 s (2 acquisition cycles max).
Y-axis live scaling Change Trend_LeftY_Start from 0 to 50. Y axis redraws with new range in < 1 s; trend line position updates.
Auto-scale toggle Set Trend_AutoScale = 1. Y axis shows the natural min/max of the displayed data.
X-axis time window Set Trend_TimeX_Start to current time minus 5 minutes. Trend shows the last 5 minutes only.
PLC tag update propagation Force ProcessValue_2 in the PLC. Wait 1 s. Pen 2 line reflects the new value (only if TrendSel_2 = 1).
CPU load on panel Open System → Performance on the panel. Panel CPU < 70% under all five channels enabled.

12. Troubleshooting Matrix

Symptom Likely cause Corrective action
Pen always shows 0 even when selector is on Scheduled task not running or VBScript error Open Diagnostics → Scripts on the panel; check the HMI tag TrendValue_n with the HMI tag monitor; verify the scheduled task is enabled in the project.
Y axis does not respond to tag change Tag assignment is to a non-REAL tag, or tag is read-only Confirm the data type of Trend_LeftY_Start/End is REAL; ensure the connection is Internal tag, not PLC.
X axis ignores time-tag change on a Data log trend Data log trend type does not support dynamic X scaling Switch the trend type to Cyclic real time if the use case permits.
Stacked Trend View objects all show at once Visibility animation not configured or wrong trigger Open the animation dialog on the Visible property; change trigger from On change to Cyclic 500 ms; verify the source tag is a Bool.
Toggle button writes the wrong tag Button tag is a shared selector, or Mode is Set instead of Toggle Confirm each toggle button points to a unique TrendSel_n; change Mode to Switch on / Switch off.
Trend freezes after several hours Trend buffer overflow on the data log Reduce Number of values; reduce Acquisition cycle; or switch to cyclic real time.
Auto-scale flickers between values Both begin and end tags are 0 but auto-scale logic does not re-evaluate Force a 1-period refresh by toggling Trend_AutoScale off and on.
Pen colors do not change on disable Pen color property is not animatable on this Trend View version Use the visibility-gate method (Section 4) instead, or add a colored rectangle behind each pen and animate the rectangle's Visible property.

13. Frequently Asked Questions

Can the operator enable or disable a single trend pen in WinCC Advanced V13 SP1?

No, the Trend View control in WinCC Advanced V13 SP1 does not expose a per-pen visibility flag. The operator can be given the same effect by either stacking Trend View objects (one pen per object) and animating each object's Visible property, or by gating the source value in a scheduled VBScript and binding the trend pen to the gated tag.

Does the Trend View in WinCC Advanced support dynamic X-axis scaling for data logs?

No. Dynamic X-axis scaling is supported only on the Cyclic real time trend type, where the begin and end are bound to DATE_AND_TIME tags. On a Data log trend, the X axis follows the log's own timestamp range and the begin/end tag fields are disabled.

How do I let the operator change the Y-axis scale at runtime?

Open the Trend View properties, expand Left value axis (or Right value axis), and assign an HMI tag of type REAL to Begin value, tag and End value, tag. Bind two numeric I/O fields on the screen to those tags. The axis redraws as soon as the tag value changes.

Is a scheduled VBScript the only way to gate trend values on a KTP400 Basic?

It is the only scriptable method on the KTP400. Comfort Panels and RT Advanced on a PC support the same approach plus user-defined functions. PLC-side gating is also viable: copy the process value into the trend tag on the PLC only when the operator sets a selector bit, eliminating the need for an HMI scheduled task.

What is the difference between the WinCC Advanced Trend View and the WinCC Professional Trend Control for this use case?

WinCC Professional exposes the full Trend Control API, including per-pen visibility, runtime pen add/remove, and a richer time-axis configuration. WinCC Advanced does not; it relies on tag animations and pre-configured pens. If pen-level runtime control is a hard requirement, migrate the panel to a Comfort Panel running the Professional image or to a PC-based RT Professional runtime.

Back to blog