WinCC Flexible 2008 Data Logging: Configuring S7-300 Tag Archives

David Krause16 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

1. Overview: Data Logging in WinCC Flexible 2008

WinCC Flexible 2008 is the Siemens engineering suite used to configure HMI panels and the PC Runtime for the SIMATIC HMI family. The software supports a structured mechanism for recording process values from a SIMATIC S7 controller, stamping each record with a system time/date, persisting it to a file system, and exposing it to operators in tabular or trend form. When the controller is an S7-300 CPU 315 (typical catalog numbers 6ES7315-2EH14-0AB0, 6ES7315-2FG14-0AB0, 6ES7315-6TH13-0AB0, and the 315-2 PN/DP variants), the HMI exchanges process data over MPI, PROFIBUS, or PROFINET, and the same tags that are displayed on the screen can simultaneously be written to a Data Log (tag log) on the panel or the PC Runtime.

The mechanism relies on three objects inside the WinCC Flexible project tree:

  • Tags (External tags point at S7-300 DB/bits/I/Q/M areas; internal tags are local to the HMI).
  • Data Logs (also called tag logs; binary ring files stored on the HMI's storage medium).
  • Logging methods (Cyclic, Event-triggered, or Command-triggered; defined per tag).

A data record written to a log contains the timestamp, the tag value, the limit violation flag, and optional user/process information. The record is also re-interpretable by the HMI Runtime for trend, table, and archive views, and can be exported to CSV for offline analysis in Excel, MATLAB, or any historian that accepts comma-separated text.

Note: WinCC Flexible 2008 reached end of life, but the logging architecture is identical to WinCC Flexible 2008 SP5 and the migration target TIA Portal WinCC Comfort/Advanced. The configuration paths below map 1:1 to TIA Portal under "HMI tags > Logs".

2. Prerequisites and Licensing

Before configuring the archive, verify the following engineering and runtime prerequisites.

Item Minimum / Recommended Notes
WinCC Flexible 2008 SP5 (Build 1030) or later Required for S7-300 CPU 315 firmware > V2.5
Runtime target WinCC Flexible PC Runtime 2008 OR Panel-class device (e.g. MP 277, TP 177B 4") Determines storage medium and licensing
S7-300 CPU 315 Firmware V2.5 or higher PROFINET variants need FW V3.x
Connection driver SIMATIC S7 300/400 (MPI/DP/PN) Configured under Project > Connections
License for archives (PC Runtime) WinCC Flexible/Archives option (count-based) Required only on the PC Runtime; on panels, archiving is included in the firmware
License for remote access Sm@rtAccess option Required for Internet/Web access to live HMI screens
Storage medium Multi Media Card (MMC) on panel, NTFS partition on PC Path \Storage Card\Logs\ or C:\Program Files\Siemens\Automation\WinCC Flexible\WinCC Flexible 2008 Runtime\Logs\
License counter: Each archived tag consumes one archive license point. The WinCC Flexible/Archives license comes in 128, 512, 1024, 2048, 4096, and 8192 point versions. Plan the project: 1 pressure tag + 1 temperature tag = 2 points. The license is read by the Runtime at start-up; if the count is exceeded, the Runtime starts in demo mode and stamps a watermark into the logged data.

3. Configuring Analog Tags for S7-300 315

Data logging in WinCC Flexible operates on the HMI's tag database, so the first engineering step is to define external tags that point to the data blocks (DB) of the CPU 315 where pressure and temperature values are stored as floating point (REAL / IEEE 754 single precision).

  1. Open the project in WinCC Flexible 2008 and double-click Tags in the project tree.
  2. Create a new tag, e.g. Pressure_01:
    • Name: Pressure_01
    • Connection: S7300_Panel (already defined under Connections > SIMATIC S7 300/400)
    • PLC address: DB 50.DBD 0 (REAL, 4 bytes)
    • Data type: Float (32-bit IEEE 754)
    • Acquisition mode: Cyclic continuous
    • Acquisition cycle: 1 s (matches a typical pressure sample rate; change to 500 ms or 250 ms if the sensor bandwidth requires it)
    • Limit monitoring: optional, e.g. 0–10 bar (tag properties > Limits)
  3. Create Temp_01 with the same parameters pointing to DB 50.DBD 4.
  4. Verify the tags read correctly in the offline simulation: Project > Compiler > Start Runtime Simulation, open a screen, drag the tag onto a numeric I/O field, and confirm the value reflects the simulated S7-300 area.

For S7-300 CPUs, the connection must be parameterized in Project > Connections > SIMATIC S7 300/400 with the CPU's MPI address (default 2) or the PROFINET device IP. The CPU 315-2 PN/DP variant uses TCP port 102; PROFINET IO controllers poll at 1 ms by default, but the HMI's polling rate is independent and is governed by the acquisition cycle defined on the tag.

4. Creating a Data Log (Tag Log)

The Data Log is the file object that holds the time-stamped records. A log is essentially a binary ring file that holds a configurable number of records before it overwrites the oldest entries (a circular buffer). One log can hold many tags; the trade-off is data consistency vs. file size.

  1. In the project tree, right-click Data Logs > Add new Data Log.
  2. Name the log, e.g. ProcessLog_01.
  3. Configure the storage path:
    • For a panel: \Storage Card\Logs\ProcessLog_01
    • For PC Runtime: C:\PlantData\ProcessLog_01 (any local or UNC path)
  4. Add the columns: Date, Time, Pressure_01, Temp_01, Limit.
  5. Set the record count: 100,000 records for 16-bit; up to 500,000 for 32-bit. On a panel, consider storage endurance: each write is 1 flash cycle; do not write faster than 1 s on MMC.
  6. Define the storage mode: Circular buffer (overwrite oldest) is the default; Linear stops when full.

The binary ring file is not directly human-readable. To read it on a PC, use the Export function on the trend view, the table view, or call the HMI function ArchiveLog with a target format of CSV. WinCC Flexible writes a header row automatically, and decimal separators follow the regional settings of the engineering station (comma vs. period).

5. Configuring Logging Cycles and Triggers

Each tag added to a Data Log can have its own logging method. The choice determines how often the tag value is appended to the log and how the time stamp is generated.

Logging method When a record is written Typical use
Cyclic Every N seconds, regardless of value Continuous process trend (pressure, temperature)
Event-triggered On a defined boolean event (e.g. limit overshoot, batch end) Alarm-driven audit trail
Command-triggered From a script or button via LogTag function Operator-initiated snapshot, recipe result capture

For the analog pressure/temperature channels, set:

  • Pressure_01 > Logging: Cyclic, 1 s
  • Temp_01 > Logging: Cyclic, 5 s (slower physical response)

To add an event-triggered entry (e.g. log only on overpressure alarm), create an internal boolean tag Alarm_PressureHigh, mark it as trigger tag, and set the log method to On change to 1. Each edge of the trigger writes a single record with the current values of all configured columns.

Time stamp source: WinCC Flexible uses the HMI clock by default. The HMI clock is synchronized from the CPU 315 (date/time area pointer > Date/Time) if the S7-300 is configured as the time master (PG/PC > Set PG/PC Interface > Time-of-Day Synchronization). For audit-grade accuracy, replace the panel battery-backed RTC with an external DCF-77 or NTP-synced time source.

6. Displaying Logged Data in Runtime Tables

Operator visibility is provided by the Trend View and the Table View HMI controls. Both are bound to a Data Log, not to individual tags.

  1. Open or create a screen (e.g. Process_Overview).
  2. Insert a Table View from the toolbox (Controls > Table View).
  3. Configure the control > Log: select ProcessLog_01.
  4. Configure the columns: Date, Time, Pressure, Temperature. Uncheck columns that the operator does not need (e.g. limit status) to keep the display readable.
  5. Add toolbar buttons: First record, Previous record, Next record, Last record, Stop update, Print, Export, Reload. The Export button writes a CSV copy of the visible log to a configurable path.

The Trend View control can be used in parallel and reads the same log file; the two controls are dual projections of the same data. On a TP 177B 4" panel, the table view scrolls in pages; on the PC Runtime, the table is interactive and supports Ctrl+F search via the configuration of the table's filter column.

7. CSV File Export and Storage Paths

WinCC Flexible provides three export vectors. Each is a one-time operation invoked by the operator or by a scheduled script.

7.1 Manual export from the Table View

On the Table View toolbar, click Export. The Runtime prompts for a path. Default extension is *.csv. The file layout is:

Date,Time,Pressure_01,Temp_01,Limit
21.05.2024,08:14:32,2.451,84.12,0
21.05.2024,08:14:33,2.453,84.13,0
...

Decimal separator depends on the project's regional settings: engineering stations set to German (de-DE) emit commas, US English (en-US) emits periods. This is critical for downstream parsers: Excel will refuse to import 2,451 as a number if the file is parsed under en-US locale.

7.2 Scheduled export with a VBScript or Scheduled Task

On the PC Runtime, you can attach a VBScript to a screen event that calls the HMI function ArchiveLog("ProcessLog_01", "csv", "C:\PlantData\DailyExport"). The HMI function appends a timestamp to the filename automatically, e.g. ProcessLog_01_20240521_081432.csv.

7.3 Direct file copy on panel

On a panel, the binary log file is at \Storage Card\Logs\. Connect to the panel over Ethernet (Control Panel > Transfer > Enable), then use ProSave to read the file system. The binary file is not the same as a CSV; it must be converted on the engineering station using File > Export > Convert log file.

Storage endurance: Industrial MMCs support roughly 100,000 write cycles per block. A 1 s logging rate of two tags will reach 86,400 records per day; the wear-leveling algorithm distributes the writes, but for long-term use, prefer 5–10 s cycles or use the PC Runtime with a hard drive.

8. Long-Term Archiving and File Management

Long-term archiving is not the same as data logging. A data log is a short-term live buffer; a long-term archive is a controlled rollover into dated CSVs that can be moved to a historian or a network share. WinCC Flexible PC Runtime supports a built-in scheduler:

  1. Open the Runtime properties of the project: Project > Runtime Settings > Archives.
  2. Define a Segment rollover: every day at 00:00, the active data log is closed and renamed with the date suffix, and a new file is opened.
  3. Define an Archive target: local path or UNC, e.g. \\SERVER\HMI_Archive\Line1\.
  4. Activate the Delete archived files older than option to enforce a retention window. Typical values are 90 days for production, 365 days for batch-pharma, indefinite for regulated environments (GxP, 21 CFR Part 11).

The resulting file structure is a daily CSV that is directly consumable by:

  • Siemens WinCC / Historian (via the Connectivity Pack)
  • OSIsoft PI (via the PI Interface for OPC HDA or direct file loader)
  • OSIsoft PI Vision / AVEVA dashboards
  • Python pandas.read_csv for ad-hoc analysis

For 21 CFR Part 11 environments, configure Audit Trail under User Administration. Every log export, log deletion, or tag value change by an operator is recorded in a separate audit log. The FDA Part 11 guidance requires that the audit trail be tamper-evident; WinCC Flexible's audit log is a signed binary, but most production sites export the audit log daily to a write-once network share.

9. Remote Access with Sm@rtAccess

The original question evolved into remote access over the Internet. WinCC Flexible exposes the Runtime over TCP/IP using the Sm@rtAccess option (also marketed as Sm@rtService for remote maintenance, and Sm@rtServer for the HMI-side service). Sm@rtAccess is the licensing option that allows an authorized client to view and operate the HMI screens from a remote location.

9.1 Licensing

Sm@rtAccess requires two licenses on a PC Runtime:

  • Sm@rtServer on the HMI side (one license per HMI station that publishes its screens).
  • Sm@rtClient on the viewing side (one license per simultaneous remote viewer; pool licenses are available).

On a panel, the firmware includes a single Sm@rtClient; to act as a server, the panel must support Sm@rtServer (e.g. MP 277, MP 377, or higher). The S7-300 CPU 315 plays no role in the Sm@rtAccess path; it is purely HMI-to-HMI or HMI-to-PC.

9.2 Configuring the Runtime as a Sm@rtServer

  1. Open Project > Runtime Settings > Services and enable Sm@rtServer.
  2. Set the listening port (default 1024, configurable to 1025/1026 for multi-station setups).
  3. Under User Administration, create the remote operator accounts and assign the required rights.
  4. Activate SSL/TLS (recommended); the certificate is generated on the engineering station and exported to the HMI.
  5. Configure the firewall to forward the Sm@rtServer port to the HMI's IP. The typical topology is router/DSL-modem → NAT → HMI on a DMZ, with the WinCC flexible Runtime exposed on a fixed port and protected by a VPN for production deployments.

9.3 Accessing the Runtime from a client

  1. Install WinCC Viewer RT (or the Sm@rtClient add-on) on the operator's PC.
  2. Open a session and enter the address in the form smarthmi://<public-ip>:<port> or use the DNS name.
  3. Authenticate. The session establishes a virtual screen; the operator sees the same HMI screens as if standing in front of the panel and can navigate, log in, and view the live data tables and trends.
Security: Direct exposure of the Sm@rtServer on the public Internet is a known attack vector. Siemens documentation recommends a VPN (IPsec or OpenVPN), IP allow-listing, and disabling the WebUX feature if not in use. Since WinCC Flexible 2008 reached end of life in 2019, the panel's TLS implementation supports up to TLS 1.0/1.1, which is no longer acceptable for many security policies; place the panel behind a modern reverse proxy or migrate to TIA Portal WinCC Unified for current TLS 1.2/1.3 support.

10. Verification and Commissioning Steps

  1. Compile and download the project to the HMI. On panels, transfer is performed via Ethernet or USB; on PC Runtime, just start the Runtime.
  2. Open the Process_Overview screen and verify that the trend and table view populate within the first acquisition cycle (1 s for pressure, 5 s for temperature).
  3. Trigger a manual log export from the Table View. Confirm the CSV opens in Excel with the correct headers and numeric values.
  4. Restart the HMI Runtime. Verify that the data log re-loads from the persistent file and continues from the last record (no gap in the timeline).
  5. Disconnect the PLC for 30 s. The HMI should continue to log; the tags will show the last valid value, and the log will record it. When the PLC returns, the log resumes live values. This is the "graceful degradation" behavior of WinCC Flexible.
  6. If Sm@rtAccess is enabled, run a remote client session from outside the plant network and validate: login, screen navigation, table view, and trend update.
Acceptance criterion: A log entry is considered valid only if (a) the timestamp is monotonically increasing, (b) the value is within the configured limits, and (c) the record was written before the next acquisition tick. Use a checksum or hash on the CSV row for audit environments.

11. Troubleshooting Matrix

Symptom Likely Root Cause Resolution
Trend and table view remain empty Tag acquisition cycle is 0 or connection to CPU 315 is not established Check Connections > Status; set cycle > 0; verify MPI/PROFINET cabling
CSV shows "###" in the value column Column width too small in Excel; or the value is out of the tag's float range Widen the column; check the PLC DB value with a watch table in STEP 7
Records stop after a few thousand rows Linear storage mode reached the configured record limit Switch to circular buffer or increase the record count
Time stamps jump backwards CPU 315's time is being read at different time zones, or the HMI is re-syncing from NTP Set a single time master; use a plant-wide NTP server; verify the date/time area pointer
Sm@rtClient cannot connect Port 1024 blocked by firewall, or Sm@rtAccess license not present on the HMI Open the port; check Runtime > License tab; verify the certificate is trusted
Log file missing after panel restart MMC card is not seated or formatted to FAT16; storage path invalid Re-seat the card; format to FAT16 with 32 kB clusters; verify path with a file browser via ProSave
Data exports successfully but Excel reads it as text Regional settings mismatch (comma vs. period) Re-export with explicit decimal separator; use Data > Text to Columns in Excel
Runtime starts in demo mode Archive license count exceeded Reduce the number of logged tags or upgrade the archive license; check > Help > About > Licenses

11.1 Diagnostic paths on the S7-300 side

When the HMI shows no data, validate the controller with STEP 7 (or TIA Portal in a migrated project):

  • Open Monitor / Modify and force DB50.DBD0. The value should appear in the HMI within one acquisition cycle.
  • Check the CPU's diagnostic buffer (CPU > Diagnostic Buffer) for MPI/PROFINET communication errors.
  • Verify the connection resource: the S7-300 315 has a limited number of online connections (16 for the 315-2 DP, 32 for the 315-2 PN/DP). Each WinCC Runtime consumes one connection; exceeding the limit causes the CPU to reject new requests with a Connection resources exhausted diagnostic entry.

12. Migration Path to TIA Portal

For new projects, migrate the configuration to TIA Portal V17 or later. The terminology maps directly:

WinCC Flexible 2008 TIA Portal (WinCC Comfort / Advanced / Unified)
External tag HMI tag > Connection > PLC tag
Data Log Logs (tag log)
Logging method > Cyclic Acquisition > Cyclic in background
Logging method > Event-triggered Trigger tag > On change
Archive (PC Runtime) Log > Storage location > SQL database or CSV
Sm@rtAccess WebUX / WinCC Unified Server (modern TLS, REST API)

Migration preserves the data; TIA Portal reads the .srt file and re-emits the configuration. The license model changes: TIA Portal uses subscription-style licensing (Comfort, Advanced, Unified) and tag-count based archive licensing (Log-on-demand).

FAQ

Which log method should I use for continuous pressure and temperature recording?

Use Cyclic logging with a 1 s cycle for fast-changing pressure and 5–10 s for slower temperature. Both records are written to the same Data Log so the timestamps are aligned; this is the most efficient storage for long-term trends.

Why is my CSV file empty after the panel restarts?

The CSV is generated on demand by the Table View's export function, not automatically. The persistent record is the binary ring file on the MMC. To produce a CSV automatically, configure a scheduled ArchiveLog function in the PC Runtime or a daily rollover on the panel.

Do I need Sm@rtAccess to view the HMI over the Internet?

Yes. The default HMI service is local-only. Sm@rtAccess is the licensing and configuration option that opens a TCP listener on the panel (default port 1024) so a remote Sm@rtClient or WinCC Viewer RT can connect. Without the license, the Runtime refuses remote connections.

How many archive tags can I log on a single S7-300 CPU 315 connection?

The HMI side is the bottleneck, not the PLC: the archive license count is the hard cap. A typical 128-point license covers a small machine, 512 covers a line, 1024+ covers plant-wide. The S7-300 315 supports up to 16 (DP) or 32 (PN/DP) simultaneous online connections; multiple HMIs multiply against this limit.

Can I read the binary log file directly from the MMC with a PC?

Yes, the file is on the MMC at \Storage Card\Logs\<LogName>. Use ProSave (Siemens tool) to copy it to the PC, then convert it in WinCC Flexible with File > Export > Convert log file. Third-party tools can also parse the format once you have read the Siemens help on the SRTCSV export filter.

Back to blog