Background technology
IEEE 1588 standard definitions a kind of in measurement and control system such as technology synergy application such as communication network, local calculatings, distributed objects, can realize the agreement of exact time synchronization.Agreement is applicable to the local area network communication system that supports cast communication, can be with the network and the local clock computational resource cost of minimum, make have different inherent accuracies, the different system of resolution, stability clock can be synchronized with master clock (Grandmaster Clock), and reach the scope of system-wide synchronous accuracy submicrosecond level.
The synchronization principles of the described agreement of IEEE 1588 standards mainly contains 2 following points:
1, sets up the host-guest architecture of clock by the clock grade information in the multicast message;
2, the protocol massages by the free information of exchange zone between the principal and subordinate, from clock tracing to the master clock time.
Set up the host-guest architecture of clock by the clock grade information among the multicast message Announce (announcement), finally on network topology, network can form a tree.When network changed, consultation had rebulid new tree.
For avoiding generating tree Cheng Huan in forming process, one of existing solution is to add a Pre_Master state when port status carries out the transition to Master (master) attitude.Like this, because port before entering Master, can enter an intermediateness Pre_Master, and can't externally send message under the Pre_Master state.Arrive the stand-by period during condition that Pre_Master enters Master,, wait for that from other states the time that enters Master is long more promptly from master clock equipment far away more.In theory, in this wait process, equipment can receive the message information of renewal, thereby reduces the possibility that ring occurs following the tracks of into to a certain extent.
But the inventor finds that this scheme can not fundamentally be determined clock tracing Cheng Huan, and for example the stand-by period of Pre_Master arrives, does not still receive the message of renewal when equipment; Perhaps, message itself existing problems or the like situation.
Existing another solution is to determine clock tracing Cheng Huan by the judgement of step-length.By becoming the network topological diagram behind the ring can find that the message of mistake does not have the source, the message that does not have the source is through the equipment on each ring the time, and step-length all needs from increasing, this information via has been described a jumping equipment.Owing to there is not the source, increasing certainly forever of step-length can't stop.If the step-length of the message of receiving just thinks that greater than 0xff (hexadecimal, converting the decimal system to is 255) this message is unavailable.
But the inventor finds that there is a problem in this scheme, must wait until that exactly step-length is accumulated to 0xff, and network could be found mistake, that is to say and finds that the wrong time is relatively slow.
Summary of the invention
Embodiments of the invention provide method, the Apparatus and system of clock tracing Cheng Huan in a kind of definite network, can fast and accurately determine clock tracing Cheng Huan in the network.
For achieving the above object, embodiments of the invention adopt following technical scheme:
The method of clock tracing Cheng Huan in a kind of definite network comprises:
Receive first message that carries this master clock heartbeat signal that the master clock in the network sends;
Judge whether the heartbeat signal that carries in described first message is identical with the last heartbeat signal that carries from second message that described master clock receives;
If the heartbeat signal that carries in described first message is different with the last heartbeat signal that carries, determine that then clock tracing Cheng Huan does not take place described network, and described first message is normal from second message that described master clock receives;
If the heartbeat signal that carries in described first message is identical with the last heartbeat signal that carries, then determine described network generation clock tracing Cheng Huan, and described first message is unusual from second message that described master clock receives.
A kind of synchronizer comprises:
Receiving element is used for receiving first message that carries this master clock heartbeat signal that the master clock of network sends;
Judging unit is used for judging whether the heartbeat signal that described first message carries is identical with the last heartbeat signal that carries from second message that described master clock receives; If the heartbeat signal that carries in described first message is different with the last heartbeat signal that carries, determine that then clock tracing Cheng Huan does not take place described network, and described first message is normal from second message that described master clock receives; If the heartbeat signal that carries in described first message is identical with the last heartbeat signal that carries, then determine described network generation clock tracing Cheng Huan, and described first message is unusual from second message that described master clock receives.
A kind of clock tracing system comprises master clock and synchronizer, wherein:
Described synchronizer is used for receiving first message that carries this master clock heartbeat signal that the described master clock of network sends; Judge whether the heartbeat signal that carries in described first message is identical with the last heartbeat signal that carries from second message that described master clock receives; If the heartbeat signal that carries in described first message is different with the last heartbeat signal that carries, determine that then clock tracing Cheng Huan does not take place described network, and described first message is normal from second message that described master clock receives; If the heartbeat signal that carries in described first message is identical with the last heartbeat signal that carries, then determine described network generation clock tracing Cheng Huan, and described first message is unusual from second message that described master clock receives.
Method, the Apparatus and system of clock tracing Cheng Huan in definite network that the embodiment of the invention provides, synchronizer receives first message that carries this master clock heartbeat signal that the master clock in the network sends, judge whether the heartbeat signal that carries in this first message is identical with the last heartbeat signal that carries from second message that master clock receives, if different in second message of the heartbeat signal in first message and reception before, illustrate that then this first message is sent out by master clock, good for use; If identical in second message of the heartbeat signal in first message and reception before, illustrate that then the non-master clock of this first message sends out, unavailable unusually, determine to have occurred in the network tracking loop.Like this, the downstream synchronizer just can be pinpointed the problems in clock tracing Cheng Huan, thereby can fast and accurately determine clock tracing Cheng Huan.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that is obtained under the creative work prerequisite.
The method of clock tracing Cheng Huan in definite network that the embodiment of the invention provides, as shown in Figure 1, this method step comprises:
First message that carries this master clock heartbeat signal that master clock in S101, the reception network sends.
Concrete, master clock can utilize a byte in the message to carry the heartbeat signal of this master clock.Like this, the expense of use is little, has just taken a reserve bytes in the message.
S102, judge whether the heartbeat signal that carries in this first message is identical with the last heartbeat signal that carries from second message that master clock receives.
S103, different with the last heartbeat signal that carries from second message that master clock receives as if the heartbeat signal that carries in first message determine that then clock tracing Cheng Huan does not take place this network, and first message is normal.
S104, identical with the last heartbeat signal that carries from second message that master clock receives as if the heartbeat signal that carries in first message then determine this network generation clock tracing Cheng Huan, and first message is unusual.
The method of clock tracing Cheng Huan in definite network that the embodiment of the invention provides, synchronizer receives first message that carries this master clock heartbeat signal that the master clock in the network sends, judge whether the heartbeat signal that carries in this first message is identical with the last heartbeat signal that carries from second message that master clock receives, if different in second message of the heartbeat signal in first message and reception before, illustrate that then this first message is sent out by master clock, good for use; If identical in second message of the heartbeat signal in first message and reception before, illustrate that then the non-master clock of this first message sends out, unavailable unusually, determine to have occurred in the network tracking loop.Like this, the downstream synchronizer just can be pinpointed the problems in clock tracing Cheng Huan, thereby can fast and accurately determine clock tracing Cheng Huan.
The method of clock tracing Cheng Huan in definite network that further embodiment of this invention provides, its network scenarios suppose that equipment 4 is for having the synchronizer of master clock as shown in Figure 2.
Under normal situation, equipment 4 is sending in the process of Announce (announcement) message at interval, the variation of a reserve bytes by message is broadcast to all synchronizers to the heartbeat signal of master clock, all downstream synchronizers are being received master clock---behind the message that contains heartbeat signal of equipment 4, extract the byte of this indication master clock heartbeat signal, compare with the heartbeat signal byte in the message that receives before, if it is different, illustrating that this message is the normal message that the equipment 4 at master clock place sends, serve as that the tracking of following the tracks of source point is set thereby set up with equipment 4.
At this, utilize a byte in the message to carry the heartbeat signal of this master clock, it is minimum can making expense.
In the time of equipment 4 degradation, as can be seen from Figure 2, equipment 6 is more farther apart from equipment 4 than equipment 8, perhaps other network reason, and what equipment 6 obtained the master clock information updating wants slow, and the message of the transmission of equipment 6 is the still message before equipment 4 degradations probably.But can initiatively not send the message before the degradation on the equipment 4 again, so the message before should degradation can be again by old master clock---equipment 4 produces heartbeat signals.Like this, the old message of equipment 6 transmissions does not just have heartbeat to change yet.After equipment 8 was received the message that equipment 6 sends, the heartbeat signal that continuous monitoring is carried in the message did not change, and promptly the heartbeat signal with the message that receives before is identical, and just determining this message is exception message, and abandons this message.Thereby on initial key point, intercepted wrong generation.
In addition, upstream device if determine that message is a normal message, just carries out clock tracing according to this message when receiving and judge the heartbeat signal that carries in the message; If determining this message is exception message, abandon this message after, the time-out count device is added 1, when the time-out count device is not overtime, continues to receive monitoring and also judge the message that master clock sends.So, present embodiment also has stronger fault-tolerance, if upstream equipment is not change owing to heartbeat signal that self reason causes, as long as the time surpasses the time of overtime judgement, can not cause that the agreement of upstream device is switched.
Concrete, as shown in Figure 3, may further comprise the steps:
The new message (first message) that master clock in S301, the synchronizer monitoring network sends, and execution in step S 302.
S302, judge whether to receive new message (first message).If do not receive new message (first message), then execution in step S301; If receive new message (first message), then execution in step S303.
The heartbeat signal that carries in S303, this new message of record (first message), and execution in step S304.
Whether the heartbeat message heartbeat signal in S304, this new message of judgement (first message) is identical with last heartbeat message heartbeat signal from the message (second message) that master clock receives before.If difference, then execution in step S305; If identical, execution in step S308 then.
S305, this new message (first message) is carried out other detections.If detect successfully, execution in step S306 then; If detect failure, then execution in step S308.
S306, with the zero clearing of time-out count device, and execution in step S307.
S307, preserve this new message, and execution in step S301 again.
S308, the time-out count device is added 1, and execution in step S309.
S309, judge whether the time-out count device is overtime.If not overtime, execution in step S301 then; If overtime, execution in step S310 then.
S310, report overtimely, determine clock tracing Cheng Huan in the network, and execution in step S301 again.
The method of clock tracing Cheng Huan in definite network that the embodiment of the invention provides, synchronizer receives first message that carries this master clock heartbeat signal that the master clock in the network sends, judge whether the heartbeat signal that carries in this first message is identical with the last heartbeat signal that carries from second message that master clock receives, if different in second message of the heartbeat signal in first message and reception before, illustrate that then this first message is sent out by master clock, good for use; If identical in second message of the heartbeat signal in first message and reception before, illustrate that then the non-master clock of this first message sends out, unavailable unusually, determine to have occurred in the network tracking loop.Like this, the downstream synchronizer just can be pinpointed the problems in clock tracing Cheng Huan, thereby can fast and accurately determine clock tracing Cheng Huan.
The synchronizer 40 that the embodiment of the invention provides as shown in Figure 4, comprising:
Receiving element 401 is used for receiving first message that carries this master clock heartbeat signal that the master clock of network sends.
Judging unit 402 is used for judging whether the heartbeat signal that this first message carries is identical with the last heartbeat signal that carries from second message that master clock receives; If the heartbeat signal that carries in first message is different with the last heartbeat signal that carries, determine that then clock tracing Cheng Huan does not take place this network, and first message is normal from second message that master clock receives; If the heartbeat signal that carries in first message is identical with the last heartbeat signal that carries, then determine this network generation clock tracing Cheng Huan, and first message is unusual from second message that master clock receives.
The synchronizer that the embodiment of the invention provides, synchronizer receives first message that carries this master clock heartbeat signal that the master clock in the network sends, and judges whether the heartbeat signal that carries in this first message is identical with the last heartbeat signal that carries from second message that master clock receives; If different in second message of the heartbeat signal in first message and reception before illustrate that then this first message is sent out by master clock, and are good for use; If identical in second message of the heartbeat signal in first message and reception before, illustrate that then the non-master clock of this first message sends out, unavailable unusually, determine to have occurred in the network tracking loop.Like this, the downstream synchronizer just can be pinpointed the problems in clock tracing Cheng Huan, thereby can fast and accurately determine clock tracing Cheng Huan.
Further, as shown in Figure 5, this synchronizer 40 also comprises:
Clock tracing unit 403 is used for carrying out clock tracing when determining first message just often according to this normal first message.
Time-out count unit 404 is used for abandoning this first unusual message when definite first message is unusual, and accumulation time-out count device.
Overtime judging unit 405 is used in the time-out count unit counters of 704 accumulations when not overtime, continues to receive and also judges first message that master clock sends; After the time-out count device is overtime, determine this network generation clock tracing Cheng Huan.
Thus, this this synchronizer 40 has stronger fault-tolerance, if upstream equipment is not change owing to heartbeat byte that self reason causes, as long as the time surpasses the time of overtime judgement, can not cause that the agreement of upstream device is switched.
The clock tracing system that the embodiment of the invention provides as shown in Figure 6, comprises master clock 602 and synchronizer 601, wherein:
Synchronizer 601 is used for receiving first message that carries these master clock 602 heartbeat signals that the master clock 602 of network sends; Judge whether the heartbeat signal that carries in this first message is identical with the last heartbeat signal that carries from second message that master clock 602 receives; If the heartbeat signal that carries in first message is different with the last heartbeat signal that carries, determine that then clock tracing Cheng Huan does not take place this network, and first message is normal from second message that master clock 602 receives; If the heartbeat signal that carries in first message is identical with the last heartbeat signal that carries, then determine this network generation clock tracing Cheng Huan, and first message is unusual from second message that master clock 602 receives.
The clock tracing system that the embodiment of the invention provides, synchronizer receives first message that carries this master clock heartbeat signal that the master clock in the network sends, and judges whether the heartbeat signal that carries in this first message is identical with the last heartbeat signal that carries from second message that master clock receives; If different in second message of the heartbeat signal in first message and reception before illustrate that then this first message is sent out by master clock, and are good for use; If identical in second message of the heartbeat signal in first message and reception before, illustrate that then the non-master clock of this first message sends out, unavailable unusually, determine to have occurred in the network tracking loop.Like this, the downstream synchronizer just can be pinpointed the problems in clock tracing Cheng Huan, thereby can fast and accurately determine clock tracing Cheng Huan.
One of ordinary skill in the art will appreciate that: all or part of step that realizes said method embodiment can be finished by the relevant hardware of program command, aforesaid program can be stored in the computer read/write memory medium, this program is carried out the step that comprises said method embodiment when carrying out; And aforesaid storage medium comprises: various media that can be program code stored such as ROM, RAM, magnetic disc or CD.
The above; only be the specific embodiment of the present invention, but protection scope of the present invention is not limited thereto, anyly is familiar with those skilled in the art in the technical scope that the present invention discloses; can expect easily changing or replacing, all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion by described protection range with claim.