WinCC Flexible 2008 Hourly, Daily, Weekly, Monthly Tag Logging

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

1. Overview: Long-Term Historical Logging on WinCC Flexible 2008

WinCC Flexible 2008 (part of the legacy SIMATIC HMI toolchain) supports continuous tag logging and historical trending. The archived values can be aggregated on the HMI runtime into multiple time windows: hourly (1 h), daily (24 h), weekly (7 d) and monthly (≈30 d). This is the standard technique for replacing missing "report" generators on Comfort, Multi Panel, Mobile Panel, TP 177/270/277 and OP 277 platforms where the operator needs to scroll back through shifts and days to investigate process behaviour.

This reference covers a 20-tag logging scenario (2 analog process tags + 18 internal/MW-MD values generated by the PLC logic). It details archive creation, cycle selection, memory-tag logging, Trend View configuration, button-driven time-range switching via VBScript and runtime verification.

End-of-life notice. WinCC Flexible 2008 reached end of active sales in 2013. New projects should use TIA Portal WinCC (Comfort/Advanced). The configuration philosophy described below is directly transferable.

2. Prerequisites

Requirement Specification
Engineering software SIMATIC WinCC Flexible 2008 SP5 or later (HF7 recommended)
HMI runtime licence WinCC Flexible/2008 Runtime; "Archives" option must be enabled on the panel image
Panel class TP 177B, TP 277, OP 277, MP 177, MP 277, MP 377, or PC Runtime
Storage medium Internal flash or external MMC/SD card with at least 1 GB free space
PLC connection MPI/PROFIBUS or Ethernet to S7-200/S7-300/S7-400 (15 process tags + 5 internal) OR all 20 tags internal to the HMI
Memory tags to be logged Word (MW), Double Word (MD), Int, Real — any internal HMI tag

Verify that the target panel supports archives. Operator panels of the 170-series (TP 170B, OP 170B) cannot log. Comfort panels log natively in TIA Portal; on WinCC Flexible 2008 the Multi Panel 177/277/377 and Touch Panel 277/377 are the supported archive targets. See the WinCC Flexible 2008 system manual for the panel-specific archive matrix.

3. Tag Archive Architecture

WinCC Flexible stores values in a Tag Logging archive. Two archive types are available:

Archive type Behaviour Typical use
Short-term (cyclic, non-backing) RAM-resident, lost on power cycle unless persisted Sub-minute trending for diagnostics
Long-term (sequence archive) File-based on flash/MMC, persistent across reboots Shift, daily, weekly, monthly reporting

For a 20-tag continuous logging application a sequence archive is mandatory, otherwise data older than the panel's RAM ring buffer is lost.

3.1 Create the Tag Archive

  1. In the project tree, right-click Tag LoggingNew Archive.
  2. Name: ProcessArchive_1s (or per your logging cycle).
  3. Storage location: File (CSV / RDB).
  4. Archive mode: Segmented circular log with a segment size of 500 kB or 1 day, whichever is reached first. Daily, weekly and monthly windows survive restart because every segment header records an absolute time stamp.
  5. Set the maximum segment count. A conservative value for 20 tags @ 1 s logging is 30 segments × 500 kB ≈ 15 MB; this gives roughly 90 days of data before overwriting the oldest segment.

4. Configuring the 20 Logged Tags

4.1 Analog Process Tags (2)

For the two external analog values coming from the PLC (e.g. DB1.DBD0 temperature, DB1.DBD4 pressure):

  1. Open Tag Logging → Tags and add a new tag.
  2. Select the source: external tag, e.g. Temperature (PLC DBW).
  3. Set Acquisition mode = Cyclic continuous.
  4. Set Acquisition cycle = 1 s (or 500 ms — confirm panel capability).
  5. Assign to ProcessArchive_1s.
  6. Set limits if scaling/range-bar is desired: Lower = 0, Upper = 100, or scaled to engineering units.

4.2 Internal / MW-MD Logic Tags (18)

WinCC Flexible can log internal tags that exist only in the HMI (e.g. derived MW/MD values calculated from the PLC logic). Procedure:

  1. In Communication → Tags create the internal tag, e.g. ShiftCounter as Int, ProdCount as DInt, Energy_kWh as Real.
  2. Use a scheduled Scheduler task or a value-change event in the PLC/HMI to update these tags.
  3. Open Tag Logging → Tags, add each tag and choose Acquisition mode = On change if values change infrequently, or Cyclic if they must be polled.
  4. Cycle recommendation: 2 s or 5 s for non-critical derived values.
Memory footprint warning. Logging 18 internal tags every 1 s for 30 days produces approximately 18 × 86 400 × 30 × 8 B ≈ 372 MB of raw CSV. Lower the cycle to 5 s or 10 s for derived counters to keep archive size under 100 MB/month.

