CN114116906A - Data synchronization method, device, electronic device and storage medium - Google Patents

Data synchronization method, device, electronic device and storage medium Download PDF

Info

Publication number
CN114116906A
CN114116906A CN202111426869.9A CN202111426869A CN114116906A CN 114116906 A CN114116906 A CN 114116906A CN 202111426869 A CN202111426869 A CN 202111426869A CN 114116906 A CN114116906 A CN 114116906A
Authority
CN
China
Prior art keywords
data
time
real
control system
historical
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111426869.9A
Other languages
Chinese (zh)
Inventor
蒋骏
汪宏毅
戴晓华
罗幸明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Supcon Technology Co Ltd
Original Assignee
Zhejiang Supcon Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Supcon Technology Co Ltd filed Critical Zhejiang Supcon Technology Co Ltd
Priority to CN202111426869.9A priority Critical patent/CN114116906A/en
Publication of CN114116906A publication Critical patent/CN114116906A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application relates to a data synchronization method, a data synchronization device, an electronic device and a storage medium, wherein the data storage method comprises the following steps: acquiring historical diagnosis data based on a preset time period, wherein the historical diagnosis data is the latest running state information of the control system stored in a database; acquiring real-time diagnosis data, wherein the real-time diagnosis data is the running state information of the control system acquired by a target server; and judging whether the time interval between the historical diagnostic data and the real-time diagnostic data exceeds the preset time period, if so, determining the real-time diagnostic data as synchronous data, and carrying out data synchronization. According to the method and the device, the technical problem that the time information displayed in different control software and the system running condition are inconsistent in the prior art is solved, the time information of different servers and the system running condition are consistent, and the diagnosis accuracy of the control system is improved.

Description

