Intelligent electric meter event triggering method and device, equipment and medium
By building an independent trigger event configuration table for each module of the smart meter and managing event flags with global arrays, the maintenance and expansion problems caused by tight coupling between modules are solved, and the system is achieved with high maintainability and scalability, simplifying the event detection process and reducing resource consumption.
Patent Information
- Application Number
- CN202411960742.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-05-30
AI Technical Summary
The tight coupling between different modules in existing smart meters makes it difficult to maintain and expand the firmware code, and the dependence between event processing logic and modules are complex, which leads to errors easily during development and maintenance, and the repair cost is high, so debugging and troubleshooting after event triggering is more difficult.
By building a trigger event configuration table for each module separately and managing event flags through a global array, decoupling between modules can be achieved, so that each module can independently configure and manage its own events, reducing the tight coupling between modules.
It improves the maintainability and scalability of the system, simplifies the event-triggered detection process, reduces system resource consumption and delay, and supports dynamic modification of event configuration, improving firmware scalability.
Smart Images

Figure CN120067398A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of smart meters, and particularly to a method, device, equipment and medium for triggering events of a smart meter. Background Art
[0002] As an important part of the smart grid, a smart meter can monitor and record various events in the power grid in real time, provide accurate power consumption data, and manage and optimize the health status of the power grid. A smart meter can not only monitor real-time grid parameters such as current, voltage, and power, but also record and process a series of events, especially trigger events such as over-limit power, time calibration, and fault alarm. Trigger events refer to events triggered by changes in the meter or grid status and need to be processed according to certain rules. The processing of these events not only involves the normal operation of the meter, but may also affect the stability, reliability, and user experience of the system.
[0003] Currently, the tight coupling between different modules makes the firmware code difficult to maintain and expand. The processing logic of events and the dependency relationships between modules are complex, resulting in errors easily occurring during the development and maintenance process, and the repair cost is high. It is difficult to debug and troubleshoot after an event is triggered. Especially in high-concurrency and multi-event trigger scenarios, the debugging and testing workload is large, which easily leads to a decline in system performance. Summary of the Invention
[0004] Object of the Invention: The object of the present invention is to solve the defect that the tight coupling between different modules in the prior art makes the firmware code difficult to maintain and expand, and the processing logic of events and the dependency relationships between modules are complex, resulting in errors easily occurring during the development and maintenance process. A method, device, equipment and medium for triggering events of a smart meter are provided, which realizes decoupling between modules by separately constructing a trigger event configuration table for each module and managing event flags through a global array. This enables each module to independently configure and manage its own events, reduces the tight coupling between modules, and improves the maintainability and scalability of the system.
[0005] One or more embodiments of this specification simultaneously relate to a device for triggering events of a smart meter, an electronic device, a computer-readable storage medium, and a computer program product to solve the technical defects existing in the prior art.
[0006] Technical Solution:
[0007] In a first aspect, the present application proposes a method for triggering events of a smart meter, including the steps of:
[0008] Constructing a trigger event configuration table according to different modules and constructing a global array;
[0009] Add the trigger events to be added to the trigger time configuration table of the corresponding module;
[0010] When an event of one of the modules occurs, set the corresponding event flag through the global array to indicate that the event has been triggered;
[0011] Traverse whether each event flag of each module in the global array is set. When the event flag is set, trigger the event in the event time configuration table;
[0012] Obtain the number and address of the corresponding event according to the time flag, and find the corresponding event in the event configuration table.
[0013] Preferably, the modules in the smart meter include electric energy, instantaneous quantity, TOU, freezing, event, demand, display, and communication.
[0014] Preferably, the global array is used to store multiple event flags of each module, and each event flag corresponds to a unique event flag.
[0015] Preferably, the trigger event configuration table corresponds to one module, each module corresponds to one or more trigger events, and each trigger event has a unique event flag.
[0016] Preferably, the event flag is set through bit operations. When the event occurs, the corresponding flag bit of the global array is set to 1 to indicate that the event has been triggered.
[0017] Preferably, each event record in the event configuration table includes: event number, total number of event records, maximum length of a single record, storage address of event data, and total table and number of objects of the capture object of event data.
[0018] Preferably, the record of the trigger event is implemented through a configuration parameter structure, where the event parameter structure includes: event type, number of records, maximum length of record items, storage address of management information, storage address of event data, and list of event identifiers of the record.
[0019] In a second aspect, an embodiment of the present invention provides a smart meter event trigger device, including:
[0020] A construction unit for constructing a trigger event configuration table and a global array according to different modules respectively;
[0021] An adding unit for adding the trigger events to be added to the trigger time configuration table of the corresponding module; when an event of one of the modules occurs, setting the corresponding event flag through the global array to indicate that the event has been triggered;
[0022] A query unit is used to traverse whether each event flag of each module in the global array is set. When the event flag is set, an event is triggered in the event time configuration table.
[0023] A matching unit is used to obtain the number and address of the corresponding event according to the time flag and find the corresponding event in the event configuration table.
[0024] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory. Among them, the memory is used to store one or more computer programs; when one or more computer programs stored in the memory are executed by the processor, the electronic device can implement the method of any possible design in the above first aspect.
[0025] In a fourth aspect, the present invention provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method in any one of the above embodiments is implemented.
[0026] In a fifth aspect, an embodiment of the present invention further provides a computer program product. When the computer program product runs on an electronic device, the electronic device is enabled to execute the method of any possible design in any one of the above aspects.
[0027] Beneficial effects: By separately constructing a trigger event configuration table for each module and managing event flags through a global array, decoupling between modules is achieved. This enables each module to independently configure and manage its own events, reduces the tight coupling between modules, and improves the maintainability and scalability of the system.
[0028] Using a global array to manage the event flags of each module can quickly determine whether an event is triggered and execute corresponding processing. The detection process of event triggering is efficient and simple, without the need to traverse complex data structures, reducing system resource consumption and latency.
[0029] The event configuration table can be dynamically modified, supporting the addition, deletion, or modification of event types without changing the core code. This makes the system more flexible, can easily handle event requirements in different scenarios, and improves the scalability of the firmware. Description of the Drawings
[0030] Figure 1 It is a schematic diagram of the method framework provided by the present invention;
[0031] Figure 2 It is a schematic structural diagram of a device provided in an embodiment of the present application;
[0032] Figure 3 It is a block diagram of an electronic device structure provided in an embodiment of the present application. Detailed Embodiments
[0033] To make the technical solution of the present invention clearer, the following further describes the present invention in detail with reference to specific embodiments in the accompanying drawings.
[0034] Embodiment 1
[0035] To make the purpose, technical solution and advantages of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of them. Based on the embodiments in the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention. Unless otherwise defined, the technical terms or scientific terms used herein shall have the ordinary meaning understood by those of ordinary skill in the art to which the present invention belongs. The words such as "including" used herein mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects.
[0036] Regarding the problems existing in the prior art, as Figure 1 shown, an intelligent meter event triggering method includes the steps:
[0037] S101, respectively construct a trigger event configuration table according to different modules, and construct a global array;
[0038] Each module (such as electric energy, instantaneous quantity, communication, etc.) will have different trigger events. In this method, the trigger event configuration table is used to define the event types and their processing methods of each module, while the global array flag_eve is used to store the event flags of each module (each module has its own event flag). Through modular design, it is convenient to expand and maintain.
[0039] S102, add the trigger event to be added to the trigger time configuration table of the corresponding module;
[0040] When a new trigger event needs to be added to a certain module, only need to add the corresponding event entry to the configuration table of this module. The detailed information of the event, including the event type, processing flow, required resources, etc., is defined in this configuration table.
[0041] S103, when an event of one of the modules occurs, set the corresponding event flag through the global array to indicate that the event has been triggered;
[0042] When a trigger event occurs in a certain module, the corresponding event flag is set in the global array flag_eve. For example, when the "time calibration" event of the communication module is triggered, flag_eve[6] will be set to a mark indicating that the event has occurred. The role of this flag bit is to inform the system that a specific event has been triggered.
[0043] S104, traverse each event flag of each module in the global array to check if it is set. When the event flag is set, trigger the event in the event time configuration table;
[0044] Traverse the flag_eve array and check one by one whether the event flag of each module is set. If the flag is set, it means that the event of the module has occurred, and the program will execute the corresponding event processing flow according to the trigger event configuration table.
[0045] S105, obtain the number and address of the corresponding event according to the time flag, and find the corresponding event in the event configuration table.
[0046] After the event flag is set, the program will obtain the number and storage location of the corresponding event according to the flag position, and find the detailed information of the event in the trigger event configuration table, which includes the parameters, processing methods, data storage locations, etc. of the event.
[0047] In some specific embodiments, the modules in the smart meter include electric energy, instantaneous quantity, TOU, freezing, event, demand, display, and communication;
[0048] Specifically, these modules each perform different functions in the smart meter. Specifically:
[0049] Electric energy module: responsible for monitoring the electric energy consumption of the meter and recording the electricity consumption;
[0050] Instantaneous quantity module: used to measure the instantaneous parameters of the power grid in real time, such as voltage, current, power, etc.;
[0051] TOU module (time-of-use electricity price module): sets electricity prices according to different time periods to help users understand the costs of using electricity at different times;
[0052] Freezing module: used to save the data in the meter and provide historical data records when needed;
[0053] Event module: records various events that occur during the operation of the meter, such as faults, time calibration, alarms, etc.;
[0054] Demand module: measures and records the maximum demand electricity of the meter within a certain period of time for managing the power grid load;
[0055] Display module: used to display the meter data and status information, usually including display devices such as LCD screens;
[0056] Communication module: Responsible for data communication between the electricity meter and external devices (such as concentrators, cloud platforms, etc.), and supports functions such as remote reading and remote control.
[0057] In some specific embodiments, the global array is used to store multiple event flags of each module, and each event flag corresponds to a unique event flag.
[0058] Specifically, the global array is used to manage multiple event flags of each module. Each module has a set of event flags, and these flags are used to indicate whether a specific event has occurred in the module. Each event flag is unique and can clearly identify whether a certain event has occurred;
[0059] To ensure the uniqueness of events, each event flag has a unique identifier, usually represented by a constant or a bitmask to represent different events;
[0060] For example, flag_eve[module]|=FLAG_EVE_COMM_645_WRITE_RTC sets the bit through an OR operation to indicate that the "time calibration event" has been triggered, which can avoid conflicts between event flags and ensure that the flags of different events do not interfere with each other;
[0061] The method of managing and using the global array is as follows:
[0062] Assume that the global array is named flag_eve, and its dimension is [module_count], and each module corresponds to a module; for example, flag_eve[0] represents the event flag of the power module, flag_eve[1] represents the event flag of the instantaneous quantity module, and so on;
[0063] Each flag_eve[module] can store multiple event flags using a bitmask, so that multiple event flags can be represented by different bits, and each event flag occupies one bit;
[0064] Setting and clearing of event flags;
[0065] Setting the flag: When an event occurs in a certain module, set the corresponding bit to set up the event flag;
[0066] For example, when a time calibration event occurs in the communication module;
[0067] flag_eve[6]|=FLAG_EVE_COMM_645_WRITE_RTC sets up the event flag of the 6th module, indicating that the event has been triggered;
[0068] Clear Flag: If it is necessary to clear an event flag (for example, the event has been processed or has expired), the following can be used:
[0069] Clear it by flag_eve[module]&=~FLAG_EVE_COMM_645_WRITE_RTC.
[0070] Event Triggering and Processing;
[0071] By traversing the flag_eve array, it is possible to detect which modules have had events occur;
[0072] When it is found that an event flag has been set, the system will trigger an event according to the time configuration table;
[0073] For example, if(flag_eve[module]&FLAG_EVE_COMM_645_WRITE_RTC):
[0074] It indicates that a time calibration event has occurred in this module, and then relevant processing is carried out according to this event.
[0075] In some specific embodiments, the trigger event configuration table corresponds to a module, each module corresponds to one or more trigger events, and each trigger event has a unique event flag.
[0076] Specifically, the trigger event configuration table is a structure in the system used to store and manage event information related to each module. Each module has a corresponding trigger event configuration table, and this configuration table contains all the events that this module may trigger; the trigger event configuration table does not contain only one event. In fact, each module may have multiple trigger events. For example, the power module may have events such as "power data update" or "power exceeds the set range", etc. These events are defined and managed in the trigger event configuration table of the power module. Other modules such as the communication module and the freeze module also have their own event configuration tables, containing different trigger events;
[0077] Each trigger event is assigned a unique event flag. The event flag is usually represented in the form of a constant or a bit mask to ensure that each event can be independently identified. For example, the "time calibration event" may be assigned a specific flag, such as:
[0078] FLAG_EVE_COMM_645_WRITE_RTC;
[0079] And this flag will be set when the event is triggered, indicating that the event has occurred.
[0080] In some specific embodiments, the event flag is set through bit operations. When an event occurs, the corresponding flag bit of the global array is set to 1, indicating that the event has been triggered.
[0081] Specifically, the event flag of each module is mapped to an element of the global array. This element is an integer data type, and each event corresponds to a certain bit in this element (for example, each event is represented by a single bit). When a certain event occurs, the corresponding bit is set to 1 through bit operations, indicating that the event has been triggered.
[0082] In some specific embodiments, each event record in the event configuration table includes: event number, total number of event records, maximum length of a single record, storage address of event data, and the total table of captured objects of event data and the number of objects.
[0083] Specifically, the event number (Event ID), each event has a unique number used to identify the event. Through the event number, the system can find the relevant records and configuration information of a specific event in the configuration table; the total number of event records (Total Record Count) represents the total number of records of the event. It is usually used to dynamically record the number of times an event occurs or the number of data items, especially for those events that may occur repeatedly; the maximum length of a single record (Max RecordLength) defines the maximum number of bytes of a single event record, ensuring that the storage space for event data is bounded. This helps to avoid overflow or memory waste and ensure the effective use of memory; the storage address of event data (Storage Address) indicates the specific storage location of event data in memory or on an external storage medium. Event data may be stored in a specific memory area or external storage (such as an SD card, Flash). The total table of captured objects of event data and the number of objects (Captured ObjectTable and Object Count) is used to describe the captured objects related to the event and their quantities. For example, for power events, the captured objects may include data such as voltage, current, and power; for communication events, it may include packet size, communication status, etc.
[0084] In some specific embodiments, the recording of the triggered event is implemented through a configuration parameter structure, where the event parameter structure includes: event type, number of records, maximum length of record items, storage address of management information, storage address of event data, and the list of event identifiers of the records.
[0085] Specifically, the event type identifies the type of the event. The event type can be defined according to different application scenarios, such as "excessive electric energy", "communication interruption", "time calibration event", etc. Through the event type, the system can more conveniently identify and process different types of events; the record count indicates the number of data records required for this event, which is usually related to the number of times the event is triggered or the size of the triggered record. Each time the event occurs, the record count may increase, which is used to count the number of times the event is triggered; the maximum record length defines the maximum number of bytes for each record, that is, the maximum length of data that can be stored in a single event record. This helps to limit the size of each record, thereby avoiding data overflow and controlling the use of memory; the management information storage address specifies the address where the management information is stored. The management information includes event type, status, timestamp, priority, etc. These information help to efficiently manage and monitor the event; the event data storage address indicates the storage location of the event data. The event data storage address points to a specific memory or storage medium area for storing the relevant data of this event (such as voltage, current, time, etc.); the list of event identifiers of the record contains all the identifiers related to this event, which is used to indicate which specific data items or objects are related to this event. The event identifier can be electric energy data, communication status, sensor reading, etc. When processing this event, the system can quickly find the relevant data items for recording through the identifier.
[0086] An embodiment of the present invention provides an intelligent electric meter event triggering device, combined with Figure 2 , including:
[0087] A construction unit 301, configured to construct a trigger event configuration table according to different modules respectively, and construct a global array;
[0088] An adding unit 302, configured to add the trigger event to be added to the trigger time configuration table of the corresponding module; when an event of one of the modules occurs, set the corresponding event flag through the global array to indicate that the event has been triggered;
[0089] A query unit 303, configured to traverse whether each event flag of each module in the global array is set. When the event flag is set, trigger the event in the event time configuration table;
[0090] A matching unit 304, configured to find the corresponding event in the event configuration table according to the time flag to obtain the number and address of the corresponding event.
[0091] All relevant content of each step involved in the above method embodiments can be cited in the function descriptions of the corresponding functional modules, and will not be elaborated here.
[0092] In some other embodiments of the present invention, embodiments of the present invention disclose an electronic device, such as Figure 3 shown, the electronic device may include: one or more processors 401; a memory 402; a display 403; one or more applications (not shown); and one or more computer programs 404. The above components may be connected through one or more communication buses 405. Wherein the one or more computer programs 404 are stored in the memory 402 and configured to be executed by the one or more processors 401. The one or more computer programs 404 include instructions, and the above instructions can be used to execute the steps in Figures 1 to 2 and the corresponding embodiments.
[0093] Through the description of the above embodiments, those skilled in the art can clearly understand that for the convenience and conciseness of description, only the above division of each functional module is used as an example. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated here.
[0094] In each embodiment of the present invention, each functional unit may be integrated into a processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0095] If the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media such as flash memory, mobile hard disk, read-only memory, random access memory, magnetic disk, or optical disk that can store program codes.
[0096] As described above, it is only the specific implementation manner of the embodiments of the present invention. However, the protection scope of the embodiments of the present invention is not limited thereto. Any changes or substitutions within the technical scope disclosed in the embodiments of the present invention should be covered within the protection scope of the embodiments of the present invention. Therefore, the protection scope of the embodiments of the present invention shall be subject to the protection scope of the claims.
Claims
1. A smart meter event triggering method, characterized in that: Includes steps: Construct trigger event configuration tables according to different modules and construct global arrays; Add the trigger events that need to be added to the trigger time configuration table of the corresponding module; When an event of one of the modules occurs, the corresponding event flag is set through the global array to indicate that the event has been triggered; Iterate through each event flag of each module in the global array to see if it is set. When the event flag is set, the event is triggered in the event time configuration table. Get the number and address of the corresponding event according to the time stamp and find the corresponding event in the event configuration table.
2. The method according to claim 1, characterized in that The modules in the smart meter include electric energy, instantaneous quantity, TOU, freeze, event, demand, display, and communication.
3. The method according to claim 1, characterized in that The global array is used to store multiple event flags of each module, and each event flag corresponds to a unique event flag.
4. The method according to claim 1, characterized in that The trigger event configuration table corresponds to a module, each module corresponds to one or more trigger events, and each trigger event has a unique event flag.
5. The method according to claim 1, characterized in that The event flag is set through bit operation. When an event occurs, the corresponding flag bit of the global array is set to 1, indicating that the event has been triggered.
6. The method according to claim 1, characterized in that Each event record in the event configuration table includes: event number, total number of event records, maximum length of a single record, storage address of event data, and total table of captured objects of event data and number of objects.
7. The method according to claim 1, characterized in that The recording of the triggering event is implemented by configuring a parameter structure, wherein the event parameter structure includes: event type, number of records, maximum length of record items, management information storage address, event data storage address, and a recorded event identifier list.
8. A smart meter event triggering device, characterized in that: include: A construction unit is used to construct trigger event configuration tables according to different modules and to construct a global array; The adding unit is used to add the trigger event to be added to the trigger time configuration table of the corresponding module; when an event of one of the modules occurs, the corresponding event flag is set through the global array to indicate that the event has been triggered; A query unit is used to traverse whether each event flag of each module in the global array is set. When the event flag is set, an event is triggered in the event time configuration table; The matching unit is used to obtain the number and address of the corresponding event according to the time mark and find the corresponding event in the event configuration table.
9. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program executable on the processor, and when the computer program is executed by the processor, the processor implements the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.