#### Abstract

The optimization of microgrid is an important part of smart grid. The global energy consumption is seriously greater than the energy it has, and the environmental pollution brought by it should not be underestimated. If we want to reduce their impact, introducing the optimization of microgrid is a good solution. Short-term load forecasting is a very important prerequisite for microgrid optimization, which lays a solid foundation for the realization of the development goal of environmental protection and the improvement of the economic benefits of microgrid. In this paper, a Multi-PSO-SVM forecasting model is proposed to forecast the actual load. By simulating four prediction models with three different samples, we can see that the average predicted value and actual load value of Multi-PSO-SVM algorithm in the three different samples are almost less than 10 MV. Compared with the other three algorithms, Multi-PSO-SVM is superior in accurately predicting the load value at each time point, which provides important conditions for the success of microgrid optimization.

#### 1. Introduction

Traditional power generation is mostly achieved through the consumption of various energy sources, which will not only bring environmental problems, but also consume more nonrenewable resources, so the optimal scheduling of microgrid is very necessary. Microgrid mainly relies on renewable energy as the source to complete distributed generation, so it can be known that the pressure of environmental pollution is greatly reduced. Compared with other power generation modes, microgrid technology is independent, which can control and feed back the power quality and performance of power grids in different regions in time and make timely response. Its flexible installation point can make it popular all over the world. It can be installed all over the world, but nonrenewable resources such as wind and photovoltaic power have some disadvantages. They have a lot of randomness, uncertainty, and intermittence, which leads to uncontrollable output power, in addition to the need to ensure the balance between load supply and demand. In a sense, load forecasting is an essential step in the research of microgrid. In this paper, Multi-PSO-SVM forecasting model is proposed, which is unexpected in terms of forecasting accuracy and effect. We also carry out experiments with other three prediction models through experimental simulation. Through four line charts, we can see that our proposed prediction models have a very high degree of coincidence.

