WO2016188026A1 - Time synchronization method and device between primary main board and standby main board - Google Patents

Time synchronization method and device between primary main board and standby main board Download PDF

Info

Publication number
WO2016188026A1
WO2016188026A1 PCT/CN2015/092571 CN2015092571W WO2016188026A1 WO 2016188026 A1 WO2016188026 A1 WO 2016188026A1 CN 2015092571 W CN2015092571 W CN 2015092571W WO 2016188026 A1 WO2016188026 A1 WO 2016188026A1
Authority
WO
WIPO (PCT)
Prior art keywords
control board
main control
packet
time
standby
Prior art date
Application number
PCT/CN2015/092571
Other languages
French (fr)
Chinese (zh)
Inventor
唐明理
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2016188026A1 publication Critical patent/WO2016188026A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L7/00Arrangements for synchronising receiver with transmitter

Definitions

  • the present invention relates to the field of communications, and in particular, to a method and apparatus for time synchronization between an active main control board and a standby main control board.
  • the traditional time synchronization scheme configures a Global Positioning System (GPS) or a BeiDou Navigation Satellite System (BD) device for each base station, so each base station needs to be configured with a time source, which is costly. From the perspective of cost, the use of bearer network to transmit high-precision time synchronization information has become a future development trend. With the continuous evolution of bearer technology, the need for time synchronization networks to provide time synchronization information to telecommunication network operators is becoming more and more urgent.
  • GPS Global Positioning System
  • BD BeiDou Navigation Satellite System
  • the main purpose of the embodiments of the present invention is to provide a method and apparatus for time synchronization between an active main control board and a standby main control board, so as to at least solve the problem of high cost in implementing the time synchronization scheme in the related art.
  • a method for time synchronization between an active main control board and a standby main control board including: an active main control board and a standby main control determined in a state of the main control board
  • the multiple timestamps are sent and received when the PTP packet is sent, and the preset rule is used to calculate the preset time according to the multiple timestamps. Determining a time compensation value between the main control board and the standby main control board; and correcting a time deviation of the standby main control board relative to the main main control board according to the time compensation value.
  • the acquiring, by using the first preset time, the multiple timestamps when sending and receiving the PTP packet includes: receiving, by the standby main control board, the PTP packet sent by the active main control board The first timestamp T1 when the first message is sent and the second timestamp T2 when the first message is received is carried in the first message;
  • the standby main control board sends the second packet in the PTP packet to the main control board, obtain a third timestamp T3 when the second packet is sent, and the standby main control board
  • the fourth timestamp T4 when the third packet is sent in the third packet is obtained.
  • the method further includes: acquiring the state of the main control board every second preset time, where the main control board is the main control board and the main control board is successfully performing the switching. And switching the state of the main control board to the state of the standby main control board; when the main control board is the standby main control board, and the standby main control board successfully performs the switching, the standby main The status of the control board is switched to the status of the active main control board.
  • the state of switching the state of the active main control board to the standby main control board includes: latching a current time stamp of the main control board, and closing the PTP report of the main main control board And sending the second packet to the standby main control board, and triggering the sending of the second packet.
  • the switching the state of the standby main control board to the state of the active main control board includes: latching the current time stamp of the main control board, and closing the PTP report of the standby main control board Sending the text, and stopping the calculation of the compensation value and the trimming of the time offset and modifying the state of the main control board to the standby main control board state; the first message and the third message are Writing to the active main control board, and triggering the sending of the first message and the third message.
  • the second preset time is less than the first preset time.
  • an apparatus for time synchronization between an active main control board and a standby main control board including: an obtaining module, configured as an active main control board determined in a state of the main control board Obtaining a plurality of timestamps when transmitting and receiving the PTP packet every first preset time, and performing a precise time synchronization protocol PTP packet forwarding with the standby main control board;
  • the time stamp uses a preset rule to calculate a time compensation value between the main control board and the standby main control board; and the correction module is configured to correct the standby main control board according to the time compensation value The time deviation of the main control board.
  • the acquiring module includes: a first acquiring unit, configured to acquire, when the standby main control board receives the first packet in the PTP packet sent by the active main control board a first timestamp T1 when the first message is sent and a second timestamp T2 when the first message is received, and a second acquiring unit, configured to be in the standby
  • the main control board sends the second packet in the PTP packet to the main control board, obtains a third timestamp T3 when the second packet is sent
  • the third acquiring unit is configured to be in the standby
  • the main control board acquires a fourth timestamp when the third packet is sent in the third packet. T4.
  • the PTP report is adopted for the main control board and the standby main control board in the main control board. Forwarding the file, and obtaining a plurality of timestamps when the PTP message is sent and received at a preset time, and calculating between the main control board and the standby main control board according to the multiple timestamps and preset rules
  • the time compensation value is used to correct the time deviation of the standby main control board relative to the main control board.
  • the embodiment of the present invention adopts a software method to realize time synchronization, and solves the time synchronization in the related art. The cost of the program is high.
  • FIG. 1 is a flowchart of a method for time synchronization between an active main control board and a standby main control board according to an embodiment of the present invention
  • FIG. 2 is a block diagram showing the structure of a device for time synchronization between an active main control board and an alternate main control board according to an embodiment of the present invention
  • FIG. 3 is a structural block diagram of an apparatus for implementing time synchronization of a standby main control board by using a PTP message according to an optional embodiment of the present invention
  • FIG. 4 is a schematic diagram of a T1, T2, T3, T4 timestamp generation mechanism according to an alternative embodiment of the present invention
  • FIG. 5 is a flow chart of an initial state control method in accordance with an alternative embodiment of the present invention.
  • FIG. 6 is a flow chart of a 1-second timer control in accordance with an alternative embodiment of the present invention.
  • FIG. 7 is a flow diagram of a 100 millisecond timer control in accordance with an alternate embodiment of the present invention.
  • FIG. 1 is a method for time synchronization between the main main control board and the standby main control board according to an embodiment of the invention.
  • Flowchart, as shown in Figure 1, the steps of the method include:
  • Step S102 When the precision time synchronization protocol (PTP) packet is forwarded between the active main control board and the standby main control board, the first preset time is obtained. Multiple timestamps when sending and receiving PTP messages;
  • PTP precision time synchronization protocol
  • Step S104 Calculate a time compensation value between the active main control board and the standby main control board by using a preset rule according to the multiple timestamps;
  • Step S106 Correct the time deviation of the standby main control board relative to the main main control board according to the time compensation value.
  • the PTP packet is forwarded to the main control board and the standby main control board in the main control board, and then the transmission and reception are obtained every first preset time.
  • the multiple timestamps of the PTP packet are calculated according to the multiple timestamps and preset rules, and the time compensation value between the main control board and the standby main control board is calculated, and the compensation value is used to correct the relative main control board.
  • the software uses the software to implement time synchronization, and solves the problem of high cost in implementing the time synchronization scheme in the related art.
  • the method may be implemented as follows:
  • Step S11 When the standby main control board receives the first packet in the PTP packet sent by the active main control board, the first timestamp T1 when the first packet is sent in the first packet is obtained. Receiving a second timestamp T2 when the first message is received;
  • Step S12 When the standby main control board sends the second packet in the PTP packet to the main control board, the third timestamp T3 when the second packet is sent is obtained;
  • Step S13 When the standby main control board receives the third packet in the PTP packet sent by the active main control board, the fourth timestamp T4 when the third packet is sent in the third packet is obtained.
  • the time compensation value can be obtained by:
  • Time delay value [(T2 + T4) - (T1 + T3)] / 2;
  • Time compensation value (T2-T1) - time delay value.
  • the method in this embodiment may further include:
  • Step S22 Acquire the state of the main control board every second preset time.
  • the main control board is the main control board and the main control board successfully performs the switching, the state of the main control board is switched to the standby state. The status of the main control board;
  • Step S23 When the main control board is the standby main control board and the standby main control board successfully performs the switching, the state of the standby main control board is switched to the state of the active main control board.
  • the manner in which the state of the active main control board in the step S22 is switched to the state of the standby main control board can be implemented by: latching the current time stamp of the main control board, and closing the main control board.
  • the PTP packet is sent, and the status of the main control board is changed to the status of the standby main control board.
  • the second packet is written to the standby main control board, and the second packet is sent.
  • the manner of switching the state of the standby main control board to the state of the active main control board in step S23 can be implemented in the following manner: latching the current time stamp of the main control board, and turning off the standby
  • the PTP packet of the main control board is sent, and the calculation of the compensation value and the modification of the time offset are performed, and the state of the main control board is changed to the state of the standby main control board; the first message and the third message are written to the main use.
  • the main control board triggers the sending of the first packet and the third packet.
  • the current time stamp may be latched during the main conversion process of the main control board, and the PTP message of the PTP port is closed by the software, and the PTP is simultaneously The port state modification is switched to the slave state.
  • the delay_req message format is written into the FPGA register by the CPU in advance, and the delay_req message is sent.
  • the current time stamp is latched, and the PTP packet transmission of the PTP port is closed by the software, and the time offset calculation and the offset correction are stopped.
  • the PTP port status is changed to master.
  • the sync and delay_resp message formats are written into the FPGA register by the CPU in advance, and the sync and delay_resp messages are sent.
  • the second preset time involved in the embodiment is less than the first preset time.
  • the second preset time may be 100 milliseconds, and the first preset time is 1 second.
  • the first preset and the second preset value here is merely an example, and may be corresponding according to actual conditions. The value.
  • a device for time synchronization between the main control board and the standby main control board is provided.
  • the device is used to implement the foregoing embodiments and preferred embodiments, and details are not described herein.
  • the term “module” "unit” may implement a combination of software and/or hardware of a predetermined function.
  • the apparatus described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware, is also possible and contemplated.
  • the apparatus includes: an obtaining module 22, which is set in a state of the main control board.
  • the timestamps are sent and received at the first preset time.
  • the correction module 26 is coupled to the calculation module 24 and configured to correct the time deviation of the standby main control board relative to the main control board according to the time compensation value.
  • the obtaining module 22 includes: a first acquiring unit, configured to: when the standby main control board receives the first packet in the PTP packet sent by the active main control board, obtain the sending in the first packet The first timestamp T1 of the first packet and the second timestamp T2 when the first packet is received; the second obtaining unit is configured to send the second of the PTP packets to the main control board on the standby main control board The third timestamp T3 is sent when the second packet is sent, and the third acquiring unit is configured to obtain the third packet in the PTP packet sent by the active main control board when the standby main control board receives the third packet. The fourth timestamp T4 when the third message is sent carried in the third packet.
  • the device may further include: a first switching module, configured to acquire the state of the main control board every second preset time, where the main control board is the main control board and the main control board is performing the switching When the switch is successful, the state of the main control board is switched to the state of the standby main control board.
  • the second switch module is set to be the standby main control board when the main control board is the standby main control board. The status of the control board is switched to the status of the active main control board.
  • the first switching module is configured to latch the current timestamp of the main control board, and disable the sending of the PTP message of the main control board, and modify the state of the main control board to the standby main control board.
  • the second packet is written to the standby main control board, and the second packet is sent.
  • the second switching module is configured to latch the current timestamp of the main control board, and close the sending of the PTP message of the standby main control board, and stop the calculation of the compensation value, the time deviation trimming, and the state of the main control board. Change to the status of the standby main control board; write the first packet and the third packet to the active main control board, and trigger the sending of the first packet and the third packet.
  • the optional embodiment provides a method for realizing time synchronization of the main control board by using a precise time protocol (Precision Time ProTocol PTP) message.
  • a precise time protocol Precision Time ProTocol PTP
  • the standby main control board in order to implement the standby main control board to track the main control clock, ensure that the system reference clocks of the primary and backup boards are the same, and the primary and backup main control boards are respectively virtualized as two PTP ports interacted by the PTP protocol.
  • the physical line can be seen as completely symmetrical, in accordance with the conditions of use of the PTP protocol. Therefore, the active main control board is virtualized into a master port, and the standby main control board is virtualized into a slave port.
  • the Ethernet switching processing chip on the main control board is used to transmit PTP protocol packets.
  • the software calculates the slave side relative to the PTP protocol algorithm. The deviation at the master end is adjusted accordingly.
  • the optional embodiment does not need to support the BMC algorithm, and only needs to configure the master/slave state of the port according to the state of the main control board. Therefore, it is not necessary to construct an announce message to negotiate the master/slave state of the port.
  • FIG. 3 is a structural block diagram of a device for implementing time synchronization of a standby main control board by using a PTP packet according to an optional embodiment of the present invention.
  • the main control board and the standby main control board include: a network switching processing unit, a CPU processing unit, and a Field-Programmed GaTe Array (FPGA) processing unit;
  • FPGA Field-Programmed GaTe Array
  • the function of the Ethernet switching processing unit is performed by a dedicated Ethernet switching processing chip or a CPU to perform PTP packet forwarding processing, and the packet type is identified, and the PTP packet forwarding between the primary and backup boards is completed.
  • the packet congestion time is negligible, so it can be regarded as the packet receiving and sending processing between the main and standby FPGAs on the main control board, and the delay is small, and the obtained synchronization precision is high.
  • the CPU processing unit is configured to create a virtual PTP port after the main control board competes for decision making the primary and backup states, and complete basic parameter configuration.
  • a synchronous packet Synchronous PackeT
  • a delay_resp packet Delay RequesT PackeT, delay request packet
  • a delay_req packet to be sent Delay RequesT PackeT, delay response message
  • the CPU processing is further configured to acquire T1, T2, T3, and T4 timestamps from the FPGA processing unit register on the slave side, calculate a time offset from the main control board according to the algorithm, and write the logic counter of the FPGA processing unit, thereby implementing Track the requirements for the time stamp of the main control board.
  • FIG. 4 is a schematic diagram of a T1, T2, T3, T4 time stamp generation mechanism according to an alternative embodiment of the present invention.
  • a 1 second timer timing reads T1, T2, T3, and T4 time stamps from an FPGA. And complete the OffseT calculation and write the FPGA to complete the time synchronization.
  • the timing time is up, and the FPGA processing unit sends a Sync message by applying a T1 timestamp in the message.
  • the Sync message is received by the FPGA, the message receives the time stamp T2, and the time stamp T1 is extracted in the message.
  • the FPGA immediately sends a delay_req message and puts a T3 timestamp.
  • the delay_req message is received by the FPGA, and the time stamp T4 is recorded; the T4 timestamp is inserted into the delay_resp message and transmitted to the slave; at the slave receiving end, the delay_resp message is received by the FPGA, and the time stamp T4 is extracted; therefore, the slave is
  • the end FPGA processing unit can extract the T1, T2, T3, and T4 time stamps for the CPU processing unit to calculate the time offset.
  • the optional embodiment further relates to another timer, a 100 millisecond timer, which is configured to poll the main board and the standby state of the main control board in real time, and switch the PTP port status and configuration according to the status of the primary and backup states.
  • a 100 millisecond timer configured to poll the main board and the standby state of the main control board in real time, and switch the PTP port status and configuration according to the status of the primary and backup states.
  • the CPU processing unit adopts a 100ms timer and is set to poll the main board and the standby status of the main control board in real time. If the board is currently the main board, the main board is switched. If the switch is not completed, continue to judge whether the switchover occurs; otherwise, the switchover is completed, switch to the standby board state, and obtain the time compensation value. If the board is currently a spare board, spare The master detects that a switchover has occurred, and the switchover is not completed, and continues to determine whether a switchover occurs; otherwise, the switchover is completed, and the time compensation value is obtained.
  • the PTP packet is sent by the software to disable the PTP packet transmission, and the PTP port state is changed to the slave state.
  • the delay_req message format is written into the FPGA register by the CPU in advance, and the delay_req message is sent.
  • the current time stamp is latched, and the PTP packet transmission of the PTP port is closed by the software, and the time offset calculation and the offset correction are stopped.
  • the PTP port status is changed to master.
  • the sync and delay_resp message formats are written into the FPGA register by the CPU in advance, and the sync and delay_resp messages are sent.
  • the physical position of the active and standby main control boards is completely bidirectional. Therefore, the PTP protocol can be applied to the primary and backup boards for time synchronization.
  • the PTP packet is forwarded through the Ethernet switch processing chip to perform PTP packet negotiation, and the time tracking function of the main board and the standby board of the main control board is set.
  • FIG. 5 is a flowchart of an initial state control method according to an alternative embodiment of the present invention. As shown in FIG. 5, the steps of the method include:
  • Step S502 The main control board is powered on
  • Step S504 determining whether the main control board is used, when the determination result is yes, executing step S506, and if the determination result is no, executing step S508;
  • Step S506 The main control board configures a PTP master port (main port) with an agreed port number;
  • Step S508 The standby main control board configures a PTP slave port (secondary port) of the agreed port number.
  • one port state is configured as a master PTP port by default.
  • the one-step method is used in the Ethernet packet encapsulation format.
  • the default interval of the PTP protocol is used to set the interval for the packet to be sent and the delay_resp packet format.
  • the basic parameters of the PTP port are configured as follows:
  • Delay measurement method one-step method
  • Sync message sending interval 0, send one sync packet per second
  • Source port ID pre-assigned port ID
  • the CPU saves the configuration data and status of the PTP port, and sets the time stamp of the PTP port to be polled by the timer. Construct the sync message and delay_resp message format to be sent, and write the FPGA register in advance.
  • the standby main control board is configured with a PTP port and the port status is slave.
  • the basic parameters of the basic PTP port are configured.
  • the Ethernet packet encapsulation format is used in one-step mode.
  • the packet transmission interval is set with the default parameters defined by the PTP protocol.
  • the delay_req message format is pre-written by the CPU into the FPGA registers.
  • the basic parameters of the PTP port are configured as follows:
  • Delay measurement method one-step method
  • Delay_req message sending interval 1, sending 2 packets per second;
  • Source port ID pre-assigned port ID
  • the CPU processing unit saves the configuration data and status of the PTP port, and is used by the timer to poll the time stamp of the PTP port. Constructs the delay_req message format that needs to be sent, which is pre-written into the FPGA register by the CPU.
  • control includes:
  • Step S602 1 second timer time is up;
  • Step S604 determining whether to reserve the main control board; when the determination result is yes, executing step S606, and when the determination result is no, ending;
  • Step S606 Read T1, T2, T3, T4 timestamps from the PFGA processing unit;
  • Step S608 Calculate the time offset compensation value and write it to the FPGA.
  • the slave end may obtain the T1, T2, T3, and T4 time stamps from the FPGA processing unit register, calculate the time deviation from the active main control board according to the algorithm, and write the time to the FPGA processing unit.
  • a logic counter that enables tracking of the time stamp of the active main control board.
  • the FPGA processing unit implements a 1MS timer, and periodically sends PTP packets according to the PTP packet sending frequency configured by the CPU processing unit. In order to achieve fast measurement, the delay and delay mechanism messages are sent and received by the FPGA of the main and standby main control boards.
  • the FPGA processing unit implements a 1MS timer.
  • the FPGA periodically sends PTP packets according to the PTP packet sending frequency configured by the CPU processing unit, and performs a corresponding time stamp.
  • the FPGA filters and resolves the PTP packet of the port and extracts the corresponding time stamp.
  • the CPU processing unit maintains a 1S timer. If the board is the main board and does nothing, the board is a standby board and is not in a swapping state.
  • the pre-agreed PTP slave port is polled, and the timestamp T1 is read from the FPGA.
  • the software calculates OffseT, writes the calculated OffseT to the FPGA processing unit, and the FPGA corrects the slave main control board from time to time synchronization.
  • FIG. 7 is a flowchart of 100 millisecond timer control according to an alternative embodiment of the present invention. As shown in FIG. 7, the control flow includes:
  • Step S702 The 100ms timer expires
  • Step S704 determining whether it is currently used; when the determination is yes, step S706 is performed; if the determination is no, step S714 is performed;
  • Step S706 determining whether the primary transfer is performed, when the determination result is yes, executing step S708; and when the determination result is negative, ending;
  • Step S708 Turn off the PTP packet.
  • Step S710 determining whether the main conversion is completed, when the determination result is yes, executing step S712; if the determination result is no, executing step S704;
  • Step S712 The PTP slave port (secondary port) of the port number of the standby configuration is agreed, and then ends;
  • Step S714 determining whether to prepare the master, if the determination result is yes, executing step S716, and when the determination result is no, ending;
  • Step S716 Turn off the PTP packet.
  • Step S718 determining whether the backup transfer is completed; when the determination is yes, executing step S720, and if the determination result is no, executing step S714;
  • Step S720 The standby configuration appoints the PTP slave port (secondary port) of the port, and then ends.
  • the clock software needs to adopt a 100ms timer, and is set to poll the main board and the standby state of the main control board in real time, and the software completes the switching of the PTP port status according to the primary and backup states and the corresponding configuration. deal with. If the board is currently the main board, the main board is switched. If the switch is not completed, continue to judge whether to switch; otherwise, the switch is completed, switch to the standby board state, and obtain the time compensation value.
  • the standby master detects that a switchover has occurred, and the switchover is not completed, and continues to determine whether to switch; otherwise, the switchover is completed, and the time compensation value is obtained; wherein the main control board is in the active state, the software needs to close the switch.
  • PTP packets are sent on the PTP port. If the primary transition is completed, the PTP port state modification is switched to the slave state. Delay_req by the CPU in advance The message format is written to the FPGA register and the delay_req message is sent. The main control board is switched to the master state. The software first disables the sending of PTP packets on the PTP port. And stop calculating the calculation of time deviation and deviation correction. If the backup master is completed, the status of the PTP port is changed to master. The sync and delay_resp message formats are written into the FPGA register by the CPU in advance, and the sync and delay_resp messages are sent.
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention can take the form of a hardware embodiment, a software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) including computer usable program code.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
  • the PTP packet is forwarded to the main control board and the standby main control board in the main control board, and the PTP message is sent and received every other preset time.
  • a timestamp according to the multiple timestamps and a preset rule, calculating a time compensation value between the main control board and the standby main control board, The compensation value is used to correct the time deviation of the standby main control board with respect to the main control board.
  • the embodiment of the present invention adopts a software method to realize time synchronization, and solves the problem that the implementation of the time synchronization scheme in the related art is costly.

