CROSS-NETWORK TIME SYNCHRONIZATION METHOD FOR INDUSTRIAL WIRELESS NETWORK AND TSN FUSION

Information

  • Patent Application
  • 20240243829
  • Publication Number
    20240243829
  • Date Filed
    May 07, 2022
    2 years ago
  • Date Published
    July 18, 2024
    a month ago
Abstract
The present invention relates to a cross-network time synchronization method for industrial wireless network and TSN fusion, which belongs to the field of Industrial Internet, comprising the following steps: S1: conducting clock synchronization by a TSN module of a border gateway with a TSN switch of a TSN 2 in a slave clock state; S2: inside the border gateway, using the TSN module as a master clock of an industrial wireless module, and conducting clock synchronization by the industrial wireless module with the TSN module through a serial port; S3: conducting clock synchronization by a routing device in the industrial wireless network with the industrial wireless module of the border gateway through a beacon frame synchronization mode in the slave clock state, and conducting clock synchronization by the routing device as the master clock of a node device for the node device; S4: conducting clock synchronization by a terminal side conversion node in the slave clock state with the node device in the industrial wireless network through a timestamp-free synchronization mode, and finally, synchronizing a TSN switch of a TSN 1 with the terminal side conversion node in the slave clock state.
Description
FIELD OF INVENTION

The present invention belongs to the field of industrial Internet, and relates to a cross-network time synchronization method for industrial wireless network and TSN fusion.


BACKGROUND ART OF THE INVENTION

Intranets, such as industrial control network and management network, of the traditional manufacturing plants can be considered as closed networks and cannot be accessed by the outside world. With the development, application and promotion of intelligent manufacturing, an internal network needs to be connected with an external network; at the same time, a wireless communication technology must be used in industrial scenarios that upgrade, reformation and wiring of rotating mechanical equipment and old factories are inconvenient, and production sites of oil and gas pipelines are too far; more industrial interconnection applications, such as machine-to-machine interaction and collaboration, factory logistics, remote maintenance of large-scale manufacturing equipment, and AR/VR, require wireless communication to satisfy the efficiency need and various performance indicators. At present, the research of convergence networks including wired and wireless technologies has a certain foundation and has begun to be widely deployed in automation systems, smart cities and home area networks. On the one hand, a wired network has higher reliability and performance due to topological stability and smaller packet loss rates; and on the other hand, network connectivity requirements are different in terms of spatial range mobility, energy consumption, data throughput, timeliness, reliability and other features. Therefore, it is necessary to combine wired and wireless network technologies to provide required service quality for factory networks.


Industrial control services need to be carried by a network with definite time delay and reliable guarantee. TSN receives extensive attention because of the forwarding capability of definite time delay and compatibility with Ethernet protocols. However, wired TSN cannot satisfy the extensive deployment needs of novel devices such as massive sensors and AGVs in smart factories. Cooperative transmission between an industrial wireless network and TSN becomes a research hotspot in the field of industry and automation.


Clock synchronization refers to a process of limiting a deviation between a clock of a device in a system and a specific time information source within a certain range, and is a particularly important technology in a distributed system. Its purpose is to establish a global time concept with predefined precision by ensuring a finite maximum offset between any two nodes. Especially in the industrial control network, many basic operations in the network, such as object tracking, deterministic scheduling and resource management, are inseparable from clock synchronization, which means that all nodes in the network need to share a unified time scale.


When the factory network combines the wireless network and the wired network which are two networks of different communication protocols, how to conduct cross-network time synchronization becomes a challenging problem. At present, there are few researches on cross-network time synchronization in China and abroad. Due to high requirements of an industrial heterogeneous network for the features of timeliness and low delay, direct use of the existing methods cannot satisfy the needs of novel industrial heterogeneous networks.


DISCLOSURE OF THE INVENTION

In view of this, the purpose of the present invention is to effectively conduct cross-network time synchronization to research time modeling and time error compensation models between synchronization nodes in the heterogeneous networks by taking the heterogeneous networks as objects in combination with statistical algorithms through synchronization modes such as IEEE 802.1AS, beacon frame synchronization and timestamp-free synchronization, so as to enhance cross-network time synchronization accuracy.


To achieve the above purpose, the present invention provides the following technical solution:


A cross-network time synchronization method for industrial wireless network and TSN fusion comprises the following steps:

    • S1: conducting clock synchronization by a TSN module of a border gateway with a TSN switch of a TSN 2 in a slave clock state;
    • S2: inside the border gateway, using the TSN module as a master clock of an industrial wireless module, and conducting clock synchronization by the industrial wireless module with the TSN module through a serial port so that time information is forwarded from a TSN 1 to an industrial wireless network;
    • S3: conducting clock synchronization by a routing device in the industrial wireless network with the industrial wireless module of the border gateway through a beacon frame synchronization mode in the slave clock state, and conducting clock synchronization by the routing device as the master clock of a node device for the node device, to ensure clock synchronization of the industrial wireless network;
    • S4: conducting clock synchronization by a terminal side conversion node in the slave clock state with the node device in the industrial wireless network through a timestamp-free synchronization mode; independent of a special synchronization protocol, only following the existing network data flow to complete synchronization parameter estimation, to forward the time information from the industrial wireless network to the TSN 1; and then completing clock synchronization by the TSN switch of the TSN 1 with the terminal side conversion node in the slave clock state.


Further, step S1 specifically comprises the following steps:

    • S11: obtaining timestamps t1, t2, t3 and t4 by a slave clock by using a peer-to-peer delay measurement mechanism;
    • S12: calculating link delay of the master clock and the slave clock by the slave clock;
    • S13: calculating processing time denoted as time_process by the slave clock;
    • S14: denoting a sum of the link delay and the processing time as A1.


Further, in step S1, the delay measurement mechanism is used to measure the link delay of the master clock and the slave clock; corresponding timestamps are obtained by exchanging a delay request message Delay_rep and a delay response message Delay_resp between the slave clock and the master clock; Delay_resp(t2) represents that the delay response message replied to the slave clock at time t3 by the master clock carries time t2; Follow_up_delay_resp(t3) represents that a follow-up delay response message sent by the master clock to the slave clock carries time t3; after a Follow_up_delay_resp message is sent, the slave clock receives the timestamps t1, t2, t3 and t4; the link delay delay_resp between the slave clock and the master clock is calculated as shown by expression (1):









delay_resp


=



(


t

2

-

t

1


)

+

(


t

4

-

t

3


)


2






(
1
)









    • the processing time is local time, which is duration time of a time interval between reception of a time synchronization event message by the master clock and transmission of a next subsequent time synchronization event message by the master clock; and the processing time is denoted as time_process, which is t3 here;

    • the sum of the link delay and the processing time is denoted as 41=delay_resp+time_process.





Further, the border gateway comprises an industrial wireless module and a TSN module; an SLIP is used to encapsulate IP data packets; and transparency of data transmission is ensured through an SLIP serial port, so that data is seamlessly connected between two networks.


Further, in step S2, a synchronization pulse signal outputted by a TSN module clock is a 1PPS pulse, and the industrial wireless module adjusts own local time by detecting the synchronization pulse signal outputted by the TSN module clock, comprising the following steps:


S21: sending, by the TSN module, an own initial clock T0 to the industrial wireless module through a serial port, and setting, by the industrial wireless module, own local initial time local_time0 according to time;


S22: starting an interrupt program to start to detect a 1PPS pulse signal outputted by the TSN module, and when detecting a 1PPS signal by the industrial wireless module, denoting time of receiving the 1PPS signal as local_time1.


S23: correcting an own local clock once by the industrial wireless module;

    • assuming that the industrial wireless module is corrected at time local_time2, corrected time local_time satisfies the following expression:









local_time0
=


T
0

+

S
R






(
2
)












local_time
=

local_time2
+
N
-
local_time1






(
3
)










    • where S represents length of a serial port message, R represents a serial port baud rate, and N represents number of pulses received by the industrial wireless module.





Further, in step S3, the industrial wireless module is denoted as A, the routing device is denoted as P1, and the node device is denoted as P2.


Time when node A sends a time message to node P1 to time when node P1 receives the message is a synchronization cycle of interaction between node A and node P1, and a process between node A and node P1 is repeated for N times to generate N synchronization cycles; after each time two nodes conduct one-way interaction of time information (i.e., one synchronization cycle), node P1 calculates clock frequency offset through the timestamp information for adjustment;


After adjustment of node P1, a time message is sent to node P2; time when node P1 sends the time message to node P2 to time when node P2 receives the message is a synchronization cycle of interaction between node P1 and node P2; a process between node P1 and node P2 is repeated for N times to generate N synchronization cycles; after each time two nodes conduct one-way interaction of time information (i.e., one synchronization cycle), node P2 calculates clock frequency offset through the timestamp information for adjustment.


Reference node A and first-layer node P1. In a first synchronization cycle between node A and node P1, node A sends current time information T1,1(A) to node P1, and receiving time T2,1(P1) recorded by P1 is represented as:










T

2
,

1


(

P
1

)


=


T

1
,

1


(
A
)


+

θ

t

0


(

A


P
1


)


+


ρ

(

A


p
1


)


(


T

1
,

1


(
A
)


-

t
0


)

+

d

(

A


p
1


)


+

X
1

(

A


P
1


)


+


ρ

(

A


P
1


)


(


d

(

A


P
1


)


+

X
1

(

A


P
1


)



)






(
4
)







In a formula, θt0(AP1) to represents an initial clock offset of node P1 relative to reference node A at time t0; ρ(AP1) represents a clock frequency offset of node P1 relative to reference node A; d(AP1) represents fixed time delay generated in a process of receiving and sending time information, with a value range of 1 ms-10 ms. X1(AP1) represents random time delay generated in the process of receiving and sending time information; ρ(AP1) (d(AP1)+X1(AP1)) represents a synchronization error accumulated due to frequency offset in the process of receiving and sending time information;


Further, in the first synchronization cycle of node A and node P1, a difference ΔT1(AP1) of receiving and sending timestamps between node A and node P1 to be synchronized is represented as:










Δ


T
1

(

AP
1

)



=



T

2
,

1


(

P
1

)


-

T

1
,

1


(
A
)


-

d

(

AP
1

)



=


θ

t

0


(

Ap
1

)


+


ρ

(

AP
1

)


(


T

1
,

1


(
A
)


-

t
0


)

+

X
1

(

AP
1

)


+


ρ

(

AP
1

)