Literature [1] points out that it is relatively difficult to integrate photovoltaic solar power into the power grid because of the uncertainty brought by photovoltaic solar power generation, so we need to make accurate short-term prediction. At present, there are three kinds of hybrid prediction models based on intelligent technology. Based on three technologies, the wavelet transform, the particle swarm optimization to optimize some parameters, and the excellent prediction accuracy of support vector machine, we can accurately predict the power generation. Then, we also find that the simulation results are consistent with the conjecture, and this model has a high degree of coincidence with the accuracy obtained by our imagined model. Literature [2] suggests that distributed generation has many uncertainties and intermittence due to various shortcomings, so it proposes an SVM technology to predict wind power and optimize the whole model by combining two algorithms, PSO and SA. The model parameters are self-adaptive, and then it is found that the learning and adjusting model can make the prediction model track the fluctuation and change of wind power effectively, which makes an important contribution to improving the accuracy of predicting the total power supply capacity of microgrid. Literature [3] considers the advantages of chaos theory, so it combines it with prediction model, then improves particle optimization algorithm, and then complements chaos theory. Finally, a result of optimizing LSSVM parameters can be obtained. Through layered training, the prediction results show that this method not only reduces the possibility of algorithm falling into local extremum, but also improves the learning ability and prediction accuracy. Literature [4] clearly points out that the accuracy of forecasting makes it an important influence index of short-term load forecasting, Therefore, this paper proposes a technique to combine support vector machine and dragonfly algorithm, which uses two parameters of support vector machine as the searching position of dragonfly, while the current fitness value and the optimal position of dragonfly correspond to its prediction accuracy and optimal parameters, respectively. From the results of the test, we can clearly know that, compared with this algorithm, the steps are simple and the global search ability is strong with high prediction accuracy and fast calculation familiarity. Literature [5] shows that support vector machine (SVM) has excellent experimental performance, and its performance depends on the sufficient setting of its parameters. Therefore, choosing appropriate initial parameters of SVM plays an important role in obtaining good performance and classification effect. Through several experiments, it is proved that this experiment includes two vector parameter optimization techniques, network search and particle swarm optimization. It can be intuitively concluded that this method has higher accuracy than other methods. Literature [6] proposes a parallel time-varying particle swarm optimization algorithm, which can optimize the parameters and feature selection of support vector machines. In fact, in the parallel environment, the initial convergence problem of PSO algorithm mainly depends on virtual machines. On a composite set consisting of 30 benchmark data sets, compared with other methods, this method can not only get more suitable model parameters, discriminant feature subsets, and smaller SVs sets, but also significantly reduce the calculation time and have higher prediction accuracy. Literature [7] proposes that charging state is an important condition for microgrid in energy management system. Based on the regression principle of least square support vector machine (LSSVM), the LSSVM model is able to solve the problem of poor generalization performance of general battery models under different health conditions. When PSO is selected, the efficiency and precision of the model and the initial anticipation training are improved well. Through constant discharge experiment, AC discharge experiment, and different examples, it is proved that this new model provides a very good solution for microgrid energy management system. Literature [8], in order to evaluate the level of enterprise asset quality management in power grid, proposes a mitigation model combining least square support vector machine and particle swarm optimization algorithm, which can provide an important measurement reference for improving their level to a great extent. Literature [9] evaluates the optimal foraging algorithm (OFA) to optimize the key parameters of support vector machines and reduce classification errors by using six common benchmark data sets and using five optimization algorithms. From the result of experiment, we can clearly know that OFA-SVM algorithm has good effects and ability to find the optimal values of SVM parameters. In literature [10], aiming at solving the bottleneck problem of high energy storage life loss cost in microgrid, a two-stage coordinated scheduling model and control strategy based on two groups of batteries are proposed. The established microgrid model aims to achieve the goal of minimizing its total operating cost, and there is also an energy storage system, which uses a topological structure. Later, it is verified by demonstration projects that it can prolong the life of batteries and achieve its desired economic benefits. Literature [11] describes a complete photovoltaic-vanadium redox cell (VRB) microgrid as a whole and puts forward the problem of the optimal power and energy rating of VRB system in isolated microgrid and grid-connected microgrid considering the charging and discharging efficiency and working characteristics of VRB. A new battery operating cost model considering the charge-discharge efficiency and life cycle of the battery is proposed. Literature [12] proposes a multiobjective optimization method for optimal dispatching and operation of microgrid based on dynamic dispatching of battery energy storage system, which aims at providing better economic benefits than others, maximum reliability, minimum fluctuation of renewable energy power, and best compliance with renewable energy power generation plan. Two methods, fuzzy theory and binary factors, are used to transform it into a single-objective optimization problem, to achieve the optimal scheduling strategy of BESS successfully. It has been verified that the conjecture with good optimization effect has been confirmed. Literature [13] presents a new optimization algorithm as the previous multiobjective particle swarm optimization, in which fuzzy clustering in the middle is a helper to find the optimal solution from generation to generation. This can not only improve the relative stability of the algorithm, but also greatly improve the global search ability, so that the optimization results are more evenly distributed. A typical microgrid example in Europe is used to verify its reliable results, and it can achieve better results in the process of implementation The multiobjective optimization model in literature [14] greatly reduces the economic cost, realizes the unification of environmental pollution and external power supply, and clearly constructs the weight coefficient of each subobjective by analyzing the stratification process. Therefore, for realizing the optimization and adjustment of MG, quantum particle swarm optimization algorithm is adopted. In the actual case analysis, we can clearly find that the feasibility of the model is very high, showing very effective results. A nonlinear constraint model is proposed in literature [15], which is a method to solve the problem of optimizing microgrid dispatching. This method reduces the cost. Harmful emissions and load requirements can be reduced. The method proposed in the above literature is based on PSO method applied to power grid. However, the current training time is long, and the complexity is high. In the optimization process, the parameters of SVM training process are optimized to accelerate the convergence of the algorithm. Section 2 describes the basic algorithm and the improved algorithm of PSO and SVM. In Section 3, the combination of PSO and SVM algorithm is discussed, and the optimal parameters are given. In Section 4, PSO-SVM algorithm is simulated, and the optimal values of various algorithms are compared. Section 5 concludes this study.

#### 2. PSO Algorithm

##### 2.1. Basic Ideas