Abstract

Provided are a time synchronization method and a device between a primary main board and a standby main board. The method comprises: when forwarding a precise time synchronization protocol PTP message between an active main board decided from a main board state and a standby main board, acquiring a plurality of time stamps when sending and receiving a PTP message every first pre-set time; computing a time compensation value between the primary main board and the standby main board by adopting a pre-set rule based on the plurality of time stamps; and correcting a time deviation of the standby main board with respect to the primary main board in accordance with the time compensation value. In the present invention, time synchronization is realized by means of software and the problem in the relevant art that the costs of the solution to carry out synchronization are high.

Description

主用主控板与备用主控板之间时间同步的方法及装置Method and device for time synchronization between main main control board and standby main control board 技术领域Technical field
本发明涉及通信领域,具体而言,涉及一种主用主控板与备用主控板之间时间同步的方法及装置。The present invention relates to the field of communications, and in particular, to a method and apparatus for time synchronization between an active main control board and a standby main control board.
背景技术Background technique
传统的时间同步方案为每个基站配置全球定位系统(Global Positionging System简称为GPS)或者北斗卫星导航系统(BeiDou Navigation Satellite System简称为BD)设备,因此每一个基站需要配置一个时间源,成本高昂。从成本方面考虑,采用承载网网络传输高精度的时间同步信息成为未来的发展趋势。随着承载技术的不断演进,时间同步网向电信网络运营商提供时间同步信息的需求越来越迫切。The traditional time synchronization scheme configures a Global Positioning System (GPS) or a BeiDou Navigation Satellite System (BD) device for each base station, so each base station needs to be configured with a time source, which is costly. From the perspective of cost, the use of bearer network to transmit high-precision time synchronization information has become a future development trend. With the continuous evolution of bearer technology, the need for time synchronization networks to provide time synchronization information to telecommunication network operators is becoming more and more urgent.
针对相关技术中实现时间同步的方案成本高昂的问题,目前尚未提出有效的解决方案。In view of the high cost of implementing the time synchronization scheme in the related art, an effective solution has not been proposed yet.
发明内容Summary of the invention
本发明实施例的主要目的在于提供一种主用主控板与备用主控板之间时间同步的方法及装置,以至少解决相关技术中实现时间同步的方案成本高昂的问题。The main purpose of the embodiments of the present invention is to provide a method and apparatus for time synchronization between an active main control board and a standby main control board, so as to at least solve the problem of high cost in implementing the time synchronization scheme in the related art.
根据本发明实施例的一个方面,提供了一种主用主控板与备用主控板之间时间同步的方法,包括:在主控板状态中决策出的主用主控板与备用主控板之间进行精确时间同步协议PTP报文转发时,每隔第一预设时间获取发送与接收所述PTP报文时的多个时间戳;基于所述多个时间戳采用预设规则计算所述主用主控板与所述备用主控板之间的时间补偿值;依据所述时间补偿值修正所述备用主控板相对于所述主用主控板的时间偏差。According to an aspect of the embodiments of the present invention, a method for time synchronization between an active main control board and a standby main control board is provided, including: an active main control board and a standby main control determined in a state of the main control board When the PTP packet is forwarded between the boards, the multiple timestamps are sent and received when the PTP packet is sent, and the preset rule is used to calculate the preset time according to the multiple timestamps. Determining a time compensation value between the main control board and the standby main control board; and correcting a time deviation of the standby main control board relative to the main main control board according to the time compensation value.
可选地,每隔第一预设时间获取发送与接收所述PTP报文时的多个时间戳包括:在所述备用主控板接收所述主用主控板发送的所述PTP报文中的第一报文时,获取所述第一报文中携带的在发送所述第一报文时的第一时间戳T1以及在接收所述第一报文时的第二时间戳T2;在所述备用主控板向所述主控板发送所述PTP报文中的第二报文时,获取发送所述第二报文时的第三时间戳T3;在所述备用主控板接收所述主用主控板发送的所述PTP报文中的第三报文时,获取所述第三报文中携带的在发送所述第三报文时的第四时间戳T4。 Optionally, the acquiring, by using the first preset time, the multiple timestamps when sending and receiving the PTP packet includes: receiving, by the standby main control board, the PTP packet sent by the active main control board The first timestamp T1 when the first message is sent and the second timestamp T2 when the first message is received is carried in the first message; When the standby main control board sends the second packet in the PTP packet to the main control board, obtain a third timestamp T3 when the second packet is sent, and the standby main control board When receiving the third packet in the PTP packet sent by the active main control board, the fourth timestamp T4 when the third packet is sent in the third packet is obtained.
可选地,通过以下方式获取所述时间补偿值包括:时间延迟值=[(T2+T4)-(T1+T3)]/2;所述时间补偿值=(T2-T1)-时间延迟值。Optionally, obtaining the time compensation value by: time delay value=[(T2+T4)−(T1+T3)]/2; the time compensation value=(T2-T1)−time delay value .
可选地,所述方法还包括:每隔第二预设时间获取所述主控板的状态,在所述主控板为主用主控板且所述主用主控板在执行倒换成功时,将所述主用主控板的状态切换到备用主控板的状态;在所述主控板为备用主控板且所述备用主控板在执行倒换成功时,将所述备用主控板的状态切换到主用主控板的状态。Optionally, the method further includes: acquiring the state of the main control board every second preset time, where the main control board is the main control board and the main control board is successfully performing the switching. And switching the state of the main control board to the state of the standby main control board; when the main control board is the standby main control board, and the standby main control board successfully performs the switching, the standby main The status of the control board is switched to the status of the active main control board.
可选地,所述主用主控板的状态切换到备用主控板的状态包括:锁存所述主用主控板当前时间戳,并关闭所述主用主控板的所述PTP报文的发送,并将所述主控板的状态修改为备用主控板状态;将所述第二报文写入所述备用主控板中,并触发所述第二报文的发送。Optionally, the state of switching the state of the active main control board to the standby main control board includes: latching a current time stamp of the main control board, and closing the PTP report of the main main control board And sending the second packet to the standby main control board, and triggering the sending of the second packet.
可选地,将所述备用主控板的状态切换到主用主控板的状态包括:锁存所述主用主控板当前时间戳,并关闭所述备用主控板的所述PTP报文的发送,并停止所述补偿值的计算以及所述时间偏差的修整以及将所述主控板的状态修改为备用主控板状态;将所述第一报文和所述第三报文写入所述主用主控板中,并触发所述第一报文和所述第三报文的发送。Optionally, the switching the state of the standby main control board to the state of the active main control board includes: latching the current time stamp of the main control board, and closing the PTP report of the standby main control board Sending the text, and stopping the calculation of the compensation value and the trimming of the time offset and modifying the state of the main control board to the standby main control board state; the first message and the third message are Writing to the active main control board, and triggering the sending of the first message and the third message.
可选地,所述第二预设时间小于所述第一预设时间。Optionally, the second preset time is less than the first preset time.
根据本发明的另一个方面,提供了一种主用主控板与备用主控板之间时间同步的装置,包括:获取模块,设置为在主控板状态中决策出的主用主控板与备用主控板之间进行精确时间同步协议PTP报文转发时,每隔第一预设时间获取发送与接收所述PTP报文时的多个时间戳;计算模块,设置为基于所述多个时间戳采用预设规则计算所述主用主控板与所述备用主控板之间的时间补偿值;修正模块,设置为依据所述时间补偿值修正所述备用主控板相对于所述主用主控板的时间偏差。According to another aspect of the present invention, an apparatus for time synchronization between an active main control board and a standby main control board is provided, including: an obtaining module, configured as an active main control board determined in a state of the main control board Obtaining a plurality of timestamps when transmitting and receiving the PTP packet every first preset time, and performing a precise time synchronization protocol PTP packet forwarding with the standby main control board; The time stamp uses a preset rule to calculate a time compensation value between the main control board and the standby main control board; and the correction module is configured to correct the standby main control board according to the time compensation value The time deviation of the main control board.
可选地,所述获取模块包括:第一获取单元,设置为在所述备用主控板接收所述主用主控板发送的所述PTP报文中的第一报文时,获取所述第一报文中携带的在发送所述第一报文时的第一时间戳T1以及在接收所述第一报文时的第二时间戳T2;第二获取单元,设置为在所述备用主控板向所述主控板发送所述PTP报文中的第二报文时,获取发送所述第二报文时的第三时间戳T3;第三获取单元,设置为在所述备用主控板接收所述主用主控板发送的所述PTP报文中的第三报文时,获取所述第三报文中携带的在发送所述第三报文时的第四时间戳T4。Optionally, the acquiring module includes: a first acquiring unit, configured to acquire, when the standby main control board receives the first packet in the PTP packet sent by the active main control board a first timestamp T1 when the first message is sent and a second timestamp T2 when the first message is received, and a second acquiring unit, configured to be in the standby When the main control board sends the second packet in the PTP packet to the main control board, obtains a third timestamp T3 when the second packet is sent, and the third acquiring unit is configured to be in the standby When receiving the third packet in the PTP packet sent by the active main control board, the main control board acquires a fourth timestamp when the third packet is sent in the third packet. T4.
可选地,通过以下方式获取所述时间补偿值包括:时间延迟值=[(T2+T4)-(T1+T3)]/2;所述时间补偿值=(T2-T1)-时间延迟值。Optionally, obtaining the time compensation value by: time delay value=[(T2+T4)−(T1+T3)]/2; the time compensation value=(T2-T1)−time delay value .
通过本发明实施例,对于主控板中状态为主用主控板和备用主控板,采用PTP报 文的转发,进而每隔第一预设时间获取发送与接收该PTP报文时的多个时间戳,根据该多个时间戳以及预设规则计算出用主控板与备用主控板之间的时间补偿值,通过该补偿值来修正备用主控板相对于主用主控板的时间偏差,可见本发明实施例采用了软件的方式来实现时间的同步,解决了相关技术中实现时间同步的方案成本高昂的问题。In the embodiment of the present invention, the PTP report is adopted for the main control board and the standby main control board in the main control board. Forwarding the file, and obtaining a plurality of timestamps when the PTP message is sent and received at a preset time, and calculating between the main control board and the standby main control board according to the multiple timestamps and preset rules The time compensation value is used to correct the time deviation of the standby main control board relative to the main control board. The embodiment of the present invention adopts a software method to realize time synchronization, and solves the time synchronization in the related art. The cost of the program is high.
附图说明DRAWINGS
此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:The drawings described herein are intended to provide a further understanding of the invention, and are intended to be a part of the invention. In the drawing:
图1是根据本发明实施例的主用主控板与备用主控板之间时间同步的方法的流程图;1 is a flowchart of a method for time synchronization between an active main control board and a standby main control board according to an embodiment of the present invention;
图2是根据本发明实施例的主用主控板与备用主控板之间时间同步的装置结构框图;2 is a block diagram showing the structure of a device for time synchronization between an active main control board and an alternate main control board according to an embodiment of the present invention;
图3是根据本发明可选实施例的通过PTP报文实现备、主用主控板时间同步的的装置结构框图;3 is a structural block diagram of an apparatus for implementing time synchronization of a standby main control board by using a PTP message according to an optional embodiment of the present invention;
图4是根据本发明可选实施例的T1,T2,T3,T4时戳产生机制的示意图;4 is a schematic diagram of a T1, T2, T3, T4 timestamp generation mechanism according to an alternative embodiment of the present invention;
图5是根据本发明可选实施例的初始状态控制方法的流程图;5 is a flow chart of an initial state control method in accordance with an alternative embodiment of the present invention;
图6是根据本发明可选实施例的1秒定时器控制的流程图;6 is a flow chart of a 1-second timer control in accordance with an alternative embodiment of the present invention;
图7是根据本发明可选实施例的100毫秒定时器控制的流程图。7 is a flow diagram of a 100 millisecond timer control in accordance with an alternate embodiment of the present invention.
具体实施方式detailed description
需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本发明。It should be noted that the embodiments in the present application and the features in the embodiments may be combined with each other without conflict. The invention will be described in detail below with reference to the drawings in conjunction with the embodiments.
在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行,并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。The steps illustrated in the flowchart of the figures may be performed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, may differ from this The steps shown are performed in the order shown or described.
本实施例提供了一种主用主控板与备用主控板之间时间同步的方法,图1是根据本发明实施例的主用主控板与备用主控板之间时间同步的方法的流程图,如图1所示,该方法的步骤包括: The embodiment provides a method for time synchronization between the main main control board and the standby main control board, and FIG. 1 is a method for time synchronization between the main main control board and the standby main control board according to an embodiment of the invention. Flowchart, as shown in Figure 1, the steps of the method include:
步骤S102:在主控板状态中决策出的主用主控板与备用主控板之间进行精确时间同步协议(Precision Time Protocol简称为PTP)报文转发时,每隔第一预设时间获取发送与接收PTP报文时的多个时间戳;Step S102: When the precision time synchronization protocol (PTP) packet is forwarded between the active main control board and the standby main control board, the first preset time is obtained. Multiple timestamps when sending and receiving PTP messages;
步骤S104:基于多个时间戳采用预设规则计算主用主控板与备用主控板之间的时间补偿值;Step S104: Calculate a time compensation value between the active main control board and the standby main control board by using a preset rule according to the multiple timestamps;
步骤S106:依据时间补偿值修正备用主控板相对于主用主控板的时间偏差。Step S106: Correct the time deviation of the standby main control board relative to the main main control board according to the time compensation value.
通过本实施例中的上述步骤S102至步骤S106,对于主控板中状态为主用主控板和备用主控板,采用PTP报文的转发,进而每隔第一预设时间获取发送与接收该PTP报文时的多个时间戳,根据该多个时间戳以及预设规则计算出用主控板与备用主控板之间的时间补偿值,通过该补偿值来修正备用主控板相对于主用主控板的时间偏差,可见本实施例采用了软件的方式来实现时间的同步,解决了相关技术中实现时间同步的方案成本高昂的问题。With the above-mentioned steps S102 to S106 in the embodiment, the PTP packet is forwarded to the main control board and the standby main control board in the main control board, and then the transmission and reception are obtained every first preset time. The multiple timestamps of the PTP packet are calculated according to the multiple timestamps and preset rules, and the time compensation value between the main control board and the standby main control board is calculated, and the compensation value is used to correct the relative main control board. In the time deviation of the main control board, it can be seen that the software uses the software to implement time synchronization, and solves the problem of high cost in implementing the time synchronization scheme in the related art.
对于本实施例中涉及到的每隔第一预设时间获取发送与接收PTP报文时的多个时间戳的方式,在本实施例的一个可选实施方式中,可以通过如下方式来实现:For the manner of obtaining multiple timestamps for sending and receiving PTP packets at the first preset time involved in this embodiment, in an optional implementation manner of this embodiment, the method may be implemented as follows:
步骤S11:在备用主控板接收主用主控板发送的PTP报文中的第一报文时,获取第一报文中携带的在发送第一报文时的第一时间戳T1以及在接收第一报文时的第二时间戳T2;Step S11: When the standby main control board receives the first packet in the PTP packet sent by the active main control board, the first timestamp T1 when the first packet is sent in the first packet is obtained. Receiving a second timestamp T2 when the first message is received;
步骤S12:在备用主控板向主控板发送PTP报文中的第二报文时,获取发送第二报文时的第三时间戳T3;Step S12: When the standby main control board sends the second packet in the PTP packet to the main control board, the third timestamp T3 when the second packet is sent is obtained;
步骤S13:在备用主控板接收主用主控板发送的PTP报文中的第三报文时,获取第三报文中携带的在发送第三报文时的第四时间戳T4。Step S13: When the standby main control board receives the third packet in the PTP packet sent by the active main control board, the fourth timestamp T4 when the third packet is sent in the third packet is obtained.
基于上述时间戳,可以通过以下方式获取时间补偿值包括:Based on the above timestamp, the time compensation value can be obtained by:
时间延迟值=[(T2+T4)-(T1+T3)]/2;Time delay value = [(T2 + T4) - (T1 + T3)] / 2;
时间补偿值=(T2-T1)-时间延迟值。Time compensation value = (T2-T1) - time delay value.
需要说明的是,上述基于时间戳获取时间补偿值的方式,仅仅是用来进行举例说明的,其他通过获取时间戳而得到时间补偿值的方式也是在本发明的保护范围之内。It should be noted that the manner of obtaining the time compensation value based on the timestamp is only used for exemplification, and other ways of obtaining the time compensation value by acquiring the timestamp are also within the protection scope of the present invention.
在本实施例的另一个可选实施方式中,本实施例的方法还可以还包括:In another optional implementation manner of this embodiment, the method in this embodiment may further include:
步骤S22:每隔第二预设时间获取主控板的状态,在主控板为主用主控板且主用主控板在执行倒换成功时,将主用主控板的状态切换到备用主控板的状态; Step S22: Acquire the state of the main control board every second preset time. When the main control board is the main control board and the main control board successfully performs the switching, the state of the main control board is switched to the standby state. The status of the main control board;
步骤S23:在主控板为备用主控板且备用主控板在执行倒换成功时,将备用主控板的状态切换到主用主控板的状态。Step S23: When the main control board is the standby main control board and the standby main control board successfully performs the switching, the state of the standby main control board is switched to the state of the active main control board.
其中,步骤S22中的主用主控板的状态切换到备用主控板的状态的方式,可以通过如下方式来实现:锁存主用主控板当前时间戳,并关闭主用主控板的PTP报文的发送,并将主控板的状态修改为备用主控板状态;将第二报文写入备用主控板中,并触发第二报文的发送。The manner in which the state of the active main control board in the step S22 is switched to the state of the standby main control board can be implemented by: latching the current time stamp of the main control board, and closing the main control board. The PTP packet is sent, and the status of the main control board is changed to the status of the standby main control board. The second packet is written to the standby main control board, and the second packet is sent.
步骤S23中的将备用主控板的状态切换到主用主控板的状态的方式,在本实施例的方式可以通过如下方式来实现:锁存主用主控板当前时间戳,并关闭备用主控板的PTP报文的发送,并停止补偿值的计算以及时间偏差的修整以及将主控板的状态修改为备用主控板状态;将第一报文和第三报文写入主用主控板中,并触发第一报文和第三报文的发送。The manner of switching the state of the standby main control board to the state of the active main control board in step S23 can be implemented in the following manner: latching the current time stamp of the main control board, and turning off the standby The PTP packet of the main control board is sent, and the calculation of the compensation value and the modification of the time offset are performed, and the state of the main control board is changed to the state of the standby main control board; the first message and the third message are written to the main use. The main control board triggers the sending of the first packet and the third packet.
对于上述步骤S22和步骤S23,在本实施例的一个应用场景中可以是:主控板主转备过程中,锁存当前时间戳,由软件关闭该PTP端口的PTP报文发送,同时将PTP端口状态修改切换为slave状态。由CPU预先将delay_req报文格式写入FPGA寄存器中,并启动发送delay_req报文。For the above-mentioned step S22 and step S23, in an application scenario of the embodiment, the current time stamp may be latched during the main conversion process of the main control board, and the PTP message of the PTP port is closed by the software, and the PTP is simultaneously The port state modification is switched to the slave state. The delay_req message format is written into the FPGA register by the CPU in advance, and the delay_req message is sent.
主控板备转主过程中,锁存当前时间戳,由软件关闭该PTP端口PTP报文的发送,并停止时间偏差计算及偏差修正。同时将该PTP端口状态修改为master。由CPU预先将sync及delay_resp报文格式写入FPGA寄存器中,并启动sync及delay_resp报文发送。During the main process of the main control board, the current time stamp is latched, and the PTP packet transmission of the PTP port is closed by the software, and the time offset calculation and the offset correction are stopped. At the same time, the PTP port status is changed to master. The sync and delay_resp message formats are written into the FPGA register by the CPU in advance, and the sync and delay_resp messages are sent.
此外,需要说明的是,对于本实施例的中涉及到的第二预设时间小于第一预设时间。例如,该第二预设时间可以是100毫秒,而第一预设时间为1秒,当然对于第一预设和第二预设的取值,这里仅仅是举例说明,可以根据实际情况进行相应的取值。In addition, it should be noted that the second preset time involved in the embodiment is less than the first preset time. For example, the second preset time may be 100 milliseconds, and the first preset time is 1 second. Of course, for the first preset and the second preset value, here is merely an example, and may be corresponding according to actual conditions. The value.
在本实施例中还提供了一种主用主控板与备用主控板之间时间同步的装置,该装置用于实现上述实施例及优选实施方式,已经进行过说明的不再赘述。如以下所使用的,术语“模块”“单元”可以实现预定功能的软件和/或硬件的组合。尽管以下实施例所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。In this embodiment, a device for time synchronization between the main control board and the standby main control board is provided. The device is used to implement the foregoing embodiments and preferred embodiments, and details are not described herein. As used below, the term "module" "unit" may implement a combination of software and/or hardware of a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware, is also possible and contemplated.
图2是根据本发明实施例的主用主控板与备用主控板之间时间同步的装置结构框图,如图2所示,该装置包括:获取模块22,设置为在主控板状态中决策出的主用主控板与备用主控板之间进行精确时间同步协议PTP报文转发时,每隔第一预设时间获取发送与接收PTP报文时的多个时间戳;计算模块24,与获取模块22耦合连接,设置为基于多个时间戳采用预设规则计算主用主控板与备用主控板之间的时间补偿值; 修正模块26,与计算模块24耦合连接,设置为依据时间补偿值修正备用主控板相对于主用主控板的时间偏差。2 is a structural block diagram of a device for time synchronization between an active main control board and a standby main control board according to an embodiment of the present invention. As shown in FIG. 2, the apparatus includes: an obtaining module 22, which is set in a state of the main control board. When the PRM packet is forwarded between the active main control board and the standby main control board, the timestamps are sent and received at the first preset time. And being coupled to the obtaining module 22, configured to calculate a time compensation value between the main control board and the standby main control board by using a preset rule according to the multiple timestamps; The correction module 26 is coupled to the calculation module 24 and configured to correct the time deviation of the standby main control board relative to the main control board according to the time compensation value.
可选地,获取模块22包括:第一获取单元,设置为在备用主控板接收主用主控板发送的PTP报文中的第一报文时,获取第一报文中携带的在发送第一报文时的第一时间戳T1以及在接收第一报文时的第二时间戳T2;第二获取单元,设置为在备用主控板向主控板发送PTP报文中的第二报文时,获取发送第二报文时的第三时间戳T3;第三获取单元,设置为在备用主控板接收主用主控板发送的PTP报文中的第三报文时,获取第三报文中携带的在发送第三报文时的第四时间戳T4。Optionally, the obtaining module 22 includes: a first acquiring unit, configured to: when the standby main control board receives the first packet in the PTP packet sent by the active main control board, obtain the sending in the first packet The first timestamp T1 of the first packet and the second timestamp T2 when the first packet is received; the second obtaining unit is configured to send the second of the PTP packets to the main control board on the standby main control board The third timestamp T3 is sent when the second packet is sent, and the third acquiring unit is configured to obtain the third packet in the PTP packet sent by the active main control board when the standby main control board receives the third packet. The fourth timestamp T4 when the third message is sent carried in the third packet.
可选地,通过以下方式获取时间补偿值包括:时间延迟值=[(T2+T4)-(T1+T3)]/2;时间补偿值=(T2-T1)-时间延迟值。Optionally, obtaining the time compensation value by: time delay value=[(T2+T4)−(T1+T3)]/2; time compensation value=(T2-T1)−time delay value.
可选地,本装置还可以包括:第一切换模块,设置为每隔第二预设时间获取主控板的状态,在主控板为主用主控板且主用主控板在执行倒换成功时,将主用主控板的状态切换到备用主控板的状态;第二切换模块,设置为在主控板为备用主控板且备用主控板在执行倒换成功时,将备用主控板的状态切换到主用主控板的状态。Optionally, the device may further include: a first switching module, configured to acquire the state of the main control board every second preset time, where the main control board is the main control board and the main control board is performing the switching When the switch is successful, the state of the main control board is switched to the state of the standby main control board. The second switch module is set to be the standby main control board when the main control board is the standby main control board. The status of the control board is switched to the status of the active main control board.
可选地,该第一切换模块,设置为锁存主用主控板当前时间戳,并关闭主用主控板的PTP报文的发送,并将主控板的状态修改为备用主控板状态;将第二报文写入备用主控板中,并触发第二报文的发送。Optionally, the first switching module is configured to latch the current timestamp of the main control board, and disable the sending of the PTP message of the main control board, and modify the state of the main control board to the standby main control board. The second packet is written to the standby main control board, and the second packet is sent.
该第二切换模块,设置为锁存主用主控板当前时间戳,并关闭备用主控板的PTP报文的发送,并停止补偿值的计算以及时间偏差的修整以及将主控板的状态修改为备用主控板状态;将第一报文和第三报文写入主用主控板中,并触发第一报文和第三报文的发送。The second switching module is configured to latch the current timestamp of the main control board, and close the sending of the PTP message of the standby main control board, and stop the calculation of the compensation value, the time deviation trimming, and the state of the main control board. Change to the status of the standby main control board; write the first packet and the third packet to the active main control board, and trigger the sending of the first packet and the third packet.
下面结合本发明的可选实施例对本发明进行举例说明;The invention is exemplified below in conjunction with an alternative embodiment of the invention;
本可选实施例提供了一种通过精确时间协议(Precision Time ProTocol简称为PTP)报文实现备、主用主控板时间同步的方法。The optional embodiment provides a method for realizing time synchronization of the main control board by using a precise time protocol (Precision Time ProTocol PTP) message.
在本可选实施例为了实现备用主控板跟踪主用主控时钟,确保主、备板的系统参考时钟相同,将主、备用主控板分别虚拟为PTP协议交互的两个PTP端口,在物理线路上可以看成完全对称的,符合PTP协议使用条件。因此将主用主控板虚拟成一个master端口,备用主控板虚拟成一个slave端口,使用主控板上的以太网交换处理芯片传递PTP协议报文,由软件根据PTP协议算法计算slave端相对于master端的偏差,进而进行调整。可见本可选实施例不需要支持BMC算法,只需根据主控板状态配置端口的master/slave状态,因此不需要构造announce报文进行协商端口的master/slave状态。 In this alternative embodiment, in order to implement the standby main control board to track the main control clock, ensure that the system reference clocks of the primary and backup boards are the same, and the primary and backup main control boards are respectively virtualized as two PTP ports interacted by the PTP protocol. The physical line can be seen as completely symmetrical, in accordance with the conditions of use of the PTP protocol. Therefore, the active main control board is virtualized into a master port, and the standby main control board is virtualized into a slave port. The Ethernet switching processing chip on the main control board is used to transmit PTP protocol packets. The software calculates the slave side relative to the PTP protocol algorithm. The deviation at the master end is adjusted accordingly. It can be seen that the optional embodiment does not need to support the BMC algorithm, and only needs to configure the master/slave state of the port according to the state of the main control board. Therefore, it is not necessary to construct an announce message to negotiate the master/slave state of the port.
图3是根据本发明可选实施例的通过PTP报文实现备、主用主控板时间同步的的装置结构框图,如图3所示,主用主控板与备用主控板包括:以太网交换处理单元、CPU处理单元及现场可编程门阵列(Field-Programmade GaTe Array简称为FPGA)处理单元;FIG. 3 is a structural block diagram of a device for implementing time synchronization of a standby main control board by using a PTP packet according to an optional embodiment of the present invention. As shown in FIG. 3, the main control board and the standby main control board include: a network switching processing unit, a CPU processing unit, and a Field-Programmed GaTe Array (FPGA) processing unit;
该以太网交换处理单元的功能由专用的以太网交换处理芯片或者CPU完成PTP报文转发处理,并识别出报文类型,完成主、备用板之间的PTP报文转发,需要说明的是,在本可选实施例中报文拥塞时间可以忽略不计,因此可以看成主控板主备FPGA之间的报文收、发处理,延时小,得到的同步精度高。The function of the Ethernet switching processing unit is performed by a dedicated Ethernet switching processing chip or a CPU to perform PTP packet forwarding processing, and the packet type is identified, and the PTP packet forwarding between the primary and backup boards is completed. In this alternative embodiment, the packet congestion time is negligible, so it can be regarded as the packet receiving and sending processing between the main and standby FPGAs on the main control board, and the delay is small, and the obtained synchronization precision is high.
该CPU处理单元,设置为在主控板竞争决策出主、备用状态之后,创建虚拟PTP端口,完成基本的参数配置。其中,在master端,构造需要发送的sync报文(Synchronous PackeT,同步报文)及delay_resp报文(Delay RequesT PackeT,延时请求报文);在slave端口,构造需要发送的delay_req报文(Delay RequesT PackeT,延时响应报文),并写到FPGA处理单元寄存器,且使能各报文发送。The CPU processing unit is configured to create a virtual PTP port after the main control board competes for decision making the primary and backup states, and complete basic parameter configuration. On the master side, construct a synchronous packet (Synchronous PackeT) and a delay_resp packet (Delay RequesT PackeT, delay request packet); on the slave port, construct a delay_req packet to be sent (Delay) RequesT PackeT, delay response message), and write to the FPGA processing unit register, and enable each message to send.
该CPU处理还设置为在slave端从FPGA处理单元寄存器获取T1、T2、T3、T4时间戳,根据算法计算相对于主用主控板的时间偏差,并写入FPGA处理单元逻辑计数器,从而实现跟踪主用主控板时间戳的要求。The CPU processing is further configured to acquire T1, T2, T3, and T4 timestamps from the FPGA processing unit register on the slave side, calculate a time offset from the main control board according to the algorithm, and write the logic counter of the FPGA processing unit, thereby implementing Track the requirements for the time stamp of the main control board.
图4是根据本发明可选实施例的T1,T2,T3,T4时戳产生机制的示意图,如图4所示,1秒定时器定时从FPGA中读取T1,T2,T3,T4时戳,并完成OffseT计算并写FPGA完成时间同步,具体地,在master发送端,定时时间到,由FPGA处理单元在报文中打上T1时戳发送Sync报文。在slave接收端,由FPGA接收Sync报文,打报文接收时戳T2,并在报文中提取出时戳T1。另外在接收到sync报文后,FPGA立即发送delay_req报文,打上T3时戳。在master接收端,由FPGA接收delay_req报文,记录时戳T4;并将T4时戳插入delay_resp报文传递给slave;在slave接收端,由FPGA接收delay_resp报文,提取出时戳T4;因此slave端FPGA处理单元可以提取T1、T2、T3、T4时戳,供CPU处理单元计算时间偏差。4 is a schematic diagram of a T1, T2, T3, T4 time stamp generation mechanism according to an alternative embodiment of the present invention. As shown in FIG. 4, a 1 second timer timing reads T1, T2, T3, and T4 time stamps from an FPGA. And complete the OffseT calculation and write the FPGA to complete the time synchronization. Specifically, at the master transmitting end, the timing time is up, and the FPGA processing unit sends a Sync message by applying a T1 timestamp in the message. At the slave receiving end, the Sync message is received by the FPGA, the message receives the time stamp T2, and the time stamp T1 is extracted in the message. In addition, after receiving the sync message, the FPGA immediately sends a delay_req message and puts a T3 timestamp. At the master receiving end, the delay_req message is received by the FPGA, and the time stamp T4 is recorded; the T4 timestamp is inserted into the delay_resp message and transmitted to the slave; at the slave receiving end, the delay_resp message is received by the FPGA, and the time stamp T4 is extracted; therefore, the slave is The end FPGA processing unit can extract the T1, T2, T3, and T4 time stamps for the CPU processing unit to calculate the time offset.
本可选实施例还涉及到另一种定时器,100毫秒定时器,该100毫秒定时器设置为实时轮询主控板主、备状态,根据主、备状态变化切换PTP端口状态及配置,而在主控倒换过程中,在主控板双主或双备状态只锁存倒换前的时间戳,停止时间偏差计算及偏差修正。The optional embodiment further relates to another timer, a 100 millisecond timer, which is configured to poll the main board and the standby state of the main control board in real time, and switch the PTP port status and configuration according to the status of the primary and backup states. In the main control switching process, only the time stamp before the switching is latched in the dual-master or dual-standby state of the main control board, and the time deviation calculation and the deviation correction are stopped.
其中,CPU处理单元采用一个100ms定时器,设置为实时轮询主控板主、备状态。若本板当前是主用板,主用板发生倒换,如果倒换未完成,继续判断是否发生倒换;否则倒换完成,切换到备用板状态,获取时间补偿值。若本板当前是是备用板,备用 主控检测到发生倒换,且倒换未完成,继续判断是否发生倒换;否则倒换完成,获取时间补偿值。The CPU processing unit adopts a 100ms timer and is set to poll the main board and the standby status of the main control board in real time. If the board is currently the main board, the main board is switched. If the switch is not completed, continue to judge whether the switchover occurs; otherwise, the switchover is completed, switch to the standby board state, and obtain the time compensation value. If the board is currently a spare board, spare The master detects that a switchover has occurred, and the switchover is not completed, and continues to determine whether a switchover occurs; otherwise, the switchover is completed, and the time compensation value is obtained.
其中,主控板主转备过程中,锁存当前时间戳,由软件关闭该PTP端口的PTP报文发送,同时将PTP端口状态修改切换为slave状态。由CPU预先将delay_req报文格式写入FPGA寄存器中,并启动发送delay_req报文。The PTP packet is sent by the software to disable the PTP packet transmission, and the PTP port state is changed to the slave state. The delay_req message format is written into the FPGA register by the CPU in advance, and the delay_req message is sent.
主控板备转主过程中,锁存当前时间戳,由软件关闭该PTP端口PTP报文的发送,并停止时间偏差计算及偏差修正。同时将该PTP端口状态修改为master。由CPU预先将sync及delay_resp报文格式写入FPGA寄存器中,并启动sync及delay_resp报文发送。During the main process of the main control board, the current time stamp is latched, and the PTP packet transmission of the PTP port is closed by the software, and the time offset calculation and the offset correction are stopped. At the same time, the PTP port status is changed to master. The sync and delay_resp message formats are written into the FPGA register by the CPU in advance, and the sync and delay_resp messages are sent.
通过上述本可选实施例可知,主、备主控板物理位置上完全是双向对称的,因此可以将PTP协议应用在主、备板时间同步。通过以太网交换处理芯片进行PTP报文转发,进行PTP报文协商,设置为完成主控板主、备板时间跟踪功能。According to the foregoing optional embodiment, the physical position of the active and standby main control boards is completely bidirectional. Therefore, the PTP protocol can be applied to the primary and backup boards for time synchronization. The PTP packet is forwarded through the Ethernet switch processing chip to perform PTP packet negotiation, and the time tracking function of the main board and the standby board of the main control board is set.
下面结合附图对本可选实施例进行详细的说明;The optional embodiment will be described in detail below with reference to the accompanying drawings;
图5是根据本发明可选实施例的初始状态控制方法的流程图,如图5所示,该方法的步骤包括:FIG. 5 is a flowchart of an initial state control method according to an alternative embodiment of the present invention. As shown in FIG. 5, the steps of the method include:
步骤S502:主控板上电;Step S502: The main control board is powered on;
步骤S504:判断是否主用主控板,在判断结果为是时执行步骤S506,在判断结果为否时,执行步骤S508;Step S504: determining whether the main control board is used, when the determination result is yes, executing step S506, and if the determination result is no, executing step S508;
步骤S506:主用主控板配置约定端口号的PTP master端口(主端口);Step S506: The main control board configures a PTP master port (main port) with an agreed port number;
步骤S508:备用主控板配置约定端口号的PTP slave端口(次端口)。Step S508: The standby main control board configures a PTP slave port (secondary port) of the agreed port number.
需要说明的是,本可选实施例中的主用主控板,默认配置一个端口状态为master PTP端口。配置基本PTP端口基本参数,采用一步法,使用以太报文封装格式,报文发送间隔采用PTP协议定义的默认参数,构造需要发送的sync报文及delay_resp报文格式。It should be noted that, in the optional main control board in this alternative embodiment, one port state is configured as a master PTP port by default. Configure the basic parameters of the basic PTP port. The one-step method is used in the Ethernet packet encapsulation format. The default interval of the PTP protocol is used to set the interval for the packet to be sent and the delay_resp packet format.
该PTP端口的基本参数配置如下:The basic parameters of the PTP port are configured as follows:
延迟测量方式:一步法;Delay measurement method: one-step method;
PTP协议包格式:1588OverETH;PTP protocol packet format: 1588OverETH;
Sync消息发送间隔:0,每秒发送一个sync包;Sync message sending interval: 0, send one sync packet per second;
源端口ID:预先分配好的端口ID; Source port ID: pre-assigned port ID;
CPU保存该PTP端口的配置数据及状态,设置为定时器轮询该PTP端口的时戳。构造需要发送的sync报文及delay_resp报文格式,预先写FPGA寄存器。The CPU saves the configuration data and status of the PTP port, and sets the time stamp of the PTP port to be polled by the timer. Construct the sync message and delay_resp message format to be sent, and write the FPGA register in advance.
备用主控板,配置一个PTP端口,端口状态为slave,配置基本PTP端口基本参数,采用一步法使用以太报文封装格式,报文发送间隔采用PTP协议定义的默认参数,配置端口识别信息。delay_req报文格式由CPU预先写入FPGA寄存器中。The standby main control board is configured with a PTP port and the port status is slave. The basic parameters of the basic PTP port are configured. The Ethernet packet encapsulation format is used in one-step mode. The packet transmission interval is set with the default parameters defined by the PTP protocol. The delay_req message format is pre-written by the CPU into the FPGA registers.
该PTP端口的基本参数配置如下:The basic parameters of the PTP port are configured as follows:
延迟测量方式:一步法;Delay measurement method: one-step method;
PTP协议包格式:1588OverETH;PTP protocol packet format: 1588OverETH;
delay_req消息发送间隔:1,每秒发送2个包;Delay_req message sending interval: 1, sending 2 packets per second;
源端口ID:预先分配好的端口ID;Source port ID: pre-assigned port ID;
CPU处理单元保存该PTP端口的配置数据及状态,用于定时器轮询该PTP端口的时戳。构造需要发送的delay_req报文格式,由CPU预先写进FPGA寄存器。The CPU processing unit saves the configuration data and status of the PTP port, and is used by the timer to poll the time stamp of the PTP port. Constructs the delay_req message format that needs to be sent, which is pre-written into the FPGA register by the CPU.
图6是根据本发明可选实施例的1秒定时器控制的流程图,如图6所示,该控制包括:6 is a flow chart of a 1-second timer control according to an alternative embodiment of the present invention. As shown in FIG. 6, the control includes:
步骤S602:1秒定时器时间到;Step S602: 1 second timer time is up;
步骤S604:判断是否备用主控板;在判断结果为是时,执行步骤S606,在判断结果为否时,结束;Step S604: determining whether to reserve the main control board; when the determination result is yes, executing step S606, and when the determination result is no, ending;
步骤S606:从PFGA处理单元读取T1,T2,T3,T4时间戳;Step S606: Read T1, T2, T3, T4 timestamps from the PFGA processing unit;
步骤S608:计算时间offset补偿值,并写入FPGA。Step S608: Calculate the time offset compensation value and write it to the FPGA.
对于上述图6中的控制流程,具体可以是slave端从FPGA处理单元寄存器获取T1、T2、T3、T4时戳,根据算法计算相对于主用主控板的时间偏差,并写入FPGA处理单元逻辑计数器,从而实现跟踪主用主控板时间戳的要求。其中,FPGA处理单元实现一个1MS定时器,根据CPU处理单元配置的PTP报文发送频率定时发送PTP报文。为了实现快速测量,delay延时机制报文的收发都分别由主、备主控板的FPGA来实现。FPGA处理单元实现一个1MS定时器,在发送端口,FPGA根据CPU处理单元配置的PTP报文发送频率定时发送PTP报文,打相应时戳。在接收端,FPGA过滤并解决该端口的PTP报文,提取相应时戳。For the control flow in FIG. 6 above, the slave end may obtain the T1, T2, T3, and T4 time stamps from the FPGA processing unit register, calculate the time deviation from the active main control board according to the algorithm, and write the time to the FPGA processing unit. A logic counter that enables tracking of the time stamp of the active main control board. The FPGA processing unit implements a 1MS timer, and periodically sends PTP packets according to the PTP packet sending frequency configured by the CPU processing unit. In order to achieve fast measurement, the delay and delay mechanism messages are sent and received by the FPGA of the main and standby main control boards. The FPGA processing unit implements a 1MS timer. At the transmitting port, the FPGA periodically sends PTP packets according to the PTP packet sending frequency configured by the CPU processing unit, and performs a corresponding time stamp. At the receiving end, the FPGA filters and resolves the PTP packet of the port and extracts the corresponding time stamp.
CPU处理单元维护一个1S定时器,若本板为主用板,不作任何处理,本主板是备用板且不为倒换状态,轮询预先约定的PTP slave端口,从FPGA中读取时间戳T1、 T2、T3及T4;根据下面两个表达式,计算Delay与OffseT的值。The CPU processing unit maintains a 1S timer. If the board is the main board and does nothing, the board is a standby board and is not in a swapping state. The pre-agreed PTP slave port is polled, and the timestamp T1 is read from the FPGA. T2, T3, and T4; Calculate the values of Delay and OffseT according to the following two expressions.
Delay=[(T2+T4)-(T1+T3)]/2Delay=[(T2+T4)-(T1+T3)]/2
OffseT=(T2-T1)-DelayOffseT=(T2-T1)-Delay
软件计算OffseT,将计算的OffseT写入FPGA处理单元,由FPGA来修正备用主控板从时间,达到时间同步的目的。The software calculates OffseT, writes the calculated OffseT to the FPGA processing unit, and the FPGA corrects the slave main control board from time to time synchronization.
图7是根据本发明可选实施例的100毫秒定时器控制的流程图,如图7所示,该控制流程包括:FIG. 7 is a flowchart of 100 millisecond timer control according to an alternative embodiment of the present invention. As shown in FIG. 7, the control flow includes:
步骤S702:100ms定时器时间到;Step S702: The 100ms timer expires;
步骤S704:判断当前是否主用;在判断为是时执行步骤S706,在判断为否时,执行步骤S714;Step S704: determining whether it is currently used; when the determination is yes, step S706 is performed; if the determination is no, step S714 is performed;
步骤S706:判断是否主转备,在判断结果为是时,执行步骤S708;在判断结果为否时结束;Step S706: determining whether the primary transfer is performed, when the determination result is yes, executing step S708; and when the determination result is negative, ending;
步骤S708:关闭PTP报文;Step S708: Turn off the PTP packet.
步骤S710:判断是否主转备完成,在判断结果为是时执行步骤S712;在判断结果为否时,执行步骤S704;Step S710: determining whether the main conversion is completed, when the determination result is yes, executing step S712; if the determination result is no, executing step S704;
步骤S712:备用配置约定端口号的PTP slave端口(次端口),然后结束;Step S712: The PTP slave port (secondary port) of the port number of the standby configuration is agreed, and then ends;
步骤S714:判断是否备转主,在判断结果为是时,执行步骤S716,在判断结果为否时,结束;Step S714: determining whether to prepare the master, if the determination result is yes, executing step S716, and when the determination result is no, ending;
步骤S716:关闭PTP报文;Step S716: Turn off the PTP packet.
步骤S718:判断是否备转注完成;在判断为是时,执行步骤S720,在判断结果为否时,执行步骤S714;Step S718: determining whether the backup transfer is completed; when the determination is yes, executing step S720, and if the determination result is no, executing step S714;
步骤S720:备用配置约定端口的PTP slave端口(次端口),然后结束。Step S720: The standby configuration appoints the PTP slave port (secondary port) of the port, and then ends.
对于图7中的控制过程,具体可以是:时钟软件需要采用一个100ms定时器,设置为实时轮询主控板主、备状态,软件根据主、备状态完成PTP端口状态的切换及相应配置的处理。若本板当前是主用板,主用板发生倒换,如果倒换未完成,继续判断是否倒换;否则倒换完成,切换到备用板状态,获取时间补偿值。若本板当前是是备用板,备用主控检测到发生倒换,且倒换未完成,继续判断是否倒换;否则倒换完成,获取时间补偿值;其中,主控板主转备状态,软件需要关闭该PTP端口的PTP报文发送。若主转备完成,则将PTP端口状态修改切换为slave状态。由CPU预先将delay_req 报文格式写入FPGA寄存器中,并启动发送delay_req报文。主控板备转主状态,软件首先关闭该PTP端口PTP报文的发送。并停止计算时间偏差的计算及偏差修正。若备转主完成,则将该PTP端口状态修改为master。由CPU预先将sync及delay_resp报文格式写入FPGA寄存器中,并启动sync及delay_resp报文发送。For the control process in FIG. 7, the clock software needs to adopt a 100ms timer, and is set to poll the main board and the standby state of the main control board in real time, and the software completes the switching of the PTP port status according to the primary and backup states and the corresponding configuration. deal with. If the board is currently the main board, the main board is switched. If the switch is not completed, continue to judge whether to switch; otherwise, the switch is completed, switch to the standby board state, and obtain the time compensation value. If the board is currently a standby board, the standby master detects that a switchover has occurred, and the switchover is not completed, and continues to determine whether to switch; otherwise, the switchover is completed, and the time compensation value is obtained; wherein the main control board is in the active state, the software needs to close the switch. PTP packets are sent on the PTP port. If the primary transition is completed, the PTP port state modification is switched to the slave state. Delay_req by the CPU in advance The message format is written to the FPGA register and the delay_req message is sent. The main control board is switched to the master state. The software first disables the sending of PTP packets on the PTP port. And stop calculating the calculation of time deviation and deviation correction. If the backup master is completed, the status of the PTP port is changed to master. The sync and delay_resp message formats are written into the FPGA register by the CPU in advance, and the sync and delay_resp messages are sent.
可见,通过本可选实施例能有效实现备用主控板跟踪主用主控板时间的功能。It can be seen that the function of the standby main control board to track the time of the main control board can be effectively realized by the optional embodiment.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用硬件实施例、软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器和光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention can take the form of a hardware embodiment, a software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) including computer usable program code.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (system), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine for the execution of instructions for execution by a processor of a computer or other programmable data processing device. Means for implementing the functions specified in one or more of the flow or in a block or blocks of the flow chart.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。The computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device. The apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device. The instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
上述仅为本发明的可选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above is only an alternative embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes can be made to the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and scope of the present invention are intended to be included within the scope of the present invention.
工业实用性Industrial applicability
通过本发明实施例,对于主控板中状态为主用主控板和备用主控板,采用PTP报文的转发,进而每隔第一预设时间获取发送与接收该PTP报文时的多个时间戳,根据该多个时间戳以及预设规则计算出用主控板与备用主控板之间的时间补偿值,通过该 补偿值来修正备用主控板相对于主用主控板的时间偏差,可见本发明实施例采用了软件的方式来实现时间的同步,解决了相关技术中实现时间同步的方案成本高昂的问题。 In the embodiment of the present invention, the PTP packet is forwarded to the main control board and the standby main control board in the main control board, and the PTP message is sent and received every other preset time. a timestamp, according to the multiple timestamps and a preset rule, calculating a time compensation value between the main control board and the standby main control board, The compensation value is used to correct the time deviation of the standby main control board with respect to the main control board. The embodiment of the present invention adopts a software method to realize time synchronization, and solves the problem that the implementation of the time synchronization scheme in the related art is costly.

