CN113055114B - Oil transportation pipe network time synchronization method based on dynamic compensation and hierarchical transmission - Google Patents

Oil transportation pipe network time synchronization method based on dynamic compensation and hierarchical transmission Download PDF

Info

Publication number
CN113055114B
CN113055114B CN202110249876.XA CN202110249876A CN113055114B CN 113055114 B CN113055114 B CN 113055114B CN 202110249876 A CN202110249876 A CN 202110249876A CN 113055114 B CN113055114 B CN 113055114B
Authority
CN
China
Prior art keywords
node
time
clock
nodes
timed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110249876.XA
Other languages
Chinese (zh)
Other versions
CN113055114A (en
Inventor
胡旭光
马大中
孟冠军
张化光
刘金海
王晨阳
高余
贾玲玲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Northeastern University China
Original Assignee
Northeastern University China
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Northeastern University China filed Critical Northeastern University China
Priority to CN202110249876.XA priority Critical patent/CN113055114B/en
Publication of CN113055114A publication Critical patent/CN113055114A/en
Application granted granted Critical
Publication of CN113055114B publication Critical patent/CN113055114B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0658Clock or time synchronisation among packet nodes
    • H04J3/0661Clock or time synchronisation among packet nodes using timestamps
    • H04J3/0667Bidirectional timestamps, e.g. NTP or PTP for compensation of clock drift and for compensation of propagation delays
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2413Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on distances to training or reference patterns
    • G06F18/24147Distances to closest patterns, e.g. nearest neighbour classification
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0682Clock or time synchronisation in a network by delay compensation, e.g. by compensation of propagation delay or variations thereof, by ranging
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Theoretical Computer Science (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Artificial Intelligence (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)

Abstract

The invention discloses a time synchronization method for an oil transportation pipe network based on dynamic compensation and a hierarchical transmission mode, and belongs to the technical field of time synchronization of oil transportation pipe networks. Dividing each clock node on the oil pipeline network according to the time synchronization sequence; an external time server is used as a time service node to provide initial standard time for a clock node of the whole oil pipe network, the clock node which is determined to be most advanced to carry out time synchronization is used as a node to be time-served, the node to be time-served acquires standard time information from the time service node, and then dynamic compensation is carried out on a local clock according to the acquired standard time to complete the time synchronization of a first-stage clock node; then, the first-stage clock node is used as a time service node, the clock node which is determined as the second sequence and carries out time synchronization is used as a node to be time-serviced, and the time synchronization of the second-stage clock node is completed; and so on, completing one time synchronization of all clock nodes according to a hierarchical transmission type synchronization mode. The precision and the efficiency of the time synchronization of the oil transportation pipe network are improved.

Description

Oil transportation pipe network time synchronization method based on dynamic compensation and hierarchical transmission
Technical Field
The invention belongs to the technical field of time synchronization of oil transportation pipe networks, and particularly relates to a dynamic compensation and hierarchical transmission type-based time synchronization method for an oil transportation pipe network.
Background
In the process of petroleum transportation, when a conveying pipeline is broken to cause leakage faults, if the position of the leakage point cannot be timely and accurately positioned, a great amount of casualties and economic losses are caused. However, the positioning accuracy of the leakage point position depends on whether the data monitored by each monitoring station of the long-distance pipeline network are the same time, so that the time synchronization is important for the safety monitoring of the pipeline network. Oil pipelines in China are long pipelines which are more than thousands of kilometers generally, and are provided with a plurality of monitoring station nodes generally. Each monitoring station node is provided with a clock module which contains a crystal oscillator and mainly provides clock service, and the clock module configured for each monitoring station is used as each clock node of the oil transportation pipe network. With the continuous development of the time synchronization technology, the GPS time service system plays an important role, but most monitoring stations of the oil pipeline network are located in remote locations such as mountainous areas, and GPS equipment may not be installed, and even if the GPS equipment is installed, the situation that the GPS time service device signals are poor may occur frequently, which has a certain influence on the oil pipeline network to perform time synchronization by using the GPS time service system. Aiming at the condition that a GPS time service device cannot be used in a monitoring station with a severe environment, the existing method is to adopt a time server to sequentially send data information containing standard time to each clock node in a pipe network, and the clock node to be time-serviced carries out time synchronization by a method of directly correcting a local clock after receiving the standard time data, but the time synchronization method has the following defects: (1) data transmission delay, data packet processing delay and clock node have certain clock offset compared with a standard clock, so that a larger initial error of time synchronization is caused. (2) The clock module has a certain crystal oscillator absolute frequency difference, and each monitoring station of the oil pipeline network is far away and is located in different environments, so that the crystal oscillator in the clock module has a certain real-time frequency deviation, and a large time synchronization accumulated error can be formed in two time service intervals. (3) When the oil pipeline network has a huge structure and a plurality of monitoring stations exist, the method has low efficiency of time synchronization of the monitoring stations of the pipeline network and has certain time cost.
Disclosure of Invention
In order to solve the problems, the invention provides a method for synchronizing the time of an oil transportation pipe network based on dynamic compensation and a hierarchical transmission mode, and aims to solve the problems of low precision and low efficiency of time synchronization of the existing oil transportation pipe network monitoring station.
The technical scheme of the invention is as follows:
a time synchronization method for an oil transportation pipe network based on dynamic compensation and hierarchical transmission comprises the following steps:
the time synchronization sequence among the clock nodes is determined, and the clock nodes on the oil transportation pipe network are divided according to the time synchronization sequence;
taking an external time server as a time service node, taking a clock node determined as the most advanced time synchronization as a node to be timed, acquiring standard time information from the time service node by the node to be timed, and dynamically compensating a local clock according to the acquired standard time to complete the time synchronization of a first-stage clock node;
taking the first-stage clock node as a time service node, taking the clock node which is determined as the second sequence and carries out time synchronization as a node to be time-service, obtaining standard time information from the time service node by the node to be time-service, and carrying out dynamic compensation on a local clock according to the obtained standard time to complete the time synchronization of the second-stage clock node;
taking the second-level clock node as a time service node, taking the clock node which is determined to be in the third sequence and carries out time synchronization as a node to be time-service, obtaining standard time information from the time service node by the node to be time-service, and carrying out dynamic compensation on a local clock according to the obtained standard time to complete the time synchronization of the third-level clock node;
and so on, completing one time synchronization of all clock nodes according to a hierarchical transmission type synchronization mode.
Further, according to the method for synchronizing the time of the oil transportation pipe network based on the dynamic compensation and the hierarchical transmission, the method for dividing each clock node on the oil transportation pipe network comprises the following steps:
firstly, dividing each clock node on an oil transportation pipe network into a central node and a path node: for an oil pipeline without branches, selecting a clock node in the middle position as a central node, and taking the rest clock nodes as path nodes; for an oil pipeline with branches, selecting a clock node at a branch node as a central node, and selecting the rest clock nodes as path nodes;
then determining the parent-child relationship of adjacent clock nodes according to the positions of the clock nodes and the upstream and downstream distribution, namely defining parent nodes and child nodes;
then, for an oil pipeline without branches, the topological structure of the pipe network is transformed into a binary tree topological structure by taking the central node as a root node and the other nodes as leaf nodes; for an oil pipeline with branches, selecting a central node as a root node, selecting the other nodes as leaf nodes, transforming the topological structure of a pipe network into a multi-branch tree topological structure, cutting off the connection between each of the other central nodes and the parent node thereof, and using the central nodes as mutually independent root nodes, thereby obtaining a plurality of mutually independent n-branch tree topological structures;
finally, all clock nodes defined as root nodes are determined as the clock nodes which are most advanced in time synchronization, the clock nodes are divided into first-stage clock nodes, and the most advanced in time synchronization is carried out; dividing the leaf nodes directly connected with the root node into second-level clock nodes and determining that time synchronization is carried out in a second sequence; the leaf nodes directly connected with the first layer of leaf nodes are called second layer of leaf nodes, are divided into third level clock nodes and are determined to carry out time synchronization in a third sequence; and so on until completing the division of each clock node on the oil pipeline network and defining the time synchronization sequence among the clock nodes.
Further, according to the method for synchronizing the time of the oil transportation pipe network based on the dynamic compensation and the hierarchical transmission, the method for determining the parent-child relationship of the adjacent clock nodes comprises the following steps: and defining a clock node close to the central node as a father node and a clock node far away from the central node as a child node for two adjacent clock nodes distributed along the pipeline by taking the central node as a starting point.
Further, according to the method for synchronizing the time of the oil transportation pipe network based on the dynamic compensation and the hierarchical transmission, the node to be timed dynamically compensates the local clock according to the acquired standard time, and the method comprises the following steps:
time information is interacted between the time-giving node and the node to be timed, the current time deviation delta of the node to be timed is calculated according to the interacted time information, and meanwhile, the environmental characteristic information of the clock module is collected through a sensor arranged on a monitoring station where the node to be timed is locatedForming an environment feature vector x, correspondingly constructing a time deviation sample S ═ { δ | x } of the node to be timed, which is currently influenced by the environment features, and repeatedly executing the time deviation sample S ═ S | x } according to a preset time frequency to obtain a historical data set S ═ { S | x } of the time deviation samples with the required number r of samples1,s2…,sr};
Obtaining a time deviation predicted value beta of a node to be timed by utilizing an improved KNN algorithm according to a historical data set;
estimating the clock offset rate alpha of the node to be timed based on the real-time sampling frequency of the node to be timed in the monitoring station node to the pipeline pressure data;
and according to the time deviation predicted value beta and the clock offset rate alpha of the node to be timed, compensating the local clock of the node to be timed in real time.
Further, according to the method for synchronizing the time of the oil transportation pipe network based on the dynamic compensation and the hierarchical transmission type, the method for obtaining the time deviation predicted value beta of the node to be timed according to the historical data set and by using the improved KNN algorithm specifically comprises the following steps: assuming that the current environment feature vector of a node to be timed is p, firstly giving different weight coefficients to different environment features, and then calculating any sample vector S in a historical data set S according to a formula (1)iThe first-order distance D (i) with the feature vector p is sorted according to the distance value from small to large, and samples corresponding to the first m distance values in the sorting are taken to form a candidate sample set SM
Figure BDA0002965548120000031
In the formula, wxA weight representing the xth environmental characteristic; s isi,xRepresenting the xth eigenvalue in the ith sample in the data set S; p is a radical ofxIs the xth eigenvalue in the eigenvector p; n is the dimension of the feature vector p;
then, calculating the characteristic vector p and the candidate sample set S by using Euclidean distanceMThe distance l (i) between the samples:
Figure BDA0002965548120000032
then, sorting l (i) in the descending order, and taking the samples corresponding to the first k1 distance values in the sorting as a calculation subsample set 1, taking the samples corresponding to the first k2 distance values as a calculation subsample set 2, and calculating the respective weight coefficients of each sample point in the calculation subsample sets 1 and 2 according to formulas (3) and (4):
Figure BDA0002965548120000033
Figure BDA0002965548120000034
then, the time offsets of the k1 calculated subsamples are multiplied by a weighting factor to sum, resulting in TSThe sum of the time deviations of the k2 calculated subsamples sets multiplied by the weighting factor results in Te;TSAnd TeForming upper and lower limits of a time deviation prediction result to obtain a time deviation prediction interval of the node to be timed, and calculating the average value of the upper and lower limits of the prediction interval as a time deviation prediction value beta of the node to be timed;
Figure BDA0002965548120000041
Figure BDA0002965548120000042
wherein, delta1(h) Is to calculate the time offset, delta, of the h-th sample in the subsample set 12(h) Is to calculate the time offset, Z, of the h-th sample in the subsample set 21(h) To calculate the weight of the time offset of the h-th sample in the subsample set 1, Z2(h) The weight of the time offset for the h-th sample in the sub-sample set 2 is calculated.
Further, according to the oil pipe network time synchronization method based on dynamic compensation and hierarchical transmission, the environmental characteristics comprise temperature, humidity, noise frequency and clock crystal oscillator absolute frequency difference of the node to be timed.
Further, according to the method for synchronizing the time of the oil transportation pipe network based on dynamic compensation and the hierarchical transmission, the method for estimating the clock offset rate alpha of the node to be timed based on the real-time sampling frequency of the monitoring station node where the node to be timed is located to the pipeline pressure data comprises the following steps: assume that the real-time sampling frequency of the pressure data in the n-times sampling is f ═ f1,f2,…,fn]The sampling time corresponding to the sampling time at each sampling frequency is t ═ t1,t2,…,tn]Creating a pressure data acquisition counter k ═ k1,k2,…,kn]The pressure data storage vector v ═ v (v ═ v)1,v2,…,vnAnd, after pressure data acquisition is completed, calculating the clock offset rate alpha of the node to be timed according to the pressure acquisition data:
Figure BDA0002965548120000043
in the formula (f)iSampling frequency, t, for the ith pressure data sampleiSampling time, k, for the ith pressure data samplei' is the final value of the pressure data acquisition counter at the end of the ith pressure data sample.
Further, according to the method for synchronizing the time of the oil transportation pipe network based on the dynamic compensation and the hierarchical transmission, the method for compensating the local clock of the node to be timed in real time according to the time deviation predicted value beta and the clock offset rate alpha of the node to be timed comprises the following steps: by a unitary linear regression equation t0=αT0+ beta compensates the local clock of the node to be timed, wherein T0The current time t of the local clock of the node to be timed0Is to T0Time after linear compensation.
Compared with the prior art, the oil transportation pipe network time synchronization method based on dynamic compensation and hierarchical transmission has the following beneficial effects:
1. the clock nodes in the oil transportation pipe network are divided according to a preset time synchronization sequence, the time synchronization sequence among the clock nodes is determined, the time of each clock node of the oil transportation pipe network is calibrated in a hierarchical transmission type synchronization mode, and the time synchronization efficiency is improved.
2. The environmental characteristics of each monitoring station influencing the clock offset are collected, the time offset is predicted by adopting the improved KNN (k-nearest neighbor) algorithm, and the time synchronization initial error during time synchronization is effectively reduced.
3. The station field real-time sampling frequency is used for estimating the local real-time clock offset rate, and the time synchronization accumulated error during the two time service intervals is effectively reduced.
4. And a corresponding relation between the clock to be timed and the standard clock is established, and the clock to be timed is dynamically compensated in real time, so that the time precision of the clock to be timed is greatly improved.
5. The method can still maintain the stability of communication under the conditions that the pipe network structure is complex and each monitoring station is far away.
Drawings
FIG. 1 is a flow chart of the method for synchronizing the time of an oil pipeline network based on dynamic compensation and hierarchical transmission according to the present invention;
FIG. 2(a) is a schematic view of the topology of an oil pipeline network; (b) the oil transportation pipe network shown in (a) is transformed into a schematic diagram of a binary tree topology structure;
FIG. 3(a) is a schematic view of the topology of another oil transportation pipe network; (b) transforming the oil transportation pipe network shown in (a) into a multi-branch tree topological structure diagram; (c) the method is a schematic diagram for transforming the oil transportation pipe network shown in (a) into a plurality of n-branch tree topologies and arranging the n-branch tree topologies in parallel;
FIG. 4 is a flowchart of a process of compensating a local clock by a node to be timed according to standard time.
Detailed Description
To facilitate an understanding of the present application, the present application will now be described more fully with reference to the accompanying drawings. Preferred embodiments of the present application are given in the accompanying drawings. This application may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
As shown in fig. 1, the method for synchronizing the time of the oil transportation pipe network based on the dynamic compensation and the staged transmission includes the following steps:
firstly, defining the time synchronization sequence among the clock nodes, and dividing the clock nodes on the oil transportation pipe network according to a preset time synchronization sequence, for example, dividing the clock node which performs time synchronization firstly into a first stage, dividing the clock node which performs time synchronization in a second sequence into a second stage, dividing the clock node which performs time synchronization in a third sequence into a third stage, and so on until all the clock nodes on the oil transportation pipe network are divided. Then, carrying out hierarchical transmission type time synchronization on the clock nodes on the oil transportation pipe network, wherein the specific method comprises the following steps: firstly, an external time server carrying standard time is used as a time service node to provide initial standard time for a clock node of the whole oil transportation pipe network, the clock node divided into a first stage is used as a node to be time-serviced, the node to be time-serviced receives a time service command from a monitoring station where the node is located according to a preset time interval, the node to be time-serviced acquires standard time information from the time service node after receiving the time service command, and then a local clock is compensated and corrected according to the acquired standard time to complete time synchronization of the first stage clock node; then, because the first-stage clock node after compensating and correcting the local clock has standard time, the first-stage clock node can be used as a time service node, the clock node divided into the second stage is used as a node to be time-service, the node to be time-service receives a time service command from a monitoring station where the node is located according to a preset time interval, the node to be time-service acquires standard time information from the time service node after receiving the time service command, and then the local clock is compensated and corrected according to the acquired standard time, so that the time synchronization of the second-stage clock node is completed; then, because the second-level clock node after compensating and correcting the local clock has standard time, the second-level clock node can be used as a time service node, the clock node divided into the third level is used as a node to be time-service, the node to be time-service receives a time service command from a monitoring station where the node is located according to a preset time interval, the node to be time-service acquires standard time information from the time service node after receiving the time service command, and then the local clock is compensated and corrected according to the acquired standard time, so that the time synchronization of the third-level clock node is completed; by analogy, one-time synchronization of all clock nodes is completed according to the hierarchical transmission type time synchronization method, so that real-time dynamic compensation of local clocks of all clock nodes can be realized, and synchronization of all clock nodes on the oil pipeline network and standard time can be well realized.
Fig. 2 and 3 show an example of dividing clock nodes on a pipeline network according to a preset time synchronization sequence according to an embodiment of the present invention. In the embodiment, each clock node on the oil transportation pipe network is divided into a center node and a path node: for an oil pipeline without branches, selecting a clock node at a middle position as a central node, and the rest clock nodes as path nodes, for example, on the oil pipeline shown in fig. 2(a), setting a clock node C as the central node, and the rest clock nodes A, B, D, E, F as path nodes; for an oil pipeline with branches, the clock node at the branch node is set as a central node, and the remaining clock nodes are set as path nodes, for example, in the oil pipeline network shown in fig. 3(a), the clock node D, H, I, M is set as a central node, and the remaining clock nodes are set as path nodes. Then, determining the parent-child relationship of the adjacent clock nodes according to the positions of the clock nodes and the upstream and downstream distribution: and defining a clock node close to the central node as a father node and a clock node far away from the central node as a child node for two adjacent clock nodes distributed along the pipeline by taking the central node as a starting point. Then, for an oil pipeline without branches, taking the central node as a root node and the remaining nodes as leaf nodes, and transforming the topology structure of the pipe network into a binary tree topology structure, for example, taking node C as the root node and the remaining nodes as the leaf nodes in the oil pipeline network shown in fig. 2(a), the pipe network topology structure shown in fig. 2(a) can be transformed into a binary tree topology structure shown in fig. 2 (b); for the oil pipeline with branches, one central node is selected as a root node, the other nodes are leaf nodes, the topology structure of the pipe network is transformed into a multi-branch tree topology structure, for example, a node H is selected as the root node in the oil pipeline network shown in fig. 3(a), the other nodes are leaf nodes, the topology structure of the oil pipeline network shown in fig. 3(a) is transformed into the multi-branch tree topology structure shown in fig. 3(b), then the connection between the other central nodes and their respective father nodes is cut off, and the central nodes are used as mutually independent root nodes, so that a plurality of mutually independent binary tree topologies or multi-branch tree topologies can be obtained, for example, the multi-branch tree topology structure shown in fig. 3(b) can be finally transformed into a multi-branch tree topology structure and three binary tree topologies which respectively use a node D, H, I, M as the root node as shown in fig. 3(c), in addition, in order to facilitate the division of the clock nodes, in this embodiment, the four n-ary tree topology structures are arranged in parallel, and the four root nodes are arranged on a straight line. Finally, dividing all clock nodes defined as root nodes into the first level of time synchronization order, such as root node C in fig. 2(b) and root node D, H, I, M in fig. 3(C), synchronizes the most advanced time; dividing leaf nodes directly connected to the root node into a second level of the time synchronization order and defining the leaf nodes as first level leaf nodes, such as leaf node B, D in fig. 2(b), and leaf node E, C, G, L, N, O, T, J, K in fig. 3(c), which are arranged in a second order for time synchronization; by analogy, dividing leaf nodes connected to the first level leaf nodes into a third level of time synchronization order, such as leaf node A, E in fig. 2(b), and leaf node B, F, P in fig. 3(c), to define these leaf nodes as second level leaf nodes, which are to be time synchronized in a third order; dividing leaf nodes connected to leaf nodes of the second layer into the fourth level of the time synchronization order, such as leaf node F in fig. 2(b), and leaf node A, Q in fig. 3(c), and defining these leaf nodes as third-level leaf nodes, which are to be arranged in the fourth order for time synchronization, so that the division of the clock nodes on the oil transportation pipe network shown in fig. 2(a) is completed but the division of the clock nodes on the oil transportation pipe network shown in fig. 3(a) is not completed, and thus the division of leaf nodes connected to leaf nodes of the third layer in fig. 3(b) into the fifth level of the time synchronization order continues, i.e., the leaf node R in fig. 3(b) is divided into the fifth level of the time synchronization order and defined as fourth-level leaf nodes, which are to be arranged in the fifth order for time synchronization, dividing the leaf node connected with the fourth layer of leaf node in fig. 3(c) to the sixth level of the time synchronization sequence, namely dividing the leaf node S in fig. 3(c) to the sixth level of the time synchronization sequence, defining the leaf node S as the fifth layer of leaf node, and arranging the clock nodes in the sixth sequence for time synchronization, thereby completing the division of each clock node on the oil transportation pipe network shown in fig. 3 (a). In this embodiment, a two-dimensional array a [ i, j ] is used to store the correspondence between clock nodes:
Figure BDA0002965548120000071
in the process of performing hierarchical transmission type time synchronization on each time node on an oil pipeline network, a method for compensating and correcting a local clock by a node to be timed according to standard time is specifically included, as shown in fig. 4: the time-giving node and the node to be timed interact time information by adopting a round-trip timing message synchronization mechanism through a bidirectional time synchronization principle, bidirectionally receive and transmit a data packet containing the time information, calculate the current time deviation of the node to be timed by using an NTP clock synchronization principle, simultaneously acquire the environmental characteristic information of the monitoring station node where the node to be timed is located, correspondingly construct a time deviation sample of the node to be timed, which is influenced by the environmental characteristic currently, and repeatedly execute the previous content according to a preset time frequency to generate a historical data set of the time deviation sample of the node to be timed, wherein the specific content comprises the following steps S001-S007; according to the historical data set of the node to be timed, the utilization change is carried outA time deviation predicted value beta of the node to be timed is obtained through a KNN algorithm; the method comprises the steps that a clock offset rate alpha is estimated based on the real-time sampling frequency of a monitoring station node where a node to be timed is located to a certain monitoring characteristic, and since pipeline pressure is the most important in each monitoring characteristic, the clock offset rate alpha is estimated based on the real-time sampling frequency of the monitoring station node where the node to be timed is located to pipeline pressure data; according to the obtained time deviation predicted value beta and the clock offset rate alpha of the node to be timed, a unitary linear regression equation is established to carry out real-time compensation correction on the local clock of the node to be timed, and the linear relation between the local time and the standard time is established in consideration of the fact that the time frequency of the clock node in a certain time range is stable, so that the unitary linear regression equation t is established0=αT0+ β, wherein, T0The current time, t, of the local clock of the node to be timed0Is to T0Time after linear compensation.
Generating a historical data set of a time deviation sample of a node to be timed according to the following steps:
step S001: after receiving a time service command from a monitoring station where the node to be time-service is located, the node to be time-service creates a data packet structure, adds current local time T1, and sends the data message to the time-service node, wherein the time T1 is based on a local clock of the node to be time-service. The data packet format of the bidirectional data transceiving process of the node to be timed and the timing node is shown in table 1.
TABLE 1 data packet format containing time information for bidirectional transmission and reception
Figure BDA0002965548120000081
Step S002: the time service node receives the data message sent by the node to be time-service, records the receiving time T2, and adds the time T2 to the data message, wherein the time T2 is based on the local clock of the time service node.
Step S003: and the time service node adds time data of time T3 to the data packet at time T3 and then sends the data packet to the node to be time-service, wherein the time T3 is based on the local clock of the time service node.
Step S004: and the node to be timed receives the data packet sent by the timing node at the time T4, and adds the time T4 to the data packet, wherein the time T4 is based on the local clock of the node to be timed.
Step S005: according to timestamp information T1, T2, T3 and T4 contained in a data packet transmitted and received by the node to be timed and the time service node in a two-way mode, the time deviation delta between the node to be timed and the time service node can be calculated through the NTP clock synchronization principle.
The clock node is internally provided with a counter and a crystal oscillator with a specific frequency, and the counter is increased by a certain value after the pulse of the oscillator is increased by a certain number, so that the counting in time is completed. Due to the fact that the crystal oscillator has a tiny frequency error, and the clock module is influenced by temperature, humidity, pressure, noise and the like of the external environment when working, certain real-time frequency deviation can occur among different clock nodes along with the lapse of time. And the time synchronization message can generate non-deterministic time delay in the transmission process, including synchronous data packet sending time delay, synchronous data packet transmission time delay, synchronous data packet receiving time delay, synchronous data packet processing time delay and clock node having certain clock offset compared with the standard clock, so that the clock node has certain initial time deviation and accumulated time deviation in the working process.
Step S006: acquiring environment characteristic information of the clock module by a node to be timed through a sensor arranged in a monitoring station where the node to be timed is located, wherein the environment characteristic information comprises temperature x1, humidity x2 and noise frequency x3, and simultaneously acquiring clock crystal oscillator absolute frequency difference x4 of the node to be timed to form an environment characteristic vector x ═[ x1, x2, x3 and x4], so that a time deviation sample s affected by environment characteristics is constructed as { delta | x }; the clock crystal oscillator absolute frequency difference refers to an absolute frequency error of a crystal oscillator, which is a natural frequency error of the crystal oscillator, for example, a crystal oscillator with a nominal value of 10MHz and an error of ± 20ppm has a frequency error range of: plus or minus (10MHz multiplied by 20ppm) ± 200 Hz.
Step S007: repeating the steps S001 to S006 at a time frequency of 1S intervals to generateObtaining a historical data set of time deviation samples of the nodes to be timed, obtaining time deviation sample sets corresponding to environmental characteristics at different moments until reaching a preset historical data set sample number upper limit r, and obtaining a historical data set S ═ S1,s2…,sr}。
In the embodiment, the specific content of obtaining the time deviation predicted value β of the node to be timed by using the improved KNN algorithm according to the historical data set of the node to be timed is as follows:
assuming that a current environment feature vector acquired by a node to be timed is p, calculating the distance between p and each sample in a historical data set, and if Euclidean distances are directly adopted to calculate the distance between the feature vector p and all samples in the historical data set, the time and space complexity is very high, therefore, the invention improves the KNN algorithm, proposes a first-order distance construction candidate sample set based on feature weight, and then constructs a K-adjacent calculation sub-sample set based on the Euclidean distances according to the candidate sample set so as to reduce the time and space complexity of calculation: assuming that a current environment characteristic vector acquired by a node to be timed is p, calculating the distance between the current characteristic vector p and each sample in a historical data set, selecting m samples from the historical data set as a candidate sample set, and selecting k (k) closest to the characteristic vector p from the m samples in the candidate sample set<m) samples are used as a calculation subsample set, and the specific content is as follows: firstly, different environment characteristics are endowed with different weight coefficient empirical values according to different influences of the environment characteristics on time deviation and clock offset rate, for example, the weight coefficient endowed to temperature is w1The weighting factor given to the humidity is w2And a weighting factor given to the noise frequency is w3The weight coefficient given to the absolute frequency difference of the clock crystal oscillator of the node to be timed is w4The obtained weight coefficient vector is w ═ w1,w2,w3,w4](ii) a Then calculating any sample vector S in the historical data set S according to the formula (1)iThe first-order distance D (i) with the feature vector p is sorted according to the distance value from small to large, and samples corresponding to the first m distance values in the sorting are taken to form a candidate sample set SM
Figure BDA0002965548120000091
In the formula, wxA weight representing the xth environmental characteristic; si,xRepresenting the xth eigenvalue in the ith sample in the data set S; p is a radical of formulaxIs the xth eigenvalue in the eigenvector p; n is a feature vector dimension, and N is 4 in the present embodiment.
Then, calculating the characteristic vector p and the candidate sample set S by using Euclidean distanceMThe distance l (i) between the samples:
Figure BDA0002965548120000092
then, the l (i) is sorted from small to large, and the samples corresponding to the first k1 distance values in the sorting are taken as a calculation sub-sample set 1, the samples corresponding to the first k2 distance values are taken as a calculation sub-sample set 2, and the respective weight coefficients of the sample points in the calculation sub-sample sets 1 and 2 are calculated according to the formulas (3) and (4):
Figure BDA0002965548120000101
Figure BDA0002965548120000102
then, the time deviation of the k1 calculated sub-sample sets is multiplied by a weighting coefficient to be summed, and the result is TSThe sum of the time deviations of the k2 calculated subsamples sets multiplied by the weighting factor results in Te。TsAnd TeAnd forming upper and lower limits of a time deviation prediction result to obtain a time deviation prediction interval of the node to be timed, and solving the average value of the upper and lower limits of the prediction interval as a time deviation prediction value beta of the node to be timed.
Figure BDA0002965548120000103
Figure BDA0002965548120000104
Wherein, delta1(h) Is to calculate the time offset, delta, of the h-th sample in the subsample set 12(h) Is to calculate the time offset, Z, of the h-th sample in the subsample set 21(h) To calculate the weight of the time offset of the h-th sample in the subsample set 1, Z2(h) The weight of the time offset for the h-th sample in the sub-sample set 2 is calculated.
In the embodiment, the clock offset rate α is estimated based on the real-time sampling frequency of the pressure data of the monitoring station node where the node to be timed is located, and includes the following contents: suppose the real-time sampling frequency of the pressure data in n times of sampling is f ═ f1,f2,…,fn]The unit is Hz, and the sampling time corresponding to the sampling time implemented by each sampling frequency is t ═ t1,t2,…,tn]In units of s, a pressure data storage vector v ═ is created1,v2,…,vnAnd with the unit of MPa, the lower computer of the monitoring station node acquires pressure data according to the local clock, the set sampling frequency and the sampling time implemented by each sampling frequency, and calculates the clock offset rate alpha of the node to be timed according to the pressure acquisition data after the pressure data acquisition is completed, and the method specifically comprises the following steps:
step S201: creating a pressure data acquisition counter k ═ k1,k2,…,kn]Initialized to 0 and of type int.
Step S202: and the time service node sends a pressure data acquisition starting message to the node to be time-serviced, and the time service node starts timing at the same time.
Step S203: the node to be timed receives the pressure data acquisition starting message and starts to sample according to the sampling frequency f1Performing pressure data acquisition and k1Performing self-increment counting, and each time pressure data acquisition is completed, k1Self-increment by 1.
Step S204: timing node timingTo reach t1And then sending a pressure data acquisition termination message to the node to be timed.
Step S205: ending the pressure data acquisition after the time service node receives the pressure data acquisition termination message, wherein k is the time service node1Is self-increasing by k1′。
Step S206: sequentially according to the sampling frequency f ═ f1,f2,…,fn]And the corresponding sampling time t ═ t1,t2,…,tn]Repeating the pressure data acquisition according to the method of steps S202 to S205 until the pressure data acquisition is completed, and recording the variable value of the pressure data acquisition counter as k' ═ k1′,k2′,…kn′]。
Step S207: the clock offset rate alpha is calculated.
Figure BDA0002965548120000111
In the formula (f)iSampling frequency, t, for the ith pressure data sampleiSampling time, k, for the ith pressure data samplei' is the final value of the pressure data acquisition counter at the end of the ith pressure data sample.
It should be understood that various changes and modifications can be made by those skilled in the art without departing from the spirit and scope of the invention.

