Scaling WinCC Tags with Linear Scaling and Dynamic Dialog

David Krause11 min read
SiemensTutorial / How-toWinCC
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

Scaling WinCC Tags with Linear Scaling and Dynamic Dialog

Engineers running SIMATIC WinCC V7.4 on top of PCS 7 V8.2 frequently need to display a single PLC tag in two different units on the same HMI screen — for example, an actuator position tag arriving from the CPU 410 as a raw 0–100 % value while the operator must simultaneously read it as 0–5000 litres. Modifying the controller program or adding a second DB variable is often undesirable in a validated PCS 7 plant because it forces a CPU re-download, an AS-side change-log entry, and a renewed S7 F/FH safety impact assessment. This reference shows four supported WinCC-side techniques — linear scaling on the tag itself, the I/O Field dynamic dialog, a global-script action with an internal tag, and the WinCC Unified tag-based dynamization — and explains when each method is appropriate, how to configure it, and how to verify the result.

1. Problem Definition and Engineering Constraints

A tag AAA is published by the CPU 410 to the WinCC tag management. The PLC value range is 0…100 % (raw INTEGER, 0…10000 if normalized to 0.01 % steps, or 0.0…100.0 as REAL). The operator screen must show two simultaneous indications:

  • Indication A: AAA displayed as 0…100 % (unchanged).
  • Indication B: the same AAA displayed as 0…5000 LITRES.

Constraint: no new tag in the CPU, no script in the AS, no FB modification. All conversion must happen inside WinCC.

2. Mathematics of the Scaling Conversion

The relationship between raw PLC percentage and the engineering-unit display is a linear map:

y = ((x − x_min) / (x_max − x_min)) × (y_max − y_min) + y_min

For the canonical PCS 7 use case (0…100 % → 0…5000 L):

Variable Meaning Value
x_min PLC raw low 0
x_max PLC raw high 100
y_min HMI display low 0
y_max HMI display high 5000
y Scaled display x × 50

Where the raw tag is normalized 0…10000 (0.01 % resolution): y = x × 0.5. Where the tag is REAL 0.0…100.0: y = x × 50.0. The scaling coefficients must match the variable type chosen for the HMI tag, otherwise a signed/unsigned overflow or precision loss will occur.

3. Prerequisites

  • Engineering station: SIMATIC WinCC Explorer V7.4 SP1 or later with the Graphics Designer and Global Script runtimes installed.
  • Control system: PCS 7 V8.2 with the SIMATIC PCS 7 – WinCC Tag Management manual referenced for tag configuration.
  • PLC connection: SIMATIC S7-400 / CPU 410 with a configured S7 connection; the tag must already be visible in WinCC tag management.
  • Screen editor authority: local administrator rights to edit pictures in Graphics Designer and to publish Global Script actions.
  • Optional — Unified path: TIA Portal V18 or later with WinCC Unified V18/V19/V20/V21 RT for the tag-dynamization workflow.

4. Method 1 — Linear Scaling in the Tag Properties (Preferred)

Linear scaling is the canonical Siemens-blessed mechanism and is documented in the WinCC V7.4 Tag Management manual. Two tags are created in WinCC that point at the same PLC address, but each carries its own scaling pair.

4.1 Step-by-step

  1. Open WinCC Explorer → Tag Management.
  2. Right-click the existing tag AAA and choose Properties. Note the exact PLC address (for example DB201.DBD12 as FLOAT or DB201.DBW12 as INT).
  3. Create a new tag BBB with the identical S7 address and the same data type. WinCC permits multiple WinCC tags pointing to one PLC address.
  4. With BBB selected, open Properties → Linear Scaling.
  5. Enable Linear scaling. Enter the values from the table below.
  6. Apply, OK, and trigger a Tag Management → Save and Compile. Restart the WinCC runtime (or use Tag Management RT reload) to publish the new mapping.
Parameter Value Comment
Tag name (HMI) BBB Pointer to same PLC address as AAA
PLC data type Float (REAL) Must match CPU declaration
WinCC data type Float (REAL) Required for fractional scaling
Raw low (PLC) 0 x_min
Raw high (PLC) 100 x_max
Scaled low (HMI) 0 y_min
Scaled high (HMI) 5000 y_max

4.2 Why it works

Linear scaling is implemented in the WinCC channel DLL and runs every acquisition cycle. Both AAA and BBB read the same DBW/DBD; the channel multiplies by the slope m = (y_max − y_min)/(x_max − x_min) and adds the offset b = y_min − m × x_min. The original tag is left untouched, so the un-scaled value remains available for faceplates, alarms, and trending.

