The TimeSync library implements the SNTP (Simple Network Time Protocol) client feature. It allows your controller to connect to an NTP (Network Time Protocol) or SNTP time server in order to synchronize the internal RTC (Real-Time Clock) of the controller in accordance with the primary time standard UTC (Universal Time Coordinated) that is globally unique.
The SNTP client complies to version 4 of the SNTP protocol.
It provides the following functions:
oGenerating a request to an (S)NTP server
oReceiving and structuring the response of the (S)NTP server
oCalculating the round-trip delay and the clock offset
oProviding the synchronized time stamp for synchronizing the RTC of the controller and taking the offset between local RTC and (S)NTP server time as well as round-trip delay times into account
oManaging detected errors
1 Time server: SNTP or NTP server
2 Controller X: SNTP client
3 Controller Y: SNTP client
Characteristics of the Library
The following table indicates the characteristics of the library:
Characteristic |
Value |
---|---|
Library title |
TimeSync |
Company |
Schneider Electric |
Category |
Communication |
Default namespace |
TIMS |
Language model attribute |
|
Forward compatible library |
Yes (FCL) |
NOTE: For this library, qualified-access-only is set. This means, that the POUs, data structures, enumerations, and constants have to be accessed using the namespace of the library. The default namespace of the library is TIMS.
In conjunction with the library, the example project FB_SntpClient.project is provided. The example project shows how to implement the components from the TimeSync library.
Step |
Action |
Comment |
---|---|---|
1 |
In the EcoStruxure Machine Expert Logic Builder, execute the command New Project. |
– |
2 |
In the New Project dialog box, select From Example from the Project type list. |
– |
3 |
On the right-hand side of the New Project dialog box, select the controller (1) from the Controller list. |
Result: Available examples are listed in the Matching Examples text box. |
4 |
Select your example from the Matching Examples list. |
– |
5 |
Enter a name for the new project, and select the file location. |
– |
6 |
Click the OK button. |
Result: A new project is created based on the selected example. |
NOTE: Setting the RTC of the controller generates entries into the controller log file. Therefore, for automatic adjustments, do not use this function more than once a day.
The allowed value range in which the internal RTC (Real-Time Clock) of the controller can be set by the function block is restricted to 01.01.1970...01.01.2100. The accuracy depends on the (S)NTP server that is used. Maximum accuracy of 1 s can be reached for UTC synchronization.
NOTE: The entries in the controller log file are saved with a time stamp. Be aware that when setting the internal RTC (Real-Time Clock) of the controller back in time, that this can result in two different log entries that are saved with an apparently inappropriate time stamp.
Consider the following limitations for (S)NTP communication:
oOnly IPv4 (Internet Protocol version 4) is supported.
oOnly one request to one (S)NTP time server is allowed at a time.
oThe TimeSync library incorporates pointers on addresses.
oDo not use a poll interval less than 15 seconds.
oUse local servers whenever available to avoid unnecessary traffic on backbone network.
Executing the Online Change command can change the contents of addresses.
|
INVALID POINTER |
Verify the validity of the pointers when using pointers on addresses and executing the Online Change command. |
Failure to follow these instructions can result in injury or equipment damage. |
The library described in this document internally uses the TcpUdpCommunication library.
The TcpUdpCommunication (Schneider Electric) and the CAA Net Base Services library (CAA Technical Workgroup) use the same system resources on the controller. The simultaneous use of both libraries in the same application may lead to disturbances during the operation of the controller.
|
UNINTENDED EQUIPMENT OPERATION |
Do not use the library TcpUdpCommunication (Schneider Electric) together with the library CAA Net Base Services (CAA Technical Workgroup) simultaneously in the same application. |
Failure to follow these instructions can result in death, serious injury, or equipment damage. |
Considerations Concerning Cyber Security
The TimeSync library functions do not support secure connections such as TLS (Transport Layer Security) or SSL (Secure Socket Layer). Since the SNTP telegrams are not encrypted and authentication is not required to get or set information on an agent. Communication must only be performed inside your industrial network, isolated from other networks inside your company, and protected from the Internet.
NOTE: Schneider Electric adheres to industry best practices in the development and implementation of control systems. This includes a "Defense-in-Depth" approach to secure an Industrial Control System. This approach places the controllers behind one or more firewalls to restrict access to authorized personnel and protocols only.
|
UNAUTHENTICATED ACCESS AND SUBSEQUENT UNAUTHORIZED MACHINE OPERATION |
oEvaluate whether your environment or your machines are connected to your critical infrastructure and, if so, take appropriate steps in terms of prevention, based on Defense-in-Depth, before connecting the automation system to any network. oLimit the number of devices connected to a network to the minimum necessary. oIsolate your industrial network from other networks inside your company. oProtect any network against unintended access by using firewalls, VPN, or other, proven security measures. oMonitor activities within your systems. oPrevent subject devices from direct access or direct link by unauthorized parties or unauthenticated actions. oPrepare a recovery plan including backup of your system and process information. |
Failure to follow these instructions can result in death, serious injury, or equipment damage. |
For more information on organizational measures and rules covering access to infrastructures, refer to ISO/IEC 27000 series, Common Criteria for Information Technology Security Evaluation, ISO/IEC 15408, IEC 62351, ISA/IEC 62443, NIST Cybersecurity Framework, Information Security Forum - Standard of Good Practice for Information Security.
The library incorporates the following features that help to prevent communication errors:
oVerification of the time stamp that has been sent originally to the server to help to detect transmission errors.
oVerification that the definition of the protocol is in accordance with the standard.
oVerification of the server version and issuing a diagnostic message in case of mismatch.
Function block / function |
Use |
---|---|
Provides SNTP client functions. |
|
Converts an enumeration element of type ET_Result to a string value. |
Overview of the Structures in the Module-Specific Interface
Structure |
Use |
---|---|
Contains specific information for sending an SNTP request to an (S)NTP time server. |
|
Contains the time stamps and can be used to synchronize the RTC. |
Enumeration |
Use |
---|---|
Defines the communication mode of the SNTP client. |
|
Contains the possible values that indicate the result of operations executed by the function block. |