Short-term power load prediction method for optimizing Elman neural network based on chicken flock algorithm
By using flock algorithms to optimize the Elman neural network in short-term power load prediction, the problem of insufficient prediction accuracy and stability in the prior art is solved, and higher prediction accuracy and stability are achieved.
Patent Information
- Application Number
- CN202411853206.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-03-25
AI Technical Summary
The prior art has problems of insufficient accuracy and stability in short-term power load prediction, especially prediction models based on neural network algorithms are prone to fall into local optimization, affecting prediction performance.
A short-term power load prediction method based on the flock algorithm is adopted to optimize the Elman neural network, and a short-term power load prediction model of the Elman neural network is used to optimize the initial weight and threshold of the Elman neural network by using the flock algorithm to build a CSO-Elman short-term power load prediction model to improve the accuracy and stability of the prediction.
By optimizing the initial weight and threshold, the accuracy and stability of short-term power load prediction are improved, and the shortcomings of traditional methods in nonlinear fit are overcome.
Smart Images

Figure CN119692558A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of power load forecasting, and in particular to a short-term power load forecasting method based on a chicken swarm algorithm to optimize an Elman neural network. Background Art
[0002] As the basis of power system planning and dispatching, power load forecasting can help the power system maintain supply and demand balance and ensure the safety of power operation. Short-term load forecasting refers to the forecast of system load in the next few days or hours. As an important issue in the power field, it has always attracted the attention of many researchers. Accurate and stable short-term load forecasting is directly related to the formulation of the system's day-ahead dispatching plan, which can effectively reduce the production cost of generator sets, has high economic and social benefits, and is of great significance to the safe and stable operation of energy management systems.
[0003] Short-term power load forecasting is a typical time series forecasting problem. It is often affected by many factors such as policy regulation, meteorology and economy, and is difficult to describe using traditional linear mathematical expressions. In order to solve this problem, neural network algorithms with arbitrary nonlinear mapping capabilities from input to output are applied to short-term power load forecasting. However, the prediction model based on the neural network algorithm has problems such as being prone to local optimality, which affects the prediction performance of the model. Therefore, a short-term power load forecasting method based on the chicken swarm algorithm to optimize the Elman neural network is designed. The chicken swarm algorithm is used to optimize the initial weights and thresholds of the Elman neural network, thereby improving the accuracy and stability of the prediction.
[0004] The Chinese patent application number CN202310232162.7 discloses a short-term power load forecasting method based on an improved feedforward neural network model. The method includes an input layer, an enhanced hidden layer and an output layer. The enhanced hidden layer includes several transient hidden layers. The load information label autoencoder is used to determine the load form, and the extreme learning machine method is used to guide learning and extract load characteristics. The improved long short-term memory neural network is used as the transient hidden layer. Different transient hidden layers can capture and mine the diversity of load data. Finally, the output of the enhanced hidden layer is formed by aggregation, and the load forecast value is finally generated in the output layer. The model used in this method is based on a feedforward artificial neural structure. It does not use a high-performance optimizer to optimize the initial network parameters of the model. It is easy to fall into local optimality and other problems when performing short-term load forecasting.
[0005] The Chinese patent application number CN202011128170.X discloses a user power load forecasting method based on LSTM-BP neural network. The method first obtains the required user historical power consumption and various influencing factor data from the power grid information collection system; uses the entropy weight method to calculate the weights of the diversified key information indicators of the user power load value to obtain the key influencing factors of the user power consumption forecast; uses the LSTM neural network and the BP neural network to perform step-by-step calculations, and trains the LSTM output as the BP input to obtain the user load forecast value. This method trains the LSTM output as the BP input, establishes a forecasting model by combining the LSTM neural network with the BP neural network, does not take into account the heterogeneity of the short-term load curve when constructing the model input feature set, and does not use the clustering algorithm to mine the power consumption pattern information in the original load sequence, so that the accuracy and stability of the short-term load model forecast cannot be guaranteed. Summary of the invention
[0006] The purpose of the present invention is to provide a short-term power load forecasting method based on chicken swarm algorithm to optimize Elman neural network, which is beneficial to improving the accuracy and stability of short-term power load forecasting.
[0007] In order to achieve the above-mentioned purpose, the technical solution adopted by the present invention is: a short-term power load forecasting method based on the chicken swarm algorithm to optimize the Elman neural network, using the Elman neural network with local memory units and local feedback connections to establish a prediction model, and using the chicken swarm algorithm CSO with global search capability to optimize the initial weights and thresholds of the Elman neural network to construct a CSO-Elman short-term power load forecasting model; then, the CSO-Elman short-term power load forecasting model is trained; finally, the trained CSO-Elman short-term power load forecasting model is used to perform short-term power load forecasting.
[0008] Further, the method comprises the following steps:
[0009] Step 1: Collect the power load data of the entire substation through smart meters and perform data preprocessing on it; fill in missing values, select and eliminate outliers, and use the Laida criterion to make judgments to improve the accuracy of data preprocessing;
[0010] Step 2: Apply the K-means clustering algorithm to cluster the power load data and divide different typical daily power consumption scenarios to classify and analyze load curves with different characteristics;
[0011] Step 3: Normalize the power load data;
[0012] Step 4: Initialize the parameters of the CSO-Elman short-term power load forecasting model;
[0013] Step 5: Define the error function of the Elman neural network as the fitness function of the chicken swarm algorithm;
[0014] Step 6: When solving the optimization problem, each individual in the flock corresponds to a solution to the optimization problem; the flock hierarchy is determined according to the fitness values of the individuals in the flock, that is, the individuals with the highest fitness values are set as roosters, the individuals in the middle are set as hens, and the individuals with the lowest fitness values are set as chicks; the rooster-hen-chicken hierarchy, the rooster-hen mate relationship, and the hen-chicken mother-child relationship remain unchanged within G generations and are updated after each G iteration;
[0015] Step 7: Import the optimized optimal initial weights and thresholds into the Elman neural network to construct a CSO-Elman short-term power load forecasting model;
[0016] The data obtained and processed in steps 1-3 are divided into a training set and a test set according to a set ratio; the load value at time k d days before the forecast date is input, and the load value at time k on the forecast date is output, and the CSO-Elman short-term power load forecasting model is iteratively trained using the training set until the stop condition is met; the trained CSO-Elman short-term power load forecasting model is tested using the test set;
[0017] Step 8: Use the trained and tested CSO-Elman short-term power load forecasting model to perform short-term power load forecasting.
[0018] Furthermore, in step 1, missing values are supplemented, including discarding, completing, true value conversion, and feature selection;
[0019] The process of using the Laida criterion for judgment is as follows:
[0020] Assume that a set of collected power load data is X = {X i |i=1,2,…,n},X i is the i-th sample data in the group of power load data, n is the number of data samples, then the mean value of the power load data is:
[0021]
[0022] The absolute value of the difference between the sample data and the mean is:
[0023]
[0024] The standard deviation of the sample data is:
[0025]
[0026] When the absolute value of the difference between the sample data and the mean exceeds 3 times the standard deviation, as shown in formula (4) and formula (5), the sample data is considered to be abnormal data and is eliminated according to the Laida criterion;
[0027]
[0028] At the same time, considering that using the mean or mode of sample data to fill missing values will underestimate the variance of the load series, the power load data at the same time of the previous day are used to fill missing values.
[0029] Further, step 2 includes the following steps:
[0030] Step 2.1: Use the K-means clustering algorithm to perform cluster analysis on the power load data. First, set the initial cluster number K and the corresponding initial cluster center C, and calculate the distance from the initial cluster center to the remaining data objects; use the Euclidean distance as the distance function of the K-means clustering algorithm, as shown in formula (6):
[0031]
[0032] In the formula, d(X,C) represents the distance from sample data X to cluster center C;
[0033] Step 2.2: Calculate the similarity based on the Euclidean distance and assign the target data with the highest similarity to the cluster center C to the corresponding cluster;
[0034] Step 2.3: After all the data are assigned to K clusters, the load data in the k clusters are averaged to form a new cluster center C, and iterative calculation is performed; if the cluster center value does not change, the algorithm iteration is stopped to output the clustering result; otherwise, return to step 2.2 to continue iterating until the termination condition is reached.
[0035] Furthermore, the implementation method of step 3 is:
[0036] Normalize the power load data and convert the load data X i (i=1,2,…,n) is normalized to the interval [0,1], and the normalization formula is:
[0037]
[0038] Among them, X min and X min Represents the power load data X i The minimum and maximum values in X nor is the normalized load data.
[0039] Furthermore, the implementation method of step 4 is:
[0040] Initialize the initial weights, thresholds, learning training parameters and training stop conditions of the Elman neural network, and initialize the relevant parameters of the CSO algorithm, including the population size N and the number of roosters N R 、Number of hens H 、N number of chicks C , the update algebra G of the chicken swarm, the maximum number of function evaluations MAX_Fes and the search step FL; randomly generate N chicken swarm individuals P = (P1, P2, ..., PN), and the spatial dimension D of the population is the number of weights and thresholds to be optimized in the Elman neural network.
[0041] Furthermore, the implementation method of step 5 is:
[0042] The error function of the Elman neural network is defined as the fitness function of the chicken swarm algorithm, as shown in the following formula:
[0043]
[0044] Where y(k) and Y(k) are the actual load value and the predicted load value respectively.
[0045] Further, step 6 includes the following steps:
[0046] Step 6.1: Define the search dimension D of the chicken swarm algorithm as the number of weights and thresholds to be optimized in the Elman neural network; generate N chicken individuals in the D-dimensional search space, and the individual positions represents the value of the jth dimension of the i-th individual at the t-th iteration, i∈[{1,…,N],j∈[1,…,D];
[0047] Step 6.2: Calculate the fitness value of N individuals in the chicken group according to formula (8), initialize the individual optimal and global optimal, and set the initial iteration number t to 1;
[0048] Step 6.3: Update the hierarchical structure of the swarm algorithm every G generations, sort the fitness values of the individuals in the swarm, and then determine the hierarchy, sub-group division, and mother-child relationship of the swarm;
[0049] Step 6.4: The individual chickens update their positions as follows:
[0050] If the i-th individual is a rooster, the following search equation is used:
[0051]
[0052] Among them, randn(0,σ 2 ) means the mean is 0 and the variance is σ2 is a Gaussian distributed random number; ε is a small constant to avoid zero division errors; f i and f k Respectively represent the fitness values of the i-th rooster and the k-th rooster, and k≠i;
[0053] If the i-th individual is a hen, it follows the rooster with index r1 to forage, and its search equation is:
[0054]
[0055] Where c1 and c2 are learning factors; rand is a random number uniformly distributed on [-1,1]; r1 represents the rooster in the subgroup where the i-th hen is located; r2 is a rooster or hen randomly selected from the entire chicken group, and r1≠r2≠i;
[0056] If the i-th individual is a chick, it follows the hen with index m to forage, and its search equation is:
[0057]
[0058] Where m is the hen corresponding to the i-th chick; FL is a random number uniformly distributed on [0,2];
[0059] Step 6.5: Calculate the fitness value of each individual in the population after the position is updated, and update the individual's optimal P i =(P i1 ,P i2 ,…,P iD ) and the global optimal P g =(P g1 ,P g2 ,…,P gD );
[0060] Step 6.6: Iterate the chicken swarm algorithm, update the position of the jth dimension of the i-th individual in the population according to formulas (9)-(14), and record the optimal initial weight threshold matrix of the Elman neural network represented by the global optimal individual;
[0061] Step 6.7: If the current number of iterations reaches the set maximum number of stops or reaches the minimum error requirement, the iteration is stopped and the optimal individual position in the population is output as the optimal initial weight and threshold of the Elman neural network; otherwise, go to step 6.3 to continue execution.
[0062] Furthermore, the implementation method of step 7 is:
[0063] The nonlinear state space expression of the Elman neural network is:
[0064] y(k)=g(w3x0(k)) (15)
[0065] x0(k)=f(w2x c (k)+w1u(k-1)) (16)
[0066] x c (k) = x0(k-1) (17)
[0067] Among them, w1, w2, w3 represent the connection weights from the input layer to the hidden layer, from the receiving layer to the hidden layer, and from the hidden layer to the output layer, respectively; the functions g() and f() represent the transfer function of the output neuron and the transfer function of the hidden layer neuron, respectively; K represents the time, Y(k) represents the output vector; x0 is the hidden layer node vector; u represents the input vector.
[0068] The error propagation of the Elman neural network is shown in formula (18):
[0069]
[0070] Where Y(k) is the target output vector;
[0071] The Elman neural network is iteratively trained according to formula (18) until the stopping condition is met.
[0072] Compared with the prior art, the present invention has the following beneficial effects:
[0073] 1) Aiming at the problem of insufficient accuracy and stability of the traditional short-term power load forecasting method based on statistical theory, the present invention establishes a short-term load hybrid forecasting model based on the Elman neural network with local memory units and local feedback connections, thus overcoming the shortcoming that the back propagation neural network cannot effectively process the correlation information between time series.
[0074] 2) The present invention takes into account the impact of random selection of initial weight thresholds on the prediction accuracy of the Elman neural network model, utilizes a swarm algorithm with global search capability to optimize the hyperparameters of the network, and proposes a CSO-Elman hybrid prediction model, which effectively integrates the advantages of intelligent optimization technology and neural network algorithms, thereby improving the accuracy and stability of short-term load forecasting. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] Figure 1 is a flow chart of a method implementation of an embodiment of the present invention;
[0076] Figure 2 is a topological diagram of a commercial substation area of a power grid in an embodiment of the present invention;
[0077] Figure 3 is a flow chart of a K-means clustering algorithm in an embodiment of the present invention;
[0078] Figure 4 is a flow chart of a chicken swarm algorithm according to an embodiment of the present invention;
[0079] Figure 5 : is a topological structure diagram of the Elman neural network in an embodiment of the present invention;
[0080] Figure 6 This is a load data diagram of a commercial substation on July 1, 2017 in an embodiment of the present invention. DETAILED DESCRIPTION
[0081] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0082] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present application belongs.
[0083] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0084] The accuracy of short-term load forecasting models is of great significance to the safety and stability of power systems. As a random, non-stationary time series, short-term power load forecasting is affected by many factors such as policy regulation, meteorology and economy. It is difficult to describe it with traditional linear mathematical expressions. Establishing an accurate load forecasting model still faces great challenges. Traditional forecasting methods based on statistical theory are relatively simple and cannot effectively reflect the nonlinear change law of load.
[0085] In order to solve the above problems, this embodiment provides a short-term power load forecasting method based on the chicken swarm algorithm to optimize the Elman neural network. First, in view of the low accuracy of the traditional feedforward neural network in solving time series prediction problems, an Elman neural network with local memory units and local feedback connections is used to establish a prediction model; then, the chicken swarm algorithm CSO with global search capability is used to optimize the initial weights and thresholds of the Elman neural network to construct a CSO-Elman short-term power load forecasting model; then, the CSO-Elman short-term power load forecasting model is trained; finally, the trained CSO-Elman short-term power load forecasting model is used to perform short-term power load forecasting. This method effectively solves the shortcomings of the traditional prediction model in solving nonlinear fitting problems and improves the accuracy and stability of short-term load forecasting.
[0086] like Figure 1 As shown, the specific implementation steps of this method are as follows.
[0087] Step 1: Collect the power load data of the entire substation through smart meters and perform data preprocessing on it, including filling in missing values and selecting and eliminating outliers, and then use the Laida criterion to make judgments to improve the accuracy of data preprocessing.
[0088] In this embodiment, the load forecast object is a single commercial substation in the urban power grid of the power system. Figure 2 It is a topological diagram of the commercial substation of the power grid in this embodiment. First, the smart meter installation point is set at the smart distribution terminal in the substation to collect the load data of the entire substation. Then, the power load data with a granularity of 1 hour collected by the smart meter is preprocessed. The missing values are supplemented by discarding, completing, true value conversion and feature selection. When selecting and eliminating outliers, the Laida criterion is used to judge to improve the accuracy of data preprocessing.
[0089] The process of using the Laida criterion for judgment is as follows.
[0090] Assume that a set of collected power load data is X = {X i |i=1,2,…,n},X i is the i-th sample data in the group of power load data, n is the number of data samples, then the mean value of the power load data is:
[0091]
[0092] The absolute value of the difference between the sample data and the mean is:
[0093]
[0094] The standard deviation of the sample data is:
[0095]
[0096] When the absolute value of the difference between the sample data and the mean exceeds 3 times the standard deviation, as shown in formula (4) and formula (5), the sample data is considered to be abnormal data and is eliminated according to the Laida criterion;
[0097]
[0098] At the same time, considering that using the mean or mode of sample data to fill missing values will underestimate the variance of the load series, the power load data at the same time of the previous day are used to fill missing values.
[0099] Step 2: Use the K-means clustering algorithm to cluster the power load data and divide it into different typical daily power consumption scenarios to classify and analyze load curves with different characteristics. The implementation process of the K-means clustering algorithm is as follows: Figure 3 shown.
[0100] Step 2.1: Use the K-means clustering algorithm to perform cluster analysis on the power load data. First, set the initial cluster number K and the corresponding initial cluster center C, and calculate the distance from the initial cluster center to the remaining data objects; use the Euclidean distance as the distance function of the K-means clustering algorithm, as shown in formula (6):
[0101]
[0102] Where d(X,C) represents the distance from sample data X to cluster center C.
[0103] Step 2.2: Calculate the similarity based on the Euclidean distance and assign the target data with the highest similarity to the cluster center C to the corresponding cluster.
[0104] Step 2.3: After all the data are assigned to K clusters, the load data in the k clusters are averaged to form a new cluster center C, and iterative calculation is performed; if the cluster center value does not change, the algorithm iteration is stopped to output the clustering result; otherwise, return to step 2.2 to continue iterating until the termination condition is reached.
[0105] Step 3: Normalize the power load data.
[0106] In order to eliminate the problem caused by inconsistent dimensions, the power load data is normalized and the load data X i (i=1,2,…,n) is normalized to the interval [0,1], and the normalization formula is:
[0107]
[0108] Among them, X min and X min Represents the power load data X i The minimum and maximum values in X nor is the normalized load data.
[0109] Step 4: Initialize the parameters of the CSO-Elman short-term power load forecasting model.
[0110] Initialize the initial weights, thresholds, learning training parameters and training stop conditions of the Elman neural network, and initialize the relevant parameters of the CSO algorithm, including the population size N and the number of roosters N R 、Number of hens H 、N number of chicks C , the update algebra of the chicken group G, the maximum number of function evaluations MAX_Fes, the search step length FL, etc. Randomly generate N chicken individuals P = (P1, P2, ..., PN), and the spatial dimension D of the population is the number of weights and thresholds to be optimized in the Elman neural network.
[0111] Step 5: Define the error function of the Elman neural network as the fitness function of the chicken swarm algorithm. The specific formula is as follows:
[0112]
[0113] Where y(k) and Y(k) are the actual load value and the predicted load value respectively.
[0114] Step 6: When solving the optimization problem, each individual in the flock corresponds to a solution to the optimization problem. The hierarchy of the flock is determined according to the fitness values of the individuals in the flock, that is, the individuals with the highest fitness values are set as roosters, the individuals in the middle are set as hens, and the individuals at the bottom are set as chicks. The number of the three types of chickens is represented by the parameter N R 、N H and N C The hierarchical relationship between roosters, hens and chickens, the mate relationship between roosters and hens, and the mother-child relationship between hens and chickens remain unchanged within G generations and are updated after each G iteration. The implementation process of the chicken swarm algorithm is as follows Figure 4 shown.
[0115] Step 6.1: Define the search dimension D of the chicken swarm algorithm as the number of weights and thresholds to be optimized in the Elman neural network; generate N chicken individuals in the D-dimensional search space, and the individual positions represents the value of the j-th dimension of the i-th individual at the t-th iteration, i∈[{1,…,N],j∈[1,…,D].
[0116] Step 6.2: Calculate the fitness value fitness of N individuals in the chicken swarm according to formula (8), initialize the individual optimum and the global optimum, and set the initial number of iterations t to 1.
[0117] Step 6.3: Update the hierarchical structure of the swarm algorithm every G generations, sort the fitness values of the individuals in the swarm, and then determine the hierarchy, sub-group division, and mother-child relationship of the swarm.
[0118] Step 6.4: The individual chickens update their positions as follows:
[0119] If the i-th individual is a rooster, the following search equation is used:
[0120]
[0121] Among them, randn(0,σ 2 (mean is 0, variance is σ 2 is a Gaussian distributed random number; ε is a very small constant to avoid zero division errors; f i and f k They represent the fitness values of the i-th rooster and the k-th rooster respectively, and k≠i.
[0122] If the i-th individual is a hen, it follows the rooster with index r1 to forage, and its search equation is:
[0123]
[0124] Among them, c1 and c2 are learning factors; rand is a random number uniformly distributed on [-1,1]; r1 represents the rooster in the sub-group where the i-th hen is located; r2 is a rooster or hen randomly selected from the entire chicken flock, and r1≠r2≠i.
[0125] If the i-th individual is a chick, it follows the hen with index m to forage, and its search equation is:
[0126]
[0127] Among them, m is the hen corresponding to the i-th chick; FL is a random number uniformly distributed on [0,2].
[0128] Step 6.5: Calculate the fitness value of each individual in the population after the position is updated, and update the individual's optimal P i =(P i1 ,P i2 ,…,P iD ) and the global optimal P g =(P g1 ,P g2 ,…,P gD ).
[0129] Step 6.6: Iterate the chicken swarm algorithm, update the position of the jth dimension of the ith individual in the population according to formulas (9)-(14), and record the optimal initial weight threshold matrix of the Elman neural network represented by the global optimal individual.
[0130] Step 6.7: If the current number of iterations reaches the set maximum number of stops or reaches the minimum error requirement, the iteration is stopped and the optimal individual position in the population is output as the optimal initial weight and threshold of the Elman neural network; otherwise, go to step 6.3 to continue execution.
[0131] Step 7: Import the optimized optimal initial weights and thresholds into the Elman neural network to construct the CSO-Elman short-term power load forecasting model.
[0132] Elman neural network is a dynamic recurrent neural network with local memory units and local feedback connections. It is usually composed of an input layer, a hidden layer, a receiving layer, and an output layer. Its network topology is as follows: Figure 5 As shown in Figure 2. Based on the BP neural network, the Elman neural network adds the continuation layer as a delay operator to the hidden layer, making it more sensitive to historical data.
[0133] The nonlinear state space expression of the Elman neural network is:
[0134] y(k)=g(w3x0(k)) (15)
[0135] x0(k)=f(w2x c (k)+w1u(k-1)) (16)
[0136] x c (k) = x0(k-1) (17)
[0137] Among them, w1, w2, w3 represent the connection weights from the input layer to the hidden layer, from the receiving layer to the hidden layer, and from the hidden layer to the output layer, respectively; the functions g() and f() represent the transfer function of the output neuron and the transfer function of the hidden layer neuron, respectively; K represents the time, Y(k) represents the output vector; x0 is the hidden layer node vector; u represents the input vector.
[0138] The error propagation of the Elman neural network is shown in formula (18):
[0139]
[0140] Where Y(k) is the target output vector.
[0141] The Elman neural network is iteratively trained according to formula (18) until the stopping condition is met.
[0142] The data obtained and processed in steps 1-3 are divided into a training set and a test set in a ratio of 7:3. The load value at time k on the day before the forecast is input, and the load value at time k on the day of the forecast is output. The CSO-Elman short-term power load forecasting model is iteratively trained using the training set until the stop condition is met. Then, the trained CSO-Elman short-term power load forecasting model is tested using the test set.
[0143] Step 8: Use the trained and tested CSO-Elman short-term power load forecasting model to perform short-term power load forecasting.
[0144] The specific implementation method of the present invention is described in detail below with reference to data examples, and the specific implementation steps are as follows.
[0145] Step 1: Set the smart meter installation location at the smart distribution terminal in the commercial area of the power grid to collect the load data of the entire area in 2017. Then preprocess the power load data collected by the smart meter with a granularity of 1 hour. Preprocess all meter data. Fill missing values through discarding, completion, true value conversion and feature selection; use the Laida criterion to determine outliers. Take a set of load data collected on July 1, 2017 as X i (i=1,2,…,n) as an example, Figure 6 shown.
[0146]
[0147] According to formula (19), we can calculate X i The average value is 397.83kw.
[0148]
[0149] Depend on Figure 6 It can be seen that the load value of the 10th load data point is 1489.09kw. According to formula (20), the absolute value of the difference between the load data and the mean is |v i | is 1091.26kw.
[0150]
[0151] The standard deviation σ of the sample data is further calculated to be 243.75kw.
[0152]
[0153] According to the criteria of formula (22)-(23), 397.83+243.75*3=1091.27<1489.09, which meets the abnormal data elimination criteria of the Laida criterion, and the load data of 311.34kw at the same time of the previous day is used to fill the missing value. The load data for the whole year of 2017 are eliminated and filled according to the above criteria.
[0154] Step 2: Use the K-means clustering algorithm to cluster user load data and divide different typical daily electricity consumption scenarios to classify and analyze load curves with different characteristics.
[0155] Step 2.1: Use the K-means clustering algorithm to perform cluster analysis on the smart meter data. First, set the initial cluster number K = 2, that is, randomly select 2 data from the daily load sample data, take each time period of each data as the initial cluster center, and use the Euclidean distance as the distance function of the K-means clustering algorithm, as shown in formula (24):
[0156]
[0157] In the formula, d(X,C) represents the distance from the data sample point X to the cluster center C;
[0158] Step 2.2: Calculate the similarity based on the Euclidean distance and assign the target data with the highest similarity to the cluster center C to the corresponding cluster.
[0159] Step 2.3: After all the data are assigned to two clusters, the load data in the two clusters are averaged to form a new cluster center C; perform iterative calculations. If the cluster center value does not change, stop the algorithm iteration and output the clustering result, otherwise return to step 2.2 to continue iterating until the termination condition is reached. According to the calculation results, the 2017 annual load data set is divided into two typical load curves: spring and summer power load data from March 6 to July 23, 2017, a total of 20 weeks; autumn and winter power load data from January 2 to February 26, 2017, and October 2 to December 24, 2017, a total of 20 weeks.
[0160] Step 3: The collected power load data needs to be normalized to eliminate the problem caused by inconsistent dimensions. The input matrix of the Elman neural network is determined as: Where d represents the date of the forecast day, k is the time, and the forecast model output is Y(k). Let q = 12, that is, the load value at the same time 12 days before the forecast day is used to predict the load value at the same time on the 13th day. Normalized to the interval [0,1], the normalization formula is:
[0161]
[0162] Where X min and X min They represent the minimum and maximum values of the input load data X, respectively. nor is the normalized load data.
[0163] Step 4: Initialize the parameters of the CSO-Elman short-term load forecasting model. Define the Elman neural network with a single hidden layer. The number of neurons in the input layer is 12, and the number of neurons in the hidden layer and output layer is 8 and 1 respectively. The activation function of the network uses the sigmoid function, the maximum number of network training times is set to 1000, and the learning rate and minimum training error are set to 0.01 and 0.00001 respectively. Initialize the relevant parameters of the CSO algorithm, the population size N = 20, the number of roosters N = 0.2N, R , number of hens NH = 0.6N, R , number of chicks NC = 0.2N, update algebra G = 10, maximum number of function evaluations MAX_Fes = 500, search step length FL = rand (0.4, 0.9). Randomly generate 20 chicken individuals It represents the value of the jth dimension of the ith individual at the tth iteration. The spatial dimension D=113 of the population is the number of weights and thresholds to be optimized in the Elman neural network.
[0164] Step 5: Define the error function of the Elman neural network as the fitness function of the chicken swarm algorithm, as shown in the following formula:
[0165]
[0166] Where y(k) and Y(k) are the actual load value and the predicted load value respectively.
[0167] Step 6: Determine the hierarchy of the chicken group according to the fitness values of the chicken groups, that is, the individuals with the highest fitness values are set as roosters, the individuals in the middle are set as hens, and the individuals at the bottom are set as chicks. The role ratio parameter of the chicken group algorithm is N R =0.2N,N H =0.6N,N C =N―N R ―N H , the calculated numbers of roosters, hens and chicks are 4, 12 and 4 respectively. From step 4, we know that the Elman neural network has 113 initial weights and thresholds that need to be optimized, so the chicken swarm algorithm performs iterative operations according to the fitness function evaluation value determined by formula (26).
[0168] Step 6.1: Generate 20 chicken individuals in the 113-dimensional search space, and the individual positions Represents the value of the j-th dimension of the ith individual at the t-th iteration.
[0169] Step 6.2: Calculate the fitness value of each individual in the flock and initialize the individual optimal and global optimal Set the initial number of iterations t to 1.
[0170] Step 6.3: When the iteration round is t = 1, the population hierarchy structure is updated first. In the subsequent iteration rounds, the fitness values of the chicken individuals are sorted every G = 10 generations, and then the hierarchy, sub-group division and mother-child relationship of the chicken group are re-determined.
[0171] Step 6.4: The individual chickens update their positions as follows:
[0172] If the i-th individual is a rooster, the following search equation is used:
[0173]
[0174] Among them, randn(0,σ 2 ) means the mean is 0 and the variance is σ 2 is a Gaussian distributed random number; ε is a very small constant set to 0.00001 to avoid zero division errors; f i and f k They represent the fitness values of the i-th rooster and the k-th rooster respectively, and k≠i.
[0175] If the i-th individual is a hen, it follows the rooster with index r1 to forage, and its search equation is:
[0176]
[0177] Among them, c1 and c2 are learning factors; rand is a random number uniformly distributed on [-1,1]; r1 represents the rooster in the sub-group where the i-th hen is located; r2 is a rooster or hen randomly selected from the entire chicken flock, and r1≠r2≠i.
[0178] If the i-th individual is a chick, it follows the hen with index m to forage, and its search equation is:
[0179]
[0180] Among them, m is the hen corresponding to the i-th chick; FL is a random number uniformly distributed on [0,2].
[0181] Step 6.5: Calculate the fitness value of each individual in the population after the position is updated, and update the individual optimal and global optimal
[0182] Step 6.6: The chicken swarm algorithm is iterated, and the position of the jth dimension of the ith individual in the population is updated according to formulas (27)-(32) respectively, and the optimal initial weight threshold matrix of the Elman neural network represented by the global optimal individual is recorded.
[0183] Step 6.7: If the current number of iterations reaches the preset maximum number of 500 generations, stop the iteration and output the optimal individual position in the population; otherwise, go to step 6.3 to continue.
[0184] Step 7: Export the optimal individual position of the population calculated by the CSO algorithm and use it as the optimal initial weight and threshold of the Elman neural network; normalized load data It is used as the input of the CSO-Elman model for iterative training.
[0185] The nonlinear state space expression of the Elman neural network is:
[0186] y(k)=g(w3x0(k)) (33)
[0187] x0(k)=f(w2x c (k)+w1u(k-1)) (34)
[0188] x c (k) = x0(k-1) (35)
[0189] Among them, w1, w2, w3 represent the connection weights between the input layer to the hidden layer, the receiving layer to the hidden layer, and the hidden layer to the output layer, respectively, which are optimized by step 6; the functions g() and f() represent the transfer function of the output neuron and the transfer function of the hidden layer neuron, respectively, and both use sigmoid functions. K represents the time, Y(k) represents the output vector; x0 is the hidden layer node vector; Represents the input vector.
[0190] The error propagation function of the Elman neural network is shown in formula (36):
[0191]
[0192] Where Y(k) is the target output vector.
[0193] Step 8: The Elman neural network performs iterative training according to the error propagation function of formula (36) until the maximum number of network training times is 1000 or the minimum training error is 0.00001. The trained model is used for short-term load forecasting. Since the intelligent algorithm in the model has a randomization process, the average of the model's 5 predictions is used as the final prediction result. The prediction results are shown in the following table:
[0194]
[0195] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0196] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0197] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0198] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0199] The above is only a preferred embodiment of the present invention, and does not limit the present invention in other forms. Any technician familiar with the profession may use the above disclosed technical content to change or modify it into an equivalent embodiment with equivalent changes. However, any simple modification, equivalent change and modification made to the above embodiment according to the technical essence of the present invention without departing from the technical solution of the present invention still belongs to the protection scope of the technical solution of the present invention.
Claims
1. A short-term power load forecasting method based on chicken swarm algorithm to optimize Elman neural network, characterized in that: An Elman neural network with local memory units and local feedback connections is used to establish a prediction model, and the chicken swarm algorithm CSO with global search capability is used to optimize the initial weights and thresholds of the Elman neural network to construct a CSO-Elman short-term power load forecasting model; then, the CSO-Elman short-term power load forecasting model is trained; finally, the trained CSO-Elman short-term power load forecasting model is used to perform short-term power load forecasting.
2. According to claim 1, a short-term power load forecasting method based on chicken swarm algorithm to optimize Elman neural network is characterized in that: The following steps are involved: Step 1: Collect the power load data of the entire substation through smart meters and perform data preprocessing on it; fill in missing values, select and eliminate outliers, and use the Laida criterion to make judgments to improve the accuracy of data preprocessing; Step 2: Apply the K-means clustering algorithm to cluster the power load data and divide different typical daily power consumption scenarios to classify and analyze load curves with different characteristics; Step 3: Normalize the power load data; Step 4: Initialize the parameters of the CSO-Elman short-term power load forecasting model; Step 5: Define the error function of the Elman neural network as the fitness function of the chicken swarm algorithm; Step 6: When solving the optimization problem, each individual in the flock corresponds to a solution to the optimization problem; the flock hierarchy is determined according to the fitness values of the individuals in the flock, that is, the individuals with the highest fitness values are set as roosters, the individuals in the middle are set as hens, and the individuals with the lowest fitness values are set as chicks; the rooster-hen-chicken hierarchy, the rooster-hen mate relationship, and the hen-chicken mother-child relationship remain unchanged within G generations and are updated after each G iteration; Step 7: Import the optimized optimal initial weights and thresholds into the Elman neural network to construct a CSO-Elman short-term power load forecasting model; The data obtained and processed in steps 1-3 are divided into a training set and a test set according to a set ratio; the load value at time k d days before the forecast date is input, and the load value at time k on the forecast date is output, and the CSO-Elman short-term power load forecasting model is iteratively trained using the training set until the stop condition is met; the trained CSO-Elman short-term power load forecasting model is tested using the test set; Step 8: Use the trained and tested CSO-Elman short-term power load forecasting model to perform short-term power load forecasting.
3. According to claim 2, a short-term power load forecasting method based on chicken swarm algorithm to optimize Elman neural network is characterized in that: In step 1, missing values are supplemented, including discarding, completing, true value conversion and feature selection; The process of using the Laida criterion for judgment is as follows: Assume that a set of collected power load data is X = {X i |i=1,2,…,n},X i is the i-th sample data in the group of power load data, n is the number of data samples, then the mean value of the power load data is: The absolute value of the difference between the sample data and the mean is: The standard deviation of the sample data is: When the absolute value of the difference between the sample data and the mean exceeds 3 times the standard deviation, as shown in formula (4) and formula (5), the sample data is considered to be abnormal data and is eliminated according to the Laida criterion; At the same time, considering that using the mean or mode of sample data to fill missing values will underestimate the variance of the load series, the power load data at the same time of the previous day are used to fill missing values.
4. According to claim 3, a short-term power load forecasting method based on chicken swarm algorithm to optimize Elman neural network is characterized in that: Step 2 includes the following steps: Step 2.1: Use the K-means clustering algorithm to perform cluster analysis on the power load data. First, set the initial cluster number K and the corresponding initial cluster center C, and calculate the distance from the initial cluster center to the remaining data objects; use the Euclidean distance as the distance function of the K-means clustering algorithm, as shown in formula (6): In the formula, d(X,C) represents the distance from sample data X to cluster center C; Step 2.2: Calculate the similarity based on the Euclidean distance and assign the target data with the highest similarity to the cluster center C to the corresponding cluster; Step 2.3: After all the data are assigned to K clusters, the load data in the k clusters are averaged to form a new cluster center C, and iterative calculation is performed; if the cluster center value does not change, the algorithm iteration is stopped to output the clustering result; otherwise, return to step 2.2 to continue iterating until the termination condition is reached.
5. The short-term power load forecasting method based on chicken swarm algorithm optimization Elman neural network according to claim 4 is characterized in that: The implementation method of step 3 is: Normalize the power load data and convert the load data X i (i=1,2,…,n) is normalized to the interval [0,1], and the normalization formula is: Among them, X min and X min Represents the power load data X i The minimum and maximum values in X nor is the normalized load data.
6. The short-term power load forecasting method based on chicken swarm algorithm optimization Elman neural network according to claim 5 is characterized in that: The implementation method of step 4 is: Initialize the initial weights, thresholds, learning training parameters and training stop conditions of the Elman neural network, and initialize the relevant parameters of the CSO algorithm, including the population size N and the number of roosters N R 、Number of hens H 、N number of chicks C , the update algebra G of the chicken swarm, the maximum number of function evaluations MAX_Fes and the search step FL; randomly generate N chicken swarm individuals P = (P1, P2, ..., PN), and the spatial dimension D of the population is the number of weights and thresholds to be optimized in the Elman neural network.
7. The short-term power load forecasting method based on chicken swarm algorithm optimization Elman neural network according to claim 6 is characterized in that: The implementation method of step 5 is: The error function of the Elman neural network is defined as the fitness function of the chicken swarm algorithm, as shown in the following formula: Where y(k) and Y(k) are the actual load value and the predicted load value respectively.
8. The short-term power load forecasting method based on chicken swarm algorithm optimization Elman neural network according to claim 7 is characterized in that: Step 6 includes the following steps: Step 6.1: Define the search dimension D of the chicken swarm algorithm as the number of weights and thresholds to be optimized in the Elman neural network; generate N chicken individuals in the D-dimensional search space, and the individual positions represents the value of the jth dimension of the i-th individual at the t-th iteration, i∈[{1,…,N],j∈[1,…,D]; Step 6.2: Calculate the fitness value of N individuals in the chicken group according to formula (8), initialize the individual optimal and global optimal, and set the initial iteration number t to 1; Step 6.3: Update the hierarchical structure of the swarm algorithm every G generations, sort the fitness values of the individuals in the swarm, and then determine the hierarchy, sub-group division, and mother-child relationship of the swarm; Step 6.4: The individual chickens update their positions as follows: If the i-th individual is a rooster, the following search equation is used: Among them, randn(0,σ 2 ) means the mean is 0 and the variance is σ 2 is a Gaussian distributed random number; ε is a small constant to avoid zero division errors; f i and f k Respectively represent the fitness values of the i-th rooster and the k-th rooster, and k≠i; If the i-th individual is a hen, it follows the rooster with index r1 to forage, and its search equation is: Where c1 and c2 are learning factors; rand is a random number uniformly distributed on [-1,1]; r1 represents the rooster in the subgroup where the i-th hen is located; r2 is a rooster or hen randomly selected from the entire chicken group, and r1≠r2≠i; If the i-th individual is a chick, it follows the hen with index m to forage, and its search equation is: Where m is the hen corresponding to the i-th chick; FL is a random number uniformly distributed on [0,2]; Step 6.5: Calculate the fitness value of each individual in the population after the position is updated, and update the individual's optimal P i =(P i1 ,P i2 ,…,P iD ) and the global optimal P g =(P g1 ,P g2 ,…,P gD ); Step 6.6: Iterate the chicken swarm algorithm, update the position of the jth dimension of the i-th individual in the population according to formulas (9)-(14), and record the optimal initial weight threshold matrix of the Elman neural network represented by the global optimal individual; Step 6.7: If the current number of iterations reaches the set maximum number of stops or reaches the minimum error requirement, the iteration is stopped and the optimal individual position in the population is output as the optimal initial weight and threshold of the Elman neural network; otherwise, go to step 6.3 to continue execution.
9. The short-term power load forecasting method based on chicken swarm algorithm optimization Elman neural network according to claim 8 is characterized in that: The implementation method of step 7 is: The nonlinear state space expression of the Elman neural network is: y(k)=g(w3x0(k)) (15) x0(k)=f(w2x c (k)+w1u(k-1)) (16) x c (k)=x0(k-1) (17) Among them, w1, w2, w3 represent the connection weights from the input layer to the hidden layer, from the receiving layer to the hidden layer, and from the hidden layer to the output layer, respectively; the functions g() and f() represent the transfer function of the output neuron and the transfer function of the hidden layer neuron, respectively; K represents the time, Y(k) represents the output vector; x0 is the hidden layer node vector; u represents the input vector. The error propagation of the Elman neural network is shown in formula (18): Where Y(k) is the target output vector; The Elman neural network is iteratively trained according to formula (18) until the stopping condition is met.
Citation Information
Patent Citations
User electrical load prediction method based on LSTM-BP neural network
CN112329990A
A Short-Term Power Load Forecasting Method Based on an Improved Feedforward Neural Network Model
CN115952927B
Short-term load prediction method for optimizing Elman neural network based on sparrow search algorithm
CN113689029A
Ship heave compensation prediction method and device based on neural network, and storage medium
CN117312783A
Piston ring nitriding process quality control prediction method
CN118296940A
Cited By
Precise aeration method for optimizing BP neural network based on chicken flock algorithm
CN121063731A