Event queue synchronization method, queue synchronization device, telecontrol machine and storage medium
By using HashSet and HashMap to match and store events in the remote motor, the problem of low efficiency of the event queue between the remote motors was solved, and more efficient data synchronization and system response were achieved.
Patent Information
- Application Number
- CN202411307360.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2025-01-28
AI Technical Summary
In power systems, event queue synchronization between remote motors is less efficient, especially when a loop queue receiving a contralateral synchronization event contains a large number of events, the loop matching time is longer.
By determining the event category of the current event, if it is a generating event, find out whether there is a target synchronization event that matches the current event in the preset hashset. If not found, the current event is stored to the default hashmap to achieve efficient queue synchronization.
提高了事件队列同步的效率,减少了在主备通道切换时重复上送数据的风险,增强了系统的响应能力。
Smart Images

Figure CN119376972A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of power systems, and in particular, relates to a queue synchronization method, a synchronization device, a remote motor and a storage medium for an event. Background Art
[0002] In the power system, the remote terminal unit (RTU) usually operates in a dual-node mode (for example, remote terminal unit A and remote terminal unit B). In this mode, remote terminal unit A and remote terminal unit B work in parallel mode, and there is no concept of master and standby. Both remote terminals can respond to the dispatching device link and upload data. The dispatching device can freely select any remote terminal unit to establish a link, and both remote terminals can respond to the dispatching device link and upload data normally. When the remote terminal unit selects the channel master-slave mode for the upper channel, the event queue synchronization between the two remote terminals is required, such as the sequence of events (SOE), to ensure that data is not uploaded repeatedly when the master and standby channels are switched.
[0003] At present, remote motor A and remote motor B each maintain a circular queue for event uploading and a circular queue for receiving opposite-side synchronization events. In the event queue synchronization process, when remote motor A generates an event, it needs to use a circular matching method to search for the same event in the circular queue for receiving opposite-side synchronization events. When the same event is found, it is determined that the generated event has been reported to the dispatching device by the opposite-side remote motor.
[0004] However, when the circular queue for receiving the opposite-side synchronization events contains a large number of events, the time for circular matching to generate events and the circular queue for receiving the opposite-side synchronization events is long, resulting in low queue synchronization efficiency of the events. Summary of the invention
[0005] In view of this, an embodiment of the present application provides a queue synchronization method, a queue synchronization device, a remote motor and a storage medium for an event to solve the above problems of the prior art.
[0006] In the first aspect, an embodiment of the present application provides a queue synchronization method for events, which is applied to a first remote motor, and the queue synchronization method includes: determining the event category of a current event; if the event category is a generated event, searching a preset hashset for a first target synchronization event that matches the current event, and the preset hashset is used to store multiple first synchronization events sent by a second remote motor; when the preset hashset does not contain the first target synchronization event, storing the current event in a preset hashmap.
[0007] Among them, in some optional embodiments, when the first target synchronization event does not exist in the preset hashset, the current event is stored in the preset hashmap, including: when the first target synchronization event does not exist in the preset hashset, the current event is stored in the preset data linked list; the iterator information of the current event in the preset data linked list and the current event are stored in the preset hashmap.
[0008] Among them, in some optional embodiments, the queue synchronization method further includes: when the first target synchronization event exists in the preset hashset, deleting the first target synchronization event from the preset hashset and discarding the current event.
[0009] Among them, in some optional embodiments, before searching whether there is a first target synchronization event matching the current event in the preset hashset, the queue synchronization method also includes: determining whether the current event is a queue event based on the event identifier of the current event; searching whether there is a first target synchronization event matching the current event in the preset hashset includes: when it is determined that the current event is the queue event based on the event identifier, searching whether the first target synchronization event exists in the preset hashset.
[0010] Among them, in some optional embodiments, the queue synchronization method also includes: if the event category is a receiving event, searching the preset hashmap for a second target synchronization event that matches the current event; when the preset hashmap does not contain the second target synchronization event, storing the current event in the preset hashset.
[0011] Among them, in some optional embodiments, the queue synchronization method also includes: when searching for the second target synchronization event in the preset hashmap, obtaining the iterator information of the second target synchronization event, the iterator information is used to characterize the storage address of the second target synchronization event in the preset data linked list; according to the iterator information, deleting the second target synchronization event from the preset data linked list, and deleting the second target synchronization event from the preset hashmap.
[0012] Among them, in some optional embodiments, determining the event category of the current event includes: if the current event is generated based on the power data reported by the power equipment, determining the event category as the generated event; if the current event is generated based on the first synchronization event sent by the second remote motor, determining the event category as the received event.
[0013] In the second aspect, the embodiment of the present application provides a queue synchronization device for events, which is applied to a first remote motor, and the queue synchronization device includes a first determination module, a first search module, and a first storage module. The first determination module is used to determine the event category of the current event; the first search module is used to search for a first target synchronization event matching the current event in a preset hashset when the event category is a generated event, and the preset hashset is used to store multiple first synchronization events sent by the second remote motor; the first storage module is used to store the current event in a preset hashmap when the first target synchronization event is not found in the preset hashset.
[0014] In a third aspect, an embodiment of the present application provides a remote control machine, comprising a memory; one or more processors coupled to the memory; and one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more applications are configured to execute the queue synchronization method provided in the first aspect above.
[0015] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a program code is stored. The program code can be called by a processor to execute the queue synchronization method provided in the first aspect above.
[0016] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product runs on a computer device, it enables the computer device to execute the queue synchronization method provided in the first aspect above.
[0017] The solution provided by the present application determines the event category of the current event. If the event category is a generated event, a search is performed to determine whether there is a first event matching the current event in a preset hashset. The preset hashset is used to store the first event sent by the second remote motor. When the first event does not exist in the preset hashset, the current event is stored in a preset hashmap. In this way, during the queue synchronization process of the event, the queue synchronization of the current event is performed according to the result of matching the current event with the preset hashset. The preset hashset has a high matching efficiency, which is beneficial to improving the queue synchronization efficiency of the event. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0019] Figure 1 A schematic diagram of a scenario of a queue synchronization system for events provided in an embodiment of the present application is shown.
[0020] Figure 2 A flow chart of a queue synchronization method for events provided in an embodiment of the present application is shown.
[0021] Figure 3 Another flow chart of the event queue synchronization method provided in an embodiment of the present application is shown.
[0022] Figure 4 Another flow chart of the event queue synchronization method provided in the embodiment of the present application is shown.
[0023] Figure 5 A structural block diagram of a queue synchronization device for events provided in an embodiment of the present application is shown.
[0024] Figure 6 A functional block diagram of a remote control machine provided in an embodiment of the present application is shown.
[0025] Figure 7 A computer-readable storage medium provided in an embodiment of the present application for storing or carrying program code for implementing a queue synchronization method for events provided in an embodiment of the present application is shown.
[0026] Figure 8 A computer program product provided by an embodiment of the present application and used for storing or carrying program codes for implementing a queue synchronization method for events provided by an embodiment of the present application is shown. DETAILED DESCRIPTION
[0027] In order to make the purpose, features, and advantages of the invention of this application more obvious and easy to understand, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the embodiments described below are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0028] It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0029] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0030] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0031] In addition, in the description of the present application, the terms "first", "second", "third", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0032] In the power system, the remote terminal unit (RTU) usually operates in a dual-node mode (for example, remote terminal unit A and remote terminal unit B). In this mode, remote terminal unit A and remote terminal unit B work in parallel mode, and there is no concept of master and standby. Both remote terminals can respond to the dispatching device link and upload data. The dispatching device can freely select any remote terminal unit to establish a link, and both remote terminals can respond to the dispatching device link and upload data normally. When the remote terminal unit selects the channel master-slave mode for the upper channel, the event queue synchronization between the two remote terminals is required, such as the sequence of events (SOE), to ensure that data is not uploaded repeatedly when the master and standby channels are switched.
[0033] At present, remote motor A and remote motor B each maintain a circular queue for event uploading and a circular queue for receiving opposite-side synchronization events. In the event queue synchronization process, when remote motor A generates an event, it needs to use a circular matching method to search for the same event in the circular queue for receiving opposite-side synchronization events. When the same event is found, it is determined that the generated event has been reported to the dispatching device by the opposite-side remote motor.
[0034] However, when the circular queue for receiving the opposite-side synchronization events contains a large number of events, the time for circular matching to generate events and the circular queue for receiving the opposite-side synchronization events is long, resulting in low efficiency of event queue synchronization.
[0035] In response to the above problems, the embodiments of the present application provide a queue synchronization method, a queue synchronization device, a remote motor and a storage medium for events. By determining the event category of the current event, if the event category is a generated event, a search is performed to determine whether there is a first event matching the current event in a preset hashset. The preset hashset is used to store the first event sent by the second remote motor, and when the first event is not found in the preset hashset, the current event is stored in a preset hashmap. In this way, during the queue synchronization process of events, queue synchronization of the current event is performed according to the result of matching the current event with the preset hashset. The preset hashset has a high matching efficiency, which is beneficial to improving the queue synchronization efficiency of events.
[0036] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0037] See also Figure 1 , which shows a schematic diagram of an application scenario of the queue synchronization system of events provided in an embodiment of the present application. The queue synchronization system of events may include a first remote motor 110, a second remote motor 120, an electric power device 130 and a dispatching device 140. The first remote motor 110 is communicatively connected to the second remote motor 120, the electric power device 130 and the dispatching device 140, and exchanges data with the second remote motor 120, the electric power device 130 and the dispatching device 140. The second remote motor 120 is also communicatively connected to the electric power device 130 and the dispatching device 140, and exchanges data with the electric power device 130 and the dispatching device 140.
[0038] The first remote motor 110 and the second remote motor 120 are respectively an Internet of Things communication device. The first remote motor 110 and the second remote motor 120 are mainly used for power system dispatching services, and monitor and control power plants, substations and other equipment through remote monitoring and control technology.
[0039] The power equipment 130 may include at least any one of a transformer, a circuit breaker, a capacitor, a high-voltage switchgear, a mutual inductor, a compensation device protection device, and a relay protector. The type of the power equipment 130 is not limited here and can be specifically set according to actual needs.
[0040] The dispatching device 140 may include at least any one of an automatic reclosing device, an automatic backup power supply device, an automatic frequency adjustment device, and an automatic excitation adjustment device. The type of the dispatching device 140 is not limited here and can be specifically set according to actual needs.
[0041] See also Figure 2, which shows a flow chart of a queue synchronization method for events provided by an embodiment of the present application. In a specific embodiment, the queue synchronization method for events can be applied to Figure 1 The first remote motor 110 in the queue synchronization system of the event shown in the figure is taken as an example below. Figure 2 The process shown is described in detail, and the event queue synchronization method may include steps 210 to 230.
[0042] Step 210: Determine the event category of the current event.
[0043] In the embodiment of the present application, the first remote motor can obtain the current event and determine the event category of the current event.
[0044] Among them, the event category can be a generated event or a received event. The generated event is generated based on the first remote motor receiving the power data reported by the power equipment, and the received event is generated based on the first remote motor receiving the first synchronization event sent by the second remote motor.
[0045] If the current event is generated based on the power data reported by the power equipment, the event category of the current event is determined to be a generated event; if the current event is generated based on the first synchronization event sent by the second remote motor, the event category of the current event is determined to be a received event.
[0046] It can be understood that the first remote motor can store the generated events in a preset data linked list (list), and the preset list is used to upload the generated events to the scheduling device according to the storage sequence of the stored generated events, and send the generated events to the second remote motor. The second remote motor generates a first synchronization event based on the received generated events, and the second remote motor stores the first synchronization event in a preset hashset.
[0047] The preset hashset is used to store multiple first synchronization events sent by the second remote motor. The preset hashset mainly stores summary information of each first synchronization event to avoid duplication of the stored multiple first synchronization events.
[0048] Step 220: If the event type is a generated event, search the preset hashset to see if there is a first target synchronization event that matches the current event.
[0049] In an embodiment of the present application, after the first remote motor determines the event category of the current event, if the event category is a generated event, it means that the current event is generated based on the power data reported by the circuit device, and it can be checked whether there is a first target synchronization event matching the current event in the preset hashset.
[0050] Specifically, after the first remote motor determines the event category of the current event, if the event category is a generated event, it can cyclically match the current event with multiple first synchronization events, and determine whether there is a first target synchronization event matching the current event in the preset hashset.
[0051] Among them, the first remote motor can cyclically match the current summary information of the current event with the first summary information of each first synchronization event to obtain multiple first matching degrees, and determine whether there is a first target synchronization event matching the current event in the preset hashset based on the multiple first matching degrees.
[0052] When there is a target first matching degree greater than or equal to the first matching degree threshold among multiple first matching degrees, it is determined that there is a first target synchronization event matching the current event in the preset hashset, and the first synchronization event corresponding to the target first matching degree is determined as the first target synchronization event; when multiple first matching degrees are all less than the first matching degree threshold, it is determined that there is no first target synchronization event matching the current event in the preset hashset.
[0053] The first matching degree threshold can be used to characterize the minimum first matching degree of the first target synchronization event that matches the current event in the preset hashset. The first matching degree threshold can be a matching degree pre-set by the user, or a matching degree automatically generated by the first remote motor based on the process of multiple queue synchronization of events, etc., which is not limited here.
[0054] Step 230: When the first target synchronization event does not exist in the preset hashset, the current event is stored in the preset hashmap.
[0055] In an embodiment of the present application, when the first remote motor searches for the first target synchronization event in the preset hashset and finds that the event does not exist, the current event can be stored in the preset hashmap, thereby realizing queue synchronization of the current event based on the result of matching the current event with the preset hashset during the queue synchronization of the event. The preset hashset has high matching efficiency, which is beneficial to improving the queue synchronization efficiency of the event.
[0056] The preset list can also store the generated event as the second synchronization event, and the preset hashmap is used to store the second synchronization event and the iterator information of the second synchronization event in the preset list. The preset hashmap is used to quickly find the generated event in the preset list, the key of the preset hashmap is used to represent the summary information of the generated event, and the value of the preset hashmap is used to represent the iterator information of the generated event in the preset list.
[0057] Specifically, when the first remote motor does not find the first target synchronization event in the preset hashset, the current event can be stored in the preset data linked list, and the iterator information of the current event in the preset data linked list and the current event can be stored in the preset hashmap.
[0058] In some embodiments, when the first remote motor searches for the presence of a first target synchronization event in a preset hashset, it indicates that the second remote motor has uploaded the same event as the current event to the scheduling device. The first target synchronization event can be deleted from the preset hashset and the current event can be discarded. This can avoid the first remote motor from repeatedly performing queue synchronization on the same event, which is beneficial to further improve the queue synchronization efficiency of events.
[0059] The solution provided by the present application determines the event category of the current event. If the event category is a generated event, it searches the preset hashset for a first target synchronization event that matches the current event. The preset hashset is used to store multiple first synchronization events sent by the second remote motor. When the first target synchronization event does not exist in the preset hashset, the current event is stored in the preset hashmap. In this way, during the queue synchronization process of the event, the queue synchronization of the current event is performed according to the result of matching the current event with the preset hashset. The preset hashset has a high matching efficiency, which is beneficial to improving the queue synchronization efficiency of the event.
[0060] See also Figure 3 , which shows a flow chart of a queue synchronization method for events provided by another embodiment of the present application. In a specific embodiment, the queue synchronization method for events can be applied to Figure 1 The first remote motor 110 in the queue synchronization system of the event shown in the figure is taken as an example below. Figure 3 The process shown is described in detail, and the event queue synchronization method may include steps 310 to 340.
[0061] Step 310: Determine the event category of the current event.
[0062] In this embodiment, step 310 may refer to the contents of the corresponding steps in the aforementioned embodiments, which will not be described in detail here.
[0063] Step 320: If the event type is a generated event, determine whether the current event is a queue event according to the event identifier of the current event.
[0064] In this embodiment, after the first remote motor determines the event category of the current event, if the event category is a generated event, it can determine whether the current event is a queue event according to the event identifier of the current event.
[0065] Specifically, after the first remote motor determines the event category of the current event, if the event category is a generated event, it can determine whether the event identifier of the current event is included in the configuration event identifier of the scheduling device, obtain a determination result, and determine whether the current event is a queue event based on the determination result.
[0066] The determination result may include a first determination result that the event identifier used to characterize the current event is included in the configured event identifier of the scheduling device, and a second determination result that the event identifier used to characterize the current event is not included in the configured event identifier of the scheduling identification.
[0067] When the first determination result is obtained, the current event is determined to be a queue event; when the second determination result is obtained, the current event is determined to be a non-queue time.
[0068] Step 330: When the current event is determined to be a queue event according to the event identifier, search whether there is a first target synchronization event in the preset hashset.
[0069] In this embodiment, when the first remote motor determines that the current event is a queue event based on the event identifier, it can search whether there is a first target synchronization event in the preset hashset, thereby avoiding queue synchronization of the current event when the current event is a non-queue event, which is beneficial to improving the accuracy of queue synchronization of events.
[0070] Regarding the process of the first remote motor searching for the first target synchronization event in the preset hashset, reference may be made to the contents of the corresponding steps in the aforementioned embodiment, which will not be repeated here.
[0071] Step 340: When the first target synchronization event does not exist in the preset hashset, the current event is stored in the preset hashmap.
[0072] In this embodiment, step 340 may refer to the contents of the corresponding steps in the aforementioned embodiments, which will not be described in detail here.
[0073] The solution provided in this embodiment determines the event category of the current event. If the event category is a generated event, it determines whether the current event is a queue event based on the event identifier of the current event. When the current event is determined to be a queue event based on the event identifier, it searches the preset hashset for a first target synchronization event. When the preset hashset does not contain the first target synchronization event, it stores the current event in a preset hashmap. This achieves queue synchronization of the current event based on the result of matching the current event with the preset hashset during the queue synchronization process of the event. The preset hashset has a high matching efficiency, which is beneficial to improving the queue synchronization efficiency of the event.
[0074] Furthermore, when the first remote motor determines that the current event is a queue event based on the event identifier, it searches the preset hashset for a first target synchronization event, thereby avoiding queue synchronization of the current event when the current event is a non-queue event, which is beneficial to improving the accuracy of queue synchronization of events.
[0075] See also Figure 4 , which shows a flow chart of a queue synchronization method for events provided by another embodiment of the present application. In a specific embodiment, the queue synchronization method for events can be applied to Figure 1 The first remote motor 110 in the queue synchronization system of the event shown in the figure is taken as an example below. Figure 4 The process shown is described in detail, and the event queue synchronization method may include steps 410 to 430.
[0076] Step 410: Determine the event category of the current event.
[0077] In this embodiment, step 410 may refer to the contents of the corresponding steps in the aforementioned embodiments, which will not be described in detail here.
[0078] Step 420: If the event type is a receiving event, search the preset hashmap to see if there is a second target synchronization event that matches the current event.
[0079] In this embodiment, after the first remote motor determines the event category of the current event, if the event category is a receiving event, it means that the current event is a synchronization event received from the second remote motor, and it can be checked whether there is a second target synchronization event matching the current event in the preset hashmap.
[0080] Specifically, after the first remote motor determines the event category of the current event, if the event category is a receiving event, it can cyclically match the current event with multiple second synchronization events, and determine whether there is a second target synchronization event matching the current event in the preset hashmap.
[0081] Among them, the first remote motor can cyclically match the current summary information of the current event with the second summary information of each second synchronization event to obtain multiple second matching degrees, and determine whether there is a second target synchronization event matching the current event in the preset hashmap based on the multiple second matching degrees.
[0082] When there is a target second matching degree greater than or equal to the second matching degree threshold among multiple second matching degrees, it is determined that there is a second target synchronization event matching the current event in the preset hashmap, and the second synchronization event corresponding to the target second matching degree is determined as the second target synchronization event; when multiple second matching degrees are all less than the second matching degree threshold, it is determined that there is no second target synchronization event matching the current event in the preset hashmap.
[0083] The second matching degree threshold can be used to characterize the minimum second matching degree of the second target synchronization event that matches the current event in the preset hashmap. The second matching degree threshold can be a matching degree pre-set by the user, or it can be a matching degree automatically generated by the first remote motor based on the process of multiple queue synchronization of events, etc., which is not limited here.
[0084] Step 430: When the second target synchronization event does not exist in the preset hashmap, the current event is stored in the preset hashset.
[0085] In this embodiment, when the first remote motor does not find the second target synchronization event in the preset hashmap, the current event can be stored in the preset hashset, so that during the queue synchronization process of the event, the queue synchronization of the current event is performed according to the result of matching the current event with the preset hashmap. The preset hashmap has high matching efficiency, which is conducive to improving the queue synchronization efficiency of the event.
[0086] In some embodiments, when the first remote motor searches for the presence of a second target synchronization event in a preset hashmap, it indicates that the first remote motor has uploaded the same event as the current event to the scheduling device, and can obtain the iterator information of the second target synchronization event, and delete the second target synchronization event from the preset list according to the iterator information, and delete the second target synchronization event from the preset hashmap, thereby avoiding the first remote motor from repeatedly performing queue synchronization on the same event, which is beneficial to further improve the queue synchronization efficiency of events.
[0087] The iterator information may be used to represent the storage address of the second event in the preset list.
[0088] The solution provided in this embodiment determines the event category of the current event. If the event category is a receiving event, it searches the preset hashmap for a second target synchronization event that matches the current event. If no second target synchronization event exists in the preset hashmap, the current event is stored in the preset hashset. In this way, during the queue synchronization process of the event, the queue synchronization of the current event is performed according to the result of matching the current event with the preset hashmap. The preset hashmap has a high matching efficiency, which is beneficial to improving the queue synchronization efficiency of the event.
[0089] See also Figure 5 , which shows an event queue synchronization device 500 provided by an embodiment of the present application. The event queue synchronization device 500 can be applied to Figure 1 The first remote motor 110 in the queue synchronization system of the event shown in the figure is taken as an example below. Figure 5 The event queue synchronization device 500 shown in the figure is described in detail. The event queue synchronization device 500 may include a first determination module 510, a first search module 520 and a first storage module 530.
[0090] The first determination module 510 can be used to determine the event category of the current event; the first search module 520 can be used to search whether there is a first event matching the current event in a preset hashset if the event category is a generated event, and the preset hashset can be used to store the first event sent by the second remote motor; the first storage module 530 can be used to store the current event in a preset hashmap when the first event is not found in the preset hashset.
[0091] In some embodiments, the first storage module 530 may include a first storage unit and a second storage unit.
[0092] The first storage unit can be used to store the current event in the preset data linked list when the first target synchronization event does not exist in the preset hashset; the second storage unit can be used to store the iterator information of the current event in the preset data linked list and the current event in the preset hashmap.
[0093] In some implementations, the event queue synchronization device 500 may further include a first deletion module.
[0094] The first deletion module can be used to delete the first target synchronization event from the preset hashset and discard the current event when finding the first target synchronization event in the preset hashset.
[0095] In some implementations, the event queue synchronization device 500 may further include a second determination module.
[0096] The second determination module can be used to determine whether the current event is a queue event according to the event identifier of the current event before the first search module 520 searches the preset hashset for a first target synchronization event that matches the current event.
[0097] In some implementations, the first search module 520 may include a search unit.
[0098] The search unit may be configured to search whether a first target synchronization event exists in a preset hashset when the current event is determined to be a queue event according to the event identifier.
[0099] In some implementations, the event queue synchronization device 500 may further include a second search module and a second storage module.
[0100] The second search module is used to search whether there is a second target synchronization event matching the current event in the preset hashmap if the event category is a receiving event; the second storage module is used to store the current event in the preset hashset when no second target synchronization event exists in the preset hashmap.
[0101] In some implementations, the event queue synchronization device 500 may further include an acquisition module and a second deletion module.
[0102] An acquisition module is used to obtain the iterator information of the second target synchronization event when searching for the second target synchronization event in the preset hashmap. The iterator information can be used to characterize the storage address of the second target synchronization event in the preset data linked list; a second deletion module is used to delete the second target synchronization event from the preset data linked list according to the iterator information, and delete the second target synchronization event from the preset hashmap.
[0103] In some implementations, the first determining module may include a first determining unit and a second determining unit.
[0104] The first determination unit can be used to determine the event category as a generated event if the current event is generated based on the power data reported by the power equipment; the second determination unit can be used to determine the event category as a received event if the current event is generated based on the first synchronization event sent by the second remote motor.
[0105] The solution provided in this embodiment determines the event category of the current event. If the event category is a generated event, it searches the preset hashset for a first event that matches the current event. The preset hashset is used to store the first event sent by the second remote motor. When the first event does not exist in the preset hashset, the current event is stored in the preset hashmap. In this way, during the queue synchronization process of the event, the queue synchronization of the current event is performed according to the result of matching the current event with the preset hashset. The preset hashset has a high matching efficiency, which is beneficial to improving the queue synchronization efficiency of the event.
[0106] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. Any processing method described in the method embodiment can be implemented by the corresponding processing module in the device embodiment, and will not be repeated one by one in the device embodiment.
[0107] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.
[0108] See also Figure 6 , which shows a functional block diagram of a remote motor 600 provided in one embodiment of the present application, and the remote motor 600 may include one or more of the following components: a memory 610, a processor 620, and one or more applications, wherein the one or more applications may be stored in the memory 610 and configured to be executed by the one or more processors 620, and the one or more applications are configured to execute the method described in the aforementioned method embodiment.
[0109] The memory 610 may include a random access memory (RAM) or a read-only memory (ROM). The memory 610 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 610 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as determining an event category, searching a preset hashset, storing multiple first synchronization events, storing a current event to a preset hashmap, storing a current event to a preset data linked list, storing iterator information to a preset hashmap, deleting a first target synchronization event, discarding a current event, determining whether the current event is a queue event, determining that the current event is a queue event, searching a preset hashmap, storing the current event to a preset hashset, obtaining iterator information, deleting a second target synchronization event, receiving power data, reporting power data, determining to generate an event, sending a first synchronization event, generating a current event, and determining to receive an event, etc.), instructions for implementing the following various method embodiments, etc. The storage data area can also store data created by the remote motor 600 during use (such as the first remote motor, current event, event category, generated event, preset hashset, first target synchronization time, second remote motor, multiple first synchronization events, preset hashmap, preset data linked list, iterator information, event identifier, queue event, receive event, second target synchronization event, storage address, power equipment and power data), etc.
[0110] The processor 620 may include one or more processing cores. The processor 620 uses various interfaces and lines to connect the various parts of the entire remote motor 600, and executes various functions and processes data of the remote motor 600 by running or executing instructions, programs, code sets or instruction sets stored in the memory 610, and calling data stored in the memory 610. Optionally, the processor 620 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), programmable logic array (PLA), etc. The processor 620 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 620, but may be implemented separately through a communication chip.
[0111] Please refer to Figure 7 , which shows a structural block diagram of a computer-readable storage medium provided in an embodiment of the present application. The computer-readable storage medium 700 stores a program code 710, which can be called by a processor to execute the method described in the above method embodiment.
[0112] The computer readable storage medium 700 can be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium 700 includes a non-transitory computer-readable storage medium. The computer readable storage medium 700 has storage space for program code 710 that performs any method steps in the above method. These program codes can be read from or written to one or more computer program products. The program code 710 can be compressed, for example, in an appropriate form.
[0113] Please refer to Figure 8, which shows a structural block diagram of a computer program product 800 provided in an embodiment of the present application. The computer program product 800 includes a computer program / instruction 810, and the computer program / instruction 810 is stored in a computer-readable storage medium of a computer device. When the computer program product 800 is run on a computer device, a processor of the computer device reads the computer program / instruction 810 from the computer-readable storage medium, and the processor executes the computer program / instruction 810, so that the computer device performs the method described in the above method embodiment.
[0114] The solution provided in this embodiment determines the event category of the current event. If the event category is a generated event, it searches the preset hashset for a first event that matches the current event. The preset hashset is used to store the first event sent by the second remote motor. When the first event does not exist in the preset hashset, the current event is stored in the preset hashmap. In this way, during the queue synchronization process of the event, the queue synchronization of the current event is performed according to the result of matching the current event with the preset hashset. The preset hashset has a high matching efficiency, which is beneficial to improving the queue synchronization efficiency of the event.
[0115] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A queue synchronization method for an event, characterized in that: Applied to the first remote motor, the queue synchronization method comprises: Determine the event category of the current event; If the event category is a generated event, searching a preset hashset for a first target synchronization event that matches the current event, wherein the preset hashset is used to store multiple first synchronization events sent by the second remote motor; When the first target synchronization event does not exist in the preset hashset, the current event is stored in the preset hashmap.
2. The queue synchronization method according to claim 1, characterized in that: When the first target synchronization event is not found in the preset hashset, storing the current event in the preset hashmap includes: When the first target synchronization event does not exist in the preset hashset, the current event is stored in the preset data linked list; The iterator information of the current event in the preset data linked list and the current event are stored in the preset hashmap.
3. The queue synchronization method according to claim 1, characterized in that: Also includes: When the first target synchronization event is found in the preset hashset, the first target synchronization event is deleted from the preset hashset, and the current event is discarded.
4. The queue synchronization method according to claim 1, characterized in that: Before searching whether there is a first target synchronization event matching the current event in the preset hashset, the queue synchronization method further includes: Determine whether the current event is a queue event according to the event identifier of the current event; The searching whether there is a first target synchronization event matching the current event in the preset hashset includes: When it is determined according to the event identifier that the current event is the queue event, it is searched whether the first target synchronization event exists in the preset hashset.
5. The queue synchronization method according to claim 1, characterized in that: Also includes: If the event type is a receiving event, searching the preset hashmap for a second target synchronization event that matches the current event; When the second target synchronization event does not exist in the preset hashmap, the current event is stored in the preset hashset.
6. The queue synchronization method according to claim 5, characterized in that: Also includes: When the second target synchronization event exists in the preset hashmap, iterator information of the second target synchronization event is obtained, where the iterator information is used to represent the storage address of the second target synchronization event in the preset data linked list; According to the iterator information, the second target synchronization event is deleted from the preset data linked list, and the second target synchronization event is deleted from the preset hashmap.
7. The queue synchronization method according to any one of claims 1 to 6, characterized in that: The determining of the event category of the current event includes: If the current event is generated based on power data reported by the power equipment, determining the event category as the generated event; If the current event is generated based on receiving the first synchronization event sent by the second remote motor, the event category is determined to be a reception event.
8. An event queue synchronization device, characterized in that: Applied to the first telemotor, the queue synchronization device comprises: A first determination module, used to determine the event category of the current event; A first search module, for searching a preset hashset for a first target synchronization event matching the current event if the event category is a generated event, wherein the preset hashset is used to store a plurality of first synchronization events sent by the second remote motor; The first storage module is used to store the current event in a preset hashmap when the first target synchronization event does not exist in the preset hashset.
9. A remote control machine, characterized in that: include: Memory; One or more processors coupled to the memory; One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more applications are configured to execute the queue synchronization method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program code, and the program code can be called by a processor to execute the queue synchronization method as described in any one of claims 1 to 7.