Electric energy meter event monitoring system based on single responsibility principle and design method thereof

By adopting the single responsibility principle design in the smart power meter event monitoring system, separating the responsibilities of each module and reducing coupling, the poor stability problem of existing systems due to complex judgment logic is solved, and higher system stability and maintainability are achieved.

CN119668971APending Publication Date: 2025-03-21ANHUI ZENITH ELECTRICITY & ELECTRONICS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411654097.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-19
Publication Date
2025-03-21

AI Technical Summary

Technical Problem

The existing smart energy meter event monitoring system has poor stability due to complex judgment logic, and there are risks such as event refusal, false trigger, refusal and false recovery.

Method used

Design an energy meter event monitoring system based on the principle of single responsibility. The system is divided into a driving layer, a logic layer and a user layer. Each module is only responsible for a single type of event processing, and there is no mutual coupling, nesting and calling relationship between each module.

Benefits of technology

A relatively stable power meter event monitoring system is realized, which reduces the probability of decision-making errors and improves the safety, stability, readability and maintainability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119668971A_ABST
    Figure CN119668971A_ABST
Patent Text Reader

Abstract

The invention relates to an electric energy meter event monitoring system based on a single responsibility principle and a design method thereof, and the electric energy meter event monitoring system comprises a driving layer, a logic layer and a user layer. The driving layer comprises an information acquisition interface module and an access interface module; the logic layer comprises a trigger judgment module, a recovery judgment module and an execution module; the information acquisition interface module is configured to acquire electric energy meter information related to a single type of target event; the trigger judgment module is configured to judge whether a target event is triggered or not according to the electric energy meter information; the recovery judgment module is configured to judge whether the target event is recovered or not according to the electric energy meter information after the target event is triggered; and the execution module is configured to update the current record information of the target event when the target event is triggered or recovered, store the current record information of the target event in the nonvolatile storage device through the access interface module, and send the current record information of the target event to the user layer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of smart electric energy meters, and in particular to an electric energy meter event monitoring system based on the single responsibility principle. Background Art

[0002] The event monitoring function of the smart electricity meter is an important function used to discover, handle, and record key internal and external abnormal situations during the operation of the electricity meter, and provide important information for advanced functions such as electricity meter operation status monitoring and power consumption status monitoring.

[0003] Since the event judgment logic has a certain degree of universality, complex universal event functions are often constructed in the traditional design and development of electric energy meter event monitoring systems. This function must obtain the event type, signal type, current state, current delay, execution content, storage address according to external parameter transmission, and finally determine the occurrence or recovery of the event and process it.

[0004] With the development of smart meters, the number of event types and judgment conditions has increased, and the function body must include judgments and a large number of processing flows for a large number of different event signals, states, time, etc. The general event function design is bloated, the branches are lengthy, the structure is mixed, and the fan-in and fan-out overhead is large, so the security, stability, readability, and maintainability are greatly reduced, and there are even risks such as event refusal to trigger, false triggering, refusal to recover, and false recovery. Summary of the invention

[0005] The present invention provides an electric energy meter event monitoring system based on the single responsibility principle to solve the problem that the current electric energy meter event monitoring system has poor stability due to complex judgment logic.

[0006] In a first aspect, the present invention provides an electric energy meter event monitoring system based on a single responsibility principle, comprising a driver layer, a logic layer and a user layer;

[0007] The driver layer includes an information collection interface module and an access interface module;

[0008] The logic layer includes a trigger determination module, a recovery determination module, and an execution module;

[0009] The information collection interface module is configured to: collect electric energy meter information related to a single type of target event;

[0010] The trigger determination module is configured to: determine whether the target event is triggered according to the electric energy meter information;

[0011] The recovery determination module is configured to: after the target event is triggered, determine whether the target event is recovered according to the electric energy meter information;

