Summary of the invention
The technical matters that the present invention mainly solves is to provide a kind of method of data synchronization of industrial data net, can ensure that the time of origin of the industrial data of industrial data net is strictly concerned with.
For solving the problems of the technologies described above, the technical scheme that the present invention adopts is: the method for data synchronization providing a kind of industrial data net, comprise: industrial data net is divided into multiple clock area, and sync identification is carried out to all network elements in described industrial data net, wherein, clock area described in each at least comprises a network element; Be respectively clock area described in each and arrange time zone stamp, wherein, the time zone stamp of any two clock area is not identical; Receive and resolve the packet that described network element uploads, wherein, described packet comprises the time of origin of the clock area at described network element place corresponding time zone stamp, industrial data and described industrial data; Judge that whether the time of origin of any two network elements is identical; If the time of origin of described any two network elements is identical, judge whether the time zone stamp of described any two network elements is identical; If the time zone stamp of described any two network elements is identical, then carry out data collision process.
Preferably, the step of described data collision process is specially: store and record the industrial data of described any two network elements; Give up the packet that described any two network elements are uploaded after described time of origin.
Preferably, the step of described data collision process is specially: store and record the industrial data of described any two network elements; Generate conflict warning daily record.
Preferably, described the step that all network elements in described industrial data net carry out sync identification to be comprised: adopt rubidium atomic clock to carry out sync identification to the indoor network element that is in described industrial data net, adopt GPS to carry out sync identification to the outdoor network element that is in described industrial data net.
Preferably, described method of data synchronization also comprises: if the time of origin of described any two network elements is not identical or the time zone of described any two network elements stamp is not identical, then do not carry out data collision process.
Be different from the situation of prior art, the invention has the beneficial effects as follows: by the network element of industrial data net is divided in different clock area, when network element uploads industrial data, whether the industrial data that different network elements distinguished by the time zone stamp utilizing clock area corresponding clashes, and when clashing, carry out data collision process, thus can ensure that the time of origin of the industrial data of industrial data net is strictly concerned with, follow-up data analysis conclusion accurate and effective can be ensured.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only a part of embodiment of the present invention, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
See Fig. 1, it is the schematic flow sheet of the method for data synchronization of embodiment of the present invention industrial data net.The method of data synchronization of the industrial data net of the embodiment of the present invention comprises the following steps:
Step S1: industrial data net is divided into multiple clock area, and sync identification is carried out to all network elements in industrial data net, wherein, each clock area at least comprises a network element.
Wherein, industrial data net is made up of multiple network element, and each network element can represent a link.The network element had in industrial data net is apart from each other on geographic position, in order to ensure that the system time of each network element is strictly concerned with, needs to carry out sync identification.In the present embodiment, the step of all network elements in industrial data net being carried out to sync identification comprises: adopt rubidium atomic clock to carry out sync identification to the indoor network element that is in industrial data net, adopts GPS to carry out sync identification to the outdoor network element that is in industrial data net.GPS and rubidium atomic clock are all high steady clocks, and drift is monthly only 5x10
-11second, GPS or rubidium atomic clock generate pulse per second (PPS) (PPS) needed for each network element or system time, thus the time difference in theory between each network element controls at 1x10
-11in magnitude.
Step S2: be respectively each clock area and arrange time zone stamp, wherein, the time zone stamp of any two clock area is not identical.
Wherein, time zone stamp is used for demarcating the clock area residing for network element, such as, industrial data net is divided into 12 clock area, so just has 12 time zone stamps corresponding with it.Arrange time zone stamp, each network element in clock area can obtain this time zone stamp.
Step S3: receive and resolve the packet that network element uploads, wherein, packet comprises the time of origin of the clock area at network element place corresponding time zone stamp, industrial data and industrial data.
Wherein, packet can adopt field format, and time zone stamp and time of origin individually adopt a byte to describe, and remaining word is saved in description industrial data.When after network element uploading data bag, the time of origin of the clock area at network element place corresponding time zone stamp, industrial data and industrial data can be obtained by resolution data bag.
Step S4: judge that whether the time of origin of any two network elements is identical.
Wherein, when receiving the packet that different network elements is uploaded, the time of origin detected in the packet of different network elements is needed whether to conflict.
Step S5: if the time of origin of any two network elements is identical, judges whether the time zone stamp of any two network elements is identical.
Step S6: if the time zone stamp of any two network elements is identical, then carry out data collision process.
Wherein, if time zone stamp is identical, represent that two network elements are in same clock area, but the network element in this clock area represents different links, these links are do not allow conflict in time, therefore, need to carry out data collision process.In one embodiment of the invention, the step of data collision process is specially: store and record the industrial data of any two network elements; Give up the packet that any two network elements are uploaded after time of origin.Wherein, this mode is based on competition mechanism, and the free uploading data bag of any two network elements, first packet is stored and record, and the packet uploaded afterwards can be given up automatically.In another embodiment of the present invention, the step of data collision process is specially: store and record the industrial data of any two network elements; Generate conflict warning daily record.Wherein, conflict warning daily record can be used for examination in follow-up data process with when analyzing.
In the present embodiment, this method of data synchronization also comprises: if the time of origin of any two network elements is not identical or the time zone of any two network elements stamp is not identical, then do not carry out data collision process.Wherein, consider that the industrial data of different network elements occurs in and be possible in the same time and allow to occur the situation of the data occurred in the same time in different time zone, therefore, in this case, do not carry out data collision process.
By the way, the method of data synchronization of the industrial data net of the embodiment of the present invention is by being divided in different clock area by the network element of industrial data net, when network element uploads industrial data, whether the industrial data that different network elements distinguished by the time zone stamp utilizing clock area corresponding clashes, and when clashing, carry out data collision process, thus can ensure that the time of origin of the industrial data of industrial data net is strictly concerned with, follow-up data analysis conclusion accurate and effective can be ensured.
The foregoing is only embodiments of the invention; not thereby the scope of the claims of the present invention is limited; every utilize instructions of the present invention and accompanying drawing content to do equivalent structure or equivalent flow process conversion; or be directly or indirectly used in other relevant technical fields, be all in like manner included in scope of patent protection of the present invention.