Mastering Industrial Control: Siemens PLC Time Synchronization – NTP

In a previous article about QR code settings, a colleague expressed concerns about the accuracy of PLC time. When there is a PC in the system, the NTP time synchronization feature can be used. Below, we will introduce the settings for NTP.

This article has been saved in PDF format, and the link is provided in the comments section for those who need it.

Mastering Industrial Control: Siemens PLC Time Synchronization - NTP

Those interested can test and verify it themselves.

1.NTP Function Overview

What is NTP?

The Network Time Protocol (NTP) is widely used to synchronize the clocks of computer systems with Internet time servers.

In NTP mode, the CPU periodically sends time queries (in client mode) to the NTP server on the subnet (LAN) . Based on the server’s response, it calculates the most reliable and accurate time and synchronizes the workstation’s clock.

The advantage of this mode is that it allows time synchronization across subnets.

In NTP mode, the server typically transmits UTC (Coordinated Universal Time) to the client.

Generally, the CPU or CP acts as the NTP client, while the NTP server can be a computer or a GPS device with NTP server functionality. This article will use the CPU as an example to introduce the configuration method for the NTP client.

2.PLC NTP Client Configuration Steps

Setting Time Synchronization

Mastering Industrial Control: Siemens PLC Time Synchronization - NTP

1: Open the project tree[Device Configuration]

2: Click on[Device View]

3: Click on[Properties]

4: Click on[Time Synchronization]

5: Check[Start time synchronization via NTP server]

6: Set the NTP server’s IP address and update interval

Setting Time Zone

In China, the time zone is usually set to UTC+08:00

Note: Please ensure that the time zone on the PC side matches the PLC’s time zone.

Some countries may adopt Daylight Saving Time. If Daylight Saving Time is needed, after correctly setting the time zone, check “Enable Daylight Saving Time,” the PLC will automatically calculate the PLC local time based on the time zone of the NTP server clock.

Mastering Industrial Control: Siemens PLC Time Synchronization - NTP

After configuration is complete, download the project.

3. Setting the PC asNTP Server

SettingLocalNTP

Start à run à regedit

Mastering Industrial Control: Siemens PLC Time Synchronization - NTP

Mastering Industrial Control: Siemens PLC Time Synchronization - NTP

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters SetLocalNTP value to 1

Mastering Industrial Control: Siemens PLC Time Synchronization - NTP

Note: If theLocalNTP option does not exist, it needs to be manually created as a DWORD variable.

Mastering Industrial Control: Siemens PLC Time Synchronization - NTP

LocalNTP setting value 0 means disabled, 1 means enabled.

After setting, restart the computer for the changes to take effect.

Stop Windows Time

Start > Control Panel > System and Security > Windows Tools > Services

Mastering Industrial Control: Siemens PLC Time Synchronization - NTP

After stopping, it should look like the image below.

Mastering Industrial Control: Siemens PLC Time Synchronization - NTP

SettingNtpServer – Enable

Start à run à regedit (refer to previous steps)

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\W32Time\TimeProviders\NtpServer

Set Enable value to 1, as shown in the image below.

Mastering Industrial Control: Siemens PLC Time Synchronization - NTP

SettingConfig – AnnounceFlags

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\W32Time\Config

Set AnnounceFlags value to 5, as shown in the image below.

Mastering Industrial Control: Siemens PLC Time Synchronization - NTP

SettingWindows Time

Set the startup type to Automatic, and start the service.

Mastering Industrial Control: Siemens PLC Time Synchronization - NTP

After starting, it should look like the image below.

Mastering Industrial Control: Siemens PLC Time Synchronization - NTP

Configuration complete.

MonitoringPLC System Time

Mastering Industrial Control: Siemens PLC Time Synchronization - NTP

After manually adjusting the computer time, the PLC system time refreshes as shown in the image below.

Mastering Industrial Control: Siemens PLC Time Synchronization - NTP

Mastering Industrial Control: Siemens PLC Time Synchronization - NTPThank you for your attention and likes. I have organized some PLC and upper computer learning materials, and the link is provided in the comments section for those who need it.Mastering Industrial Control: Siemens PLC Time Synchronization - NTPMastering Industrial Control: A Treasure Chest for Beginners – Full of Useful InformationMastering Industrial Control: Why Run Around to Press the Interface When Siemens HMI Can Be Remote?Mastering Industrial Control: Siemens PLC Read and Write Operations on SQL (SQL4Automation Continued)Mastering Industrial Control: Siemens PLC Direct Read and Write Operations on SQL Database

Leave a Comment