[0012] The execution module is configured to: after the target event is triggered or restored, update the current record information of the target event, store the current record information of the target event in a non-volatile storage device through the access interface module, and send the current record information of the target event to the user layer.

[0013] In a second aspect, the present invention provides a design method for an electric energy meter event monitoring system, which is used to design the electric energy meter event monitoring system based on the single responsibility principle described in the first aspect, and the design method includes:

[0014] Based on the single responsibility principle, different data structures are designed for different types of events. The variable type of each data structure is unique and corresponds to different types of events.

[0015] Designing a system architecture, wherein the system architecture includes three system layers, namely a driver layer, a logic layer and a user layer, each of the system layers includes a number of functional modules, and each functional module has only one input that can cause an output change;

[0016] The system architecture applies different data structures to obtain different electric energy meter event monitoring systems.

[0017] In a third aspect, the present invention provides an electronic device, comprising a memory and a processor, wherein the memory stores an electric energy meter event monitoring system based on the single responsibility principle, and the processor is configured to run the electric energy meter event monitoring system based on the single responsibility principle.

[0018] Compared with the related art, the electric energy meter event monitoring system provided by the present invention is based on the single responsibility principle, has a single responsibility data structure, decision logic, etc., a single system is only used to process a single type of event, each module in the system only needs to respond to a single variable, and there is no mutual coupling, nesting and calling relationship between the modules. Therefore, the present invention provides a relatively stable electric energy meter event monitoring system, which solves the problem of poor stability of the current electric energy meter event monitoring system due to complex judgment logic.

[0019] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 is an architecture diagram of an electric energy meter event monitoring system based on a single responsibility principle provided in an embodiment of the present invention;

[0021] Figure 2 is a schematic diagram of an electric energy meter event monitoring logic based on a single responsibility principle provided in an embodiment of the present invention;

[0022] Figure 3 It is a schematic diagram of storage space allocation based on the single responsibility principle provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0023] In order to more clearly understand the purpose, technical solutions and advantages of the present application, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments.

[0024] Unless otherwise defined, the technical terms or scientific terms involved in this application shall have the general meaning understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the", "these" and the like in this application do not represent quantitative restrictions, and they can be singular or plural. The terms "include", "comprise", "have" and any variants thereof involved in this application are intended to cover non-exclusive inclusions; for example, a process, method and system, product or device comprising a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether directly or indirectly. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships. For example, "A and / or B" can mean: A exists alone, A and B exist at the same time, and B exists alone. Usually, the character " / " indicates that the objects associated with each other are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.

[0025] In an embodiment of the present invention, an electric energy meter event monitoring system based on a single responsibility principle is provided. Figure 1 is an architecture diagram of an electric energy meter event monitoring system based on a single responsibility principle provided in an embodiment of the present invention, such as Figure 1 As shown, the system includes a driver layer, a logic layer and a user layer.

[0026] The driving layer includes an information acquisition interface module and an access interface module; the logic layer includes a trigger determination module, a recovery determination module, and an execution module; the information acquisition interface module is configured to: collect electric energy meter information related to a single type of target event; the trigger determination module is configured to: determine whether the target event is triggered according to the electric energy meter information; the recovery determination module is configured to: after the target event is triggered, determine whether the target event is recovered according to the electric energy meter information; the execution module is configured to: after the target event is triggered or recovered, update the current record information of the target event, and store the current record information of the target event in a non-volatile storage device through the access interface module, and send the current record information of the target event to the user layer.