5. Logging Cycle Selection Matrix

Tag class Recommended cycle Trigger Daily volume (20 tags)
Fast analog (pressure, flow) 1 s Cyclic continuous ~1.7 M samples
Slow analog (temperature) 2–5 s Cyclic continuous ~0.35 M samples
Counters / energy 10 s or on change On change (Δ ≥ 1) ~86 k samples
Shift totals On command Shift-end script 3 samples/shift
Aggregated MW/MD from logic 5 s Cyclic ~0.34 M samples

Total archive growth for the reference 20-tag project at the recommended mix: ≈ 2.7 M samples/day → roughly 22 MB of CSV before compression. A 4 GB MMC therefore retains ~180 days of full-resolution history.

6. Configuring the Trend View Control

WinCC Flexible provides the Trend View object for graphical historical display. It supports three time modes:

  • Time range mode — operator picks start and end time, the control zooms into the window.
  • Time axis mode — fixed time per screen pixel (e.g. 1 min/pixel, 1 h/pixel).
  • Time base mode — relative offset from "now" (e.g. last hour, last 24 h, last 7 d, last 30 d).

For the hourly/daily/weekly/monthly switching requested by the customer, use the Time base mode. It is configured per trend:

  1. Insert a Trend View on the desired screen.
  2. Open Properties → Axis → Time axis.
  3. Set Mode = Time base.
  4. Set Time range = 1 h, 24 h, 7 d or 30 d for the four buttons.
  5. Bind each visible trend row to one of the 20 logged tags (or a subset of the most important 6–8 for screen readability).
  6. Enable Scroll bar and Ruler so the operator can read exact values at any cursor position.

7. VBScript to Switch Between Hourly, Daily, Weekly and Monthly Windows

The runtime cannot switch trend time-bases by a simple property; you must rebuild the trend source list with the new time-base offset. The cleanest approach is to maintain four Trend View objects layered at the same screen position with Visible toggled by buttons:

' WinCC Flexible 2008 — Trend View time-base switching
' Place four Trend Views: tvHour, tvDay, tvWeek, tvMonth
' All have Mode = "Time base", TimeRange = 1h / 24h / 7d / 30d

Sub ShowHour()
    SmartTags("tvHour").Visible = True
    SmartTags("tvDay").Visible  = False
    SmartTags("tvWeek").Visible = False
    SmartTags("tvMonth").Visible= False
End Sub

Sub ShowDay()
    SmartTags("tvHour").Visible = False
    SmartTags("tvDay").Visible  = True
    SmartTags("tvWeek").Visible = False
    SmartTags("tvMonth").Visible= False
End Sub

Sub ShowWeek()
    SmartTags("tvHour").Visible = False
    SmartTags("tvDay").Visible  = False
    SmartTags("tvWeek").Visible = True
    SmartTags("tvMonth").Visible= False
End Sub

Sub ShowMonth()
    SmartTags("tvHour").Visible = False
    SmartTags("tvDay").Visible  = False
    SmartTags("tvWeek").Visible = False
    SmartTags("tvMonth").Visible= True
End Sub

Wire each button's Click event to ShowHour, ShowDay, ShowWeek, ShowMonth respectively. The trend view automatically reads from the configured tag-logging archive; no script-side data fetch is needed.

8. Dynamic Time-Range Variant (Single Trend View)

If screen real estate is limited, swap a single Trend View's properties at runtime:

Sub SetRange(ByVal rangeStr)
    Dim tv
    Set tv = SmartTags("TrendView1")
    tv.TimeAxisMode = 1          ' 0 = Time range, 1 = Time base
    tv.TimeBaseRange = rangeStr   ' "0:01:00" / "1.00:00:00" / "7.00:00:00" / "30.00:00:00"
End Sub

Sub BtnHour_Click()  : SetRange "0:01:00"        : End Sub
Sub BtnDay_Click()   : SetRange "1.00:00:00"    : End Sub
Sub BtnWeek_Click()  : SetRange "7.00:00:00"    : End Sub
Sub BtnMonth_Click() : SetRange "30.00:00:00"   : End Sub

The property TimeBaseRange accepts a string in days.hours:minutes:seconds. See the WinCC Flexible scripting manual for the full VBS object model.

9. Logging Internal Tags Without a Trigger Source

For derived MW/MD values that are computed inside the PLC and only refreshed every cycle, the simplest robust logging pattern is:

  1. Create a 100 ms OB in the PLC that copies the desired MD/MW words into a DB data block dedicated to logging.
  2. Expose that DB to the HMI as external tags.
  3. Mark each DB word for logging in Tag Logging → Tags with Acquisition mode = On change.
  4. This prevents archive flooding when the value is identical, while still capturing every meaningful transition.

If the HMI must log purely internal (HMI-side) calculations, use the On change trigger with a hysteresis band, e.g. Limit = 0.5 °C for a temperature tag.