Claims (5)

1. A time synchronization method for an oil transportation pipe network based on dynamic compensation and a hierarchical transmission mode is characterized by comprising the following steps:
the time synchronization sequence among the clock nodes is determined, and the clock nodes on the oil transportation pipe network are divided according to the time synchronization sequence;
taking an external time server as a time service node, taking a clock node determined as the most advanced time synchronization as a node to be timed, acquiring standard time information from the time service node by the node to be timed, and dynamically compensating a local clock according to the acquired standard time to complete the time synchronization of a first-stage clock node;
taking the first-stage clock node as a time service node, taking the clock node which is determined as the second sequence and carries out time synchronization as a node to be time-service, obtaining standard time information from the time service node by the node to be time-service, and carrying out dynamic compensation on a local clock according to the obtained standard time to complete the time synchronization of the second-stage clock node;
taking the second-level clock node as a time service node, taking the clock node which is determined to be in the third sequence and carries out time synchronization as a node to be time-service, obtaining standard time information from the time service node by the node to be time-service, and carrying out dynamic compensation on a local clock according to the obtained standard time to complete the time synchronization of the third-level clock node;
and so on, completing one time synchronization of all clock nodes according to a hierarchical transmission type synchronization mode;
the method for dividing each clock node on the oil transportation pipe network comprises the following steps:
firstly, dividing each clock node on an oil transportation pipe network into a central node and a path node: for an oil pipeline without branches, selecting a clock node in the middle position as a central node, and taking the rest clock nodes as path nodes; for an oil pipeline with branches, selecting clock nodes at the branch nodes as central nodes, and selecting the rest clock nodes as path nodes;
then determining the parent-child relationship of adjacent clock nodes according to the positions of the clock nodes and the upstream and downstream distribution, namely defining parent nodes and child nodes;
secondly, for an oil pipeline without branches, the topological structure of the pipe network is transformed into a binary tree topological structure by taking the central node as a root node and the other nodes as leaf nodes; for an oil pipeline with branches, selecting a central node as a root node, selecting the other nodes as leaf nodes, transforming the topological structure of a pipe network into a multi-branch tree topological structure, cutting off the connection between each of the other central nodes and the parent node thereof, and using the central nodes as mutually independent root nodes, thereby obtaining a plurality of mutually independent n-branch tree topological structures;
finally, all clock nodes defined as root nodes are determined as the clock nodes which are most advanced in time synchronization, the clock nodes are divided into first-stage clock nodes, and the most advanced in time synchronization is carried out; the leaf nodes directly connected with the root node are called first-layer leaf nodes, are divided into second-level clock nodes and are determined to perform time synchronization in a second sequence; the leaf nodes directly connected with the first layer of leaf nodes are called second layer of leaf nodes, are divided into third level clock nodes and are determined to carry out time synchronization in a third sequence; and repeating the steps until the clock nodes on the oil pipeline network are divided.
2. The method for synchronizing the time of the oil transportation pipe network based on the dynamic compensation and the hierarchical transmission manner according to claim 1, wherein the method for determining the parent-child relationship of the adjacent clock nodes comprises the following steps: and defining a clock node close to the central node as a father node and a clock node far away from the central node as a child node for two adjacent clock nodes distributed along the pipeline by taking the central node as a starting point.
3. The oil pipe network time synchronization method based on dynamic compensation and hierarchical transmission according to claim 1, wherein the node to be timed dynamically compensates the local clock according to the acquired standard time, and the method comprises the following steps:
the time service method comprises the steps that time information is interacted between a time service node and a node to be time-service, the current time deviation delta of the node to be time-service is calculated according to the interacted time information, meanwhile, environment characteristic information of a clock module is collected through a sensor arranged in a monitoring station where the node to be time-service is located, an environment characteristic vector x is formed, a time deviation sample S, affected by environment characteristics, of the node to be time-service is correspondingly constructed, and after repeated execution is carried out according to preset time frequency, a needed historical data set S, formed by r time deviation samples, is obtained1,s2…,sr};
Obtaining a time deviation predicted value beta of a node to be timed by utilizing an improved KNN algorithm according to a historical data set;
estimating the clock offset rate alpha of the node to be timed based on the real-time sampling frequency of the node to be timed in the monitoring station node to the pipeline pressure data;
according to the time deviation predicted value beta and the clock offset rate alpha of the node to be timed, compensating the local clock of the node to be timed in real time;
the method for obtaining the time deviation predicted value beta of the node to be timed according to the historical data set and by using the improved KNN algorithm specifically comprises the following steps: assuming that a current environment feature vector of a node to be timed is p, firstly giving different weight coefficients to different environment features, and then calculating any sample vector S in a historical data set S according to a formula (1)iThe first-order distance D (i) with the feature vector p is sorted according to the distance value from small to large, and samples corresponding to the first m distance values in the sorting are taken to form a candidate sample set SM
Figure FDA0003499367380000021
In the formula, wxA weight representing the xth environmental characteristic; si,xRepresenting the xth eigenvalue in the ith sample in the data set S; p is a radical ofxIs the xth eigenvalue in the eigenvector p; n is the dimension of the feature vector p;
then, calculating the characteristic vector p and the candidate sample set S by using Euclidean distanceMThe distance l (i) between the samples:
Figure FDA0003499367380000022
then, the l (i) is sorted from small to large, and the samples corresponding to the first k1 distance values in the sorting are taken as a calculation sub-sample set 1, the samples corresponding to the first k2 distance values are taken as a calculation sub-sample set 2, and the respective weight coefficients of the sample points in the calculation sub-sample sets 1 and 2 are calculated according to the formulas (3) and (4):
Figure FDA0003499367380000031
Figure FDA0003499367380000032
then, the time deviation of the k1 calculated sub-sample sets is multiplied by a weighting coefficient to be summed, and the result is TSThe sum of the time deviations of the k2 calculated subsamples sets multiplied by the weighting factor results in Te;TSAnd TeForming upper and lower limits of a time deviation prediction result to obtain a time deviation prediction interval of the node to be timed, and calculating the average value of the upper and lower limits of the prediction interval as a time deviation prediction value beta of the node to be timed;
Figure FDA0003499367380000033
Figure FDA0003499367380000034
wherein, delta1(h) Is to calculate the time offset, delta, of the h-th sample in the subsample set 12(h) Is to calculate the time offset, Z, of the h-th sample in the subsample set 21(h) To calculate the weight of the time offset of the h-th sample in the subsample set 1, Z2(h) To calculate the weight of the time offset of the h sample in the sub-sample set 2;
the method for estimating the clock offset rate alpha of the node to be timed based on the real-time sampling frequency of the node to be timed in the monitoring station node to the pipeline pressure data comprises the following steps: suppose the real-time sampling frequency of the pressure data in n times of sampling is f ═ f1,f2,…,fn]The sampling time corresponding to each sampling frequency is t ═ t1,t2,…,tn]Creating a pressure data acquisition counter k ═ k1,k2,…,kn]The pressure data storage vector v ═ v (v ═ v)1,v2,…,vnAnd, after pressure data acquisition is completed, calculating the clock offset rate alpha of the node to be timed according to the pressure acquisition data:
Figure FDA0003499367380000035
in the formula (f)iSampling frequency, t, for the ith pressure data sampleiSampling time, k, for the ith pressure data samplei' is the final value of the pressure data acquisition counter at the end of the ith pressure data sample.
4. The oil pipeline network time synchronization method based on dynamic compensation and hierarchical transmission according to claim 3, wherein the environmental characteristics include temperature, humidity, noise frequency and clock crystal oscillator absolute frequency difference of the node to be timed.
5. The oil pipe network time synchronization method based on dynamic compensation and hierarchical transmission according to claim 3, wherein the method for compensating the local clock of the node to be timed in real time according to the time deviation predicted value β and the clock offset rate α of the node to be timed comprises the following steps: by a unitary linear regression equation t0=αT0+ beta compensates the local clock of the node to be timed, wherein T0The current time t of the local clock of the node to be timed0Is to T0Time after linear compensation.
CN202110249876.XA 2021-03-08 2021-03-08 Oil transportation pipe network time synchronization method based on dynamic compensation and hierarchical transmission Active CN113055114B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110249876.XA CN113055114B (en) 2021-03-08 2021-03-08 Oil transportation pipe network time synchronization method based on dynamic compensation and hierarchical transmission

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110249876.XA CN113055114B (en) 2021-03-08 2021-03-08 Oil transportation pipe network time synchronization method based on dynamic compensation and hierarchical transmission