[0027] Among them, the key point of the above-mentioned electric energy meter monitoring system is that the type of target event is single, that is, a single electric energy meter event monitoring system only monitors one type of event, and thus the electric energy meter event monitoring system is based on the single responsibility principle. Each module in the system only needs to respond to a single type of electric energy meter information (such as current data or voltage data, etc.). For example, the decision logic and decision parameters of each module in the logic layer are only a unique set, so the data structure and decision logic in the system are based on the single responsibility principle. Among them, the data structure in a single system only contains member variables of a single business data type or only focuses on a single business function. After the data structure is determined, an independent cache space is allocated for each type of data in the form of defining global variables. Further, each module in each logic layer makes a decision corresponding to a single variable, for example, the trigger determination module only responds to the electric energy meter information to make a decision on whether the target event is triggered, and the recovery determination module only responds to the electric energy meter information to make a decision on whether the target event is recovered. Therefore, the decision logic inside each module is relatively simple, which can greatly reduce the probability of decision errors. At the same time, there is no mutual coupling, nesting and calling relationship between the modules, and the data processing logic is unidirectional. For example, during the process of the trigger determination module making a decision, there is no need to call the recovery determination module to make a decision, and the decision result of the recovery determination module will not affect the decision of the trigger determination module.

[0028] In summary, the electric energy meter event monitoring system provided by the present invention is based on the single responsibility principle, and has a single responsibility data structure, decision logic, etc. A single system is only used to process a single type of event. Each module in the system only needs to respond to a single variable, and there is no mutual coupling, nesting, and calling relationship between the modules.

[0029] Therefore, a relatively stable electric energy meter event monitoring system is provided, which solves the problem that the current electric energy meter event monitoring system has poor stability due to complex judgment logic.

[0030] In some of the embodiments, the trigger determination module includes a trigger threshold determination module and a trigger delay determination module; the trigger threshold determination module is configured to: determine whether the electric energy meter information meets the trigger threshold condition, if not, determine that the target event is not triggered; the trigger delay determination module is configured to: when the electric energy meter information meets the trigger threshold condition, determine whether the electric energy meter information meets the trigger delay condition, if so, determine that the target event is triggered.

[0031] There are two judgment conditions for whether some target events are triggered. One is the trigger threshold condition, that is, whether the data (current or voltage data) in the electric energy meter information meets the trigger threshold (lower or higher than the preset value), and the other is the trigger delay condition, that is, whether the duration of the data in the electric energy meter information meeting the trigger threshold condition meets the trigger threshold (the duration below or above the threshold is greater than the preset time). Therefore, for such target events, the trigger judgment module can be further divided into a trigger threshold judgment module and a trigger delay judgment module. Each module only performs a single judgment task, and still strictly meets the single responsibility principle.

[0032] In some embodiments, the recovery determination module includes a recovery threshold determination module and a recovery delay determination module. The recovery threshold determination module is configured to: when the target event is triggered, determine whether the electric energy meter information meets the recovery threshold condition; the recovery delay determination module is configured to: when the electric energy meter information meets the recovery threshold condition, determine whether the electric energy meter information meets the recovery delay condition, if so, the target event is determined to be recovered.

[0033] Similarly, there are two judgment conditions for whether some target events are restored. One is the recovery threshold condition, that is, whether the data (current or voltage data) in the electric energy meter information meets the recovery threshold (lower or higher than the preset value), and the other is the recovery delay condition, that is, whether the duration of the data in the electric energy meter information meeting the recovery threshold condition meets the recovery threshold (the duration lower than or higher than the recovery threshold is greater than the preset time). Therefore, for such target events, the recovery judgment module can be further divided into a recovery threshold judgment module and a recovery delay judgment module. Each module only performs a single judgment task and still strictly meets the single responsibility principle.

[0034] It should be noted that whether the target event is restored is determined after the target event is triggered. That is, when the trigger delay determination module determines that the electric energy meter information meets the trigger delay condition (at this time, the target event is determined to be triggered, and the target event recovery determination needs to be started), the recovery threshold determination module begins to continuously determine whether the electric energy meter information meets the recovery threshold condition.

[0035] In some of the embodiments, the execution module includes a trigger execution module and a recovery execution module; the trigger execution module is configured to: when the target event is triggered, update the record information of the target event and store the current record information of the target event in a non-volatile storage device through the access interface module; the recovery execution module is configured to: when the target event is recovered, update the record information of the target event and store the current record information of the target event in the non-volatile storage device through the access interface module.