Claims (10)

  1. 一种主用主控板与备用主控板之间时间同步的方法,包括:A method for time synchronization between an active main control board and an alternate main control board includes:
    在主控板状态中决策出的主用主控板与备用主控板之间进行精确时间同步协议PTP报文转发时,每隔第一预设时间获取发送与接收所述PTP报文时的多个时间戳;When the PTP packet is forwarded between the active main control board and the standby main control board in the state of the main control board, the PTP message is sent and received every first preset time. Multiple timestamps;
    基于所述多个时间戳采用预设规则计算所述主用主控板与所述备用主控板之间的时间补偿值;Calculating, according to the plurality of timestamps, a time compensation value between the active main control board and the standby main control board by using a preset rule;
    依据所述时间补偿值修正所述备用主控板相对于所述主用主控板的时间偏差。And correcting a time deviation of the standby main control board relative to the main main control board according to the time compensation value.
  2. 根据权利要求1所述的方法,其中,每隔第一预设时间获取发送与接收所述PTP报文时的多个时间戳包括:The method of claim 1, wherein the obtaining, by the first preset time, the multiple timestamps when sending and receiving the PTP message comprises:
    在所述备用主控板接收所述主用主控板发送的所述PTP报文中的第一报文时,获取所述第一报文中携带的在发送所述第一报文时的第一时间戳T1以及在接收所述第一报文时的第二时间戳T2;And receiving, by the standby main control board, the first packet in the PTP packet sent by the active main control board, acquiring, when the first packet is sent in the first packet, a first timestamp T1 and a second timestamp T2 when the first message is received;
    在所述备用主控板向所述主控板发送所述PTP报文中的第二报文时,获取发送所述第二报文时的第三时间戳T3;When the standby main control board sends the second packet in the PTP packet to the main control board, obtain a third timestamp T3 when the second packet is sent;
    在所述备用主控板接收所述主用主控板发送的所述PTP报文中的第三报文时,获取所述第三报文中携带的在发送所述第三报文时的第四时间戳T4。And receiving, by the standby main control board, the third packet in the PTP packet sent by the active main control board, acquiring the third packet carried in the third packet when the third packet is sent The fourth time stamp T4.
  3. 根据权利要求2所述的方法,其中,通过以下方式获取所述时间补偿值包括:The method according to claim 2, wherein the obtaining the time compensation value by:
    时间延迟值=[(T2+T4)-(T1+T3)]/2;Time delay value = [(T2 + T4) - (T1 + T3)] / 2;
    所述时间补偿值=(T2-T1)-时间延迟值。The time compensation value = (T2-T1) - time delay value.
  4. 根据权利要求2所述的方法,其中,所述方法还包括:The method of claim 2, wherein the method further comprises:
    每隔第二预设时间获取所述主控板的状态,在所述主控板为主用主控板且所述主用主控板在执行倒换成功时,将所述主用主控板的状态切换到备用主控板的状态;Acquiring the state of the main control board every second preset time. When the main control board is the main control board and the main control board is successfully performing the switching, the main control board is used. The state is switched to the state of the standby main control board;
    在所述主控板为备用主控板且所述备用主控板在执行倒换成功时,将所述备用主控板的状态切换到主用主控板的状态。When the main control board is the standby main control board and the standby main control board successfully performs the switching, the state of the standby main control board is switched to the state of the active main control board.
  5. 根据权利要求4所述的方法,其中,所述主用主控板的状态切换到备用主控板的状态包括: The method according to claim 4, wherein the state of switching the state of the active main control board to the standby main control board comprises:
    锁存所述主用主控板当前时间戳,并关闭所述主用主控板的所述PTP报文的发送,并将所述主控板的状态修改为备用主控板状态;The current timestamp of the main control board is latched, and the sending of the PTP message of the main control board is turned off, and the state of the main control board is changed to the state of the standby main control board;
    将所述第二报文写入所述备用主控板中,并触发所述第二报文的发送。Writing the second packet to the standby main control board, and triggering the sending of the second packet.
  6. 根据权利要求4所述的方法,其中,将所述备用主控板的状态切换到主用主控板的状态包括:The method according to claim 4, wherein the switching the state of the standby main control board to the state of the active main control board comprises:
    锁存所述主用主控板当前时间戳,并关闭所述备用主控板的所述PTP报文的发送,并停止所述补偿值的计算以及所述时间偏差的修整以及将所述主控板的状态修改为备用主控板状态;And latching the current timestamp of the active main control board, and turning off the sending of the PTP message of the standby main control board, and stopping the calculation of the compensation value and the trimming of the time deviation and the main The status of the control board is changed to the status of the standby main control board.
    将所述第一报文和所述第三报文写入所述主用主控板中,并触发所述第一报文和所述第三报文的发送。And writing the first packet and the third packet to the active main control board, and triggering the sending of the first packet and the third packet.
  7. 根据权利要求4所述的方法,其中,所述第二预设时间小于所述第一预设时间。The method of claim 4, wherein the second preset time is less than the first preset time.
  8. 一种主用主控板与备用主控板之间时间同步的装置,包括:A device for time synchronization between an active main control board and an alternate main control board, comprising:
    获取模块,设置为在主控板状态中决策出的主用主控板与备用主控板之间进行精确时间同步协议PTP报文转发时,每隔第一预设时间获取发送与接收所述PTP报文时的多个时间戳;The obtaining module is configured to obtain the transmission and reception of the PTP packet at the first preset time when the PTP packet is forwarded between the active main control board and the standby main control board that is determined in the state of the main control board. Multiple timestamps when PTP packets are sent;
    计算模块,设置为基于所述多个时间戳采用预设规则计算所述主用主控板与所述备用主控板之间的时间补偿值;a calculation module, configured to calculate a time compensation value between the active main control board and the standby main control board by using a preset rule according to the multiple time stamps;
    修正模块,设置为依据所述时间补偿值修正所述备用主控板相对于所述主用主控板的时间偏差。And a correction module, configured to correct a time deviation of the standby main control board relative to the main main control board according to the time compensation value.
  9. 根据权利要求8所述的装置,其中,所述获取模块包括:The apparatus of claim 8, wherein the obtaining module comprises:
    第一获取单元,设置为在所述备用主控板接收所述主用主控板发送的所述PTP报文中的第一报文时,获取所述第一报文中携带的在发送所述第一报文时的第一时间戳T1以及在接收所述第一报文时的第二时间戳T2;The first obtaining unit is configured to: when the standby main control board receives the first packet in the PTP packet sent by the active main control board, obtain the sending station carried in the first packet a first timestamp T1 when the first message is described and a second timestamp T2 when the first message is received;
    第二获取单元,设置为在所述备用主控板向所述主控板发送所述PTP报文中的第二报文时,获取发送所述第二报文时的第三时间戳T3;The second obtaining unit is configured to: when the standby main control board sends the second packet in the PTP packet to the main control board, obtain a third timestamp T3 when the second packet is sent;
    第三获取单元,设置为在所述备用主控板接收所述主用主控板发送的所述PTP报文中的第三报文时,获取所述第三报文中携带的在发送所述第三报文时的第四时间戳T4。And the third acquiring unit is configured to: when the standby main control board receives the third packet in the PTP packet sent by the active main control board, acquire the sending station carried in the third packet The fourth timestamp T4 when the third message is described.
  10. 根据权利要求9所述的装置,其中,通过以下方式获取所述时间补偿值包括: The apparatus according to claim 9, wherein the obtaining the time compensation value by:
    时间延迟值=[(T2+T4)-(T1+T3)]/2;Time delay value = [(T2 + T4) - (T1 + T3)] / 2;
    所述时间补偿值=(T2-T1)-时间延迟值。 The time compensation value = (T2-T1) - time delay value.
