CN116805892A - Time synchronization method, device, system, storage medium and network equipment - Google Patents

Time synchronization method, device, system, storage medium and network equipment Download PDF

Info

Publication number
CN116805892A
CN116805892A CN202310689569.2A CN202310689569A CN116805892A CN 116805892 A CN116805892 A CN 116805892A CN 202310689569 A CN202310689569 A CN 202310689569A CN 116805892 A CN116805892 A CN 116805892A
Authority
CN
China
Prior art keywords
time synchronization
time
target
message
slave
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310689569.2A
Other languages
Chinese (zh)
Inventor
胥平春
王蒴
孟忠伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Centec Communications Co Ltd
Original Assignee
Suzhou Centec Communications Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Centec Communications Co Ltd filed Critical Suzhou Centec Communications Co Ltd
Priority to CN202310689569.2A priority Critical patent/CN116805892A/en
Publication of CN116805892A publication Critical patent/CN116805892A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0658Clock or time synchronisation among packet nodes
    • H04J3/0661Clock or time synchronisation among packet nodes using timestamps
    • H04J3/0667Bidirectional timestamps, e.g. NTP or PTP for compensation of clock drift and for compensation of propagation delays
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/30Managing network names, e.g. use of aliases or nicknames
    • H04L61/3015Name registration, generation or assignment

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)

Abstract

The application provides a time synchronization method, a time synchronization device, a time synchronization system, a storage medium and network equipment, and relates to the field of communication. Wherein, for each slave device in the system, the master device assigns a target device identification for the slave device; and transmitting the target device identification to the slave device. And the slave equipment receives the target equipment identification sent by the master equipment and records the target equipment identification locally. The master device also transmits a time synchronization message including a target device identifier; receiving a time synchronization message from the equipment; if the time synchronization message comprises the target equipment identifier, responding to the time synchronization message, and keeping the time of the time adjustment of the time synchronization message at the master equipment consistent. In this way, when the master device is communicatively coupled to the plurality of slave devices via the same interface, time synchronization between the master device and the plurality of slave devices is achieved.

Description

