HMI Engineering · Technical Blog

HMI Shift and Production Report: Counters, Runtime Data and CSV Export

Production meetings run on numbers that someone has to collect. This lesson builds those numbers in the PLC, displays them on the panel and exports a shift report to CSV so nobody copies figures onto paper again.

2,500+ engineers trained 4.9/5 Google rating 21+ years, Chinchwad, Pune Next batch: contact for dates
Quick answer

Count production and runtime in the PLC using retentive counters and timers, publish them to the HMI interface DB, then use a scheduled task or a button with the LogFileCopy or export functions to write a CSV to USB or a network drive at shift end. Reset shift totals only after the export has succeeded.

  • Counters and runtime totals belong in the PLC with retentive memory, so a panel restart never loses production data.
  • Separate shift totals from lifetime totals; resetting the wrong one destroys the machine history.
  • Export before reset, and confirm the file was written before clearing anything.

Production Data the PLC Should Provide

Everything on a shift report starts as a counter or a timer in the controller. Build them in the PLC where they are safe from a panel restart, and publish them as read-only values to the HMI.

ValueSourceData type
Good parts producedCTU on the completion sensorDINT, retentive
Rejected partsCTU on the reject gateDINT, retentive
Machine running timeAccumulating timer while runningDINT seconds, retentive
DowntimeAccumulating timer while faulted or idleDINT seconds, retentive
Number of stopsCTU on the falling edge of RunningINT, retentive
Longest stopMaximum of the stop timerDINT seconds
Last cycle timeTimer captured at cycle endREAL seconds

Mark the counters and totals retentive so they survive a power cycle. Counter programming details are covered in Siemens PLC counters CTU, CTD and CTUD.

Count from a sensor that sees the finished part, not from the command that starts a cycle. Counting commands means an aborted cycle still counts as production, and the report quietly overstates output.

Shift Totals, Lifetime Totals and Reset Logic

Keep two sets of numbers. Shift totals are reset at every shift change. Lifetime totals never reset and are the basis for maintenance intervals and machine history.

A safe reset sequence looks like this:

  1. The shift end event occurs, either from a scheduled task or an operator button.
  2. The current shift values are copied into a snapshot structure.
  3. The report is written to file from the snapshot.
  4. The write is confirmed successful.
  5. Only then are the shift counters cleared, while lifetime totals continue accumulating.

Copying into a snapshot first matters more than it looks. If the report is generated directly from the live counters, a part completed during the export lands in neither the old shift nor the new one.

Protect the reset with a user authorisation so an operator cannot clear production figures accidentally. User groups are covered in HMI user administration and runtime settings.

Displaying the Shift Summary on the Panel

The shift screen should answer three questions at a glance: how much have we made, how much time did we lose, and what stopped us.

  • Output block: good parts, rejects and reject percentage as output fields.
  • Time block: running time, downtime and availability as a percentage.
  • Stop block: number of stops, longest stop and the most recent fault text.
  • Rate block: parts per hour, calculated in the PLC rather than the panel.

Do the arithmetic in the PLC. A percentage calculated on the panel exists only there, so the same figure sent to SCADA or a report will not match. One calculation in the controller keeps every display consistent.

Add a small trend of parts per hour across the shift if the panel supports data logging, using the setup in HMI trends and data logs. A flat line with one deep notch tells a supervisor exactly when the problem happened.

Build production reporting in class

Sessions cover PLC counters, HMI reports, WinCC archives and SQL Server reporting for real plants.

Book a Free Demo Class

Exporting the Report to CSV

Comfort panels can write CSV files to an SD card, a USB stick or a mapped network path. There are two practical routes.

Data log export

Log the shift values to a data log configured as segmented, so each shift produces its own file. Then use the system function that copies or closes the log at shift end. The file lands on the storage medium in CSV format ready for Excel.

Scripted export

On panels that support VBScript, a script can assemble a formatted report with a header row, the shift values and a timestamp, then write it to the target path. This gives full control over layout at the cost of a script to maintain.

TriggerConfigured inNotes
Scheduled task at a fixed timeScheduled tasks, time-of-day triggerReliable for fixed shift patterns
Operator button at shift endButton event calling the export functionSuits variable shift timings
PLC bit at end of production runScheduled task on tag changeBest for batch or order based production

Always test what happens when the USB stick is missing or the network path is unavailable. The export must fail visibly with an alarm, and the reset must not run. A silent failure that also clears the counters loses a shift of data permanently.

Hands-On Lab: Build and Export a Shift Report

Hands-on
Before you start
  • TIA Portal with WinCC Comfort and a panel or simulation
  • PLC counters and runtime timers with retentive memory
  • An SD card, USB stick or simulated storage path
  • Estimated time: 45 minutes
1

Build the counters

Create retentive counters for good parts, rejects and stops, plus accumulating timers for running and downtime.

Values continue from their previous state after a PLC restart.
2

Publish and display

Copy the values into the HMI interface DB and build a shift screen with output fields and calculated rate and availability.

All figures update live and match the PLC values exactly.
3

Create the snapshot

Add a snapshot structure and copy shift values into it when a shift end bit is set.

The snapshot holds a frozen set of values while production continues.
4

Configure the export

Set up a segmented data log or a scheduled task that writes the snapshot to CSV on the storage medium.

A CSV file appears on the medium with a header row and correct values.
5

Test the failure case

Remove the storage medium and trigger the export again.

The export fails with a visible alarm and the shift counters are not cleared.
Checkpoint—how to know you did it right

Production data survives restarts, shift and lifetime totals are separate, the export produces a readable CSV, and a failed export never clears the counters.

Frequently asked questions

Should counters be kept in the PLC or on the HMI?

In the PLC with retentive memory. A panel can be replaced, restarted or swapped for a spare, and production data must not depend on it.

Why copy values to a snapshot before writing the report?

So parts produced during the export are not lost between the closing shift and the new one. The report is written from a frozen set of values.

Can a Comfort panel write directly to a network drive?

Yes, if the path is reachable and the panel has permission. Always handle the case where the network is unavailable, so the export fails visibly instead of silently.

Where should availability and parts per hour be calculated?

In the PLC. Calculating on the panel means SCADA, reports and the panel can each show a slightly different number for the same shift.

Reviewed by Bhawesh Kumar SinghIndustrial Automation Trainer and Industry 4.0 Consultant · Softwell Automation · 21+ years industry experience

Get the full syllabus + free demo class

Share your details—a Softwell training advisor will contact you with batch dates, fees and hardware-practice options.

No spam. Used only to share course details for this enquiry.

Learn with practical industrial examples

Join live online, Pune classroom or corporate in-plant automation training.

Request Course Details
Verified learning pathway

Discuss HMI Shift and Production Report

Explore practical curriculum, software, hardware and batch options for this technology.

Content reviewed: 09 September 2026

Siemens PLC & TIA Portal Learning Path

Continue with the related Siemens PLC tutorials in this practical learning series.

  1. SCL vs Ladder Logic
  2. Upload PLC Program
  3. TIA Selection Tool
  4. Analog Input Scaling
  5. PLC Counters
  6. PLC Timers
  7. Addressing & Data Types
  8. Hardware & PLC Tags
  9. OB, FB, FC & DB
☎ Call WhatsApp ✉ Email Enquire Now