Setting Up Constant X-Axis Trends and Data Logs in WinCC Flexible

David Krause16 min read
SiemensTechnical ReferenceWinCC
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

WinCC Flexible 2004 SPx through WinCC Flexible 2008 SP3 (and later WinCC Comfort/Advanced migrations) provide a trend view object that can be sourced from a connected controller tag or, more usefully for historical review, from a circular data log on the panel's removable storage. When the application demands a fixed look-back window — one week, one month, one year — the X-axis must be configured to render a stable time range regardless of when the operator opens the screen. The data must also survive a power cycle so that it can be printed, exported to a PC, or archived for compliance.

This reference covers the trend object configuration, data log storage paths on MultiMediaCard (MMC) and CompactFlash (CF) media, source-setting entries that bind the trend to the log, re-opening stored archives, and the supported mechanisms for transferring logs from an MP370 or TP270 panel back to an engineering workstation or office PC.

Prerequisites

  • Engineering software: WinCC Flexible 2004 SP3 Hotfix 4 or later; recommended upgrade path is WinCC Flexible 2005 SP1, 2007 SP2, or 2008 SP3 (WinCC Flexible 2005 is the first release with stable Data Log segmented circular logging and improved CSV export behaviour).
  • Runtime panels supported: OP77B, OP170B, TP170B, TP177B, TP270, MP270, MP370 (the panel must be a Windows CE-based device with a CF slot; OP77A and OP3 are not supported for Data Log archives).
  • Storage media: 6ES7 648-0DC20-0YA0 (CF 16 MB) or larger for MP370, 6ES7 648-0DC30-0YA0 (CF 32 MB) minimum for typical weekly trends at 10-minute sample interval. MMC cards (6ES7 648-0AE20-0YA0, 8 MB) only on OP/TP panels predating 2004.
  • Runtime licensing: Standard runtime license for the panel; Sm@rtService (order number 6AV6 617-1AB11-0AB0 in the WinCC Flexible 2005/2007 catalog range) is required only for remote file access over Ethernet. Verify the exact catalog number against the current Siemens Industry Mall before ordering.
  • Network: Ethernet TCP/IP between panel and PC if Sm@rtService, ProSave, or FTP will be used; static IP or DHCP reservation recommended.
Engineering note: Projects created in WinCC Flexible 2004 can be opened and recompiled in 2005/2007/2008 but not in the TIA Portal WinCC Comfort/Advanced without migration. Plan a single upgrade cut-over before deploying archived logs across mixed versions.

Step 1 - Define the Data Log Object

Open the project in WinCC Flexible ES, expand the panel node in the project tree, and select Logs. Insert a new Data Log object. The following table lists the parameters that control storage duration, file format, and physical placement on the panel.

Parameter Typical Value (1-year weekly log) Description
Name MeterLog_1yr Tag used as the log identifier; max 32 characters, no spaces.
Storage location CF card Storage Card MMC path = \\Storage Card MMC\\Logs\\; for CF card = \\Storage Card CF\\Logs\\
Log type Segmented circular log Creates a configurable number of segments; oldest segment is overwritten when full.
Number of segments 52 One segment per week; each segment is a separate file on the CF card.
Entries per segment 2016 10-minute sampling × 24 h × 7 days = 1008; 2016 leaves 100% headroom.
Sampling cycle 600,000 ms 10 minutes as required by the application.
Event-triggered log Disabled For pure time-based trend, leave disabled; otherwise the X-axis becomes irregular.
Format CSV with header Select 'File - Save format: CSV' for PC-readable export; RDB is binary and requires ProSave to decode.
File format caveat: CSV segments written by WinCC Flexible 2004 use a semicolon (;) delimiter and comma (,) decimal separator in the German/French locale builds. English locale builds use comma delimiter and period decimal. Verify the target PC's regional settings before scripting an import.

Step 2 - Configure the Trend View Object

Insert a Trend View onto the desired screen. The trend view properties dialog exposes the trend list, the X-axis (time axis), and the source assignment. For a constant-axis trend, the key parameter group is Properties > Trend > Time Axis.

Property Setting Behaviour
Time axis mode Absolute Anchor the X-axis to a real date/time; the screen always shows the same window regardless of when opened.
Start time 01.01.2024 00:00:00 Define the window left edge; can be tag-driven if a shift calendar tag is used.
End time 31.12.2024 23:59:59 Window right edge; for a 1-year view this is +12 months from Start time.
Time axis label Show month names Operator sees January, February … December regardless of when the screen is rendered.
Major interval 1 month Draws a vertical grid line at each month boundary.
Minor interval 1 week Optional finer grid; useful when sampling is weekly.
Update cycle 1 s Redraw frequency; high values can mask slow logs.
Trend source type Archive tag Binds the trend line to a column of a data log rather than a live process tag.