Time synchronization method, device, system, storage medium and network equipment
Technical Field
The present application relates to the field of communications, and in particular, to a time synchronization method, apparatus, system, storage medium, and network device.
Background
With the development of network technology, the clock precision requirement of the existing communication network on the equipment is higher and higher. Services such as delay measurement and operation and maintenance analysis are all required to be based on time with high precision, so more and more network devices already support a clock synchronization function based on PTP (Precision Time Protocol ).
The PTP is based on IEEE1588 standard, supports messages such as EtherNet, V4 UPD, V6UDP, MPLS (Multi-Protocol Label Switching ) and the like to be carried, and can support nanosecond precision by utilizing cooperation of bottom hardware and PTP protocol. The PTP system involves three devices, namely OC (normal Clock), BC (Boundary Clock), TC (transparent Clock ); at present, OC equipment serving as a master equipment can perform time synchronization on a plurality of OC equipment serving as slave equipment in a system by means of BC equipment; however, in some application scenarios, the BC device is not present in the system.
Disclosure of Invention
In order to overcome at least one of the disadvantages in the prior art, the present application provides a time synchronization method, apparatus, system, storage medium and network device, which specifically include:
in a first aspect, the present application provides a time synchronization method applied to a master device in a PTP protocol-based time synchronization system, the time synchronization system further including a plurality of slave devices communicatively coupled to the same interface of the master device, the method including:
for each slave device, assigning a target device identification to the slave device;
Transmitting the target equipment identifier to the slave equipment, wherein the target equipment identifier is used for indicating the slave equipment to respond to only a time synchronization message comprising the target equipment identifier;
and sending a time synchronization message comprising the target equipment identifier, so that the slave equipment responds to the time synchronization message and adjusts the time of the slave equipment to be consistent with the time of the master equipment.
With reference to the optional implementation manner of the first aspect, the PTP protocol-based packet includes a sequence field, where a value interval that can be accommodated by the sequence field is divided into a plurality of subintervals, and the allocating a target device identifier to the slave device includes:
if the slave device is detected to be added to the time synchronization system for the first time, selecting an unassigned target subinterval from the multiple subintervals;
and taking any numerical value in the target subinterval as a target equipment identifier of the slave equipment.
With reference to the optional implementation manner of the first aspect, the sending a time synchronization packet including the target device identifier includes:
selecting a first serial number from the target subinterval;
sending a Sync message comprising the first sequence number, and establishing a corresponding relation between the sending time of the Sync message and the first sequence number;
Selecting a second serial number from the target subinterval for the sending time according to the corresponding relation;
transmitting a follow_up message comprising the transmission time and the second sequence number;
if the received delay_req message comprises a third sequence number located in the target subinterval, selecting a fourth sequence number from the target subinterval for the receiving time of the delay_req message;
and sending a delay_resp message comprising the fourth sequence number and the receiving time.
With reference to the optional implementation manner of the first aspect, the master device includes a switching chip, and the sending a Sync message including the first sequence number, and establishing a correspondence between a sending time of the Sync message and the first sequence number, includes:
sending a sampling identifier and a Sync message comprising the first serial number to the exchange chip, wherein the sampling identifier is used for indicating the exchange chip to acquire the sending time of the Sync message and storing the sending time and the first serial number in an associated mode;
and acquiring the transmission time and the first serial number which are stored in an associated way from the exchange chip, and establishing a corresponding relation between the transmission time and the first serial number.
In a second aspect, the present application provides a time synchronization method applied to any slave device in a time synchronization system based on PTP protocol, said time synchronization system further including a master device communicatively connected to a plurality of said slave devices via a communication interface, said method comprising:
receiving a target equipment identifier sent by the main equipment;
recording the target equipment identification locally;
receiving a time synchronization message sent by the master device;
and if the time synchronization message comprises the target equipment identifier, responding to the time synchronization message, and adjusting the time of the time synchronization message to be consistent with the time of the master equipment.
In a third aspect, the present application provides a time synchronization system, which is based on PTP protocol, and includes a master device and a plurality of slave devices communicatively coupled to the same interface of the master device;
for each slave device, the master device allocates a target device identification for the slave device; and transmitting the target device identification to the slave device;
the slave device receives a target device identifier sent by the master device and records the target device identifier locally;
the master device also transmits a time synchronization message including the target device identifier;
The slave device receives the time synchronization message; and if the time synchronization message comprises the target equipment identifier, responding to the time synchronization message, and keeping the time of the time adjustment of the time synchronization message at the master equipment consistent.
In a fourth aspect, the present application provides a time synchronization apparatus for a master device in a PTP protocol based time synchronization system, said time synchronization system further comprising a plurality of slave devices communicatively coupled to the same interface of said master device, said apparatus comprising:
the first identification module is used for distributing target equipment identification for each slave equipment; transmitting the target equipment identifier to the slave equipment, wherein the target equipment identifier is used for indicating the slave equipment to respond to only a time synchronization message comprising the target equipment identifier;
and the first synchronization module is used for sending a time synchronization message comprising the target equipment identifier so that the slave equipment responds to the time synchronization message and adjusts the self time to be consistent with the time of the master equipment.
With reference to the optional implementation manner of the fourth aspect, the PTP protocol-based packet includes a sequence field, where a numerical interval that can be accommodated by the sequence field is divided into a plurality of subintervals, and the first identification module is further configured to:
If the slave device is detected to be added to the time synchronization system for the first time, selecting an unassigned target subinterval from the multiple subintervals;
and taking any numerical value in the target subinterval as a target equipment identifier of the slave equipment.
With reference to the optional implementation manner of the fourth aspect, the first synchronization module is further configured to:
selecting a first serial number from the target subinterval;
sending a Sync message comprising the first sequence number, and establishing a corresponding relation between the sending time of the Sync message and the first sequence number;
selecting a second serial number from the target subinterval for the sending time according to the corresponding relation;
transmitting a follow_up message comprising the transmission time and the second sequence number;
if the received delay_req message comprises a third sequence number located in the target subinterval, selecting a fourth sequence number from the target subinterval for the receiving time of the delay_req message;
and sending a delay_resp message comprising the fourth sequence number and the receiving time.
With reference to the optional implementation manner of the fourth aspect, the master device includes a switch chip, and the first synchronization module is further configured to:
Sending a sampling identifier and a Sync message comprising the first serial number to the exchange chip, wherein the sampling identifier is used for indicating the exchange chip to acquire the sending time of the Sync message and storing the sending time and the first serial number in an associated mode;
and acquiring the transmission time and the first serial number which are stored in an associated way from the exchange chip, and establishing a corresponding relation between the transmission time and the first serial number.
In a fifth aspect, the present application further provides a time synchronization apparatus applied to any slave device in a PTP protocol-based time synchronization system, said time synchronization system further including a master device communicatively coupled to a plurality of said slave devices via a communication interface, said apparatus comprising:
the second identification module is used for receiving the target equipment identification sent by the main equipment; recording the target equipment identification locally;
the second synchronization module is used for receiving the time synchronization message sent by the master device; and if the time synchronization message comprises the target equipment identifier, responding to the time synchronization message, and adjusting the time of the time synchronization message to be consistent with the time of the master equipment.
In a sixth aspect, the present application also provides a storage medium storing a computer program which, when executed by a processor, implements a time synchronization method applied to a master device or a slave device.
In a seventh aspect, the present application also provides a network device, the network device comprising a processor and a memory, the memory storing a computer program which, when executed by the processor, implements a time synchronization method applied to a master device or a slave device.
Compared with the prior art, the application has the following beneficial effects:
the application provides a time synchronization method, a time synchronization device, a time synchronization system, a storage medium and network equipment. Wherein, for each slave device in the system, the master device assigns a target device identification for the slave device; and transmitting the target device identification to the slave device. And the slave equipment receives the target equipment identification sent by the master equipment and records the target equipment identification locally. The master device also transmits a time synchronization message including a target device identifier; receiving a time synchronization message from the equipment; if the time synchronization message comprises the target equipment identifier, responding to the time synchronization message, and keeping the time of the time adjustment of the time synchronization message at the master equipment consistent. In this way, when the master device is communicatively coupled to the plurality of slave devices via the same interface, time synchronization between the master device and the plurality of slave devices is achieved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of a PTP time synchronization principle provided by an embodiment of the present application;
FIG. 2 is a diagram of an existing time synchronization scenario provided by an embodiment of the present application;
FIG. 3 is a timing synchronization scenario of the present application provided by an embodiment of the present application;
FIG. 4 is a flowchart of a time synchronization method according to an embodiment of the present application;
FIG. 5 is a second flowchart of a time synchronization method according to an embodiment of the present application;
FIG. 6 is a schematic diagram of a time synchronization apparatus according to an embodiment of the present application;
FIG. 7 is a second schematic diagram of a time synchronization apparatus according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a network device according to an embodiment of the present application.
Icon: 101A-a first identification module; 102A-a first synchronization module; 101B-a second identification module; 102B-a second synchronization module; 201-a memory; 202-a processor; 203-a communication unit; 204-system bus.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. The components of the embodiments of the present application generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the application, as presented in the figures, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
In the description of the present application, it should be noted that the terms "first," "second," "third," and the like are used merely to distinguish between descriptions and are not to be construed as indicating or implying relative importance. Furthermore, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Based on the above statement, as introduced in the background art, the OC device currently serving as the master needs to use the BC device to perform time synchronization on a plurality of OC devices serving as slaves in the system; however, in some application scenarios, the BC device is not present in the system. In order to facilitate understanding of the solution to be provided in this embodiment, the present embodiment may be explained with reference to specific terms.
The OC, hereinafter referred to as OC device, has only one physical port participating in time synchronization within a communication domain corresponding to the same PTP protocol based time synchronization system. Through this port, the device can act as a Master device (also known as a Master) publishing time to downstream network devices; the time may also be obtained from an upstream network device as a slave device (also known as a slave).
BC, hereinafter referred to as BC device, in a communication domain corresponding to the same PTP protocol based time synchronization system, the device may have a plurality of physical ports to participate in synchronization, at least one port is used as a clock port of the slave device, and the clock is acquired from the upstream network, and all the remaining ports are used as clock ports of the master device to provide clocks to the downstream network.
The TC, hereinafter referred to as TC device, only forwards PTP messages, and corrects the forwarding delay, so that the local clocks of the transparent clock device do not need to be synchronized.
Further, in combination with the above description of the roles of each device in the time synchronization system, the following description is made on the time synchronization process between the master device and the slave device in combination with fig. 1:
1. the master device periodically sends a Sync message and records the accurate time t1 when the message leaves the master clock;
2. receiving a Sync message from the equipment, and recording the accurate time t2 when the Sync message arrives;
3. after the Sync message is sent, the main equipment sends a Follow_up message including an accurate time t1, and analyzes t1 from the Follow_up message;
4. the slave device sends a delay_req message to the master device, and records the accurate time t3 when the delay_req message leaves the slave device;
5. after receiving the delay_req message, the master device sends the precise time t4 when the delay_req message is received to the slave device through delay_resp.
At this time, 4 parameters of t1, t2, t3 and t4 are obtained from the device, and the following expression is satisfied between the parameters under the assumption of symmetric link delay:
where offset represents the time offset between the master and slave, dms represents the link delay of the transmission link between the master and slave, and sm represents the link delay of the transmission link between the slave and master. In the case of symmetric link delays, dms=dsm, the offset can be calculated:
offset=[(t2-t1)-(t4-t3)]/2;
Based on the calculated offset, the slave device can adjust its own time to remain synchronized with the master device.
In connection with the above description of the time synchronization principle, a currently conventional time synchronization scenario is shown in fig. 2, which shows 4 OC devices (OC 1, OC2, OC3, OC 4), 2 BC devices (BC 1, BC 2) and 1 TC device. Wherein, OC1 in 4 OC devices is used as a master device of an original clock source, and OC2, OC3 and OC4 are used as slave devices; any device in the figure is marked with "M" when it is a master device, and marked with "S" when it is a slave device.
With continued reference to fig. 2, the OC1 synchronizes time to the BC1 first, the BC1 synchronizes time to the OC2 and BC2 as the master of OC2 and BC2, and the BC2 then synchronizes time to the OC3 and OC4 as the master of OC2 and BC2, respectively, thereby completing the time synchronization between all the devices. In the figure, except TC equipment, PTP protocol needs to be supported between connected equipment; and, 1 master interface can only time synchronize with 1 slave interface. However, in some scenarios, it is desirable to support 1 master interface link to multiple interfaces of a slave device and time synchronize the multiple slave devices.
As shown in fig. 3, 4 OC devices (OC 1, OC2, OC3, OC 4), 2 BC devices (BC 1, BC 2) and 1 TC device are also shown. Unlike fig. 2, BC1, BC2 in fig. 3 does not support PTP protocol, only TC function. At this time, OC1 is required as a master device, and time synchronization with OC2, OC3, and OC4 is performed simultaneously and directly through one interface. In the current PTP protocol, only 1 master device interface can perform time synchronization with 1 slave device interface, so that OC1 in fig. 2 cannot perform time synchronization on OC2, OC3, and OC4 simultaneously with the same interface; therefore, only BC1, BC2 can be replaced with devices supporting PTP protocol at present.
Based on the findings of the above technical problems, the inventors have made creative efforts to propose the following technical solutions to solve or improve the above problems. It should be noted that the above drawbacks of the prior art solutions and the solutions presented in this embodiment are the results of the inventor after practice and careful study, and therefore, the discovery process of the above problems and the solutions presented in the following embodiments of the present application for the above problems should be all contributions of the inventor to the application during the inventive process, and should not be construed as what is known to those skilled in the art.
In view of this, the present embodiment provides a time synchronization system based on the PTP protocol, including a master device and a plurality of slave devices communicatively linked to the same interface of the master device. For each slave device in the system, the master device assigns a target device identification for the slave device; and transmitting the target device identification to the slave device. And the slave equipment receives the target equipment identification sent by the master equipment and records the target equipment identification locally. The master device also transmits a time synchronization message including a target device identifier; receiving a time synchronization message from the equipment; if the time synchronization message comprises the target equipment identifier, responding to the time synchronization message, and keeping the time of the time adjustment of the time synchronization message at the master equipment consistent. In this way, when the master device is communicatively coupled to the plurality of slave devices via the same interface, time synchronization between the master device and the plurality of slave devices is achieved.
The time synchronization system can be applied to the fields of power systems, industrial automation, telecommunication networks, financial transactions, scientific research tests, information security, mobile communication and the like. For example, in the field of power systems, many devices and processes in a power system rely on accurate time synchronization, and PTP protocols can provide high-precision time synchronization on the order of microseconds to meet the needs of the power system. For another example, in the field of industrial automation, many automation devices and processes in a factory also need to rely on accurate time information to perform synchronous control, and PTP time synchronization systems are widely used in the field of industrial automation. In other fields, this embodiment will not be described in detail.
In order to make the present embodiment clearer, the time synchronization method provided in the present embodiment is described in detail below from the master device side and the slave device side, respectively. It should be understood that the operations of the flow diagrams may be performed out of order and that steps that have no logical context may be performed in reverse order or concurrently. Moreover, one or more other operations may be added to or removed from the flow diagrams by those skilled in the art under the direction of the present disclosure. As shown in fig. 4, the method includes:
S101A, for each slave device, a target device identification is assigned to the slave device.
S102A, the target device identification is sent to the slave device.
Wherein the target device identifier is used for indicating the slave device to only respond to the time synchronization message comprising the target device identifier. The research finds that the PTP protocol-based message comprises a sequence field, the sequence field is 16 bits in total, and the numerical value interval which can be accommodated is 0-65535; when the time synchronization is carried out based on the PTP protocol, only a few times of interaction are needed; thus, the present embodiment divides the entire numerical section into a plurality of subintervals, and each slave device shares one subinterval alone. In the optional implementation manner of step S101, if the master device detects that the slave device joins the time synchronization system for the first time, the master device selects an unallocated target subinterval from the multiple subintervals; and taking any numerical value in the target subinterval as a target device identifier of the slave device.
For example, continuing to take fig. 3 as an example, OC1 serves as a master device, OC2, OC3, and OC4 serve as slave devices, respectively, and if OC2 is detected to join the time synchronization system for the first time, a target subinterval of 0 to 255 is allocated thereto. Similarly, after OC2 is added, if OC3 is detected to be added to the time synchronization system, 256-511 target subintervals are allocated to the time synchronization system. Similarly, after the OC2 and the OC3 are added, if the OC4 is detected to be added into the time synchronization system, a target subinterval of 512-767 is allocated for the time synchronization system. When the OC1 needs to perform time synchronization on the OC3, the sequence number of the sent time synchronization message starts from 256; and after receiving the target equipment identifier allocated by the OC1, the OC3 only responds to the time synchronization messages with the sequence numbers between 256 and 511.
S103A, sending a time synchronization message comprising the target equipment identification.
Thus, the slave device responds to the time synchronization message and adjusts the time of the slave device to be consistent with the time of the master device. Since the multiple subintervals are respectively identified as the target devices of the different slave devices in this embodiment, an optional implementation manner of step S103A includes:
S103A-1, selecting a first serial number from the target subinterval.
Illustratively, continuing to take OC3 in FIG. 3 as an example, OC1 is allocated as a target subinterval for which the master is 512-767; then OC1 may choose 512 as the first sequence number when time synchronizing OC 3.
In conjunction with the above description of the first serial number, step S103A further includes:
S103A-2, sending a Sync message comprising the first sequence number, and establishing a corresponding relation between the sending time of the Sync message and the first sequence number.
It should be understood that the host device includes a processor and a communication unit, where the communication unit includes a switch chip, and the processor needs to send a message to the switch chip first, and then the switch chip sends the message to the network, so that the time spent in the data transfer process from the processor to the switch chip should be removed from the actual sending time of the message. In view of this, the master device sends a sampling identifier and a Sync message including a first sequence number to the exchange chip, where the sampling identifier is used to instruct the exchange chip to collect a sending time of the Sync message, and store the sending time and the first sequence number in an associated manner; and acquiring the transmission time and the first serial number which are stored in an associated way from the exchange chip, and establishing a corresponding relation between the transmission time and the first serial number.
In the PTP protocol, the sampling identifier is denoted as Capture, and the replacement identifier is denoted as Replace. When the processor needs the sending time of the message, the Capture identifier is set when the message is sent. The switching chip provides the sending time of the message to the processor in a processor interrupt mode based on the Capture identifier, and encapsulates the sending time of the message into the message and sends the message into the network together. When the processor does not need the sending time of the message, a replay identifier is set when the message is sent. The exchange chip encapsulates the sending time of the message into the message based on the display identifier and sends the message to the network together.
In addition, the interaction chip is also provided with FIFO queues, considering that the master device needs to maintain context information during interaction with the plurality of slave devices. Therefore, for the Sync message of each slave device, the master device stores the first serial number in the message and the sending time into the FIFO queue, and the processor reads the associated stored first serial number and the sending time from the FIFO queue and establishes the corresponding relation between the first serial number and the sending time. It should be noted that in some embodiments, the master device may include a plurality of ports, and each port manages a plurality of slave devices, so, in order to avoid misselecting a port when sending a message, a corresponding relationship between the first serial number, the sending time and the port identifier may be established and stored by the processor.
In combination with the correspondence between the transmission time and the first sequence number, step S103A further includes:
S103A-3, selecting a second serial number from the target subinterval for the sending time according to the corresponding relation.
S103A-4, a Follow_up message comprising the sending time and the second serial number is sent.
Because the sending time of the Sync message needs to be sent to the slave device through the follow_up message, and the master device manages a plurality of slave devices, in this embodiment, confusion can be avoided through the corresponding relationship between the first sequence number and the sending time.
Taking fig. 3 as an example, for the Sync message of OC2, the sending time is t1 2 A sequence number of 0; in (t 1) 2 0) means the correspondence between the two, wherein the specific implementation mode can store the correspondence between the two through the key value pair way. Similarly, for the Sync message of OC3, the sending time is t1 3 The serial number is 256; in (t 1) 3 256) means that the correspondence between the two is represented; for the Sync message of OC4, the sending time is t1 4 Serial number 512; in (t 1) 3 512) represent the correspondence between the two. Then, when a Follow_up message needs to be sent for OC2, according to (t 1 2 0) can determine that the target subinterval of OC2 is 0-255; thus, a value of 2 is selected therefrom as the second serial number.
S103A-5, if the received Delay_Req message comprises a third sequence number positioned in the target subinterval, selecting a fourth sequence number from the target subinterval for the receiving time of the Delay_Req message.
S103A-6, a delay_Resp message comprising a fourth serial number and a receiving time is sent.
It should be understood that the delay_req message is a response message of the follow_up message, and in this embodiment, the packet is a multicast message based on the PTP protocol, which means that all slave devices located in the multicast domain can receive the follow_up message, and the slave device capable of responding to the follow_up message needs that the first sequence number carried in the follow_up message is located in the target subinterval of the slave device. Therefore, the slave device responding to the follow_up message also needs to select the third sequence number from the target subinterval of the slave device to package the third sequence number into a delay_req message.
For example, continuing to take fig. 3 as an example, when the third sequence number in the received delay_req message is 3, the third sequence number is located between 0 and 255 target subintervals; meaning that the sending object of the delay_req message is OC2, therefore, 4 needs to be selected from 0-255 for the receiving time of the delay_req message as the fourth sequence number, and 4 is encapsulated into a delay_resp message and sent to the multicast domain; thereby enabling OC2 to respond to the Delay Resp message.
The above embodiments introduce a time synchronization method from the side of the master device; the implementation also provides a time synchronization method which is applied to any slave device in the time synchronization system based on the PTP protocol, and the time synchronization system also comprises a master device which is in communication connection with a plurality of slave devices through a communication interface. As shown in fig. 5, the method includes:
S101B, receiving a target device identifier sent by the main device.
S102B, the target equipment identification is recorded locally.
S103B, receiving a time synchronization message sent by the master device.
And S104B, if the time synchronization message comprises the target equipment identifier, responding to the time synchronization message, and adjusting the time of the time synchronization message to be consistent with the time of the master equipment.
For example, continuing to take fig. 3 as an example, when OC1 receives that the target device identifier sent by the master device is 0-255, then 0-255 is recorded locally; when a Sync message, a follow_up message and a delay_Resp message in a multicast domain are received, firstly, the sequence numbers are read from the messages, the read sequence numbers are compared with 0-255, if the sequence numbers are positioned in the interval, the response processing is carried out on the messages, and otherwise, the received time synchronization messages are discarded. In this way, in the case of a plurality of slave devices, each slave device processes only the time synchronization message sent to itself.
Based on the same inventive concept as the above-described time synchronization method applied to the master device, the present embodiment also provides a time synchronization apparatus including at least one software functional module that may be stored in a memory or solidified in the master device in a software form. The processor in the host device is configured to execute the executable modules stored in the memory. For example, a software function module included in the time synchronization apparatus, a computer program, and the like. Referring to fig. 6, functionally divided, the time synchronization apparatus may include:
a first identification module 101A, configured to assign, for each slave device, a target device identification to the slave device; transmitting a target device identifier to the slave device, wherein the target device identifier is used for indicating the slave device to only respond to the time synchronization message comprising the target device identifier;
the first synchronization module 102A is configured to send a time synchronization packet including the target device identifier, so that the slave device responds to the time synchronization packet and adjusts its own time to be consistent with the time of the master device.
In this embodiment, the first identification module 101A is used to implement steps S101A-S102A in fig. 4, and the first synchronization module 102A is used to implement step S103A in fig. 4, and for details of each module, reference may be made to specific embodiments of corresponding steps. It should be noted that, since the same inventive concept is applied to the time synchronization method of the master device, the above modules may also be used to implement other steps or sub-steps of the method.
Similarly, based on the same inventive concept as the above-described time synchronization method applied to the slave device, the present embodiment also provides a time synchronization apparatus, which includes at least one software functional module that may be stored in a memory or solidified in the master device in a software form. The processor in the host device is configured to execute the executable modules stored in the memory. For example, a software function module included in the time synchronization apparatus, a computer program, and the like. Referring to fig. 7, functionally divided, the time synchronization apparatus may include:
a second identification module 101B, configured to receive a target device identifier sent by the master device; recording the target device identification locally;
a second synchronization module 102B, configured to receive a time synchronization packet sent by the master device; if the time synchronization message includes the target equipment identifier, responding to the time synchronization message, and adjusting the time of the time synchronization message to be consistent with the time of the master equipment.
In this embodiment, the second identification module 101B is used to implement steps S101B-S102B in fig. 5, and the second synchronization module 102B is used to implement steps S103B-S104B in fig. 4, and for a detailed description of each module, reference may be made to a specific embodiment of the corresponding steps. It should be noted that, since the same inventive concept is applied to the time synchronization method of the slave device, the above modules may also be used for implementing other steps or sub-steps of the method.
In addition, functional modules in the embodiments of the present application may be integrated together to form a single part, or each module may exist alone, or two or more modules may be integrated to form a single part.
It should also be appreciated that the above embodiments, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored on a computer readable storage medium. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application.
Accordingly, the present embodiment also provides a storage medium storing a computer program which, when executed by a processor, implements the time synchronization method applied to a slave device or the time synchronization method applied to a master device provided by the present embodiment. The computer readable storage medium may be any of various media capable of storing a program code, such as a usb (universal serial bus), a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk.
The embodiment provides a network device. As shown in fig. 8, the network device may include a processor 202 and a memory 201. The memory 201 stores a computer program, and the processor reads and executes the computer program corresponding to the above embodiment in the memory 201 to realize the time synchronization method applied to the slave device or the time synchronization method applied to the master device provided in the present embodiment.
Continuing to refer to fig. 8, the network device further includes a communication unit 203. The memory 201, the processor 202, and the communication unit 203 are electrically connected to each other directly or indirectly through a system bus 204 to achieve data transmission or interaction.
The memory 201 may be an information recording device based on any electronic, magnetic, optical or other physical principle for recording execution instructions, data, etc. In some embodiments, the memory 201 may be, but is not limited to, volatile memory, non-volatile memory, storage drives, and the like.
In some embodiments, the volatile memory may be random access memory (Random Access Memory, RAM); in some embodiments, the non-volatile Memory may be Read Only Memory (ROM), programmable ROM (Programmable Read-Only Memory, PROM), erasable ROM (Erasable Programmable Read-Only Memory, EPROM), electrically erasable ROM (Electric Erasable Programmable Read-Only Memory, EEPROM), flash Memory, or the like; in some embodiments, the storage drive may be a magnetic disk drive, a solid state disk, any type of storage disk (e.g., optical disk, DVD, etc.), or a similar storage medium, or a combination thereof, etc.
The communication unit 203 is used for transmitting and receiving data through a network. In some embodiments, the network may include a wired network, a wireless network, a fiber optic network, a telecommunications network, an intranet, the internet, a local area network (Local Area Network, LAN), a wide area network (Wide Area Network, WAN), a wireless local area network (Wireless Local Area Networks, WLAN), a metropolitan area network (Metropolitan Area Network, MAN), a wide area network (Wide Area Network, WAN), a public switched telephone network (Public Switched Telephone Network, PSTN), a bluetooth network, a ZigBee network, a near field communication (Near Field Communication, NFC) network, or the like, or any combination thereof. In some embodiments, the network may include one or more network access points. For example, the network may include wired or wireless network access points, such as base stations and/or network switching nodes, through which one or more components of the service request processing system may connect to the network to exchange data and/or information.
The processor 202 may be an integrated circuit chip with signal processing capabilities and may include one or more processing cores (e.g., a single-core processor or a multi-core processor). By way of example only, the processors may include a central processing unit (Central Processing Unit, CPU), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a special instruction set Processor (Application Specific Instruction-set Processor, ASIP), a graphics processing unit (Graphics Processing Unit, GPU), a physical processing unit (Physics Processing Unit, PPU), a digital signal Processor (Digital Signal Processor, DSP), a field programmable gate array (Field Programmable Gate Array, FPGA), a programmable logic device (Programmable Logic Device, PLD), a controller, a microcontroller unit, a reduced instruction set computer (Reduced Instruction Set Computing, RISC), a microprocessor, or the like, or any combination thereof.
It should be understood that the apparatus and method disclosed in the above embodiments may be implemented in other manners. The apparatus embodiments described above are merely illustrative, for example, of the flowcharts and block diagrams in the figures that illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The above description is merely illustrative of various embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think about variations or substitutions within the scope of the present application, and the application is intended to be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method of time synchronization for a master device in a PTP protocol based time synchronization system, said time synchronization system further comprising a plurality of slave devices communicatively coupled to a same interface of said master device, said method comprising:
for each slave device, assigning a target device identification to the slave device;
transmitting the target equipment identifier to the slave equipment, wherein the target equipment identifier is used for indicating the slave equipment to respond to only a time synchronization message comprising the target equipment identifier;
and sending a time synchronization message comprising the target equipment identifier, so that the slave equipment responds to the time synchronization message and adjusts the time of the slave equipment to be consistent with the time of the master equipment.
2. The time synchronization method according to claim 1, wherein the PTP protocol-based message includes a sequence field, and a numerical interval that can be accommodated by the sequence field is divided into a plurality of subintervals, and the allocating a target device identifier to the slave device includes:
If the slave device is detected to be added to the time synchronization system for the first time, selecting an unassigned target subinterval from the multiple subintervals;
and taking any numerical value in the target subinterval as a target equipment identifier of the slave equipment.
3. The method of time synchronization according to claim 2, wherein the sending a time synchronization message including the target device identifier includes:
selecting a first serial number from the target subinterval;
sending a Sync message comprising the first sequence number, and establishing a corresponding relation between the sending time of the Sync message and the first sequence number;
selecting a second serial number from the target subinterval for the sending time according to the corresponding relation;
transmitting a follow_up message comprising the transmission time and the second sequence number;
if the received delay_req message comprises a third sequence number located in the target subinterval, selecting a fourth sequence number from the target subinterval for the receiving time of the delay_req message;
and sending a delay_resp message comprising the fourth sequence number and the receiving time.
4. The method of claim 3, wherein the master device includes a switch chip, the sending a Sync message including the first sequence number, and establishing a correspondence between a sending time of the Sync message and the first sequence number, includes:
Sending a sampling identifier and a Sync message comprising the first serial number to the exchange chip, wherein the sampling identifier is used for indicating the exchange chip to acquire the sending time of the Sync message and storing the sending time and the first serial number in an associated mode;
and acquiring the transmission time and the first serial number which are stored in an associated way from the exchange chip, and establishing a corresponding relation between the transmission time and the first serial number.
5. A time synchronization method, applied to any slave device in a PTP protocol-based time synchronization system, said time synchronization system further including a master device communicatively coupled to a plurality of said slave devices via a communication interface, said method comprising:
receiving a target equipment identifier sent by the main equipment;
recording the target equipment identification locally;
receiving a time synchronization message sent by the master device;
and if the time synchronization message comprises the target equipment identifier, responding to the time synchronization message, and adjusting the time of the time synchronization message to be consistent with the time of the master equipment.
6. A time synchronization system, wherein the time synchronization system is based on PTP protocol, and comprises a master device and a plurality of slave devices communicatively connected to the same interface of the master device;
For each slave device, the master device allocates a target device identification for the slave device; and transmitting the target device identification to the slave device;
the slave device receives a target device identifier sent by the master device and records the target device identifier locally;
the master device also transmits a time synchronization message including the target device identifier;
the slave device receives the time synchronization message; and if the time synchronization message comprises the target equipment identifier, responding to the time synchronization message, and keeping the time of the time adjustment of the time synchronization message at the master equipment consistent.
7. A time synchronization apparatus for use with a master device in a PTP protocol based time synchronization system, said time synchronization system further comprising a plurality of slave devices communicatively coupled to a same interface of said master device, said apparatus comprising:
the first identification module is used for distributing target equipment identification for each slave equipment; transmitting the target equipment identifier to the slave equipment, wherein the target equipment identifier is used for indicating the slave equipment to respond to only a time synchronization message comprising the target equipment identifier;
And the first synchronization module is used for sending a time synchronization message comprising the target equipment identifier so that the slave equipment responds to the time synchronization message and adjusts the self time to be consistent with the time of the master equipment.
8. A time synchronization apparatus for use with any slave device in a PTP protocol based time synchronization system, said time synchronization system further comprising a master device communicatively coupled to a plurality of said slave devices via a communication interface, said apparatus comprising:
the second identification module is used for receiving the target equipment identification sent by the main equipment; recording the target equipment identification locally;
the second synchronization module is used for receiving the time synchronization message sent by the master device; and if the time synchronization message comprises the target equipment identifier, responding to the time synchronization message, and adjusting the time of the time synchronization message to be consistent with the time of the master equipment.
9. A storage medium storing a computer program which, when executed by a processor, implements the time synchronization method of any one of claims 1-4 or the time synchronization method of claim 5.
10. A network device comprising a processor and a memory storing a computer program which, when executed by the processor, implements the time synchronization method of any one of claims 1-4 or the time synchronization method of claim 5.
CN202310689569.2A 2023-06-12 2023-06-12 Time synchronization method, device, system, storage medium and network equipment Pending CN116805892A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310689569.2A CN116805892A (en) 2023-06-12 2023-06-12 Time synchronization method, device, system, storage medium and network equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310689569.2A CN116805892A (en) 2023-06-12 2023-06-12 Time synchronization method, device, system, storage medium and network equipment

