ADC Community_02 (Automationdirect.com) asked a question.

Productivity PROtips: Synching time with SNTP server

Since Productivity CPU’s real time clock accuracy can range from +/- 2-15 seconds day, depending on CPU model, the CPU clock may need to be synchronized with a time server to ensure that time dependent features still function correctly. Some features that require a secure TLS connection, such as EMAIL and MQTT(S), will not function properly if the CPU clock time and date are not accurate.

 

imageExternal SNTP server (Internet)

 First, the Network Time Server must be set up in the CPU project. It can be found in Network Time Service under the Application Tools Panel  -> Services -> Network Time Service. 

 

image.png 

image.png 

Note: Network Time Service does not support Domain Name System protocol (DNS).

 

Once the Network Time Service window is open, enter an available SNTP time server IP address. There are several sources of SNTP time servers. Below is link to a list of time servers from the National Institute of Standards and Technology:

https://tf.nist.gov/tf-cgi/servers.cgi

 

Entering an alternate is recommended as it will attempt to contact this server if the primary SNTP server is unreachable.

 

Note: If there is no response from the main IP address then the alternate IP address will automatically be attempted. If there is no response from secondary, then any Time Sync (TSYN) user defined status bits will be updated.

 

(Optional) If needed, add a tagname for daylight savings time (DST). When the tag is ON (True), one hour will be added to the current time received from the SNTP server. For an example, applying DST:

https://support.automationdirect.com/examples/P3000/EP-MISC-001_PAC.zip

 

Note: The DST tag is only used when the Time Sync (TSYN) instruction is enabled. Changing the DST tag (without enabling TSYN) will not automatically adjust the PLC clock.

 

(Optional) If a constant offset is needed (instead of DST offset) such as for a time zone offset, select the "Use Constant" radio button and select an option from the list or choose "Other" enter the desired constant offset in the field provided. Coordinated Universal Time (UTC) is the primary time standard globally used to regulate clocks and time.

 

Once the Network Time Service is configured, the Time Sync (TSYN) instruction needs to be set up. The TSYN instruction is used to change the PLC's internal real-time clock and calendar to the Date and Time specified in conjunction with the previously configured SNTP (Simple Network Time Protocol) server.

 

Enter a TYSN instruction in the ladder editor, the below instruction configuration will become available.

image.png 

The instruction can be manually triggered in ladder (one shot) or it can be configured to update at a desired interval.

 

Note: Manual triggering the instruction faster than every 5 seconds will flag an error.

 

Next enter tags for each of the status tags or select Use Structure data type that can speed up overall programming because multiple tags are created and assigned automatically.

 

Local SNTP Windows Server

 

A "local Windows SNTP server" refers to a computer running the Windows operating system that is configured to act as a time source for other devices on the local network, essentially allowing them to synchronize their clocks with the local machine by using the Simple Network Time Protocol (SNTP) which is part of the Windows Time service.

 

Note: Administrator privileges will be required to change Windows settings. If needed contact your IT department.

 

1.)   Click on the windows home button and search for "Edit Group Policy"

2.)   Navigate to "Administrative Templates->System->Windows Time Service->Time Providers"

3.)   Double click "Enable Windows NTP Server"

4.)   Click the "Enable" button

5.)   Restart your PC

 

image.pngAn exception to Windows firewall will be needed to allow the PLC to access the SNTP time server on the PC. Hit windows home button -> search for Firewall & Network Protection. 

 image.png 

Click on Advanced Settings -> Right Click on Inbound Rules-> then New Rule.

image.png

Select Port -> Next -> then UDP -> for Specific Local Ports enter 123

image.pngFor action select default “allow the connection -> When does this rule apply? Leave all three options selected. -> Give new inbound rule a name “SNTP Productivity” -> Then select Finish.

 

The new rule is now available.

image 

Now follow steps above on adding Network Time Service and adding Time Sync instruction in ladder to synchronize CPU time to the designated PC.


  • ADC Community_02 (Automationdirect.com)

    Productivity PROtips: Synching time with SNTP server

  • kewakl (Customer)

    Went through this with new guy a few weeks back.👍