Scaling S7-1200 TIME to Real in WinCC Professional V13

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

Problem Description

When a legacy WinCC v7.0 project is migrated to TIA Portal WinCC Professional V13 or V13 SP1, the HMI tag dialog forces the destination data type for S7-1200 and S7-1500 TIME variables to DInt. The local HMI tag type cannot be changed to Real through the standard Properties pane. The combination box only exposes DInt as a mouse-selectable option. As soon as the user enters a scaling factor of 1:100 to obtain 0.1-second resolution, the fractional component is silently truncated and the HMI panel displays whole-second values only. The legacy WinCC v7.0 I/O field accepted a Real destination type with the same scaling, so the migrated screens display wrong values on operator panels, recipe views, batch reports, and trend archives.

The defect is reproducible in WinCC Professional V13 and V13 SP1 with both Comfort Panels (TP, KTP, MP) and WinCC Runtime Professional. It affects every tag that has a 1:100 or higher scaling factor and a TIME source on an S7-1200 or S7-1500 PLC.

Symptom summary: S7-1200 or S7-1500 TIME value scaled 1:100 displays as a truncated integer on the HMI panel. Local tag type cannot be set to Real through the standard menu. WinCC v7.0 worked correctly with the same scaling.

Affected Platforms, Firmware, and Software Versions

Component Tested Version Status
STEP 7 Professional V13 V13.0 + SP1 Update 4 Affected
WinCC Professional V13 V13.0 + SP1 Update 4 Affected
STEP 7 / WinCC Professional V13 SP2 V13.0 SP2 Defect re-classified; hotfix not confirmed at the time of writing
STEP 7 / WinCC Professional V14 V14.0 + SP1 Fixed via redesigned tag editor
S7-1200 CPU firmware V4.0 - V4.4 Source of TIME tag; no controller-side defect
S7-1500 CPU firmware V1.5 - V2.6 Source of TIME tag; no controller-side defect
Comfort Panels TP / KTP / MP FW 13.0.0.0 and later Display side; no defect
WinCC Runtime Professional V13.0 + SP1 Affected

Confirm the locally installed version with Start > Control Panel > Programs > Siemens Automation > Installed Software or from the TIA Portal splash screen. For S7-1200 firmware identification use Online & Diagnostics > Diagnostics > Module Information in TIA Portal. See the S7-1200 Programmable Controller System Manual (entry ID 109478121) for the corresponding module identification procedure and CPU version matrix.

Root Cause Analysis

The TIME data type on S7-1200 and S7-1500 PLCs is a signed 32-bit value that represents milliseconds, conforming to IEC 61131-3. A 16-bit or 32-bit DInt on the HMI side cannot hold the fractional component produced by a 1:100 scaling ratio. The TIA Portal V13 SP1 tag editor implements the destination-type combo as a fixed enum that omits Real. The legacy WinCC v7.0 tag editor exposed a free-text destination field, so users could specify Real directly and the same scaling worked without truncation.

At the binary protocol layer, the S7-1200 / S7-1500 returns the raw 32-bit DWord value of the TIME variable. WinCC Professional V13 expects a destination type, applies the configured scaling factor, and writes the result into the HMI tag buffer. With DInt as the destination, the conversion DWORD -> DINT is performed first and the decimal part is dropped before the scaling is applied. With Real as the destination, the conversion path is DWORD -> REAL followed by the 1:100 multiplication, which preserves tenths of a second end-to-end.

The PLC firmware is not at fault; the defect is purely in the WinCC Professional V13 SP1 tag-editor dialog. Siemens Industry Online Support has acknowledged the truncation symptom in the WinCC Professional V13 SP1 documentation (entry ID 109091876) and in the related STEP 7 V13 SP1 readme (entry ID 109311041). A formal fix shipped in TIA Portal V14 onward through the redesigned tag editor, which exposes Real directly in the destination-type combo for TIME sources.

Step-by-Step Workaround

The destination-type combo box is read-only against mouse interaction but accepts keyboard input. Typing the value Real directly bypasses the enum restriction and stores a Real destination type for the HMI tag. Once Real is accepted, the scaling factor is applied as a floating-point multiplication and 0.1-second resolution is preserved end-to-end.

  1. Open the migrated project in TIA Portal V13 SP1 and switch to the HMI tag editor view.
  2. Locate the tag whose PLC data type is TIME (for example Motor1_RunTime on DB1).
  3. Select the tag and open the Properties > General pane of the HMI tag inspector.
  4. In the HMI tag type combo box, click the field, clear any existing entry with Ctrl + A, then type the literal text Real and press Enter.
  5. Confirm the entry is accepted - no red squiggly underline, and the status bar reads Real.
  6. Set the scaling factor to 1:100 in Properties > General > Scaling.
  7. Set the I/O field decimal places to 1 under Properties > General > Format.
  8. Optional: Set the unit text to s under Properties > Appearance > Text so operators see the unit suffix.
  9. Compile the HMI station with Project > Compile > Software (rebuild all).
  10. Download to the Comfort Panel or WinCC Runtime Professional and verify the value on-screen.
