Electric energy metering method and device, electronic equipment and readable storage medium
By using a dual-metering unit design and a composite gain Kalman filter algorithm, redundant metering and real-time backup of electrical energy data are achieved, solving the problem of data loss when the metering unit fails and improving the accuracy and reliability of electrical energy metering.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA ELECTRIC POWER RESEARCH INSTITUTE CO LTD
- Filing Date
- 2025-12-25
- Publication Date
- 2026-04-14
AI Technical Summary
Existing electricity meters are prone to data loss or measurement errors when the metering unit fails. They lack real-time data backup and error correction mechanisms, have insufficient calibration accuracy, and cannot effectively cope with measurement errors in complex power grid environments.
The system adopts a dual metering unit design, which collects grid parameters through the first and second metering units, combines the data with the error unit and the data fusion unit, and uses a composite gain Kalman filter algorithm for error comparison and correction, thereby achieving redundant metering and real-time backup of power data.
To ensure the system can still operate normally when the metering unit fails, improve the accuracy and reliability of electricity metering, reduce the data loss rate to 0%, and improve the metering accuracy to over 0.1%.
Smart Images

Figure CN121856633A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of power grid technology, and more specifically, relates to an energy metering method and device, electronic equipment, and readable storage medium. Background Technology
[0002] As the core equipment for electricity metering in the power grid, the accuracy of electricity meters directly affects the economic operation of the power system and the electricity rights of users. With the development of smart grids, the requirements for the metering accuracy and reliability of electricity meters are increasing. However, existing electricity meters still have the following problems in practical applications: data loss due to metering unit failure. Traditional electricity meters usually use a single metering unit, and once the metering unit fails, it may lead to the loss of electricity data or measurement errors.
[0003] Therefore, there is an urgent need for a reliable method for measuring electricity to ensure the reliability and accuracy of electricity measurement. Summary of the Invention
[0004] The purpose of this application is to provide an electricity metering method and apparatus, electronic device, and readable storage medium to improve the reliability and accuracy of electricity metering.
[0005] A first aspect of this application provides an energy metering method, which is applied to a data fusion unit of an energy metering system. The energy metering system includes a first metering unit, a second metering unit, an error unit, and a data fusion unit. The first metering unit is connected to both the error unit and the data fusion unit, the second metering unit is connected to both the error unit and the data fusion unit, and the error unit is connected to the data fusion unit.
[0006] The method includes:
[0007] Obtain the first parameter value, which includes the first phase electrical parameter value and the first electrical energy value. The first phase electrical parameter value is the phase electrical parameter of the power grid collected by the first metering unit, and the first electrical energy value is the electrical energy value of the power grid calculated by the first metering unit based on the first phase electrical parameter value.
[0008] The second parameter value is obtained. The second parameter value includes the second phase electrical parameter value and the second electrical energy value. The second phase electrical parameter value is the phase electrical parameter of the power grid collected by the second metering unit, and the second electrical energy value is the electrical energy value of the power grid calculated by the second metering unit based on the second phase electrical parameter value.
[0009] The relative error is obtained by the error unit based on the values of the first phase electrical parameters and the second phase electrical parameters.
[0010] Calculate the residuals corresponding to the first parameter value, the second parameter value, and the relative error to obtain multiple residuals;
[0011] The first and second parameter values are adjusted based on the residuals to obtain the power grid's energy metering value.
[0012] A second aspect of this application provides an energy metering device, which is applied to the data fusion unit of an energy metering system. The energy metering system includes a first metering unit, a second metering unit, an error unit, and a data fusion unit. The first metering unit is connected to both the error unit and the data fusion unit, the second metering unit is connected to both the error unit and the data fusion unit, and the error unit is connected to the data fusion unit.
[0013] The device includes:
[0014] The first data acquisition module is used to acquire the first parameter value, which includes the first phase power parameter value and the first energy value. The first phase power parameter value is the phase power parameter of the power grid collected by the first metering unit, and the first energy value is the energy value of the power grid calculated by the first metering unit based on the first phase power parameter value.
[0015] The second data acquisition module is used to acquire the second parameter value, which includes the second phase electrical parameter value and the second electrical energy value. The second phase electrical parameter value is the phase electrical parameter of the power grid collected by the second metering unit, and the second electrical energy value is the electrical energy value of the power grid calculated by the second metering unit based on the second phase electrical parameter value.
[0016] The third data acquisition module is used to acquire the relative error, which is calculated by the error unit based on the first phase electrical parameter value and the second phase electrical parameter value.
[0017] The first calculation module is used to calculate the residuals corresponding to the first parameter value, the second parameter value, and the relative error, and obtain multiple residuals.
[0018] The second calculation module is used to adjust the first parameter value and the second parameter value according to each residual to obtain the power grid's energy metering value.
[0019] A third aspect of this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program to implement the steps of the above-described power metering method.
[0020] A fourth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described electricity metering method.
[0021] The beneficial effects of the power metering method, device, electronic equipment, and readable storage medium provided in this application are as follows: This application embodiment achieves redundant metering and real-time backup of power data through a dual metering unit design, ensuring that the system can still operate normally when a certain metering unit fails, thereby improving the accuracy and reliability of power metering. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a structural block diagram of the electricity metering system provided in the embodiments of this application;
[0024] Figure 2 This is a schematic diagram of the specific connection of the electricity metering system provided in the embodiments of this application;
[0025] Figure 3 This is a structural block diagram of the first metering unit provided in the embodiments of this application;
[0026] Figure 4 This is a structural block diagram of the second metering unit provided in the embodiments of this application;
[0027] Figure 5 A schematic flowchart of an embodiment of the power metering method provided in this application;
[0028] Figure 6 This is a structural block diagram of an energy metering device provided in an embodiment of this application;
[0029] Figure 7 This is a schematic block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0030] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0031] To make the objectives, technical solutions, and advantages of this application clearer, the following description will be provided in conjunction with the accompanying drawings and specific embodiments.
[0032] Figure 1This is a structural block diagram of the electricity metering system provided in the embodiments of this application, as shown below. Figure 1 As shown, the electricity metering system 10 may include a first metering unit 12, a second metering unit 13, an error unit 14, and a data fusion unit 11; wherein, the first metering unit 12 is connected to the error unit 14 and the data fusion unit 11 respectively, the second metering unit 13 is connected to the error unit 14 and the data fusion unit 11 respectively, and the error unit 14 is connected to the data fusion unit 11.
[0033] In actual use, the input of the first metering unit 12 is also used to connect to the power grid 20, the input of the second metering unit 13 is also used to connect to the power grid, and the output of the data fusion unit 11 can be connected to the main station.
[0034] Both the first metering unit 12 and the second metering unit 13 can collect electrical parameters from the power grid 20. The error unit 14 can calculate the collection error between the first metering unit 12 and the second metering unit 13 to determine if any metering unit is damaged. The second metering unit 13 can be a standard metering unit, and its reliability is higher than that of the first metering unit 12. The data fusion unit 11 can perform data fusion based on the collected electrical parameters and error identification results to output reliable collected data, ensuring the reliability of the main station's operation. The electrical parameters are the phase electrical parameters, including phase current and phase voltage.
[0035] Figure 2 This is a schematic diagram of the specific connection of the electricity metering system provided in the embodiments of this application, such as... Figure 2 As shown in the embodiments of this application, the first metering unit 12 may include an ADC chip 121, a DSP chip 122, and a first MCU chip 123. The second metering unit 13 may include an energy metering chip 131 and a second MCU chip 132. The first metering unit 12 can acquire electrical parameters of the power grid 20 through a three-phase transmitter 30. The energy metering chip 131 in the second metering unit 13 can directly acquire electrical parameters of the power grid 20.
[0036] Specifically, the working process of the first measurement unit is as follows:
[0037] The first metering unit first receives analog voltage and current signals from the power grid. The first metering unit adopts an ADC+DSP+MCU architecture. A three-phase transmitter is added before the first metering unit to step down the three-phase voltage of the power grid and isolate the signal. After processing, the ADC chip can collect current AD sampling and voltage AD sampling at a sampling frequency of 10MHz. The communication protocol between the ADC chip and the DSP chip adopts SPI.
[0038] The communication process can be as follows:
[0039] The MCU chip acts as the master, and the DSP chip acts as the slave. Parallel communication is set up, and relevant interrupts are enabled. The ADC chip packages the collected data into 8-bit data frames, which are then transmitted to the DSP chip for detection via the high-speed communication port, and finally transmitted to the MCU via UART for data processing and backup.
[0040] In the embodiments of this application, the specific configuration of UART can be as follows: the baud rate is 9600 BPS, each transmitted byte includes a start bit, data bits, even parity bit and stop bit, wherein each byte contains 8 bits of binary code, and during transmission, a start bit, an even parity bit and a stop bit are added for a total of 11 bits, the data bits are 8 bits, and each 8 bytes are packed into a data frame, each frame includes a frame header and a frame trailer, which are represented in hexadecimal as 0x0A and 0x0C respectively.
[0041] For example, Figure 3 This is a structural block diagram of the first metering unit provided in the embodiments of this application, such as... Figure 3 As shown, the ADC chip includes current AD sampling and voltage AD sampling, and sends the acquired phase voltage and phase current to the DSP chip. The DSP chip can send them to the MCU chip through a high-speed port for storage and processing.
[0042] Specifically, the ADC chip is mainly used to acquire and measure analog signals of three-phase voltage and three-phase current, while the DS chip mainly receives the digital signals output by the ADC chip. Its core task is to filter noise and extract signal features from the raw sampled data, providing clean and effective data for the power calculation of the first MCU chip. Through the built-in FIR digital filtering algorithm, it filters out high-frequency noise such as electromagnetic interference caused by residual noise during the ADC sampling process; at the same time, it extracts key features such as the amplitude and phase difference of voltage and current signals, and transforms the raw digital signals into feature data that can be used for power calculation.
[0043] The first MCU chip is used to receive digital voltage and current signals, calculate the active and reactive energy values, and finally convert them into corresponding energy values.
[0044] The specific working process of the second measurement unit is as follows:
[0045] The second metering unit uses an energy metering chip to measure energy. Simultaneously, the second metering unit also functions as a standard meter, verifying and checking the electrical pulses generated by the first metering unit. The energy metering chip is a multi-functional, high-precision three-phase energy metering chip, suitable for three-phase three-wire and three-phase four-wire applications.
[0046] For example, Figure 4 This is a structural block diagram of the second metering unit provided in the embodiments of this application, such as... Figure 4As shown, the high-precision, multi-functional three-phase energy metering chip can accurately collect phase current or phase voltage and send the phase current or phase voltage to the MCU chip for storage and processing.
[0047] In the embodiments of this application, the first measuring unit can send low-frequency pulses to the error unit, while the second measuring unit sends high-frequency pulses to the measuring unit.
[0048] The data fusion unit can receive data sent by the first measurement unit, the second measurement unit, and the error unit, and perform error comparison and correction processing on the corresponding data to obtain accurate and reliable data, which facilitates the reliable operation of the main station.
[0049] Specifically, the data fusion unit can improve the composite gain Kalman filter to perform error comparison and correction processing on the data.
[0050] Error comparison: Identify the deviation between the first metering unit (main metering, ADC+DSP+MCU architecture) and the second metering unit in terms of energy data, including active and reactive energy and pulse count, and determine whether there are any data anomalies such as sampling distortion, unit failure, or other special circumstances.
[0051] Corrective measures: For the identified deviations, the abnormal data is corrected by combining the standard meter attributes of the second metering unit (higher accuracy, and the predetermined system error δ0 is negligible) to ensure that the final output energy value meets the metering accuracy requirements (above 0.1%), while avoiding data failure due to a single unit failure.
[0052] The detailed working process of the data fusion unit is described in detail below.
[0053] Please refer to Figure 5 , Figure 5 This is a flowchart illustrating an embodiment of an energy metering method provided in this application. This method can be applied to, for example... Figure 1 The data fusion unit of the electricity metering system shown. The method may include steps S101 to S105.
[0054] S101, Obtain the first parameter value, which includes the first phase electrical parameter value and the first electrical energy value. The first phase electrical parameter value is the phase electrical parameter of the power grid collected by the first metering unit, and the first electrical energy value is the electrical energy value of the power grid calculated by the first metering unit based on the first phase electrical parameter value.
[0055] In this embodiment, the first phase electrical parameter values collected by the first metering unit may include the real-time phase voltage U1(n) and real-time phase current I1(n) of the power grid. The first energy value calculated by the first metering unit may include the active energy value W1 and the reactive energy value Q1. Simultaneously, the first metering unit can also output a low-frequency pulse N. L Provided to the error unit.
[0056] The first metering unit can send the collected and calculated data to the data fusion unit, which will then perform subsequent calculations.
[0057] In addition, the first parameter value may also include the grid fundamental frequency (50Hz / 60Hz), the sampling time interval Δt (derived from the first unit's 10MHz sampling frequency), and the maximum limiting deviation ΔT of the amplitude-limited mean filter.
[0058] S102, obtain the second parameter value, which includes the second phase electrical parameter value and the second electrical energy value. The second phase electrical parameter value is the phase electrical parameter of the power grid collected by the second metering unit, and the second electrical energy value is the electrical energy value of the power grid calculated by the second metering unit based on the second phase electrical parameter value.
[0059] In this embodiment, the second phase electrical parameter values collected by the second metering unit may include the real-time phase voltage U2(n) and real-time phase current I2(n) of the power grid. The second electrical energy value calculated by the second metering unit may include the active energy value W2 and the reactive energy value Q2. Simultaneously, the second metering unit can also output a high-frequency pulse N. L The error is then fed into the error unit. The second metering unit typically uses a high-precision acquisition chip; therefore, the active energy value can be used as a standard value.
[0060] The first metering unit can send the collected and calculated data to the data fusion unit, which will then perform subsequent calculations.
[0061] In addition, the second parameter value may also include the grid fundamental frequency (50Hz / 60Hz), the sampling time interval Δt (derived from the 10MHz sampling frequency of the first unit), and the maximum limiting deviation ΔT of the amplitude-limited mean filter.
[0062] S103, obtain the relative error, which is calculated by the error unit based on the first phase electrical parameter value and the second phase electrical parameter value.
[0063] The error unit can calculate the relative error, which can be calculated according to the formula δ=(l0-l) / l×100%+δ0, where l is the measured number of high-frequency pulses, l0 is the preset value, and δ0=0.
[0064] Specifically, the error unit starts counting pulses when it receives the rising or falling edge of the meter pulse. When the two metering units are operating continuously, it counts the high-frequency pulse 1 output by the second metering unit when the first metering unit outputs N low-frequency pulses, and uses this as the actual measured high-frequency pulse count, which is then compared with the preset high-frequency pulse count.
[0065] The relative error δ can be expressed as:
[0066]
[0067] In the formula:
[0068] δ0 — The predetermined systematic error of the second measurement unit. When no correction is required, δ0 = 0.
[0069] l — Measured number of high-frequency pulses.
[0070] l0 — The number of high-frequency pulses that are calculated or preset.
[0071]
[0072] In the formula:
[0073] —The high-frequency pulse constant of the second metering unit, imp / kWh.
[0074] C L —The low-frequency pulse constant of the first metering unit, imp / kWh.
[0075] S104, calculate the residuals corresponding to the first parameter value, the second parameter value, and the relative error, and obtain multiple residuals.
[0076] The specific calculation process is as follows:
[0077] S1041, construct the state vector corresponding to the first parameter value, the second parameter value, and the relative error.
[0078] The signal gain of the first parameter is obtained by applying signal gain based on the magnitude of the first parameter value.
[0079] The signal gain of the second parameter is obtained by applying signal gain based on the magnitude of the second parameter value.
[0080] The error signal is obtained by applying signal gain to the relative error.
[0081] A state vector is constructed based on the first parameter signal, the second parameter signal, and the error signal.
[0082] Specifically, a fused signal is constructed from the first parameter signal, the second parameter signal, and the error signal;
[0083] The fused signal is filtered using a linear filtering function to obtain a linear signal.
[0084] The linear signal is discretized according to a preset period to obtain the state vector.
[0085] S1042, construct the observation vector corresponding to the first parameter value, the second parameter value, and the relative error.
[0086] S1043, calculate the first residual corresponding to the first parameter value based on the state vector and the observation vector.
[0087] S1044, calculate the second residual corresponding to the second parameter value based on the state vector and the observation vector.
[0088] S1045, calculate the third residual corresponding to the relative error based on the state vector and the observation vector.
[0089] S105, adjust the first parameter value and the second parameter value according to each residual to obtain the power grid's energy metering value.
[0090] Specifically, the adjustment process may include:
[0091] Whether to perform data correction is determined based on the first, second, and third residuals.
[0092] When it is determined that data correction is needed, the value of the first parameter is adjusted according to the value of the second parameter to obtain the power grid's energy metering value.
[0093] The data correction process may include:
[0094] If the first residual is greater than the first preset threshold, the second residual is less than the second preset threshold, and the third residual is greater than the third preset threshold, then it is determined that data correction is required.
[0095] This application embodiment achieves redundant metering and real-time backup of electrical energy data through a dual metering unit design, ensuring that the system can still operate normally when one metering unit fails, thereby improving the accuracy and reliability of electrical energy metering.
[0096] In embodiments of this application, the data fusion unit may include a Kalman filter unit.
[0097] In this embodiment of the application, the working process of the data fusion unit may include:
[0098] The data fusion unit can divide the signal into three gain ranges: low, medium, and high, based on the amplitude of the input signal (i.e., the first parameter value and the second parameter value, such as U(n), I(n), W1 / W2, etc.). Each sampling interval can correspond to a fixed gain coefficient. The purpose is to adapt the optimal gain to the noise characteristics of signals with different amplitudes and balance signal amplification and noise suppression.
[0099] For example, in the low amplitude range (such as voltage < 180V, current < 10A): adapt to a high gain coefficient P1 = 20 to amplify weak effective signals and prevent low amplitude signals from being masked by noise;
[0100] Medium amplitude range (e.g., voltage 180V~240V, current 10A~50A): The gain coefficient P2 is 10, which balances signal amplification and noise control, and matches the normal operating conditions of the power grid.
[0101] High amplitude range (e.g., voltage > 240V, current > 50A): Adapted with a low gain coefficient P3 = 5 to avoid saturation distortion of high amplitude signals due to excessive gain, while suppressing electromagnetic interference noise under high current and high voltage.
[0102] The signal is divided into three gain intervals: low, medium, and high, based on its dynamic amplitude. The coefficients n represent a discrete-time sequence, with coefficients P1 = 20, P2 = 10, and P3 = 5. The amplitude function is defined as follows:
[0103]
[0104] A1 and A2 are amplitude thresholds, and the processed signal is y1(n) = P(x(n))x(n);
[0105] In this embodiment of the application, considering that the signal fluctuations become larger and abrupt changes occur after processing, we introduce a linear transition function g(n), that is, g(n)=a(n-n0)+b, where 0≤a≤1, b=0,1; a is the ramp coefficient, and after processing we can obtain: y2(n)=g(n)y1(n).
[0106] Subsequently, in this embodiment of the application, the preprocessed signal y2(n) can be discretized according to a certain signal period to obtain the state vector X(k). At this time, a state-space equation containing the relative error, the measured value of the first measurement unit, and the measured value of the second measurement unit can be established: Let the state vector X(k) = [x1(k), x2(k), ..., x m (k)] T , where k is the discrete time series and m is the state dimension.
[0107] In the embodiments of this application, the state vector X(k) contains key measurement parameters of the dual measurement units, reflecting the true state of the system. The dimension m is set according to the actual number of parameters, and a typical structure is as follows: X(k) = [x1(k), x2(k), x3(k), x4(k), x5(k)] T
[0108] in:
[0109] x1(k): The actual value of active power of the first metering unit at time k.
[0110] x2(k): The actual value of active power of the second metering unit at time k.
[0111] x3(k): The true value of the relative error δ at time k.
[0112] x4(k): The actual value of the phase voltage of the power grid at time k.
[0113] x5(k): The actual value of the phase current of the power grid at time k.
[0114] In the embodiments of this application, the observation vector Z(k) = [z1(k), z2(k), ..., z e (k)] T ,e represents the observation dimension;
[0115] The observation vector Z(k) contains the actual collected two-cell data, with dimension e matching the state vector. A typical structure is as follows: Z(k) = [z1(k), z2(k), z3(k), z4(k), z5(k)] T
[0116] in:
[0117] z1(k): Active energy collected by the first metering unit at time k.
[0118] z2(k): Active energy collected by the second metering unit at time k (with minimal error).
[0119] z3(k): The relative error δ calculated by the error unit at time k.
[0120] z4(k): The average phase voltage collected by the first / second metering unit at time k.
[0121] z5(k): The average phase current collected by the first / second metering unit at time k.
[0122] In the embodiments of this application, the state transition matrix A(k) describes the change relationship of the state vector from time k-1 to time k, reflecting the "continuity" of electrical energy data, such as the accumulation of electrical energy over time.
[0123] The observation matrix is H(k), which is used to map the state vector to the observation space.
[0124] The process noise covariance matrix is Q(k), which represents the statistical characteristics of noise during the state transition process. It describes the noise during the state transition process, such as the power increment error caused by grid fluctuations. The statistical characteristics are set based on historical data. When the grid voltage fluctuates greatly, the Q element corresponding to the voltage state increases.
[0125] The observation noise covariance matrix is R(k), which represents the statistical characteristics of the noise during the state transition process.
[0126] In embodiments of this application, the Kalman filtering process of the data fusion unit may include:
[0127] In the prediction step of filtering, the state at time k is first predicted based on the optimal state estimate X(k-1|k-1) at time k-1, and then the state X(k|k-1) = A(k) × X(k-1|k-1) is the predicted value.
[0128] Then, by using the difference between the observation vector Z(k) and the observation mapping value H(k)×X(k|k-1), the residual ε(k)=Z(k)-H(k)×X(k|k-1) is calculated.
[0129] The residual ε(k) directly reflects the deviation of the data from the two measurement units.
[0130] If ε1(k)=z1(k)-x1(k|k-1) (the deviation between the observed and predicted values in the first unit) is large, and ε2(k)=z2(k)-x2(k|k-1) (the deviation in the second unit) is small, it indicates that the data in the first unit may be abnormal.
[0131] If ε3(k)=z3(k)-x3(k|k-1) (relative error deviation) exceeds the preset threshold of 0.1%, it is determined that there is a significant deviation in the dual measurement unit data, and correction processing needs to be initiated.
[0132] Specifically, the Kalman gain calculation process is as follows:
[0133] (1) Prediction Steps
[0134] in, The state estimate at time k is predicted based on the state estimate at time k-1.
[0135] Where P(k|k-1) is the prediction error covariance matrix.
[0136] (2) Update steps
[0137] K(k)=P(k|k-1)H T (k)[H(k)P(k|k-1)H T +R(k)] -1 Where K(k) is the Kalman gain;
[0138] in, This is the updated state estimate at time k;
[0139] P(k|k)=[1-K(k)H(k)]P(k|k-1)], where P(k|k) is the updated error covariance matrix and l is the identity matrix.
[0140] In the embodiments of this application, the Kalman gain K(k) is a weight adjuster for the correction process. The predicted state X(k|k-1) is corrected using the Kalman gain K(k) and the residual ε(k) to obtain the optimal state estimate X(k|k) at time k (i.e., the corrected data).
[0141] Using the Kalman gain K(k) and residual ε(k), the predicted state X(k|k-1) is corrected to obtain the optimal state estimate X(k|k) at time k, i.e., the corrected data:
[0142] X(k|k)=X(k|k-1)+K(k)ε(k)
[0143] If the data of the first measurement unit is abnormal (such as z1(k) deviating too much from X(k|k-1)), then ε1(k) is large, K(k) will adjust the weights and use the reliable data z2(k) of the second measurement unit (mapped through H(k)) to correct x1(k) in X(k|k), so that x1(k|k) approaches x2(k|k) (the standard value).
[0144] If the relative error δ is abnormal (ε3(k) is large), then x3(k|k) is corrected by K(k) to make it closer to the true deviation, providing a basis for subsequent unit fault judgment.
[0145] y3(n) can be obtained from the optimal state estimation vector x3(k|k).
[0146] In this embodiment, due to fluctuations in grid voltage and current, to make the measurement estimate more accurate, we introduce a limiting mean filtering algorithm. The sampling window length is defined as m measurement cycles. The signal sequence can be divided into y3(n), y3(n-1), ..., y3(n-m+1) in sequence. Let the nth sampling value be y3(n), the previous valid sampling value be y3(n-1), and the maximum limiting deviation be ΔT.
[0147] If |y3(n)-y3(n-1)|≤ΔT, the sampling is considered valid.
[0148] If |y3(n)-y3(n-1)|>ΔT, then the current sampling is considered invalid, and the previous sampling value is used instead. The average value of the m valid sampling values is calculated as follows:
[0149]
[0150] According to the calibration coefficient C of the error unit u C i The actual values of voltage and current can be calculated using the following conversion formula:
[0151] U(n)=C u |y3u (n)|,I(n)=C i |y 3i (n)|
[0152] C u C i They are used for voltage-current conversion respectively, and |y3(n)| is the signal amplitude.
[0153] This application embodiment also provides a method for calculating the active energy metering value and the reactive energy metering value of the first metering unit, and the specific calculation is as follows:
[0154] Based on the measured values of U(n) and I(n) obtained above, the formula for calculating active power can be derived.
[0155] Calculate the active power of each phase, where Let n be the phase difference between voltage and current at time n.
[0156] Using the trapezoidal integration method for all three phases A, B, and C, the formula for calculating the active energy value of each phase can be listed as follows:
[0157]
[0158] Total active energy value:
[0159]
[0160] N is the number of sampling points in the sampling interval, and Δt is the sampling time interval.
[0161] Similarly, the formula for calculating reactive power can be expressed as:
[0162]
[0163] This application provides a method to address the problem of data loss caused by metering unit failure: Existing electricity meters typically use a single metering unit, and a failure in this unit can lead to data loss or metering errors. It also addresses the problem of insufficient calibration accuracy: Existing electricity meter calibration methods (such as the standard source method and the standard meter method) may suffer from insufficient calibration accuracy in complex power grid environments, particularly in the synchronous processing of high-frequency and low-frequency pulses. Furthermore, it addresses the problem of inadequate data backup and error correction mechanisms: Existing electricity meters lack real-time data backup and error correction mechanisms, making them unable to effectively handle metering unit failures or data anomalies. Finally, it addresses the limitations of output power deviation and error correction: The actual output power of the standard source method device may deviate from the set value due to factors such as temperature and circuit load changes, leading to inaccurate calculation of the standard electricity value. Finally, it addresses the problem of insufficient real-time fault detection capability: Existing technologies cannot detect metering unit failures in the tested equipment in real time, potentially leading to data loss or error accumulation.
[0164] In this embodiment, analog voltage and current signals are simultaneously transmitted to metering units of two different energy metering methods. The two metering units send high-frequency pulse constants amplified by N times, and the error unit simultaneously measures the energy pulses generated by the two metering units. The energy data is stored and backed up in real time by setting independent storage spaces for the first and second metering units in the main control unit. The two sets of energy data are compared and corrected by improving the composite gain Kalman filter algorithm, which reduces the energy loss caused by the failure of the metering unit itself.
[0165] This application's embodiments can improve the accuracy of power metering. Through a wideband sampling module and a high-precision ADC, high-precision sampling of voltage and current signals is achieved, with a sampling accuracy exceeding 0.1%. Traditional standard source methods and standard meter methods are limited by pulse frequency and output power offset, with calibration accuracy typically ranging from 0.1% to 0.2%. The test environment temperature is 25℃, the mains voltage is 220V±10%, and the current range is 0.5A to 100A.
[0166] The embodiments of this application enhance system reliability by implementing redundant metering and real-time backup of electrical energy data through a dual-metering unit design, ensuring that the system can still operate normally in the event of a failure in one metering unit. In tests simulating metering unit failure, the system can automatically switch to the backup metering unit with a data loss rate of 0%.
[0167] The embodiments of this application can realize real-time data backup and error correction. Through the composite gain algorithm, Kalman filter algorithm and real-time data backup mechanism, real-time error correction and recovery of power data are realized, ensuring the integrity and reliability of the data.
[0168] Corresponding to the electricity metering method in the above embodiment, Figure 6This is a structural block diagram of an electricity metering device provided according to an embodiment of this application. For ease of explanation, only the parts relevant to the embodiment of this application are shown. References Figure 6 The electricity metering device 20 is applied to the data fusion unit of the electricity metering system. The electricity metering system includes a first metering unit, a second metering unit, an error unit, and a data fusion unit. The first metering unit is connected to the error unit and the data fusion unit, the second metering unit is connected to the error unit and the data fusion unit, and the error unit is connected to the data fusion unit.
[0169] The electricity metering device 20 includes: a first data acquisition module 201, a second data acquisition module 202, a third data acquisition module 203, a first calculation module 204, and a second calculation module 205;
[0170] The first data acquisition module 201 is used to acquire a first parameter value, which includes a first phase power parameter value and a first energy value. The first phase power parameter value is the phase power parameter of the power grid collected by the first metering unit, and the first energy value is the energy value of the power grid calculated by the first metering unit based on the first phase power parameter value.
[0171] The second data acquisition module 202 is used to acquire the second parameter value, which includes the second phase electrical parameter value and the second electrical energy value. The second phase electrical parameter value is the phase electrical parameter of the power grid collected by the second metering unit, and the second electrical energy value is the electrical energy value of the power grid calculated by the second metering unit based on the second phase electrical parameter value.
[0172] The third data acquisition module 203 is used to acquire the relative error, which is calculated by the error unit based on the first phase electrical parameter value and the second phase electrical parameter value.
[0173] The first calculation module 204 is used to calculate the residuals corresponding to the first parameter value, the second parameter value, and the relative error, and obtain multiple residuals.
[0174] The second calculation module 205 is used to adjust the first parameter value and the second parameter value according to each residual to obtain the power grid's energy metering value.
[0175] In one embodiment of this application, the first calculation module 204 is specifically used to construct a state vector corresponding to a first parameter value, a second parameter value, and a relative error; construct an observation vector corresponding to the first parameter value, the second parameter value, and the relative error; calculate a first residual corresponding to the first parameter value based on the state vector and the observation vector; calculate a second residual corresponding to the second parameter value based on the state vector and the observation vector; and calculate a third residual corresponding to the relative error based on the state vector and the observation vector.
[0176] In one embodiment of this application, the second calculation module 205 is specifically used to determine whether data correction needs to be performed based on the first residual, the second residual, and the third residual; when it is determined that data correction is required, the first parameter value is adjusted according to the second parameter value to obtain the power grid's energy metering value.
[0177] In one embodiment of this application, the second calculation module 205 is specifically used to determine that data correction is required if the first residual is greater than the first preset threshold, the second residual is less than the second preset threshold, and the third residual is greater than the third preset threshold.
[0178] In one embodiment of this application, the first calculation module 204 is specifically used to perform signal amplification on the first parameter value based on the magnitude of the first parameter value to obtain a first parameter signal; perform signal amplification on the second parameter value based on the magnitude of the second parameter value to obtain a second parameter signal; perform signal amplification on the relative error to obtain an error signal; and construct a state vector based on the first parameter signal, the second parameter signal, and the error signal.
[0179] In one embodiment of this application, the first calculation module 204 is specifically used to construct a fused signal of the first parameter signal, the second parameter signal, and the error signal; to filter the fused signal based on a linear filtering function to obtain a linear signal; and to discretize the linear signal according to a preset period to obtain a state vector.
[0180] In one embodiment of this application, the device 20 further includes:
[0181] The switching module is used to stop receiving data from the first metering unit and receive data from the second metering unit when the first metering unit is determined to be faulty; and to stop receiving data from the second metering unit and receive data from the first metering unit when the second metering unit is determined to be faulty.
[0182] See Figure 7 , Figure 7 This is a schematic block diagram of an electronic device provided according to an embodiment of this application. Figure 7 The electronic device 300 in this embodiment may include one or more processors 301, one or more input devices 302, one or more output devices 303, and one or more memories 304. The processors 301, input devices 302, output devices 303, and memories 304 communicate with each other via a communication bus 305. The memories 304 store computer programs, including program instructions. The processors 301 execute the program instructions stored in the memories 304. Specifically, the processors 301 are configured to invoke the program instructions to perform the functions of each module / unit in the above-described device embodiments, for example... Figure 6The functions of the first data acquisition module 201, the second data acquisition module 202, the third data acquisition module 203, the first calculation module 204, and the second calculation module 205 are shown.
[0183] It should be understood that, in the embodiments of this application, the processor 301 may be a central processing unit (CPU), but it may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0184] Input device 302 may include a touchpad, a fingerprint sensor (for collecting the user's fingerprint information and fingerprint orientation information), a microphone, etc., and output device 303 may include a display (LCD, etc.), a speaker, etc.
[0185] The memory 304 may include read-only memory and random access memory, and provides instructions and data to the processor 301. A portion of the memory 304 may also include non-volatile random access memory. For example, the memory 304 may also store device type information.
[0186] In specific implementations, the processor 301, input device 302, and output device 303 described in the embodiments of this application can execute the implementation method described in the power metering method provided in the embodiments of this application, or they can execute the implementation method of the electronic device described in the embodiments of this application, which will not be repeated here.
[0187] In another embodiment of this application, a computer-readable storage medium is provided. This computer-readable storage medium stores a computer program, which includes program instructions. When executed by a processor, the program instructions implement all or part of the processes in the methods described above. Alternatively, the computer program can instruct related hardware to complete the process. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include any entity or device capable of carrying computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.
[0188] The computer-readable storage medium can be an internal storage unit of the electronic device in any of the foregoing embodiments, such as a hard disk or memory of the electronic device. The computer-readable storage medium can also be an external storage device of the electronic device, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the electronic device. Furthermore, the computer-readable storage medium can include both internal and external storage units of the electronic device. The computer-readable storage medium is used to store computer programs and other programs and data required by the electronic device. The computer-readable storage medium can also be used to temporarily store data that has been output or will be output.
[0189] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.
[0190] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the electronic devices and units described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0191] In the several embodiments provided in this application, it should be understood that the disclosed electronic devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and other division methods may exist in actual implementation. Furthermore, the mutual couplings or direct couplings or communication connections shown or discussed can be indirect couplings or communication connections through some interfaces or units, or they can be electrical, mechanical, or other forms of connection.
[0192] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of this application, depending on actual needs.
[0193] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for metering electrical energy, characterized in that, The method is applied to the data fusion unit of an electricity metering system, which includes a first metering unit, a second metering unit, an error unit, and a data fusion unit; wherein the first metering unit is connected to both the error unit and the data fusion unit, the second metering unit is connected to both the error unit and the data fusion unit, and the error unit is connected to the data fusion unit. The method includes: Obtain a first parameter value, which includes a first phase power parameter value and a first energy value. The first phase power parameter value is the phase power parameter of the power grid collected by the first metering unit, and the first energy value is the energy value of the power grid calculated by the first metering unit based on the first phase power parameter value. Obtain a second parameter value, which includes a second phase electrical parameter value and a second electrical energy value. The second phase electrical parameter value is the phase electrical parameter of the power grid collected by the second metering unit, and the second electrical energy value is the electrical energy value of the power grid calculated by the second metering unit based on the second phase electrical parameter value. The relative error is obtained, which is calculated by the error unit based on the first phase electrical parameter value and the second phase electrical parameter value. Calculate the residuals corresponding to the first parameter value, the second parameter value, and the relative error to obtain multiple residuals; The first parameter value and the second parameter value are adjusted according to the residuals to obtain the power grid's energy metering value.
2. The electricity metering method as described in claim 1, characterized in that, The calculation of the residuals corresponding to the first parameter value, the second parameter value, and the relative error yields multiple residuals, including: Construct a state vector corresponding to the first parameter value, the second parameter value, and the relative error; Construct an observation vector corresponding to the first parameter value, the second parameter value, and the relative error; Calculate the first residual corresponding to the first parameter value based on the state vector and the observation vector; Calculate the second residual corresponding to the second parameter value based on the state vector and the observation vector; The third residual corresponding to the relative error is calculated based on the state vector and the observation vector.
3. The electricity metering method as described in claim 2, characterized in that, The step of adjusting the first parameter value and the second parameter value according to each residual to obtain the power grid's energy metering value includes: Based on the first residual, the second residual, and the third residual, determine whether to perform data correction; When it is determined that data correction is required, the first parameter value is adjusted according to the second parameter value to obtain the power grid's energy metering value.
4. The electricity metering method as described in claim 3, characterized in that, The step of determining whether to perform data correction based on the first residual, the second residual, and the third residual includes: If the first residual is greater than the first preset threshold, the second residual is less than the second preset threshold, and the third residual is greater than the third preset threshold, then it is determined that data correction is required.
5. The electricity metering method as described in claim 2, characterized in that, The construction of the state vector corresponding to the first parameter value, the second parameter value, and the relative error includes: The signal gain of the first parameter value is obtained by performing signal gain on the first parameter value based on the magnitude of the first parameter value; The signal gain is applied to the second parameter value based on the magnitude of the second parameter value to obtain the second parameter signal; The relative error is amplified to obtain the error signal; A state vector is constructed based on the first parameter signal, the second parameter signal, and the error signal.
6. The electricity metering method as described in claim 5, characterized in that, The construction of the state vector based on the first parameter signal, the second parameter signal, and the error signal includes: Construct a fused signal of the first parameter signal, the second parameter signal, and the error signal; The fused signal is filtered using a linear filtering function to obtain a linear signal. The linear signal is discretized according to a preset period to obtain a state vector.
7. The electricity metering method according to any one of claims 1 to 6, characterized in that, Also includes: When the first metering unit is determined to be faulty, the reception of data from the first metering unit is stopped, and data from the second metering unit is received instead. When the second metering unit is determined to be faulty, data reception from the second metering unit is stopped, and data reception from the first metering unit is started.
8. An electricity metering device, characterized in that, This device is applied to the data fusion unit of an electricity metering system, which includes a first metering unit, a second metering unit, an error unit, and a data fusion unit; wherein, the first metering unit is connected to both the error unit and the data fusion unit, the second metering unit is connected to both the error unit and the data fusion unit, and the error unit is connected to the data fusion unit. The device includes: The first data acquisition module is used to acquire a first parameter value, which includes a first phase power parameter value and a first energy value. The first phase power parameter value is the phase power parameter of the power grid collected by the first metering unit, and the first energy value is the energy value of the power grid calculated by the first metering unit based on the first phase power parameter value. The second data acquisition module is used to acquire a second parameter value, which includes a second phase power parameter value and a second electrical energy value. The second phase power parameter value is the phase power parameter of the power grid collected by the second metering unit, and the second electrical energy value is the electrical energy value of the power grid calculated by the second metering unit based on the second phase power parameter value. The third data acquisition module is used to acquire the relative error, which is calculated by the error unit based on the first phase electrical parameter value and the second phase electrical parameter value. The first calculation module is used to calculate the residuals corresponding to the first parameter value, the second parameter value, and the relative error, respectively, to obtain multiple residuals; The second calculation module is used to adjust the first parameter value and the second parameter value according to each residual to obtain the power grid's energy metering value.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 7.