Managing Time Synchronization and Timestamping Batch Events in SIMATIC PCS 7

Managing Time Synchronization and Timestamping Batch Events in SIMATIC PCS 7

In SIMATIC PCS 7, manually moving server or controller clocks backwards while runtime is active is strictly prohibited because it corrupts historical SQL Server archives, creates primary key collisions in alarm logging, and disrupts batch execution. Plant time synchronization must follow a hierarchical structure: an external GPS master (or dedicated central time master) synchronizes the Plant Bus via SIMATIC mode or NTP, while WinCC Time Synchronization distributes coordinated UTC time across the Terminal Bus. To capture and display exact batch completion timestamps in WinCC, use system function SFC 1 (READ_CLK) or APL Event blocks (FB 1811) rather than analog monitoring blocks.

Table of Contents

The Critical Role of Time Synchronization in PCS 7

In distributed process control systems, precise, monotonic time synchronization is not merely a convenience; it is a foundational prerequisite for process safety, sequence-of-events (SOE) recording, alarm logging, and regulatory compliance.

A common operational challenge arises when isolated PCS 7 systems (operating without an external internet connection) drift or fail to catch daylight saving time (summer time shifts), leaving servers running ahead of local time. Operators and engineers frequently ask:
1. Can we manually change the system clock on running OS Servers and Clients to match real time?
2. How can we capture the exact completion time of a batch sequence inside an SFC chart and transmit that timestamp to WinCC without misusing analog monitoring blocks?

Addressing both questions requires a strict understanding of PCS 7 time architecture and database integrity rules.

The Hazards of Manual Time Shifts on Active WinCC Systems

Manually setting the system clock on an active PCS 7 system is dangerous, especially when shifting time backwards:

1. SQL Database Primary Key Collisions

WinCC Tag Logging and Alarm Logging write historical process records into Microsoft SQL Server segments indexed by UTC timestamps.
* If the clock is shifted backwards (e.g., from 14:05 to 13:00), WinCC begins generating records with timestamps that already exist in the database.
* This causes primary key index violations, segment corruption, and permanent loss of process trend data.

2. Alarm Chronology and Sequence-of-Events Inversion

Moving time backwards causes newly triggered alarms to appear chronologically earlier than older, acknowledged alarms, rendering the alarm journal incomprehensible and invalidating incident root-cause investigations.

3. SIMATIC BATCH Sequence Stalls

SIMATIC BATCH recipes track step durations and phase timeouts based on elapsed time calculations. A negative time jump can cause recipe execution engines to freeze or prematurely abort active batches.

[!CAUTION]
If a backward time correction is mandatory on an un-synchronized plant, you must completely deactivate WinCC Runtime on all OS Servers and Clients, adjust the operating system clocks across all nodes while the system is offline, and then restart runtime.

Comparison Table - PCS 7 Time Synchronization Methodologies

The following table contrasts the two primary protocols used to synchronize plant clocks across SIMATIC PCS 7 networks.

Feature / MetricSIMATIC Time Synchronization ProcedureNetwork Time Protocol (NTP / RFC 1305)Underlying Network ProtocolLayer 2 ISO Broadcast (MAC addressing)Layer 3 UDP/IP (Port 123)Typical Deployment DomainIndustrial Ethernet Plant BusTerminal Bus / Corporate NetworkMaster Clock SourceSICLOCK, central S7-400 CPU, or CP 443-1Dedicated GPS NTP Server, Domain ControllerSubnet RoutabilityNon-routable (isolated to local Layer 2 segment)Fully routable across IP routers and firewallsResolution / AccuracySub-millisecond (with 1 ms SOE hardware)1 ms to 10 ms typicalOS Station ConfigurationWinCC Time Synchronization editor (Plant Bus)Windows W32Time service / WinCC Time Sync

Hierarchical Architecture for Plant Bus and Terminal Bus

To eliminate manual clock adjustments permanently, implement the standard Siemens hierarchical time model:

1. The Central Clock Master

Deploy a dedicated hardware master clock (such as a Siemens SICLOCK or third-party GPS NTP server) connected to the Plant Bus:
* The master receives atomic GPS satellite time and broadcasts coordinated universal time (UTC) across the network.
* S7-400H / CPU 410-5H controllers synchronize via their CP 443-1 or onboard PROFINET interfaces in SIMATIC mode or NTP mode.

2. Terminal Bus Coordination (WinCC Time Synchronization)

  • On the Terminal Bus, configure WinCC Time Synchronization in WinCC Explorer.
  • Designate one redundant OS Server (e.g., OS_Server_1) as the active time master for the Terminal Bus.
  • All OS Clients and secondary servers synchronize their local Windows clocks from this master, ensuring 100% time uniformity across every operator station.

