Resolving SIMATIC BATCH Batches Stuck in 'Closing' State Forever: PDF Reports and Database Locks

Resolving SIMATIC BATCH Batches Stuck in 'Closing' State Forever: PDF Reports and Database Locks

In SIMATIC BATCH V8.2, a batch order remaining permanently stuck in the 'Closing' state instead of transitioning to 'Closed' or 'Archived' is primarily caused by the automatic PDF batch report generator hanging in the background, or by failed WinCC historical alarm queries. When 'Generate PDF report automatically' is enabled in Project Settings, a missing or unresponsive PDF printer driver freezes the batch closing thread indefinitely. To resolve this, open Batch Control Center, navigate to Project Settings -> Close and Archive, disable automatic PDF report generation, set the waiting time after closing to 0, verify write permissions on the archive directory, and restart the BATCH Server.

Table of Contents

The Batch Lifecycle: Transitioning from Completed to Closing to Closed

In SIMATIC BATCH, a production batch traverses a rigorous state machine defined by ANSI/ISA-88 standards: Planned -> Released -> Ready to start -> Running -> Completed -> Closing -> Closed -> Archived.

When all recipe phases finish, the batch enters the Completed state. The system then automatically initiates the Closing phase. During Closing, the BATCH Server executes three critical backend tasks:

  1. Process Data Ingestion: It queries the WinCC OS Server databases to retrieve all operator inputs, alarm messages, and continuous trend curves recorded while the batch was active.
  2. Report Compilation: It compiles the official Electronic Batch Record (EBR) protocol, optionally printing a physical copy or generating a standardized PDF report.
  3. Database Finalization: It writes the finalized batch data into the SIMATIC BATCH SQL database (SBDatabase) and creates an exportable archive file (*.sbx). Once completed, the status updates to Closed.

If any single sub-task stalls, the state machine halts permanently in the 'Closing' state.

Root Cause 1: The Automated PDF Report Generation Hang

In the vast majority of industrial field occurrences in SIMATIC BATCH V8.2 and early V9.0 releases, the hang is caused by the automated PDF report generator:

  • Session 0 Print Driver Hang: The BATCH Server service (bfserver.exe) runs as a non-interactive Windows service in Session 0. When configured to generate a PDF report automatically upon closing, BATCH invokes the default PDF virtual printer (e.g. Adobe PDF, PDFCreator, or Siemens Report Printer).
  • Silent Modal Dialogs: If the PDF driver attempts to spawn a 'Save As' window, prompts for fonts, or hangs waiting for a print spooler response, the background print thread blocks indefinitely. Because Session 0 cannot display GUI prompts to users, the thread waits forever, preventing the batch state from advancing to 'Closed'.

Root Cause 2: WinCC Historical Alarm and Tag Query Timeouts

A secondary cause stems from communication breakdown between SIMATIC BATCH and WinCC OS Servers:

  • The Alarm Query Handshake: To assemble the batch report, BATCH executes OLE-DB queries against the WinCC Alarm Logging database. If the WinCC Alarm Control is misconfigured, if the WinCC alarm provider (CCAlarmServer.exe) is unresponsive, or if the station displays 'WinCC Alarm Control cannot be used on this computer', the data harvesting query times out or deadlocks.
  • Waiting Time After Closing Parameter: In BCC Project Settings, the parameter 'Waiting time after closing' dictates how many seconds BATCH pauses before finalizing data. If set to an excessive duration or if data queries hang, the closing state remains locked.

Root Cause 3: Archive Target Storage Permissions and Quotas

When the batch data is compiled, BATCH writes the final batch record to the configured archive folder (Project Settings -> Archive Directory):

  • Storage Full: Although the server may have 40 GB free on drive C:, the designated archive path may point to a mapped network share (NAS) or dedicated partition that has exhausted its storage quota.
  • NTFS Access Denied: The BATCH service account (BATCH_USER) must possess explicit Write and Modify permissions on the target directory. If write access is denied, file creation fails and the batch remains trapped in 'Closing'.

Diagnostic Matrix: SIMATIC BATCH Closing and Archiving Hangs

