Charging pile error prediction method, system and device based on particle swarm optimization long short-term memory neural network and computer readable storage medium
By optimizing long and short-term memory neural network based on particle swarm, combined with various influencing factors in the charging station, the accuracy of metering error prediction of charging stations is improved, the problem of low prediction accuracy in the existing technology is solved, and more accurate measurement is achieved Parameter adjustment.
Patent Information
- Application Number
- CN202411185770.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2024-12-06
AI Technical Summary
In the prior art, when only the measurement error of some charging piles is used to predict the measurement error of the entire charging station, the prediction accuracy is low, resulting in inaccurate calibration of the metering parameters and increasing the measurement error of the charging station.
The method of optimizing long and short-term memory neural network based on particle swarm is adopted. By obtaining the measurement error, factory error, distribution network voltage fluctuation and product batch failure rate of some charging piles in the charging station, the improved classic particle swarm algorithm and Long-term memory neural network model makes predictions and optimizes hyperparameters to improve prediction accuracy.
It improves the accuracy and reliability of the metering error prediction of charging stations, ensures the accuracy of metering parameters adjustment, and reduces the metering error of the entire station.
Smart Images

Figure CN119090073A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of charging pile electricity metering, and specifically relates to a charging pile error prediction method, system, device and computer-readable storage medium based on particle swarm optimization long short-term memory neural network. Background Art
[0002] With the widespread use of electric vehicles, public charging piles serve as important infrastructure for their energy replenishment, and their metering accuracy directly affects the user's usage cost and the operating efficiency of the power grid. In the prior art, the metering error of each charging pile is usually measured to obtain the metering error of the entire charging station, but this method is inefficient and time-consuming. In order to save time and improve the calculation efficiency of the metering error of the charging station, the prior art also proposes a technical solution to sample the metering errors of some charging piles to predict the metering error of the entire station. However, in this solution, the prediction results are easily affected by the randomness of sampling. For example, the metering errors of the sampled charging piles are relatively small, but the metering errors of the entire station are not necessarily small, and there may be a large deviation between the predicted results and the actual results; therefore, the prediction accuracy of this solution is low. When the prediction results of the above solution are used to adjust the metering parameters of the charging piles, the metering parameters will be inaccurately adjusted, thereby increasing the metering error of the entire charging station. Summary of the invention
[0003] The object of the present invention is to provide a charging pile error prediction method, system, device and computer-readable storage medium based on particle swarm optimization long short-term memory neural network, so as to solve the technical problem of low prediction accuracy caused by using only the metering errors of some charging piles to predict the metering errors of the entire charging station in the prior art.
[0004] In order to solve the above technical problems, the present invention provides a charging pile error prediction method based on particle swarm optimization long short-term memory neural network, the method comprising the following steps:
[0005] Acquire data required for prediction, the data required for prediction includes measurement errors of some charging piles in the charging station during the time period to be tested, the data required for prediction also includes one, two or more of factory errors of all charging piles in the charging station, voltage fluctuations of the distribution network during the time period to be tested, product batch failure rates corresponding to all charging piles, and cumulative operating time of all charging piles;
[0006] The data required for prediction is input into the trained machine learning algorithm model to predict the metering error of the charging station during the test period.
[0007] Furthermore, the machine learning algorithm model is an improved long short-term memory neural network model obtained by improving the classic long short-term memory neural network model, and the improvement includes using a heuristic search algorithm to optimize the hyperparameters in the model.
[0008] Furthermore, the heuristic search algorithm is an improved particle swarm algorithm obtained by improving the classical particle swarm algorithm, and the improvement includes using a dynamic inertia weight formula to update the inertia weight of the improved particle swarm algorithm; the dynamic inertia weight formula is as follows:
[0009]
[0010] Among them, w(k) is the inertia weight at the kth iteration, w max is the maximum value of the inertia weight, w min is the minimum value of the inertia weight, k max is the maximum number of iterations, that is, the upper limit of the number of iterations before the algorithm terminates, and k is the current number of iterations.
[0011] Furthermore, the heuristic search algorithm is an improved particle swarm algorithm obtained by improving the classical particle swarm algorithm, and the improvement includes using an elite retention strategy to retain particles after the positions of all particles in the particle swarm are updated to participate in the next iteration; the elite retention strategy is to screen out particles with higher fitness and retain them to the next generation.
[0012] Furthermore, the heuristic search algorithm is a classical particle swarm algorithm.
[0013] Furthermore, the machine learning algorithm model is a classic long short-term memory neural network model.
[0014] Furthermore, the training data for training the machine learning algorithm model is the training data with random noise added.
[0015] The present invention is an improved invention creation, and its beneficial effects are as follows: the charging station metering error prediction method of the present invention uses the metering errors of some charging piles to predict the metering errors of the entire charging station, and when using the trained machine learning algorithm model to predict the metering errors of the charging station, data that has a greater impact on the metering errors of the charging piles is considered. For example, for a single charging pile, the larger the factory error, the higher the corresponding product batch failure rate, and the longer the cumulative running time, the larger the metering error is usually. These data are also used as inputs of the algorithm, thereby improving the prediction accuracy; specifically, the input of the charging station metering error prediction model includes the metering errors of some charging piles in the charging station extracted, and also includes one, two or more of the factory errors of all charging piles in the charging station, the voltage fluctuation of the distribution network in the corresponding time period, the product batch failure rate corresponding to all charging piles, and the cumulative running time of all charging piles; the data that has a greater impact on the metering errors of the charging piles is also used as the input of the model and is input into the trained machine learning algorithm model at the same time as the metering errors of some charging piles of the charging station. The model has more input data and higher accuracy, and the metering error of the entire charging station predicted in the end is more accurate and reliable.
[0016] To solve the above technical problems, the present invention also provides a charging pile error prediction system based on particle swarm optimization long short-term memory neural network, including a processor, which is used to execute a computer program to implement the steps of the charging pile error prediction method based on particle swarm optimization long short-term memory neural network of the present invention.
[0017] The present invention is an improved invention creation, and its beneficial effects are as follows: in the charging pile error prediction system based on particle swarm optimization long short-term memory neural network of the present invention, the processor uses the metering error of some charging piles to predict the metering error of the entire charging station when executing the computer program, and when using the trained machine learning algorithm model to predict the metering error of the charging station, the data with a large influence on the metering error of the charging pile is taken into account. For example, for a single charging pile, the larger the factory error, the higher the corresponding product batch failure rate, and the longer the cumulative running time, the larger the metering error. These data are also used as input of the algorithm, thereby improving the prediction accuracy. degree; specifically, the input of the charging station metering error prediction model includes the metering errors of some charging piles in the charging station, as well as the factory errors of all charging piles in the charging station, the voltage fluctuation of the distribution network in the corresponding time period, the product batch failure rate corresponding to all charging piles, and the cumulative operating time of all charging piles, one, two or more; the data that has a greater impact on the metering error of the charging piles is also input as the input of the model together with the metering errors of some charging piles in the charging station and is input into the trained machine learning algorithm model. The model has more input data and higher accuracy, and the final predicted metering error of the entire charging station is more accurate and reliable.
[0018] In order to solve the above technical problems, the present invention also provides a charging pile error prediction device based on particle swarm optimization long short-term memory neural network, comprising the following modules:
[0019] Data acquisition module: used to acquire data required for prediction, the data required for prediction includes measurement errors of some charging piles in the charging station during the time period to be tested, the data required for prediction also includes one, two or more of factory errors of all charging piles in the charging station, voltage fluctuations of the distribution network during the time period to be tested, product batch failure rates corresponding to all charging piles, and cumulative operating time of all charging piles;
[0020] Metering error prediction module: used to input the data required for prediction into the trained machine learning algorithm model to predict the metering error of the entire charging station within the test time period.
[0021] Furthermore, the machine learning algorithm model is an improved long short-term memory neural network model obtained by improving the classic long short-term memory neural network model, and the improvement includes using a heuristic search algorithm to optimize the hyperparameters in the model.
[0022] The present invention is an improved invention creation, and its beneficial effects are as follows: the charging pile error prediction device based on particle swarm optimization long short-term memory neural network of the present invention uses the metering error of some charging piles to predict the metering error of the entire charging station, and when using the trained machine learning algorithm model to predict the metering error of the charging station, the data with a large impact on the metering error of the charging pile is considered. For example, for a single charging pile, the larger the factory error, the higher the corresponding product batch failure rate, and the longer the cumulative running time, the larger the metering error is usually. These data are also used as inputs of the algorithm, thereby improving the prediction accuracy; specifically, the input of the charging station metering error prediction model includes the metering errors of some charging piles in the charging station extracted, and also includes one, two or more of the factory errors of all charging piles in the charging station, the voltage fluctuation of the distribution network in the corresponding time period, the product batch failure rate corresponding to all charging piles, and the cumulative running time of all charging piles; the data with a large impact on the metering error of the charging pile is also used as the input of the model and is input into the trained machine learning algorithm model at the same time as the metering error of some charging piles of the charging station, so that the model inputs more data and has higher accuracy, and the metering error of the entire charging station predicted in the end is more accurate and reliable.
[0023] In order to solve the above problems, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed, implements the steps of the charging pile error prediction method based on particle swarm optimization long short-term memory neural network of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 It is a flow chart of a charging station metering error prediction method according to a method embodiment of the present invention. DETAILED DESCRIPTION
[0025] A charging station metering error prediction method, a computer device, an apparatus and a computer-readable storage medium of the present invention use the metering errors of some charging piles to predict the metering errors of the entire charging station, and when using the trained machine learning algorithm model to predict the metering errors of the charging station, data that has a greater impact on the metering errors of the charging piles is considered. For example, for a single charging pile, the larger the factory error, the higher the corresponding product batch failure rate, and the longer the cumulative running time, the larger the metering error is usually. These data are also used as inputs of the algorithm, thereby improving the prediction accuracy; specifically, the input of the charging station metering error prediction model includes the metering errors of some charging piles extracted in the charging station, and also includes one, two or more of the factory errors of all charging piles in the charging station, the voltage fluctuation of the distribution network in the corresponding time period, the product batch failure rate corresponding to all charging piles, and the cumulative running time of all charging piles; the data that has a greater impact on the metering errors of the charging piles is also used as the input of the model and is input into the trained machine learning algorithm model at the same time as the metering errors of some charging piles of the charging station. The model has more input data and higher accuracy, and the metering error of the entire charging station predicted in the end is more accurate and reliable.
[0026] Method Example:
[0027] The present invention provides a charging pile error prediction method based on particle swarm optimization long short-term memory neural network, which uses the metering errors of some sampled charging piles and other parameters that have a greater impact on the prediction accuracy to predict the overall error of all charging piles in the station. Figure 1 As shown, the specific method flow includes the following steps:
[0028] Step 1: Construct a charging station metering error prediction model.
[0029] In this embodiment, a long short-term memory (LSTM) neural network is used as the core architecture of the prediction model, and its powerful processing ability for time series data is used to effectively capture and model the temporal characteristics of the charging pile metering error. The input of the model includes the metering error of the sampled charging piles, and the output is the overall metering error of all charging piles in the entire station. As other implementation methods, other machine learning algorithm models can also be used as charging station metering error prediction models.
[0030] In addition to the metering errors of some of the sampled charging piles, other parameters need to be input into the model, including the factory errors of all charging piles in the charging station, the voltage fluctuations of the distribution network during the test period, the product batch failure rates corresponding to all charging piles, and the cumulative operating time of all charging piles; the product batch failure rates corresponding to the charging piles are the failure rates of the batch of products sampled when leaving the factory provided by the manufacturer. These parameters have a significant impact on the final result. In order to ensure the accuracy of the prediction, in this embodiment, these parameters are used together with the metering errors of the sampled charging piles as inputs to construct the model, taking into account various situations that have a significant impact on the metering errors of the charging piles, so that the issues considered by the model are more comprehensive, the model is more accurate, and the final prediction accuracy of the metering error of the entire station is improved.
[0031] In this embodiment, the voltage fluctuation of the distribution network is measured by the difference between the real-time voltage and the rated voltage of the distribution network, specifically the ratio of the difference between the real-time voltage and the rated voltage to the rated voltage, which is called voltage deviation, and the range is usually ±5% to ±10%. For a 380V power supply system, the allowable voltage deviation may be +7%, -10%.
[0032] Step 2: Optimization of charging station metering error prediction model.
[0033] For the prediction model that has been built, in order to improve the prediction effect, the model's hidden layer node number, learning rate, regularization coefficient and other hyperparameters are optimized. In this embodiment, the specific optimization algorithm selects the particle swarm optimization (PSO) algorithm to globally optimize the hyperparameters of the LSTM neural network, so that the model structure is optimally matched with the charging pile error data characteristics and the pile group topology structure, thereby improving the generalization ability and accuracy of the prediction model. As other implementation methods, other heuristic search algorithms can also be selected to optimize hyperparameters.
[0034] In this embodiment, the classic PSO optimization algorithm is improved by using dynamic inertia weight adjustment and elite retention strategy to obtain an improved PSO algorithm. The improved PSO algorithm has improved optimization effect compared with the classic PSO algorithm. After optimizing the hyperparameters of the prediction model using the improved PSO optimization algorithm, the accuracy of the prediction results can be further improved. The steps of the improved PSO algorithm are explained below in combination with the code.
[0035] 1. Start->Initialize particle swarm (position, speed, individual best position, global best position)->Calculate fitness value
[0036] 2. For each iteration t=1,2,...,iter_max:
[0037] 3. Calculate the inertia weight w(t) of the current iteration according to the dynamic inertia weight adjustment formula
[0038] 4. For each particle i=1,2,...,n_particles:
[0039] 5. Update speed v_i(t+1)=w(t)*v_i(t)+c1*r1*(pbest_i-x_i(t))+c2*r2*(gbest-x_i(t))
[0040] 6. Apply velocity constraints to avoid overly large updates
[0041] 7. Update position x_i(t+1)=x_i(t)+v_i(t+1)
[0042] 8. Calculate the fitness value of the current position
[0043] 9. Update the individual best position pbest_i and the global best position gbest (if necessary)
[0044] 10. Apply elite retention strategies
[0045] 11. Check the stopping criteria (such as reaching the maximum number of iterations or meeting the preset accuracy requirements)
[0046] 12. If the stopping criteria are met, jump out of the loop. If not, jump to step 2.
[0047] 13. End->Output the global optimal solution and its fitness value
[0048] Where iter_max is the maximum number of iterations, i represents the i-th particle, w(t) is the inertia weight, vi(t+1) is the velocity of the i-th particle at time t+1, vi(t) is the velocity of the i-th particle at time t, x(t+1) is the position of the i-th particle at time t+1, x(t) is the position of the i-th particle at time t, c1 and c2 are learning factors; r1 and r2 are random numbers between 0 and 1.
[0049] The dynamic inertia adjustment formula is as follows:
[0050]
[0051] Where w(k) is the inertia weight at the kth iteration.
[0052] w max is the maximum value of the inertia weight, which is usually set high in the early stages of exploration to facilitate global search.
[0053] w minis the minimum value of the inertia weight and is usually set low in late exploration to promote local search.
[0054] k max is the maximum number of iterations, that is, the upper limit of the number of iterations before the algorithm terminates.
[0055] k is the current iteration number.
[0056] The dynamic inertia weight adjustment formula shows that the inertia weight will change from w max Start at k max After iterations, it is reduced to w min In the early stage of the algorithm, particles can be enabled to explore a wider space, and in the later stage, particles are guided to conduct more detailed exploration in the known high-quality solution area.
[0057] The elite retention strategy is used to ensure that the best individual (or multiple individuals) in the current population can be directly passed to the next generation of population without any operation. At the end of each generation of evolution, one or more individuals with the best fitness (elite individuals) are selected from the current population and these elite individuals are directly copied to the next generation of population.
[0058] Step 3: Model training.
[0059] The historical metering data of charging stations is obtained, and the historical metering data of charging piles is used as a training set to train the model. The weights of the LSTM neural network are updated through the back propagation algorithm so that it gradually approaches the actual error during the training process.
[0060] The metering errors of randomly sampled charging piles in historical data are used as the input of the prediction model, and the corresponding metering errors of the entire station are used as the output of the prediction model to train the model.
[0061] In this embodiment, the prediction model also includes the initial factory error value of each charging pile, the voltage fluctuation of the distribution network, the stability of the product batch, and the cumulative running time of each charging pile as inputs. Finally, the prediction results of the metering errors of the sampled charging piles under these corresponding conditions are obtained.
[0062] In this embodiment, during the model training process, random noise is added to the input variables to enhance the anti-interference ability and robustness of the model.
[0063] Step 4: Obtain the data required for prediction.
[0064] A certain number of charging piles are randomly selected from the charging piles to be tested for measurement, and the error (measurement error) between the actual amount of electricity charged into the electric vehicle during the test period and the amount of electricity charged displayed by the charging piles is calculated. These data and other data required for prediction are simultaneously input into the prediction model to obtain the prediction result of the measurement error of the entire station.
[0065] In this embodiment, the data required for prediction also include parameters such as the initial value of the factory error of each charging pile, the voltage fluctuation of the distribution network during the test period, the stability of the product batch, and the cumulative running time of each charging pile. These parameters have a great influence on the metering error of the charging pile. The final prediction result is also the metering error of the sampled charging pile, which is the prediction result under the conditions of the input initial value of the factory error of the charging pile, the voltage fluctuation of the distribution network, the stability of the product batch, and the cumulative running time of the charging pile.
[0066] In this embodiment, parameters such as the factory error initial value of each charging pile, the voltage fluctuation of the distribution network during the test time period, the stability of the product batch, and the cumulative operating time of each charging pile are used as inputs of the prediction model and the metering errors of some of the extracted charging piles are simultaneously input into the prediction model to predict the metering error of the entire charging station. As other implementation methods, one, two or more of the data required for prediction can be selected according to actual needs and input into the prediction model for prediction.
[0067] Step 5: Based on the prediction results, perform real-time calibration of the charging pile.
[0068] Based on the predicted metering error of the entire station, the charging piles are calibrated and the metering parameters of the charging piles are adjusted to reduce the metering error and improve the metering accuracy.
[0069] Through the above-mentioned method steps, the charging station metering error prediction method of the present invention uses the metering errors of the charging piles sampled in the charging station to be input into the prediction model to predict the error of the entire station. At the same time, other data required for the prediction are also input into the model. These parameters have a great influence on the metering errors of the charging piles, such as the initial value of the factory error of each charging pile, the voltage fluctuation of the distribution network during the test time period, the stability of the product batch and the cumulative operating time of each charging pile. By inputting these parameters into the model, the operating conditions of each charging pile can be clarified, thereby improving the accuracy of the metering error prediction of the entire charging station. When the prediction results are used to adjust the metering parameters, the metering parameter adjustment is also more accurate, thereby reducing the metering error of the entire station.
[0070] System Example:
[0071] A charging pile error prediction system based on particle swarm optimization long short-term memory neural network of the present invention includes a processor, and the processor is used to implement the steps of the charging pile error prediction method based on particle swarm optimization long short-term memory neural network as described in the method embodiment when executing the computer program. The specific steps, principles and beneficial effects of the method have been described in detail in the method embodiment, and will not be repeated in this embodiment.
[0072] The processor may be a microprocessor MCU, a programmable logic device FPGA or other processing device. The memory may be various memories, such as RAM, ROM or the like.
[0073] Device Example:
[0074] A charging pile error prediction device based on particle swarm optimization long short-term memory neural network of the present invention comprises the following modules:
[0075] Data acquisition module: used to acquire data required for prediction, the data required for prediction includes measurement errors of some charging piles in the charging station during the time period to be tested, the data required for prediction also includes one, two or more of factory errors of all charging piles in the charging station, voltage fluctuations of the distribution network during the time period to be tested, product batch failure rates corresponding to all charging piles, and cumulative operating time of all charging piles;
[0076] Metering error prediction module: used to input the data required for prediction into the trained machine learning algorithm model to predict the metering error of the entire charging station within the test time period.
[0077] The device is actually a computer solution to the charging pile error prediction method based on particle swarm optimization long short-term memory neural network introduced in the above method embodiment. The specific steps, principles and beneficial effects of the method have been described in detail in the method embodiment, and will not be repeated in this embodiment.
[0078] Computer readable storage medium embodiment:
[0079] A computer-readable storage medium of the present invention stores a computer program thereon, and when the computer program is executed, the steps of the charging pile error prediction method based on particle swarm optimization long short-term memory neural network as described in the method embodiment are implemented. The specific steps, principles and beneficial effects of the method have been described in detail in the method embodiment, and will not be repeated in this embodiment.
Claims
1. A charging pile error prediction method based on particle swarm optimization long short-term memory neural network, characterized in that: The method comprises the following steps: Acquire data required for prediction, the data required for prediction includes measurement errors of some charging piles in the charging station during the time period to be tested, the data required for prediction also includes one, two or more of factory errors of all charging piles in the charging station, voltage fluctuations of the distribution network during the time period to be tested, product batch failure rates corresponding to all charging piles, and cumulative operating time of all charging piles; The data required for prediction is input into the trained machine learning algorithm model to predict the metering error of the charging station during the test period.
2. The charging pile error prediction method based on particle swarm optimization long short-term memory neural network according to claim 1 is characterized in that: The machine learning algorithm model is an improved long short-term memory neural network model obtained by improving the classic long short-term memory neural network model, and the improvement includes using a heuristic search algorithm to optimize the hyperparameters in the model.
3. The charging pile error prediction method based on particle swarm optimization long short-term memory neural network according to claim 2 is characterized in that: The heuristic search algorithm is an improved particle swarm algorithm obtained by improving the classical particle swarm algorithm, and the improvement includes using a dynamic inertia weight formula to update the inertia weight of the improved particle swarm algorithm; the dynamic inertia weight formula is as follows: Among them, w(k) is the inertia weight at the kth iteration, w max is the maximum value of the inertia weight, w min is the minimum value of the inertia weight, k max is the maximum number of iterations, that is, the upper limit of the number of iterations before the algorithm terminates, and k is the current number of iterations.
4. The charging pile error prediction method based on particle swarm optimization long short-term memory neural network according to claim 2 is characterized in that: The heuristic search algorithm is an improved particle swarm algorithm obtained by improving the classical particle swarm algorithm, and the improvement includes using an elite retention strategy to retain particles after the positions of all particles in the particle swarm are updated to participate in the next iteration; the elite retention strategy is to screen out particles with better fitness and retain them to the next generation.
5. The charging pile error prediction method based on particle swarm optimization long short-term memory neural network according to claim 2 is characterized in that: The heuristic search algorithm is a classical particle swarm algorithm.
6. The charging pile error prediction method based on particle swarm optimization long short-term memory neural network according to claim 1 is characterized in that: The machine learning algorithm model is a classic long short-term memory neural network model.
7. The charging pile error prediction method based on particle swarm optimization long short-term memory neural network according to any one of claims 1 to 6, characterized in that: The training data for training the machine learning algorithm model is the training data after random noise is added.
8. A charging pile error prediction system based on particle swarm optimization long short-term memory neural network, comprising a processor, characterized in that: The processor is used to execute a computer program to implement the steps of the charging pile error prediction method based on particle swarm optimization long short-term memory neural network as described in any one of claims 1-7.
9. A charging pile error prediction device based on particle swarm optimization long short-term memory neural network, characterized in that: Includes the following modules: Data acquisition module: used to acquire data required for prediction, the data required for prediction includes measurement errors of some charging piles in the charging station during the time period to be tested, the data required for prediction also includes one, two or more of factory errors of all charging piles in the charging station, voltage fluctuations of the distribution network during the time period to be tested, product batch failure rates corresponding to all charging piles, and cumulative operating time of all charging piles; Metering error prediction module: used to input the data required for prediction into the trained machine learning algorithm model to predict the metering error of the entire charging station within the test time period.
10. The charging pile error prediction device based on particle swarm optimization long short-term memory neural network according to claim 9 is characterized in that: The machine learning algorithm model is an improved long short-term memory neural network model obtained by improving the classic long short-term memory neural network model, and the improvement includes using a heuristic search algorithm to optimize the hyperparameters in the model.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed, the steps of the charging pile error prediction method based on particle swarm optimization long short-term memory neural network as described in any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Charging pile data transmission method
CN120781175A
