Logarithmic Y-Axis on Siemens WinCC Flexible Trend Displays
Problem Overview
Siemens WinCC Flexible trend (curve) displays render the value (Y) axis on a linear scale only. There is no native property, registry setting, or VBScript extension that switches the axis to base-10 logarithmic. When the application monitors a physical quantity whose useful range spans many decades, vacuum chamber pressure from 2.00E+03 mBar down to 1.00E-09 mBar being the canonical example, a linear axis collapses the lower decades into a single line at the bottom of the chart and the operator loses visibility of process events at low pressure.
This article documents four engineering workarounds that have proven reliable in production: PLC-side base-10 logarithm conversion (recommended), VBScript inside the HMI runtime, split-range dual-trend display, and right Y-axis assignment. Each approach is described with working code, parameter ranges, and field-verified caveats. The article also covers migration to TIA Portal WinCC Comfort/Advanced where the same architectural limitation persists.
Why Logarithmic Scaling Is Required for Vacuum Data
Vacuum pumping systems routinely traverse nine or more decades of pressure during a single batch cycle. The semiconductor, vacuum coating, freeze-drying, analytical instrument, and particle accelerator industries use the logarithmic pX convention:
pX = -log10(P_mBar)
A linear mBar axis from 2.00E+03 to 1.00E-09 gives a 200,000,000,000:1 dynamic range. Even with auto-scaling the operator cannot see a 1E-08 mBar event when the current value is 1.00E+03 mBar because the lower decades occupy less than 0.000001% of the available pixel height on a 600-pixel-tall chart.
Typical Vacuum Regimes
| Regime | Pressure (mBar) | pX | Typical Sensor |
|---|---|---|---|
| Atmospheric | 1.00E+03 | -3 | Capacitance manometer (MKS Baratron) |
| Rough vacuum | 1.00E+03 to 1.00E+00 | -3 to 0 | Pirani (Pfeiffer TPR 280) |
| Medium vacuum | 1.00E+00 to 1.00E-03 | 0 to 3 | Pirani / Capacitance combo |
| High vacuum (HV) | 1.00E-03 to 1.00E-07 | 3 to 7 | Penning / Cold cathode (Pfeiffer IKR 270) |
| Ultra-high vacuum (UHV) | 1.00E-07 to 1.00E-10 | 7 to 10 | Bayard-Alpert hot cathode (Pfeiffer IMR 265) |
| Extreme high vacuum (XHV) | <1.00E-10 | >10 | Extractor / inverted magnetron |
The pX transformation produces a linear-mappable value between -3 and 10 that WinCC Flexible can plot natively. This is the preferred engineering solution and is functionally indistinguishable from a true logarithmic axis for the operator.
WinCC Flexible Trend Display Architecture Limitation
The WinCC Flexible Trend View control exposes the following configurable Y-axis properties in the Properties dialog:
- LowerLimit (REAL)
- UpperLimit (REAL)
- ScaleType (Integer, internally: 0 = Linear, 1 = Logarithmic) — this property exists in the underlying Siemens graphics library for Bar and Slider objects but is not surfaced through the configuration UI for the Trend View Value axis.
- AxisColor, AxisFont, LineStyle
The Trend View Value axis is fixed-linear in WinCC Flexible 2008 SP5 and all prior service packs. The same restriction applies to:
- WinCC Comfort V18 / V19 (TIA Portal, for Comfort Panels TP700 to TP2200)
- WinCC Advanced V18 / V19 (TIA Portal, for PC-based Runtime)
- WinCC Professional V18 / V19 (TIA Portal, SCADA-grade)
- Legacy ProTool / Pro RT (predecessor to WinCC Flexible)
For all of these targets, you must pre-transform the value to be plotted. Reference Siemens support entry SIMATIC HMI WinCC Flexible / TIA Portal WinCC engineering documentation for confirmation of Trend View axis limitations.
Workaround Comparison Matrix
| Workaround | Implementation site | Precision | CPU load on panel | Audit-trail friendly | Freeze-safe |
|---|---|---|---|---|---|
| 1. PLC log10 (recommended) | S7-1200 / 1500 SCL or S7-300/400 STL | IEEE-754 single (24-bit mantissa) | None | Yes | Yes |
| 2. VBScript log10 | HMI runtime scheduler | IEEE-754 double (53-bit mantissa) | Moderate | Yes (with right tag) | Yes |
| 3. Split-range dual trend | HMI screen layout | Native (no transform) | Higher (more graphics) | Yes | Yes |
| 4. Right Y-axis assignment | HMI legend right-click | Native (no transform) | None | Yes | Yes |
Workaround 1: PLC-Side Log10 Conversion (Recommended)
The cleanest solution is to compute -log10(rawPressure) in the PLC and trend the resulting linear value. With the value mapped to the pX range (-3 to 10), a linear WinCC Flexible Y-axis with LowerLimit = -3 and UpperLimit = 10 produces the operator-visible chart that a log axis would have given.
S7-1200 / S7-1500 SCL Implementation (Firmware V18+)
STEP 7 Basic / Professional V18 supports the LN function natively in SCL. Divide by ln(10) = 2.302585093 to obtain log10. The following snippet targets an S7-1500 with firmware V2.9 or later; the same code compiles on S7-1200 firmware V4.6 or later.
// Function block: fb_pX_Convert
// Input : rawPressure_mBar : REAL
// Output : pX_OUT : REAL (plot this on the WinCC Flexible trend)
{ S7_Optimized_Access := 'TRUE' }
FUNCTION_BLOCK "fb_pX_Convert"
VAR
ln10 : REAL := 2.302585093; // ln(10) - constant
END_VAR
VAR_INPUT
rawPressure_mBar : REAL;
END_VAR
VAR_OUTPUT
pX_OUT : REAL;
END_VAR
BEGIN
IF #rawPressure_mBar > 0.0 THEN
#pX_OUT := -LN(#rawPressure_mBar) / #ln10;
ELSE
#pX_OUT := 20.0; // saturation sentinel
END_IF;
// Clamp to trend axis range
IF #pX_OUT > 10.0 THEN #pX_OUT := 10.0; END_IF;
IF #pX_OUT < -3.0 THEN #pX_OUT := -3.0; END_IF;
END_FUNCTION_BLOCK
S7-300 / S7-400 STL Implementation (STEP 7 V5.6)
Older controllers use the LN instruction from the IEC function block library. The following STL excerpt accepts a REAL in rawPressure_mBar and writes a REAL to pX_OUT. Required: the IEC library must be linked into the S7 program (Libraries → Standard Library → IEC Function Blocks).
// STL: compute pX = -log10(rawPressure_mBar)
// Guard against pressure <= 0 (LN undefined)
L #rawPressure_mBar
L 0.000000e+000
>R
JC POSV // jump to valid path if pressure > 0
L 0.000000e+000 // else output 0 (out of range low)
JU STORE
POSV: L #rawPressure_mBar
LN // result stack 1 = ln(pressure)
L 2.302585e+000 // ln(10)
/R // stack 1 = log10(pressure)
NEG // stack 1 = -log10(pressure) = pX
STORE: T #pX_OUT
SET
SAVE
Reference: SIMATIC S7-300/400 STEP 7 V5.6 Basic Functions manual for the LN instruction semantics and accumulator behavior.
WinCC Flexible Trend Configuration for pX Data
- Add a Trend View to the screen (Controls → Trend View).
- Open Properties → Axes → Value axis (left Y).
- Set LowerLimit = -3.0 and UpperLimit = 10.0.
- Format the axis value column to three decimal places.
- Add a static text label "pX" beside the axis (use the Label tool from the toolbox).
- Configure the Trend View tag connection with type REAL and acquisition cycle matching your data source (typically 500 ms to 1 s for vacuum gauges).
The visual result is identical to a base-10 log axis: the operator sees evenly spaced vertical positions for each decade marker (pX 0 = 1 mBar, pX 3 = 1E-03 mBar, pX 9 = 1E-09 mBar).
Workaround 2: VBScript Inside WinCC Flexible
When the PLC program is frozen (validated system, FDA-regulated batch, OEM-locked controller, ECAD black box), compute the log value inside the HMI runtime. WinCC Flexible supports VBScript on the script-level interface with full access to SmartTags.
VBScript Function for log10
' File: log10_scheduler.vbs
' Attach to a Scheduler trigger, cyclic 500 ms, or to a tag-change event
' on SmartTags("DB_Vacuum_RawPressure_mBar")
Dim rawPressure, pX
' Read the IEEE-754 REAL value from the PLC
rawPressure = SmartTags("DB_Vacuum_RawPressure_mBar").Value
' Guard against zero or negative (LN undefined)
If rawPressure > 0 Then
pX = -Log(rawPressure) / Log(10.0)
Else
pX = 20.0 ' saturation sentinel
End If
' Clamp to trend axis range
If pX > 10 Then pX = 10
If pX < -3 Then pX = -3
' Write the result to the trend source tag
SmartTags("DB_Vacuum_pX_Trend").Value = pX
Scheduling
Attach the script to a Scheduler event in the screen or to the global scheduler:
- Cycle: 500 ms (matches typical trend sampling).
- Variable trigger: also fire on tag change of the raw pressure tag.
- Trigger condition: tag changed OR scheduler tick.
Reference: WinCC Flexible 2008 SP5 Communication manual, VBScript reference.
Performance and Precision Caveats
- VBScript uses double-precision IEEE-754 (64-bit), so the conversion itself adds negligible error (about 15 decimal digits).
- CPU load on the HMI panel climbs when more than ~50 tags are computed per cycle. For 4" panels (KTP400 Basic, TP177B PN), restrict the script to a 1 s cycle and the relevant single trend.
- Tag logging rate and script execution rate are decoupled. The log tag triggers the trend archive; the script runs at its own cadence. If the script cadence exceeds the logging cadence, the trend will record redundant samples.
- On WinCC Flexible Runtime for PC (Windows 7 SP1 / Windows 10), the script also runs fine but watch the OS scheduling; do not run more than ~500 tags/cycle on a Core i3 or slower host.
Workaround 3: Split-Range Dual-Trend Display
When neither PLC nor HMI scripts can be modified (locked OEM scope, change-controlled system), use two or more synchronized Trend View objects on the same screen, each zoomed into a different decade band. The operator mentally stitches the traces.
| Trend object | Y-axis range (mBar) | Use |
|---|---|---|
| Trend_High | 1.00E+02 to 1.00E+03 | Atmospheric to rough |
| Trend_Mid | 1.00E+00 to 1.00E-03 | Medium vacuum |
| Trend_HV | 1.00E-03 to 1.00E-07 | High vacuum |
| Trend_UHV | 1.00E-07 to 1.00E-10 | UHV regime |
Implement with a screen-level "Decade Selector" combo box that swaps which trend is visible (using the Visibility property bound to a tag), or stack all four trends vertically with a shared time axis (same Update cycle on every object).
Configuring the Decade Selector
- Insert a Symbol List or Combo Box from the toolbox.
- Populate with four entries ("Atmospheric", "Rough", "Medium", "HV").
- Bind a tag (e.g.,
Vacuum_Decade, INT) to the Selection property. - Set the Visibility expression on each trend object to show only when the corresponding integer matches (e.g.,
Vacuum_Decade == 0for Trend_High).
Workaround 4: Right Y-Axis Assignment
The Trend View supports an additional right-side Y-axis assigned to a specific data series. Right-click the colored line icon next to the series in the legend, choose Y-Axis Assignment, and pick Right. Each axis can have its own LowerLimit and UpperLimit.
Combine with Workaround 1 to plot raw pressure on the left axis (linear, mBar, 0-1000) and the pX log signal on the right axis (linear, pX, -3 to 10). The operator sees the linear mBar trace for at-a-glance reading and the log trace for diagnostic resolution at low pressure. The same architectural pattern is used by other visualization platforms such as Grafana; the WinCC Flexible Trend View supports it natively. Reference: Wikipedia - Logarithmic scale for axis theory.
Migration Considerations: TIA Portal WinCC Comfort / Advanced
TIA Portal WinCC Comfort V18 / V19 (successor to WinCC Flexible for Comfort Panels) and WinCC Advanced V18 / V19 (successor for PC-based RT) carry the same linear-only restriction on the Trend View Value axis. The recommended migration path is identical:
- Create the pX calculation as an SCL FB with instance DB in the PLC program.
- Tag the pX result as the trend source in the HMI tag table.
- Configure the Comfort Panel Trend View with LowerLimit = -3, UpperLimit = 10.
- Recompile and download to the panel.
TIA Portal-Specific Advantage: Generic LogBase FB
With the TIA Portal EXPT (x^y) function together with the LOG instruction, you can build a generic logarithm-to-any-base FB:
// Function block: fb_LogBase (S7-1200/1500 SCL, TIA Portal V18)
FUNCTION_BLOCK "fb_LogBase"
VAR_INPUT
value : REAL;
base : REAL;
END_VAR
VAR_OUTPUT
result : REAL;
END_VAR
BEGIN
IF #value > 0.0 AND #base > 0.0 AND #base <> 1.0 THEN
#result := LN(#value) / LN(#base);
ELSE
#result := 0.0;
END_IF;
END_FUNCTION_BLOCK
This allows future migrations to natural-log, base-2, or decibel scales (10 * log10(P/P0)) without rewriting the conversion. Reference: SIMATIC S7-1200/1500 SCL programming manual.
Verifying the Log-Scale Trend Implementation
After deployment, perform the following verification on the panel or in the WinCC Flexible Runtime simulation (RT):
- Inject calibration pressure values from a precision voltage source or a calibrated pressure controller:
- 1.00E+03 mBar → pX should read -3.000
- 1.00E+00 mBar → pX should read 0.000
- 1.00E-03 mBar → pX should read 3.000
- 1.00E-09 mBar → pX should read 9.000
- Confirm the trend trace occupies evenly spaced vertical positions for each decade marker.
- Toggle the saturation path: inject 0.0 mBar and confirm pX clamps to 20.0 (or whatever sentinel value you selected).
- Cycle power on the panel and confirm the trend archive resumes with the correct pX values.
- Verify tag logging limits (WinCC Flexible: license-dependent, typically 5000 tags / 1000 logs) and adjust the segment size if the archive runs short of disk space.
- Confirm the audit trail (if 21 CFR Part 11 / EU Annex 11 applies) records the pX value, not the raw mBar, so what the operator saw matches what was archived.
Troubleshooting Matrix
| Symptom | Root cause | Remediation |
|---|---|---|
| Trend shows a flat line at the bottom across all pressures | PLC feeds raw mBar but axis scaled in pX units; no transformation done | Implement Workaround 1 (PLC log10) or Workaround 2 (VBScript) |
| Trend shows NaN or 0 after pX deployment | Pressure sensor returned 0 or negative; LN(0) is undefined | Add the IF pressure > 0 guard in SCL or VBScript |
| Trend shows discrete jumps at decade boundaries | Sensor delivers log-mapped 4-20 mA (e.g., Pfeiffer TPR gauge); feeding raw counts to a log function double-transforms | Convert 4-20 mA to engineering units linearly FIRST, THEN apply log10 |
| Trend archive stops logging after pX tag change | Tag rename broke the archive binding | Re-bind the archive source tag in the Logging tab; restart Runtime |
| pX value is reversed (low pressure at top) | WinCC axis LowerLimit set higher than UpperLimit | Swap so that LowerLimit = -3, UpperLimit = 10 |
| VBScript does not execute | Tag name typo or scheduler not armed | Verify SmartTags spelling; check Scheduler → Trigger tab is enabled |
| Trend time base wrong after migration to TIA Portal | Default Update cycle changed from 1 s to 500 ms | Adjust Trend View Update property to 1 s to match legacy |
| Trend shows negative pX values drifting positive on warm-up | Sensor cold-start offset < 1E-09 mBar | Clamp sensor minimum to 1E-10 mBar in the analog conditioning circuit |
| Panel runs sluggish after deploying VBScript | Too many tag-computed scripts | Move the calculation to the PLC (Workaround 1) |
Field Commissioning Notes
- Dropping the VBScript cycle below 250 ms on a TP177B 4" panel measurably degrades Runtime responsiveness. Default to 500 ms or 1 s for HMI panel targets.
- Some Pirani / Penning combination gauges (Pfeiffer PCR 280, INFICON BPG400, MKS SRG-3) deliver a single analog output that itself is log-scaled between 5E-04 and 1E-09 mBar on 0-10 V. Mixing these "log-scaled voltage" signals with the log10 math described here will produce a squared-log display. Convert the voltage to mBar linearly first.
- For FDA 21 CFR Part 11 or EU Annex 11 installations, the pX tag MUST be the archived value (not the raw mBar) so the audit trail records what the operator actually saw.
- Vacuum gauge controllers from MKS, Granville-Phillips, and Inficon often expose Modbus holding registers containing IEEE-754 REAL pressure in mBar. Read those registers directly into the PLC and skip the analog path entirely.
- Some Penning gauges (Pfeiffer IKR 270) can be turned off below a threshold to extend filament life. Tie the gauge enable tag to the pX value (e.g., enable when pX > 3, disable when pX > 7) to protect the filament at UHV.
- Cross-check the calculated pX against the gauge controller's local display to verify the conversion factor. A mismatch of 1 pX unit indicates a base-10 / natural-log error in the PLC code.
Related Standards and References
- AVS Standard 4.1 - nomenclature for vacuum pressures (American Vacuum Society)
- ISO 3529 - Vacuum technology - Vocabulary
- SEMI E12 - Standard for vacuum pump exhaust
- Wikipedia - Logarithmic scale (mathematical background)
- Siemens Industry Online Support - WinCC Flexible / TIA Portal WinCC documentation
Note: Standards above are listed for reference only. The engineer remains responsible for verifying conformance with the local regulatory dossier applicable to their installation.
FAQ
Can I switch the WinCC Flexible trend Y-axis to logarithmic directly?
No. The Trend View Value axis is linear-only in WinCC Flexible 2008 SP5 and all prior service packs. Pre-transform the value with log10 in the PLC or VBScript and plot the linear-mapped result on a standard linear axis.
What is the pX convention and why use it for vacuum?
pX is -log10(pressure in mBar). It maps the 9-decade range of typical vacuum processes to a linear -3 to 10 scale that WinCC Flexible can plot natively. pX 9 = 1E-09 mBar, pX 3 = 1E-03 mBar, pX 0 = 1 mBar, pX -3 = 1E+03 mBar.
What PLC function block computes log10 on S7-1200 / S7-1500?
Use the LN (natural log) instruction in SCL and divide by LN(10) = 2.302585093. Wrap it in an FB so the function can be reused for any log base. Guard against value <= 0 because LN is undefined there. The same pattern works in S7-300/400 STL using the IEC LN instruction.
Does TIA Portal WinCC Comfort / Advanced have a true logarithmic Y-axis?
No. The Trend View Value axis remains linear in TIA Portal WinCC Comfort V18 / V19 and Advanced V18 / V19. The PLC-side pX conversion pattern carries over unchanged, and the generic fb_LogBase FB makes future scale changes trivial.
How do I avoid double-logging when my sensor already outputs a log-scaled voltage?
Convert the log-mapped voltage back to mBar linearly (using the manufacturer's published transfer function, e.g., Pfeiffer TPR 280: 0 V = 1E-09 mBar, 10 V = 5E-04 mBar) BEFORE applying log10. Otherwise the trend will show the log of a log and the curve will appear with extreme compression.