Demand value processing method based on real-time power direction change and smart electric energy meter
Patent Information
- Application Number
- CN202610719964.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-25
- Publication Date
- 2026-08-18
AI Technical Summary
[0005]异常事件处理混乱:发生校时时,若直接清零或延续计数,会产生不完整周期的无效需量数据,影响计量准确性
[0018] Other features and advantages of the invention will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description and the accompanying drawings.
Smart Images

Figure CN122592030A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of smart grid electrical measurement technology, and in particular to a demand value processing method based on real-time power direction changes and a smart energy meter. Background Technology
[0002] Current smart energy meters primarily measure demand according to enterprise standards such as Q / GDW 10354-2020, typically using the calculation method of "electrical energy divided by effective power duration". However, the newly released national standard GB / T 17215.241-2025 explicitly requires that demand calculation should use the "total electrical energy within a cycle divided by the complete cycle duration (e.g., 15 minutes)" method, and dynamic current application testing must be performed at the beginning and end of the cycle. Existing technology has the following shortcomings: Standard incompatibility: The old calculation logic conflicts with the new national standard, resulting in inconsistent demand values under the same load, which leads to disputes in trade settlement.
[0003] Directional misjudgment: When there is photovoltaic backfeeding or impulsive load in the power grid, the power direction is prone to short-term fluctuations (less than 1 minute). Traditional meters do not have anti-vibration mechanisms and may misjudge this as a power flow reversal, leading to jumps in demand values.
[0004] Data coupling: Multiple directions of demand share the same cache, and there is mutual interference between forward and reverse, and between reactive power in different quadrants. The maximum demand is easily overwritten by errors.
[0005] Disorganized handling of abnormal events: When time synchronization occurs, directly resetting to zero or continuing the count will generate invalid demand data for incomplete cycles, affecting measurement accuracy.
[0006] Therefore, the present invention provides a demand value processing method based on real-time power direction changes and a smart energy meter. Summary of the Invention
[0007] This invention is based on a demand value processing method for real-time power direction changes and a smart energy meter, ensuring metering compliance, data independence, and strong anti-interference capabilities.
[0008] This invention provides a demand value processing method based on real-time power direction changes and a smart energy meter, including: The cycle timing control module is used to set a fixed demand accumulation cycle and slip interval, start demand measurement from the next whole minute of the current time, obtain the complete demand cycle and record the corresponding maximum demand value; A multi-dimensional independent cache module is used to divide the microcontroller unit (MCU) into several independent directional cache spaces, determine the direction corresponding to each demand cycle, and allocate a corresponding directional cache space for each demand cycle. The power direction discrimination module is used to monitor the duration of power flow direction changes in real time. When the duration of the change is less than 1 minute, the original demand output is maintained; otherwise, the demand output is switched to the new direction to obtain the current demand value for each direction. The invalid data masking module is used to identify and terminate the current unfinished demand cycle and the corresponding unfinished demand when the current demand value is greater than the maximum demand value, and to optimize the current demand value using the unfinished demand.
[0009] One feasible approach includes: The directional buffer space consists of six parts: forward active power buffer space, reverse active power buffer space, first quadrant reactive power demand buffer space, second quadrant reactive power demand buffer space, third quadrant reactive power demand buffer space, and fourth quadrant reactive power demand buffer space.
[0010] In one implementable manner, the periodic timing control module includes: The cycle setting unit is used to set the demand accumulation cycle to 15 minutes, 30 minutes or 60 minutes, set the slip interval to 1 minute, and force the 00:00 time of each day to be the end node of a complete demand cycle. The starting point calibration unit is used to freeze the current system time when a voltage power-on event, zeroing event, time period transition event, or demand cycle change event is detected, and lock the next whole minute closest to the current time as the metering starting point; The timing execution unit is used to drive the internal hardware timer to count down from the metering start point. When the counting duration reaches the fixed demand accumulation cycle, the demand calculation interrupt is triggered and the cycle is marked as a valid cycle. The recording control unit is used to write the obtained demand value into the maximum demand register within the valid period marked by the timing execution unit. After power-on initialization, the demand reading port is closed until the system time elapses beyond the sum of a complete demand accumulation cycle and a slip interval, at which point the reading port is reopened.
[0011] In one implementable manner, the multi-dimensional independent caching module includes: The mapping and binding unit is used to establish a one-to-one mapping relationship between the power direction identifier and the direction cache space. When the active power is detected to be positive in real time, the positive active power cache is bound, and when the active power is negative, the reverse active power cache is bound. The corresponding reactive quadrant cache is bound according to the polarity and phase relationship of the reactive power. The accumulation calculation unit is used to read the power pulse count value in the corresponding cache block at the end of each complete demand cycle, obtain the standardized demand result, compare the current demand value with the historical maximum demand value stored in the corresponding cache block, and send a rewrite instruction to the flash memory controller to update the maximum demand record if the current value is greater than the historical value.
[0012] In one implementable embodiment, the power direction determination module includes: The sampling and monitoring unit is used to perform a digital multiplication operation on the voltage sampling signal and the current sampling signal once per second to obtain the sign bit of the instantaneous active power corresponding to each second, and continuously monitor the high and low level status corresponding to each sign bit. The timing accumulation unit is used to set the time window counter to 1 minute. When the power sign bit flips, it controls the time window counter to enter the counting operation. If the sign bit is reset to zero during the counting operation, the counter will continue to accumulate if the sign bit continues to maintain the new state. The direction locking unit is used to logically compare the real-time value of the time window counter with the judgment threshold, output a Boolean judgment result, and when the judgment result is false, eliminate the current power sign bit change, maintain the original direction identifier latched in the previous whole minute, and judge the Boolean judgment result as an instantaneous disturbance. The direction refresh unit is used to confirm the power flow reversal when the determination result is true, update the direction identifier to the direction corresponding to the new power symbol when the next whole minute arrives, and simultaneously switch the demand output channel.
[0013] One feasible approach also includes: If the count is less than 60 seconds, the result is determined to be false. When the count is greater than or equal to 60 seconds, the result is determined to be true.
[0014] In one implementable manner, the invalid data masking module includes: The numerical comparison unit is used to compare the real-time acquired current demand value with the stored maximum demand value and record the comparison result; The event parsing unit is used to obtain real-time monitoring communication messages when the comparison result is abnormal, parse the clock adjustment instructions sent to the microcontroller unit (MCU), and extract the target timestamp contained in the instructions. The reset and cleanup unit is used to control the multi-dimensional independent cache module to forcibly clear the number of power pulses and intermediate variables that are being accumulated in all six cache blocks according to the clock adjustment instruction, and terminate the current unfinished demand cycle; The scheduling unit is restarted to read the target timestamp in the clock adjustment instruction, calculate the next whole minute closest to the target time, set this time point as the new metering start point, and restart the demand measurement process. The data optimization unit is used to shield demand data from the old cycle during the slippage window when the time synchronization action occurs, and to perform data optimization using the complete demand data in the new cycle after the time synchronization is completed.
[0015] One feasible approach also includes: Temperature data acquisition module, the temperature data acquisition module includes: The sensing unit is used to collect real-time temperature change signals from the microcontroller unit (MCU). The data conversion unit is used to convert the real-time temperature change signal into 16-bit signed long integer data. The storage reporting unit is used to write the converted temperature data to the corresponding storage address for storage.
[0016] In one implementable manner, the accumulation calculation unit includes: The power reading subunit is used to read the power pulse register in the corresponding direction buffer space at the end of the cycle to obtain the power value at the beginning of the cycle and the power value at the end of the cycle. The numerical calculation subunit is used to determine the cumulative energy increment corresponding to each cycle based on the energy value at the end of the cycle and the energy value at the beginning of the cycle, and to obtain the original demand value by combining the fixed demand accumulation cycle duration. The unit conversion subunit is used to multiply the original demand value by a preset multiplier coefficient, convert it into a demand value under a standard unit of measurement, and output it to the display buffer.
[0017] The beneficial effects achievable by this invention are as follows: To achieve unified demand measurement timing, independent data, accurate direction determination, and closed-loop anomaly handling, significantly improving measurement accuracy, anti-interference capability, and compliance, and effectively avoiding data crosstalk, jumps, and settlement disputes, a fixed demand accumulation period and slip interval are first set. The starting points for power-on, zeroing, time period conversion, and demand period change are uniformly aligned to the next whole minute of the current moment. This drives the hardware timer to complete the full cycle timing and record the maximum demand value within the valid period. Simultaneously, the read port is delayed after power-on, thereby achieving demand period standardization and precise timing, ensuring a unified measurement starting point and clear valid period boundaries, fully complying with national standards and State Grid requirements, and improving data consistency and reliability. Then, the microcontroller unit (MCU) is used... The system internally divides the system into several independent directional buffer spaces. Based on the power direction, a corresponding buffer is allocated for each demand cycle, and a one-to-one mapping relationship is established. This allows each direction of demand to independently complete energy accumulation, demand calculation, and maximum demand update without interference or crosstalk. This achieves decoupled metering of forward active power, reverse active power, and four-quadrant reactive power demand, improving data accuracy, traceability, and adaptability to complex operating conditions. Furthermore, it monitors the duration of power flow direction changes in real time, using a 1-minute threshold. If the change duration is less than 1 minute, the original directional demand output is maintained; if it is greater than or equal to 1 minute, the output is switched to the new directional demand. This is achieved by filtering out transient... By mitigating time fluctuations and locking in the true power flow reversal state, the system avoids demand value jumps and misjudgments, improving metering stability and anti-interference capabilities. This makes the output results more closely match the actual power load status. Finally, when the current demand value exceeds the maximum demand value, the system identifies clock adjustment events in real time, immediately terminates the current incomplete demand cycle and clears the corresponding intermediate data, and optimizes the current demand value using the incomplete demand. Metering is then restarted from the next whole minute after time calibration. This process shields invalid data from abnormal cycles and prevents invalid values from polluting the maximum demand record, forming a complete exception handling logic that improves system robustness and metering reliability.
[0018] Other features and advantages of the invention will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description and the accompanying drawings.
[0019] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0020] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used together with the embodiments of the invention to explain the invention and do not constitute a limitation thereof. The drawings show... Figure 1This is a schematic diagram of the demand value processing method based on real-time power direction change and the composition of the smart energy meter in an embodiment of the present invention. Figure 2 This is a schematic diagram illustrating the demand value processing method based on real-time power direction changes and the composition of the power direction discrimination module in a smart energy meter, as described in this embodiment of the invention. Detailed Implementation
[0021] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.
[0022] Example 1 illustrates that this embodiment provides a demand value processing method based on real-time power direction changes and a smart energy meter, such as... Figure 1 As shown, it includes: The cycle timing control module is used to set a fixed demand accumulation cycle and slip interval, start demand measurement from the next whole minute of the current time, obtain the complete demand cycle and record the corresponding maximum demand value; A multi-dimensional independent cache module is used to divide the microcontroller unit (MCU) into several independent directional cache spaces, determine the direction corresponding to each demand cycle, and allocate a corresponding directional cache space for each demand cycle. The power direction discrimination module is used to monitor the duration of power flow direction changes in real time. When the duration of the change is less than 1 minute, the original demand output is maintained; otherwise, the demand output is switched to the new direction to obtain the current demand value for each direction. The invalid data masking module is used to identify and terminate the current unfinished demand cycle and the corresponding unfinished demand when the current demand value is greater than the maximum demand value, and to optimize the current demand value using the unfinished demand.
[0023] In this example, the fixed demand integration period represents the fixed-duration energy integration interval set according to the national standard, including 15 minutes / 30 minutes and 60 minutes, with the period duration remaining unchanged.
[0024] In this example, the slip interval represents the time interval between two consecutive demand value updates, typically set to 1 minute, to achieve slip metering of demand. In this example, demand measurement refers to the measurement of the average power over a fixed period, calculated by dividing the cumulative energy within the period by the fixed period duration.
[0025] In this example, the maximum demand value represents the maximum demand in the same direction recorded during historical metering and is updated only within a complete cycle.
[0026] In this example, the microcontroller unit (MCU) represents the core processor inside the electricity meter used for data processing, logic control, and cache management.
[0027] In this example, the directional buffer space represents an independent storage area allocated within the MCU, used to store the energy data and demand data for positive active power, negative active power, and reactive power in the four quadrants, respectively.
[0028] In this example, the demand period represents a demand measurement interval that starts from the metering start point and ends after a complete fixed duration.
[0029] In this example, the change in power flow direction indicates a change in the direction, polarity, and quadrant of active or reactive power.
[0030] In this example, an incomplete demand cycle refers to a demand cycle that terminates prematurely before reaching its fixed duration due to interruptions caused by events such as power-on, time synchronization, or zeroing.
[0031] In this example, unfulfilled demand refers to intermediate demand values that are not valid and are generated within the unfulfilled demand period.
[0032] The working principle and beneficial effects of the above technical solution are as follows: To achieve unified demand measurement timing, independent data, accurate direction determination, and closed-loop anomaly handling, significantly improving measurement accuracy, anti-interference capability, and compliance, and effectively avoiding data crosstalk, jumps, and settlement disputes, a fixed demand accumulation cycle and slip interval are first set. The starting points for power-on, zeroing, time period conversion, and demand cycle changes are uniformly aligned to the next whole minute of the current moment. This drives the hardware timer to complete the full cycle timing and record the maximum demand value within the valid cycle. Simultaneously, the read port is delayed after power-on, thereby achieving demand cycle standardization and precise timing, ensuring a unified measurement starting point and clear valid cycle boundaries, fully complying with national standards and State Grid requirements, and improving data consistency and reliability. Then, the microcontroller unit (MCU) is used... The system internally divides the system into several independent directional buffer spaces. Based on the power direction, a corresponding buffer is allocated for each demand cycle, and a one-to-one mapping relationship is established. This allows each direction of demand to independently complete energy accumulation, demand calculation, and maximum demand update without interference or crosstalk. This achieves decoupled metering of forward active power, reverse active power, and four-quadrant reactive power demand, improving data accuracy, traceability, and adaptability to complex operating conditions. Furthermore, it monitors the duration of power flow direction changes in real time, using a 1-minute threshold. If the change duration is less than 1 minute, the original directional demand output is maintained; if it is greater than or equal to 1 minute, the output is switched to the new directional demand. This is achieved by filtering out transient... By mitigating time fluctuations and locking in the true power flow reversal state, the system avoids demand value jumps and misjudgments, improving metering stability and anti-interference capabilities. This makes the output results more closely match the actual power load status. Finally, when the current demand value exceeds the maximum demand value, the system identifies clock adjustment events in real time, immediately terminates the current incomplete demand cycle and clears the corresponding intermediate data, and optimizes the current demand value using the incomplete demand. Metering is then restarted from the next whole minute after time calibration. This process shields invalid data from abnormal cycles and prevents invalid values from polluting the maximum demand record, forming a complete exception handling logic that improves system robustness and metering reliability.
[0033] Example 2: Based on Example 1, the demand value processing method and smart energy meter based on real-time power direction changes include: The directional buffer space consists of six parts: forward active power buffer space, reverse active power buffer space, first quadrant reactive power demand buffer space, second quadrant reactive power demand buffer space, third quadrant reactive power demand buffer space, and fourth quadrant reactive power demand buffer space.
[0034] In this example, the forward active energy cache space represents a dedicated storage area for storing, calculating, and updating forward active energy and demand data.
[0035] In this example, the reverse active energy cache space represents a dedicated storage area for storing, calculating, and updating reverse active energy and demand data.
[0036] In this example, the reactive demand buffer space in the first quadrant represents a dedicated storage area for storing, calculating, and updating reactive energy and demand data in the first quadrant.
[0037] In this example, the second quadrant reactive demand cache space represents a dedicated storage area for storing, calculating, and updating reactive energy and demand data in the second quadrant.
[0038] In this example, the third quadrant reactive demand buffer space represents a dedicated storage area for storing, calculating, and updating reactive energy and demand data in the third quadrant.
[0039] In this example, the fourth quadrant reactive demand buffer space represents a dedicated storage area for storing, calculating, and updating reactive energy and demand data in the fourth quadrant.
[0040] The working principle and beneficial effects of the above technical solution are as follows: Six independent and physically isolated directional cache spaces are set up within the MCU of the electricity meter. These spaces are dedicated to storing and independently calculating the reactive power demand in the forward, reverse, first quadrant, second quadrant, third quadrant, and fourth quadrant. Each cache space only processes the energy accumulation, demand calculation, and maximum demand update for its corresponding direction. They do not access, interfere with, or crosstalk with each other, achieving complete decoupling of multi-directional demand metering from the bottom layer. This ensures that each type of demand data is independent, accurate, and unaffected by other directions, significantly improving metering accuracy, data stability, and traceability, and fully meeting the national standards and State Grid's requirements for multi-quadrant and multi-directional demand metering.
[0041] Example 3: Based on Example 1, the demand value processing method based on real-time power direction change and the smart energy meter, the periodic timing control module includes: The cycle setting unit is used to set the demand accumulation cycle to 15 minutes, 30 minutes or 60 minutes, set the slip interval to 1 minute, and force the 00:00 time of each day to be the end node of a complete demand cycle. The starting point calibration unit is used to freeze the current system time when a voltage power-on event, zeroing event, time period transition event, or demand cycle change event is detected, and lock the next whole minute closest to the current time as the metering starting point; The timing execution unit is used to drive the internal hardware timer to count down from the metering start point. When the counting duration reaches the fixed demand accumulation cycle, the demand calculation interrupt is triggered and the cycle is marked as a valid cycle. The recording control unit is used to write the obtained demand value into the maximum demand register within the valid period marked by the timing execution unit. After power-on initialization, the demand reading port is closed until the system time elapses beyond the sum of a complete demand accumulation cycle and a slip interval, at which point the reading port is reopened.
[0042] In this example, the end node represents a fixed time point at 00:00 each day when a complete demand cycle must be completed and the current cycle measurement must be terminated.
[0043] In this example, the voltage power-on event refers to the event in which the electricity meter is reconnected to the operating voltage and returns to normal operation from the power-off state.
[0044] In this example, the zeroing event represents an event in which the electricity meter performs a zeroing operation on the demand data or metering data.
[0045] In this example, the time period transition event indicates that the electricity meter switches to a new metering period according to the preset time period scheme.
[0046] In this example, the demand cycle change event indicates that the demand accumulation cycle duration of the electricity meter has been reconfigured or modified.
[0047] In this example, freezing the current system time means pausing the use of the current real-time time and temporarily storing the time information in order to calculate the starting point of the next whole minute.
[0048] In this example, the effective period refers to the demand metering period that starts from a whole minute, lasts for the entire set duration, and is not terminated prematurely.
[0049] In this example, the read port represents the communication channel through which the electricity meter outputs demand data and allows external devices to read the data.
[0050] The working principle and beneficial effects of the above technical solution are as follows: To achieve standardized demand measurement timing, unified starting point, and effective cycle, thereby improving the consistency, stability, and reliability of measurement data, and meeting the requirements of national standards and relevant State Grid specifications, the demand accumulation cycle is first set to a fixed duration of 15 minutes, 30 minutes, or 60 minutes. The slip interval is set to 1 minute, and 00:00 every day is forcibly set as the end time of a complete demand cycle, keeping all cycle durations consistent and achieving standardized measurement cycle parameters. This avoids measurement deviations caused by chaotic cycle configurations. Then, when voltage power-on, zeroing, time period transition, or demand cycle change is detected, the current system time is frozen, and the next nearest whole minute is selected as the measurement starting point, ensuring that each... Both exceptions and startup events are measured at a unified time to eliminate the incomplete cycle problem caused by random starting points and ensure that the measurement starting point is standardized and uniform. Furthermore, starting from the determined measurement starting point, the hardware timer is controlled to count down. After reaching the set demand accumulation cycle, the calculation interrupt is triggered and the cycle is marked as a valid cycle. This ensures that only cycles of complete duration can participate in subsequent calculations, guaranteeing the validity of the cycle and the accuracy of the calculation from the timing perspective. Finally, the demand value is written to the maximum demand register within the valid cycle. After power-on initialization, the demand reading port is closed. The port is reopened after the system time has elapsed for the sum of a complete demand cycle and a slip interval. This avoids the reading of unstable data in the early stage of power-on and ensures that the output data comes from a complete valid cycle, thereby improving data reliability.
[0051] Example 4: Based on Example 1, the demand value processing method and smart energy meter based on real-time power direction changes, the multi-dimensional independent cache module includes: The mapping and binding unit is used to establish a one-to-one mapping relationship between the power direction identifier and the direction cache space. When the active power is detected to be positive in real time, the positive active power cache is bound, and when the active power is negative, the reverse active power cache is bound. The corresponding reactive quadrant cache is bound according to the polarity and phase relationship of the reactive power. The accumulation calculation unit is used to read the power pulse count value in the corresponding cache block at the end of each complete demand cycle, obtain the standardized demand result, compare the current demand value with the historical maximum demand value stored in the corresponding cache block, and send a rewrite instruction to the flash memory controller to update the maximum demand record if the current value is greater than the historical value.
[0052] In this example, the power direction indicator is a marking signal used to distinguish between the positive and negative directions of active power and the quadrant of reactive power.
[0053] In this example, a positive active power indicates that electrical energy is being transmitted from the grid side to the user side.
[0054] In this example, the polarity and phase relationship of reactive power represent the inductive and capacitive properties of reactive power and their phase correspondence with voltage and current.
[0055] In this example, the positive active energy cache refers to a dedicated cache space for storing positive active energy and demand data.
[0056] In this example, the reverse active energy cache refers to a dedicated cache space for storing reverse active energy and demand data.
[0057] In this example, the reactive quadrant cache represents a dedicated cache space for storing reactive energy and demand data for the corresponding quadrant.
[0058] In this example, the energy pulse count value represents the number of energy pulses collected by the energy meter within the metering cycle, which is used to reflect the cumulative amount of energy.
[0059] In this example, the maximum demand record represents the maximum demand value in the same direction that is recorded and stored in the historical period.
[0060] The working principle and beneficial effects of the above technical solution are as follows: In order to achieve independent storage, independent calculation and independent updating of demand data in different directions, avoid mutual data interference, and improve metering accuracy, data stability and traceability, power direction information is first collected in real time, and a fixed correspondence is established between power direction identifiers and cache spaces in each independent direction. When active power is detected to be positive, a positive active power cache is bound; when active power is detected to be negative, a reverse active power cache is bound. The corresponding reactive power quadrant cache is matched according to the polarity and phase relationship of reactive power, ensuring that the energy and demand data of each type of direction only enter the dedicated cache area, achieving accurate matching between direction and cache, and avoiding crosstalk at the data entry point. Then, at the end of each complete demand cycle, the energy pulse count value in the corresponding cache block is read, and a standardized demand result is obtained through calculation. The current demand value is compared with the historical maximum demand value stored in the cache. When the current value is greater than the historical value, an erase / write and update command is sent to the flash memory controller to refresh the maximum demand record. This ensures that the calculation and update of each type of demand are completed independently, without being affected by data from other directions, thereby improving the accuracy of demand calculation and the reliability of the maximum demand record.
[0061] Example 5: Based on Example 1, the demand value processing method and smart energy meter based on real-time power direction changes, the power direction discrimination module, such as... Figure 2 As shown, it includes: The sampling and monitoring unit is used to perform a digital multiplication operation on the voltage sampling signal and the current sampling signal once per second to obtain the sign bit of the instantaneous active power corresponding to each second, and continuously monitor the high and low level status corresponding to each sign bit. The timing accumulation unit is used to set the time window counter to 1 minute. When the power sign bit flips, it controls the time window counter to enter the counting operation. If the sign bit is reset to zero during the counting operation, the counter will continue to accumulate if the sign bit continues to maintain the new state. The direction locking unit is used to logically compare the real-time value of the time window counter with the judgment threshold, output a Boolean judgment result, and when the judgment result is false, eliminate the current power sign bit change, maintain the original direction identifier latched in the previous whole minute, and judge the Boolean judgment result as an instantaneous disturbance. The direction refresh unit is used to confirm the power flow reversal when the determination result is true, update the direction identifier to the direction corresponding to the new power symbol when the next whole minute arrives, and simultaneously switch the demand output channel.
[0062] In this example, the time window counter represents a 1-minute timing tool used to count the duration of power direction change.
[0063] In this example, the voltage sampling signal represents the signal obtained by the electricity meter from the analog line voltage after digital conversion.
[0064] In this example, the current sampling signal represents the signal obtained by the electricity meter from the analog quantity of the line current after digital conversion.
[0065] In this example, digital multiplication operation represents the process of multiplying the digitized voltage signal and the current signal to obtain instantaneous power data.
[0066] In this example, the sign bit of the instantaneous active power represents the numerical bit used to indicate whether the direction of the active power is positive or negative.
[0067] In this example, the high and low level states represent the high or low level state of the digital signal corresponding to the sign bit.
[0068] In this example, the judgment threshold represents the time critical value used to distinguish between instantaneous disturbances and power flow reversals; in this example, it is 1 minute.
[0069] In this example, the Boolean decision result represents a logical judgment result with only two states: true or false.
[0070] In this example, the transient disturbance represents a short-term change in power direction followed by a rapid recovery, and does not represent a fluctuation phenomenon in the actual power flow.
[0071] In this example, power flow reversal means that the power direction continues to change and reaches the judgment threshold, which represents a real switch in the actual power consumption direction.
[0072] The working principle and beneficial effects of the above technical solution are as follows: In order to provide real-time and stable basic data for direction change judgment and ensure the real-time performance and accuracy of direction recognition, the time window counter is first set to 1 minute. When the power sign bit flip is detected, counting is started. If the sign bit returns to its original state during the counting process, the counter is cleared. If the sign bit maintains the new state, the counting continues to accumulate. The timing logic distinguishes between short-term fluctuations and continuous changes, providing a reliable time basis for subsequent direction judgment. Then, the real-time value of the time window counter is logically compared with the judgment threshold and a Boolean judgment result is output. When the result is false, it is judged as an instantaneous disturbance, the sign bit change is eliminated and the original direction identifier is maintained, avoiding misjudgment of direction due to short-term interference and maintaining continuous and stable demand output. Finally, when the Boolean judgment result is true, the power flow reversal is confirmed. At the next whole minute, the direction identifier is updated to the direction corresponding to the new power sign, and the demand output channel is switched synchronously to keep the direction switching and the metering cycle timing synchronized, ensuring the consistency of demand calculation and output.
[0073] Example 6: Based on Example 5, the demand value processing method and smart energy meter based on real-time power direction changes further include: If the count is less than 60 seconds, the result is determined to be false. When the count is greater than or equal to 60 seconds, the result is determined to be true.
[0074] Example 7: Based on Example 1, the demand value processing method based on real-time power direction change and the smart energy meter, the invalid data shielding module includes: The numerical comparison unit is used to compare the real-time acquired current demand value with the stored maximum demand value and record the comparison result; The event parsing unit is used to obtain real-time monitoring communication messages when the comparison result is abnormal, parse the clock adjustment instructions sent to the microcontroller unit (MCU), and extract the target timestamp contained in the instructions. The reset and cleanup unit is used to control the multi-dimensional independent cache module to forcibly clear the number of power pulses and intermediate variables that are being accumulated in all six cache blocks according to the clock adjustment instruction, and terminate the current unfinished demand cycle; The scheduling unit is restarted to read the target timestamp in the clock adjustment instruction, calculate the next whole minute closest to the target time, set this time point as the new metering start point, and restart the demand measurement process. The data optimization unit is used to shield demand data from the old cycle during the slippage window when the time synchronization action occurs, and to perform data optimization using the complete demand data in the new cycle after the time synchronization is completed.
[0075] In this example, the current demand value represents the real-time demand value calculated within the current demand period.
[0076] In this example, an abnormal comparison result indicates that the comparison between the current demand value and the maximum demand value does not conform to normal measurement logic, and the cause of the event needs to be further investigated.
[0077] In this example, the real-time monitoring communication message represents the real-time data frames and control information exchanged between the electricity meter and external devices.
[0078] In this example, the clock adjustment command represents a control command issued by an external device to the electricity meter to modify the system time.
[0079] In this example, the target timestamp represents the target time information that needs to be set, carried in the clock adjustment instruction.
[0080] In this example, the number of energy pulses represents the cumulative number of energy pulses collected by the energy meter during the metering process, which is used to reflect the amount of energy consumed.
[0081] In this example, the intermediate variables represent temporary computational data used in the demand calculation process and do not form a final valid result.
[0082] The working principle and beneficial effects of the above technical solution are as follows: In order to completely eliminate invalid metering data caused by clock adjustments, avoid abnormal values affecting the maximum demand calculation results, ensure the authenticity and validity of demand metering throughout the entire process, and improve the reliability and consistency of metering results, the current demand value acquired in real time is first compared with the stored maximum demand value and the result is recorded. This is used to identify whether there are abnormal fluctuations in the data, providing a trigger basis for subsequent event analysis and anomaly handling, ensuring that anomalies can be detected in a timely manner. Then, when the comparison result is abnormal, a real-time monitoring communication message is acquired, parsed, and sent to the MCU. The system receives clock adjustment commands and extracts the target timestamp, accurately identifying external time synchronization operations. This provides an accurate time reference and triggering conditions for subsequent reset and restart processes. Furthermore, based on the clock adjustment commands, it controls the multi-dimensional independent cache modules to forcibly clear the accumulated energy pulse count and intermediate variables in the six cache blocks. Simultaneously, it terminates the current incomplete demand cycle, eliminating invalid data at its source and preventing abnormal data from participating in subsequent calculations. Then, it reads the target timestamp, calculates the next nearest whole minute, and sets it as the new metering starting point, restarting the demand measurement process. This restores the metering sequence to standard specifications, ensuring cycle integrity and starting point consistency. Finally, during the slippage window of the time synchronization operation, it masks the demand data of the old cycle. After time synchronization is completed, it uses the complete demand data from the new cycle for data optimization, ensuring that the output demand values all come from valid cycles, thus improving the quality and reliability of the final metering data.
[0083] Example 8: Based on Example 1, the demand value processing method and smart energy meter based on real-time power direction changes further include: Temperature data acquisition module, the temperature data acquisition module includes: The sensing unit is used to collect real-time temperature change signals from the microcontroller unit (MCU). The data conversion unit is used to convert the real-time temperature change signal into 16-bit signed long integer data. The storage reporting unit is used to write the converted temperature data to the corresponding storage address for storage.
[0084] In this example, the real-time temperature change signal represents an electrical signal used to reflect the current temperature and temperature fluctuation of the microcontroller unit (MCU).
[0085] In this example, the 16-bit signed long integer data representation is a standard data format that consists of 16-bit binary numbers and can contain positive and negative values, suitable for the transmission and storage of temperature data.
[0086] In this example, the storage address represents a dedicated storage location allocated inside the electricity meter for temperature data, used to store the temperature data and support system reading and retrieval.
[0087] The working principle and beneficial effects of the above technical solution are as follows: In order to provide reliable data support for meter measurement error temperature drift compensation, operation status diagnosis, and fault early warning, and to improve the metering stability and operational reliability of the electricity meter under different ambient temperatures, the real-time temperature change signal of the microcontroller unit (MCU) is first directly collected to continuously sense the temperature changes in the environment in which the MCU is located, providing raw temperature information for subsequent data processing and ensuring the real-time and accurate nature of temperature monitoring. Then, the collected analog or discrete real-time temperature change signal is uniformly converted into 16-bit signed long integer data, so that the temperature data meets the communication protocol and data processing format requirements, improving the universality, standardization, and transmission stability of the data. Finally, the converted temperature data is written to the corresponding storage address for storage, so that the temperature data can be called, queried, or remotely read by the system, realizing traceable management of temperature data and providing long-term and effective data basis for equipment status monitoring.
[0088] Example 9: Based on Example 4, the demand value processing method and smart energy meter based on real-time power direction changes, the accumulation calculation unit includes: The power reading subunit is used to read the power pulse register in the corresponding direction buffer space at the end of the cycle to obtain the power value at the beginning of the cycle and the power value at the end of the cycle. The numerical calculation subunit is used to determine the cumulative energy increment corresponding to each cycle based on the energy value at the end of the cycle and the energy value at the beginning of the cycle, and to obtain the original demand value by combining the fixed demand accumulation cycle duration. The unit conversion subunit is used to multiply the original demand value by a preset multiplier coefficient, convert it into a demand value under a standard unit of measurement, and output it to the display buffer.
[0089] In this example, the cycle start energy value represents the energy data recorded in the energy pulse register at the beginning of the demand metering cycle.
[0090] In this example, the energy value at the end of the cycle represents the energy data recorded in the energy pulse register at the end of the demand metering cycle.
[0091] In this example, the cumulative energy increment represents the difference between the energy value at the end of the cycle and the energy value at the beginning of the cycle, reflecting the total amount of energy consumed or generated in the current cycle.
[0092] In this example, the raw demand value represents the initial demand data calculated directly from the increase in electricity and the cycle duration, without undergoing rate conversion.
[0093] In this example, the preset multiplier factor represents the fixed conversion factor built into the electricity meter, which is used to convert the original demand value into the standard unit of measurement value actually used.
[0094] The working principle and beneficial effects of the above technical solution are as follows: In order to achieve standardized and accurate calculation of demand in all directions, ensure that the demand value calculation process is independent, the results are accurate, and the measurement units are unified, and effectively improve the measurement accuracy and data readability, firstly, at the end of each demand cycle, the energy pulse register inside the corresponding direction buffer space is read to obtain the energy data at the beginning and end of the cycle, respectively, to provide accurate raw data for subsequent energy increment calculation, ensuring the integrity and reliability of the measurement start and end data. Then, the cumulative energy increment in the current cycle is obtained by subtracting the energy value at the beginning of the cycle from the energy value at the end of the cycle. The cumulative energy increment is then divided by the fixed demand accumulation cycle duration to obtain the original demand value. The core demand calculation is completed strictly in accordance with the national standard energy method to ensure that the calculation logic is compliant and the results are accurate. Finally, the original demand value is multiplied by a preset multiplier coefficient to convert the calculation result into a demand value under the standard measurement unit that meets the actual use requirements, and the final data is output to the display buffer area so that the demand value meets the format requirements for on-site reading, display and remote reporting.
[0095] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A method for processing of demand values based on real-time power direction changes and a smart meter, characterized in that, include: The cycle timing control module is used to set a fixed demand accumulation cycle and slip interval, start demand measurement from the next whole minute of the current time, obtain the complete demand cycle and record the corresponding maximum demand value; A multi-dimensional independent cache module is used to divide the microcontroller unit (MCU) into several independent directional cache spaces, determine the direction corresponding to each demand cycle, and allocate a corresponding directional cache space for each demand cycle. The power direction discrimination module is used to monitor the duration of power flow direction changes in real time. When the duration of the change is less than 1 minute, the original demand output is maintained; otherwise, the demand output is switched to the new direction to obtain the current demand value for each direction. The invalid data masking module is used to identify and terminate the current unfinished demand cycle and the corresponding unfinished demand when the current demand value is greater than the maximum demand value, and to optimize the current demand value using the unfinished demand.
2. The method and smart meter for processing demand value based on real-time power direction change according to claim 1, wherein, include: The directional buffer space consists of six parts: forward active power buffer space, reverse active power buffer space, first quadrant reactive power demand buffer space, second quadrant reactive power demand buffer space, third quadrant reactive power demand buffer space, and fourth quadrant reactive power demand buffer space.
3. The demand value processing method based on real-time power direction change and the smart energy meter as described in claim 1, characterized in that, The periodic timing control module includes: The cycle setting unit is used to set the demand accumulation cycle to 15 minutes, 30 minutes or 60 minutes, set the slip interval to 1 minute, and force the 00:00 time of each day to be the end node of a complete demand cycle. The starting point calibration unit is used to freeze the current system time when a voltage power-on event, zeroing event, time period transition event, or demand cycle change event is detected, and lock the next whole minute closest to the current time as the metering starting point; The timing execution unit is used to drive the internal hardware timer to count down from the metering start point. When the counting duration reaches the fixed demand accumulation cycle, the demand calculation interrupt is triggered and the cycle is marked as a valid cycle. The recording control unit is used to write the obtained demand value into the maximum demand register within the valid period marked by the timing execution unit. After power-on initialization, the demand reading port is closed until the system time elapses beyond the sum of a complete demand accumulation cycle and a slip interval, at which point the reading port is reopened.
4. The demand value processing method based on real-time power direction change and the smart energy meter as described in claim 1, characterized in that, The multi-dimensional independent caching module includes: The mapping and binding unit is used to establish a one-to-one mapping relationship between the power direction identifier and the direction cache space. When the active power is detected to be positive in real time, the positive active power cache is bound, and when the active power is negative, the reverse active power cache is bound. The corresponding reactive quadrant cache is bound according to the polarity and phase relationship of the reactive power. The accumulation calculation unit is used to read the power pulse count value in the corresponding cache block at the end of each complete demand cycle, obtain the standardized demand result, compare the current demand value with the historical maximum demand value stored in the corresponding cache block, and send a rewrite instruction to the flash memory controller to update the maximum demand record if the current value is greater than the historical value.
5. The demand value processing method based on real-time power direction change and the smart energy meter as described in claim 1, characterized in that, The power direction determination module includes: The sampling and monitoring unit is used to perform a digital multiplication operation on the voltage sampling signal and the current sampling signal once per second to obtain the sign bit of the instantaneous active power corresponding to each second, and continuously monitor the high and low level status corresponding to each sign bit. The timing accumulation unit is used to set the time window counter to 1 minute. When the power sign bit flips, it controls the time window counter to enter the counting operation. If the sign bit is reset to zero during the counting operation, the counter will continue to accumulate if the sign bit continues to maintain the new state. The direction locking unit is used to logically compare the real-time value of the time window counter with the judgment threshold, output a Boolean judgment result, and when the judgment result is false, eliminate the current power sign bit change, maintain the original direction identifier latched in the previous whole minute, and judge the Boolean judgment result as an instantaneous disturbance. The direction refresh unit is used to confirm the power flow reversal when the determination result is true, update the direction identifier to the direction corresponding to the new power symbol when the next whole minute arrives, and simultaneously switch the demand output channel.
6. The demand value processing method based on real-time power direction change and the smart energy meter as described in claim 5, characterized in that, Also includes: If the count is less than 60 seconds, the result is determined to be false. When the count is greater than or equal to 60 seconds, the result is determined to be true.
7. The demand value processing method based on real-time power direction change and the smart energy meter as described in claim 1, characterized in that, The invalid data masking module includes: The numerical comparison unit is used to compare the real-time acquired current demand value with the stored maximum demand value and record the comparison result; The event parsing unit is used to obtain real-time monitoring communication messages when the comparison result is abnormal, parse the clock adjustment instructions sent to the microcontroller unit (MCU), and extract the target timestamp contained in the instructions. The reset and cleanup unit is used to control the multi-dimensional independent cache module to forcibly clear the number of power pulses and intermediate variables that are being accumulated in all six cache blocks according to the clock adjustment instruction, and terminate the current unfinished demand cycle; The scheduling unit is restarted to read the target timestamp in the clock adjustment instruction, calculate the next whole minute closest to the target time, set this time point as the new metering start point, and restart the demand measurement process. The data optimization unit is used to shield demand data from the old cycle during the slippage window when the time synchronization action occurs, and to perform data optimization using the complete demand data in the new cycle after the time synchronization is completed.
8. The demand value processing method based on real-time power direction change and the smart energy meter as described in claim 1, characterized in that, Also includes: Temperature data acquisition module, the temperature data acquisition module includes: The sensing unit is used to collect real-time temperature change signals from the microcontroller unit (MCU). The data conversion unit is used to convert the real-time temperature change signal into 16-bit signed long integer data. The storage reporting unit is used to write the converted temperature data to the corresponding storage address for storage.
9. The demand value processing method based on real-time power direction change and the smart energy meter as described in claim 4, characterized in that, The accumulation calculation unit includes: The power reading subunit is used to read the power pulse register in the corresponding direction buffer space at the end of the cycle to obtain the power value at the beginning of the cycle and the power value at the end of the cycle. The numerical calculation subunit is used to determine the cumulative energy increment corresponding to each cycle based on the energy value at the end of the cycle and the energy value at the beginning of the cycle, and to obtain the original demand value by combining the fixed demand accumulation cycle duration. The unit conversion subunit is used to multiply the original demand value by a preset multiplier coefficient, convert it into a demand value under a standard unit of measurement, and output it to the display buffer.