PSO is realized by simulating birds and other particles of birds. Particles have only two properties, velocity and position. The position vector is a good idea to denote the direction of motion and the solution. The velocity vector represents the velocity of the position and indicates changes in direction and size. Each and every particle is isolated in the searchable space to look for the optimum solution, it will remember the current individual extreme value and share the previously recorded extremum with other particles, and the optimal individual extremum is found to become the overall situation optimal solution. Each particle in the particle swarm adjusts its speed and position through the current individual extreme value. PSO algorithm is simple and easy, and its parameters are not adjusted much.

##### 2.2. Update Rule

PSO is initialized to a random bunch of particles (random solutions) and then passes the iteration to find out the optimal solution. In each iteration, the particle usually changes the velocity vector and position vector of the two “extremes” (*p*, ) to update itself.

The speed and position update formula of PSO algorithm is expressed as

where rand () is random numbers within (0, 1); *X _{i}* is the current position of the particle; and C

_{1}and C

_{2}are learning factor, usually 2. The formula is divided into three different parts by the operation symbol plus sign. The first part represents the influence of the previous velocity vector, and the second part is a vector from the current point to the best point of the particle obtained by experience and calculation.

*P*and represent the velocity vector and the position vector. Rand is a random number; its function is to change the corresponding speed and position indefinitely in the optimization process, so that PSO algorithm can get the global optimization more easily in the optimization process. It shows that the particle swarm algorithm is a summary of the historical records and proposes the best solution. The third part is a vector that points from the current point to the population and obtains the best point from experience and work, which reflects the cooperation of each particle and the sharing of its own information between individuals and populations.where

*i*= 1, 2, 3, …,

*N*, where

*N*is the total number of particles. is velocity of particles. PSO has the problem of premature convergence and is easy to fall into local optimum. In formula (1), the next velocity variable value is updated to get the particle velocity. Equation (2) updates the position, thus updating the position information. Repeat the above process until an optimal value is reached. In this paper, an optimal combination method of PSO-SVM is proposed, which can effectively transform local optimum to global optimum.

##### 2.3. Improved PSO Algorithm

The inertia factor is introduced, and its value is nonnegative. When the optimization ability of each part is strong, the global and local values need to be larger. On the contrary, if the global and local optimization ability are weak, the value needs to be smaller, and the optimization ability has a good linear relationship with the value of inertia factor. Dynamic inertia factor can obtain better optimization results than fixed values because dynamic inertia factor can change linearly in PSO search [16] and can also change dynamically according to a measure function of PSO performance.

Linear decreasing weight is as follows:where is the maximum number of iterations; the is initial inertia weight, typically 0.9; and is the inertia weight of iteration to maximum evolutionary algebra, with the typical value being = 0.4. Global PSO and local PSO: The former can get a relatively fast convergence rate in the global range, but its disadvantage is that it sometimes falls into local optimization. The latter has slow convergence speed, but it is difficult to optimize locally. In common practical applications, we generally use particle swarm optimization algorithm to find a similar result, then determine that it is the most suitable in the global range, and then use local optimization particle swarm optimization algorithm to search for specific local areas.

##### 2.4. Algorithm Instance Steps

Step 1: assume that the population size is *N*. The velocity vector and position vector of each connection are initialized arbitrarily in the specified search space, the adaptive function value is calculated, and then the forward optimal position of particles in the population and the global optimal position of the middle population are obtained. Step 2: update the velocity and position of particles. The two parameters are updated according to the historical optimal position and the global left and right position. Step 3: select the fitness function of particles, and then evaluate its value. Then, it is necessary to update the historical optimal position and the global optimal position, mainly depending on whether they are different from the previous comparison, and if they are different, they will be updated. Step 4: this step belongs to judgment. If the end condition is met, it will be output. If it is not met, it will continue to be executed in Step 2.

The PSO algorithm flow chart is as shown in Figure 1.

###### 2.4.1. Basic Concepts

SVM is a clear two-class classification model [17, 18], and at the same time, it is an excellent linear classifier, which can solve many linear problems. We can clearly see that it has the largest interval in feature space. The learning goal of an excellent linear classifier is to find a hyperplane in *n*-dimensional data space, and its equation is . Its learning strategy is to maximize the interval. If you want to solve it simply, the interval can finally be transformed into a convex quadratic programming problem.