Data synchronization method, device, electronic device and storage medium
Technical Field
The present application relates to the field of industrial control, and in particular, to a data synchronization method, apparatus, electronic apparatus, and storage medium.
Background
With the continuous development of control technology, the application of industrial control software is more and more extensive. The industrial control software has important application value as an important means of industrial automation. The diagnosis module is used as an important component in industrial control software, bears the diagnosis function of the whole control system and is used for monitoring the operation condition of the control system. Currently, the diagnostic module has mainly the following functions: observing the running state of the system through an instrument control fault interface and a configuration flow chart; checking the diagnostic state of the system through a current value page; viewing the historical state of the system through a log interface; and adding a historical trend form through the diagnostic data to trace back the running state of the system.
When a user needs to obtain diagnosis data, because the control system does not need to display time externally in the operation process, in the prior art, the diagnosis data such as real-time data, instrument control fault data and the like of different control devices and network nodes are obtained through different processing ends, time information and system operation conditions are further extracted based on the diagnosis data, and the time information and the system operation conditions are displayed on a display interface of industrial control software. However, the time of the diagnostic data acquired by each processing terminal may be different, so that the diagnostic data acquired by different processing terminals may be inconsistent, and further, the time information displayed in different control software and the system operating condition may be inconsistent.
Aiming at the technical problem that time information displayed in different control software and system running conditions are inconsistent in the related art, no effective solution is provided at present.
Disclosure of Invention
The embodiment provides a data synchronization method, a data synchronization device, a data synchronization system, an electronic device and a storage medium, so as to solve the problem that time information displayed in different control software and system operation conditions are not consistent in the related art.
In a first aspect, in this embodiment, a data synchronization method is provided, which is applied to a control system, and includes:
acquiring historical diagnosis data based on a preset time period, wherein the historical diagnosis data is the latest running state information of the control system stored in a database;
acquiring real-time diagnosis data, wherein the real-time diagnosis data is the running state information of the control system acquired by a target server;
and judging whether the time interval between the historical diagnostic data and the real-time diagnostic data exceeds the preset time period, if so, determining the real-time diagnostic data as synchronous data, and carrying out data synchronization.
In some of these embodiments, the obtaining real-time diagnostic data further comprises:
and if the real-time diagnosis data is failed to be acquired, taking the historical diagnosis data as the synchronous data to carry out data synchronization.
In some of these embodiments, determining the real-time diagnostic data as synchronous data further comprises:
analyzing the synchronous data;
and judging whether the analysis result meets preset conditions or not, if not, judging that a fault exists in the control system, and outputting fault prompt information, wherein the preset conditions at least comprise network load conditions and network communication conditions.
In some of these embodiments, the obtaining real-time diagnostic data further comprises:
and if the real-time diagnosis data is failed to be acquired, judging that a fault exists in the control system, and outputting fault prompt information.
In some of these embodiments, determining that there is a fault in the control system further comprises:
acquiring historical fault data, and acquiring the duration of a fault based on the historical fault data;
judging whether the duration time of the fault exceeds preset time or not;
and if the preset time is exceeded, judging that the control system is in a serious fault state, and outputting a serious fault prompt message.
In some of these embodiments, the control system includes at least a control device, a server, and a client, and the obtaining real-time diagnostic data includes:
and respectively acquiring and summarizing the running state information of the control equipment, the server and the client to obtain the real-time diagnosis data.
In some embodiments, the determining whether the time interval between the historical diagnostic data and the real-time diagnostic data exceeds the preset time period further includes:
and if the historical diagnostic data does not exceed the preset threshold, taking the historical diagnostic data as synchronous data to carry out data synchronization.
In a second aspect, in this embodiment, there is provided a data synchronization apparatus, applied to a control system, including:
the system comprises a first acquisition module, a second acquisition module and a control module, wherein the first acquisition module is used for acquiring historical diagnostic data based on a preset time period, and the historical diagnostic data is the latest running state information of a control system stored in a database;
the second acquisition module is used for acquiring real-time diagnosis data, wherein the real-time diagnosis data is the running state information of the control system acquired by the target server;
and the judging module is used for judging whether the time interval between the historical diagnostic data and the real-time diagnostic data exceeds the preset time period, and if so, determining the real-time diagnostic data as synchronous data to perform data synchronization.
In a third aspect, in this embodiment, there is provided an electronic apparatus, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the data synchronization method of the first aspect is implemented.
In a fourth aspect, in the present embodiment, there is provided a storage medium having stored thereon a computer program which, when executed by a processor, implements the data synchronization method of the first aspect described above.
Compared with the related art, the data synchronization method, the data synchronization device, the electronic device and the storage medium provided in the embodiment acquire historical diagnostic data based on a preset time period, wherein the historical diagnostic data is the latest operating state information of the control system stored in the database; acquiring real-time diagnosis data, wherein the real-time diagnosis data is the running state information of the control system acquired by a target server; and judging whether the time interval between the historical diagnostic data and the real-time diagnostic data exceeds the preset time period, if so, determining the real-time diagnostic data as synchronous data, and carrying out data synchronization. The time interval of the historical diagnostic data and the real-time diagnostic data is judged, and the real-time diagnostic data of which the time interval exceeds a time period is further determined as synchronous data, so that the synchronous data in each server is always the latest running state information of the control system, the technical problem that the time information displayed in different control software and the running state of the system are not consistent in the prior art is solved, the time information of different servers and the running state of the system are consistent, and the diagnostic accuracy of the control system is improved.
The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below to provide a more thorough understanding of the application.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a block diagram of a terminal hardware structure of a data synchronization method according to an embodiment of the present invention;
FIG. 2 is a flow chart of a data synchronization method according to an embodiment of the invention;
FIG. 3 is a schematic structural diagram of a data synchronization system according to an embodiment of the present invention;
FIG. 4 is a flow chart of a data synchronization method according to another embodiment of the present invention;
fig. 5 is a block diagram of a data synchronization apparatus according to an embodiment of the present invention.
Detailed Description
For a clearer understanding of the objects, aspects and advantages of the present application, reference is made to the following description and accompanying drawings.
Unless defined otherwise, technical or scientific terms used herein shall have the same general meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The use of the terms "a" and "an" and "the" and similar referents in the context of this application do not denote a limitation of quantity, either in the singular or the plural. The terms "comprises," "comprising," "has," "having," and any variations thereof, as referred to in this application, are intended to cover non-exclusive inclusions; for example, a process, method, and system, article, or apparatus that comprises a list of steps or modules (elements) is not limited to the listed steps or modules, but may include other steps or modules (elements) not listed or inherent to such process, method, article, or apparatus. Reference throughout this application to "connected," "coupled," and the like is not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. Reference to "a plurality" in this application means two or more. "and/or" describes an association relationship of associated objects, meaning that three relationships may exist, for example, "A and/or B" may mean: a exists alone, A and B exist simultaneously, and B exists alone. In general, the character "/" indicates a relationship in which the objects associated before and after are an "or". The terms "first," "second," "third," and the like in this application are used for distinguishing between similar items and not necessarily for describing a particular sequential or chronological order.
The method embodiments provided in the present embodiment may be executed in a terminal, a computer, or a similar computing device. For example, the method is executed on a terminal, and fig. 1 is a block diagram of a hardware structure of the terminal according to the data synchronization method of the present embodiment. As shown in fig. 1, the terminal may include one or more processors 102 (only one shown in fig. 1) and a memory 104 for storing data, wherein the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA. The terminal may also include a transmission device 106 for communication functions and an input-output device 108. It will be understood by those of ordinary skill in the art that the structure shown in fig. 1 is merely an illustration and is not intended to limit the structure of the terminal described above. For example, the terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used for storing computer programs, for example, software programs and modules of application software, such as a computer program corresponding to the data synchronization method in the present embodiment, and the processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, so as to implement the above-mentioned method. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used to receive or transmit data via a network. The network described above includes a wireless network provided by a communication provider of the terminal. In one example, the transmission device 106 includes a Network adapter (NIC) that can be connected to other Network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used to communicate with the internet in a wireless manner.
Referring to fig. 2, fig. 2 is a flow chart illustrating a data synchronization method according to an embodiment of the invention. In this embodiment, the data synchronization method includes:
s202: historical diagnostic data is acquired based on a preset time period, and the historical diagnostic data is latest running state information of the control system stored in a database.
Illustratively, a preset time period is set, and historical diagnosis data is acquired based on the preset time period, wherein the historical diagnosis data comprises the diagnosis data which is stored in a database of other servers except the target server and is closest to the current time, and the diagnosis data comprises the running state information of the whole control system. Specifically, all diagnostic data of a server in the control system are obtained and cached, a diagnostic data queue is obtained based on time sequence, and the latest diagnostic data in the diagnostic data queue is further used as historical diagnostic data.
S204: and acquiring real-time diagnosis data, wherein the real-time diagnosis data is the running state information of the control system acquired by the target server.
Illustratively, real-time diagnosis data of the current time is acquired, wherein the real-time diagnosis data comprises the current operation state information of the control system acquired by the target server. Specifically, a control instruction is sent to a target server, and the target server is controlled to acquire and send real-time diagnosis data; and receiving the real-time diagnosis data sent by the target server.
S206: and judging whether the time interval between the historical diagnostic data and the real-time diagnostic data exceeds a preset time period, if so, determining the real-time diagnostic data as synchronous data, and performing data synchronization.
Illustratively, corresponding time information is acquired based on historical diagnostic data and real-time diagnostic data respectively, a time interval between the historical diagnostic data and the real-time diagnostic data is determined based on the time information, whether the time interval exceeds a preset time period or not is further judged, and if the time interval exceeds the preset time period, the real-time diagnostic data is taken as synchronous data to perform data synchronization. It can be understood that, if the time interval exceeds the preset time period, it indicates that the acquisition time of the historical diagnostic data and the acquisition time of the real-time diagnostic data are not in the same time period, and at this time, the real-time diagnostic data needs to be used as synchronous data, so as to synchronize the diagnostic data in the control system. The real-time diagnosis data and the historical diagnosis data have time stamps, namely the time for acquiring the diagnosis data, and the time information of the real-time diagnosis data and the historical diagnosis data is determined based on the time stamps.
In one specific embodiment, other servers except the target server only perform data communication with the target server, and the data synchronization method in the embodiment ensures that the diagnostic data in the local server is consistent with the real-time diagnostic data of the target server. Specifically, the other servers send data synchronization requests to the target server, and the target server receives and processes the data synchronization requests, acquires real-time diagnostic data, and returns the real-time diagnostic data to the other servers.
In another specific embodiment, a time stamp of historical diagnostic data and a time stamp of real-time diagnostic data are obtained, where the time stamp is in a unit of a preset time period, and may be 1 s; and judging whether the time tag of the historical diagnostic data is later than that of the real-time diagnostic data, if so, judging that the historical diagnostic data is invalid, and further taking the real-time diagnostic data as synchronous data.
Alternatively, the synchronization period of the setting data is 1s, and the diagnostic data packet transmission period in the control system may be set based on software. When a plurality of diagnostic data are processed in one synchronization cycle, there may be a conflict between the diagnostic data, resulting in a reduction in the time of the fail-over period. To ensure that the fault trigger cycle coincides with the data synchronization cycle, only one diagnostic data is processed in each cycle. For example, when two diagnostic data exist in the same synchronization period, i.e. the packet transmission period of the control system is 500ms, only the diagnostic data between 1-500ms is accepted, and the diagnostic data within 500-1000ms is discarded, thereby avoiding processing different real-time diagnostic data in the same time period.
Optionally, the control device, the server, the client, and other devices in the control system all have a time synchronization function, and time information of the whole system is synchronized through the time synchronization functions of different devices, so that all device times of the whole system are ensured to be in a synchronization state.
The method includes the steps that historical diagnosis data are obtained based on a preset time period, and the historical diagnosis data are latest running state information of a control system stored in a database; acquiring real-time diagnosis data, wherein the real-time diagnosis data is the running state information of the control system acquired by a target server; and judging whether the time interval between the historical diagnostic data and the real-time diagnostic data exceeds a preset time period, if so, determining the real-time diagnostic data as synchronous data, and performing data synchronization. The time interval of the historical diagnostic data and the real-time diagnostic data is judged, and the real-time diagnostic data of which the time interval exceeds a time period is further determined as synchronous data, so that the synchronous data in each server is always the latest running state information of the control system, the technical problem that the time information displayed in different control software and the running state of the system are not consistent in the prior art is solved, the time information of different servers and the running state of the system are consistent, and the diagnostic accuracy of the control system is improved.
In another embodiment, the obtaining real-time diagnostic data further comprises:
and if the real-time diagnosis data are failed to be acquired, taking the historical diagnosis data as synchronous data to carry out data synchronization.
Illustratively, after the operation of acquiring the real-time diagnostic data is performed, it is determined whether the real-time diagnostic data is successfully acquired. And if the real-time diagnosis data cannot be acquired, taking the historical diagnosis data as synchronous data. It is understood that since there is no current real-time diagnostic data, the historical diagnostic data closest to the current point in time is taken as the synchronization data.
In one embodiment, the preset time period is set to 1s, and the data synchronization operation is performed every 1 s. If the real-time diagnosis data is not acquired, the time stamp of the historical diagnosis data is increased by 1s to be used as the time stamp of the period, at the moment, the historical diagnosis data is synchronous data, namely the historical diagnosis data of the last preset perfect period is used as the synchronous data of the current period.
In this embodiment, if the real-time diagnostic data fails to be acquired, the historical diagnostic data is used as the synchronization data to perform data synchronization. When the control system has an unexpected condition and cannot acquire real-time diagnosis data, the historical diagnosis data of the previous preset time period is used as synchronous data, so that the continuous operation of data synchronization is ensured, and the stability of the control system is improved.
In another embodiment, determining the real-time diagnostic data as the synchronization data further comprises:
step 1: analyzing the synchronous data;
step 2: and judging whether the analysis result meets preset conditions or not, if not, judging that a fault exists in the control system, and outputting fault prompt information, wherein the preset conditions at least comprise network load conditions and network communication conditions.
Illustratively, after the synchronous data are acquired, the synchronous data are analyzed according to a data analysis protocol, the analyzed synchronous data are judged according to a preset condition, if the synchronous data do not meet the preset condition, a fault exists in the control system, and fault prompt information is output to a user. The preset conditions at least comprise network load conditions and network communication conditions. Specifically, the network load condition is used to determine whether there is an overload operation condition in the control system, and the network connection condition is used to determine whether there is an open circuit condition in the control system. It is understood that the preset condition may also include other conditions, such as whether the device accessing the system has the related right, and the present embodiment is not limited thereto.
In one specific embodiment, the method includes the steps that data of all nodes in a control system are obtained, wherein the nodes comprise control equipment and two-layer nodes, the two-layer nodes comprise operation nodes and server nodes, and control system monitoring software can be run based on the two-layer nodes to monitor the control system and obtain the data of all the nodes; analyzing and processing the data of all the nodes to obtain diagnosis data; determining whether the control system has a fault or not according to the contents of system operation load, network on-off state and the like; and if the data of the node is not received, judging that the control system is in a suspected fault state.
Optionally, a mechanism for analyzing and processing the synchronization data is set: acquiring synchronous data every 1s of time period; if the synchronous data are obtained, analyzing the synchronous data in real time; and if the synchronous data cannot be acquired, acquiring the synchronous data every 1 s.
The embodiment analyzes the synchronous data; and judging whether the analysis result meets preset conditions or not, if not, judging that a fault exists in the control system, and outputting fault prompt information, wherein the preset conditions at least comprise network load conditions and network communication conditions. The synchronous data is judged according to the preset conditions, whether faults exist in the control system is further identified, accordingly, potential safety hazards in the control system are found in time, and stability and safety of the control system are improved.
In another embodiment, the obtaining real-time diagnostic data further comprises:
and if the real-time diagnosis data is failed to be acquired, judging that a fault exists in the control system, and outputting fault prompt information.
For example, after the step of obtaining the real-time diagnostic data is performed, if the real-time diagnostic data is not successfully obtained, it indicates that a fault exists in the control system, so that the real-time diagnostic data cannot be obtained, and at this time, it is directly determined that the fault exists in the control system, and fault prompt information is output to a user.
Specifically, the diagnosis state of the control network is determined according to whether a network message of real-time diagnosis data is received: if the real-time network message of the control system can be received, judging that the control system is in a normal operation state; and if the real-time network message of the control system cannot be received, judging that a fault exists in the control system.
If the real-time diagnosis data fails to be acquired, the fault in the control system is judged, and fault prompt information is output. When the real-time diagnosis data is not received, the fault in the control system is directly judged, so that the potential safety hazard in the control system is timely found and processed, and the safety of the control system is improved.
In another embodiment, determining that a fault exists in the control system further comprises:
step 1: acquiring historical fault data, and acquiring the duration of the fault based on the historical fault data;
step 2: judging whether the duration time of the fault exceeds preset time or not;
and step 3: and if the preset time is exceeded, judging that the control system is in a serious fault state, and outputting a serious fault prompt message.
Illustratively, upon detecting a fault in the control system, historical fault data is obtained. Wherein the historical fault data is diagnostic data in a historical time period in which a fault exists. Based on the historical fault data, a continuous historical time period is determined that includes the current time period, and thus the duration. For example, 10 historical time periods are included before the current time period, and the historical time period 1 to the historical time period 10 and the current time period are respectively set according to the time sequence. If the fault exists in the historical time period 2-the current time period, the duration is the historical time period 2-the current time period; if the fault exists in the historical time period 1-the historical time period 5, the historical time period 7-the current time period, and the fault does not exist in the historical time period 6, the duration is the historical time period 7-the current time period.
Illustratively, determining whether the duration of the fault exceeds a preset time; and if the duration time of the fault exceeds the preset time, judging that the control system is in a serious fault state, and outputting fault prompt information to a user. The serious fault state refers to the situation that a persistent fault exists in the control system, the severity of potential safety hazards of the control system is higher than that of general faults or temporary faults, and in most cases, the control system cannot automatically remove the serious fault state and needs manual intervention.
Specifically, whether the fault duration time of the control system reaches the filtering time is judged, if yes, the fact that the control system actually triggers the fault is indicated, and if the state of the actual triggering fault has a corresponding reminding module, reminding information is pushed to a user. The filtering time is used for shielding short-term or intermittent faults and avoiding the fault judgment in the control system.
In one specific embodiment, data is acquired through a controller and a diagnostic data collection program running on a layer two node, wherein the diagnostic data collection program is deployed on the layer two node and is used for acquiring the running state of an operating node where monitoring software is located and periodically sending the running state; receiving and processing data acquired by a controller and a diagnostic data collection program through a diagnostic service program to obtain real-time diagnostic data, wherein the diagnostic service program is deployed in all two-layer nodes, and all data of the controller and the two-layer nodes are collected and summarized to obtain the real-time diagnostic data; analyzing the real-time diagnosis data through a related program to obtain a real-time diagnosis state of the control system; and determining a fault prompt state based on the real-time diagnosis state, if fault prompt needs to be carried out on the user, pushing prompt information to a prompt module through a diagnosis service program, and displaying the prompt information to the outside through the prompt module.
The embodiment acquires historical fault data and acquires the fault duration based on the historical fault data; judging whether the duration time of the fault exceeds preset time or not; and if the preset time is exceeded, judging that the control system is in a serious fault state, and outputting a serious fault prompt message. Whether the duration time of the fault exceeds the preset time is judged to avoid intermittent fault occurrence, or under the condition that the control system automatically repairs the fault in time after the fault occurs, prompt information for prompting errors is pushed to a user, and finally the fault judgment is avoided.
In another embodiment, the control system includes at least a control device, a server, and a client, and obtaining real-time diagnostic data includes:
and respectively acquiring and summarizing the running state information of the control equipment, the server and the client to obtain real-time diagnosis data.
Illustratively, the control system comprises a control device, a server and a client, wherein the server corresponds to the server node, and the client corresponds to the operation node, and the server and the client form a two-layer node together. The real-time diagnosis data of the control network is finally obtained by acquiring and summarizing the running state information of all control equipment, servers and clients in the control network.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a data synchronization system according to an embodiment of the present invention. Specifically, the control system further includes a control network and an operation network, wherein the control network is used for data interaction between the control devices and the monitoring software, the operation network is used for data transmission between the monitoring software, and the monitoring software can be run on the client.
In one embodiment, the diagnostic service runs on all of the tier two nodes, i.e., servers and clients. When more than two servers exist in the control system, a master diagnosis server and a slave diagnosis server are deployed according to the system requirements and the operation states of the servers, wherein the master diagnosis server can be used as a target server in the invention. Except the master diagnosis server and the slave diagnosis server, the servers of the other two-layer nodes are common diagnosis servers.
In another embodiment, the control device periodically obtains the operation status information of the control device, including a system diagnosis status, an operation status, a control status, and the like, and sends the operation status information of the control device in the control network through a multicast protocol. The diagnostic data collection program is used for acquiring the working state of the current node, including the network state, the load state and the like, and transmitting the running state information of the current node in the operation network through a multicast protocol.
Optionally, the control device performs data transmission in two control networks at the same time, where the period of data transmission is 500ms or 1 s; the diagnostic service program simultaneously carries out data transmission in two operation networks, and the period of the data transmission is 1 s.
In another embodiment, the structure of the data packet of the real-time diagnostic data includes a packet header, a packet command word, a timestamp, a packet content, and a packet trailer. The packet header is used for identifying a binary protocol to analyze the real-time diagnostic data, the packet command word is used for distinguishing different real-time diagnostic data, and the packet content is used for storing the content of the real-time diagnostic data.
The embodiment respectively obtains and summarizes the running state information of the control equipment, the server and the client to obtain the real-time diagnosis data, improves the comprehensiveness of the real-time diagnosis data, and further improves the accuracy of data synchronization.
In another embodiment, the determining whether the time interval between the historical diagnostic data and the real-time diagnostic data exceeds the preset time period further comprises:
and if the historical diagnostic data does not exceed the preset threshold, taking the historical diagnostic data as synchronous data to carry out data synchronization.
Illustratively, time information of historical diagnostic data and real-time diagnostic data is acquired, and whether the time interval between the historical diagnostic data and the real-time diagnostic data exceeds a preset time period is determined based on the time information. If the preset time period is not exceeded, the historical diagnosis data and the real-time diagnosis data are in the same time period, and the historical diagnosis data are directly used as synchronous data.
In this embodiment, if the historical diagnostic data does not exceed the predetermined threshold, the historical diagnostic data is used as synchronization data to perform data synchronization. By using historical diagnostic data as synchronous data, only one diagnostic data exists in the same time period, thereby avoiding the conflict between different diagnostic data and improving the accuracy of data synchronization.
In another embodiment, the obtaining real-time diagnostic data further comprises:
real-time diagnostic data is saved to a database based on the chronological order.
Illustratively, the real-time diagnostic data is saved to the database in chronological order of acquisition of the real-time diagnostic data. Specifically, the real-time diagnosis data are stored in the database according to the time sequence through time serialization, so that the historical state of the real-time diagnosis data can be inquired through the database in the following process.
Optionally, the database supports a function of querying a single record or querying a plurality of records in batch, and further keeps timestamps of different devices in the control system consistent.
In one specific embodiment, data during all data synchronization and backup data are acquired, wherein the data during the data synchronization comprises logic calculation data and synchronization data, and the backup data comprises all diagnosis data and fault data.
In another embodiment, the data synchronization method further comprises:
an online mode and an offline mode are set based on the data synchronization method, the online mode can support the data synchronization function, and the offline mode cannot support the data synchronization function.
Referring to fig. 4, fig. 4 is a flowchart illustrating a data synchronization method according to another embodiment of the invention. Specifically, the online mode supports full functionality and can synchronize data in the control system, while the offline mode only supports core functionality and can process diagnostic data but cannot synchronize data. The method for distinguishing the online mode from the offline mode comprises the following steps: and judging whether the main diagnosis service program exists in the control system. If the main diagnosis service program exists in the control system, the control system is in an online mode; if the main diagnosis service program does not exist in the control system, the control system is in an off-line mode. The main diagnosis service program is a diagnosis service program operated in a main diagnosis server.
In this embodiment, an online mode and an offline mode are set based on the data synchronization method, where the online mode may support the data synchronization function, and the offline mode may not support the data synchronization function. By setting the online mode and the offline mode, the control system selects the online mode to perform data synchronization or selects the offline mode not to perform data synchronization according to actual requirements, the control system does not need to be in a data synchronization state all the time, and computing resources in the control system are saved.
It should be noted that the steps illustrated in the above-described flow diagrams or in the flow diagrams of the figures may be performed in a computer system, such as a set of computer-executable instructions, and that, although a logical order is illustrated in the flow diagrams, in some cases, the steps illustrated or described may be performed in an order different than here.
In this embodiment, a data synchronization apparatus is further provided, and the apparatus is used to implement the foregoing embodiments and preferred embodiments, and the description already made is omitted. The terms "module," "unit," "subunit," and the like as used below may implement a combination of software and/or hardware for a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 5 is a block diagram of the data synchronization apparatus of the present embodiment, and as shown in fig. 5, the apparatus includes:
the system comprises a first acquisition module, a second acquisition module and a control module, wherein the first acquisition module is used for acquiring historical diagnosis data based on a preset time period, and the historical diagnosis data is the latest running state information of the control system stored in a database;
the second acquisition module is used for acquiring real-time diagnosis data, and the real-time diagnosis data is the running state information of the control system acquired by the target server;
the second acquisition module is also used for respectively acquiring and summarizing the running state information of the control equipment, the server and the client to obtain real-time diagnosis data;
the judging module is used for judging whether the time interval between the historical diagnostic data and the real-time diagnostic data exceeds a preset time period or not, and if so, determining the real-time diagnostic data as synchronous data and carrying out data synchronization;
the data synchronization device also comprises a synchronization module;
the synchronization module is used for taking the historical diagnosis data as synchronization data to carry out data synchronization if the real-time diagnosis data fails to be acquired;
the data synchronization device also comprises an analysis module;
the analysis module is used for analyzing the synchronous data;
judging whether the analysis result meets preset conditions or not, if not, judging that a fault exists in the control system, and outputting fault prompt information, wherein the preset conditions at least comprise network load conditions and network communication conditions;
the data synchronization device also comprises a judgment module;
the judging module is used for judging that a fault exists in the control system and outputting fault prompt information if the real-time diagnosis data acquisition fails;
the data synchronization device also comprises a continuous fault module;
the continuous fault module is used for acquiring historical fault data and acquiring the fault duration based on the historical fault data;
judging whether the duration time of the fault exceeds preset time or not;
if the preset time is exceeded, judging that the control system is in a serious fault state, and outputting a serious fault prompt message;
the data synchronization device also comprises a second synchronization module;
and the second synchronization module is used for taking the historical diagnosis data as synchronization data to perform data synchronization if the historical diagnosis data does not exceed the preset threshold.
The above modules may be functional modules or program modules, and may be implemented by software or hardware. For a module implemented by hardware, the modules may be located in the same processor; or the modules can be respectively positioned in different processors in any combination.
There is also provided in this embodiment an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.
Optionally, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, acquiring historical diagnosis data based on a preset time period, wherein the historical diagnosis data is the latest running state information of the control system stored in the database;
s2, acquiring real-time diagnosis data, wherein the real-time diagnosis data are the running state information of the control system acquired by the target server;
and S3, judging whether the time interval between the historical diagnosis data and the real-time diagnosis data exceeds a preset time period, if so, determining the real-time diagnosis data as synchronous data, and carrying out data synchronization.
It should be noted that, for specific examples in this embodiment, reference may be made to the examples described in the foregoing embodiments and optional implementations, and details are not described again in this embodiment.
In addition, in combination with the data synchronization method provided in the foregoing embodiment, a storage medium may also be provided to implement in this embodiment. The storage medium having stored thereon a computer program; the computer program, when executed by a processor, implements any of the data synchronization methods in the above embodiments.
It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to be limiting. All other embodiments, which can be derived by a person skilled in the art from the examples provided herein without any inventive step, shall fall within the scope of protection of the present application.
It is obvious that the drawings are only examples or embodiments of the present application, and it is obvious to those skilled in the art that the present application can be applied to other similar cases according to the drawings without creative efforts. Moreover, it should be appreciated that in the development of any such actual implementation, as in any engineering or design project, numerous implementation-specific decisions must be made to achieve the developers' specific goals, such as compliance with system-related and business-related constraints, which may vary from one implementation to another.
The term "embodiment" is used herein to mean that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is to be expressly or implicitly understood by one of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the patent protection. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims (10)

