Time synchronization optimization method, equipment and storage device in industrial Internet of Things scenario
By calculating the time offset parameters and message rate in the industrial IoT scenario, and adjusting the polling rate of the NTP service, the network congestion problem caused by NTP time synchronization is solved, and the dual guarantee of time synchronization performance and network stability is achieved.
Patent Information
- Application Number
- CN202211155241.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-22
- Publication Date
- 2025-01-17
- Estimated Expiration
- 2042-09-22
AI Technical Summary
In the industrial Internet of Things scenario, NTP time synchronization may cause network blockage, affecting the real-time operation of the control system, especially when the client needs to send requests to the server at a faster polling frequency.
By obtaining the time offset of the client relative to the server in the system, calculate the system's time offset parameters and total message rate, set the message rate threshold, and adjust the polling rate of the NTP service based on the real-time time offset parameters and message rate. to avoid network congestion.
It effectively avoids network congestion caused by uncontrolled NTP traffic and ensures time synchronization performance and network stability in industrial IoT scenarios.
Smart Images

Figure CN115622651B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of human-computer interaction technology, and in particular to a time synchronization optimization method, device and storage device in an industrial Internet of Things scenario. Background Art
[0002] At present, in industrial automation production, industrial Internet of Things technology has been widely used due to its advantages such as persistent storage, easy evaluation, and data fusion. With the increase of industrial Internet of Things devices, the demand for time synchronization of various devices in distributed systems has gradually increased. Initially, the bus network in the industrial production environment was designed to be separated from the Internet. The main purpose was to transmit process-related data locally to the system controller in real time, that is, to be compatible with production requirements in time. But now this situation has changed. The industrial Internet of Things environment can be connected to the Internet, and some network protocols have been integrated into the communication stack of field devices. Some emerging technologies of Ethernet such as ultra-low latency networks and time-sensitive networks have also been used in industrial production. However, due to the limited computing power of industrial Internet of Things devices, simpler network protocols are increasingly being adopted. For example, compared with the more accurate PTP (Precision Time Protocol), NTP (Network Time Protocol) or SNTP (Simple Network Time Protocol) is preferred.
[0003] NTP enables devices to operate as either a server or a client. A server can obtain time directly from a reference clock linked to UTC. A client can synchronize itself with one or more servers, but does not propagate time information to other clients. However, it is common for NTP devices to act as both clients and servers to achieve a hierarchical structure, and in general, IIoT devices only act as NTP clients. During the time synchronization process, the client sends a request to the server, and the server responds with the current time. An NTP server can manage multiple clients, depending on its computing power. Each synchronization process includes two NTP messages (request and reply). Synchronization requests to the same server can be repeated quickly in a short period of time (burst mode). The minimum polling time for the NTP service is usually set to 8 seconds, but some IIoT devices may use arbitrary time intervals.
[0004] Typically, NTP time propagation is based on timestamps obtained at the application level. Therefore, it is prone to errors when delays occur in servers, IoT devices, and networks. NTP uses several mitigation algorithms to filter unexpected errors caused by: unreliable network propagation delays, faulty servers, and malicious servers.
[0005] Each time synchronization operation of the NTP service is performed by the client sending a request to the server, and the server responds by providing the current time. In the industrial Internet of Things scenario, the distributed system has many devices as clients, so the time synchronization traffic is relatively large, and network congestion may occur during the peak of synchronization requests. The relevant network time protocol has nothing to do with the automation function of the Internet of Things devices, and the network congestion caused by the generated traffic may interfere with the real-time operation of the control system. When the control system needs to sample timestamps for the Internet of Things at an extremely fast frequency, the requirements for time synchronization are also increased accordingly. At this time, the client needs to send requests to the server at a faster polling frequency, resulting in increased throughput pressure on the distributed system network. Therefore, it is necessary to monitor the NTP traffic and set a certain threshold strategy to limit excessive synchronization requests to ensure the normal operation of the control system.
[0006] Based on this, the present invention proposes a time synchronization optimization method, device and storage device in an industrial Internet of Things scenario. Summary of the invention
[0007] In order to overcome the deficiencies of the prior art, the present invention provides a simple and efficient time synchronization optimization method, device and storage device in an industrial Internet of Things scenario.
[0008] The present invention is achieved through the following technical solutions:
[0009] A time synchronization optimization method in an industrial Internet of Things scenario, characterized in that it comprises the following steps:
[0010] Step S1, obtaining the time offset of the client in the system relative to the server, and calculating the time offset parameter of the system according to the time offset of the client in the system;
[0011] Step S2, calculating the NTP message rate generated by each client by summing up the message rates of the server providing time synchronization service to it, calculating the sum of the message rates of all clients, and obtaining the total message rate r of the system network environment;
[0012] Step S3: Calculate the theoretical maximum value r of the system network environment message rate considering extreme situations max , according to the maximum value r max Set the message rate threshold R of the system;
[0013] Step S4: adjusting the polling rate of the time synchronization service according to the real-time time offset parameter and message rate of the system.
[0014] In step S1, the method for obtaining the time offset parameter of the system is as follows:
[0015] Get the time offset of each client relative to the server from the NTP service, calculate the average μ and standard deviation σ of all time offsets, and combine the two to generate the time offset parameter u:
[0016]
[0017] In an industrial production environment, when the time offset parameter u is less than the custom value, the time synchronization performance is considered to be excellent.
[0018] In step S2, the total message rate of the system network environment is calculated as follows:
[0019] The number of clients in the system is N, and the corresponding servers of client n are 1, 2, 3, ..., j; the number of servers corresponding to client n is S n , the polling rate of client n to server j is P nj , the number of polls from client n to server j in burst mode is C nj , the polling interval of client n to server j is T nj ;
[0020] The sum of the message rates to the server providing time synchronization service to client n is the NTP message rate generated by client n, taking the burst mode into account, that is,
[0021]
[0022] The NTP message rate r of the network environment is the sum of the NTP message rates of all clients, that is,
[0023]
[0024] In step S3, all clients simultaneously send NTP requests to the server, send burst mode requests within 1 second after the first request, and the server responds to the request within 1 second; at this time, the theoretical maximum value of the total message rate of the system network environment is calculated. max , the calculation formula is as follows:
[0025] In step S3, the threshold R of the NTP message rate of the system network environment is set to r max / 2.
[0026] In step S4, when the total message rate r of the system network environment is greater than the threshold R, it is considered to threaten the on-site production environment. At this time, the NTP service polling frequency is reduced, while ensuring that the time offset parameter u is less than the custom value;
[0027] If the total message rate r of the system network environment is less than the threshold R, the NTP service increases the polling frequency.
[0028] The custom value is set to 1 ms.
[0029] A device, characterized in that it includes a memory and a processor; the memory is used to store a computer program, and the processor is used to implement the above method steps when executing the computer program.
[0030] A readable storage medium, characterized in that: a computer program is stored on the readable storage medium, and the computer program implements the above method steps when executed by a processor.
[0031] The beneficial effects of the present invention are as follows: the time synchronization optimization method, device and storage device in the industrial Internet of Things scenario match the time offset parameters and polling threshold requirements with the NTP polling rate, and use a polling rate that satisfies the constraints, thereby avoiding uncontrolled NTP traffic from causing network congestion of the control system and causing damage to industrial production activities, thereby ensuring the time synchronization performance and network stability in the industrial Internet of Things scenario. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0033] Attached Figure 1 This is a simplified schematic diagram of the NTP system network structure of the present invention. DETAILED DESCRIPTION
[0034] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0035] The time synchronization optimization method in the industrial Internet of Things scenario includes the following steps:
[0036] Step S1, obtaining the time offset of the client in the system relative to the server, and calculating the time offset parameter of the system according to the time offset of the client in the system;
[0037] Step S2, calculating the NTP message rate generated by each client by summing up the message rates of the server providing time synchronization service to it, calculating the sum of the message rates of all clients, and obtaining the total message rate r of the system network environment;
[0038] Step S3: Calculate the theoretical maximum value r of the system network environment message rate considering extreme situations max , according to the maximum value r max Set the message rate threshold R of the system;
[0039] Step S4: adjusting the polling rate of the time synchronization service according to the real-time time offset parameter and message rate of the system.
[0040] In order to measure and evaluate the time synchronization performance, some indicators need to be selected. For the Network Time Protocol, the time offset parameter is used as a reference for the synchronization performance within the distributed system.
[0041] In step S1, the method for obtaining the time offset parameter of the system is as follows:
[0042] Get the time offset of each client relative to the server from the NTP service, calculate the average μ and standard deviation σ of all time offsets, and combine the two to generate the time offset parameter u:
[0043]
[0044] In an industrial production environment, when the time offset parameter u is less than the custom value, the time synchronization performance is considered excellent. If the environment has higher requirements for time synchronization, it can be adjusted accordingly. When the polling interval (poll) of time synchronization is reduced, the client will send time synchronization requests to the server more frequently, and the time offset parameter will be reduced accordingly, indicating that the synchronization performance has improved.
[0045] The network topology in most industrial automation production environments is centralized, where field-level production equipment exchanges data with a few higher-level control terminals. Therefore, when analyzing NTP traffic, it is possible to consider simplifying the NTP system network, such as the following: Figure 1 shown.
[0046] In step S2, the total message rate of the system network environment is calculated as follows:
[0047] The number of clients in the system is N, and the corresponding servers of client n are 1, 2, 3, ..., j; the number of servers corresponding to client n is S n , the polling rate of client n to server j is P nj , the number of polls from client n to server j in burst mode is C nj , the polling interval of client n to server j is Tnj ;
[0048] The sum of the message rates to the server providing time synchronization service to client n is the NTP message rate generated by client n, taking the burst mode into account, that is,
[0049]
[0050] The NTP message rate r of the network environment is the sum of the NTP message rates of all clients, that is,
[0051]
[0052] In step S3, all clients simultaneously send NTP requests to the server, send burst mode requests within 1 second after the first request, and the server responds to the request within 1 second; at this time, the theoretical maximum value of the total message rate of the system network environment is calculated. max , the calculation formula is as follows:
[0053] In step S3, the threshold R of the NTP message rate of the system network environment is set to r max / 2.
[0054] When max When it is greater than 20% of the total system traffic, it may cause network problems. Set the threshold R to r max / 2, users can also customize R and r according to network conditions (r as a percentage of total traffic) max proportion.
[0055] In step S4, when the total message rate r of the system network environment is greater than the threshold R, it is considered to threaten the on-site production environment. At this time, the NTP service polling frequency is reduced, while ensuring that the time offset parameter u is less than the custom value;
[0056] If the total message rate r of the system network environment is less than the threshold R, the NTP service increases the polling frequency.
[0057] The custom value is set to 1 ms.
[0058] By adjusting the polling rate in real time by referring to the values of r, u, and R, the time synchronization of the distributed system can meet the requirements of both synchronization performance and network stability.
[0059] The device comprises a memory and a processor; the memory is used to store a computer program, and the processor is used to implement the above method steps when executing the computer program.
[0060] The readable storage medium stores a computer program, and when the computer program is executed by a processor, the above method steps are implemented.
[0061] The embodiment described above is only one specific implementation of the present invention. Common changes and substitutions made by those skilled in the art within the scope of the technical solution of the present invention should be included in the protection scope of the present invention.
Claims
1. A time synchronization optimization method in an industrial Internet of Things scenario, characterized in that: The steps include: Step S1, obtaining the time offset of the client in the system relative to the server, and calculating the time offset parameter of the system according to the time offset of the client in the system; Step S2, calculating the NTP message rate generated by each client by summing up the message rates of the server providing time synchronization service to it, calculating the sum of the message rates of all clients, and obtaining the total message rate r of the system network environment; The total message rate r of the system network environment is calculated as follows: The number of clients in the system is N, and the corresponding servers of client n are 1, 2, 3, ..., j; the number of servers corresponding to client n is S n , the polling rate of client n to server j is P nj , the number of polls from client n to server j in burst mode is C nj , the polling interval of client n to server j is T nj ; The sum of the message rates to the server providing time synchronization service to client n is the NTP message rate generated by client n, taking the burst mode into account, that is, The NTP message rate r of the network environment is the sum of the NTP message rates of all clients, that is, Step S3: Calculate the theoretical maximum value r of the system network environment message rate considering extreme situations max , according to the maximum value r max Set the message rate threshold R of the system; Step S4: adjusting the polling rate of the time synchronization service according to the real-time time offset parameter and message rate of the system.
2. The time synchronization optimization method in the industrial Internet of Things scenario according to claim 1 is characterized in that: In step S1, the method for obtaining the time offset parameter of the system is as follows: Get the time offset of each client relative to the server from the NTP service, calculate the average μ and standard deviation σ of all time offsets, and combine the two to generate the time offset parameter u: In an industrial production environment, when the time offset parameter u is less than the custom value, the time synchronization performance is considered to be excellent.
3. The time synchronization optimization method in the industrial Internet of Things scenario according to claim 1 is characterized in that: In step S3, all clients simultaneously send NTP requests to the server, send burst mode requests within 1 second after the first request, and the server responds to the request within 1 second; at this time, the theoretical maximum value of the total message rate of the system network environment is calculated. max , the calculation formula is as follows:
4. The time synchronization optimization method in the industrial Internet of Things scenario according to claim 3 is characterized in that: In step S3, the threshold R of the NTP message rate of the system network environment is set to r max / 2.
5. The time synchronization optimization method in the industrial Internet of Things scenario according to claim 1 or 4 is characterized in that: In step S4, when the total message rate r of the system network environment is greater than the threshold R, it is considered to threaten the on-site production environment. At this time, the NTP service polling frequency is reduced, while ensuring that the time offset parameter u is less than the custom value; If the total message rate r of the system network environment is less than the threshold R, the NTP service increases the polling frequency.
6. The time synchronization optimization method in the industrial Internet of Things scenario according to claim 5 is characterized in that: The custom value is set to 1 ms.
7. A time synchronization optimization device in an industrial Internet of Things scenario, characterized in that: It comprises a memory and a processor; the memory is used to store a computer program, and the processor is used to implement the method steps as claimed in any one of claims 1 to 6 when executing the computer program.
8. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
NTP-based time synchronization method and corresponding system
CN107017958A
Time synchronization method, relay equipment and device
CN110601786A