###### 2.4.2. Solution of Regression Linear Equation

Convert to optimization:

Since obtaining the maximum of can be equivalent to obtaining the minimum of , the corresponding objective function can be equivalent to

By transforming the Lagrange duality into a problem where the dual variables are as large as the optimization problem, the optimal solution of the original problem is obtained by solving a problem equivalent to the original problem. Define Lagrange functions:

From the last formula, we can see that the function only contains one variable, *a*_{i}, at this time, and if we find its value, we can find and *b*; then, we can classify the function:

By introducing kernel function, it can simplify the inner product operation in mapping space, which is equivalent to the original classification function:mapped towhere the kernel function is .

By introducing the relaxation variable , the objective function becomeswhere *C* is the learning factor.

#### 3. PSO-SVM

##### 3.1. Basic Overview and Formula

The basic formula of the algorithm is

PSO-SVM algorithm [19, 20] needs to use particle thermal optimization algorithm to project low-dimensional plane points onto high-dimensional plane, optimize SVM kernel parameters and penalty coefficient *C*, and introduce linear separable data kernel function *K* into low-dimensional plane. The classification decision function is as follows:

The kernel function is , *C* is the penalty factor. The selection of kernel function parameters will affect the performance of the model. PSO and SVM, which are simple to operate and fast to converge, are combined to find the optimal combination of parameters. In the SVM classification, because of the training, the parameters in the optimization process are more complex, resulting in low efficiency in the classification process, and combined with PSO, the optimized SVM in the training can optimize the parameters and achieve better classification results.

##### 3.2. Parameter Optimization

The flow chart of parameter optimization steps is as follows: the termination condition refers to the maximum number of iterations, the convergence of the obtained solution, or whether the obtained solution has achieved the expected effect as shown in Figure 2.

##### 3.3. Fitness Value

This fitness value can measure the quality of a solution [21]. There is a noun called maximum fitness evaluation, which is updated according to different population variations, which can be described in relation to the maximum iteration times:

In the iterative process, it is calculated once, that is, called once, and evaluated once. The maximization and minimization of this value are related to the product, which is the product between the weight and fitness values to handle the update. By comparing fitness values of different sizes, this can be simply described as a linear relationship. If the fitness of each element is equal, the higher the fitness, the better.

#### 4. Experimental Simulation

The data selected in this paper is the power load values of a specific area in Zhejiang Province. The following three time points in 2020 are taken as three sampling points, and the SVM algorithm [22], PSO algorithm [23], PSO-SVM algorithm [24], and Multi-PSO-SVM forecasting model on February 1, March 1, and April 1 are compared with the actual load values, as shown in Figures 3–5.

Through the above three charts, we can find that PSO-SVM prediction is better than Multi-PSO-SVM prediction in these three sampling points, which shows that they have the best prediction effect.

The average values of load sampling data at the above three sampling points are shown in Table 1. Through specific data, the prediction accuracy and effect of the above models can be analyzed more accurately.

As can be seen from Table 1, Multi-PSO-SVM forecasting model is used to forecast the microgrid load, and the forecasting accuracy completely meets the standard. By comparing the results of the forecasting model with the other three forecasting models, we can know that the forecasting error of Multi-PSO-SVM forecasting model is the smallest; in addition, the average load predicted by it, along with the actual load, is almost less than 10 MV, so the Multi-PSO-SVM proposed in this paper has more advantages. The specific prediction error is shown in Figure 6.

The maximum error of the proposed method is 10, the minimum error is 0, and the overall performance is good. The time complexity of the proposed method is O(*n* log *n*).

#### 5. Conclusion

This paper presents a superior short-term load forecasting model for microgrid, Multi-PSO-SVM prediction model; after analyzing the great importance of charge prediction to microgrid, considering the influence of different time periods and temperatures on the microgrid, four algorithms are selected to forecast the load value. Through the combination of different algorithms, the results show that the prediction accuracy of the Multi-PSO-SVM model proposed in this paper is obviously better than that of the other three algorithms, and the model has strong accuracy and strain capacity.

#### Data Availability

The experimental data used to support the findings of this study are available from the corresponding author upon request.

#### Conflicts of Interest

The authors declare that they have no conflicts of interest regarding this work.