1. A data synchronization method is applied to a control system and is characterized by comprising the following steps:
acquiring historical diagnosis data based on a preset time period, wherein the historical diagnosis data is the latest running state information of the control system stored in a database;
acquiring real-time diagnosis data, wherein the real-time diagnosis data is the running state information of the control system acquired by a target server;
and judging whether the time interval between the historical diagnostic data and the real-time diagnostic data exceeds the preset time period, if so, determining the real-time diagnostic data as synchronous data, and carrying out data synchronization.
2. The data synchronization method of claim 1, wherein the obtaining real-time diagnostic data further comprises:
and if the real-time diagnosis data is failed to be acquired, taking the historical diagnosis data as the synchronous data to carry out data synchronization.
3. The data synchronization method of claim 1, wherein determining the real-time diagnostic data as synchronization data further comprises:
analyzing the synchronous data;
and judging whether the analysis result meets preset conditions or not, if not, judging that a fault exists in the control system, and outputting fault prompt information, wherein the preset conditions at least comprise network load conditions and network communication conditions.
4. The data synchronization method of claim 1, wherein the obtaining real-time diagnostic data further comprises:
and if the real-time diagnosis data is failed to be acquired, judging that a fault exists in the control system, and outputting fault prompt information.
5. The data synchronization method according to claim 3 or 4, wherein determining that there is a fault in the control system further comprises:
acquiring historical fault data, and acquiring the duration of a fault based on the historical fault data;
judging whether the duration time of the fault exceeds preset time or not;
and if the preset time is exceeded, judging that the control system is in a serious fault state, and outputting a serious fault prompt message.
6. The data synchronization method of claim 1, wherein the control system comprises at least a control device, a server, and a client, and the obtaining real-time diagnostic data comprises:
and respectively acquiring and summarizing the running state information of the control equipment, the server and the client to obtain the real-time diagnosis data.
7. The data synchronization method according to claim 1, wherein the determining whether the time interval between the historical diagnostic data and the real-time diagnostic data exceeds the preset time period further comprises:
and if the historical diagnostic data does not exceed the preset threshold, taking the historical diagnostic data as synchronous data to carry out data synchronization.
8. A data synchronization device applied to a control system is characterized by comprising:
the system comprises a first acquisition module, a second acquisition module and a control module, wherein the first acquisition module is used for acquiring historical diagnostic data based on a preset time period, and the historical diagnostic data is the latest running state information of a control system stored in a database;
the second acquisition module is used for acquiring real-time diagnosis data, wherein the real-time diagnosis data is the running state information of the control system acquired by the target server;
and the judging module is used for judging whether the time interval between the historical diagnostic data and the real-time diagnostic data exceeds the preset time period, and if so, determining the real-time diagnostic data as synchronous data to perform data synchronization.
9. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, and the processor is configured to execute the computer program to perform the data synchronization method of any of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the data synchronization method according to any one of claims 1 to 7.
CN202111426869.9A 2021-11-28 2021-11-28 Data synchronization method, device, electronic device and storage medium Pending CN114116906A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111426869.9A CN114116906A (en) 2021-11-28 2021-11-28 Data synchronization method, device, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111426869.9A CN114116906A (en) 2021-11-28 2021-11-28 Data synchronization method, device, electronic device and storage medium