PCT/CN2015/092571 2015-05-22 2015-10-22 Time synchronization method and device between primary main board and standby main board WO2016188026A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510269107.0 2015-05-22
CN201510269107.0A CN106301745A (en) 2015-05-22 2015-05-22 The method and device of time synchronized between main control board and slave control board

Publications (1)

Publication Number Publication Date
WO2016188026A1 true WO2016188026A1 (en) 2016-12-01

Family

ID=57392570

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/092571 WO2016188026A1 (en) 2015-05-22 2015-10-22 Time synchronization method and device between primary main board and standby main board

Country Status (2)

Country Link
CN (1) CN106301745A (en)
WO (1) WO2016188026A1 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112311621A (en) * 2020-10-15 2021-02-02 新华三技术有限公司合肥分公司 Communication detection method and device
CN113162813A (en) * 2020-01-22 2021-07-23 烽火通信科技股份有限公司 PTP message loss detection analysis method and device
CN113839816A (en) * 2021-09-23 2021-12-24 新华三信息安全技术有限公司 Wiring device and fault switching method thereof
CN114598639A (en) * 2022-01-28 2022-06-07 新华三技术有限公司合肥分公司 Message processing method and device
CN116436555A (en) * 2023-06-09 2023-07-14 新华三技术有限公司 Time synchronization method and device and distributed network equipment

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106851817A (en) * 2017-02-20 2017-06-13 成都物梦工场信息技术有限公司 A kind of high-accuracy clock synchronization method between base station

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101425961A (en) * 2007-10-31 2009-05-06 华为技术有限公司 Method for implementing link state database synchronization, router, circuit board and main control board
CN101483540A (en) * 2008-01-11 2009-07-15 上海博达数据通信有限公司 Master-slave switching method in high class data communication equipment
CN102098155A (en) * 2011-03-18 2011-06-15 北京国智恒电力管理科技有限公司 Method for realizing sub-microsecond synchronization accuracy based on PTP (Precision Time Protocol)
US20120275501A1 (en) * 2011-04-27 2012-11-01 Sergiu Rotenstein Pluggable synchronization clocks, networks, systems and methods related thereto
CN102781090A (en) * 2012-06-28 2012-11-14 华为技术有限公司 Multimode base station and implementation method

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101242419B1 (en) * 2009-07-20 2013-03-12 한국전자통신연구원 Time synchronization apparatus based on parallel processing technique
CN102013931B (en) * 2009-09-08 2015-04-01 中兴通讯股份有限公司 Time synchronization method and system, salve timing device and main timing device
JP5576747B2 (en) * 2010-09-06 2014-08-20 株式会社日立製作所 Communication system and time synchronization method
CN103763056A (en) * 2013-12-31 2014-04-30 电信科学技术第五研究所 Method for time synchronization high-precision remote monitoring

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101425961A (en) * 2007-10-31 2009-05-06 华为技术有限公司 Method for implementing link state database synchronization, router, circuit board and main control board
CN101483540A (en) * 2008-01-11 2009-07-15 上海博达数据通信有限公司 Master-slave switching method in high class data communication equipment
CN102098155A (en) * 2011-03-18 2011-06-15 北京国智恒电力管理科技有限公司 Method for realizing sub-microsecond synchronization accuracy based on PTP (Precision Time Protocol)
US20120275501A1 (en) * 2011-04-27 2012-11-01 Sergiu Rotenstein Pluggable synchronization clocks, networks, systems and methods related thereto
CN102781090A (en) * 2012-06-28 2012-11-14 华为技术有限公司 Multimode base station and implementation method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
CHEN, HUAJIN ET AL.: "New Mechanism of Realizing Time-Synchronization in LAN by Using CPU Time Stamp", JOURNAL OF COMPUTER APPLICATIONS, vol. 29, no. 11, 1 November 2009 (2009-11-01), ISSN: 1001-9081 *
CHU, YINGJUN ET AL.: "An Implementation Method of IEEE 1588 Time Synchronization Technology Based on Hardware Timestamping", MODERN TRANSMISSION, vol. 1, no. 1, 15 February 2011 (2011-02-15), ISSN: 1673-5137 *

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113162813A (en) * 2020-01-22 2021-07-23 烽火通信科技股份有限公司 PTP message loss detection analysis method and device
CN113162813B (en) * 2020-01-22 2022-06-03 烽火通信科技股份有限公司 PTP message loss detection analysis method and device
CN112311621A (en) * 2020-10-15 2021-02-02 新华三技术有限公司合肥分公司 Communication detection method and device
CN112311621B (en) * 2020-10-15 2022-05-24 新华三技术有限公司合肥分公司 Communication detection method and device
CN113839816A (en) * 2021-09-23 2021-12-24 新华三信息安全技术有限公司 Wiring device and fault switching method thereof
CN113839816B (en) * 2021-09-23 2024-01-19 新华三信息安全技术有限公司 Wiring device and fault switching method thereof
CN114598639A (en) * 2022-01-28 2022-06-07 新华三技术有限公司合肥分公司 Message processing method and device
CN114598639B (en) * 2022-01-28 2023-12-26 新华三技术有限公司合肥分公司 Message processing method and device
CN116436555A (en) * 2023-06-09 2023-07-14 新华三技术有限公司 Time synchronization method and device and distributed network equipment
CN116436555B (en) * 2023-06-09 2023-08-18 新华三技术有限公司 Time synchronization method and device and distributed network equipment