5. Method 2 — Dynamic Dialog inside an I/O Field

When a project-wide scaled tag is overkill — for instance, the conversion is only needed on a single picture — the I/O Field's built-in Dynamic dialog can compute the display directly from the source tag.

5.1 Step-by-step

  1. In Graphics Designer, drag an I/O Field onto the picture and configure it as Output.
  2. In the configuration dialog, set Output/Input to Dynamic dialog.
  3. Set Data type to Direct.
  4. Build the expression using the tag AAA, the operator / and a constant. Example expression:
AAA / 50        // 0…100 %  → 0…5000 L, displayed value 50× larger
// or, in the standardized form:
((AAA - 0) / (100 - 0)) * (5000 - 0) + 0
  1. Define the value range for the dialog: Low value 0, High value 5000.
  2. Format the output field with a suffix string such as " L" so the operator reads "2475 L".
  3. Compile the picture and activate runtime.
Caution: Direct expressions in Dynamic dialog are limited to the operators +, −, *, /, ^ and a fixed number of operands. Complex conditional formatting requires C or VBS script.

6. Method 3 — Global Action with an Internal Tag

If the converted value must be reused by multiple pictures, archives, or alarms, expose it as an internal tag and drive it from a scheduled global action. This is the documented WinCC pattern for any value derived entirely on the HMI side.

6.1 Step-by-step

  1. Tag Management → Add new tag. Name: BBB. Data type: Float. Mark as Internal tag (no PLC address).
  2. Open Global Script → C-Actions (or VBS). Create a new action named, e.g., act_ScaleAAAtoBBB.
  3. Use the standard WinCC API and set the trigger to fire on change of AAA:
// C-Editor — Global action, triggered by tag "AAA"
#include "apdefap.h"

int gscAction(void)
{
    float raw;
    float scaled;

    raw   = GetTagFloat("AAA");           // reads from PLC
    scaled = raw * 50.0F;                 // 0…100 % → 0…5000 L

    // Optional clamping for safety:
    if (scaled < 0.0F)    scaled = 0.0F;
    if (scaled > 5000.0F) scaled = 5000.0F;

    SetTagFloat("BBB", scaled);
    return 0;
}
  1. In the action properties, choose Trigger = tag AAA (with cycle On change) so the script runs only when the source value updates.
  2. Save and generate the runtime. Use Graphics Designer → Dynamic Wizard → Tag Trigger if the script must also refresh a faceplate on the same change.
  3. Bind the I/O Field, bar graph, or trend on the operator screen to BBB.

6.2 VBScript equivalent

' VBS — Global action triggered by tag "AAA"
Dim raw, scaled
raw    = HMIRuntime.Tags("AAA").Read
scaled = raw * 50
If scaled < 0    Then scaled = 0
If scaled > 5000 Then scaled = 5000
HMIRuntime.Tags("BBB").Write scaled

7. Method 4 — Tag-based Dynamization in WinCC Unified

In TIA Portal projects that use WinCC Unified (V18 and later), the tag-based dynamization is the Unified equivalent of Dynamic dialog and is configured inline in the Inspector window — see the Dynamizing an object property via a tag (RT Unified) documentation. The same four-step flow applies to bar graphs, fill levels, colors, and visibility.

7.1 Step-by-step

  1. In the Unified screen editor, select the HMI object (I/O Field, bar, circle, etc.).
  2. Open Properties → Properties in the Inspector window.
  3. Expand the property to dynamize (e.g. Process value or Fill level) and choose Tag as the dynamization source.
  4. Pick the existing PLC tag AAA, set the scaling range Low 0 / High 5000, and confirm.
Note: Unified does not store a second HMI tag; the scaling coefficients live on the object's dynamization node, which keeps tag management single-sourced and reduces point-count licensing.

8. Method Comparison

Criterion Linear Scaling Dynamic Dialog Global Action Unified Tag Dyn.
PLC impact None None None None
Extra HMI tag Yes (external) No Yes (internal) No
Reusable in archives/alarms Yes No (display only) Yes Yes (via tag)
Update on tag change Acquisition cycle Picture cycle Trigger / cycle Acquisition cycle
CPU load on RT Negligible Negligible Low–moderate Negligible
WinCC version V7.0+ V7.0+ V7.0+ V18+ (Unified)
Best use case Plant-wide scaled value Single-picture cosmetic scale Conditional logic, clamps Modern TIA / Unified projects

