Charging pile metering error detection method and device based on KDE-EnKF
By combining kernel density estimation and ensemble Kalman filter, the probability distribution of the power loss term is accurately fitted, solving the problems of simple model assumptions and Gaussian distribution limitations in the metering error detection of charging piles, and achieving more efficient and accurate metering error detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- FUJIAN METROLOGY INST
- Filing Date
- 2025-12-10
- Publication Date
- 2026-05-12
AI Technical Summary
Existing charging pile metering error detection methods rely on simplistic assumptions about energy loss distribution in the energy conservation model. The Kalman filter is limited by a Gaussian distribution, leading to performance degradation in non-Gaussian scenarios and affecting the accuracy and robustness of the detection.
A KDE-EnKF-based method is adopted to accurately fit the probability distribution function of the power loss term through kernel density estimation, and dynamic correction is performed by combining ensemble Kalman filters. This is incorporated into the state estimation process to improve the estimation accuracy of the error coefficient and the ability to adapt to complex operating conditions.
It significantly improves the accuracy and robustness of charging pile metering error detection, reduces hardware costs, improves calibration efficiency, and reduces maintenance costs.
Smart Images

Figure CN122017719A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electric vehicle charging pile calibration technology, specifically to a method and device for detecting metering errors in charging piles. Background Technology
[0002] Charging piles, as a key infrastructure for electric vehicle energy replenishment, have been widely used in recent years with the rapid expansion of the new energy vehicle market. Based on different charging technologies and power levels, charging piles can be mainly divided into two categories: AC charging piles and DC charging piles. AC charging piles have a relatively simple structure, but their limited charging power results in longer charging times; DC charging piles, on the other hand, have high power output capabilities, which can significantly shorten charging time, but their equipment and installation costs are correspondingly higher. With the continuous development of the electric vehicle industry and breakthroughs in charging technology, the coverage density and intelligence level of charging infrastructure are gradually improving, which is expected to further promote the large-scale application of electric vehicles and provide important support for building a clean and low-carbon energy system.
[0003] However, during the charging process, various internal and external factors can affect the accuracy of electricity metering at charging piles, directly impacting the interests of users and service providers. Since charging piles are involved in electricity trade settlements, they are considered mandatory verification measuring instruments according to the "Metrology Law of the People's Republic of China." Traditional on-site manual verification methods are increasingly unable to meet the current demand for large-scale verification due to their high cost and low efficiency. Existing research mostly utilizes big data for charging pile verification, and based on different principles, it can be divided into two categories: vehicle-pile interaction and energy conservation methods. Among these, the energy conservation model has high requirements for modeling electricity loss, and the accuracy of the model is a key factor affecting the final result. However, most existing models are based on simple assumptions or specific distribution characteristics, making it difficult to accurately reflect the true distribution of electricity loss.
[0004] For example: Chinese invention patent CN119936723A, published on May 6, 2025, discloses a method, apparatus, device, and medium for analyzing the error characteristics of charging pile groups. The invention constructs an initial set of state variables; calculates the set of estimated state variables for the charging pile group error coefficients at time k; calculates the set of estimated output variables at time k; calculates the set of corrected state variable values and their covariance at time k; and outputs the corrected vector estimate of the charging pile group error coefficients at time k and its uncertainty. This invention only proposes a method for solving the error coefficients using a ensemble Kalman filter, without addressing energy loss terms (such as line losses and equipment heat loss). This results in an incomplete energy conservation model, and the difference between the total meter output energy and the sub-meter output energy cannot be explained by the loss terms. Directly attributing this difference to the error coefficients will cause the error coefficient estimation results to include interference from the loss terms, leading to increased estimation bias. Furthermore, the lack of a dynamic correction mechanism for the loss terms makes it difficult to adapt to complex operating conditions and fails to distinguish between "changes in the true error coefficients" and "changes in the loss terms," resulting in poor robustness under complex operating conditions. Ultimately, this affects the accuracy and stability of the error coefficient estimation.
[0005] Chinese invention patent CN113346579A, published on September 3, 2021, discloses a method for monitoring the operational error of metering equipment in a DC charging station. The method employs the following technical solution: A method for monitoring the operational error of metering equipment in a DC charging station includes the following steps: establishing equations regarding the AC-side power supply, the power consumption of each charging gun, the inherent losses of the charging station, the energy conversion efficiency of the AC-DC conversion module of each charging pile, equivalent error parameters, and the heat loss of each charging gun; obtaining power data and energy conversion efficiency of each charging pile at each charging gun metering point on both the AC and DC sides of the charging station over multiple metering cycles; substituting the power data and energy conversion efficiency into the equations to establish a system of equations, and solving the system of equations to obtain the heat loss of each charging gun and the equivalent error parameters of each charging gun. In the equation for solving the error coefficient, this invention treats the loss term as a fixed value. However, in actual operation, significant fluctuations in the charging station load and ambient temperature cause the loss term to change drastically. The static assumption about the loss term cannot capture this dynamic change. As a result, the fixed loss model will introduce systematic errors under changing operating conditions, which will lead to a large deviation in the calculation of the error coefficient and seriously affect the accuracy and reliability of monitoring.
[0006] Furthermore, in the practical application of charging pile metering error detection, traditional Kalman filters and their typical derivative methods usually require that the system noise and state variables both follow a Gaussian distribution in order to ensure the consistency of the recursive filtering process. This premise limits its applicability in non-Gaussian distribution scenarios. That is, when the system loss term exhibits a non-normal distribution, the performance of the Kalman filter may significantly decrease or even diverge. Summary of the Invention
[0007] The technical problem to be solved by the present invention is to provide a charging pile metering error detection method and device based on KDE-EnKF. Based on the energy conservation model, the method incorporates probabilistic characteristics into the state estimation process, which can continuously and accurately estimate the error coefficient of the charging pile, thereby significantly improving the verification efficiency of the charging pile.
[0008] In a first aspect, the present invention provides a method for detecting metering errors in charging piles based on KDE-EnKF, comprising the following steps: S101. Fit the probability distribution function of the power loss term in the charging station using the kernel density estimation method; S102. Initialize the ensemble Kalman filter model; S103. Through the ensemble Kalman filter model, the charging pile error coefficient is continuously corrected at multiple moments within a continuous time period. The continuous correction is achieved by using the total meter output energy and the sub-meter output energy at each moment as inputs to the ensemble Kalman filter model, combining the probability distribution function of the energy loss term, and using the ensemble Kalman filter model to correct the charging pile error coefficient at the previous moment, and using the corrected value as the output of the filter model.
[0009] Secondly, the present invention provides a charging pile metering error detection device based on KDE-EnKF, comprising: The fitting module uses the kernel density estimation method to fit the probability distribution function of the power loss term in the charging station; The initialization module is used to initialize the ensemble Kalman filter model; The correction module is used to continuously correct the charging pile error coefficient at multiple moments within a continuous time period using the ensemble Kalman filter model. The continuous correction uses the total meter output energy and the sub-meter output energy at each moment as inputs to the ensemble Kalman filter model, combines the probability distribution function of the energy loss term, and uses the ensemble Kalman filter model to correct the charging pile error coefficient at the previous moment, and uses the corrected value as the output of the filter model.
[0010] The present invention has the following technical effects: 1. Based on the energy conservation model, this invention accurately fits the probability distribution of the energy loss term using the kernel density estimation method. Combined with the dynamic correction mechanism of the ensemble Kalman filter, the probability characteristics are integrated into the state estimation process. While considering the random characteristics of the energy loss term and the dynamic changes of the system within the charging station, it can continuously and accurately estimate the error coefficient of the charging pile, reducing the estimation error by approximately 25%. Among them, the ensemble Kalman filter model eliminates the need for complex covariance matrix calculations, thus improving computational efficiency. It can effectively handle nonlinear systems and dynamically changing scenarios. By approximating the probability distribution through ensemble samples, it enhances the robustness and accuracy of state estimation. 2. This invention eliminates the cost and time of personnel dispatch and on-site operation in traditional manual on-site verification, and can remotely realize rapid and large-scale verification of the metering performance of a large number of charging piles, significantly improving verification efficiency; 3. By optimizing software algorithms to replace traditional high-precision sensor solutions, the hardware cost of the single-pile detection system is reduced by more than 30%, and subsequent maintenance costs are also reduced, thus lowering hardware dependency costs.
[0011] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description
[0012] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0013] Figure 1 This is a flowchart of the method in Embodiment 1 of the present invention; Figure 2 This is a simplified model diagram of the law of conservation of energy in an embodiment of the present invention; Figure 3 This is a schematic diagram of the device in Embodiment 2 of the present invention. Detailed Implementation
[0014] This application provides a method and apparatus for detecting metering errors in charging piles based on KDE-EnKF. Based on the energy conservation model, it incorporates probabilistic characteristics into the state estimation process, which can continuously and accurately estimate the error coefficients of charging piles, thereby significantly improving the verification efficiency of charging piles.
[0015] The technical solution in this application embodiment has the following general idea: Addressing the problems of simplistic assumptions about energy loss distribution in traditional charging pile metering error detection models and performance degradation in non-Gaussian scenarios due to Gaussian distribution limitations of Kalman filters, this application uses the energy conservation model as a foundation and the kernel density estimation (KDE) method to accurately fit the probability distribution function of energy loss terms within the charging station, overcoming the limitations of traditional models' assumptions about loss distribution. Simultaneously, by combining an ensemble Kalman filter (EnKF), probabilistic characteristics are integrated into the state estimation process. While considering the random characteristics of energy loss terms and dynamic changes in the system, this method can continuously and accurately estimate the error coefficients of the charging pile, improving the accuracy of metering error detection and enhancing adaptability to complex operating conditions.
[0016] Before conducting metering error detection of charging piles, it is necessary to obtain and preprocess the data of the charging pile group. The data that needs to be obtained includes: Sampling time; total meter reading of the charging station; number of charging piles in the charging station and sub-meter readings of each charging pile; charging pile calibration readings.
[0017] The required preprocessing includes: Remove unusable data; Calculate the electrical energy of the main meter and each individual meter per unit time; Calculate the energy loss value within the charging station; Interpolate at sampling points where data is scarce or use models for prediction; Appropriately correct sampling points with abnormal values; Standardize the data, including units and types; Align the various data according to time. Example 1
[0018] like Figure 1 As shown, this embodiment provides a method for detecting metering errors in charging piles based on KDE-EnKF, including the following steps: S101. Fit the probability distribution function of the power loss term in the charging station using the kernel density estimation method; This step constructs a probabilistic model of the power loss term using kernel density estimation (KDE), providing a statistical distribution basis for the loss term in state estimation. It overcomes the limitation of traditional models that make simple assumptions about the loss distribution, enabling the loss estimation to reflect non-Gaussian distribution characteristics and improving the accuracy of the state estimation input.
[0019] S102. Initialize the ensemble Kalman filter model; This step establishes the basic framework for state estimation by configuring the initial parameters of the EnKF model; this ensures that the filter starts from a reasonable initial state, providing a stable iterative starting point for subsequent dynamic correction and reducing convergence time. S103: Using the ensemble Kalman filter model, the charging pile error coefficient is continuously corrected at multiple moments within a continuous time period. This continuous correction uses the total meter output energy and sub-meter output energy at each moment as inputs to the ensemble Kalman filter model, combined with the probability distribution function of the energy loss term, to correct the charging pile error coefficient of the previous moment, and the corrected value is used as the output of the filter model.
[0020] This step incorporates probabilistic characteristics into state estimation, dynamically optimizing the error coefficient; and enabling adaptation to load fluctuations and environmental disturbances.
[0021] Step S101 specifically includes the following process: S11. First, for a given... N For a charging station with DC charging piles, based on the law of conservation of energy, an energy conservation equation is established for the total meter output energy, the output energy of each sub-meter, and the energy loss term. The formula is as follows: ; In the formula, The total electrical energy output of the charging station's main meter during a specific time period; For the first i The output power of each charging pile sub-meter during the specific time period; S This refers to the energy loss within the charging station during the same time period. The output power of the main meter of the charging station and the sub-meters of each charging pile during the specific time period is calculated from the difference between the cumulative readings of the corresponding meters at the beginning and end of the specific time period. Secondly, based on prior data samples, the energy conservation equation is established to calculate... t Power loss at the charging station at different times And calculate the mean of the power loss term. and sample standard deviation The calculation formulas are as follows: ; ; ; In the formula, n For sample size, for k The total output power of the charging station's main meter at all times. for k Time of the first i The output power of each charging pile's sub-meter; This step is used to obtain the basic statistical characteristics of the power loss sample, providing raw parameters for kernel density estimation; the central tendency and dispersion of the loss data are quantified by the mean and standard deviation to ensure the representativeness of the sample for subsequent distribution fitting.
[0022] S12, Calculate bandwidth h The calculation formula is as follows: ; This step determines the smoothing parameters for kernel density estimation, balancing estimation bias and variance; by dynamically adjusting the bandwidth (e.g., based on sample size and standard deviation), the probability density function preserves data details while avoiding noise interference, thus improving the distribution fitting accuracy.
[0023] S13. Define the kernel function The formula is as follows: ; In the formula,u For the estimated point s Standardized distance variables for energy loss; This step transforms discrete samples into a continuous distribution using a kernel function, providing a mathematical framework for constructing the probability density function.
[0024] S14. For each estimation point s and each power loss item Calculate the standardized distance variable u The calculation formula is as follows: ; This step is used to standardize the distance scale between sample points and estimated points to adapt to the input requirements of the kernel function; thereby eliminating the influence of dimensions, enabling the kernel function to accurately calculate sample weights based on standardized distances, and improving the consistency of distribution estimation.
[0025] S15. Calculate the probability density function of the energy loss term within the charging station. The calculation formula is as follows: .
[0026] This step is used to integrate sample statistical features, bandwidth, and kernel function to construct a complete power loss probability distribution model; thereby generating a probability density function that accurately describes the random characteristics of power loss, providing a statistical distribution basis for the loss term in the state estimation of ensemble Kalman filtering.
[0027] Step S102 specifically includes the following process: S21, regarding the above N For each DC charging pile, the initial error coefficient is determined based on the calibration results or charging data. The initial state variable means ; This step establishes an initial estimation benchmark for the error coefficient based on historical charging data, providing initial mean values for the state variables; it initializes the error coefficient using actual operating data, reducing subjective assumption bias and making the initial state closer to the real operating conditions.
[0028] S22. Determine the covariance matrix of the state variables based on prior knowledge. The mean of the composition is variance is The normal distribution; This step is used to quantify the uncertainty of the initial state variables and construct a probability distribution model of the state variables; thus, the covariance matrix is used to describe the correlation and dispersion of the error coefficients, providing a statistical distribution basis for subsequent set sampling.
[0029] S23. Sampling from the normal distribution M Variables The initial state variable set constituting the error coefficient of the charging pile The number of variables M in the set is the larger of 2*n and 100. If N is large, then M is increased accordingly, ranging from 100 to 1000. in For the first i The th initial state variable n Error coefficient of each charging station.
[0030] This step is used to generate an initial sample set that satisfies the probability distribution characteristics, providing an iterative starting point for ensemble Kalman filtering; thus, based on the core idea of Monte Carlo, diverse initial state estimates are obtained through sampling, avoiding single-point estimation bias and improving the filtering process's adaptability to system nonlinearity.
[0031] Step S103 specifically includes the following process: S31. Under the aforementioned ensemble Kalman filter model, calculate the prior estimate of the set of state variables for the charging pile error coefficients at the current moment. The calculation formula is as follows: ; In the formula, for k Set of estimated values of state variables at time points. for k Time of the first i Prior estimates of state variables For the first n Error coefficient of each charging station; for k The set of state variable correction values at time −1; for k The collection of process noise at any given moment; ,obey N (0, Q )distributed, Q for Covariance matrix; For the first n The process noise of a charging pile; when k When the value is 1, the system performs its first iteration based on the initial set of state variables according to the charging pile error coefficient. For the state variables at the first time step The set is used for prior estimation, and each subsequent iteration is based on the set of corrected state variable values from the previous time step. ; This step predicts the current state based on the state variables and process noise from the previous time step, providing a priori estimation basis for filtering correction. By introducing the process noise enhancement model to adapt to the dynamic changes of the system, the initialization phase uses the initial state set to ensure the rationality of the iteration starting point.
[0032] S32. Based on the probability density function of power loss distribution Sampling is performed to form an estimated set of power losses at the current moment. ; The sampling method is as follows: for state variables For each element in the set, firstly, a data point is selected from the original dataset with uniform probability. pi Secondly, using this data point pi Centered, bandwidth h A random offset is drawn from the kernel probability distribution of the scaling parameter; finally, the estimated value of the current time-to-date power loss is... pi The sum of the random offsets taken; This step is used to generate a loss sample set that conforms to the actual probability characteristics by using the loss distribution estimated by kernel density; by sampling by kernel distribution, the non-Gaussian distribution characteristics of power loss are captured, avoiding the estimation bias caused by the traditional assumed distribution, and improving the statistical representativeness of the loss term.
[0033] S33. Based on the energy conservation equation established in S11, calculate the estimated value of the total electrical energy output of the charging station's main meter at the current moment. The calculation formula is as follows: ; In the formula, for k Time of the first n The output power value obtained from the sub-meter of each charging pile; ,in For set elements in With matrix The matrix formed by taking the reciprocals of each element of the summed matrix. for A matrix of all ones; for k The time-lapse meter outputs a set of estimated electrical energy values; for k Time of the first i Estimated output energy value of each meter; for k The set of measurement noise at any given time; obey N(0, R )distributed, R Let its covariance matrix be ; This step is used to establish a correlation model between the state variables and the estimated output power of the total meter, providing observation equations for the calculation of filter gain.
[0034] S34. Calculate the ensemble Kalman filter gain at the current time. The calculation formula is as follows: ; In the formula, ; This step is used to construct a weighting mechanism for state estimation error and observation error, and to optimize the direction of state correction. The gain is dynamically adjusted through covariance matrix operations, so that the filtering result depends on prior estimation when the observation noise is large, and the weight of the observation data is enhanced when the system dynamics change drastically.
[0035] S35. Calculate the set of correction values for the current charging pile error coefficient state variables. and estimated value The calculation formulas are as follows: ; ; In the formula, for k The output electrical energy value obtained from the main meter of the charging station at all times; for A matrix of all ones; , for k Time of the first n The final estimated value of the error coefficient for each charging pile; for k Set of time-state variable correction values The first in i Each element.
[0036] This step is used to fuse prior estimates and observational information to output the optimal estimate of the final error coefficients; sampling errors are eliminated by ensemble averaging, so that the corrected set of state variables converges to the true error coefficients. Example 2
[0037] Based on the same inventive concept, this application also provides an apparatus corresponding to the method in Embodiment 1, as detailed in Embodiment 2.
[0038] like Figure 3 As shown, this embodiment provides a charging pile metering error detection device based on KDE-EnKF, including: The fitting module uses kernel density estimation to fit the probability distribution function of the energy loss term in the charging station; it constructs a probability model of the energy loss term through kernel density estimation (KDE), providing a statistical distribution basis for the loss term for state estimation; it overcomes the limitation of the traditional model's simple assumptions about the loss distribution, enabling the loss estimation to reflect the non-Gaussian distribution characteristics and improving the accuracy of the state estimation input.
[0039] The initialization module is used to initialize the ensemble Kalman filter model; by configuring the initial parameters of the EnKF model, it establishes the basic framework for state estimation; to ensure that the filter starts from a reasonable initial state, providing a stable iterative starting point for subsequent dynamic corrections and reducing convergence time.
[0040] The correction module is used to continuously correct the charging pile error coefficient at multiple moments within a continuous time period using the ensemble Kalman filter model. This continuous correction uses the total meter output energy and sub-meter output energy at each moment as inputs to the ensemble Kalman filter model, combines the probability distribution function of the energy loss term, and uses the ensemble Kalman filter model to correct the charging pile error coefficient at the previous moment, with the corrected value as the output of the filter model. By incorporating probabilistic characteristics into state estimation, the error coefficient is dynamically optimized, enabling adaptation to load fluctuations and environmental interference.
[0041] Specifically, the fitting module is used to perform the following process: S11, for a given... N For a charging station with DC charging piles, based on the law of conservation of energy, an energy conservation equation is established for the total meter output energy, the output energy of each sub-meter, and the energy loss term. The formula is as follows: ; In the formula, The total electrical energy output of the charging station's main meter during a specific time period; For the first i The output power of each charging pile sub-meter during the specific time period; S This refers to the energy loss within the charging station during the same time period. The output power of the main meter of the charging station and the sub-meters of each charging pile during the specific time period is calculated from the difference between the cumulative readings of the corresponding meters at the beginning and end of the specific time period. Secondly, based on prior data samples, the energy conservation equation is established to calculate... t Power loss at the charging station at different times And calculate the mean of the power loss term. and sample standard deviation The calculation formulas are as follows: ; ; ; In the formula, n For sample size, for k The total output power of the charging station's main meter at all times. for k Time of the first i The output power of each charging pile's sub-meter; This step is used to obtain the basic statistical characteristics of the power loss sample, providing raw parameters for kernel density estimation; the central tendency and dispersion of the loss data are quantified by the mean and standard deviation to ensure the representativeness of the sample for subsequent distribution fitting.
[0042] S12, Calculate bandwidth h The calculation formula is as follows: ; This step determines the smoothing parameters for kernel density estimation, balancing estimation bias and variance; by dynamically adjusting the bandwidth (e.g., based on sample size and standard deviation), the probability density function preserves data details while avoiding noise interference, thus improving the distribution fitting accuracy.
[0043] S13. Define the kernel function The formula is as follows: ; In the formula, u For the estimated point s Standardized distance variables for energy loss; This step transforms discrete samples into a continuous distribution using a kernel function, providing a mathematical framework for constructing the probability density function.
[0044] S14. For each estimation point s and each power loss item Calculate the standardized distance variable u The calculation formula is as follows: ; This step is used to standardize the distance scale between sample points and estimated points to adapt to the input requirements of the kernel function; thereby eliminating the influence of dimensions, enabling the kernel function to accurately calculate sample weights based on standardized distances, and improving the consistency of distribution estimation.
[0045] S15. Calculate the probability density function of the energy loss term within the charging station. The calculation formula is as follows: .
[0046] This step is used to integrate sample statistical features, bandwidth, and kernel function to construct a complete power loss probability distribution model; thereby generating a probability density function that accurately describes the random characteristics of power loss, providing a statistical distribution basis for the loss term in the state estimation of ensemble Kalman filtering.
[0047] The initialization module is specifically used to perform the following process: S21, regarding the above N For each DC charging pile, the initial error coefficient is determined based on the calibration results or charging data. The initial state variable means ; This step establishes an initial estimation benchmark for the error coefficient based on historical charging data, providing initial mean values for the state variables; it initializes the error coefficient using actual operating data, reducing subjective assumption bias and making the initial state closer to the real operating conditions.
[0048] S22. Determine the covariance matrix of the state variables based on prior knowledge. The mean of the composition is variance is The normal distribution; This step is used to quantify the uncertainty of the initial state variables and construct a probability distribution model of the state variables; thus, the covariance matrix is used to describe the correlation and dispersion of the error coefficients, providing a statistical distribution basis for subsequent set sampling.
[0049] S23. Sampling from the normal distribution M Variables The initial state variable set constituting the error coefficient of the charging pile The number of variables M in the set is the larger of 2*n and 100. If N is large, then M is increased accordingly, ranging from 100 to 1000. in For the first i The th initial state variable n Error coefficient of each charging station.
[0050] This step is used to generate an initial sample set that satisfies the probability distribution characteristics, providing an iterative starting point for ensemble Kalman filtering; thus, based on the core idea of Monte Carlo, diverse initial state estimates are obtained through sampling, avoiding single-point estimation bias and improving the filtering process's adaptability to system nonlinearity.
[0051] The correction module is specifically used to perform the following process: S31. Under the aforementioned ensemble Kalman filter model, calculate the prior estimate of the set of state variables for the charging pile error coefficients at the current moment. The calculation formula is as follows: ; In the formula, for k Set of estimated values of state variables at time points. for k Time of the first i Prior estimates of state variables For the first nError coefficient of each charging station; for k The set of state variable correction values at time −1; for k The collection of process noise at any given moment; ,obey N (0, Q )distributed, Q for Covariance matrix; For the first n The process noise of a charging pile; when k When the value is 1, the system performs its first iteration based on the initial set of state variables according to the charging pile error coefficient. For the state variables at the first time step The set is used for prior estimation, and each subsequent iteration is based on the set of corrected state variable values from the previous time step. ; This step predicts the current state based on the state variables and process noise from the previous time step, providing a priori estimation basis for filtering correction. By introducing the process noise enhancement model to adapt to the dynamic changes of the system, the initialization phase uses the initial state set to ensure the rationality of the iteration starting point.
[0052] S32. Based on the probability density function of power loss distribution Sampling is performed to form an estimated set of power losses at the current moment. ; The sampling method is as follows: for state variables For each element in the set, firstly, a data point is selected from the original dataset with uniform probability. pi Secondly, using this data point pi Centered, bandwidth h A random offset is drawn from the kernel probability distribution of the scaling parameter; finally, the estimated value of the current time-to-date power loss is... pi The sum of the random offsets taken; This step is used to generate a loss sample set that conforms to the actual probability characteristics by using the loss distribution estimated by kernel density; by sampling by kernel distribution, the non-Gaussian distribution characteristics of power loss are captured, avoiding the estimation bias caused by the traditional assumed distribution, and improving the statistical representativeness of the loss term.
[0053] S33. Based on the energy conservation equation established in S11, calculate the estimated value of the total electrical energy output of the charging station's main meter at the current moment. The calculation formula is as follows: ; In the formula, fork Time of the first n The output power value obtained from the sub-meter of each charging pile; ,in For set elements in With matrix The matrix formed by taking the reciprocals of each element of the summed matrix. for A matrix of all ones; for k The time-lapse meter outputs a set of estimated electrical energy values; for k Time of the first i Estimated output energy value of each meter; for k The set of measurement noise at any given time; obey N (0, R )distributed, R Let its covariance matrix be ; This step is used to establish a correlation model between the state variables and the estimated output power of the total meter, providing observation equations for the calculation of filter gain.
[0054] S34. Calculate the ensemble Kalman filter gain at the current time. The calculation formula is as follows: ; In the formula, ; This step is used to construct a weighting mechanism for state estimation error and observation error, and to optimize the direction of state correction. The gain is dynamically adjusted through covariance matrix operations, so that the filtering result depends on prior estimation when the observation noise is large, and the weight of the observation data is enhanced when the system dynamics change drastically.
[0055] S35. Calculate the set of correction values for the current charging pile error coefficient state variables. and estimated value The calculation formulas are as follows: ; ; In the formula, for k The output electrical energy value obtained from the main meter of the charging station at all times; for A matrix of all ones; , for kTime of the first n The final estimated value of the error coefficient for each charging pile; for k Set of time-state variable correction values The first in i Each element.
[0056] This step is used to fuse prior estimates and observational information to output the optimal estimate of the final error coefficients; sampling errors are eliminated by ensemble averaging, so that the corrected set of state variables converges to the true error coefficients.
[0057] Since the apparatus described in Embodiment 2 of the present invention is an apparatus used to implement the method of Embodiment 1 of the present invention, those skilled in the art can understand the specific structure and variations of the apparatus based on the method described in Embodiment 1 of the present invention, and therefore will not be described again here. All apparatuses used in the method of Embodiment 1 of the present invention fall within the scope of protection of the present invention.
[0058] While specific embodiments of the present invention have been described above, those skilled in the art should understand that the specific embodiments described are merely illustrative and not intended to limit the scope of the present invention. Equivalent modifications and variations made by those skilled in the art in accordance with the spirit of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. This invention provides a method and apparatus for detecting metering errors in charging piles based on KDE-EnKF, the method comprising: S101. Fit the probability distribution function of the power loss term in the charging station using the kernel density estimation method; S102. Initialize the ensemble Kalman filter model; S103. Using the ensemble Kalman filter model, the error coefficient of the charging pile is continuously corrected at multiple moments within a continuous time period. This continuous correction uses the total meter output energy and sub-meter output energy at each moment as inputs to the ensemble Kalman filter model. Combined with the probability distribution function of the energy loss term, the ensemble Kalman filter model corrects the charging pile error coefficient of the previous moment, and the corrected value is used as the output of the filter model. This invention, based on the energy conservation model, incorporates probabilistic characteristics into the state estimation process, enabling continuous and accurate estimation of the charging pile error coefficient, thereby significantly improving the verification efficiency of charging piles.
2. The method according to claim 1, characterized in that: Step S101 specifically includes the following process: S11, for a given... N For a charging station with DC charging piles, based on the law of conservation of energy, an energy conservation equation is established for the total meter output energy, the output energy of each sub-meter, and the energy loss term. The formula is as follows: ; In the formula, The total electrical energy output of the charging station's main meter during a specific time period; For the first i The output power of each charging pile sub-meter during the specific time period; S This refers to the energy loss within the charging station during the same time period. The output power of the main meter of the charging station and the sub-meters of each charging pile during the specific time period is calculated from the difference between the cumulative readings of the corresponding meters at the beginning and end of the specific time period. Secondly, based on prior data samples, the energy conservation equation is established to calculate... t Power loss at the charging station at different times And calculate the mean of the power loss term. and sample standard deviation The calculation formulas are as follows: ; ; ; In the formula, n For sample size, for k The total output power of the charging station's main meter at all times. for k Time of the first i The output power of each charging pile's sub-meter; S12, Calculate bandwidth h The calculation formula is as follows: ; S13. Define the kernel function The formula is as follows: ; In the formula, u For the estimated point s Standardized distance variables for energy loss; S14. For each estimation point s and each power loss item Calculate the standardized distance variable u The calculation formula is as follows: ; S15. Calculate the probability density function of the energy loss term within the charging station. The calculation formula is as follows: .
3. The method according to claim 2, characterized in that: Step S102 specifically includes the following process: S21, regarding the above N For each DC charging pile, the initial error coefficient is determined based on the calibration results or charging data. The initial state variable means ; S22. Determine the covariance matrix of the state variables based on prior knowledge. The mean of the composition is variance is The normal distribution; S23. Sampling from the normal distribution M Variables The initial state variable set constituting the error coefficient of the charging pile The number of variables M in the set is the larger of 2*n and 100. If N is large, then M is increased accordingly, ranging from 100 to 1000. in For the first i The th initial state variable n Error coefficient of each charging station.
4. The method according to claim 3, characterized in that: Step S103 specifically includes the following process: S31. Under the aforementioned ensemble Kalman filter model, calculate the prior estimate of the set of state variables for the charging pile error coefficients at the current moment. The calculation formula is as follows: ; In the formula, for k Set of estimated values of state variables at time points. for k Time of the first i Prior estimates of state variables For the first n Error coefficient of each charging station; for k The set of state variable correction values at time −1; for k The collection of process noise at any given moment; ,obey N (0, Q )distributed, Q for Covariance matrix; For the first n The process noise of a charging pile; when k When the value is 1, the system performs its first iteration based on the initial set of state variables according to the charging pile error coefficient. For the state variables at the first time step The set is used for prior estimation, and each subsequent iteration is based on the set of corrected state variable values from the previous time step. ; S32. Based on the probability density function of power loss distribution Sampling is performed to form an estimated set of power losses at the current moment. ; The sampling method is as follows: for state variables For each element in the set, firstly, a data point is selected from the original dataset with uniform probability. pi Secondly, using this data point pi Centered, bandwidth h A random offset is drawn from the kernel probability distribution of the scaling parameter; finally, the estimated value of the current time-to-date power loss is... pi The sum of the random offsets taken; S33. Based on the energy conservation equation established in S11, calculate the estimated value of the total electrical energy output of the charging station's main meter at the current moment. The calculation formula is as follows: ; In the formula, for k Time of the first n The output power value obtained from the sub-meter of each charging pile; ,in For set elements in With matrix The matrix formed by taking the reciprocals of each element of the summed matrix. 1´ N A matrix of all ones; for k The time-lapse meter outputs a set of estimated electrical energy values; for k Time of the first i Estimated output energy value of each meter; for k The set of measurement noise at any given time; obey N (0, R )distributed, R Let its covariance matrix be ; S34. Calculate the ensemble Kalman filter gain at the current time. The calculation formula is as follows: ; In the formula, ; S35. Calculate the set of correction values for the current charging pile error coefficient state variables. and estimated value The calculation formulas are as follows: ; ; In the formula, for k The output electrical energy value obtained from the main meter of the charging station at all times; for A matrix of all ones; , for k Time of the first n The final estimated value of the error coefficient for each charging pile; for k Set of time-state variable correction values The first in i Each element.
5. A charging pile metering error detection device based on KDE-EnKF, characterized in that: include: The fitting module uses the kernel density estimation method to fit the probability distribution function of the power loss term in the charging station; The initialization module is used to initialize the ensemble Kalman filter model; The correction module is used to continuously correct the charging pile error coefficient at multiple moments within a continuous time period using the ensemble Kalman filter model. The continuous correction uses the total meter output energy and the sub-meter output energy at each moment as inputs to the ensemble Kalman filter model, combines the probability distribution function of the energy loss term, and uses the ensemble Kalman filter model to correct the charging pile error coefficient at the previous moment, and uses the corrected value as the output of the filter model.
6. The apparatus according to claim 5, characterized in that: The fitting module is specifically used to perform the following process: S11, for a given... N For a charging station with DC charging piles, based on the law of conservation of energy, an energy conservation equation is established for the total meter output energy, the output energy of each sub-meter, and the energy loss term. The formula is as follows: ; In the formula, The total electrical energy output of the charging station's main meter during a specific time period; For the first i The output power of each charging pile sub-meter during the specific time period; S This refers to the energy loss within the charging station during the same time period. The output power of the main meter of the charging station and the sub-meters of each charging pile during the specific time period is calculated from the difference between the cumulative readings of the corresponding meters at the beginning and end of the specific time period. Secondly, based on prior data samples, the energy conservation equation is established to calculate... t Power loss at the charging station at different times And calculate the mean of the power loss term. and sample standard deviation The calculation formulas are as follows: ; ; ; In the formula, n For sample size, for k The total output power of the charging station's main meter at all times. for k Time of the first i The output power of each charging pile's sub-meter; S12, Calculate bandwidth h The calculation formula is as follows: ; S13. Define the kernel function The formula is as follows: ; In the formula, u For the estimated point s Standardized distance variables for energy loss; S14. For each estimation point s and each power loss item Calculate the standardized distance variable u The calculation formula is as follows: ; S15. Calculate the probability density function of the energy loss term within the charging station. The calculation formula is as follows: .
7. The apparatus according to claim 6, characterized in that: The initialization module is specifically used to perform the following process: S21, regarding the above N For each DC charging pile, the initial error coefficient is determined based on the calibration results or charging data. The initial state variable means ; S22. Determine the covariance matrix of the state variables based on prior knowledge. The mean of the composition is variance is The normal distribution; S23. Sampling from the normal distribution M Variables The initial state variable set constituting the error coefficient of the charging pile The number of variables M in the set is the larger of 2*n and 100. If N is large, then M is increased accordingly, ranging from 100 to 1000. in For the first i The th initial state variable n Error coefficient of each charging station.
8. The apparatus according to claim 7, characterized in that: The correction module is specifically used to perform the following process: S31. Under the aforementioned ensemble Kalman filter model, calculate the prior estimate of the set of state variables for the charging pile error coefficients at the current moment. The calculation formula is as follows: ; In the formula, for k Set of estimated values of state variables at time points. for k Time of the first i Prior estimates of state variables For the first n Error coefficient of each charging station; for k The set of state variable correction values at time −1; for k The collection of process noise at any given moment; ,obey N (0, Q )distributed, Q for Covariance matrix; For the first n The process noise of a charging pile; when k When the value is 1, the system performs its first iteration based on the initial set of state variables according to the charging pile error coefficient. For the state variables at the first time step The set is used for prior estimation, and each subsequent iteration is based on the set of corrected state variable values from the previous time step. ; S32. Based on the probability density function of power loss distribution Sampling is performed to form an estimated set of power losses at the current moment. ; The sampling method is as follows: for state variables For each element in the set, firstly, a data point is selected from the original dataset with uniform probability. pi Secondly, using this data point pi Centered, bandwidth h A random offset is drawn from the kernel probability distribution of the scaling parameter; finally, the estimated value of the current time-to-date power loss is... pi The sum of the random offsets taken; S33. Based on the energy conservation equation established in S11, calculate the estimated value of the total electrical energy output of the charging station's main meter at the current moment. The calculation formula is as follows: ; In the formula, for k Time of the first n The output power value obtained from the sub-meter of each charging pile; ,in For set elements in With matrix The matrix formed by taking the reciprocals of each element of the summed matrix. for A matrix of all ones; for k The time-lapse meter outputs a set of estimated electrical energy values; for k Time of the first i Estimated output energy value of each meter; for k The set of measurement noise at any given time; obey N (0, R )distributed, R Let its covariance matrix be ; S34. Calculate the ensemble Kalman filter gain at the current time. The calculation formula is as follows: ; In the formula, ; S35. Calculate the set of correction values for the current charging pile error coefficient state variables. and estimated value The calculation formulas are as follows: ; ; In the formula, for k The output electrical energy value obtained from the main meter of the charging station at all times; for A matrix of all ones; , for k Time of the first n The final estimated value of the error coefficient for each charging pile; for k Set of time-state variable correction values The first in i Each element.