Disclosure of Invention
In view of this, the present invention provides a method for synchronizing data in a data communication gateway, which can improve the integrity and timeliness of the data synchronized by the data communication gateway; another object of the present invention is to provide an apparatus for synchronizing data in a data communication gateway, a data communication gateway and a computer readable storage medium, all of which have the above advantages.
In order to solve the above technical problem, the present invention provides a method for synchronizing data during a data communication gateway, comprising:
when the communication abnormality with the spacer layer device is detected, sending a retrieval identifier to a standby machine so that the standby machine can search corresponding telecommand deflection data in a preset cache region according to the retrieval identifier;
receiving the telecommand deflection data returned by the standby machine;
and synchronizing the remote signaling displacement data to a master station system.
Preferably, the retrieval identification specifically comprises a spacer layer device address and a data timestamp.
Preferably, after the standby machine returns the telecommand displacement data, the method further comprises the following steps:
adding the device address of the spacer layer into a device list needing synchronization;
after receiving new telecommand displacement data, judging whether an interlayer device address corresponding to the new telecommand displacement data exists in the device list needing to be synchronized;
and if so, sending the new telecommand displacement data to the host.
Preferably, after the receiving the telecommand shifted data returned by the standby machine, the method further comprises the following steps:
comparing the telecommand displacement data with telecommand displacement data cached by the telecommand displacement data and judging whether a difference exists or not;
and if so, updating the self-cached telecommand displacement data by using the telecommand displacement data, and entering the step of synchronizing the telecommand displacement data to the master station system.
Preferably, the method is characterized by further comprising the following steps:
and when the communication with the spacer layer device is detected to be recovered to be normal, sending a synchronous data canceling command to the standby machine so that the standby machine stops sending the telecommand displacement data to the host machine.
Preferably, after the standby machine stops sending the telecommand displacement data to the host machine, the method further comprises:
deleting the spacer layer device address in the device list needing synchronization;
an acknowledge desynchronize data command is returned to the host.
Preferably, before the sending the command to the standby machine to cancel the synchronous data, the method further comprises:
judging whether new telecommand deflection data sent by the spacer layer device is received or not;
if yes, the step of sending the command of canceling the synchronous data to the standby machine is carried out.
In order to solve the above technical problem, the present invention further provides a device for synchronizing data during a data communication gateway, including:
the sending module is used for sending a retrieval identifier to the standby machine when the communication abnormality with the spacer layer device is detected, so that the standby machine can search corresponding telecommand displacement data in a preset cache region according to the retrieval identifier;
the receiving module is used for receiving the telecommand deflection data returned by the standby machine;
and the synchronization module is used for synchronizing the remote signaling displacement data to the master station system.
In order to solve the above technical problem, the present invention further provides a data communication gateway apparatus, including:
a memory for storing a computer program;
and the processor is used for realizing the steps of any one of the data communication network shutdown data synchronization methods when executing the computer program.
In order to solve the above technical problem, the present invention further provides a computer-readable storage medium, where a computer program is stored, and the computer program, when executed by a processor, implements the steps of any one of the above methods for synchronizing data during a data communication network shutdown.
The invention provides a method for synchronizing data of a data communication gateway, which comprises the steps of sending a retrieval identifier to a standby machine when detecting that the communication with a spacer layer device is abnormal, so that the standby machine can search corresponding telecommand displacement data in a preset cache region according to the retrieval identifier; receiving the telecommand deflection data returned by the standby machine; and synchronizing the remote signaling displacement data to a master station system.
The method is used for caching the telecommand displacement data sent to the host and the standby by the spacing layer device by presetting a telecommand displacement data cache region. When the host detects that the communication with the spacer layer device is abnormal, the host sends a retrieval identifier to the standby machine, the standby machine searches corresponding telecommand deflection data in a preset telecommand deflection data cache region according to the retrieval identifier, and sends the searched telecommand deflection data to the host, so that the host sends the telecommand deflection data to the master station system. The corresponding cached telecommand deflection data is searched by the standby unit and is sent to the host, namely the telecommand deflection data sent by the spacer layer device is forwarded to the host by the standby unit, and the forwarding line is not interfered with the line between the spacer layer device and the host, so that the host can timely receive the telecommand deflection data of the spacer layer device and send the telecommand deflection data to the master station system. And because the data in the remote signaling displacement data buffer area is sent to the host computer in time, the possibility of data loss is reduced. The method improves the integrity and timeliness of the remote signaling displacement data of the synchronous spacer layer device of the data communication network shutdown to the master station system when the communication between the spacer layer device and the host is abnormal.
In order to solve the technical problem, the invention also provides a device for synchronizing data of the data communication gateway machine, the data communication gateway machine and a computer readable storage medium, which have the beneficial effects.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The core of the embodiment of the invention is to provide a method for synchronizing data of a data communication gateway machine, which can improve the integrity and timeliness of the data communication gateway machine; another core of the present invention is to provide a device for synchronizing data in a data communication gateway, and a computer readable storage medium, all having the above beneficial effects.
In order that those skilled in the art will better understand the disclosure, the invention will be described in further detail with reference to the accompanying drawings and specific embodiments.
Fig. 1 is a flowchart of a method for synchronizing data during a data communication gateway-down operation according to an embodiment of the present invention; fig. 2 is a system structure diagram of a method for synchronizing data during a data communication gateway down according to an embodiment of the present invention. As shown in the figure, the method for synchronizing data in data communication network shutdown comprises the following steps:
s10: when the communication abnormality with the bay layer device 40 is detected, a retrieval identifier is sent to the standby machine 30, so that the standby machine 30 searches the corresponding telecommand displacement data in a preset cache region according to the retrieval identifier.
It can be understood that the data communication gateway machine is a communication device, and is used for realizing communication between the intelligent substation and the master station systems for scheduling, production and the like, and providing data, model and graph transmission service for the master station systems for realizing functions of monitoring control, information inquiry, remote browsing and the like of the intelligent substation. Therefore, it is important for the data communication gateway to synchronize the telecommand displacement data of the spacer layer device to the master station system timely and accurately.
Generally, the bay level device 40 and the host 20 and the backup 30 of the data communication network apparatus are connected to the backbone network a and the backbone network B, respectively, so that the bay level device 40 transmits the remote signaling displacement data to the host 20 and also to the backup 30. That is, the spacer layer device 40 to which the host 20 and the backup 30 are connected is the same, that is, the data source of the received telecommand displacement data of the host 20 and the backup 30 is from the spacer layer device 40, and the same telecommand displacement data received by the host 20 and the backup 30 is from the same spacer layer device 40. It should be noted that the original data link between the host 20 and the backup device 30 can be used for communication between the host 20 and the backup device 30, but in order to avoid interference of data transmission, as a preferred embodiment, a dedicated data synchronization communication link may be established between the host 20 and the backup device 30 in advance for communication between the host 20 and the backup device 30 when communication between the host 20 and the bay level device 40 is abnormal.
Specifically, the communication status between the host 20 and the bay level device 40 is monitored in real time, and if a communication abnormality occurs, such as a communication interruption, a synchronous data command and a search flag are sent to the standby 30. More specifically, the monitoring operation may be performed by the host 20 itself, or may be performed by another device, and in order to reduce the communication delay caused by information interaction, as a preferred embodiment, the host 20 in this embodiment monitors the communication status between itself and the bay level device 40 in real time.
It should be noted that the synchronous data command is a command for prompting the standby device 30 to perform data synchronization, and the retrieval identifier is a search basis required by the standby device 30 to perform data search. In a specific implementation, the synchronous data command and the search identifier may be the same signal, or may be two independent signals, that is, the search identifier may be used as a synchronous data command to remind the standby device 30 of data synchronization, and may also be used as a search basis for data search of the standby device 30, which is not limited in this embodiment.
The standby machine 30 searches the corresponding telecommand displacement data in the preset cache region according to the retrieval identification. That is, a buffer area is preset for buffering the telecommand displacement data sent by the bay layer device 40 to the host 20 and the standby 30, and a search identifier is set for the received telecommand displacement data to perform indexing. After receiving the retrieval identifier, the standby device 30 searches for corresponding telecommand displacement data in the cache region according to the retrieval identifier.
Specifically, the buffer area may be disposed on the spacer layer device 40, that is, the buffer area of the spacer layer device 40 itself is utilized; it may also be disposed on the standby machine 30, that is, a buffer area is newly added on the standby machine 30, which is not limited in this embodiment. In addition, the time for setting the buffer is generally when the communication between the host 20 and the spacer layer device 40 is normal, that is, before the communication between the host 20 and the spacer layer device 40 is abnormal, so as to avoid losing data when the communication between the host 20 and the spacer layer device 40 is abnormal and after the communication is abnormal. The remote signaling displacement data stored in the cache region needs to be indexed by setting a retrieval identifier according to a certain rule, and the retrieval identifier corresponding to the rule is generally the only identity identifier of the remote signaling displacement data. That is, each retrieval identification is uniquely associated with one telecommand shifted data. In addition, the search identifier and the search identifier of the remote signaling displacement data should correspond to each other so that the standby device 30 can find the corresponding remote signaling displacement data according to the search identifier. That is, by setting the retrieval identifier for the telecommand displacement data, the only corresponding telecommand displacement data can be found through the retrieval identifier. In this embodiment, the standby device 30 sets a sufficiently large SOE (event sequence recording system) buffer in itself, stores the telecommand displacement data into the buffer after receiving the telecommand displacement data, and indexes the data according to the time of the received telecommand displacement data, that is, the time scale of each data is used as a retrieval identifier, and each time scale uniquely corresponds to one piece of telecommand displacement data.
S20: receiving the telecommand displacement data returned by the standby 30.
Specifically, after the standby device 30 receives the retrieval identifier sent by the host 20, the standby device 30 searches for corresponding telecommand displacement data in the cache region according to the retrieval identifier. It can be understood that each telecommand displacement data has a corresponding retrieval identifier, and the corresponding telecommand displacement data is searched according to the retrieval identifier. The data returned by the backup device 30 to the host device 20 may be one data or a plurality of data. For example, when retrieving the time corresponding to the time identified as the communication abnormality, the corresponding searched data may be the data at the time of searching, or may be all the data in a short time period from the time of communication abnormality to the time before returning the data. This embodiment is not limited to this.
It should be noted that, the standby machine 30 receives the synchronous data command of the host machine 20 and packages the found data to be sent to the host machine 20 after finding the corresponding data. The packed data may be correspondingly packed according to the search identifier, or may be packed according to the content of the data, which is not limited in this embodiment. Specifically, the standby device 30 may perform data transmission through a dedicated data synchronous communication link.
S30: the telemetry shift data is synchronized to the master system 10.
It can be understood that the purpose of the host 20 obtaining the remote signaling displacement data of the bay level device 40 is to upload the remote signaling displacement data to the master station system 10, so that the master station system 10 can implement functions of monitoring control, information query, remote browsing, and the like of the intelligent substation according to the obtained remote signaling displacement data. Specifically, after receiving the telecommand displacement data returned by the standby device 30, the host 20 performs corresponding processing on the telecommand displacement data and then sends the processed telecommand displacement data to the master station system 10, and in order to ensure the timeliness of the data and reduce the time delay, the shorter the processing time is, the better the processing time is. In addition, the performance of the data communication gateway and the performance of the communication link can generally affect the efficiency of synchronizing the telemetry data to the master system 10. In this embodiment, the type of the data communication gateway is not limited, and the manner in which the host 20 synchronizes the remote signaling displacement data to the master system 10 is also not limited.
The method for synchronizing data of a data communication gateway machine provided by this embodiment is used for caching the telecommand displacement data sent to the host machine and the standby machine by the spacer layer device by presetting a telecommand displacement data cache region. When the host detects that the communication with the spacer layer device is abnormal, the host sends a retrieval identifier to the standby machine, the standby machine searches corresponding telecommand deflection data in a preset telecommand deflection data cache region according to the retrieval identifier, and sends the searched telecommand deflection data to the host, so that the host synchronizes the telecommand deflection data to the master station system. The corresponding cached telecommand deflection data is searched by the standby unit and is sent to the host, namely the telecommand deflection data sent by the spacer layer device is forwarded to the host by the standby unit, and the forwarding line is not interfered with the line between the spacer layer device and the host, so that the host can timely receive the telecommand deflection data of the spacer layer device and send the telecommand deflection data to the master station system. And because the data in the remote signaling displacement data buffer area is sent to the host computer in time, the possibility of data loss is reduced. The method improves the integrity and timeliness of the remote signaling displacement data of the synchronous spacer layer device of the data communication network shutdown to the master station system when the communication between the spacer layer device and the host is abnormal.
On the basis of the above embodiments, this embodiment further describes and optimizes the technical solution, and specifically, the retrieval identifier specifically includes a spacer layer device address and a data timestamp.
It should be noted that, when the communication abnormality with the bay layer device 40 is detected, the bay layer device address with the communication abnormality and the time scale of the last piece of telecommand displacement data are sent to the standby device 30, the standby device 30 finds the corresponding bay layer device 40 according to the bay layer device address, and after the communication abnormality is found according to the time scale of the last piece of telecommand displacement data, the bay layer device 40 sends the data information to the standby device 30. It can be understood that, correspondingly, on the basis of presetting the cache region, in order to more conveniently search the corresponding telecommand displacement data, mutually independent cache spaces are divided for different devices. The standby 30 receives the remote signaling displacement data and puts the remote signaling displacement data into the space of the cache region of the corresponding device, and sets data time marks for the data.
Fig. 3 is a timing diagram of another method for synchronizing data during a data communication network shutdown according to an embodiment of the present invention. As shown in the figure, on the basis of the above embodiment, the embodiment further describes and optimizes the technical solution, and specifically, after the standby machine 30 returns the telecommand displacement data, the method further includes:
s31: the spacer layer device address is added to the list of devices to be synchronized.
Specifically, a synchronization-required device list for recording the addresses of devices whose information is required to be synchronized by the standby device 30 is set in advance. The set action may be executed by the standby device 30, or may be executed by another device, which is not limited in this embodiment. Specifically, the list may be set in the standby device 30, or may be set in another location, as a preferred embodiment, the list of devices to be synchronized is set in the standby device 30, so that the standby device 30 can conveniently retrieve the address information of the spacer layer device according to the retrieval identifier. The bay level device address is added to the set list of devices to be synchronized so that the only corresponding bay level device 40 can be found from the bay level device address.
S32: and after receiving the new telecommand displacement data, judging whether the spacer layer device address corresponding to the new telecommand displacement data exists in a device list needing to be synchronized.
After the backup unit 30 receives the new telecommand displacement data, it is determined whether the device address of the bay layer device 40 corresponding to the new telecommand displacement data exists in the synchronization required device list. Specifically, when the device and the host 20 are in communication abnormality, after receiving the remote signaling displacement data, the device obtains information of the data, obtains an address of the spacer layer device which sends the remote signaling displacement data, and searches whether the address of the spacer layer device exists in a list.
S33: if the remote signaling displacement data exists, the new remote signaling displacement data is transmitted to the host 20.
It should be noted that, if the spacer layer device address corresponding to the new telecommand displacement data exists in the synchronization-required device list, it indicates that the device corresponding to the information is a device that needs synchronization information, that is, the device is in an abnormal state in communication with the host 20, and therefore, the new telecommand displacement data is transmitted to the host 20 as the direct acquisition data.
Therefore, by setting the device list needing synchronization and adding the interlayer device address with abnormal communication into the device list needing synchronization, after the standby machine receives the telecommand displacement data again, if the interlayer device address corresponding to the data is judged to be in the device list needing synchronization, the interlayer device address is directly sent to the host machine, the search mark sent by the host machine does not need to be received each time, the corresponding telecommand displacement data are searched and then returned to the host machine, and the data transmission process is simpler.
Fig. 4 is a timing diagram of another method for synchronizing data during a data communication gateway down according to an embodiment of the present invention, which further describes and optimizes the technical solution in this embodiment, specifically, as shown in the figure, after receiving the telecommand shifted data returned by the standby device, the method further includes:
s41: comparing the telecommand displacement data with the telecommand displacement data cached by the telecommand displacement data and judging whether a difference exists or not;
s42: if so, the remote signaling displacement data stored in the buffer is updated with the remote signaling displacement data, and the process proceeds to S30.
When receiving the telecommand displacement data, the host 20 stores the latest telecommand displacement data, and when receiving new telecommand displacement data, updates the last cached telecommand displacement data with the telecommand displacement data. That is, after receiving the telecommand displacement data sent by the standby device 30, the host 20 compares the telecommand displacement data with the telecommand displacement data cached by itself, and determines whether there is a difference; if so, indicating that the received data is updated data, updating the remote signaling displacement data cached by the remote signaling displacement data, and entering a step of synchronizing the remote signaling displacement data to the master station system 10.
The remote signaling displacement data are compared with the remote signaling displacement data cached by the host computer, and whether difference exists is judged; under the condition of difference, the remote signaling deflection data are used for updating the remote signaling deflection data cached by the remote signaling deflection data, and then the remote signaling deflection data are synchronized to the master station system, so that the situation that the same remote signaling deflection data are repeatedly sent to the master station system by the host is avoided, and the extra data processing burden is avoided for the system.
Fig. 5 is a timing diagram illustrating another method for synchronizing data during a data communication network shutdown according to an embodiment of the present invention. As shown in the figure, on the basis of the above embodiment, the present embodiment further describes and optimizes the technical solution, and specifically, the method for synchronizing data during shutdown of the data communication network further includes:
s51: when it is detected that the communication with the bay level device 40 is restored to normal, a command to cancel the synchronization data is transmitted to the backup device 30 so that the backup device 30 stops transmitting the telecommand displacement data to the host device 20.
Specifically, when the host 20 detects that the communication with the bay level device 40 is restored to normal, the preferred embodiment switches back to a mode in which the host 20 receives the remote signaling displacement data of the bay level device 40. Specifically, the synchronization data cancellation command is transmitted to the backup device 30, and when the backup device 30 receives the synchronization data cancellation command, the remote signaling displacement data is stopped from being returned to the host device 20.
In a preferred embodiment, after the backup unit 30 stops returning the telecommand displacement data to the host unit 20, the method further includes:
s52: the spacer layer device addresses are deleted in the synchronization required device list.
Specifically, since the spacer layer device address is deleted in the synchronization required device list, when the standby device 30 searches the synchronization required device list after receiving new telecommand displacement data, the telecommand displacement data is data that does not need to be synchronized by the standby device 30, and therefore, the standby device 30 buffers the data without transmitting the data to the host 20.
S53: an acknowledge desynchronize data command is returned to the host 20.
It will be appreciated that the standby 30 returns an acknowledge desynchronized data command to the host 20 as a return command to the desynchronized data command sent by the host 20 to "tell" the host 20 that the standby 30 is already performing the step of desynchronizing data.
After the backup device 30 stops transmitting the telecommand displacement data to the host device 20, the host device 20 transmits the telecommand displacement data to the master station system 10 according to a normal procedure after receiving the telecommand displacement data transmitted from the bay layer device 40 again.
It can be seen that by deleting the spacer layer device address in the device list to be synchronized, it can be avoided that the standby device 30 receives new telecommand displacement data and then sends the new telecommand displacement data to the host 20 after the communication between the host 20 and the spacer layer device 40 is recovered to normal, so that the host 20 receives two identical telecommand displacement data, and additional data processing burden is caused to the host 20.
As a preferred embodiment, before sending the command to cancel the synchronous data to the standby machine 30, the method further includes:
it is determined whether new telecommand displacement data transmitted by the spacer layer device 40 is received.
If yes, the process proceeds to the step of sending a command to cancel the sync data to the standby device 30.
Specifically, before sending the command to the backup device 30 to cancel the synchronization data, the host 20 needs to send the command to the backup device 30 after sending the total recall data on the bay level device 40 in order to confirm that the communication between itself and the bay level device 40 is really normal. That is, the host 20 determines whether it is more capable of receiving the telecommand displacement data from the bay level device 40. When the host 20 receives the new telecommand displacement data sent by the bay level device 40, the process proceeds to a step of sending a command to cancel the synchronization data to the standby 30.
Whether new telecommand deflection data sent by the spacer layer device are received or not is judged to confirm that the communication between the host and the spacer layer device is recovered to be normal, and the problem that the telecommand deflection data are lost due to the fact that a standby machine is cancelled to synchronize the telecommand deflection data when the communication between the host and the spacer layer device is abnormal is avoided.
The above detailed description is given to the embodiment of the method for synchronizing data in a data communication gateway machine according to the present invention, and the present invention further provides a device for synchronizing data in a data communication gateway machine, and a computer-readable storage medium corresponding to the method.
Fig. 6 is a schematic structural diagram of an apparatus for synchronizing data during a data communication gateway apparatus according to an embodiment of the present invention, as shown in the figure, the apparatus includes:
the sending module 61 is configured to send a retrieval identifier to the standby device when detecting that the communication with the bay layer device is abnormal, so that the standby device searches for corresponding telecommand displacement data in a preset cache region according to the retrieval identifier;
the receiving module 62 is configured to receive the telecommand displacement data returned by the standby machine;
and the synchronization module 63 is used for synchronizing the remote signaling displacement data to the master station system.
The device for synchronizing data of the data communication gateway machine has the beneficial effect of the method for synchronizing data of the data communication gateway machine.
Fig. 7 is a schematic structural diagram of a data communication gateway according to an embodiment of the present invention, as shown in the figure, including:
a memory 71 for storing a computer program;
a processor 72 for executing the computer program to implement the following steps from time to time:
when the communication abnormality with the spacer layer device is detected, sending a retrieval identifier to the standby machine so that the standby machine can search corresponding telecommand displacement data in a preset cache region according to the retrieval identifier;
receiving remote signaling displacement data returned by the standby machine;
and synchronizing the remote signaling displacement data to the master station system.
The data communication gateway machine provided by the invention has the beneficial effect of the method for synchronizing the data of the data communication gateway machine.
To solve the above technical problem, the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program when executed by a processor implements the following steps:
when the communication abnormality with the spacer layer device is detected, sending a retrieval identifier to the standby machine so that the standby machine can search corresponding telecommand displacement data in a preset cache region according to the retrieval identifier;
receiving remote signaling displacement data returned by the standby machine;
and synchronizing the remote signaling displacement data to the master station system.
The computer-readable storage medium provided by the embodiment has the beneficial effects of the method for synchronizing data during the shutdown of the data communication network.
The method and the device for synchronizing data of the data communication gateway machine, the data communication gateway machine and the computer readable storage medium provided by the invention are described in detail above. The principles and embodiments of the present invention are explained herein using specific examples, which are set forth only to help understand the method and its core ideas of the present invention. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.
The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.