[0036] Taking into account that there are two types of event decisions, namely target event triggering and target event recovery, the execution module is further divided into a trigger execution module and a recovery execution module in the above embodiment, which update the record information of the target event under different decision results, thereby making the responsibilities of the execution module more single and further improving the stability of the execution module.

[0037] The recorded information of the target event includes at least event status, event count, etc. The event status includes event occurrence flag, event hold flag, event recovery flag, action start execution flag, action hold execution flag, and action reset flag, etc. The event count includes the total number of events and the number of cycles, the total number of actions and the number of cycles, etc.

[0038] Furthermore, each piece of record information of the target event is stored in different and independent fixed physical storage spaces in the non-volatile storage device, and each fixed physical storage space has a unique address. That is, an independent and unique fixed physical storage space is allocated to each piece of record information of the target event in the non-volatile storage device.

[0039] In some of the embodiments, the user layer includes a message receiving module, an event reporting module, and an event display module;

[0040] Send the current record information of the target event to the user layer, including:

[0041] The recorded information of the target event is sent to the event reporting module and the event display module through the message receiving module.

[0042] The event reporting module is configured to report the current record information of the target event to the host computer; the event display module is configured to display the current record information of the target event.

[0043] In an embodiment of the present invention, a design method of an electric energy meter event monitoring system is also provided, which is used to design the electric energy meter event monitoring system based on the single responsibility principle provided in the present invention. The design method includes:

[0044] Step S110, designing different data structures for different types of events based on the single responsibility principle, wherein the variable type of each data structure is unique and corresponds to different types of events;

[0045] Step S120, designing a system architecture, the system architecture includes three system layers, the three system layers are a driver layer, a logic layer and a user layer, each system layer includes a number of functional modules, and each functional module has only one input that can cause an output change;

[0046] Step S130: the system architecture applies different data structures to obtain different electric energy meter event monitoring systems, and the different electric energy meter event monitoring systems manage different electric energy meter event monitoring data.

[0047] Preferably, in the system design, a global variable of each data structure is defined, and an independent cache is allocated to each global variable of each data structure.

[0048] The design method of the above-mentioned electric energy meter event monitoring system is based on the single responsibility principle to design the electric energy meter event monitoring system, and each electric energy meter event monitoring system only handles a single type of event. The types of events include abnormal voltage events, abnormal current events, etc.

[0049] As follows, the electric energy meter event monitoring system based on the single responsibility principle and the design method thereof in the present invention are further described through a specific embodiment.

[0050] The data structure example is as follows:

[0051] 1.1 Trigger and recovery voltage parameters

[0052] typedefstruct

[0053] {

[0054] UINT32 voltage_trigger_upper; / / voltage trigger upper limit

[0055] UINT32 voltage_trigger_lower; / / voltage trigger lower limit

[0056] UINT32 voltage_restore_upper; / / voltage recovery upper limit

[0057] UINT32 voltage_restore_lower; / / voltage recovery lower limit

[0058] }EVENT_U_VOLTAGE_LOSS_A_s.

[0059] 1.2 Trigger and recovery current parameters

[0060] typedefstruct

[0061] {

[0062] UINT32 current_restore_upper; / / current recovery lower limit

[0063] UINT32 current_restore_lower; / / current recovery lower limit

[0064] UINT32 current_trigger_upper; / / Current trigger lower limit

[0065] UINT32 current_trigger_lower; / / Current trigger lower limit

[0066] }EVENT_I_VOLTAGE_LOSS_A_s.

[0067] 1.3 Determination delay

[0068] typedefstruct

[0069] {

[0070] UINT32 delay_occur; / / Event delay occurrence time

[0071] UINT32 delay_restore; / / Event delay recovery time

[0072] UINT32 delay_action; / / action execution delay time

[0073] UINT32 delay_reset; / / Action reset delay time

[0074] }EVENT_DELAY_VOLTAGE_LOSS_A_s.

