Dynamic pricing, as a demand-side management technique, can achieve equilibrium changes in electricity consumption by influencing customers’ electricity consumption, and an asymmetric Stackelberg game can be used in the process of dynamic pricing of electricity to achieve an equilibrium in electricity consumption and improve transaction utility. Therefore, this paper constructs a real-time dynamic pricing model based on an asymmetric Stackelberg game, in which there are two participants in the electricity trading process, i.e., the power company and the customer. The power company is responsible for generating electricity and selling it to its customers. To ensure a stable supply of electricity, the power company issues a certain number of incentives to encourage customers to adjust their electricity consumption. As rational individuals in the trading process, both power companies and customers are selfish.
To improve the trading utility and adjust the distribution of electricity consumption, in this section, we constructed an asymmetric game model based on cost and demand to simulate the process of calculating the optimal price by collaboration between the trading parties. Meanwhile, we divide the day into different periods to develop a dynamic pricing strategy. By solving the Nash equilibrium for each period, the optimal price and optimal trading volume can be obtained. As the input parameters of the model, the electricity demand must be accurately forecasted. To improve the accuracy of the demand forecasting results, in this section, we use the Sarima-Ann hybrid intelligent forecasting model to forecast the electricity demand, which can ensure the accuracy of the electricity forecasting results. After using the collaborative game calculation scheme in this paper, the peak electricity consumption of customers decreases, i.e., the electricity consumption achieves an equilibrium distribution, the utility of electric companies and customers increases, and the total social welfare increases.
4.2. Composition of Electricity Costs
To maximize the utility of both parties, the power company needs to consider the costs paid when setting prices. These costs include marginal cost , load fluctuation cost and incentive cost .
Marginal cost : Marginal cost refers to the cost incurred by the power company to meet basic power generation and other needs. The higher the marginal cost, the higher the corresponding electricity price. Additionally, there is a quadratic function relationship between the marginal cost and electricity consumption [
42], which can be expressed as:
Load fluctuation cost : Fluctuation cost refers to the extra cost paid by the power company due to the fluctuation of power consumption. This cost is related to the fluctuation of power usage, and the greater the fluctuation of power usage, the greater the cost. The user load fluctuation function
in stage
k shows the extra cost that the power company needs to bear due to the load fluctuation in stage
k [
16], which should be as low as possible. In this scheme, we calculate the average daily power demand
according to the predicted power demand, and
can be expressed as:
Then, the load fluctuation cost is calculated according to the average total power demand of one day, which can be expressed as:
represents the load fluctuation coefficient, and different power companies in different regions have different load fluctuation coefficients.
The overall user load fluctuation function can be expressed as:
The power company wants this function to be as low as possible. In different electricity markets, the coefficient will take different values.
Incentive cost : The incentive cost
represents the expenses paid by the power company to motivate users to participate in peak shaving, and the cost can be expressed as:
Among them, represents the incentive rate, and represents the electricity consumption in the kth stage before the dynamic price strategy of this scheme is used. The more obvious the load transfer, the higher the incentive amount obtained by the user.
4.3. Electricity Demand Forecast Based on Sarima-Ann Hybrid Model
In this paper, we assume that all electricity consumers have smart meters through which their electricity transaction data will be uploaded to the power company [
43]. After the power company collects the customers’ electricity transaction data, it can use the data to forecast the future electricity demand of customers, and the forecast results can guide the generation and pricing process. We regard electricity demand as an input parameter of the dynamic pricing model, and the price is guided by the electricity demand. Understanding the changes in electricity demand can guide power plants to control the amount of electricity generated. By accurately predicting the user demand for a certain period, the output result of the pricing model can be more accurate, and the effect of reducing the power peak and improving the transaction utility of both parties of the power transaction can be better achieved. In this paper, we use the Sarima-Ann hybrid model to forecast the electricity demand and achieve better forecasting accuracy than the traditional Arima forecasting model and Sarima model.
Electricity demand forecasting model Sarima-Ann:
The Sarima-Ann hybrid model in this paper uses the prediction results of the Sarima model and its error as the input of the Ann model training set and uses the widely used BP neural network in Ann to predict the prediction error of the Sarima model. The Sarima prediction error is the nonlinear part of the data, and the Ann model finds the law of the nonlinear part by learning from the data.
The hybrid model can use the actual data of a certain time in the past day (or days) to predict the data of a certain time in the next day. In the hybrid model, Sarima predicts the next day according to the historical actual power demand data, and the linear part of the data can be obtained. Ann can predict the nonlinear part of the data by learning the rules of the prediction results and prediction errors of the Sarima model. That is, first use the Sarima model to make predictions to obtain a prediction result, and then use the Ann model to predict the error of this result. Combining the two can obtain a more accurate prediction result.
To improve the prediction accuracy, in this paper, we use the rolling prediction method, which requires the model to update the latest actual data to the training data set constantly, so we can obtain more accurate results.
The Sarima-Ann algorithm for power trading in this paper is designed as follows.
The process of forecasting power demand by the Sarima model is shown in Algorithm 1.
Algorithm 1: Sarima algorithm for electricity demand forecasting |
Input: Historical power actual transaction dataset L Output: Predicted power demand data D, prediction error E Initialization:, , , , , , model = 1: Perform a white noise test on L 2: Perform stationarity test and differentiate on L 3: 4: for p in : for d in : for q in : for P in : for D in : for Q in : 5: do 6: 7: end for 8: //Assign the combination of parameters corresponding to to the Sarima model 9: Use to predict the electricity demand to obtain the prediction result data set D 10: Subtract the prediction result from the actual power usage value to obtain the prediction error data E 11: save D, E
|
Step 1: Obtain actual historical electricity transaction data and initialize the model parameters.
Step 2: Preprocess the time series. When using the Sarima model for forecasting, the time series used for forecasting must be a stationary non-white noise time series, so it is necessary to first perform a white noise test and smoothness test on the obtained electricity data. If the series is a white noise series, then the power data are useless and need to be discarded. If the power data form a non-stationary time series, the series is differenced until the series is smooth. When performing the white noise test, this scheme uses the Ljung–Box method, and when the p_value value of the result is less than 0.01, the sequence is proven to be a non-white noise sequence and can be processed subsequently. When conducting the smoothness test, this scheme uses the ADF test, and when the p_value value of the test result is less than 0.01, the series is proved to be smooth; otherwise, the difference is performed until the series is smooth. This procedure corresponds to lines 1–2 of Algorithm 1.
Step 3: Build the Sarima model. The optimal parameters of the Sarima model are determined by calculating the Bayesian information criterion (bic) values. It is known that the smaller the bic value is, the better the model effect is, then this scheme calculates the bic value under different parameter combinations by traversing the parameters, and then finds the most effective parameter combination as the parameters of the final Sarima model to construct the Sarima model. This procedure corresponds to lines 3–8 in Algorithm 1.
Step 4: Model training and prediction. After the Sarima model is built, historical electricity transaction data are used as the training data set to forecast future electricity demand. A rolling forecast method is used here, where the latest acquired data are updated into the training data before each forecast. Since the training data used for each forecast are the most recent, better forecasting results can be achieved. This procedure corresponds to line 9 in Algorithm 1.
Step 5: Save the power demand forecast results and forecast errors. The difference between the power demand forecast result of the Sarima model and the actual power consumption value is taken as the forecast error, and the power demand forecast result and the forecast error of the Sarima model for each period are saved. This procedure corresponds to lines 10–11 in Algorithm 1.
The process of the Ann model predicting the prediction error of the Sarima model is shown in Algorithm 2:
Algorithm 2: Ann algorithm for forecasting the power demand forecasting error of Sarima model |
Input: Power demand data set D predicted by Sarima and prediction error data set E Output: Future prediction error 1: Determine the input x and output y of the training set. 2: Determine the model parameters, including the learning rate number of cycles, activation function, number of hidden layers, number of hidden layer neurons, number of input features, the number of output features and the number of samples. 3: Train the model. 4: Use the trained model to predict the error value to obtain .
|
Step 1: Obtain the power demand forecast result and forecast error of the Sarima model.
Step 2: Determine the training set of the Ann model. In this scheme, the 12 metrics in
Table 5 were selected as the input data for the training set of the Ann model, and the prediction error of the prediction day is taken as the output data of the training set.
Step 3: Set the parameters for the Ann model. The main parameters include the learning rate, the number of cycles, the activation function, the number of hidden layers, the number of neurons in the hidden layer, the number of input features, the number of output features, and the number of samples. At the beginning of this scheme, the hyperbolic tangent function tahf() is used as the activation function of the Ann model, the learning rate is set to 0.000348, the number of cycles is set to 90,000, and the number of hidden layers is set to 1, and the number of neurons in the hidden layer is set to 169. The number of input features is 12, the number of output features is 1, and the number of samples is 7 × N. That is, seven days of historical power usage data are selected as samples. In this scheme, the structure diagram of the Ann model can be represented as shown in
Figure 3:
Where , … represent input features and y represents output features.
Step 4: Use the training data set to train the model. The specific process is as follows:
(1) Select the training data set. The training data are divided into input data and output data.
(2) Choose an example from the training dataset and feed the input data into the network.
(3) Each layer in the network calculates and outputs the data and uses it as the input of the next layer, and the final data are aggregated to the output layer, which is the prediction result.
(4) Calculate the difference between the predicted result and the actual result. That is the error.
(5) Backpropagation according to the error. Reverse the calculation from the output layer to the first hidden layer and re-adjust the connection weights of each neuron in each layer to make the error develop in a decreasing direction.
(6) Repeat the above steps until the specified number of cycles is reached.
Step 5: Perform power demand prediction on the input test data of the trained Ann model to obtain the error value of the power demand forecast.
Finally, the power demand forecast result of the Sarima model is combined with the error forecast result of the Ann model, and the power demand forecast value of the hybrid model Sarima-Ann is obtained. We use the mean absolute error MAE, mean absolute percentage error MAPE, mean square error MSE, root mean square error RMSE, and R-square to calculate the accuracy of the prediction results of the mixed model.