The same principles apply to a 1-week trend: choose Start = Monday 00:00:00 and End = Sunday 23:59:59 with a 1-day major interval and a 6-hour minor interval. WinCC Flexible's trend view does not automatically roll the start time forward week-over-week; the operator sees the same week repeatedly. If a rolling 7-day display is required instead, use the Relative time axis mode and tag the start time with a script that updates it every Monday at 00:00:05.

Step 3 - Bind the Trend to the Log (Source Setting)

The trend source dialog contains two fields that frequently confuse first-time users. They are answered below.

  1. Log (data log name): Enter the exact name of the Data Log object created in Step 1, e.g. MeterLog_1yr. This is a symbolic reference resolved at compile time; if the log name is changed after the trend is configured, the trend will show a red exclamation icon in the ES and the runtime will display No data.
  2. Log entry (column / field): Select the column within the log that holds the trend value. If the log contains a single measurement, this defaults to that column. If the log contains multiple values (e.g. flow, pressure, temperature stored side-by-side), each trend line must be bound to the correct column. The column list is populated from the Data Log configuration's tag list.

For multiple variables in one log, configure one trend line per variable and assign each line to its own log column. For per-variable logs (one Data Log object per tag), simply set Log to the tag's log and accept the single available Log entry.

Compile warning: If WinCC Flexible reports Trend source tag not connected, the most common cause is a typo in the log name (case-sensitive) or a missing Data Log object. Re-check the project tree under the panel node before debugging deeper.

Step 4 - Storage Paths on MMC / CF Card / Internal Flash

WinCC Flexible writes data logs to one of three device paths. These are the canonical paths used by the runtime to open, append, and rotate segments.

Path Physical Media Typical Use
\\Flash\\Storage\\Logs\\ Internal flash (PROGRAM) Small, persistent; survives card removal. Limited to ~512 KB on MP370.
\\Storage Card MMC\\Logs\\ MMC card slot Older OP170B, TP170A panels.
\\Storage Card CF\\Logs\\ CF card slot TP270, MP270, MP370; the recommended location for > 1 MB logs.
\\Storage Card USB\\Logs\\ USB stick (panel-dependent) Panels with USB host port (TP177B, MP177, Comfort panels).

Each segment of a segmented circular log is stored as a separate file: <LogName>_<YYYYMMDD>_<SegmentNumber>.csv. Operators can browse to the Logs folder on the panel using the file viewer in the Control Panel > File Explorer, but do not delete segments from the panel file viewer while the runtime is running; this corrupts the segment index and the trend view will display gaps or refuse to draw.

Step 5 - Re-opening Stored Archives on the Panel

WinCC Flexible Runtime supports re-opening historical segments directly inside the trend view, without any PC intervention. Two mechanisms are available.

  1. Time-range navigation toolbar: In the trend view's properties, enable Toolbar > Time range selection. The operator can then tap the calendar icon, select any start/end within the span covered by the available segments, and the trend redraws.
  2. External tag-driven navigation: Two HMI tags of type Date/Time can be configured as Trend start and Trend end. A VBScript on the screen can compute the desired window (for example, the previous calendar week) and write those tags on button press, which causes the trend to redraw automatically.

For a sample VBScript that snaps the trend to the previous calendar week:


' Compute Monday 00:00 of the previous ISO week and the following Sunday 23:59:59
Dim dToday, dMon, dSun, iDow
Set dToday = SmartTags("InternalTag_CurrentDate")
iDow = Weekday(dToday, vbMonday)   ' 1 = Monday
Set dMon = DateAdd("d", -(iDow + 6), dToday)
Set dSun = DateAdd("d", 6, dMon)
SmartTags("TrendStart") = CDate(FormatDateTime(dMon, vbShortDate) & " 00:00:00")
SmartTags("TrendEnd")   = CDate(FormatDateTime(dSun, vbShortDate) & " 23:59:59")

The same approach works for a rolling 12-month view by setting TrendStart to the first day of the same month one year prior and TrendEnd to the current day.

Step 6 - Transferring Archived Logs from MP370 / TP270 to a PC

Three methods are commonly used to move log segments off the panel. They are mutually compatible and can be combined.

Method A - Manual CF card swap

  1. Stop the runtime (Control Panel > OP > Stop Runtime).
  2. Power down the panel and eject the CF card.
  3. Insert the CF card into a USB card reader on the PC.
  4. Copy the contents of \\Logs\\ to a network share.
  5. Reinsert the CF card, power up, restart runtime.

This is the most reliable method when the panel is installed in a cabinet without network access, and is the only method guaranteed to copy segments while the runtime is offline.