[0075] 1.4 Event Status

[0076] typedefstruct

[0077] {

[0078] UINT32 occur_flag; / / Event occurrence flag

[0079] UINT32 hold_flag; / / Event hold flag

[0080] UINT32 restore_flag; / / Event restore flag

[0081] UINT32 action_start_flag; / / action start flag

[0082] UINT32 action_hold_flag; / / action hold execution flag

[0083] UINT32 action_reset_flag; / / action reset flag

[0084] }EVENT_FLAG_VOLTAGE_LOSS_A_s.

[0085] 1.5 Event Count

[0086] typedefstruct

[0087] {

[0088] UINT32 event_total_count; / / Total number of events

[0089] UINT32 event_cycle_count; / / Number of cycles (1 to 10 or 1 to 100) UINT32 action_total_count; / / Total number of actions

[0090] UINT32 action_cycle_count; / / Number of action cycles (1 to 10 or 1 to 100)}EVENT_COUNT_VOLTAGE_LOSS_A_s.

[0091] 1.6 Event Storage Management

[0092] typedefstruct

[0093] {

[0094] UINT32 state; / / Storage status (1-not stored; 2-storage in progress; 2-storage completed)

[0095] UINT32 number; / / Storage record number (1 to 10 or 1 to 100)

[0096] UINT32 address[NUM_VOLTAGE_LOSS_A]; / / storage address

[0097] UINT32 length[NUM_VOLTAGE_LOSS_A]; / / storage length

[0098] }EVENT_STORAGE_VOLTAGE_LOSS_A_s.

[0099] Among them, the action is the response to the event. For example, when the overvoltage event is confirmed to be triggered, the action to be executed is opening the circuit breaker; when the overvoltage event is confirmed to be restored, the action to be executed is closing the circuit breaker.

[0100] Referring to the above example, for the data structure part of the system, each event will set up a series of data structures with a single responsibility to manage each link in the process of energy meter event monitoring, including: trigger and recovery parameters, delay judgment time, event status, event count and event record storage status, etc. Each data structure contains only a single business data type member variable or focuses on a single business function. Take the voltage undervoltage event as an example:

[0101] Single business data type: The trigger and recovery voltage / current parameter data structure only contains the voltage / current value judged by the event; the delay judgment time data structure only contains the delay time; the event status data structure only contains the flag bits of the three states; the event count data structure only contains the total number of events and the number of cycles.

[0102] Single business function: Event storage management data structure, including storage status, storage records, storage space first address and length, only serves the storage management of event records. When the main system needs to access event records, it provides corresponding information to assist the main system in accessing storage space accurately and efficiently.

[0103] Independent cache: After the above data structure is determined, independent cache space must be allocated for it in the form of defining global variables. An example of a global variable is as follows:

[0104] EVENT_U_VOLTAGE_LOSS_A_s g_U_VoltageLoss.

[0105] EVENT_I_VOLTAGE_LOSS_A_s g_I_VoltageLoss.

[0106] EVENT_DELAY_VOLTAGE_LOSS_A_s g_Delay_VoltageLoss.

[0107] EVENT_FLAG_VOLTAGE_LOSS_A_s g_Flag_VoltageLoss.

[0108] EVENT_COUNT_VOLTAGE_LOSS_A_s g_Count_VoltageLoss.

[0109] EVENT_STORAGE_VOLTAGE_LOSS_A_s g_Storage_VoltageLoss.

[0110] An independent cache is allocated for each global variable of the above undervoltage event for subsequent initialization, update, and read / write access operations to release the coupling or connection between the variables within a certain event.

[0111] The above-mentioned independent cache allocation is performed for each global variable of each event to release the coupling or connection between events.