9. Verification and Acceptance Test

  1. Boundary 0 %: Force AAA = 0 in the S7-PLCSIM or via an online force on the faceplate. Confirm BBB shows 0 L and the unmodified AAA shows 0.0 %.
  2. Boundary 100 %: Force AAA = 100. Confirm BBB = 5000 L.
  3. Midpoint: Force AAA = 47. Expected BBB = 2350 L.
  4. Trend consistency: Open an online trend on BBB and on the tag scaled by Method 1. Both must overlap exactly with AAA × 50.
  5. Cycle latency: Watch the tag update time in WinCC Explorer → Tools → Tag Diagnosis. Scaled tags must match the unscaled tag within one acquisition cycle (default 1 s).
  6. Archive round-trip: If BBB is archived, confirm in the Tag Logging editor that the value stored matches the value displayed (no double-scaling bug).
  7. CPU re-load safety: Confirm that only the OS/ES project has changed; the AS project remains untouched and no S7 F/FH re-certification is triggered.

10. Troubleshooting Matrix

Symptom Likely Root Cause Corrective Action
BBB shows 0 even though AAA updates Linear scaling enabled but scaling range left at default 0…100 Re-enter the scaled range 0…5000 in tag properties
BBB always equals AAA Dynamic dialog expression evaluates to AAA only — typo or missing operator Inspect the expression string in the I/O Field configuration
BBB updates only every 2 s Global action trigger set to On cycle 2 s Switch trigger to On change of AAA
BBB displays truncated value WinCC tag data type set to INT instead of FLOAT Change tag type to FLOAT and recompile
Alarm on BBB never triggers BBB defined as internal; internal tags cannot trigger WinCC alarms Use Linear Scaling (external tag) instead of internal tag for any alarm-bound value
Scaled value flickers on picture change Picture cycle < acquisition cycle; dialog re-evaluates stale data Set picture cycle to match acquisition cycle (default 1 s)
Unified dynamization compiles but no runtime update Tag selection did not resolve; check HMI device proxy Verify tag exists under HMI tags and that the device proxy points to the correct PLC

11. Field-Proven Caveats

  • Unsigned vs. signed: Real-world actuator tags can briefly return negative values during valve stroking. A scaling pair of 0…100 assumes a non-negative source. Add an explicit clamp in the global action or use a wider PLC-side range.
  • REAL precision: A tag declared as REAL in the CPU but scaled as FLOAT in WinCC is acceptable, but never scale a REAL through an INT-tag declaration — precision is silently truncated.
  • Point count: Each external HMI tag counts toward the WinCC PowerTag license. Two tags pointing at the same address count as two. For very large plants, Method 2 or Method 4 reduces the license footprint.
  • Faceplate regeneration: When a scaled value is bound to a PCS 7 faceplate, regenerate the faceplate instance after tag property changes; stale faceplate views will keep the old scaling until regenerated.
  • Audit trail: In a GxP or 21 CFR Part 11 plant, document the scaling pair in the Functional Specification and the change-log; the S7 side is unchanged, but the operator-visible value is now derived, not raw.

12. Frequently Asked Questions

Does linear scaling change the value the PLC sends?

No. Linear scaling is implemented entirely in the WinCC channel DLL. The CPU continues to send the raw value; WinCC multiplies and offsets it only for the HMI-side view.

Can I scale an internal tag with linear scaling?

No. Linear scaling is only available on process (external) tags that have a PLC address. Use a global action with an internal tag, or use the I/O Field dynamic dialog, for purely internal conversions.

Why does my Dynamic Dialog expression show #ERR?

The expression has exceeded the operand limit, contains an unsupported function, or one of the tags is offline. Split the conversion into two nested I/O Fields or move the logic into a global action with explicit clamps.

How fast does the scaled tag update?

The scaled tag follows the acquisition cycle of the underlying process tag — by default 1 s in PCS 7. Use On change triggers in global actions for sub-second reaction.

Is WinCC Unified tag-based dynamization available in V17?

Tag-based dynamization was introduced with Unified V16 and is fully supported in V17 and later. Projects on V15 must upgrade the HMI runtime before using this method.

Will scaling a tag 0…100 % to 0…5000 L affect existing alarms?

Only if the scaled tag is bound to the alarm. Bind the alarm to the original AAA tag with limits in percent, and use BBB solely for display, to keep alarm thresholds correct.

Back to blog