10. Runtime Verification

  1. Compile and download the project to the panel.
  2. Start the panel. Within one logging cycle the trend view should already show live data.
  3. Press the Hour button — the X-axis compresses to the last 60 minutes, ruler shows mm:ss.
  4. Press the Day button — X-axis expands to last 24 h, ruler shows hh:mm.
  5. Press Week / Month — X-axis expands further; verify older data is still rendered (proves archive persistence).
  6. Power-cycle the panel and confirm the historical trace reappears (proves the segmented file archive is being read on cold start).
Field tip. When the trend view comes up empty after restart, the most common cause is that the archive segment path is not configured as a persistent location. Open Device Settings → Archive and set the storage location to the MMC/SD card path /Logs/; never use the volatile RAM path for production logs.

11. Export and Reporting

While WinCC Flexible does not provide a built-in "report designer" with band-style headers, the runtime can export the logged archive to CSV which can be opened in Excel:

  1. On the same screen, place an Output field tied to \Storage Card\Logs\ProcessArchive_1s.csv.
  2. Add a button with the event: StopRuntime is not required — instead use the TraceExport function or the SmartClient viewer.
  3. Use Internet Explorer / browser view control on Comfort Panels to display index.htm served by an SMB share.

For structured shift/daily/weekly/monthly PDFs, the conventional path is to log everything into the archive on the HMI, then use WinCC Explorer on the engineering station to export the archive to a CSV/Excel pivot table. See the HMI report and archive FAQ from Siemens.

12. Troubleshooting Matrix

Symptom Likely cause Corrective action
Trend shows live data but nothing historical Archive storage location = RAM only Switch storage location to \Storage Card MMC\Logs\ or panel internal flash
Historical trace disappears after power cycle RAM-based short-term archive Convert to Sequence archive, enable Persistent segments
Internal tag (MW/MD) does not appear in archive Tag not added under Tag Logging → Tags Right-click archive → New Tag, select internal tag explicitly
Trend View shows flat line Wrong acquisition mode (e.g. On command with no trigger) Change to Cyclic continuous or wire a script-based LogTag trigger
Compile warning "archive segment overflow" Too many tags at sub-second cycle Increase cycle or split into multiple archives
Hour/Day/Week/Month buttons do not switch view VBScript assigned to wrong event Bind to Click, not Press; verify script with Tools → Script Debugger
Time stamp off by 1 h Daylight-saving handling Enable Convert UTC in panel date/time settings
20 tags work individually but cause PLC timeout when all logged Connection overload Reduce poll rate, group tags via PUT/GET, or move derived logic to HMI internal tags

13. Migration Path to TIA Portal

If the project is later converted with the WinCC Flexible → TIA Portal migrator:

  • Archives are converted to Logging DBs (SQLite on Comfort Panels).
  • Trend Views map to Trend Control (Compact) / (Advanced) with the same Time base property.
  • VBScript code migrates largely unchanged; SmartTags becomes SmartTags/Tags with HMI_Tag namespace.
  • The runtime licence "Logging Tags" must be re-counted; confirm with the TIA Portal WinCC Comfort/Advanced manual.

End of life for WinCC Flexible 2008 SP5 is documented under Siemens product support entry 109751463; design new code so it remains migratable.

14. FAQ

Can WinCC Flexible 2008 generate true "daily, weekly, monthly reports" with PDF output?

No. WinCC Flexible 2008 has no native report designer. The accepted pattern is to log continuously into a Tag Logging archive and let the operator browse the trend view across hour, day, week and month windows. PDF report generation is added by TIA Portal WinCC Advanced or by exporting the archive CSV to Excel.

How many tags can a TP 277 / MP 277 archive at 1 second?

The practical limit depends on archive segment size. A TP 277 with a 2 GB MMC comfortably handles 50 tags at 1 s for about 30 days. For 20 tags the cycle can be tightened to 500 ms if needed, but verify the connection to the PLC does not saturate.

Do MW and MD internal tags get logged automatically if I log the DB word they come from?

No. Tag Logging only stores tags you explicitly add under Tag Logging → Tags. Even if the value originates in the PLC MW/MD area, the HMI must have its own internal tag pointing to that address and that tag must be added to the archive.

How do I switch the trend view between last hour, last 24 h, last 7 d and last 30 d?

Use the Time base mode of the Trend View axis and change the TimeBaseRange property via VBScript on button click. The accepted format is days.hours:minutes:seconds — e.g. 7.00:00:00 for seven days.

Why does the historical trace disappear after a panel reboot?

The archive is stored in volatile RAM. Open Device Settings → Archive and switch the storage location to the MMC/SD card or internal flash, then change the archive type from short-term to segmented sequence archive so segments persist across reboots.

Back to blog