[0112] Reference Figure 2 For the logic judgment part, based on the single responsibility principle, the event judgment logic is designed, taking the voltage undervoltage event as an example:

[0113] Step (1): Start undervoltage event monitoring, including record clearing, parameter initialization and other preparations.

[0114] Step (2): Trigger threshold judgment, by comparing the trigger threshold with the current reading to determine whether the trigger condition is met.

[0115] The function is deployed in the form of UINT32 EventJudge_VoltageLoss_threshold(VOID). The parameters of the event judgment function are defaulted, and the trigger threshold and current reading value related to the voltage undervoltage event are read, compared, and judged directly in the function body. When the return value is 1, it means that the trigger threshold condition is met; when the return value is 0, it means that the trigger threshold condition is not met. This function is designed according to SRP and focuses on realizing the voltage undervoltage event trigger threshold judgment function. It has a single input and a single output. It does not involve irrelevant thresholds and readings, irrelevant events, or other operations, and is not coupled with other data, functions, or functional modules.

[0116] Step (3): Trigger delay judgment, by comparing the event delay setting with the current duration to determine whether the trigger condition is met.

[0117] The function is deployed in the form of UINT32 EventJudge_VoltageLoss_delay(VOID). The parameters of the event judgment function are defaulted, and the reading, comparison, and judgment of the voltage undervoltage event delay setting and the current duration of the event are directly implemented in the function body. When the return value is 1, it means that the trigger delay condition is met; when the return value is 0, it means that the trigger delay condition is not met. This function is designed according to SRP and focuses on realizing the voltage undervoltage event trigger delay judgment function. It has a single input and a single output. It does not involve irrelevant settings and time, irrelevant events, or other operations, and is not coupled with other functions or functional modules.

[0118] Step (4): After the judgment is completed, process the triggered event.

[0119] The function is deployed in the form of VOID EventUpdate_VoltageLoss_Start(VOID) with default parameters. It directly completes the event status update, count update, storage update, report update and other operations in the function body. It only involves the update of data related to the event and is not coupled with other data, functions or functional modules.

[0120] Step (5): Recovery threshold judgment, by comparing the recovery threshold with the current reading, to determine whether the recovery condition is met.

[0121] The function is deployed in the form of UINT32 EventRestore_VoltageLoss_threshold(VOID), focusing on implementing the voltage undervoltage event recovery threshold judgment function.

[0122] Step (6): Recovery delay judgment, by comparing the event delay setting with the current duration to determine whether the recovery condition is met.

[0123] The function is deployed in the form of UINT32 EventRestore_VoltageLoss_delay(VOID), focusing on implementing the voltage undervoltage event recovery delay judgment function.

[0124] Step (7): After the judgment is completed, process the recovered event.

[0125] The function is implemented in the form of VOID EventUpdate_VoltageLoss_End(VOID).

[0126] Step (8): Event monitoring interval delay, after a round of monitoring of the event is completed, active delay is performed.

[0127] Reference Figure 1, for the system architecture and module division, based on the single responsibility principle, the three-layer system includes the driver layer, the logic layer, and the user layer. Take the voltage undervoltage event as an example:

[0128] The driver layer is responsible for providing hardware driver modules for the logic layer, including signal acquisition interface modules and non-volatile storage device access interface modules.

[0129] Logic layer: responsible for implementing event business logic functions, including trigger threshold determination module, trigger delay determination module, recovery threshold determination module, recovery delay determination module, trigger execution module, and recovery execution module.

[0130] User layer: responsible for implementing the event display and reporting application, including message receiving module, event reporting module, and event display module.

[0131] Each level has independent functions and single responsibilities, and has no associated coupling between parameters and variables, and can run independently.

[0132] In particular, when an event is more complex and additional judgment conditions are required, the judgment module can be directly added or modified in the logic layer.

[0133] In particular, when the event is more complex and requires additional signals, the model acquisition interface can be directly added or modified in the driver layer.