Important: Do not pick the Real option from the dropdown - it is not in the list. You must type the word Real into the combo field. The same trick works for LReal, WString, and DTL when the source data type demands a non-enumerated conversion that the V13 SP1 dialog does not expose.

Alternative Approaches

If the typed-Real workaround is not acceptable - for example, because the project must be regenerated by an automated build pipeline that calls the TIA Portal Openness API - the following alternatives are field-proven in production environments.

A. Pre-scale on the PLC side

Convert the TIME value to a Real with engineering units in the S7-1200 / S7-1500 user program. Use the standard library function TIME_TO_REAL from the IEC Timer block collection, or the standard conversion operator. Expose a Real HMI tag (for example "DB_Motor".RunTime_s : REAL) and skip the HMI scaling factor entirely.

// SCL snippet for S7-1500 and S7-1200 FW 4.0+
"DB_Motor".RunTime_s := "DB_Motor".RunTime_ms / 1000.0;
// Real in seconds with sub-second precision preserved

Note: TIME_TO_REAL returns milliseconds as a Real value, so divide by 1000.0 to obtain seconds, or by 1000.0 and then scale as required. Keep the source TIME for IEC math and store the Real mirror variable for HMI consumption only.

B. Use DInt with 100 ms tick

If the resolution can be relaxed to whole deciseconds (100 ms), leave the destination as DInt and configure a 1:100 scaling. The displayed value will be a whole number that already represents tenths of a second. Add the unit suffix " * 0.1 s" in the I/O field text. This option loses one decimal place but eliminates the truncation defect without modifying the PLC program.

C. Two-tag approach

Declare one HMI tag as the whole-second DInt (scaling 1:1000) and a second HMI tag as the millisecond remainder using a modulo operation in the PLC. Display both in the I/O field. This approach preserves 1 ms resolution without a Real conversion on the HMI side and works on Comfort Panels without firmware updates.

// SCL - extract whole seconds and millisecond remainder
"DB_Motor".RunTime_s_int := "DB_Motor".RunTime_ms / 1000;
"DB_Motor".RunTime_ms_rem := "DB_Motor".RunTime_ms MOD 1000;

D. Openness automation