Capturing Batch Completion Timestamps in SFC and Displaying in WinCC

Attempting to store timestamps using analog monitoring blocks (MonAnL, OpAnL) fails because analog blocks process IEEE 754 floating-point real numbers, not 64-bit date-and-time structures.

Siemens provides two compliant engineering methods for capturing batch event timestamps:

Method 1: Using System Function SFC 1 (READ_CLK) in SCL

To store an exact completion timestamp when an SFC sequencer reaches its final step:
1. In SCL, create a custom helper block or embed SFC 1 inside an equipment phase FB:
```scl
VAR_OUTPUT
BatchEndTime {s7_m_c := 'true'} : STRING[20];
END_VAR
VAR_TEMP
CurrentTime : DATE_AND_TIME;
RetVal : INT;
END_VAR

// Execute on batch completion transition
IF BatchCompleted THEN
RetVal := READ_CLK(CDT := CurrentTime);
// Convert DATE_AND_TIME to displayable STRING
BatchEndTime := DT_TO_STRING(CurrentTime);
END_IF;
`` 2. BecauseBatchEndTimepossesses the` attribute, the OS compiler generates a string tag in WinCC.
3. In Graphics Designer, bind a simple static text or I/O field to this string tag to display the completion timestamp directly on the screen.

Method 2: Triggering an APL Event Block (Event / FB 1811)

The most elegant PCS 7 methodology is triggering an APL Event block when the batch step completes:
* In CFC, connect the SFC step completion flag to input In1 of an Event block.
* When In1 transitions from 0 to 1, the block automatically attaches the controller's exact millisecond-accurate hardware timestamp to an operator message: Batch XYZ Completed Successfully.
* The message is logged into the WinCC Alarm Journal, creating an unalterable historical audit record with zero custom scripting.

Verification

Verify proper time synchronization and batch timestamp capture:

  1. Verify Plant Bus Time Synchronization:
    * In SIMATIC Manager, go online with the S7-400 CPU and press Ctrl+D to open Module Information.
    * Navigate to the Time System tab.
    * Confirm that the CPU operating system indicates Synchronized and displays the correct UTC time.
  2. Verify WinCC Terminal Bus Synchronization:
    * Open WinCC Explorer on an OS Client.
    * Open the WinCC Time Synchronization editor. Confirm that the status reports active synchronization from the master OS Server.
  3. Verify Batch Timestamp Capture:
    * Execute an SFC sequence to completion.
    * Confirm that the custom string tag or Event message displays the exact completion timestamp on the WinCC graphic display and in the Alarm Control journal.

Limitations and Operational Precautions

  • Always Use UTC for Plant Clocks: All automation controllers and WinCC database servers should operate internally on Coordinated Universal Time (UTC). Local daylight saving time adjustments should be handled purely as a graphical display offset in the WinCC client user interface.
  • Prohibition of Direct Internet Synchronization: Never connect production OS Servers directly to public NTP internet pools. Always isolate plant networks behind an air-gapped firewall and use an internal GPS NTP receiver.
  • SFC 1 Return Codes: Always check the integer return code (RET_VAL) of SFC 1. A return value other than 0 indicates that the controller clock has not yet been synchronized.

Engineer FAQ

Can I use Windows Internet Time (time.windows.com) on PCS 7 servers?

No. PCS 7 systems must never be synchronized with public web time servers due to cybersecurity isolation requirements and unpredictable latency over commercial internet connections.

What happens if an OS Server loses connection to the time master?

The OS Server continues running using its internal high-precision hardware real-time clock (RTC). Modern server motherboards drift by only a few milliseconds per day. Once connectivity restores, time synchronization gently slews the clock back into alignment.

Why can't I store timestamps in an analog REAL variable?

An IEEE 754 32-bit floating-point variable has only 24 bits of mantissa precision (roughly 7 decimal digits). Storing epoch timestamps in a REAL variable causes severe truncation, losing second and millisecond resolution.

Does WinCC automatically adjust for Daylight Saving Time?

Yes. When WinCC is configured for UTC, the underlying SQL database remains linear and continuous. The WinCC runtime graphics engine automatically calculates and displays the local daylight saving time offset based on Windows regional settings.

Technical References

Related Articles

Related Tags

  • Time-Synchronization
  • NTP
  • SICLOCK
  • SFC1
  • WinCC-TimeSync
  • Batch-Timestamp
6 respuestas