A method for synchronization of main and auxiliary substation machines based on time-segment historical events
By adopting a time segment-based synchronization method in the substation monitoring system, the problems of synchronization consistency and low efficiency of the main and auxiliary dual-machine historical matters are solved, and efficient and reliable synchronization of historical matters is achieved.
Patent Information
- Application Number
- CN202010674877.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-14
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2040-07-14
AI Technical Summary
In the substation monitoring system, the synchronization mechanism of the main and auxiliary dual-computer historical matters has problems such as insufficient consistency guarantee and low synchronization efficiency.
The synchronization method based on time segments is adopted. By dividing hierarchical time segments, and based on the synchronization identification and event summary of the time segment, we judge whether the two machines need to be synchronized. If synchronization is required, the minimum time segment will be disassembled step by step, extract historical events and perform two-way comparison and synchronization.
On the basis of ensuring the consistency of historical matters between the two machines, the efficiency of historical matters comparison and synchronization between the two machines is improved, and the reliability and efficiency of synchronization are enhanced.
Smart Images

Figure CN111813859B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the technical field of data synchronization, and in particular to a method for synchronizing a master-slave dual machine of a substation historical event based on time segments. Background Art
[0002] During the actual operation of the substation monitoring system, a large number of operation and alarm events will be generated. These historical events are stored in the historical database of the monitoring host. When a power grid failure occurs in the substation, the operation and maintenance personnel will query and comprehensively analyze the historical events to complete the fault investigation and location. Therefore, it is very important to ensure the integrity of historical events. At present, the substation monitoring system is generally deployed in a master-slave dual-machine mode, but during the operation, a monitoring host may crash or the communication may be interrupted, resulting in missing events. Especially when both the master and the auxiliary machines have lost events, how to perform two-way synchronization to ensure the integrity and consistency of the historical events of the master and the auxiliary machines is of great significance.
[0003] At present, the main primary and secondary dual-machine synchronization mechanisms for historical events include cache file synchronization mechanism and point-by-point synchronization mechanism. Their shortcomings are: the cache file synchronization mechanism cannot guarantee the consistency of historical events on both machines when the cache file is damaged or lost; and although the point-by-point synchronization mechanism guarantees the consistency of historical events on both machines, its comparison and synchronization efficiency is low.
[0004] Based on the above-mentioned deficiencies in the prior art, the present invention proposes a method for synchronizing the main and auxiliary machines of substation historical events based on time segments, which improves the comparison and synchronization efficiency of the historical events of the two machines while ensuring the consistency of the historical events of the two machines. Summary of the invention
[0005] The embodiment of the present invention provides a method for synchronizing the main and auxiliary machines of substation historical events based on time segments, which improves the comparison and synchronization efficiency of the historical events of the two machines on the basis of ensuring the consistency of the historical events of the two machines, and ensures the reliability and efficiency of the synchronization of the historical events of the two machines.
[0006] The present invention is achieved through the following technical solutions:
[0007] A method for synchronizing a main and auxiliary substation based on time segments, comprising the following steps:
[0008] Divide the hierarchical time segments and initialize the synchronization object queue;
[0009] When the synchronization time arrives, the synchronization flag and event summary of the time segment are used to determine whether the two machines need to be synchronized. If synchronization is required, the time segment is disassembled level by level to obtain the minimum time segment that needs to be synchronized.
[0010] According to the time period range of the minimum time segment, the historical events of both machines are extracted, and the historical databases of both machines are compared and synchronized in both directions according to the unique identifier of the event.
[0011] In this solution, the division of hierarchical time segments can be constructed according to the hierarchical relationship of "day-hour-minute". It should be noted that the hierarchical division of time segments here is not uniquely determined and should be constructed according to actual conditions. The synchronization identifier is a sign of whether synchronization has been performed. The unique identifier of an event is a time-space unique code generated based on the current time, clock sequence, machine identification number, etc. The event summary is a summary generated by calculating the unique identifiers of all events in the current time segment. When the historical events of the two machines in a certain time segment are inconsistent, the corresponding event summaries are also inconsistent.
[0012] Preferably, the division into hierarchical time segments and initialization of synchronization object queues are specifically performed as follows:
[0013] Create a synchronization object queue. The queue length is configured according to the actual number of synchronization days n. The synchronization objects stored in the queue are constructed according to the hierarchical relationship of "day-hour-minute". Each synchronization object contains a timestamp, synchronization identifier, and event summary.
[0014] Read the historical event synchronization operation table of the two machines and update the synchronization object queue.
[0015] Further, based on the above solution, the reading of the historical event synchronization operation table of the two machines and updating the synchronization object queue include the following steps:
[0016] Read the synchronization start time st, synchronization end time et, and synchronization identifier and event summary of each time segment in the dual-machine historical event synchronization operation table;
[0017] According to the current time ct and the actual synchronization days n, calculate the start time dt required for synchronization, where dt = ct-n. If dt is less than st, set the synchronization start time to st. If dt is between st and et, set the synchronization start time to dt.
[0018] Read the synchronization identifiers and event summaries of all time segments after the synchronization start time in the synchronization operation table, and refresh the corresponding synchronization objects in the synchronization object queue.
[0019] Further, based on the above solution, the step of determining whether the two machines need to be synchronized includes the following steps:
[0020] Determine the synchronization flags and event summaries of the two machines in the corresponding time segment. If the synchronization flag is not synchronized but the event summaries are consistent, refresh the time segment synchronization flag according to the type of time segment as follows:
[0021] 1) Whole minute: Refresh the synchronization mark of the minute as successful, traverse the synchronization marks of each minute in the hour time segment to which the minute belongs, if all are synchronized, go to 2), if there are any that are not synchronized, go to step S0;
[0022] 2) Whole hour: Refresh the synchronization mark of the hour as successful, traverse the synchronization marks of each hour in the daily time segment to which the hour belongs, if all are synchronized, go to 3), if there are unsynchronized ones, go to step S0;
[0023] 3) All day: Refresh the synchronization flag for that day as successful;
[0024] S0: Save the time segment synchronization identifier to the historical event synchronization operation table.
[0025] If the synchronization flags of the two machines in the corresponding time segments are not synchronized and the event summaries are inconsistent, the time segments are disassembled level by level according to the following process to obtain the minimum time segment that needs to be synchronized:
[0026] 1) Whole-minute synchronization: add the minute synchronization command to the synchronization command scheduling thread;
[0027] 2) Full hour synchronization: traverse the synchronization mark of each minute in the hour. If there is an unsynchronized minute object, go to 1);
[0028] 3) Full-day synchronization: traverse the synchronization flags of each hour of the day. If there are unsynchronized hourly objects, go to 2);
[0029] 4) Traverse the synchronization object queue and read the daily synchronization flag. If there is an unsynchronized daily object, go to 3).
[0030] Furthermore, in the above scheme, extracting the historical events of the two machines and performing a two-way comparison and synchronization on the historical databases of the two machines include the following steps:
[0031] Take out synchronization commands one by one from the command queue and parse the synchronization time segments of the synchronization commands;
[0032] Connect to the databases of the primary and secondary machines respectively, and obtain the historical event queue within the period according to the start and end times in the synchronization command;
[0033] Perform a two-way comparison of the historical events of the primary and secondary machines based on the unique event identifiers, and obtain the lists of historical events that need to be inserted into the two machines respectively;
[0034] Start transaction operation and insert the historical event list of both machines into the database;
[0035] Calculate the event summaries of each time segment after the synchronization of the two machines respectively, and save them in the historical event synchronization operation table;
[0036] Compare the event summaries of each time segment after the two machines are synchronized. If they are consistent, refresh the time segment synchronization flag according to the above process based on the time segment type.
[0037] The effects provided in the summary of the invention are only the effects of the embodiments, rather than all the effects of the invention. The above technical solution has the following advantages or beneficial effects:
[0038] 1. A method for synchronizing the main and auxiliary machines of substation historical events based on time segments is provided in an embodiment of the present application. Hierarchical time segments are defined, and hierarchical relationships in the form of "day-hour-minute" can be constructed according to actual needs. By disassembling longer time segments step by step, the time granularity of historical event synchronization is refined, thereby greatly improving the efficiency of synchronization checks.
[0039] 2. The embodiment of the present application provides a method for synchronizing the main and auxiliary machines of the substation historical events based on time segments, which performs a two-way comparison and synchronization of the historical databases of the two machines according to the unique identifier of the event, thereby ensuring the consistency of the historical events of the two machines.
[0040] 3. The embodiment of the present application provides a method for synchronizing the main and auxiliary machines of the substation historical events based on time segments, which uses hierarchical time segment synchronization identifiers and event summaries to check and compare the dual-machine events. There is no need to compare the dual-machine events for all time segments. Only when the synchronization identifier is in an unsynchronized state and the event summaries are inconsistent, the dual-machine events are extracted for comparison, which reduces the number of event comparisons, improves the synchronization inspection and comparison efficiency of the main and auxiliary dual-machine historical events, and can quickly restore synchronization at a relatively low cost in the event of loss of step, thereby ensuring the reliability and efficiency of the synchronization of the dual-machine historical events. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0042] Figure 1 A flow chart of a method for synchronizing a main and auxiliary substation based on time segments for historical events provided in an embodiment of the present application;
[0043] Figure 2 This is a main-auxiliary dual-machine interaction diagram of the substation historical event generation module in the embodiment of the present application;
[0044] Figure 3 This is a diagram of the interaction between the main and auxiliary machines of the substation historical event synchronization module in the embodiment of the present application;
[0045] Figure 4 This is a flowchart of the storage of historical events of a substation in an embodiment of the present application;
[0046] Figure 5 This is a flowchart of initializing the substation historical event synchronization module according to an embodiment of the present application;
[0047] Figure 6 This is a flowchart of the substation historical event processing in the embodiment of the present application;
[0048] Figure 7 This is a flowchart of synchronization of substation historical events in an embodiment of the present application. DETAILED DESCRIPTION
[0049] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0050] Figure 1 A flow chart of a method for synchronizing a master and a slave substation based on historical events of a time segment according to this embodiment is shown.
[0051] Reference Figure 1 , the implementation steps of this embodiment are as follows:
[0052] S1. Initialize the historical event synchronization module and divide the hierarchical time segments;
[0053] S2. Determine whether the two machines need to be synchronized based on the synchronization identifier and event summary of the time segment. If synchronization is required, the time segment is disassembled level by level to obtain the minimum time segment that needs to be synchronized.
[0054] S3. Extract the historical events of both machines according to the time period range of the minimum time segment, and perform a two-way comparison and synchronization of the historical databases of both machines according to the unique identifier of the event.
[0055] In the above scheme, the division of hierarchical time segments can be constructed according to the hierarchical relationship of "day-hour-minute"; it can also be constructed according to the hierarchical relationship of "day-hour-half hour-minute" or "day-hour-half hour-ten minutes-minute", etc., which can be set according to the actual situation. For the convenience of explanation, in this embodiment, the time segments are divided according to the hierarchical relationship of "day-hour-half hour-ten minutes-minute". The synchronization identifier in the time segment is a mark of whether it has been synchronized. The unique identifier of the matter is a time-space unique code generated according to the current time, clock sequence, machine identification number, etc. The matter summary is a summary generated after calculating the unique identifiers of all matters in the current time segment. When the historical matters of the two machines in a certain time segment are inconsistent, the corresponding matter summaries are also inconsistent.
[0056] Specifically, Figures 2 to 4 As shown, Figure 2 The diagram of the interaction between the main and auxiliary machines of the substation historical event generation module shows that when the main and auxiliary machines of the event generation module are running, only the main module connects to the event storage module of the dual machine to publish events. The event storage module stores the received events in the local history library. At the same time, it combines the event summaries of each time segment in the local database and the unique identifier of the current event to calculate a new event summary and store it in the local history library. Figure 3 The diagram of the interaction between the main and auxiliary machines of the substation historical event synchronization module is shown. It can be seen from the figure that the historical event synchronization module can be operated on a single machine or on a main and auxiliary dual machine. When the main and auxiliary dual machines are running, only the main module connects to the dual machine databases at the same time for synchronization operations, and the auxiliary module does not execute synchronization commands. Figure 4 The flowchart of substation historical event storage is shown. It can be seen from the figure that the event summary needs to be written or updated when the event is generated. According to the event generation time, the minute, ten-minute, half-hour, hour and day objects to which it belongs are found, and the event summary of each object is updated. When the two machines receive a new event, the event is written into their respective historical databases and, at the same time, their respective historical event synchronization operation tables are updated.
[0057] Figure 5 The flowchart of substation historical event synchronization module initialization is shown. Based on the above scheme and with reference to the figure, in step S1, the historical event synchronization module is initialized and hierarchical time segments are divided. The specific steps are as follows:
[0058] Create a synchronization object queue. The queue length is configured according to the actual number of synchronization days n. The synchronization objects stored in the queue are constructed according to the hierarchical relationship of "day-hour-half hour-ten minutes-minute". Each synchronization object contains a timestamp, synchronization identifier, and event summary.
[0059] Update the synchronization object queue and read the historical event synchronization operation table of the two machines. The synchronization operation table includes the synchronization start time st, end time et, and the synchronization identifier and event summary of each time segment.
[0060] According to the current time ct and the actual synchronization days n, calculate the start time dt required for synchronization, where dt = ct-n. If dt is less than st, set the synchronization start time to st. If dt is between st and et, set the synchronization start time to dt.
[0061] Read the synchronization identifiers and event summaries of all time segments after the synchronization start time in the synchronization operation table, and refresh the corresponding synchronization objects in the synchronization object queue.
[0062] Specifically, in the step of initializing the historical event synchronization module, the actual synchronization days n is the number of days that need to be synchronized, that is, the number of days counted backwards from the current time, and is configured according to actual needs. Read the start time and end time in the historical event synchronization operation table, combine the current time with the actual synchronization days to determine whether there is an intersection, then read the synchronization identifier and event summary of the intersection, and refresh the synchronization object queue.
[0063] Next, Figure 6 The flowchart of substation historical event processing is shown. Based on the above scheme and with reference to the figure, in step S2, according to the synchronization mark and event summary of the time segment, it is judged whether the two machines need to be synchronized. If synchronization is required, the time segment is disassembled level by level to obtain the minimum time segment that needs to be synchronized. The specific steps are as follows:
[0064] Based on the divided time segments, determine the synchronization identifier of the corresponding time segment when the synchronization time arrives. If the synchronization identifier is not synchronized, compare whether the event summaries of the two machines in the corresponding time segment are consistent. If they are consistent, execute step S21; if not, execute step S22.
[0065] S21. Refresh the time segment synchronization flag according to the time segment type. The specific process is as follows:
[0066] 1) Full minute: Refresh the synchronization mark of the minute as successful, and traverse the synchronization marks of each minute in the ten-minute time segment to which the minute belongs. If all are synchronized, go to 2); if there are any that are not synchronized, go to S0;
[0067] 2) Ten minutes: Refresh the synchronization mark of the ten minutes as success, traverse the synchronization marks of every ten minutes in the half-hour time segment to which the ten minutes belong, if all are synchronized, go to 3); if there are any that are not synchronized, go to S0;
[0068] 3) Full half hour: Refresh the synchronization mark of the half hour as success; traverse the synchronization marks of each half hour in the hour time segment to which the half hour belongs. If all are synchronized, go to 4); if there are any that are not synchronized, go to S0;
[0069] 4) Whole hour: Refresh the synchronization mark of the hour as successful, traverse the synchronization marks of each hour in the daily time segment to which the hour belongs, if all are synchronized, go to 5), if there are unsynchronized ones, go to S0;
[0070] 5) All day: Refresh the synchronization flag for that day as successful;
[0071] S0: Save the time segment synchronization identifier to the historical event synchronization operation table.
[0072] S22, disassemble the time segments step by step to obtain the minimum time segments that need to be synchronized. The specific process is as follows:
[0073] 1) Whole-minute synchronization: add the minute synchronization command to the synchronization command scheduling thread;
[0074] 2) Synchronize for ten minutes: traverse the synchronization mark of each minute within ten minutes. If there is an unsynchronized minute object, go to 1);
[0075] 3) Half-hour synchronization: traverse the synchronization flags of every ten minutes in half an hour. If there are unsynchronized ten-minute objects, go to 2);
[0076] 4) Full hour synchronization: traverse the synchronization mark of each half hour in the hour. If there is an unsynchronized half-hour object, go to 3);
[0077] 5) Full-day synchronization: traverse the synchronization flags of each hour of the day. If there are unsynchronized hourly objects, go to 4);
[0078] 6) Traverse the synchronization object queue and read the daily synchronization flag. If there is an unsynchronized daily object, go to 5).
[0079] Specifically, Figure 6 The initialization in Figure 5 Initialization process of historical event synchronization module of substation.
[0080] Next, Figure 7 The substation historical event synchronization flow chart is shown, based on the above scheme and referring to Figure 6 , Figure 7 As shown in , in step S3, extracting the historical events of both machines, and performing a two-way comparison and synchronization on the historical databases of both machines include the following steps:
[0081] The historical event synchronization command scheduling thread takes out synchronization commands from the command queue one by one and parses the time segment of synchronization of the synchronization commands;
[0082] Connect to the databases of the primary and secondary machines respectively, and obtain historical events in the corresponding period according to the start and end times in the synchronization command;
[0083] Perform a two-way comparison of the historical events of the primary and secondary machines based on the unique event identifiers, and obtain the lists of historical events that need to be inserted into the two machines respectively;
[0084] Start transaction operation and insert the historical event list of both machines into the database;
[0085] Calculate the event summaries of each time segment after the synchronization of the two machines respectively, and save them in the historical event synchronization operation table;
[0086] After the synchronization of the two machines, the event summaries of the time segments are compared. If they are consistent, the time segment synchronization flag is refreshed according to the time segment type to which the event summaries belong according to the method described in step S21.
[0087] The method of this embodiment improves the efficiency of synchronization check by defining the hierarchical time segments of "day-hour-half hour-ten minutes-minute". When a minute is not synchronized within a day, if all minute objects are traversed, a maximum of 1440 checks are required. However, by dividing the hierarchical time segments of this solution, a maximum of 39 checks are required, which greatly improves the efficiency of synchronization check. This method also uses hierarchical time segment synchronization identification and matter summaries. There is no need to compare the two-machine matters for all time segments. Only when the synchronization identification is in an unsynchronized state and the matter summaries are inconsistent, the two-machine matters are extracted for comparison, which reduces the number of matter comparisons and improves the efficiency of the two-machine matter comparisons.
[0088] The above description is only a specific embodiment of the present invention, so that those skilled in the art can understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but should conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for synchronizing the main and auxiliary machines of a substation based on time segments, characterized in that: The following steps are involved: Divide the hierarchical time segments and initialize the synchronization object queue; When the synchronization time arrives, the synchronization identifier and event summary of the time segment are used to determine whether the two machines need to be synchronized. If synchronization is required, the time segment is disassembled level by level to obtain the minimum time segment that needs to be synchronized. The synchronization identifier is a mark of whether synchronization has been completed. The event summary is a summary generated by calculating the unique identifiers of all events in the time segment to which the current object belongs. The event unique identifier is a time-space unique code generated based on the current time, clock sequence, and machine identification number. Extract the historical events of both machines according to the time range of the minimum time segment, and perform two-way comparison and synchronization of the historical databases of both machines; The extraction of historical events of the two machines and the bidirectional comparison and synchronization of the historical databases of the two machines include the following steps: Take out synchronization commands one by one from the command queue and parse the synchronization time segments of the synchronization commands; Connect to the databases of the primary and secondary machines respectively, and obtain historical events in the corresponding period according to the start and end times in the synchronization command; Perform a two-way comparison of the historical events of the primary and secondary machines based on the unique event identifiers, and obtain the lists of historical events that need to be inserted into the two machines respectively; Start transaction operation and insert the historical event list of both machines into the database; Calculate the event summaries of each time segment after the synchronization of the two machines respectively, and save them in the historical event synchronization operation table; Compare the event summaries of each time segment after the synchronization of the two machines. If they are consistent, refresh the time segment synchronization flag according to the time segment type.
2. A method for synchronizing the main and auxiliary substations based on time segments of historical events according to claim 1, characterized in that: The time segment is a time segment at the level of "day, hour, minute" or "day, hour, half hour, minute".
3. The method for synchronizing the main and auxiliary substations based on the time segment of the historical events according to claim 1 is characterized in that: The step of dividing the hierarchical time segments and initializing the synchronization object queue includes the following steps: Create a synchronization object queue. The synchronization objects stored in the queue are constructed according to the hierarchical relationship of time segments. Each synchronization object contains a timestamp, synchronization identifier, and event summary. Read the historical event synchronization operation table of the two machines and update the synchronization object queue.
4. A method for synchronizing the main and auxiliary substations based on time segments of historical events according to claim 3, characterized in that: The process of reading the historical event synchronization operation table of the two machines and updating the synchronization object queue includes the following steps: Read the synchronization start time st, synchronization end time et, and synchronization identifier and event summary of each time segment in the dual-machine historical event synchronization operation table; According to the current time ct and the actual number of synchronization days n, calculate the start time dt = ct-n that needs to be synchronized. If dt is less than st, set the synchronization start time to st. If dt is between st and et, set the synchronization start time to dt. Read the synchronization identifiers and event summaries of all time segments after the synchronization start time in the synchronization operation table, and refresh the corresponding synchronization objects in the synchronization object queue.
5. According to the method of claim 1, the main and auxiliary dual-machine synchronization method of substation historical events based on time segments is characterized in that: The step of determining whether the two machines need to be synchronized comprises the following steps: Determine the synchronization flags and event summaries of the two machines in the corresponding time segments. If the synchronization flag is not synchronized and the event summaries are inconsistent, the time segments need to be disassembled level by level to obtain the minimum time segment that needs to be synchronized; otherwise, only the time segment synchronization flag needs to be refreshed according to the time segment type, and no synchronization processing is required.
6. A method for synchronization of main and auxiliary substations based on time segments of historical events according to claim 1, characterized in that: The time segment synchronization flag is refreshed according to the time segment type, and the specific process is as follows: 1) Whole minute: Refresh the synchronization mark of the minute as successful, traverse the synchronization marks of each minute in the hour time segment to which the minute belongs, if all are synchronized, go to 2), if there are any that are not synchronized, go to step S0; 2) Whole hour: Refresh the synchronization mark of the hour as successful, traverse the synchronization marks of each hour in the daily time segment to which the hour belongs, if all are synchronized, go to 3), if there are any that are not synchronized, go to step S0; 3) All day: Refresh the synchronization flag of the day as successful; S0: Save the time segment synchronization identifier to the historical event synchronization operation table.
7. A method for synchronizing the main and auxiliary substations based on time segments of historical events according to claim 1, characterized in that: The time segments are disassembled level by level to obtain the minimum time segment that needs to be synchronized. The specific process is as follows: 1) Full-minute synchronization: add the minute synchronization command to the synchronization command scheduling thread; 2) Full hour synchronization: traverse the synchronization mark of each minute in the hour. If there is an unsynchronized minute object, go to 1); 3) Full-day synchronization: traverse the synchronization flags of each hour of the day. If there are unsynchronized hourly objects, go to 2); 4) Traverse the synchronization object queue and read the daily synchronization flag. If there are unsynchronized daily objects, go to 3).
Citation Information
Patent Citations
Data synchronization method for dual redundancy
CN108156264A