The following matrix outlines troubleshooting steps for batches stuck in the Closing state:

Diagnostic FactorRoot Cause MechanismCorrective Engineering ActionPDF Report enabledPDF virtual printer driver hanging in Session 0Disable 'Generate PDF report automatically' in BCC Project SettingsWinCC Alarm error presentAlarm harvesting query deadlocks against WinCCRe-register CCAxAlarmControl.ocx; restart WinCC Alarm LoggingArchive directory fullTarget storage quota exceeded or share offlineCheck archive path in Project Settings; verify write permissionsWaiting time parameterExcessive post-batch delay configuredSet 'Waiting time after closing' to 0 seconds in BCC settingsService deadlockBATCH closing thread corruptedRestart SIMATIC BATCH services via BATCH Launch Coordinator

Step-by-Step Procedure to Unlock Batches and Restore Automatic Closing

Follow this sequence to unlock existing stalled batches and prevent future occurrences:

  1. Disable Automated PDF Generation: Open Batch Control Center. Navigate to Options -> Project Settings -> Close and Archive. Uncheck the box 'Generate PDF report automatically'.
  2. Adjust Waiting Delays: In the same tab, set 'Waiting time after closing' to 0 seconds.
  3. Verify Archive Path: Check the configured archive directory path; verify that the local drive or UNC share has ample free space and full write permissions for the BATCH user account.
  4. Restart BATCH Server Services: Open the Windows Notification Area, right-click the SIMATIC BATCH Launch Coordinator icon, select Stop Services, wait 30 seconds, and select Start Services.
  5. Manually Force Batch Close: In BCC, right-click the stuck batch order, select Control -> Close (or Archive). With automated PDF printing disabled, the batch will immediately transition from 'Closing' to Closed.
  6. Install Siemens BATCH Updates: Install the latest official SIMATIC BATCH V8.2 Update (Upd1 / Upd2) to permanently resolve print spooler Session 0 integration defects.

Verification

Confirm that batch closing operates smoothly without manual intervention:

  1. In Batch Control Center, verify that the previously stuck batch displays status Closed with a solid lock icon.
  2. Create, release, and execute a new short test batch recipe.
  3. Allow all phases to complete; verify that the batch status transitions from Completed to Closing and then automatically to Closed within 5 to 15 seconds.
  4. Right-click the closed batch, select Print Preview / Export PDF, and confirm that reports can still be generated manually on demand.

Limitations and Operational Precautions

Adhere to the following operational precautions:

  • Regulated Industries (FDA 21 CFR Part 11): In validated pharmaceutical plants requiring automatic PDF archiving, install the officially released Siemens BATCH Hotfix/Update rather than permanently disabling PDF reports, and ensure an approved dedicated PDF virtual printer is configured.
  • Never Terminate BATCH SQL Processes: Never kill SQL Server (sqlservr.exe) or force-delete BATCH databases while batches are in Closing; doing so causes catastrophic database corruption.
  • Maintain BATCH Update Parity: Ensure SIMATIC BATCH software updates match identically across BATCH Servers, OS Servers, and BATCH Clients.

Engineer FAQ

Why does the PDF generator hang when run as a background service?

Because the BATCH Server service executes in Session 0. Many standard PDF printer drivers attempt to spawn interactive dialog windows, which cannot be displayed in Session 0, causing the printer driver to block forever.

What role does 'Waiting time after closing' play in SIMATIC BATCH?

It defines a deliberate pause (in seconds) allowing slow field devices and OS servers to finish transmitting post-batch alarm and trend records before BATCH seals the archive.

Can I delete a batch that is permanently stuck in the Closing state?

No. SIMATIC BATCH prohibits deleting active or closing batches to protect electronic batch record integrity. The batch must reach the Closed or Canceled state before it can be archived or purged.

Technical References

Related Articles

Related Tags

  • SIMATIC BATCH
  • Batch Stuck in Closing
  • PDF Report Generation
  • Batch Control Center
  • Archive Directory
  • ISA-88 Batch Lifecycle
6 respuestas