Publications (1)

Publication Number Publication Date
CN114116906A true CN114116906A (en) 2022-03-01

Family

ID=80370468

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111426869.9A Pending CN114116906A (en) 2021-11-28 2021-11-28 Data synchronization method, device, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN114116906A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114305702A (en) * 2022-03-07 2022-04-12 极限人工智能有限公司 Method and device for detecting surgical robot system, robot and medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114305702A (en) * 2022-03-07 2022-04-12 极限人工智能有限公司 Method and device for detecting surgical robot system, robot and medium

Similar Documents

Publication Publication Date Title
CN107547589B (en) Data acquisition processing method and device
CN103795580A (en) Data monitoring method, system and related equipment
CN110908879A (en) Method, device, terminal and storage medium for reporting buried point data
CN109960634B (en) Application program monitoring method, device and system
CN110493075B (en) Method, device and system for monitoring online duration of equipment
CN101997925A (en) Server monitoring method with early warning function and system thereof
CN112506702B (en) Disaster recovery method, device, equipment and storage medium for data center
CN112422684B (en) Target message processing method and device, storage medium and electronic device
CN112202635B (en) Link monitoring method and device, storage medium and electronic device
CN114675983A (en) Business data processing method and device, storage medium and electronic equipment
CN112486707A (en) Redis-based message asynchronous consumption method and device
CN111865674B (en) Log processing method, device and medium
CN105450479A (en) Method and apparatus for monitoring module
CN114116906A (en) Data synchronization method, device, electronic device and storage medium
CN113765690A (en) Cluster switching method, system, device, terminal, server and storage medium
CN103001822A (en) Network anomaly handling method and device
CN113010379A (en) Electronic equipment monitoring system
CN110224872B (en) Communication method, device and storage medium
CN112417050A (en) Data synchronization method and device, system, storage medium and electronic device
CN111818582A (en) Data transmission method and device and electronic equipment
CN114338477B (en) Communication link monitoring method, device, equipment and storage medium
CN110597672A (en) Method and device for main/standby switching of ATCA switching system
CN115208905A (en) Device information synchronization method, device, system, electronic device and storage medium
CN112437146B (en) Equipment state synchronization method, device and system
CN116260747A (en) Monitoring method and device of terminal test equipment and electronic equipment

Legal Events

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