Publications (2)

Publication Number Publication Date
CN113055114A CN113055114A (en) 2021-06-29
CN113055114B true CN113055114B (en) 2022-06-03

Family

ID=76510585

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110249876.XA Active CN113055114B (en) 2021-03-08 2021-03-08 Oil transportation pipe network time synchronization method based on dynamic compensation and hierarchical transmission

Country Status (1)

Country Link
CN (1) CN113055114B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114584246B (en) * 2022-03-01 2023-08-15 四川九洲电器集团有限责任公司 FPGA-based wireless ad hoc network time synchronization method, system and medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018125233A1 (en) * 2016-12-30 2018-07-05 Agerstam Mats Mechanism for efficient data reporting in iiot wsn
CN108599888A (en) * 2018-05-09 2018-09-28 西安电子科技大学 A kind of distributed network clock synchronizing system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10778659B2 (en) * 2012-05-24 2020-09-15 Smart Security Systems Llc System and method for protecting communications
CN103945525A (en) * 2014-04-30 2014-07-23 国家电网公司 Hierarchical structure based wireless sensor network time synchronization method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018125233A1 (en) * 2016-12-30 2018-07-05 Agerstam Mats Mechanism for efficient data reporting in iiot wsn
CN108599888A (en) * 2018-05-09 2018-09-28 西安电子科技大学 A kind of distributed network clock synchronizing system

