IMDTouchKnowledge BaseShop main store

Troubleshooting

Why a WinCC Unified on-demand trend exports 4 samples per second

HMI and touchscreens Published 8 min read By IMDTouch engineering team

Short answer

The export reads the stored log, not the screen, so a file at 4 samples per second means the exported series is still written on a fixed cycle of 250 ms. Set Logging mode to On demand with a Trigger mode other than none, bind the Trigger tag, point the trend series at the logging tag, and export only records written after the download.

On this page
  1. Why does my on-demand trend export about 4 samples per second?
  2. What does Logging mode On demand actually change?
  3. How do I set the trigger properties on the logged tag?
  4. Why does the trend show no points with Logging mode On demand?
  5. Why does one trigger event write two log records?
  6. Is the trend series bound to the logging tag or to the live tag?
  7. Why does the CSV still show dense data after I fixed the logging mode?
  8. How do I verify the on-demand export end to end?
  9. Questions asked

A trend that plots one point per trigger on screen but hands you a CSV at 4 samples per second is not exporting the screen: the export reads the stored log records, and that density means the exported series is still being written on a fixed cycle. The log's content is decided by the logged tag's own properties, so the fix lives on the tag, not in the CSV conversion. Set Logging mode to On demand, choose a Trigger mode other than none, bind the Trigger tag, point the trend series at the logging tag, and export only records written after the download. The checks below run in the order that isolates which of the three usual suspects wrote your file.

Why does my on-demand trend export about 4 samples per second? #

The CSV export reads the stored log records, not the screen, and 4 samples per second works out to one record every 250 ms (1000 ms ÷ 4), which is a fixed cycle: whatever produced that file was not waiting for a trigger that moves once per minute.

A cyclic writer and a trigger-based writer leave different fingerprints, and the record count is the fingerprint that decides it. Count the records across one period of your trigger; a converter only formats the records the log holds, it cannot invent them.

Worked example, with a trigger that toggles once per minute:

  • Period between records: 1000 ms ÷ 4 = 250 ms.
  • Records across one trigger period: 4 samples per second × 60 s = 240 records.
  • Expected records across the same period: 2 with Rising and falling edge, 1 with a single edge.
  • Verdict: 240 ÷ 2 = 120 times the expected count, and only a cyclic writer multiplies records like that.

Three suspects produce such a file:

Suspect Mechanism Decisive check
Another series in the same trend A trend can mix sources, and a cyclic-logged tag writes at its own rate Open each series and read its tag's Logging mode and cycle
The exported tag is still cyclic Logging mode is not On demand on the tag you export Read Logging mode on the logged tag
The series is bound to the live tag The control collects its own samples at its refresh rate and exports those Read the series source: logging tag or raw tag

The fix belongs at the log configuration, not at the converter — the same source-not-export principle as Configuring Easy Chart Excel Exports for Minute Samples. Decide from the record count: a constant interval convicts the log, never the conversion.

What does Logging mode On demand actually change? #

It replaces the fixed acquisition cycle with an event: with Logging mode set to On demand, the tag is written to the log only when the Trigger tag makes the transition selected in Trigger mode, which synchronizes each stored record with a production point instead of with a clock.

A normal trend source acquires every cycle and stores each sample, so the log fills on the clock whether or not anything happened. On demand turns that off for the tag and hands the write decision to a Boolean edge. A period that used to fill with 240 records now holds one or two, each stamped at the trigger instant. The screen does not change; what changes is what the log holds behind it, and the export follows the log.

How do I set the trigger properties on the logged tag? #

Select the logged tag, open its Logging tags tab between the tag table and the inspector window, and set the three properties there: Logging mode to On demand, Trigger mode to an edge option, Trigger tag to your auxiliary Boolean, for example a tag named Trigger.

Create the auxiliary Boolean HMI tag first — the sample projects name it Trigger, and the logged tag is typically something like HMI_Tag_1. Then, on the Logging tags tab of the logged tag:

  • Logging mode = On demand — disables cyclic acquisition for this tag.
  • Trigger mode = Rising edge, Falling edge or Rising and falling edge — any option but none; selects the transition that writes a record.
  • Trigger tag = the auxiliary Boolean — the source of the event.

Set all three or the log never fires. Trigger mode left at none leaves the logger with no event source, which is exactly the configuration behind a trend that never gains a point — the next check.

Why does the trend show no points with Logging mode On demand? #

With no points at all, the tag has no event source: Trigger mode left at none or no Trigger tag assigned means the logger never sees a transition, so nothing is written no matter how long the runtime runs.

On demand removed the cycle that used to feed the log, and without an edge and a tag to watch, nothing replaces it. Set Trigger mode to Rising edge, Falling edge or Rising and falling edge, assign the Boolean as the Trigger tag, and apply the change to the runtime; the next transition writes the first record. Decision: a flat trend with a frozen record count is this missing-source case, while a flat trend whose record count keeps climbing is a cyclic series — the two look alike on screen and separate immediately in the log.

Why does one trigger event write two log records? #

Because Trigger mode is set to Rising and falling edge, which writes one record on each transition, so a trigger that toggles once per minute produces two records per minute; pick Rising edge or Falling edge alone when only one transition marks the event.