Publications (1)

Publication Number Publication Date
CN116805892A true CN116805892A (en) 2023-09-26

Family

ID=88079265

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310689569.2A Pending CN116805892A (en) 2023-06-12 2023-06-12 Time synchronization method, device, system, storage medium and network equipment

Country Status (1)

Country Link
CN (1) CN116805892A (en)

Similar Documents

Publication Publication Date Title
US11032056B2 (en) Efficient unicast signaling in a precision time protocol enabled packet network
US10158444B1 (en) Event-driven precision time transfer
EP2817902B1 (en) Method and network node for processing a precision time protocol
EP3758271A1 (en) Communication system, communication device and communication method
EP3016306B1 (en) Method and apparatus for providing in-vehicle network time synchronization using redundant grandmaster
JP2535615B2 (en) Data synchronous transmission system
KR100987389B1 (en) Synchronization method with fixed delay time in network, and bridge adopting the same method
EP2506470A1 (en) Method, apparatus and system for time distribution in a telecommunications network
EP3903454B1 (en) A tsn enabled controller
WO2015196685A1 (en) Clock synchronization method and apparatus
JP6449430B2 (en) Time synchronization method, device and time synchronization server for network device
CN106899370A (en) A kind of clock chain circuit changing method, device and base station
EP1601124B1 (en) Method and apparatus synchronizing clocks of network nodes
CN113572561B (en) Method, apparatus, communication system and medium for clock synchronization
JP5891142B2 (en) Communications system
CN116805892A (en) Time synchronization method, device, system, storage medium and network equipment
WO2012051564A1 (en) Reducing continuity check message (ccm) bursts in connectivity fault management (cfm) maintenance association (ma)
JP6805938B2 (en) Virtual LAN time synchronization method
US20230300068A1 (en) Synchronization in Distributed Communication Systems
WO2022259376A1 (en) Communication schedule allocation device, communication schedule allocation method, and program
US20160309435A1 (en) Segment synchronization method for network based display
CN112953672B (en) System for realizing clock synchronization based on network bridge module
CN114051712B (en) Method for time synchronization in an Ethernet-based network
JP2015207865A (en) synchronization establishing method
EP4387130A1 (en) Time synchronization monitoring method

Legal Events

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