Method B - ProSave over Ethernet

  1. Install ProSave (bundled with WinCC Flexible or available on the Siemens support portal at support.industry.siemens.com).
  2. Configure the panel's Ethernet interface (Control Panel > Network) with a static IP in the same subnet as the PC.
  3. Enable the panel-side transfer mode (Control Panel > OP > Transfer; enable 'Remote Control' and 'FTP').
  4. From ProSave, select Panel > File Browser, navigate to \\Storage Card CF\\Logs\\, mark the segments, and save to a local folder.

Method C - Sm@rtService / Sm@rtServer

  1. Activate the Sm@rtService option on the panel (Control Panel > Sm@rtService > Start).
  2. From the WinCC Flexible ES, connect to the panel using Transfer > Sm@rtService with the panel's IP address and the password set in step 1.
  3. Once the remote desktop session is established, the operator has read access to the CF card via the on-panel file viewer. File write/delete operations from the remote session are restricted in stock WinCC Flexible 2005/2007 builds.
  4. For true bidirectional file transfer, use the bundled ProSave file browser (Method B) which routes over the same Sm@rtService channel on TCP port 102 (ISO-on-TCP) plus the proprietary transfer port 5001.
Clarification on Sm@rtService transfer semantics: In WinCC Flexible Runtime, Sm@rtService (later branded Sm@rtServer in TIA Portal) provides remote viewing and operation of the panel HMI, not direct file-system read/write of the CF card. Operators using Sm@rtService can read data logs through the trend view but cannot drag-and-drop CSV files off the card. For file-level extraction, ProSave (Method B) or the manual card swap (Method A) is required. This nuance is frequently misunderstood in field deployments.

Method D - Third-party FTP server on the panel

Third-party FTP daemons (commonly Cerio or the open-source FileZilla Server CE port) can be loaded onto MP370 panels running Windows CE 5.0. Once installed, the panel presents its CF card as an FTP root and any FTP client on the network can GET the CSV segments on a schedule. This avoids the Sm@rtService license fee but introduces a non-Siemens component that must be maintained and validated against the operator's cyber-security policy.

Step 7 - Printing the Trend

Printing directly from the panel uses the on-board printer driver (HP LaserJet III emulation) over USB. Configure a Print job on the screen's button event with the following parameters:

Field Value
Print job name PrintTrend_1yr
Print area Screen with trend view
Print mode Hard copy (graphic)
Number of copies 1
Trigger Button event OnClick

For unattended monthly or yearly prints, schedule a Scheduler task on the panel (or a script on the controller) that opens the trend screen at the desired snapshot time and triggers the print job. Be aware that the panel's print buffer is limited and a long queue can stall the runtime if the printer is offline.

Step 8 - Verification Checklist

  1. Compile the project in WinCC Flexible ES with no warnings under Messages window.
  2. Transfer the project to the panel, run for at least one full sampling interval (10 minutes for the example configuration).
  3. Confirm a CSV file appears under \\Storage Card CF\\Logs\\ on the panel via Control Panel > File Explorer.
  4. Open the trend view on the panel; verify the X-axis shows the configured start/end dates and the trend line contains at least one sample.
  5. Force a power cycle of the panel; restart runtime and confirm the trend redraws the previously captured samples (proves persistence).
  6. From a PC, run ProSave File Browser (or FTP client if Method D) and confirm the CSV segment can be retrieved.
  7. Open the CSV in Excel; confirm the timestamp column is in the expected locale format and the value column matches the live tag.

Troubleshooting Matrix

Symptom Likely Cause Resolution
Trend view shows No data Log name typo, log not started, or trend source type is set to Tag instead of Archive tag Re-check the Source Setting dialog; verify Start log on panel startup is enabled in the Data Log properties
X-axis labels shift every page refresh Time axis mode is Relative rather than Absolute Change Time axis mode to Absolute and supply fixed Start/End tags
Samples are recorded but trend line is flat at zero Wrong Log entry column selected, or column is bit-typed for a numeric tag Verify the column data type matches the tag type; recreate the trend line and re-bind
CSV file grows beyond CF card capacity Sampling cycle too fast, or segments too large Reduce segment count or increase sampling interval; consider gzip compression in post-processing
ProSave cannot connect to panel Firewall blocking TCP 102/5001, panel Remote Control disabled, IP mismatch Open the firewall ports, enable remote transfer on the panel, verify ping and arp
Sm@rtService session connects but file browser is greyed out License missing or session opened in read-only mode Confirm the Sm@rtService license is present on the panel (Control Panel > OP > Licensing); switch to ProSave for file operations
Trend prints garbled or truncated Printer driver mismatch, paper size, or buffer overflow Set the printer to HP LaserJet III PCL mode; reduce the trend's rendered area to fit the printable page
CSV shows wrong decimal separator on PC Locale mismatch between panel and PC Standardize the panel locale at compile time (Project > Language > Locale); pre-process CSV with a sed/awk script on the PC
WinCC Flexible 2004 ES will not compile Project corrupted by SP upgrade; or referenced library missing Upgrade the engineering station to WinCC Flexible 2005 SP1 minimum; recompile from source backup