When the project is generated by TIA Portal Openness (C# or VB), call HMITag.SetAttribute("DataType", "Real") before compile. The Openness API bypasses the WinCC combo restriction and writes the Real destination type directly. Validate against the STEP 7 V13 SP1 readme (entry ID 109311041) for Openness API changes and the matching reference DLL version.

Verification Procedure

  1. Compile the HMI station. Check the output window for warning W: Tag ... data type Real requires CPU firmware V2.0 or higher - this is informational only and does not block the download.
  2. Download the HMI station to the panel or the WinCC Runtime Professional instance.
  3. Start the runtime and observe the I/O field bound to the affected TIME tag.
  4. Trigger a known value on the PLC. Set the source TIME to T#12.3s, which equals 12300 ms.
  5. Verify the I/O field displays 12.3 with the unit s, not 12.
  6. Watch the value over 30 seconds of execution. No truncation should occur; values like 7.4 s or 9.9 s must be displayed exactly.
  7. Open the HMI tag diagnostics with Tools > Diagnostics > Tag Simulation and confirm the buffer contains the floating-point representation.
  8. Trigger a value-overflow test. Set the source TIME to T#2147483647ms (max positive 32-bit DInt). The I/O field should display 21474836.4 s without overflow if the Real destination is correctly stored.
  9. For Comfort Panels, restart the panel cold and re-check after a power cycle to ensure the typed Real persists in the project XML and the loaded runtime image.

S7-1200 / S7-1500 TIME Data Type Reference

Attribute Value
Length 32 bits, signed
Unit Milliseconds
Range T#-24d20h31m23s648ms to T#+24d20h31m23s647ms (-2,147,483,648 ms to +2,147,483,647 ms)
Resolution 1 ms
Internal representation Two's-complement DWord in little-endian byte order
Default initial value T#0ms
PLC conversion operators TIME_TO_REAL, TIME_TO_DINT, TIME_TO_STRING, TIME_TO_LREAL, TIME_TO_DWORD
Related types LTIME (64-bit ns), S5TIME (16-bit BCD), TOD, DT, DTL

For the full reference and the related LTIME, S5TIME, DTL, and TOD types, see the S7-1200 Programmable Controller System Manual (entry ID 109478121) and the S7-1500 System Manual (entry ID 59191792).

Best Practices for TIME Scaling in TIA Portal HMI Tags

  • Prefer PLC-side conversion. Convert TIME to Real in the user program and expose engineering units directly. This eliminates the HMI scaling dialog entirely and removes any version-specific HMI defect from the critical path.
  • Name the destination variable clearly. Use suffixes such as _s, _ms, _min so the unit is unambiguous to operators and to future engineers maintaining the project.
  • Document the scaling factor in the tag comment. Even when the Real destination is stored, leave a comment: // HMI tag, Real destination, scaling 1:100 = tenths of a second.
  • Avoid 1:1000 (ms resolution) on DInt. The result fits, but the 24.8-day rollover becomes invisible. Use a Real destination or a DTL type if full millisecond precision is required across long runtime intervals.
  • Verify in offline simulation first. Use Tools > Simulation > PLC Simulator with a S7-PLCSIM instance and watch the HMI runtime before going to the live panel.
  • Pin the project XML. After typing Real into the combo, immediately archive the project. Re-opening the tag dialog still hides Real in the dropdown, but the stored XML retains the Real type.
  • Use Openness for batch regeneration. When many tags require the same treatment, drive the fix from a TIA Portal Openness script instead of clicking through every tag manually.
  • Plan a TIA Portal upgrade. V14 and later ship a redesigned tag editor that exposes Real natively. Schedule a migration window once the rest of the project is V14-compatible.

Troubleshooting Matrix

Symptom Probable Cause Recommended Action
I/O field shows whole-second value 12 instead of 12.3 DInt destination with 1:100 scaling Type Real into the destination combo
Combo greys out and reverts to DInt after re-open Project not re-compiled Compile > Software (rebuild all), re-download
Compile error: data type Real not supported on Comfort Panel Comfort Panel firmware older than 13.0.0.0 Update panel firmware to 13.0.0.0 or later
Value shown as 21474836.4 s for T#-24d20h31m23s648ms Two's-complement overflow into positive Real Use DTL type or constrain the source to non-negative
Tag shows ####### on panel Field width too small for the formatted string Increase I/O field width or reduce decimal places
Openness script fails to set DataType to Real Openness API version mismatch with TIA Portal version Match the Openness reference to the installed TIA Portal version
After hot reload, Real is reset to DInt Project XML corrupted by editor save Re-type Real, save, then back up the .ap13 file immediately
Multiple tags share the same Real fix but only some retain it Tag editor silently strips Real on partial compile Compile the entire HMI station (rebuild all), not incremental
Trend view shows stepped values rather than smooth curve DInt destination still active on the trend tag Apply the same Real fix to the trend tag, not only the I/O field

FAQ

Why does WinCC Professional V13 force the destination type to DInt for S7-1200 TIME tags?

The tag-editor combo box in WinCC Professional V13 and V13 SP1 implements destination types as a fixed enum that omits Real. Typing the literal string Real into the combo bypasses the enum restriction and stores a Real destination type that respects the configured 1:100 scaling without truncation.

Does the fix survive an HMI station re-compile in TIA Portal V13 SP1?

Yes. Once Real is typed and accepted, the project XML stores the destination type as Real. The dropdown still does not show Real after a re-open, but the value persists across compile, download, and panel power-cycle as long as the project file is not edited by another tool that strips unknown attribute values.

Is the same workaround valid on S7-300 with S5TIME tags?

No. S5TIME is a 16-bit BCD-encoded value with 10 ms base granularity and the bug applies only to the 32-bit TIME type on S7-1200 and S7-1500. For S5TIME, perform the scaling on the PLC side using S5TIME_TO_TIME followed by the TIME-to-Real path described in alternative approach A.

What is the maximum TIME value that fits in a Real HMI tag after 1:100 scaling?

The S7-1200 / S7-1500 TIME type holds signed 32-bit milliseconds, i.e. +/- 2,147,483,647 ms. After 1:100 scaling the Real value range is +/- 21,474,836.47 s, which is well within the IEEE 754 single-precision Real range used by Comfort Panels and WinCC Runtime Professional.

Which TIA Portal version permanently fixes the truncation defect?

TIA Portal V14 and later ship a redesigned tag editor that exposes Real in the destination-type combo for TIME sources. Projects migrated from V13 SP1 to V14 or higher accept Real without the typed-string workaround and display tenths of a second directly.

Can I script the fix with TIA Portal Openness instead of typing Real manually?

Yes. Use the Openness API call HMITag.SetAttribute("DataType", "Real") against each affected tag before compile. Match the Openness reference DLL version to the installed TIA Portal version per the STEP 7 V13 SP1 readme.

Back to blog