Also Published As

Publication number Publication date
CN106301745A (en) 2017-01-04

Similar Documents

Publication Publication Date Title
WO2016188026A1 (en) Time synchronization method and device between primary main board and standby main board
US10673551B2 (en) Time synchronization method and apparatus
US10432336B2 (en) System and method of synchronizing a distributed clock in a packet-compatible network
KR102031268B1 (en) Method and apparatus for communicating time information between time-aware devices
US10644867B2 (en) Method, device, and system for synchronizing clocks of processors
US8081663B2 (en) Time synchronization method and relay apparatus
CN103166729B (en) Clock synchronizing method and equipment
WO2017101528A1 (en) Method and device for clock link switching and base station
US11095383B2 (en) Method for exchanging time synchronization packet and network apparatus
WO2012163172A1 (en) Clock synchronization method and device
WO2009043299A1 (en) A determining method and device for the synchronization port of a transparent clock equipment
CN112838903B (en) Clock synchronization method, equipment and storage medium
WO2012071910A1 (en) Method and device for achieving time synchronization
WO2017045546A1 (en) Time synchronization packet processing method and device
CN105978652A (en) Synchronous time comparing equipment of redundant Ethernet, system and method thereof
JP2013251878A (en) Communication device, control device, and program
JP2008244609A (en) Method of synchronizing time and wireless network system using the same
EP2750339A1 (en) Synchronization method and system for traversing the synchronous network of third-party
WO2016119362A1 (en) Clock synchronization method, router and cluster routing system
JP2017228977A (en) Log information creation device, log information creation method, log information creation program, and information processing system
JP6240635B2 (en) Wireless communication method and wireless communication system
CN101420281A (en) Be used between network element, transmitting the method and apparatus of time value in a few days
CN214480655U (en) Embedded equipment compatible with definable deterministic communication Ethernet
WO2016184129A1 (en) Method, device and network apparatus for realizing unicast-based time synchronization
WO2018153192A1 (en) Time synchronization method and apparatus

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15893102

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15893102

Country of ref document: EP

Kind code of ref document: A1