Migration Path from WinCC Flexible 2004

WinCC Flexible 2004 is no longer maintainable for production systems. The recommended migration targets are:

  • Same-platform upgrade: WinCC Flexible 2008 SP3 (final release in the WinCC Flexible family). Projects open directly; recompile and transfer.
  • TIA Portal migration: WinCC Comfort or WinCC Advanced in TIA Portal V18 or later. The project must be migrated using the Migration Tool; some legacy script constructs require manual rewriting. Data log archives on the CF card are forward-compatible at the CSV level.

Operators who continue to maintain WinCC Flexible 2004 installations should at minimum install the latest hotfix package and disable Autorun on the panel's Control Panel to prevent the well-documented boot-loop bug present in the 2004 RT build.

Field-Proven Caveats

  1. Time zone and DST: The panel's clock should be synchronised to the controller via the Time synchronization area pointer, or to an SNTP server. Without synchronisation, the constant X-axis will drift relative to wall-clock months, and the trend view's month-boundary grid lines will not align with operator expectations.
  2. Storage Card MMC vs Storage Card CF: The path string differs. Code that hard-codes \\Storage Card MMC\\ on an MP370 panel returns Path not found. Use WinCC Flexible's Device path symbolic references rather than raw strings where possible.
  3. Segment index corruption: Removing the CF card while the runtime is appending can corrupt the active segment. Implement a controlled shutdown routine that flushes buffers before card ejection (Control Panel > OP > Stop Runtime > wait 5 s).
  4. Trend view performance: Rendering more than four trend lines on a 6" TP270 at 1 s refresh can drop frame rate below usable levels. Use Value axes > Common mode to scale multiple lines on a single axis and reduce draw cost.
  5. Sample value resolution: The default CSV format records 6 significant digits. For revenue-metering applications, set the tag's display format to Float (32-bit IEEE) and verify with a calibration trace before commissioning.

Related Siemens Documentation

How do I display a trend with a constant one-week X-axis in WinCC Flexible?

Set the trend view's Time axis mode to Absolute, fix Start time to Monday 00:00:00 and End time to Sunday 23:59:59, set Major interval to 1 day, and bind the trend source to a Data Log configured with a 10-minute sampling cycle and a 7-day segmented circular log. The X-axis will always render Monday-Sunday regardless of when the operator opens the screen.

Where is the Data Log stored on an MP370 or TP270 panel?

Logs are stored under \\Storage Card CF\\Logs\\ on the CompactFlash card (or \\Storage Card MMC\\Logs\\ for older MMC-based panels). Each segment of a segmented circular log is a separate CSV file named <LogName>_<YYYYMMDD>_<Segment>.csv. The card must remain inserted while the runtime is writing; ejecting it without stopping the runtime first will corrupt the active segment.

What is the difference between the Log and Log entry fields in the trend source dialog?

Log is the symbolic name of the Data Log object in the project tree (for example MeterLog_1yr). Log entry is the specific column within that log that holds the trend values. For multi-variable logs, each trend line must be bound to the correct column; for single-variable logs the default selection is sufficient. Both fields are case-sensitive and must match the project configuration exactly.

Can I transfer data log files from the panel to a PC using Sm@rtService?

Not directly for file-level copy. Sm@rtService provides remote viewing and operation of the HMI screens, including the trend view, but it does not expose the CF card as a file-system root for drag-and-drop transfer. To move the CSV files to a PC, use ProSave's File Browser over Ethernet (TCP ports 102 and 5001), remove the CF card and read it in a USB card reader, or install a third-party FTP server on the panel. The Sm@rtService session remains useful for verifying that the correct segment is selected before initiating the transfer via ProSave.

How do I print a trend view once a month or once a year automatically?

Create a Print job bound to the trend screen with print mode Hard copy (graphic), then trigger it from a Scheduler task on the panel or from a controller-side script that opens the trend screen and invokes the print job at the desired date and time. For multi-year archiving, prefer CSV export to a network share over direct printing; printing the same file every month produces duplicate paper, whereas a CSV can be appended to a master logbook and versioned automatically.

Should I upgrade from WinCC Flexible 2004 to a newer version?

Yes. WinCC Flexible 2004 has known boot-loop bugs in its runtime build and is no longer serviced. The minimum recommended upgrade target is WinCC Flexible 2008 SP3 (same tool family, direct project open). For long-term support, migrate to WinCC Comfort or WinCC Advanced inside TIA Portal V18 or later using the Siemens migration tool; CSV data logs written by WinCC Flexible remain readable by the newer runtime, so archived history is preserved across the cut-over.

Back to blog