[0134] In particular, when the event is more complex and requires interactive application, the user module can be directly added or modified in the user layer.

[0135] Subdividing functional modules, based on the single responsibility principle, each module is designed to have only one factor that causes the change of its return result or execution content. For example:

[0136] The threshold determination module is triggered to determine the voltage and current readings and output the determination results.

[0137] The trigger delay determination module determines the holding time after the event trigger condition is met and outputs the determination result.

[0138] The recovery threshold determination module determines the voltage and current readings and outputs the determination results.

[0139] The recovery delay determination module determines the holding time after the event recovery condition is met and outputs the determination result.

[0140] The trigger execution module executes status update, count update, storage update, and report update after determining the trigger.

[0141] The recovery execution module executes status update, count update, storage update, and report update after determining the recovery.

[0142] All modules exist independently, and there is no calling or nesting relationship between any two modules.

[0143] Reference Figure 3 For event storage, based on the single responsibility principle, each unit's physical space is required to store only one record of an event. That is, each record of each event has its own fixed physical storage space with independent space and unique address.

[0144] Taking event 1 as an example, each time an event occurs, the 10 storage spaces allocated by the system for event 1 are written in sequence. When 10 events occur, the 10 storage spaces are filled. When the 11th event occurs, the storage space address of event 1 is rolled back, and the 11th event record is overwritten in the first record space of event 1. The 12th event record is overwritten in the second record space of event 1, and so on.

[0145] In summary, the design method of the electric energy meter event monitoring system of the present invention includes:

[0146] 1. Single responsibility data structure and independent cache design: Each event will set up a series of data structures with single responsibilities to manage various links in the process of electric energy meter event monitoring, including: trigger and recovery parameters, delay determination and recovery time, event status, event count and event record storage status, etc. Each data structure only contains member variables of a single business data type or focuses on a single business function. After the data structure is determined, independent cache space is allocated for it in the form of defining global variables.

[0147] 2. Design of event judgment logic for the entire process: Based on the single responsibility principle, the following eight steps are designed: (1) Start monitoring; (2) Trigger threshold judgment; (3) Trigger delay judgment; (4) Trigger event processing; (5) Recovery threshold judgment; (6) Recovery delay judgment; (7) Recovery event processing; (8) Event monitoring interval delay.

[0148] 3. Three-tier system architecture and subdivided functional module design: Based on the single responsibility principle, a three-tier system architecture is designed to realize complete event functions. The three-tier system includes a driver layer, a logic layer, and a user layer. Each layer contains several subdivided functional modules, and each module is designed to have only one factor that causes the change of its return result or execution content.

[0149] 4. Independent storage space design: Each record of each event has a fixed physical storage space with independent space and unique address.

[0150] Based on the design method of the above-mentioned electric energy meter event monitoring system, the present invention provides a method for the electric energy meter to independently monitor, independently trigger, independently store, and independently display a number of different types of event records, which can minimize the correlation between different events and enable each sub-module of the event monitoring function module to focus on specific events and operate with minimum complexity and minimum coupling, thereby exchanging space for safety and improving the safety, stability, readability, and maintainability of the system.

[0151] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein the memory stores an electric energy meter event monitoring system based on the single responsibility principle, and the processor is configured to run the electric energy meter event monitoring system based on the single responsibility principle.

[0152] It should be understood that the specific embodiments described herein are only used to explain the application, rather than to limit it. Based on the embodiments provided in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the protection scope of this application.

[0153] Obviously, the drawings are only some examples or embodiments of the present application. For ordinary technicians in the field, the present application can also be applied to other similar situations based on these drawings without creative work. In addition, it is understandable that although the work done in this development process may be complicated and lengthy, for ordinary technicians in the field, certain changes in design, manufacturing or production based on the technical content disclosed in this application are only conventional technical means and should not be regarded as insufficient content disclosed in this application.

Claims

1. An electric energy meter event monitoring system based on the single responsibility principle, characterized in that: Includes driver layer, logic layer and user layer; The driver layer includes an information collection interface module and an access interface module; The logic layer includes a trigger determination module, a recovery determination module, and an execution module; The information collection interface module is configured to: collect electric energy meter information related to a single type of target event; The trigger determination module is configured to: determine whether the target event is triggered according to the electric energy meter information; The recovery determination module is configured to: after the target event is triggered, determine whether the target event is recovered according to the electric energy meter information; The execution module is configured to: after the target event is triggered or restored, update the current record information of the target event, store the current record information of the target event in a non-volatile storage device through the access interface module, and send the current record information of the target event to the user layer.

2. The electric energy meter event monitoring system based on the single responsibility principle according to claim 1 is characterized in that: The trigger determination module includes a trigger threshold determination module and a trigger delay determination module; The trigger threshold determination module is configured to: determine whether the electric energy meter information meets the trigger threshold condition, and if not, determine that the target event is not triggered; The trigger delay determination module is configured to: when the electric energy meter information meets the trigger threshold condition, determine whether the electric energy meter information meets the trigger delay condition, and if so, determine that the target event is triggered.

3. The electric energy meter event monitoring system based on the single responsibility principle according to claim 2 is characterized in that: The recovery determination module includes a recovery threshold determination module and a recovery delay determination module; The restoration threshold determination module is configured to: when the target event is triggered, determine whether the electric energy meter information meets the restoration threshold condition; The recovery delay determination module is configured to: when the electric energy meter information meets the recovery threshold condition, determine whether the electric energy meter information meets the recovery delay condition, and if so, determine that the target event is restored.

4. The electric energy meter event monitoring system based on the single responsibility principle according to claim 1 is characterized in that: The execution module includes a trigger execution module and a recovery execution module; The trigger execution module is configured to: after the target event is triggered, update the record information of the target event and store the current record information of the target event in a non-volatile storage device through the access interface module; The recovery execution module is configured to: after the target event is recovered, update the record information of the target event and store the current record information of the target event in a non-volatile storage device through the access interface module.

5. The electric energy meter event monitoring system based on the single responsibility principle according to claim 1 is characterized in that: The user layer includes a message receiving module, an event reporting module and an event display module; Sending the current record information of the target event to the user layer includes: Sending the record information of the target event to the event reporting module and the event display module through the message receiving module; The event reporting module is configured to: report the current record information of the target event to the host computer; The event display module is configured to display the current record information of the target event.

6. The electric energy meter event monitoring system based on the single responsibility principle according to claim 1 is characterized in that: Each piece of record information of the target event is stored in different and mutually independent fixed physical storage spaces in a non-volatile storage device, and the address of each fixed physical storage space is unique.

7. The electric energy meter event monitoring system based on the single responsibility principle according to claim 1 is characterized in that: The record information of the target event includes event status information and event count information of the target event.

8. A design method for an electric energy meter event monitoring system, characterized in that: For designing an electric energy meter event monitoring system based on a single responsibility principle as described in any one of claims 1 to 7, the design method comprises: Based on the single responsibility principle, different data structures are designed for different types of events. The variable type of each data structure is unique and corresponds to different types of events. Designing a system architecture, wherein the system architecture includes three system layers, namely a driver layer, a logic layer and a user layer, each of the system layers includes a number of functional modules, and each functional module has only one input that can cause an output change; The system architecture applies different data structures to obtain different electric energy meter event monitoring systems.

9. The design method of the electric energy meter event monitoring system according to claim 8, characterized in that: The design method also includes: A global variable of each of the data structures is defined, and an independent cache is allocated to each global variable of each of the data structures.

10. An electronic device comprising a memory and a processor, characterized in that: The memory stores an electric energy meter event monitoring system based on the single responsibility principle, and the processor is configured to run the electric energy meter event monitoring system based on the single responsibility principle.