(


d

(

AP
1

)


(


d

(

AP
1

)


+

X
1

(

AP
1

)



)








(
5
)







T5,1(P1) is correction time of the first cycle of P1; then, node P1 uses the difference ΔT1(AP1) to adjust the own local clock at time T5,1(P1) and time adjusted by P1 is represented by T5,1(P1)*, and there is










T

5
,

1



(

P
1

)

*


=



T

5
,

1


(

P
1

)


+

Δ


T
1

(

A


P
1


)




=


T

5
,

1


(

P
1

)


+

T

2
,

1


(

P
1

)


-

T

1
,

1


(
A
)


-

d

(

AP
1

)








(
6
)







In a period from initial time t0 to the correction time T5,1(P1), a real clock deviation ΔTtrue,1(AP1) between node A and node P1 is:










Δ


T

true
,

1


(

A


P
1


)



=


θ

t

0


(

A


P
1


)


+


ρ

(

A


P
1


)


(


T

5
,

1


(

P
1

)


-

t
0


)






(
7
)







From formulas (7)-(5), a new clock offset θt1(AP1) of node P1 after adjustment is obtained as:










θ

t

1


(

A


P
1


)


=



Δ


T

true
,

1


(

A


P
1


)



-

Δ


T
1

(

A


P
1


)




=



ρ

(

AP
1

)


(


T

5
,

1


(

P
1

)


-

T

1
,

1


(
A
)


-

d

(

AP
1

)


-

X
1

(

AP
1

)



)

-

X
1

(

A


P
1


)








(
8
)







In a second synchronization cycle between node A and node P1, node A sends current time information T1,2(A) to node P1, and receiving time T2,2(P1) recorded by node P1 is represented as:










T

2
,

2


(

P
1

)


=


T

1
,

2


(
A
)


+

θ

t

1


(

A


P
1


)


+


ρ

(

AP
1

)


(


T

1
,

2


(
A
)


-

T

5
,

1



(

P
1

)

*



)

+

d

(

AP
1

)


+

X
2

(

A


P
1


)


+


ρ

(

A


P
1


)


(


d

(

A


P
1


)


+

X
2

(

A


P
1


)



)






(
9
)







where X2(AP1) is random time delay generated in a process of receiving and sending time information of the second synchronization cycle between node A and node P1.


Further, in the second synchronization cycle of node A and node P1, a difference ΔT2(AP1) of receiving and sending timestamps between reference node A and node P1 is represented as:










Δ


T
2

(

A


P
1


)



=



T

2
,

2


(

P
1

)


-

T

1
,

2


(
A
)


-

d

(

AP
1

)



=


θ

t

1


(

A


P
1


)


+


ρ

(

AP
1

)


(


T

1
,

2


(
A
)


-

T

5
,

1



(

P
1

)

*



)

+

X
2

(

A


P
1


)


+


ρ

(

A


P
1


)


(


d

(

A


P
1


)


+

X
2

(

A


P
1


)



)







(
10
)







Time of P1 after adjustment in the first synchronization cycle is set as T5,1(P1)*, and time of node A, corresponding to the time, is T5,1(A)*; at this moment, because node P1 just adjusts local time and time of node A is close to time of node P1, T5,1(P1)*=T5,1(A) is set; formula (10) is changed as:










Δ


T
2

(

A


P
1


)



=


θ

t

1


(

A


P
1


)


+


ρ

(

AP
1

)


(


T

1
,
2


(
A
)


-

T

5
,
1



(
A
)

*



)

+

X
2

(

A


P
1


)


+


ρ

(


AP


1

)


(


d

(

AP
1

)


+

X
2

(

A


P
1


)



)






(
11
)







θt1(AP1) and T5,1(A) are substituted into formula (11) to obtain:










Δ


T
2

(

A


P
1


)



=



ρ

(

AP
1

)


(


T

1
,
2


(
A
)


-

X
1

(

AP
1

)


+

X
2

(

AP
1

)


-

T

2
,
1


(

P
1

)


+

d

(

AP
1

)



)

-

X
1

(

A


P
1


)


+

X
2

(

A


P
1


)







(
12
)







In a period from T5,1(P1)* to T5,2(P1) (i.e., in the second synchronization cycle between node A and node P1), a real clock deviation ΔTtrue,2(AP1) between node A and node P1 is:










Δ


T

true
,
2


(

A


P
1


)



=


θ

t

1


(

A


P
1


)


+


ρ

(

A


P
1


)


(


T

5
,
2


(

P
1

)


-

T

5
,
1



(

P
1

)

*



)






(
13
)









    • where T5,2(P1) is correction time of P1 in the second cycle of node A and node P1.





From formulas (13)-(12), a new clock offset θt2(AP1) of node P1 after second adjustment is obtained as:










θ

t

2


(

A


P
1


)


=



Δ


T

true
,
2


(

A


P
1


)



-

Δ


T
2

(

A


P
1


)




=



ρ

(

A

P

)


(


T

5
,
2


(

P
1

)


-

T

1
,
2


(
A
)


-

d

(

AP
1

)


-

X
2

(

AP
1

)



)

-

X
2

(

A


P
1


)








(
14
)







In an ith synchronization cycle of node A and node P1, a difference ΔTi(AP1) of receiving and sending timestamps between reference node A and node P1 is obtained as:










Δ


T
i

(

A


P
1


)



=



ρ

(

A


P
1


)


(


T

1
,
i


(
A
)


-

X

i
-
1


(

AP
1

)


+

X
i

(

AP
1

)


-

T

2
,

i
-
1



(

P
1

)


+

d

(

AP
1

)



)

-

X

i
-
1


(

A


P
1


)


+

X
i

(

A


P
1


)







(
15
)







where Xi(AP1) is random time delay generated in a process of receiving and sending time information of the ith cycle between node A and node P1.


A new clock offset θti(AP1) of node P1 after ith adjustment is:










θ

t

i


(

A


P
1


)


=



Δ


T

true
,
i


(

A


P
1


)



-

Δ


T
i

(

A


P
1


)




=



ρ

(

AP
1

)


(


T

5
,
i


(

P
1

)


-

T

1
,
i


(
A
)


-

d

(

AP
1

)


-

X
i

(

AP
1

)



)

-

X
i

(

A


P
1


)








(
16
)







To simplify calculation, formula (15) is transformed into the following expression:










Δ


T
i

(

AP
1

)



=



ρ

(

AP
1

)


(


T

1
,
i


(
A
)


-

T

2
,

i
-
1



(

P
1

)


-

d

(

AP
1

)



)

+


(

1
+

ρ

(

AP
1

)



)



(


X
i

(

AP
1

)


-

X

i
-
1


(

AP
1

)



)







(
17
)







Qi=Xi(AP1)−Xi-1(AP1) is made; because random time delay Xi(AP1) and Xi-1(AP1) can be regarded as random variables which have the same average and obey Gaussian distribution, it is easy to know that Qi is also a random variable which obeys Gaussian distribution, i.e., Qi˜(0,δ2); frequency offset ρ(AP1) is estimated by using a maximum likelihood estimation method; and a log-likelihood function of formula (17) based on observed quantity {T2,i(P1),T1,i(A),d(AP1)}i=1N is represented as:










ln

L

(


ρ

(

A


P
1


)


,

δ
2


)


=



-

N
2




ln

(

2


πδ
2


)



-


1

2


δ
2








Σ



i
=
1

N

[



T

2
,
i


(

P
1

)


-

T

1
,
i


(
A
)


-

d

(

AP
1

)


-


ρ

(

AP
1

)


(


T

1
,
i


(
A
)


-

T

2
,

i
-
1



(

P
1

)



)



1
+

ρ

(

A


P
1


)




]

2







(
18
)







A partial derivative of ρ(AP1) is calculated and made as 0:










ln

L

(


ρ

(

A


P
1


)


,

δ
2


)






ρ

(

A


P
1


)




=












i
=
1

N

[

(


T

2
,
i


(

P
1

)


-

T

1
,
i


(
A
)


-

d

(

AP
1

)


-


ρ

(

AP
1

)




(


T

1
,
i


(
A
)


-

T

2
,

i
-
1



(

P
1

)



)



)








(


T

2
,
i


(

P
1

)


-

T

2
,

i
-
1



(

P
1

)


-

d

(

AP
1

)



)

]






(

1
+

ρ

(

A


P
1


)



)

3


=
0





A solution is obtained as:










ρ

(

A


P
1


)


=




Σ



t
=
1

N



(


T

2
,
i


(

P
1

)


-

T

1
,
i


(
A
)


-

d

(

A


P
1


)



)



(


T

2
,
i


(

P
1

)


-

T

2
,

i
-
1



(

P
1

)


-

d

(

A


P
1


)



)





Σ



i
=
1

N



(


T

1
,
i


(
A
)


-

T

2
,

i
-
1



(

P
1

)



)



(


T

2
,
i


(

P
1

)


-

T

2
,
i


(

P
1

)


-

T

2
,

i
-
1



(

P
1

)


-

d

(

AP
1

)



)







(
19
)







P1 only needs to obtain parameters in formula (19) to estimate ρ(AP1) By selecting appropriate d(AP1) value, ρ(AP1) can be adjusted so that frequencies of node P1 and node A are gradually close, to complete time synchronization of P1 and A.


Further, in step S3, first-layer node P1 and second-layer node P2 are included. After node P1 receives the time information from reference node A, a reference node as node P2 after adjustment of an own local clock is calculated according to timestamps. Similarly, node P2 uses node P1 as the reference node, and node P1 sends the time information to node P2;


In the first synchronization cycle between node P1 and node P2, node P1 sends current time information T1,1(P1) to node P2, and time when node P2 receives the time information sent by node P1 is denoted as T2,1(P2), which is represented as:










T

2
,
1


(

P
2

)


=


T

1
,
1


(

P
1

)


+

θ

t

0



(


P
1



P
2


)


+


ρ

(


P
1



P
2


)


(


T

1
,
1


(

P
1

)


-

t
0


)

+

d

(


P
1



P
2


)


+

X
1

(


P
1



P
2


)


+


ρ

(


P
1



P
2


)


(


d

(


P
1



P
2


)


+

X
1

(


P
1



P
2


)



)






(
20
)







In a formula, θt0(P1P2) represents an initial clock offset of node P2 at time to relative to reference node P1; ρ(P1P2) represents a clock frequency offset of node P2 relative to reference node P1; d(P1P2) represents fixed time delay generated in a process of receiving and sending time information, with a value range of 1 ms-10 ms. X1(P1P2) represents random time delay generated in the process of receiving and sending time information; ρ(P1P2) (d(P1P2)+X1(P1P2)) represents a synchronization error accumulated due to frequency offset in the process of receiving and sending time information;


In the first synchronization cycle of node P1 and node P2, a difference ΔT1(P1P2) of receiving and sending timestamps between node P1 and node P2 is:










Δ


T
1

(


P
1



P
2


)



=



T

2
,
1


(

P
2

)


-

T

1
,
1


(

P
1

)


-

d

(


P
1



P
2


)



=


θ

t

0


(


P
1



P
2


)


+


ρ

(


P
1



P
2


)


(


T

1
,
1


(

P
1

)


-

t
0


)

+

X
1

(


P
1



P
2


)


+


ρ

(


P
1



P
2


)


(


d

(


P
1



P
2


)


+

X
1

(


P
1



P
2


)



)







(
21
)







T5,1(P2) is correction time of P2 in the first synchronization cycle of node P1 and node P2; then, node P2 uses the difference ΔT1(P1P2) of the timestamps to adjust the local clock at time T5,1(P2) and adjusted local time is represented by T5,1(P2)*, and there is T5,1(P2)*=T5,1(P2)+ΔT1(P1P2);


In a period from the initial time to the correction time, a real clock deviation ΔTtrue,1(P1P2) between node P1 and node P2 is:










Δ


T

true
,
1


(


P
1



P
2


)



=


θ

t

0


(


P
1



P
2


)


+


ρ

(


P
1



P
2


)


(


T

5
,
1


(

P
2

)


-

t
0


)






(
22
)







From formulas (22)-(21), a new clock offset θt1(P1P2) of node P2 after adjustment in the first synchronization cycle of node P1 and node P2 is:










θ

t

1


(


P
1



P
2


)


=



Δ


T

true
,
1


(


P
1



P
2


)



-

Δ


T
1

(


P
1



P
2


)




=



ρ

(


P
1



P
2


)




(


T

5
,
1


(

P
2

)


-

T

1
,
1


(

P
1

)


-

d

(


P
1



P
2


)


-

X
1

(


P
1



P
2


)



)


-

X
1

(


P
1



P
2


)








(
23
)







In the second synchronization cycle between node P1 and node P2, reference node P1 needs to use a difference ΔT1(AP1) of the receiving and sending timestamps of node A and node P1 in the first synchronization cycle to correct an own local clock in each cycle, so for nodes P2 and P1, a difference ΔT2(P1P2) of the receiving and sending timestamps in the second synchronization cycle is represented as:











T

2
,
2


(

P
2

)


-

T

1
,
2


(

P
1

)


-

d

(


P
1



P
2


)


+

Δ


T
1

(

AP
1

)




=


θ

t

1


(


P
1



P
2


)


+


ρ

(


P
1



P
2


)


(


T

1
,
2


(

P
1

)


-

T

5
,
1



(

P
2

)

*



)

+

X
2

(


P
1



P
2


)


+


ρ

(


P
1



P
2


)


(


d

(


P
1



P
2


)


+

X
2

(


P
1



P
2


)



)






(
24
)









    • where T1,2(P1) is sending time when node P1 sends a synchronization message to node P2 in the second synchronization cycle between node P1 and node P2; T2,2(P2) is receiving time when node P2 receives the synchronization message in the second synchronization cycle between node P1 and node P2; X2(P1P2) is random time delay generated in a process of receiving and sending time information of the second synchronization cycle between node P1 and node P2;

    • θt1(P1P2) and T5,1(P2)* are substituted into formula (24) to obtain a difference ΔT2(P1P2) of receiving and sending timestamps between node P1 and node P2 in the second synchronization cycle of node P1 and node P2:













Δ


T
2

(


P
1



P
2


)



=




T

2
,
2



(

P
2

)


-


T

1
,
2



(

P
1

)


-

d

(


P
1



P
2


)



=



ρ

(


P
1



P
2


)


(



T

1
,
2



(

P
1

)


-


T

2
,
1



(

P
2

)


-


X
1


(


P
1



P
2


)


+


X
2


(


P
1



P
2


)


+

d

(


P
1



P
2


)



)

-


X
1


(


P
1



P
2


)


+


X
2


(


P
1



P
2


)


-

(


T

2
,
1


(

P
1

)


-

T

1
,
1


(
A
)


-

d

(

AP
1

)



)







(
25
)







where T2,1(P2) represents receiving time when node P2 receives time information sent by node P1 in the first synchronization cycle between node P1 and node P2; T2,1(P1) represents receiving time when node P1 receives time information sent by node A in the first synchronization cycle between node A and node P1; T1,1(A) represents sending time when node A sends a time message to node P1 in the first synchronization cycle between node A and node P1.


T5,2(P2) is correction time of P2 in the second cycle of node P1 and node P2; then, node P2 uses the difference ΔT2(P1P2) of the timestamps to adjust the local clock at time T5,2(P2) and adjusted time is represented by T5,2(P2), and there is T5,2(P2)*=T5,2(P2)+ΔT2(P1P2).


In the first synchronization cycle of node P1 and node P2, adjusted time of node P2 at time T5,1(P2) is T5,1(P2)*; in a period from time corresponding to this time to corresponding time T5,2(P2), a real clock deviation ΔTtrue,2(P1P2) of node P2 compared with P1 is:










Δ


T

true
,
2


(


P
1



P
2


)



=


θ

t

1


(


P
1



P
2


)


+


ρ

(


P
1



P
2


)


(



T

5
,
2



(

P
2

)


-


T

5
,
1




(

P
2

)

*



)






(
26
)







From formulas (26)-(25), a clock offset θt2(P1P2) of node P2 after adjustment in the second synchronization cycle of node P1 and node P2 is:










θ

t

2


(


P
1



P
2


)


=



Δ


T

true
,
2


(


P
1



P
2


)



-

Δ


T
2

(


P
1



P
2


)




=



ρ

(


P
1



P
2


)


(



T

5
,
2



(

P
2

)


-


T

1
,
2



(

P
1

)


-


X
2


(


P
1



P
2


)


-

d

(


P
1



P
2


)



)

-


X
2


(


P
1



P
2


)


-

Δ



T

(

AP
1

)


1








(
27
)







where T1,2(P1) is sending time when node P1 sends a synchronization message to node P2 in the second synchronization cycle between node P1 and node P2; ΔT1(AP1) represents a difference of the receiving and sending timestamps between node A and node P1 in the first synchronization cycle between node A and node P1.


In a third synchronization cycle between node P1 and node P2, reference node P1 needs to use a difference ΔT2(AP1) of the receiving and sending timestamps of node A and node P1 in the second synchronization cycle to correct an own local clock in each cycle, so for nodes P2 and P1, a difference ΔT3(P1P2) of the receiving and sending timestamps in the third synchronization cycle between node P1 and node P2 is represented as:












T

2
,
3



(

P
2

)


-


T

1
,
3



(

P
1

)


-

d

(


P
1



P
2


)


+

Δ


T
2

(

AP
1

)




=


θ

t

2


(


P
1



P
2


)


+


ρ

(


P
1



P
2


)


(



T

1
,
3



(

P
1

)


-


T

5
,
2




(

P
2

)

*



)

+


X
3


(


P
1



P
2


)


+


ρ

(


P
1



P
2


)


(


d

(


P
1



P
2


)


+


X
3


(


P
1



P
2


)



)






(
28
)







θt2(P1P2) and T5,2(P2)* are substituted into formula (28) to obtain a difference ΔT3(P1P2) of receiving and sending timestamps between node P1 and node P2 in the third synchronization cycle of node P1 and node P2:










Δ


T
3

(


P
1



P
2


)



=




T

2
,
3



(

P
2

)


-


T

1
,
3



(

P
1

)


-

d

(


P
1



P
2


)



=



ρ

(


P
1



P
2


)


(



T

1
,
3



(

P
1

)


-


T

2
,
2



(

P
2

)


-


X
2


(


P
1



P
2


)


+


X
3


(


P
1



P
2


)


+

d

(


P
1



P
2


)



)

-


X
2


(


P
1



P
2


)


+


X
3


(


P
1



P
2


)


-

[


(


T

2
,
2


(

P
1

)


-

T

1
,
2


(
A
)


-

d

(

AP
1

)



)

-

(


T

2
,
1


(

P
1

)


-

T

1
,
1


(
A
)


-

d

(

AP
1

)



)


]







(
29
)









    • where T2,2(P2) represents receiving time when node P2 receives time information sent by node P1 in the second synchronization cycle between node P1 and node P2; T2,2(P1) represents receiving time when node P1 receives time information sent by node A in the second synchronization cycle between node A and node P1; T1,2(A) represents sending time when node A sends a time message to node P1 in the second synchronization cycle between node A and node P1; T2,1(P1) represents receiving time when node P1 receives time information sent by node A in the first synchronization cycle between node A and node P1; T1,1(A) represents sending time when node A sends a time message to node P1 in the first synchronization cycle between node A and node P1.





For the ith synchronization cycle between node P1 and node P2, reference node P1 needs to use a difference ΔTi(AP1) of the receiving and sending timestamps of node A and node P1 in the ith synchronization cycle to correct an own local clock in each cycle, so for nodes P2 and P1, a difference ΔTi((P1P2) of the receiving and sending timestamps in the ith synchronization cycle is represented as:










Δ


T
i

(


P
1



P
2


)



=



ρ

(


P
1



P
2


)


(



T

1
,
i



(

P
1

)


-


T

2
,

i
-
1




(

P
2

)


-


X

i
-
1



(


P
1



P
2


)


+


X
i


(


P
1



P
2


)


+

d

(


P
1



P
2


)



)

-


X

i
-
1



(


P
1



P
2


)


+


X
i


(


P
1



P
2


)


-

[


(



T

2
,

i
-
1




(

P
1

)


-

T

1
,

i
-
1



(
A
)



)

-







j
=
1

i



(



T

2
,

i
-
j
-
1




(

P
1

)


-

T

1
,

i
-
j
-
1



(
A
)



)



]

+


(

i
-
3

)



d

(


P
1



P
2


)








(
30
)










ϵ
i

=


[


(



T

2
,

i
-
1




(

P
1

)


-

T

1
,

i
-
1



(
A
)



)

-







j
=
1

i



(



T

2
,

i
-
j
-
1




(

P
1

)


-

T

1
,

i
-
j
-
1



(
A
)



)



]

+


(

i
-
3

)



d

(


P
1



P
2


)








is set;

    • where T1,i(P1) is represented as sending time when node P1 sends a synchronization message to node P2 in the ith synchronization cycle between node P1 and node P2; T2,i-1(P2) represents receiving time when node P2 receives time information sent by node P1 in an i−1th synchronization cycle between node P1 and node P2; Xi(P1P2) represents random time delay generated in a process of receiving and sending time information of the ith synchronization cycle between node P1 and node P2; T2,i-1(P1) represents receiving time when node P1 receives time information sent by node A in the i−1th synchronization cycle between node A and node P1; T1,i-1(A) represents sending time when node A sends a time message to node P1 in the i−1th synchronization cycle between node A and node P1; T2,i-j-1(P1) represents sending time when node P1 sends a synchronization message to node P2 in an i−j−1th synchronization cycle between node P1 and node P2; T1,i-j-1(A) represents sending time when node A sends a time message to node P1 in the i−j−1th synchronization cycle between node A and node P1.


Frequency offset ρ(P1P2) is estimated by using the maximum likelihood estimation method; and a log-likelihood function of formula (30) based on observed quantity {T2,i(P2),T1,i(P1),d(P1P2)}i=1N represented as:










ln

L

(


ρ


(


P
1



P
2


)

,




δ
2


)


=



-

N
2



ln

-

(

4

π


δ
2


)

-


1

2


δ
2











i

=
1

N

[






(



T

2
,
i



(

P
2

)


-


T

1
,
i



(

P
1

)


-

d

(


P
1



P
2


)



)

-








ρ

(


P
1



P
2


)




(



T

1
,
i



(

P
1

)


-


T

2
,

i
-
1




(

P
2

)


-

d

(


P
1



P
2


)



)


+

ϵ
i






1
+

ρ

(


P
1



P
2


)




]







(
31
)







Partial derivatives of ρ(P1P2) on both sides of formula (31) are:













ln

L

(


ρ


(


P
1



P
2


)

,




δ
2


)






ρ

(


P
1



P
2


)




=












i
=
1

N

[


(



T

2
,
i



(

P
2

)


-


T

1
,
i



(

P
1

)


-

d

(


P
1



P
2


)



)

-









ρ

(


P
1



P
2


)




(



T

1
,
i



(

P
1

)


-


T

2
,

i
-
1




(

P
2

)


-

d

(


P
1



P
2


)



)


+

ϵ
i






(

1
+

ρ

(

AP
1

)



)


×










(



T

2
,

i
-
1




(

P
2

)


-


T

1
,
i



(

P
1

)


+

d

(


P
1



P
2


)



)



(

1
+

ρ

(


P
1



P
2


)



)


-

(



T

2
,
i



(

P
2

)


-










[



T

1
,
i



(

P
1

)


-

d

(


P
1



P
2


)




)

-


ρ

(


P
1



P
2


)


(



T

1
,
i



(

P
1

)


-


T

2
,

i
-
1




(

P
2

)


-














d

(


P
1



P
2


)


)



ϵ
i


]






(

1
+

ρ

(


P
1



P
2


)



)

2







(
32
)







Formula (32) is made to be equal to 0, and a solution is:










ρ

(


P
1



P
2


)


=











i
=
1

N

[


(



T

2
,
i



(

P
2

)


-


T

1
,
i



(

P
1

)


-

d

(


P
1



P
2


)



)



(



T

2
,
i



(

P
2

)


-


T

2
,

i
-
1




(

P
2

)


-












2


d

(


P
1



P
2


)



+

2


ϵ
i



)

-

(



T

2
,

i
-
1




(

P
2

)


-


T

1
,
i



(

P
1

)


-

d

(


P
1



P
2


)



)

+

ϵ
i

+


ϵ
i

2


















i
=
1

N

[


(



T

2
,
i



(

P
2

)


-


T

1
,
i



(

P
1

)


-

d

(


P
1



P
2


)



)



(



T

2
,

i
-
1




(

P
2

)


-

2



T

1
,
i



(

P
1

)



+












T

2
,
i



(

P
2

)


)

+


(



T

1
,
i



(

P
1

)


-


T

2
,

i
-
1




(

P
2

)


-

d

(


P
1



P
2


)



)



(



T

2
,
i



(

P
2

)


-

















T

2
,

i
-
1




(

P
2

)


+

ϵ
i


)

]

.









(
33
)







P2 only needs to obtain parameters in formula (33) to estimate ρ(P1P2) By selecting appropriate d(P1P2) value, ρ(P1P2) can be adjusted so that frequencies of node P2 and node P1 are gradually close, to complete time synchronization of P2 and P1.


Further, in step S4, the node device of the industrial wireless network is used as the master clock, denoted as M; the terminal side conversion node is used as the slave clock, denoted as S; node S periodically sends ordinary data packets to node M; and synchronization information is transferred implicitly by controlling a response time interval Δi of a receiver for a sender;


In the ith cycle, sending node S sends an ordinary data packet to receiving node M at time T1,i(S), and receiving node M receives the data packet at time T2,1(M)k after waiting for the response time interval Δi, a response message is returned to sending node S at time T3,1(M) and sending node S receives the response message at time T4,i(S); then local receiving and sending time is recorded and stored in a local cache; with repeated processes of receiving and sending node data packets, the node can use the receiving and sending time of the local cache to estimate the clock frequency offset.


Further, number of time synchronizations in step S4 is set as N; there is A ∈{2,3,4, . . . N−1}; any of prime numbers P, Q and D is taken, where N=P*Q; when (D*E)mod((P−1)*(Q−1))=1 is established, there is Ci=(Ai EXP D) mod N; where 1<i<N; Ci is a generated random number; meanwhile, Ci is used to represent a response time interval Δi that a receiving node needs to wait for in an ith synchronization process. It is noted that according to the principle of the RSA algorithm, although synchronization is conducted for N times, a response time interval Δi in N−2 synchronization processes can only be obtained. When N is large enough, N−2 times of synchronization and N times of synchronization can be regarded as the same.


fS and fM are set as crystal oscillator frequencies of node S and node M respectively, and a clock frequency offset







ρ

(
MS
)


=


f
M


f

s






of node S relative to node M is defined;


In the first synchronization cycle, when node S sends an ordinary data packet to node M at time T1,1(S), time T2,1(M) when node M receives the data packet is represented as a formula below:










T

2
,
1


(
M
)


=



ρ

(
MS
)


×

T

1
,
1


(
S
)



+

θ

t
0


+


ρ

(
MS
)


×

(


d
1

+

X
1


)







(
34
)









    • where θto represents an initial clock offset of node S relative to node M; d1 represents fixed time delay generated in a process of receiving and sending the data packets; X1 represents random time delay generated in the process of receiving and sending the data packets;

    • Time T3,1(M) when node M sends a response message can be obtained according to an RSA algorithm, i.e., T3,1(M)=T2,1(M)2; time when node S receives the response message sent by node M is denoted as T4,1(S), then:













T

3
,
1


(
M
)


=



ρ

(
MS
)


×

T

4
,
1


(
S
)



+

θ

t
0


-


ρ

(
MS
)


×

(


d
2

+

Y
1


)







(
35
)









    • where d2 is fixed time delay of the response message in transmission, and d2=d1−m; here, the size of m is in direct proportion to a difference between length of uplink data packet messages and length of downlink response messages; Y1 is downlink random time delay in the first synchronization cycle;





In the second synchronization cycle, node S sends an ordinary data packet to node M at time T1,2(S), and node M receives the data packet at time T2,2(M); a value of the response time interval Δ2 in the second synchronization cycle is obtained according to the RSA algorithm; at this moment, time when node M sends a response message is T3,2(M)=T2,2(M)2, and then:










T

3
,
2


(
M
)


=



ρ

(
MS
)


×

T

4
,
2


(
S
)



+

θ

t
0


-


ρ

(
MS
)


×

(


d
2

+

Y
2


)







(
36
)









    • where d2 is fixed time delay generated by the data packets in a process of receiving and sending the data packets in the second synchronization cycle; and Y2 is downlink random time delay in the second synchronization cycle;





In the third synchronization cycle, node S sends an ordinary data packet to node M at time T1,3(S), and node M receives the data packet at time T2,3(M); a value of the response time interval Δ3 in the third synchronization cycle is obtained according to the RSA algorithm; at this moment, time when node M sends a response message is T3,3(M)=T2,3(M)3, and then:










T

3
,
3


(
M
)


=



ρ

(
MS
)


×

T

4
,
3


(
S
)



+

θ

t
0


-


ρ

(
MS
)


×

(


d
2

+

Y
3


)







(
37
)









    • where Y3 represents downlink random time delay in the third synchronization cycle;





In the 7th synchronization cycle, node S sends an ordinary data packet to node M at time T1,i(S), and node M receives the data packet at time T2,i(M); a value of the response time interval Δi in the ith cycle can be obtained according to the RSA algorithm; at this moment, time when node M sends a response message is T3,i(M); node S receives the response message returned by node M at time T4,i(S). The following can be obtained:










T

2
,
i


(
M
)


=



ρ

(
MS
)


×

T

1
,
i


(
S
)



+

θ

t
0


+


ρ

(
MS
)


×

(


d
1

+

X
i


)







(
38
)













T

3
,
i


(
M
)


=



ρ

(
MS
)


×

T

4
,
i


(
S
)



+

θ

t
0


-


ρ

(
MS
)


×

(


d
2

+

Y
i


)







(
39
)













Δ
i



(



Δ

2
,




Δ
3


,


,

Δ

N
-
1



)





(
40
)













T

3
,
i


(
M
)


=


T

2
,
i


(
M
)


+

Δ
i






(
41
)









    • where Xi represents random time delay generated in the process of receiving and sending the data packets in the ith cycle; and Yi represents downlink random time delay in the ith cycle.





After N−1 synchronization cycles, sending node S obtains a set of local timestamp pairs {T1,i(S),T4,i(S)}i=2N-1, and receiving node M obtains a set of local timestamp pairs {T2,i(M),T3,i(M)}i=2N-1; combined with the response time interval Δi, the maximum likelihood estimation method is used to estimate frequency offset and fixed delay between nodes;


Formulas (39)-(38) are used to obtain:











T

3
,
i


(
M
)


-

T

2
,
i


(
M
)



=


ρ

(
MS
)


[


T

4
,
i


(
S
)


-

T

1
,
i


(
S
)


-

(


d
1

+

d
2


)

-

(


X
i

+

Y
i


)


]





(
42
)







Because Xi and Yi are Gaussian random distributions with mean of 0 and variance of σ2 and Vi=Xi+Yi is made, Vi is Gaussian random distribution with mean of 0 and variance of 2σ2 and






α
=

1

ρ

(
MS
)







is made; then formula (42) is simplified as:










α

(


T

3
,
i


(
M
)


-

T

2
,
i


(
M
)



)

=


(


T

4
,
i


(
S
)


-

T

1
,
i


(
S
)



)

-

2


d
1


+
m
-

V
i






(
43
)









    • where T3,i(M)−T2,i(M)i, and then formula (43) is expressed as a matrix form below:













[





T

4
,
2


-

T

1
,
2


+
m







T

4
,
3


-

T

1
,
3


+
m












T

4
,

N
-
1



-

T

1
,

N
-
1



+
m




]

=



[





T

3
,
2


-

T

2
,
2





2






T

3
,
3


-

T

2
,
3





2







2






T

3
,

N
-
1



-

T

2
,

N
-
1






2



]

[



α





d
1




]

+

[




V
2






V
3











V

N
-
1





]






(
44
)







A maximum likelihood function of formula (44) about parameters (α,d12) is expressed as:










L

(

α
,


d
1



σ
2



)

=



(

2

π
×
2


σ
2


)


-


N
-
1

2




exp


{


-

1

2
×
2


σ
2













i
=
2


i
=

N
-
1



[


(


T

4
,
i


(
S
)


-

T

1
,
i


(
S
)



)

-

α


Δ
i


-

2


d
1


+
m

]

2


}






(
45
)







Logarithms of both sides of formula (45) are calculated to obtain:










ln


L

(

α
,


d
1



σ
2



)


=



-


N
-
1

2




ln

(

4

π


σ
2


)


-


1

4


σ
2












i
=
2


N
-
1


[


(


T

4
,
i


(
S
)


-

T

1
,
i


(
S
)



)

-

α


Δ
i


-

2


d
1


+
m

]

2







(
46
)







A first-order partial derivative about α for formula (46) is calculated to obtain:













ln



L

(

α
,

d
1

,

σ
2


)




α


=


1

2


σ
2











i
=
2


N
-
1


[


(


T

4
,
i


(
S
)


-

T

1
,
i


(
S
)


-

α


Δ
i


-

2


d
1


+
m

)



Δ
i


]






(
47
)







A first-order partial derivative about d1 for formula (46) is calculated to obtain:













ln



L

(

α
,

d
1

,

σ
2


)





d
1



=


1

σ
2









i
=
2


N
-
1




(


T

4
,
i


(
S
)


-

T

1
,
i


(
S
)


-

α


Δ
i


-

2


d
1


+
m

)






(
48
)







Formula (47) and formula (48) are made as 0, and maximum likelihood functions of ρ(MS) and d1 can be obtained by simultaneous solution:










ρ

(

M

S

)


=


1
α

=




(

N
-
2

)








t
=
2


N
-
1




Δ

t
2



-


(







t
=
2


N
-
1




Δ
t


)

2








(

N
-
2

)









t
=
2


N
-
1


[


(


T

4.
i


(
S
)


-

T

1.
i


(
S
)


+
m

)



Δ
i


]


-












J
=
2


N
-
1




(


τ

4.
i


(
S
)


-

τ

1.
i


(
S
)


+
m

)








t
=
2


N
-
1




Δ
i











(
49
)













d
1

=












i
=
2


N
-
1




Δ

i
2









i
=
2


N
-
1




(


T

4

i


(
S
)


-

T

1

i


(
S
)


+
m

)


-













i
=
2


N
-
1


[


(


T

4

i


(
S
)


-

T

1

i


(
S
)


+
m

)



Δ
i


]








t
=
2


N
-
1




Δ
i






2
[



(

N
-
2

)








i
=
2


N
-
1




Δ
i
2


-


(







i
=
2


N
-
1




Δ
i


)

2


]






(
50
)







Thus, the fixed time delay of the response message in transmission is d2=d1−m.


After the terminal side conversion node and the node device of the industrial wireless network complete synchronization, the TSN switch of the TSN 1 completes synchronization with the terminal side conversion node in the slave clock state, and a synchronization method is consistent with step S1.


The present invention has the following beneficial effects: in the method, the time synchronization information is extended from a two-level network to a three-level network in the wireless network; time adjustment of a first-level node after each synchronization cycle should consider the correction quantity of an upper-level node; in addition, the influence of fixed delay is added to the traditional correction quantity; and at the same time, it is not necessary to estimate frequency offset and clock offset jointly, but only needs to estimate the frequency offset separately, which can realize synchronization with multi-level nodes of the network, thereby reducing algorithm complexity while optimizing the correction quantity. At the same time, the present invention transfers the synchronization information level by level from the master clock of the convergence network to the slave clock through the industrial wireless network by means of multi-level forwarding of the time synchronization information, so as to complete the cross-network time synchronization between the industrial wireless network and the TSN.


Other advantages, objectives and features of the present invention will be illustrated in the following description to some extent, and will be apparent to those skilled in the art based on the following investigation and research to some extent, or can be taught from the practice of the present invention. The objectives and other advantages of the present invention can be realized and obtained through the following description.





DESCRIPTION OF THE DRAWINGS

To enable the purpose, the technical solution and the advantages of the present invention to be more clear, the present invention will be preferably described in detail below in combination with the drawings, wherein:



FIG. 1 is a cross-network architecture diagram of industrial wireless network and TSN fusion in the present invention;



FIG. 2 is a schematic diagram of a cross-network time synchronization method;



FIG. 3 is a flow chart of TSN synchronization;



FIG. 4 is a diagram of a peer-to-peer delay measurement mechanism;



FIG. 5 is a structural schematic diagram of a border gateway;



FIG. 6 is a flow chart of correction type time synchronization message interaction; and



FIG. 7 is a timestamp-free synchronization protocol based on RSA algorithm.





DETAILED DESCRIPTION OF THE INVENTION

Embodiments of the present invention are described below through specific embodiments. Those skilled in the art can understand other advantages and effects of the present invention easily through the disclosure of the description. The present invention can also be implemented or applied through additional different specific embodiments. All details in the description can be modified or changed based on different perspectives and applications without departing from the spirit of the present invention. It should be noted that the figures provided in the following embodiments only exemplarily explain the basic conception of the present invention, and if there is no conflict, the following embodiments and the features in the embodiments can be mutually combined.


Wherein the drawings are only used for exemplary description, are only schematic diagrams rather than physical diagrams, and shall not be understood as a limitation to the present invention. In order to better illustrate the embodiments of the present invention, some components in the drawings may be omitted, scaled up or scaled down, and do not reflect actual product sizes. It should be understandable for those skilled in the art that some well-known structures and description thereof in the drawings may be omitted.


Same or similar reference numerals in the drawings of the embodiments of the present invention refer to same or similar components. It should be understood in the description of the present invention that terms such as “upper”, “lower”, “left”, “right”, “front” and “back” indicate direction or position relationships shown based on the drawings, and are only intended to facilitate the description of the present invention and the simplification of the description rather than to indicate or imply that the indicated device or element must have a specific direction or constructed and operated in a specific direction, and therefore, the terms describing position relationships in the drawings are only used for exemplary description and shall not be understood as a limitation to the present invention; for those ordinary skilled in the art, the meanings of the above terms may be understood according to specific conditions.


With the continuous fusion and development of industrialization and informatization, in actual factory networks, most of the networks are formed by fusion of wired and wireless networks. In this heterogeneous network, the network requires devices between different networks to have strong time sequence constraint relationships during data fusion, energy management and deterministic scheduling. As shown in FIG. 1, the solution innovatively proposes a cross-network architecture for industrial wireless network and TSN fusion. The architecture conducts TSN processing for both ends of an industrial wireless network, and is comprised of two TSNs, an industrial wireless network, a border gateway and a terminal side conversion node, wherein the border gateway comprises an industrial wireless module and a TSN module. A TSN 1 and a TSN 2 use the same protocol, and the industrial wireless network and the two TSNs use different protocols.


The TSN comprises a TSN terminal and a TSN switch; the industrial wireless network may be a WIA-PA, a wireless sensor network, WirelessHART, 5G and other wireless communication networks; and the border gateway and the terminal side conversion node are used to convert protocols between the industrial wireless network and the TSN to play a role of communicating two networks.


Asymmetric delay in hybrid wireless and wired networks is one of the main reasons for inaccuracy of a synchronization process. Synchronization accuracy is affected by asymmetric delay, and the influence degree depends on the accuracy of calculated path delay. A schematic diagram of a cross-network time synchronization method in the solution is shown in FIG. 2.


The whole convergence network takes a TSN switch of the TSN 2 as a master clock and takes a TSN switch of the TSN 1 as a slave clock; the time information is forwarded from the TSN switch of the TSN 2 to the TSN switch of the TSN 1 through the border gateway, a routing device, a node device and the terminal side conversion node; and the master clock and the slave clock cross the industrial wireless network. The TSN and the industrial wireless network use the existing mature clock synchronization protocols such as IEEE 802.1AS and beacon frame synchronization to conduct synchronization, without introducing additional protocol overhead.


Firstly, a TSN module of a border gateway conducts clock synchronization with a TSN switch of a TSN 2 in a slave clock state; then, inside the border gateway, the TSN module is used as a master clock of an industrial wireless module, and the industrial wireless module conducts clock synchronization with the TSN module through a serial port so that time information is forwarded from a TSN 2 to an industrial wireless network.


Next, a routing device in the industrial wireless network conducts clock synchronization with the industrial wireless module of the border gateway through a beacon frame synchronization mode in the slave clock state, and the routing device is used as the master clock of a node device, to ensure clock synchronization of the industrial wireless network.


Finally, a terminal side conversion node conducts clock synchronization in the slave clock state with the node device in the industrial wireless network through a timestamp-free synchronization mode; independent of a special synchronization protocol, only the existing network data flow is followed to complete synchronization parameter estimation, to forward the time information from the industrial wireless network to the TSN 1; and then completing clock synchronization by the TSN switch of the TSN 1 with the terminal side conversion node in the slave clock state.


The synchronization information is transferred level by level from the master clock of the convergence network to the slave clock through the industrial wireless network by means of level-by-level forwarding of the time synchronization information, so as to complete the cross-network time synchronization between the industrial wireless network and the TSN.


In the synchronization process of TSN time, the TSN switch of the TSN 2 is used as the master clock and the TSN module in the border gateway is used as the slave clock. Considering that a wired network topology is relatively stable, link delay and processing time of the master clock and the slave clock are mainly considered in the synchronization process of TSN time, and the link delay is calculated according to IEEE 802.1AS. The flow chart of synchronization is shown in FIG. 3.


1) Link delay measurement. The link delay of the master clock and the slave clock is measured by a delay measurement mechanism shown in FIG. 4.


In FIG. 4, corresponding timestamps are obtained by exchanging a delay request message Delay_rep and a delay response message Delay_resp between the slave clock and the master clock; in the figure, Delay_resp(t2) represents that the delay response message replied to the slave clock at time t3 by the master clock carries time t2; Follow_up_delay_resp(t3) represents that a follow-up delay response message sent by the master clock to the slave clock carries time t3; after the follow-up delay response message Follow_up_delay_resp is sent, the slave clock receives the timestamps t1, t2, t3 and t4; and according to IEEE 802.1AS, the link delay delay_resp between the slave clock and the master clock is calculated as shown by expression (1):









delay_resp
=



(


t

2

-

t

1


)

+

(


t

4

-

t

3


)


2





(
1
)







2) Processing time measurement. Processing time is local time (which is duration time of a time interval between reception of a time synchronization event message by the master clock and transmission of a next subsequent time synchronization event message by the master clock). The processing time is denoted as time_process, which is t3 here.


Finally, the sum of the link delay and the processing time is denoted as Δ1=delay_resp+time_process.


The border gateway structure, as shown in FIG. 5, comprises an industrial wireless module and a TSN module. To support IP processing of non-IP networks such as WIA-PA, an SLIP is used in the solution to encapsulate IP data packets; and transparency of data transmission is ensured through an SLIP serial port, so that data is seamlessly connected between two networks.


The TSN module synchronizes to the master clock of the TSN 2 in a slave clock state, and then forwards the time synchronization information to the industrial wireless module through serial communication in a master clock state. Therefore, the time information is forwarded from the TSN 2 to the industrial wireless network.


A synchronization pulse signal outputted by a TSN module clock is a 1PPS pulse, and the industrial wireless module adjusts own local time by detecting the synchronization pulse signal outputted by the TSN module clock.


For clock synchronization between two modules, firstly, the TSN module needs to send an own initial clock T0 to the industrial wireless module through a serial port, and the industrial wireless module sets own local initial time local_time0 according to time; then, an interrupt program is started to begin to detect a 1PPS pulse signal outputted by the TSN module; when detecting a 1PPS signal, time of receiving the 1PPS signal is denoted as local_time1; and subsequently, the own local clock is corrected once. Assuming that the industrial wireless module is corrected at time local_time2, corrected time local_time satisfies the following expression:









local_time0
=


T
0

+

S
/
R






(
2
)












local_time
=

local_time2
+
N
-
local_time1





(
3
)









    • where S represents length of a serial port message; R represents a serial port baud rate; and N represents number of pulses received by the industrial wireless module.





The industrial wireless network can run protocols such as WIA-PA, ISA100.11a, 5G or WirelessHART. In the previous synchronization correction type algorithms, the clock is often adjusted only by calculating the frequency offset of the difference between the timestamps of a sender and a receiver, without considering an error influence caused by fixed time delay; or the influence of the fixed time delay is considered, but is only considered in a single-hop network. In order to further improve the correction accuracy of node clocks, the present invention estimates and compensates the frequency offset in a multi-hop network based on a synchronization mechanism of one-way message propagation, and adds the fixed time delay to the correction quantity. The synchronization process is as follows:


On this basis, the industrial wireless module synchronizes to the TSN 2 in a slave clock state according to the above method, and next, the industrial wireless module forwards the time synchronization information to the routing device and the node device in a master clock state.


The whole industrial wireless network firstly takes the industrial wireless module in the border gateway as a reference node of clock synchronization; the industrial wireless module transfers the synchronization information to the routing device; the routing device adjusts the own local clock according to the information; then, the routing device serves as a reference node for the clock of the node device and forwards the synchronization information to the node device; and the node device adjusts the own local clock based on the time synchronization information. As shown in FIG. 6, the industrial wireless module is denoted as A, the routing device is denoted as P1, and the node device is denoted as P2.


Time when node A sends a time message to node P1 to time when node P1 receives the message is a synchronization cycle of interaction between node A and node P1, and a process between node A and node P1 is repeated for N times to generate N synchronization cycles; after each time two nodes conduct one-way interaction of time information (i.e., one synchronization cycle), node P1 calculates clock frequency offset through the timestamp information for adjustment;


After adjustment of node P1, a time message is sent to node P2; time when node P1 sends the time message to node P2 to time when node P2 receives the message is a synchronization cycle of interaction between node P1 and node P2; a process between node P1 and node P2 is repeated for N times to generate N synchronization cycles; after each time two nodes conduct one-way interaction of time information (i.e., one synchronization cycle), node P2 calculates clock frequency offset through the timestamp information for adjustment.


1. Reference Node a and First-Layer Node P1

In a first synchronization cycle, node A sends current time information T1,1(A) to node P1, and receiving time T2,1(P1) recorded by P1 can be represented as:










T

2
,
1


(

P
1

)


=


T

1
,
1


(
A
)


+

θ

t

0


(

AP
1

)


+


ρ

(

AP
1

)


(


T

1
,
1


(
A
)


-

t
0


)

+

d

(

AP
1

)


+

X
1

(

AP
1

)


+


ρ

(

AP
1

)


(


d

(

AP
1

)


+

X
1

(

AP
1

)



)






(
4
)







In a formula, θt0(AP1) represents an initial clock offset of node P1 relative to reference node A at time to; ρ(AP1) represents a clock frequency offset of node P1 relative to reference node A; d(AP1) represents fixed time delay generated in a process of receiving and sending time information, with a value range of 1 ms-10 ms. X1(AP1) represents random time delay generated in the process of receiving and sending time information; ρ(AP1) (d(AP1)+X1(AP1)) represents a synchronization error accumulated due to frequency offset in the process of receiving and sending time information.


Further, in the first synchronization cycle, a difference ΔT1(AP1) of receiving and sending timestamps between node A and node P1 to be synchronized can be represented as:










Δ


T
1

(

AP
1

)



=



T

2
,
1


(

P
1

)


-

T

1
,
1


(
A
)


-

d

(

AP
1

)



=


θ

t

0


(

AP
1

)


+


ρ

(

AP
1

)


(


T

1
,
1


(
A
)


-

t
0


)

+

X
1

(

AP
1

)


+


ρ

(

AP
1

)


(


d

(

AP
1

)


+

X
1

(

AP
1

)



)







(
5
)







T5,1(P1) is correction time of P1 in the first synchronization cycle. Node P1 uses the difference ΔT1(AP1) to adjust the own local clock at time T5,1(P1) and time adjusted by P1 is represented by T5,1(P1)*, and there is










T

5
,
1



(

P
1

)

*


=



T

5
,
1


(

P
1

)


+

Δ


T
1

(

AP
1

)




=


T

5
,
1


(

P
1

)


+

T

2
,
1


(

P
1

)


-

T

1
,
1


(
A
)


-

d

(

AP
1

)








(
6
)







In a period from initial time t0 to the correction time T5,1(P1), a real clock deviation ΔTtrue,1(AP1) between node A and node P1 is:










Δ


T

true
,
1


(

A


P
1


)



=


θ

t

0


(

AP
1

)


+


ρ

(

AP
1

)


(


T

5
,
1


(

P
1

)


-

t
0


)






(
7
)







From formulas (7)-(5), a new clock offset θ1(AP1) of node P1 after adjustment is obtained as:










θ

t

1


(

AP
1

)


=



Δ


T

true
,
1


(

AP
1

)



-

Δ


T
1

(

AP
1

)




=



ρ

(

AP
1

)


(


T

5
,
1


(

P
1

)


-

T

1
,
1


(
A
)


-

d

(

AP
1

)


-

X
1

(

AP
1

)



)

-

X
1

(

AP
1

)








(
8
)







In a second synchronization cycle, node A sends current time information T1,2(A) to node P1 In the second synchronization cycle, receiving time T2,2(P1) recorded by node P1 can be represented as:










T

2
,
2


(

P
1

)


=


T

1
,
2


(
A
)


+

θ

t

1


(

AP
1

)


+


ρ

(

AP
1

)


(


T

1
,
2


(
A
)


-

T

5
,
1



(

P
1

)

*



)

+

d

(

AP
1

)


+

X
2

(

AP
1

)


+


ρ

(

AP
1

)


(


d

(

AP
1

)


+

X
2

(

AP
1

)



)






(
9
)







where X2(AP1) is random time delay generated in a process of receiving and sending time information of the second synchronization cycle.


Further, in the second synchronization cycle, a difference ΔT2(AP1) of receiving and sending timestamps between reference node A and node P1 can be represented as:










Δ


T
2

(

AP
1

)



=



T

2
,
2


(

P
1

)


-

T

1
,
2


(
A
)


-

d

(

AP
1

)



=


θ

t

1


(

AP
1

)


+


ρ

(

AP
1

)


(


T

1
,
2


(
A
)


-

T

5
,
1



(

P
1

)

*



)

+

X
2

(

AP
1

)


+


ρ

(

AP
1

)


(


d

(

AP
1

)


+

X
2

(

AP
1

)



)







(
10
)







Time of P1 after adjustment in the first synchronization cycle is set as T5,1(P1)*, and time of node A, corresponding to the time, is T5,1(A)*; at this moment, because node P1 just adjusts local time and time of node A is close to time of node P1, T5,1(P1)*=T5,1(A)* can be set; and formula (10) is changed as:










Δ


T
2

(

AP
1

)



=


θ

t

1


(

AP
1

)


+


ρ

(

AP
1

)


(


T

1
,
2


(
A
)


-

T

5
,
1



(
A
)

*



)

+

X
2

(

AP
1

)


+


ρ

(

AP
1

)


(


d

(

AP
1

)


+

X
2

(

AP
1

)



)






(
11
)







θt1(AP1) and T5,1(A)* are substituted into formula (11) to obtain:










Δ


T
2

(

AP
1

)



=



ρ

(

AP
1

)


(


T

1
,
2


(
A
)


-

X
1

(

AP
1

)


+

X
2

(

AP
1

)


-

T

2
,
1


(

P
1

)


+

d

(

AP
1

)



)

-

X
1

(

AP
1

)


+

X
2

(

AP
1

)







(
12
)







In a period from T5,1(P1)* to T5,2(P1) (i.e., in the second synchronization cycle), a real clock deviation ΔTtrue,2(AP1) between node A and node P1 is:










Δ


T

true
,
2


(

AP
1

)



=


θ

t

1


(

AP
1

)


+


ρ

(

AP
1

)


(


T

5
,
2


(

P
1

)


-

T

5
,
1



(

P
1

)

*



)






(
13
)







where T5,2(P1) is correction time of P1 in the second synchronization cycle. From formulas (13)-(12), a new clock offset θt2(AP1) of node P1 after second adjustment can be obtained as:










θ

t

2


(

AP
1

)


=



Δ


T

true
,
2


(

AP
1

)



-

Δ


T
2

(

AP
1

)




=



ρ

(
AP
)


(


T

5
,
2


(

P
1

)


-

T

1
,
2


(
A
)


-

d

(

AP
1

)


-

X
2

(

AP
1

)



)

-

X
2

(

AP
1

)








(
14
)







Similarly, in an ith synchronization cycle, a difference ΔTi(AP1) of receiving and sending timestamps between reference node A and node P1 can be obtained as:










Δ


T
i

(

AP
1

)



=



ρ

(

AP
1

)


(


T

1
,
i


(
A
)


-

X

i
-
1


(

AP
1

)


+

X
2

(

AP
1

)


-

T

2
,

i
-
1



(

P
1

)


+

d

(

AP
1

)



)

-

X

i
-
1


(

AP
1

)


+

X
i

(

AP
1

)







(
15
)









    • where Xi(AP1) is random time delay generated in a process of receiving and sending time information of the ith synchronization cycle.





A new clock offset θ(AP1) of node P1 after ith adjustment is:










θ
ti

(

AP
1

)


=



Δ


T

true
,
i


(

AP
1

)



-

Δ


T
i

(

AP
1

)




=



ρ

(

AP
1

)


(


T

5
,
i


(

P
1

)


-

T

1
,
i


(
A
)


-

d

(

AP
1

)


-

X
i

(

AP
1

)



)

-

X
i

(

AP
1

)








(
16
)







Table 1 provides main parameters in the process of node clock synchronization, including reference time, initial offset, correction time and correction quantity.









TABLE 1







Main Parameters in Clock Synchronization













Cycle
1
2
3
. . .
i
i + 1





Reference
t0
T5, 1(A)*
T5, 2(A)*
. . .
T5, i−1(A)*
T5, i(A)*


time


A sending
T1, 1(A)
T1, 2(A)
T1, 3(A)
. . .
T1, i(A)
T1, i+1(A)


time


P1 receiving
T2, 1(P1)
T2, 2(P1)
T2, 3(P1)
. . .
T2, i(P1)
T2, i+1(P1)


time


P2 receiving
T2, 1(P2)
T2, 2(P2)
T2, 3(P2)
. . .
T2, i(P2)
T2, i+1(P2)


time


Initial offset
θt0(AP1)
θt1(AP1)
θt2(AP1)
. . .
θti−1(AP1)
θti(AP1)


P1 correction
T5, 1(P1)
T5, 2(P1)
T5, 3(P1)
. . .
T5, i−1(P1)
T5, i(P1)


time


P1 correction
ΔT1(AP1)
ΔT2(AP1)
ΔT3(AP1)
. . .
ΔTi−1(AP1)
ΔTi(AP1)


quantity


Random time
X1(AP1)
X2(AP1)
X3(AP1)
. . .
Xi(AP1)
Xi+1(AP1)


delay









To simplify calculation, formula (15) can be transformed into the following expression:










Δ


T
i

(

AP
1

)



=



ρ

(

AP
1

)


(


T

1
,
i


(
A
)


-

T

2
,

i
-
1



(

P
1

)


-

d

(

AP
1

)



)

+


(

1
+

ρ

(

AP
1

)



)



(


X
i

(

AP
1

)


-

X

i
-
1


(

AP
1

)



)







(
17
)







Qi=Xi(AP1)−Xi-1(AP1) is made; because random time delay Xi(AP1) and Xi-1(AP1) can be regarded as random variables which have the same average and obey Gaussian distribution, it is easy to know that Qi is also a random variable which obeys Gaussian distribution, i.e., Qi˜(0,δ2); frequency offset ρ(AP1) is estimated by using a maximum likelihood estimation method; and a log-likelihood function of formula (17) based on observed quantity {T2,i(P1),T1,i(A),d(AP1)}i=1N is represented as:










ln

L

(


ρ

(

AP
1

)


,

δ
2


)


=



-

N
2




ln

(

2

π


δ
2


)



-


1

2


δ
2












i
=
1

N

[



T

2
,
i


(

P
1

)


-

T

1
,
i


(
A
)


-

d

(

AP
1

)


-


ρ

(

AP
1

)


(


T

1
,
i


(
A
)


-

T

2
,

i
-
1



(

P
1

)



)



1
+

ρ

(

AP
1

)




]

2







(
18
)







A partial derivative of ρ(AP1) is calculated and made as 0:













ln

L

(


ρ

(

AP
1

)


,

δ
2


)






ρ

(

AP
1

)




=












i
=
1

N

[

(


T

2
,
i


(

P
1

)


-

T

1
,
i


(
A
)


-

d

(

AP
1

)


-

ρ

(

AP
1

)













(


T

1
,
i


(
A
)


-

T

2
,

i
-
1



(

P
1

)



)

)



(


T

2
,
i


(

P
1

)


-

T

2
,

i
-
1



(

P
1

)


-

d

(

AP
1

)



)


]






(

1
+

ρ

(

AP
1

)



)

3








=

0







A solution is obtained as:










ρ

(

AP
1

)


=








i
=
1

N



(


T

2
,
i


(

P
1

)


-

τ

1
,
i


(
A
)


-

d

(

AP
1

)



)



(


T

2
,
i


(

P
1

)


-

τ

2
,

i
-
1



(

P
1

)


-

d

(

AP
1

)



)









t
=
1

N



(


T

1
,
i


(
A
)


-

T

2
,

i
-
1



(

P
1

)



)



(


T

2
,
i


(

P
1

)


-

T

2
,

i
-
1



(

P
1

)


-

d

(

AP
1

)



)







(
19
)







P1 only needs to obtain parameters in formula (19) to estimate ρ(AP1) By selecting appropriate d(AP1) value, ρ(AP1) can be adjusted so that frequencies of node P1 and node A are gradually close, to complete time synchronization of P1 and A.


2. First-Layer Node P1 and Second-Layer Node P2


After node P1 receives the time information from reference node A, a reference node as node P2 after adjustment of an own local clock is calculated according to timestamps. Similarly, node P2 uses node P1 as the reference node, and node P1 sends the time information to node P2.


In the first synchronization cycle between node P1 and node P2, node P1 sends current time information T1,1(P1) to node P2, and time when node P2 receives the time information sent by node P1 is denoted as T2,1(P2), which can be represented as:











T

2
,
1



(

P
2

)


=



T

1
,
1



(

P
1

)


+

θ

t

0


(


P
1



P
2


)


+


ρ

(


P
1



P
2


)


(



T

1
,
1



(

P
1

)


-

t
0


)

+

d

(


P
1



P
2


)


+


X
1


(


P
1



P
2


)


+


ρ

(


P
1



P
2


)


(


d

(


P
1



P
2


)


+


X
1


(


P
1



P
2


)



)






(
20
)







In a formula, θt0(P1P2) represents an initial clock offset of node P2 at time to relative to reference node P1; ρ(P1P2) represents a clock frequency offset of node P2 relative to reference node P1; d(P1P2) represents fixed time delay generated in a process of receiving and sending time information, with a value range of 1 ms-10 ms; X1(P1P2) represents random time delay generated in the process of receiving and sending time information; and ρ(P1P2) (d(P1P2)+X1(P1P2)) represents a synchronization error accumulated due to frequency offset in the process of receiving and sending time information.


Further, in the first synchronization cycle of node P1 and node P2, a difference ΔT1(P1P2) of receiving and sending timestamps between node P1 and node P2 can be obtained:










Δ


T
1

(


P
1



P
2


)



=




T

2
,
1



(

P
2

)


-


T

1
,
1



(

P
1

)


-

d

(


P
1



P
2


)



=


θ

t

0


(


P
1



P
2


)


+


ρ

(


P
1



P
2


)


(



T

1
,
1



(

P
1

)


-

t
0


)

+


X
1


(


P
1



P
2


)


+


ρ

(


P
1



P
2


)


(


d

(


P
1



P
2


)


+


X
1


(


P
1



P
2


)



)







(
21
)







T5,1(P2) is correction time of P2 in the first synchronization cycle. Then, node P2 uses the difference ΔT1(P1P2) of the timestamps to adjust the local clock at time T5,1(P2) and adjusted local time is represented by T5,1(P2)*, and there is T5,1(P2)*=T5,1(P2)+ΔT1(P1P2).


In a period from the initial time to the correction time, a real clock deviation ΔTtrue,1(P1P2) between node P1 and node P2 is:










Δ


T

true
,
1


(


P
1



P
2


)



=


θ

t

0


(


P
1



P
2


)


+


ρ

(


P
1



P
2


)


(


T

5
,
1


(

P
2

)


-

t
0


)






(
22
)







From formulas (22)-(21), a new clock offset θt1(P1P2) of node P2 after adjustment in the first synchronization cycle of node P1 and node P2 is:










θ

t

1


(


P
1



P
2


)


=



Δ


T

true
,
1


(


P
1



P
2


)



-

Δ


T
1

(


P
1



P
2


)




=




ρ

(


P
1



P
2


)


(


T

5
,
1


(

P
2

)


-

T

1
,
1


(

P
1

)


-

d

(


P
1



P
2


)


-

X
1

(


P
1



P
2


)



)

-

X
1

(


P
1



P
2


)








(
23
)







In the second synchronization cycle, reference node P1 needs to use a difference ΔT1(AP1) of the receiving and sending timestamps of node A and node P1 in the first synchronization cycle to correct an own local clock in each cycle, so for nodes P2 and P1, a difference ΔT2(P1P2) of the receiving and sending timestamps of node P1 and node P2 in the second synchronization cycle can be represented as:











T

2
,
1


(

P
2

)


-

T

1
,
2


(

P
1

)


-

d

(


P
1



P
2


)


+

Δ


T
1

(


P
1



P
2


)




=


θ

t

1


(


P
1



P
2


)


+



ρ

(


P
1



P
2


)


(


T

1
,
2


(

P
1

)


-

T

5
,
1



(

P
2

)

*



)

+

X
2

(


P
1



P
2


)


+


ρ

(


P
1



P
2


)


(


d

(


P
1



P
2


)


+

X
2

(


P
1



P
2


)



)






(
24
)







where T1,2(P1) is sending time when node P1 sends a synchronization message to node P2 in the second synchronization cycle between node P1 and node P2; T2,2(P2) is receiving time when node P2 receives the synchronization message in the second synchronization cycle between node P1 and node P2; X2(P1P2) is random time delay generated in a process of receiving and sending time information of the second synchronization cycle between node P1 and node P2;


θt1(P1P2) and T5,1(P2)* are substituted into formula (24) to obtain a difference ΔT2(P1P2) of receiving and sending timestamps between node P1 and node P2 in the second synchronization cycle of node P1 and node P2:










Δ


T
2

(


P
1



P
2


)



=



T

2
,
2


(

P
2

)


-

T

1
,
2


(

P
1

)


-

d

(


P
1



P
2


)



=




ρ

(


P
1



P
2


)


(


T

1
,
2


(

P
1

)


-

T

2
,
1


(

P
2

)


-

X
1

(


P
1



P
2


)


+

X
2

(


P
1



P
2


)


+

d

(


P
1



P
2


)



)

-

X
1

(


P
1



P
2


)


+


X
2

(


P
1



P
2


)


-

(


T

2
,
1


(

P
1

)


-

T

2
,
1


(
A
)


-

d

(

AP
1

)



)







(
25
)







where T2,1(P2) represents receiving time when node P2 receives time information sent by node P1 in the first synchronization cycle between node P1 and node P2; T2,1(P1) represents receiving time when node P1 receives time information sent by node A in the first synchronization cycle between node A and node P1; T1,1(A) represents sending time when node A sends a time message to node P1 in the first synchronization cycle between node A and node P1.


T5,2(P2) is correction time of P2 in the second synchronization cycle. Then, node P2 uses the difference ΔT2(P1P2) of the timestamps to adjust the local clock at time T5,2(P2) and adjusted time is represented by T5,2(P2), and there is T5,2(P2)*=T5,2(P2)+ΔT2(P1P2).


In the first synchronization cycle of node P1 and node P2, adjusted time of node P2 at time T5,2(P2) is T5,1(P2)*; in a period from time corresponding to this time to corresponding time T5,2(P2), a real clock deviation ΔTtrue,2(P1P2) of node P2 compared with P1 is:










Δ


T

true
,
2


(


P
1



P
2


)



=


θ

t

1


(


P
1



P
2


)


+


ρ

(


P
1



P
2


)


(


T

5
,
2


(

P
2

)


-

T

5
,
1



(

P
2

)

*



)






(
26
)







From formulas (26)-(25), a clock offset θt2(P1P2) of node P2 after adjustment in the second synchronization cycle of node P1 and node P2 is:










θ

t

2


(


P
1



P
2


)


=




Δ


T

true
,
2


(


P
1



P
2


)



-

Δ


T
2

(


P
1



P
2


)




=



ρ

(


P
1



P
2


)


(


T

5
,
2


(

P
2

)


-

T

1
,
2


(

P
1

)


-

X
2

(


P
1



P
2


)


-

d

(


P
1



P
2


)



)

-


X
2

(


P
1



P
2


)


+

Δ


T
1

(

AP
1

)









(
27
)









    • where T1,2(P1) is sending time when node P1 sends a synchronization message to node P2 in the second synchronization cycle between node P1 and node P2; ΔT1(AP1) represents a difference of the receiving and sending timestamps between node A and node P1 in the first synchronization cycle between node A and node P1.





In a third synchronization cycle between node P1 and node P2, reference node P1 needs to use a difference ΔT2(AP1) of the receiving and sending timestamps of node A and node P1 in the second synchronization cycle to correct an own local clock in each cycle, so for nodes P2 and P1, a difference ΔT3(P1P2) of the receiving and sending timestamps in the third synchronization cycle between node P1 and node P2 can be represented as:











T

2
,
3


(

P
2

)


-

T

1
,
3


(

P
1

)


-

d

(


P
1



P
2


)


+

Δ


T
2

(


P
1



P
2


)




=


θ

t

2


(


P
1



P
2


)


+



ρ

(


P
1



P
2


)




(


T

1
,
3


(

P
1

)


-

T

5
,
2



(

P
2

)

*



)


+

X
3

(


P
1



P
2


)


+


ρ

(


P
1



P
2


)




(


d

(


P
1



P
2


)


+

X
3

(


P
1



P
2


)



)







(
28
)









    • where T1,3(P1) is sending time when node P1 sends a synchronization message to node P2 in the third synchronization cycle between node P1 and node P2; T2,3(P2) is receiving time when node P2 receives the synchronization message in the third synchronization cycle between node P1 and node P2; X3(P1P2) is random time delay generated in a process of receiving and sending time information of the third synchronization cycle between node P1 and node P2;

    • θt2(P1P2) and T5,2(P2)* are substituted into formula (28) to obtain a difference ΔT3(P1P2) of receiving and sending timestamps between node P1 and node P2 in the third synchronization cycle of node P1 and node P2:













Δ


T
3

(


P
1



P
2


)



=



T

2
,
3


(

P
2

)


-

T

1
,
3


(

P
1

)


-

d

(


P
1



P
2


)



=




ρ

(


P
1



P
2


)




(


T

1
,
3


(

P
1

)


-

T

2
,
2


(

P
2

)


-

X
2

(


P
1



P
2


)


+

X
3

(


P
1



P
2


)


+

d

(


P
1



P
2


)



)


-

X
2

(


P
1



P
2


)


+


X
3

(


P
1



P
2


)


-

[


(


T

2
,
2


(

P
1

)


-

T

1
,
2


(
A
)


-

d

(

AP
1

)



)

-

(


T

2
,
1


(

P
1

)


-

T

1
,
1


(
A
)


-

d

(

AP
1

)



)


]







(
29
)









    • where T2,2(P2) represents receiving time when node P2 receives time information sent by node P1 in the second synchronization cycle between node P1 and node P2; T2,2(P1) represents receiving time when node P1 receives time information sent by node A in the second synchronization cycle between node A and node P1; T1,2(A) represents sending time when node A sends a time message to node P1 in the second synchronization cycle between node A and node P1. T2,1(P1) represents receiving time when node P1 receives time information sent by node A in the first synchronization cycle between node A and node P1; T1,1(A) represents sending time when node A sends a time message to node P1 in the first synchronization cycle between node A and node P1.





Similarly, for the ith synchronization cycle between node P1 and node P2, reference node P1 needs to use a difference ΔTi(AP1) of the receiving and sending timestamps of node A and node P1 in the ith synchronization cycle to correct an own local clock in each cycle, so for nodes P2 and P1, a difference ΔTi((P1P2) of the receiving and sending timestamps in the ith synchronization cycle of node P1 and node P2 can be represented as:










Δ


T
i

(


P
1



P
2


)



=



ρ

(


P
1



P
2


)


(


T

1
,
i


(

P
1

)


-

T

2
,

i
-
1



(

P
2

)


-

X

i
-
1


(


P
1



P
2


)


+


X
i

(


P
1



P
2


)


+

d

(


P
1



P
2


)



)

-

X

i
-
1


(


P
1



P
2


)


+

X
i

(


P
1



P
2


)


-

[


(


T

2
,

i
-
1



(

P
1

)


-

T

1
,

i
-
1



(
A
)



)

-








j
=
1

i



(


T

2
,

i
-
j
-
1



(

P
1

)


-

T

1
,

i
-
j
-
1



(
A
)



)



]

-


(

i
-
3

)



d

(


P
1



P
2


)








(
30
)










ϵ
i

=


[


(


T

2
,

i
-
1



(

P
1

)


-

T

1
,

i
-
1



(
A
)



)

-







j
=
1

i



(


T

2
,

i
-
j
-
1



(

P
1

)


-

T

1
,

i
-
j
-
1



(
A
)



)



]

+


(

i
-
3

)



d

(


P
1



P
2


)








is set;

    • where T1,i(P1) is represented as sending time when node P1 sends a synchronization message to node P2 in the ith synchronization cycle between node P1 and node P2; T2,i-1(P2) represents receiving time when node P2 receives time information sent by node P1 in an i−1th synchronization cycle between node P1 and node P2; Xi(P1P2) represents random time delay generated in a process of receiving and sending time information of the ith synchronization cycle between node P1 and node P2; T2,i-1(P1) represents receiving time when node P1 receives time information sent by node A in the i−1th synchronization cycle between node A and node P1; T1,i-1(A) represents sending time when node A sends a time message to node P1 in the i−1th synchronization cycle between node A and node P1; T2,i-j-1(P1) represents sending time when node P1 sends a synchronization message to node P2 in an i−j−1th synchronization cycle between node P1 and node P2; T1,i-j-1(A) represents sending time when node A sends a time message to node P1 in the i-j−1th synchronization cycle between node A and node P1.


Frequency offset ρ(P1P2) is estimated by using the maximum likelihood estimation method; and a log-likelihood function of formula (30) based on observed quantity {T2,i(P2),T1,i(P1),d(P1P2)}i=1N is is represented as:










ln

L

(


ρ

(


P
1



P
2


)


,

δ
2


)


=



-

N
2




ln

(

4

π


δ
2


)



-



1

2


δ
2












i
=
1

N

[






(


T

2
,
i


(

P
2

)


-

T

1
,
i


(

P
1

)


-

d

(


P
1



P
2


)



)

-








ρ

(


P
1



P
2


)


(


T

1
,
i


(

P
1

)


-

T

2
,

i
-
1



(

P
2

)


-

d

(


P
1



P
2


)



)

+

ϵ
i






1
+

ρ

(


P
1



P
2


)




]

2







(
31
)







Partial derivatives of ρ(P1P2) on both sides of formula (31) are:













ln

L

(


ρ

(


P
1



P
2


)


,

δ
2


)






ρ

(


P
1



P
2


)




=












i
=
1

N

[


(


T

2
,
i


(

P
2

)


-

T

1
,
i


(

P
1

)


-

d

(


P
1



P
2


)



)

-










ρ

(


P
1



P
2


)


(


T

1
,
i


(

P
1

)


-

T

2
,

i
-
1



(

P
2

)


-

d

(


P
1



P
2


)



)

+

ϵ
i


]





(

1
+

ρ

(

A


P
1


)



)


×








(


T

2
,

i
-
1



(

P
2

)


-

T

1
,
i


(

P
1

)


+

d

(


P
1



P
2


)



)



(

1
+

ρ

(


P
1



P
2


)



)


-









[


(


T

2
,
i


(

P
2

)


-

T

1
,
i


(

P
1

)


-

d

(


P
1



P
2


)



)

-











ρ

(


P
1



P
2


)




(


T

1
,
i


(

P
1

)


-

T

2
,

i
-
1



(

P
2

)


-

d

(


P
1



P
2


)



)


+



i


]









(

1
+

ρ

(


P
1



P
2


)



)

2







(
32
)







Formula (32) is made to be equal to 0, and a solution is:










ρ

(


P
1



P
2


)


=











i
=
1

N

[

(


T

2
,
i


(

P
2

)


-

T

1
,
i


(

P
1

)


-

d

(


P
1



P
2


)



)








(


T

2
,
i


(

P
2

)


-

T

2
,

i
-
1



(

P
2

)


-

2


d

(


P
1



P
2


)



+

2


ϵ
i



)

-









(


T

2
,

i
-
1



(

P
2

)


-

T

1
,
i


(

P
1

)


-

d

(


P
1



P
2


)



)



ϵ
i


+

ϵ
i
2


]














i
=
1

N

[


(


T

2
,

i
-
1



(

P
2

)


-

2


T

1
,
i


(

P
1

)



+

T

2
,
i


(

P
2

)



)

+







(


T

2
,
i


(

P
2

)


-

T

2
,

i
-
1



(

P
2

)


-

d

(


P
1



P
2


)



)







(


T

2
,
i


(

P
2

)


-

T

2
,

i
-
1



(

P
2

)


+

ϵ
i


)

]









(
33
)







P2 only needs to obtain parameters in formula (33) to estimate ρ(P1P2) By selecting appropriate d(P1P2) value, ρ(P1P2) can be adjusted so that frequencies of node P2 and node P1 are gradually close, to complete time synchronization of P2 and P1.


In the method, the time synchronization information is extended from a two-level network to a three-level network; time adjustment of a first-level node after each synchronization cycle should consider the correction quantity of an upper-level node; in addition, the influence of fixed delay is added to the traditional correction quantity; and at the same time, it is not necessary to estimate frequency offset and clock offset jointly, but only needs to estimate the frequency offset separately, which can realize synchronization with node A, thereby reducing algorithm complexity while optimizing the correction quantity.


The terminal side conversion node is an important node which crosses the industrial wireless network and the TSN 1 to play a role of a bridge that connects two networks. In the past cross-network time synchronization methods, most of the synchronization modes use a hardware clock module to obtain the timestamps, which not only brings high hardware complexity, but also causes extra protocol overhead because different protocol networks use different time synchronization mechanisms.


With respect to the above problems, synchronization between the node device and the terminal side conversion node uses a timestamp-free synchronization method based on RSA algorithm herein, which does not rely on special synchronization protocols, and is not limited to different time synchronization protocols used by different networks, thereby getting rid of the dependence of existing timestamp-free synchronization methods on following response packets; only the transmission of the existing network data flow is followed to complete synchronization parameter estimation; and in the process of data flow interaction, there is no need to carry timestamp information, so that the synchronization message needed for cross-network time synchronization can be obtained implicitly.


As shown in FIG. 7, the node device of the industrial wireless network is used as the master clock, denoted as M; the terminal side conversion node is used as the slave clock, denoted as S; node S periodically sends ordinary data packets to node M; and synchronization information is transferred implicitly by controlling a response time interval Δi of a receiver for a sender.


In the ith synchronization cycle, sending node S sends an ordinary data packet to receiving node M at time T1,i(S), and receiving node M receives the data packet at time T2,i(M); after waiting for the response time interval Δi, a response message is returned to sending node S at time T3,i(M) and sending node S receives the response message at time T4,i(S); then local receiving and sending time is recorded and stored in a local cache; with repeated processes of receiving and sending node data packets, the node can use the receiving and sending time of the local cache to estimate the clock frequency offset.


1. Presetting of Response Time Interval Δi

In the timestamp-free synchronization method based on RSA algorithm, receiving node M determines the response time interval Δi according to the RSA algorithm. RSA algorithm is an asymmetric cryptographic algorithm. Given a number, different random numbers within the range of this number can be generated. The present invention only draws on the characteristic of RSA algorithm that can generate the random numbers. A specific mechanism is as follows:


It is assumed that the process is synchronized for N times; there is A ∈{2,3,4, . . . N−1}; any of prime numbers P, Q and D is taken, where N=P*Q; when (1)*E) mod(P−1)*(Q−1)=1 established, there is Ci=(Ai EXP D)mod N; where I<i<N; Ci is a generated random number; meanwhile, Ci is used to represent a response time interval Δi that a receiving node needs to wait for in an ith synchronization process. It is noted that according to the principle of the RSA algorithm, although synchronization is conducted for N times, a response time interval Δi in N−2 synchronization processes can only be obtained. When N is large enough, N−2 times of synchronization and N times of synchronization can be regarded as the same.


2. Modeling of Timestamp-Free Synchronization Method Based on RSA Algorithm

fS and fM are set as crystal oscillator frequencies of node S and node M respectively, and a clock frequency offset







ρ

(
MS
)


=


f
M


f
S






of node S relative to node M is defined.


In the first synchronization cycle, as shown in FIG. 7, when node S sends an ordinary data packet to node M at time T1,1(S), time T2,1(M) when node M receives the data packet can be represented as a formula below:










T

2
,
1


(
M
)


=



ρ

(
MS
)


×

T

1
,
1


(
S
)



+

θ

t
0


+


ρ

(
MS
)


×

(


d
1

+

X
1


)







(
34
)









    • where θto represents an initial clock offset of node S relative to node M; d1 represents fixed time delay generated in a process of receiving and sending the data packets; X1 represents random time delay generated in the process of receiving and sending the data packets.





Time T3,1(M) when node M sends a response message to node S can be obtained according to the above RSA algorithm, i.e., T3,1(M)=T2,1(M)2; time when node S receives the response message sent by node M is denoted as T4,1(S), then:










T

3
,
1


(
M
)


=



ρ

(
MS
)


×

T

4
,
1


(
S
)



+

θ

t
0


-


ρ

(
MS
)


×

(


d
2

+

Y
1


)







(
35
)









    • where d2 is fixed time delay of the response message in transmission, and d2=d1−m; here, the size of m is in direct proportion to a difference between length of uplink data packet messages and length of downlink response messages; Y1 is downlink random time delay in the first synchronization cycle.





In the second synchronization cycle, node S sends an ordinary data packet to node M at time T1,2(S), and node M receives the data packet at time T2,2(M); a value of the response time interval Δ2 in the second synchronization cycle can be obtained according to the RSA algorithm; at this moment, time when node M sends a response message is T3,2(M)=T2,2(M)2, and then:










T

3
,
2


(
M
)


=



ρ

(
MS
)


×

T

4
,
2


(
S
)



+

θ

t
0


-


ρ

(
MS
)


×

(


d
1

+

Y
2


)







(
36
)









    • where d2 is fixed time delay generated by the data packets in a process of receiving and sending the data packets in the second synchronization cycle; and Y2 is downlink random time delay in the second synchronization cycle.





In the third synchronization cycle, node S sends an ordinary data packet to node M at time T1,3(S), and node M receives the data packet at time T2,3(M); a value of the response time interval Δ3 in the third synchronization cycle can be obtained according to the RSA algorithm; at this moment, time when node M sends a response message is T3,3(M)=T2,3(M)3, and then:










T

3
,
3


(
M
)


=



ρ

(
MS
)


×

T

4
,
3


(
S
)



+

θ

t
0


-


ρ

(
MS
)


×

(


d
1

+

Y
3


)







(
37
)









    • where Y3 represents downlink random time delay in the third synchronization cycle.





Similarly, in the ith synchronization cycle, node S sends an ordinary data packet to node M at time T1,i(S), and node M receives the data packet at time T2,i(M); a value of the response time interval Δi in the ith synchronization cycle can be obtained according to the RSA algorithm; at this moment, time when node M sends a response message is T3,i(M); node S receives the response message returned by node M at time T4,i(S) The following can be obtained:










T

2
,
i


(
M
)


=



ρ

(
MS
)


×

T

1
,
i


(
S
)



+

θ

t
0


+


ρ

(
MS
)


×

(


d
1

+

X
i


)







(
38
)







T

3
,
i


(
M
)


=



ρ

(
MS
)


×

T

4
,
i


(
S
)



+

θ

t
0


-


ρ

(
MS
)


×

(


d
2

+

Y
i


)







(
39
)







Δ
i



(


Δ
2

,

Δ
3

,


,

Δ

B
-
1



)





(
40
)







T

3
,
i


(
M
)


=


T

2
,
i


(
M
)


+

Δ
i






(
41
)







where Xi represents random time delay generated in the process of receiving and sending the data packets in the ith synchronization cycle; and Yi represents downlink random time delay in the ith synchronization cycle.


After N−1 synchronization cycles, sending node S can obtain a set of local timestamp pairs {T1,i(S),T4,i(S)}i=2N-1, and receiving node M can obtain a set of local timestamp pairs {T2,i(M),T3,i(M)}i=2N-1; combined with the response time interval Δi, the maximum likelihood estimation method is used to estimate frequency offset and fixed delay between nodes.


Formulas (39)-(38) are used to obtain:











T

3
,
i


(
M
)


-

T

2
,
i


(
M
)



=


ρ

(
MS
)


[


T

4
,
i


(
S
)


-

T

1
,
i


(
S
)


-

(


d
1

+

d
2


)

-

(


X
i

+

Y
i


)


]





(
42
)







Because Xi and Yi are Gaussian random distributions with mean of 0 and variance of σ2 and Vi=Xi+Yi is made, Vi is Gaussian random distribution with mean and variance of 2σ2.






α
=

1

ρ

(
MS
)







is made; and then formula (42) can be simplified as:










α

(


T

3
,
i


(
M
)


-

T

2
,
i


(
M
)



)

=


(


T

4
,
i


(
S
)


-

T

1
,
i


(
S
)



)

-

2


d
1


+
m
-

V
i






(
43
)









    • where T3,i(M)−T2,i(M)i, and then formula (43) can be expressed as a matrix form below:













[





T

4
,
2


-

T

1
,
2


+
m







T

4
,
3


-

T

1
,
3


+
m












T

4
,

N
-
1



-

T

1
,

N
-
1



+
m




]

=



[





T

3
,
2


-

T

2
,
2





2






T

3
,
3


-

T

2
,
3





2







2






T

3
,

N
-
1



-

T

2
,

N
-
1






2



]

[



α





d
1




]

+

[




V
2






V
3











V

N
-
1





]






(
44
)







A maximum likelihood function of formula (44) about parameters (α,d12) can be expressed as:










L

(

α
,

d
1

,

σ
2


)

=



(

2

π
×
2


σ
2


)


-


N
-
1

2




exp


{


-

1

2
×
2


σ
2











i
=
2





i
=

N
-
1






[


(


T

4
,
i


(
S
)


-

T

1
,
i


(
S
)



)

+

αΔ
i

-

2


d
1


+
m

]

2



}






(
45
)







Logarithms of both sides of formula (45) are calculated to obtain:










L

(

α
,

d
1

,

σ
2


)

=



-


N
-
1

2




ln

(

4


πσ
2


)


-


1

4


σ
2








i
=
2


N
-
1





[


(


T

4
,
i


(
S
)


-

T

1
,
i


(
S
)



)

-

αΔ
i

-

2


d
1


+
m

]

2








(
46
)







A first-order partial derivative about α for formula (46) is calculated to obtain:














ln



L

(

α
,

d
1

,

σ
2


)




α


=


1

2


σ
2










i
=
2





N
-
1




[


(


T

4
,
i


(
S
)


-

T

1
,
i


(
S
)


-

αΔ
i

-

2


d
1


+
m

)



Δ
i


]







(
47
)







A first-order partial derivative about d1 for formula (46) is calculated to obtain:














ln



L

(

α
,

d
1

,

σ
2


)




α


=


1

2


σ
2










i
=
2





N
-
1




(


T

4
,
i


(
S
)


-

T

1
,
i


(
S
)


-

αΔ
i

-

2


d
1


+
m

)







(
48
)







Formula (47) and formula (48) are made as 0, and maximum likelihood functions of ρ(MS) and d1 can be obtained by simultaneous solution:










ρ

(
MS
)


=


1
α

=




(

N
-
2

)








i
=
2





N
-
1




Δ
i
2



-


(






i
=
2





N
-
1




Δ
i


)

2









N
-
2

)








i
=
2





N
-
1




[


(


T

4
,
i


(
S
)


-

T

1
,
i


(
S
)


+
m

)



Δ
i


]



-











I
=
2





N
-
1





(


T

4
,
i


(
S
)


-

T

1
,
i


(
S
)


+
m

)








i
=
2





N
-
1




Δ
i













(
49
)







d
1

=











i
=
2





N
-
1





Δ
i
2








i
=
2





N
-
1




(


T

4
,
i


(
S
)


-

T

1
,
i


(
S
)


+
m

)




-











i
=
2





N
-
1





[


(


T

4
,
i


(
S
)


-

T

1
,
i


(
S
)


+
m

)



Δ
i


]








i
=
2





N
-
1




Δ
i








2
[



(

N
-
2

)








i
=
2





N
-
1




Δ
i
2



-


(






i
=
2





N
-
1




Δ
i


)

2


]






(
50
)







Thus, the fixed time delay of the response message in transmission is d2=d1−m.


After the terminal side conversion node and the node device of the industrial wireless network complete synchronization, the TSN switch of the TSN 1 completes synchronization with the terminal side conversion node in the slave clock state, and a synchronization method is consistent with the time synchronization process of the TSN.


Finally, it should be noted that the above embodiments are only used for describing, rather than limiting the technical solution of the present invention. Although the present invention is described in detail with reference to the preferred embodiments, those ordinary skilled in the art shall understand that the technical solution of the present invention can be amended or equivalently replaced without departing from the purpose and the scope of the technical solution. The amendment or equivalent replacement shall be covered within the scope of the claims of the present invention.

Claims
  • 1. A cross-network time synchronization method for industrial wireless network and TSN fusion, characterized by comprising the following steps: S1: conducting clock synchronization by a TSN module of a border gateway with a TSN switch of a TSN 2 in a slave clock state;S2: inside the border gateway, using the TSN module as a master clock of an industrial wireless module, and conducting clock synchronization by the industrial wireless module with the TSN module through a serial port;S3: conducting clock synchronization by a routing device in the industrial wireless network with the industrial wireless module of the border gateway through a beacon frame synchronization mode in the slave clock state, and conducting clock synchronization by the routing device as the master clock of a node device for the node device;S4: conducting clock synchronization by a terminal side conversion node in the slave clock state with the node device in the industrial wireless network through a timestamp-free synchronization mode, and finally, synchronizing a TSN switch of a TSN 1 with the terminal side conversion node in the slave clock state.
  • 2. The cross-network time synchronization method for industrial wireless network and TSN fusion according to claim 1, characterized in that: step S1 specifically comprises the following steps: S11: obtaining timestamps t1, t2, t3 and t4 by a slave clock by using a peer-to-peer delay measurement mechanism;S12: calculating link delay of the master clock and the slave clock by the slave clock;S13: calculating processing time denoted as time_process by the slave clock;S14: denoting a sum of the link delay and the processing time as Δ1.
  • 3. The cross-network time synchronization method for industrial wireless network and TSN fusion according to claim 2, characterized in that: in step S1, the delay measurement mechanism is used to measure the link delay of the master clock and the slave clock; corresponding timestamps are obtained by exchanging a delay request message Delay_rep and a delay response message Delay_resp between the slave clock and the master clock; Delay_resp(t2) represents that the delay response message replied to the slave clock at time t3 by the master clock carries time t2; Follow_up_delay_resp(t3) represents that a follow-up delay response message sent by the master clock to the slave clock carries time t3; after a Follow_up_delay_resp message is sent, the slave clock receives the timestamps t1, t2, t3 and t4; the link delay delay_resp between the slave clock and the master clock is calculated as shown by expression (1):
  • 4. The cross-network time synchronization method for industrial wireless network and TSN fusion according to claim 1, characterized in that: the border gateway comprises an industrial wireless module and a TSN module; an SLIP is used to encapsulate IP data packets; and transparency of data transmission is ensured through an SLIP serial port, so that data is seamlessly connected between two networks.
  • 5. The cross-network time synchronization method for industrial wireless network and TSN fusion according to claim 4, characterized in that: in step S2, a synchronization pulse signal outputted by a TSN module clock is a 1PPS pulse, and the industrial wireless module adjusts own local time by detecting the synchronization pulse signal outputted by the TSN module clock, comprising the following steps: S21: sending, by the TSN module, an own initial clock T0 to the industrial wireless module through a serial port, and setting, by the industrial wireless module, own local initial time local_time0 according to time;S22: starting an interrupt program to start to detect a 1PPS pulse signal outputted by the TSN module, and when detecting a 1PPS signal by the industrial wireless module, denoting time of receiving the 1PPS signal as local_time1;S23: correcting an own local clock once by the industrial wireless module;assuming that the industrial wireless module is corrected at time local_time2, corrected time local_time satisfies the following expression:
  • 6. The cross-network time synchronization method for industrial wireless network and TSN fusion according to claim 1, characterized in that: in step S3, the industrial wireless module is denoted as A, the routing device is denoted as P1, and the node device is denoted as P2; time when node A sends a time message to node P1 to time when node P1 receives the message is a synchronization cycle of interaction between node A and node P1, and a process between node A and node P1 is repeated for N times to generate N synchronization cycles; after each time two nodes conduct one-way interaction of time information, i.e., one synchronization cycle, node P1 calculates clock frequency offset through the timestamp information for adjustment;after adjustment of node P1, a time message is sent to node P2; time when node P1 sends the time message to node P2 to time when node P2 receives the message is a synchronization cycle of interaction between node P1 and node P2; a process between node P1 and node P2 is repeated for N times to generate N synchronization cycles; after each time two nodes conduct one-way interaction of time information, i.e., one synchronization cycle, node P2 calculates clock frequency offset through the timestamp information for adjustment;in a first synchronization cycle between node A and node P1, node A sends current time information T1,1(A) to node P1, and receiving time T2,1(P1) recorded by P1 is represented as:
  • 7. The cross-network time synchronization method for industrial wireless network and TSN fusion according to claim 6, characterized in that: in step S3, after node P1 receives the time information from reference node A, similarly, node P2 uses node P1 as the reference node, and node P1 sends the time information to node P2; in the first synchronization cycle between node P1 and node P2, node P1 sends current time information T1,1(P1) to node P2, and time when node P2 receives the time information sent by node P1 is denoted as T2,1(P2), which is represented as:
  • 8. The cross-network time synchronization method for industrial wireless network and TSN fusion according to claim 1, characterized in that: in step S4, the node device of the industrial wireless network is used as the master clock, denoted as M; the terminal side conversion node is used as the slave clock, denoted as S; node S periodically sends ordinary data packets to node M; and synchronization information is transferred implicitly by controlling a response time interval Δi of a receiver for a sender; in the ith cycle, sending node S sends an ordinary data packet to receiving node M at time T1,i(S), and receiving node M receives the data packet at time T2,i(M); after waiting for the response time interval Δi, a response message is returned to sending node S at time T3,i(M) and sending node S receives the response message at time T4,i(S); then local receiving and sending time is recorded and stored in a local cache; with repeated processes of receiving and sending node data packets, the node can use the receiving and sending time of the local cache to estimate the clock frequency offset.
  • 9. The cross-network time synchronization method for industrial wireless network and TSN fusion according to claim 8, characterized in that: number of time synchronizations in step S4 is set as N; there is A∈{2,3,4, . . . N−1}; any of prime numbers P, Q and D is taken, where N=P*Q; when (D*E)mod((P−1)*(Q−1))=1 is established, there is Ci=(Ai EXP D)mod N; where 1<i<N; Ci is a generated random number; meanwhile, Ci is used to represent a response time interval Δi that a receiving node needs to wait for in an ith synchronization process; fS and fM are set as crystal oscillator frequencies of node S and node M respectively, and a clock frequency offset
Priority Claims (1)
Number Date Country Kind
CN202111323593.1 Nov 2021 CN national
CROSS-REFERENCE TO RELATED APPLICATIONS

This application claims priority from International Patent Application Serial Number PCT/CN2022/091457, entitled “CROSS-NETWORK TIME SYNCHRONIZATION METHOD FOR INDUSTRIAL WIRELESS NETWORK AND TSN FUSION” and filed on May 7, 2022, which also claims priority to Chinese Patent Application Serial Number CN202111323593.1 and filed on Nov. 8, 2021, which are each hereby incorporated herein by reference in their respective entirety.

PCT Information
Filing Document Filing Date Country Kind
PCT/CN2022/091457 5/7/2022 WO