A full toggle — false to true and back — fires twice in that mode, once per edge. The behavior is correct when the start and the end of a cycle are both records you need, and pure noise otherwise. Decision: one transition, one record — set the single edge that marks your event and the count drops to one per trigger cycle; keep both edges only for cycles whose end matters as its own record.

Is the trend series bound to the logging tag or to the live tag? #

A series that points at the raw tag ignores the log entirely and collects its own samples at the control's refresh rate, so check each series in the trend and bind the ones you want to export to the logging tag, not to the process tag.

A live-tag line can look perfectly event-driven on screen while its export walks through buffered samples at the refresh cadence — the mismatch behind the original symptom. A trend may hold several series, and one cyclic straggler drags the whole export's density up, so remove duplicate series that point at the same value through a cyclic source. Decision: the exported series must read the log — source each series from the logging tag associated with your tag and delete the live-tag twin.

Why does the CSV still show dense data after I fixed the logging mode? #

Records written under the earlier cyclic setting stay in the log after the download, so any export range that spans them still shows the dense data; set the export start after the download time or clear that log segment, then repeat the one-event test.

Mixing old and new records is the usual reason a corrected configuration still appears to fail. Read the timestamps: dense records before the change-over and event-spaced records after it prove the new mode is live and only old data is in the way. Before you build reporting on export windows, check how long this log keeps its records — Verifying HMI Historical Trend Retention Before Committing covers that side. Decision: keep the export range strictly after the download or clear the segment; never judge the new mode on a range that includes the old one.

How do I verify the on-demand export end to end? #

On a bench runtime with verified test tags, toggle the trigger once with Rising and falling edge and expect exactly two new points; with a single edge, one; then export a short window holding one known event and require the record count to equal the number of selected edges.

Run the checks in order:

  • On the logged tag: Logging mode = On demand, Trigger mode not none, Trigger tag assigned.
  • Trigger idle for several minutes: the trend line stays flat and the record count does not grow; growth with an idle trigger convicts a cyclic series.
  • One full toggle: exactly two new points with both edges selected, one with a single edge.
  • Export a window that starts after the download: the record count equals the edges fired in that window.

Keep the machine in a safe state during the toggle test: the test switch writes an HMI-side tag, but a screen object bound to the wrong tag can move real equipment. The export step itself varies by target and version — for the panel case where an MTP1500 CSV log export needs a script in TIA V20, see Why MTP1500 CSV log export needs a script in TIA V20. Decision: a record count that equals the edges and freezes while the trigger idles means the log and the export are correct; a count that still climbs points to a cyclic series upstream of the converter, never to the conversion.

Questions asked

How do I toggle the trigger tag during the test?

Drag the Boolean trigger tag from the tag table onto a screen as a switch or an I/O field and operate it from the runtime screen. The switch writes the HMI-side auxiliary tag and fires the trigger without touching the PLC program, which keeps the test independent of the machine code and easy to repeat on a bench.

How can I tell from the CSV file which mode wrote it?

Read the timestamp column instead of the plot. Compute the interval between consecutive record timestamps: a constant interval, for example 250 ms, means a cyclic logger wrote the series, while intervals that line up with the trigger transitions mean the on-demand logger did. A file showing both patterns points at records that predate the download.

When do changes to the logging properties reach the runtime?

When the changed project reaches the runtime. On a panel that means compile and download; on a PC runtime it means starting or restarting the station. Until then the running log keeps the old behavior, so records written before the download follow the earlier cyclic setting and stay dense in any export that covers them.

Which Trigger mode should I pick for a process event?

Pick Rising edge when the transition into the state marks the event, Falling edge when leaving it, and Rising and falling edge only when both the start and the end of the cycle are records you need. Both edges double the record count: a one-minute trigger cycle logs two records per minute instead of one.

Keep reading

  • Troubleshooting

    Why MTP1500 CSV log export needs a script in TIA V20

    On an MTP1500 engineered in TIA Portal V20 there is no ExportTagLog system function and no Comfort-style CloseAllLogs/ArchiveLogFile/OpenAllLogs sequence, because Unified logs are SQLite segments, not TXT or CSV files. The documented route is the supplied snippet under Snippets > HMI Runtime > Tag Logging > Export Tag Log as CSV, sequenced with status tags so logging stays open and no samples are lost.

    HMI and touchscreens

  • Explainer

    Why WinCC Unified scripts export tag data as CSV, not Excel

    A WinCC Unified runtime script cannot write an .xlsx file: its JavaScript environment exposes tags, screen items, alarms and system functions, with no file-system or zip library, and an Excel workbook is a zipped XML package. Log the tags, select a start and end time on a screen, and export that range as CSV from the trend control's export or an external log reader, converting UTC to local time in one place.

    HMI and touchscreens

  • Troubleshooting

    Why WinCC Unified CSV access needs an existing directory

    On a WinCC Unified Comfort or Basic panel, the USB device in the X61 port mounts under /media/simatic/X61, and WriteFile and ReadFile require every folder in the target path to already exist — create it on the stick or with CreateDirectory before the first write. When the file contents prove correct but the expected read/write success message never appears, the transfer has succeeded and only the feedback path is faulty.

    HMI and touchscreens

Why a Unified panel trend plots only the current value