Also Published As

Publication number Publication date
CN113055114A (en) 2021-06-29

Similar Documents

Publication Publication Date Title
JP4819781B2 (en) Method for performing time synchronization between nodes of a network and equipment for performing this method
CA2613440A1 (en) Automated precision alignment of data in a utility monitoring system
US8416812B2 (en) Network timing synchronization systems
CN101803268B (en) Clock synchronization system, method and program thereof
CN101068128B (en) Method for time synchronization in distributed control system
CN107182123B (en) A kind of synchronous method and synchronization system of UWB positioning system
CN101316160A (en) Multi-node synchronization sampling and data transmission method
CA2612583A1 (en) Automated hierarchy classification in utility monitoring systems
CN100499526C (en) End-to-end quening time delay measuring method
CA2613441A1 (en) Automated integration of data in utility monitoring systems
CN113055114B (en) Oil transportation pipe network time synchronization method based on dynamic compensation and hierarchical transmission
CN102449940A (en) Network synchronization method and apparatus for performing time synchronization between nodes
CN103929293A (en) Asymmetrically-delayed time synchronization method and system
CN112118623A (en) Network time synchronization method and system for multi-node sensor acquisition system
WO2009058683A2 (en) Automated data alignment based upon indirect device relationships
CN110350996B (en) Clock drift rate tracking method and system based on interactive multi-model filter
CN112969229B (en) Clock correction method and device and network equipment
CN114389735A (en) Clock synchronization method based on IEEE802.1AS redundant master clock
CN103124212B (en) Digital control system on-the-spot bus time synchronous method and device based on Bayes principle
CN116506802A (en) Underwater node time synchronization method for distributed ocean flow field acoustic measurement
CN113890667B (en) Reverse integral filtering round-trip time correction method and system
Dong et al. Research on fault-tolerant strategy of time synchronization for industrial wireless sensor network
CN109525349B (en) Distributed time synchronization method based on noise estimation and trust weighting
Qi et al. A clock synchronization method for ad hoc networks
CN106970611B (en) Network control system sampling period optimal control method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant