A method and system for controlling electric energy meter based on state machine
By using the control method of the MEALY state machine in the IoT Energy table, the problem of decreased system stability and rising maintenance costs caused by improper priority processing of priority processing is solved, and higher system stability and user experience are achieved.
Patent Information
- Application Number
- CN202411127879.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-08-16
AI Technical Summary
When existing IoT meters are improperly handled (especially confusing priority), they may lead to reduced system stability and increased maintenance costs, affecting user experience and service quality.
Adopt the electrical energy meter control method based on the MEALY state machine, to determine the corresponding relationship between the control command received and priority state through the state machine, to ensure that the state machine is always in the state of the highest priority or appropriate relegation state to perform the control of the power meter control Essence
Effectively avoid improper priority treatment, improve the stability of the system, reduce maintenance costs, and improve user experience and service quality.
Smart Images

Figure CN118655803B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to an electric energy meter control method and system based on a state machine, belonging to the field of electric energy meter control. Background Art
[0002] IoT meters play an increasingly important role in our daily lives. IoT meters can monitor the use of electricity in real time, including instantaneous power, voltage, current and other data. Through these data, users can understand the actual consumption of electricity, providing a basis for energy management and control; IoT meters can also monitor abnormal conditions in the power system, such as voltage fluctuations, current overloads, etc., and send an alarm to the user once an abnormality occurs.
[0003] Currently, the existing IoT meters only have functions such as power protection and ordinary closing and opening. The smart IoT meter is a new generation of smart meters, which has newly added functions such as friendly power closing and opening, overheating closing, and overload closing. There is a certain priority logic relationship between the newly added functions and the original functions to ensure that the most appropriate response can be made in different situations. The addition of new functions such as friendly power closing and opening, overheating closing, and overload closing means that the control logic and hardware requirements of the system have become more complex. If the priority is not handled properly (especially the priority is confused) during the processing of different control logics, it may cause the closing and opening to fail, resulting in reduced system stability and increased maintenance costs; the closing and opening failure will also affect the user experience and service quality, leading to a series of problems such as user dissatisfaction and increased complaints. Summary of the invention
[0004] The purpose of the present invention is to provide an electric energy meter control method and system based on a state machine, so as to solve the problem that improper priority processing (especially priority confusion) may lead to reduced system stability and increased maintenance costs.
[0005] To achieve the above object, the solution of the present invention includes:
[0006] A method for controlling an electric energy meter based on a state machine comprises the following steps:
[0007] 1) Determine through the state machine whether the received control command corresponds to the state with the highest priority or the current state machine is in the state with the highest priority; if so, control the state machine to be in the state with the highest priority to execute the control of the electric energy meter; if not, proceed to step 2); the state machine is a Mealy type state machine; the state refers to the control state of the state machine;
[0008] 2) Determine through the state machine whether there is a control command corresponding to a state with a priority level reduced by one level or the current state machine is in the state with the priority level reduced by one level; if so, control the state machine to be in the state with the priority level reduced by one level to execute control of the electric energy meter; if not and the state contains more than three types, repeat step 2), and each repetition reduces the priority by one level based on the previous repetition until there is no state with a lower priority.
[0009] Further, in step 1), if it is determined that there is no received control command corresponding to the highest priority control state but the current state machine is in the highest priority control state, then while the control state machine is in the highest priority control state, the control command is also stored in the corresponding field of the control state of the state machine corresponding to the control command, so that when the state machine is not in the highest priority control state, the control command can be treated as a received control command and processed in steps 1)-2).
[0010] Further, in step 2), if it is determined that there is no received control command corresponding to a control state with a priority level reduced by one level but there is a situation where the current state machine is in a control state with a priority level reduced by one level, then while the control state machine is in the control state with a priority level reduced by one level, the control command is also stored in a corresponding field of the control state corresponding to the control command of the state machine, so that when the state machine is not in the control state with a priority level reduced by one level, the control command can be treated as a received control command and processed in steps 1)-2).
[0011] Furthermore, the control states of the state machine include at least two types of overload / overheat protection state, power conservation state, friendly power state and conventional closing and closing control state.
[0012] Furthermore, the control status priorities are from high to low: overload / overheat protection status, power conservation status, friendly power usage status, and conventional closing and closing control status.
[0013] Furthermore, the method of controlling the state machine to be in the highest priority state or in a state where the priority is reduced by one level to execute control over the electric energy meter includes: controlling the state machine to be in the highest priority state or in a state where the priority is reduced by one level, according to the control logic of the state machine in this state, combined with the current state of the state machine and the received control command, controlling the opening or closing action of the electric energy meter.
[0014] The beneficial effects of the present invention are:
[0015] The present invention utilizes the characteristic that "the output of the Mealy-type state machine is a joint function of the current state of the state machine and the input", and judges from the highest priority in the order of priority of the control state of the Mealy-type state machine, and specifically judges whether the control command corresponds to the state with the highest priority (that is, whether the control command corresponding to the state with the highest priority has appeared, which is equivalent to the trigger condition of the state with the highest priority) or the current state machine is in the state with the highest priority (that is, whether the current state is the state with the highest priority). As long as the state with the highest priority is about to be triggered or already exists, the state is maintained. Otherwise, it continues to judge whether the state with a lower priority is about to be triggered or already exists, which is equivalent to realizing the locking of the current state of the state machine. As long as the priority of the state corresponding to the received control command is not higher than the priority of the current state of the state machine, the state of the state machine will still be maintained at the current state. The control of the electric energy meter is executed in the state where the state machine was previously in; and when the state corresponding to the received control command has a higher priority than the current state of the state machine, the state of the state machine is switched to the state corresponding to the control command with a higher priority to execute the control of the electric energy meter; thereby, it can be ensured that the control of the electric energy meter is not affected by the control command with a lower priority; at the same time, as long as there is a control command that makes the priority of the state corresponding to the control command higher than the priority of the current control state of the Mealy-type state machine, the Mealy-type state machine can still respond to the control command with a higher priority of the corresponding state in real time, instead of continuing to execute the current control state, which can effectively avoid the problem of improper priority processing (especially priority confusion), that is, it can effectively avoid the problem that the current control state of the Mealy-type state machine has a lower priority but is executed first, thereby effectively improving the stability of the system.
[0016] To achieve the above object, the solution of the present invention also includes:
[0017] A state machine-based electric energy meter control system comprises a processor, in which executable program instructions are stored. The executable program instructions are used to be executed to implement the above-mentioned state machine-based electric energy meter control method.
[0018] The state machine-based electric energy meter control system of the present invention can achieve the same beneficial effects as the state machine-based electric energy meter control method described above. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 is an operation flow chart of an electric energy meter control method based on a state machine in an embodiment of the electric energy meter control method based on a state machine of the present invention;
[0020] Figure 2 It is a control flow model diagram of a Mealy-type state machine in an embodiment of an electric energy meter control method based on a state machine of the present invention;
[0021] Figure 3 It is a flowchart of the state machine-based electric energy meter control method in the embodiment of the state machine-based electric energy meter control method of the present invention. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments.
[0023] An embodiment of an electric energy meter control method based on a state machine:
[0024] like Figure 1 As shown, this embodiment provides a technical solution of a power meter control method based on a state machine (specifically, the controlled power meter is a smart power meter), which specifically includes the following steps:
[0025] 1) Determine through the state machine whether the received control command corresponds to the state with the highest priority or the current state machine is in the state with the highest priority; if so, control the state machine to be in the state with the highest priority to execute the control of the electric energy meter; if not, proceed to step 2); wherein, the state machines mentioned in this embodiment are all Mealy type state machines; the states mentioned in this embodiment all refer to the control states of the state machine;
[0026] 2) Determine through the state machine whether there is a control command corresponding to a state with a priority level reduced by one level or the current state machine is in a state with a priority level reduced by one level; if so, control the state machine to be in the state with a priority level reduced by one level to execute control of the electric energy meter; if not and the state contains more than three types, repeat step 2), and each repetition reduces the priority by one level based on the previous repetition until there is no state with a lower priority.
[0027] The output signal of the Mealy-type state machine depends not only on the current control state of the Mealy-type state machine, but also on the control command currently input to the Mealy-type state machine. Therefore, this embodiment utilizes the characteristic that "the output of the Mealy-type state machine is a joint function of the current state of the state machine and the input", and judges from the highest priority in the order of priority of the control state of the Mealy-type state machine, and specifically judges whether the control command corresponds to the state with the highest priority (that is, whether the control command corresponding to the state with the highest priority has appeared, which is equivalent to the trigger condition of the state with the highest priority) or the current state machine is in the state with the highest priority (that is, whether the current state is in the state with the highest priority). As long as the state with the highest priority is about to be triggered or already exists, the state is maintained. Otherwise, it continues to judge whether the state with a lower priority is about to be triggered or already exists, which is equivalent to realizing the locking of the current state of the state machine. As long as the priority of the state corresponding to the received control command is not higher than the priority of the current state of the state machine, the state of the state machine will still be maintained. The control of the electric energy meter is executed in the current state; when the state corresponding to the received control command has a higher priority than the current state of the state machine, the state of the state machine is switched to the state corresponding to the control command with a higher priority to execute the control of the electric energy meter; thereby, it can be ensured that the control of the electric energy meter is not affected by the control command with a lower priority; at the same time, as long as there is a control command that makes the priority of the state corresponding to the control command higher than the priority of the current control state of the Mealy-type state machine, the Mealy-type state machine can still respond immediately to the control command with a higher priority for the corresponding state, instead of continuing to execute the current control state to completion, which can effectively avoid the problem of improper priority handling (especially priority confusion), that is, it can effectively avoid the problem that the current control state of the Mealy-type state machine has a lower priority but is executed first, thereby effectively improving the stability of the system.
[0028] Specifically, the control state of the Mealy type state machine includes at least two types of overload / overheat protection state, power conservation state, friendly power state, and conventional closing and closing control state. In this embodiment, taking the Mealy type state machine including four control states as an example, the four control states are respectively four key states: overload / overheat protection state, power conservation state, friendly power state, and conventional closing and closing control state.
[0029] The priority of the control state is from high to low: overload / overheat protection state, power conservation state, friendly power state and conventional closing and pulling control state. In this embodiment, taking the Mealy type state machine including four control states as an example, the four control states are: overload / overheat protection state, power conservation state, friendly power state and conventional closing and pulling control state, four key states, then the priority of the four control states is from high to low: overload / overheat protection state, power conservation state, friendly power state and conventional closing and pulling control state. In other embodiments, the control state of the Mealy type state machine and the priority of the control state can be flexibly set according to needs.
[0030] In summary, the design idea of this solution is to build an efficient and safe control state machine based on the Mealy state machine. The output signal of this state machine depends not only on the control state of the current Mealy state machine, but also on the control command currently input to the Mealy state machine. That is, in the Mealy state machine, the output is a joint function of the state and the input. To obtain the output signal of the Mealy state machine, it is necessary to know the control state of the current Mealy state machine and the control command currently input to the Mealy state machine, such as Figure 3 Specifically, taking the case where the Mealy-type state machine includes four control states (overload / overheat protection state, power conservation state, friendly power state, and conventional closing and closing control state) as an example, the above steps 1)-2) are described in detail:
[0031] 1) Determine through the state machine whether the received control command corresponds to the state with the highest priority or the current state machine is in the state with the highest priority; if so, control the state machine to be in the state with the highest priority to execute the control of the electric energy meter; if not, proceed to step 2); the state machine is a Mealy type state machine; the state refers to the control state of the state machine;
[0032] Furthermore, in step 1), if it is determined that there is no received control command corresponding to the highest priority control state but the current state machine is in the highest priority control state, then while the control state machine is in the highest priority control state, the control command is also stored in the corresponding data field of the control state of the state machine corresponding to the control command, so that when the state machine is not in the highest priority control state, the control command can be treated as a received control command and processed in steps 1)-2).
[0033] Specifically, in this embodiment, when the control state of the Mealy-type state machine is in the state with the highest priority (i.e., the overload / overheat protection state), the output of the Mealy-type state machine (i.e., which control state the Mealy-type state machine will enter) depends on the control command currently input to the Mealy-type state machine. It is determined whether the control command currently input to the Mealy-type state machine corresponds to the state with the highest priority of the current Mealy-type state machine. If it corresponds (i.e., the control command is an overload / overheat protection control command), the Mealy-type state machine is controlled to perform control of the electric energy meter in the state with the highest priority (i.e., control other related devices to open and close the switch through the electric energy meter); if it does not correspond (i.e., the control command is a non-overload / overheat protection control command), the Mealy-type state machine is maintained in the overload / overheat protection state, and the control command currently input to the Mealy-type state machine is stored in the corresponding data field of the control state of the Mealy-type state machine corresponding to the control command. When the control command currently input to the Mealy-type state machine does not correspond to the highest priority state of the current Mealy-type state machine, the control command is stored in the corresponding data field, so that when the state machine is not in the highest priority control state (that is, all control logic in the highest priority state of the current Mealy-type state machine has been executed), the control command stored in the corresponding data field is used again as the control command input to the Mealy-type state machine to process the relevant steps.
[0034] 2) Determine through the state machine whether there is a control command corresponding to a state with a priority level lowered by one level or whether the current state machine is in a state with a priority level lowered by one level; if so, control the state machine to be in the state with a priority level lowered by one level to execute control of the electric energy meter;
[0035] In step 2), if it is determined that there is no received control command corresponding to a control state with a priority level reduced by one level, but there is a situation where the current state machine is in a control state with a priority level reduced by one level, then while the control state machine is in the control state with a priority level reduced by one level, the control command is also stored in a corresponding field of the control state corresponding to the control command of the state machine, so that when the state machine is not in the control state with a priority level reduced by one level, the control command can be treated as a received control command and processed in steps 1)-2).
[0036] Specifically, in this embodiment, when the situation in step 1) does not exist, that is, when the control state of the Mealy-type state machine is in a control state (such as a power preservation state) whose priority is one level lower than the control state with the highest priority (that is, the overload / overheating protection state) and the control command currently input to the Mealy-type state machine is not the control command corresponding to the control state with the highest priority (that is, the overload / overheating protection control command), the output of the Mealy-type state machine at this time (that is, what control state the Mealy-type state machine will enter) is the control state of the current Mealy-type state machine and the control command currently input to the Mealy-type state machine. It is determined whether the control command currently input to the Mealy-type state machine corresponds to the state where the priority of the current Mealy-type state machine is reduced by one level. If it corresponds (that is, the control command is a power-saving control command), the Mealy-type state machine is controlled to perform control on the electric energy meter in the power-saving state; if it does not correspond (that is, the control command is not a power-saving control command), the Mealy-type state machine is maintained in the power-saving state, and the control command currently input to the Mealy-type state machine is stored in the corresponding data field of the control state corresponding to the control command of the Mealy-type state machine. In the case where the control command currently input to the Mealy-type state machine does not correspond to the state where the priority of the current Mealy-type state machine is reduced by one level, the control command is stored in the corresponding data field, so that when the state machine is not in the state where the priority is reduced by one level (that is, the control logic in the state where the priority of the current Mealy-type state machine is reduced by one level is all executed), the control command stored in the corresponding data field is used as the control command input to the Mealy-type state machine again to process the relevant steps.
[0037] If it does not exist and the state contains more than three types, repeat step 2), and each repetition will reduce the priority by one level based on the previous repetition until there is no state with a lower priority.
[0038] In this embodiment, on the basis that there is no situation where the control command currently input to the Mealy-type state machine corresponds to the overload / overheating protection state or the current state machine is in the overload / overheating protection state, and the control command currently input to the Mealy-type state machine corresponds to the power conservation state or the current state machine is in the power conservation state, it is determined whether the control command currently input to the Mealy-type state machine corresponds to the friendly power usage state. If it corresponds (that is, the control command is a friendly power usage state control command), the Mealy-type state machine is controlled to perform control of the electric energy meter in the friendly power usage state; if it does not correspond (that is, the control command is not a friendly power usage control command), the Mealy-type state machine is maintained in the friendly power usage state, and the control command currently input to the Mealy-type state machine is stored in the corresponding data field of the control state of the Mealy-type state machine corresponding to the control command. When the control command currently input to the Mealy-type state machine does not correspond to the friendly power state of the current Mealy-type state machine, the control command is stored in the corresponding data domain, so that when the state machine is not in the friendly power state (that is, all the control logic in the friendly power state of the current Mealy-type state machine has been executed), the control command stored in the corresponding data domain is used again as the control command input to the Mealy-type state machine to process the relevant steps.
[0039] In this embodiment, on the basis that there is no situation that the control command currently input to the Mealy type state machine corresponds to the overload / overheat protection state or the current state machine is in the overload / overheat protection state, the control command currently input to the Mealy type state machine corresponds to the power conservation state or the current state machine is in the power conservation state, the control command currently input to the Mealy type state machine corresponds to the friendly power state or the current state machine is in the friendly power state, it is determined whether the control command currently input to the Mealy type state machine corresponds to the conventional closing and closing state. If it corresponds (that is, the control command is a conventional closing and closing control command), the Mealy type state machine is controlled to perform control of the electric energy meter in the conventional closing and closing state. Based on the above judgments of step 1) and step 2), it is impossible that the control command currently input to the Mealy type state machine is not a conventional closing and closing control command, so the relevant commands will not be stored at this time.
[0040] like Figure 2As shown in the state machine control flow model diagram, when the Mealy state machine is performing the control logic corresponding to a certain control state, if the priority of the state corresponding to a certain control command is lower than the current state of the Mealy state machine, the Mealy state machine continues to maintain the current state and stores the control command in the corresponding position, that is, the Mealy state machine is not affected by the control command of a lower level; if the priority of the state corresponding to a certain control command is higher than the current state of the Mealy state machine, the Mealy state machine will turn to execute the state corresponding to the control command, that is, the Mealy state machine will immediately respond to the control command of a higher level. Although the control logic corresponding to the control state of the current Mealy state machine has not been completed, once a higher-level control command is encountered, the Mealy state machine will immediately respond to the control command of a higher priority, instead of choosing to continue to execute the current control state. This can effectively avoid the problem of improper priority handling, that is, it can effectively avoid the problem that the current control state of the Mealy state machine has a lower priority but is executed first, thereby effectively improving the stability of the system.
[0041] The four key states (overload / overheat protection state, power conservation state, friendly power consumption state, and conventional closing and closing control state) included in the Mealy state machine are specifically designed as configurable modules, and one or more state functions are flexibly selected for adaptation according to the needs of different types of meters. The electric energy meter control method of this embodiment is designed to utilize the characteristics of the Mealy state machine, relying on a rigorous and well-organized process architecture, and accurately parse and execute the received remote control commands through strict and logically clear steps to ensure the accuracy of the operation and the safety of the system; and select control functions according to different meter types, effectively reduce the dependence between functions, improve the flexibility and maintainability of the system, reduce the degree of functional coupling, and improve the stability of the system.
[0042] The four control states are designed as dynamically optional components, aiming to flexibly integrate any combination of the above four functional states according to the unique needs of specific instrument types. At the same time, a set of logically rigorous and hierarchical command processing processes built by utilizing the characteristics of the Mealy-type state machine can accurately and stably execute remote control commands, reduce the interweaving associations between functions, enhance the modularity and decoupling characteristics of the system, avoid a series of problems caused by disordered priority order, optimize user experience, and also lay a solid foundation for the flexibility and reliability of smart grids.
[0043] Example of an electric energy meter control system based on a state machine:
[0044] This embodiment provides a technical solution for an electric energy meter control system based on a Mealy-type state machine. The system includes a processor, which is used to implement any implementation of an electric energy meter control method based on a state machine. The specific implementation of this embodiment refers to the embodiment of the electric energy meter control method based on a state machine, which will not be repeated here.
[0045] Finally, it should be noted that the above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention is described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions recorded in the aforementioned embodiments without creative work, or replace some of the technical features therein with equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for controlling an electric energy meter based on a state machine, characterized in that: The steps include: 1) Determine through the state machine whether the received control command corresponds to the state with the highest priority or the current state machine is in the state with the highest priority; if yes, control the state machine to be in the state with the highest priority to execute the control of the electric energy meter; if no, proceed to step 2); the state machine is a Mealy type state machine; the state refers to the control state of the state machine, including at least two types of overload / overheat protection state, power conservation state, friendly power state and conventional closing and closing control state; 2) Determine through the state machine whether there is a control command corresponding to a state with a lower priority by one level or the current state machine is in a state with a lower priority by one level; if so, the control state machine is in a state with a lower priority by one level to execute control of the electric energy meter; if not and the state contains more than three types, repeat step 2), and each repetition reduces the priority by one level based on the previous repetition until there is no state with a lower priority, so that when the priority of the state corresponding to the control command is lower than the state of the current state machine, the control state machine continues to maintain the current state, and when it is higher than the state of the current state machine, the control state machine switches to the state corresponding to the control command.
2. The electric energy meter control method based on the state machine according to claim 1, characterized in that: In step 1), if it is determined that there is no received control command corresponding to the control state with the highest priority but the current state machine is in the control state with the highest priority, then while the control state machine is in the control state with the highest priority, the control command is also stored in the corresponding field of the control state of the state machine corresponding to the control command, so that when the state machine is not in the control state with the highest priority, the control command can be treated as a received control command and processed in steps 1)-2).
3. The electric energy meter control method based on a state machine according to claim 1 or 2, characterized in that: In step 2), if it is determined that there is no received control command corresponding to a control state with a priority level reduced by one level, but there is a situation where the current state machine is in a control state with a priority level reduced by one level, then while the control state machine is in the control state with a priority level reduced by one level, the control command is also stored in a corresponding field of the control state corresponding to the control command of the state machine, so that when the state machine is not in the control state with a priority level reduced by one level, the control command can be treated as a received control command and processed in steps 1)-2).
4. The electric energy meter control method based on a state machine according to claim 1, characterized in that: The control status priorities from high to low are: overload / overheat protection status, power conservation status, friendly power usage status, and conventional closing and closing control status.
5. The electric energy meter control method based on a state machine according to claim 1, characterized in that: The method of controlling the electric energy meter when the control state machine is in the highest priority state or in a state where the priority is reduced by one level includes: when the control state machine is in the highest priority state or in a state where the priority is reduced by one level, according to the control logic of the state machine in this state, combined with the current state of the state machine and the received control command, controlling the opening or closing action of the electric energy meter.
6. An electric energy meter control system based on a state machine, characterized in that: It includes a processor, in which executable program instructions are stored, and the executable program instructions are used to be executed to implement the state machine-based electric energy meter control method as described in any one of claims 1-5.
Citation Information
Patent Citations
Method for controlling relay according to priority of control object
CN108962675A
Verification method and device for case physical lamp
CN110633179A
Command execution method and device, communication equipment and readable storage medium
CN117749886A