Open access peer-reviewed chapter

# Optimal Design of Energy System Based on the Forecasting Data with Particle Swarm Optimization

By Yamin Yan, Haoran Zhang, Jianqin Zheng and Yongtu Liang

Submitted: June 14th 2019Reviewed: October 2nd 2019Published: April 1st 2020

DOI: 10.5772/intechopen.90007

## Abstract

Renewable energy source has developed rapidly and attracted considerable attention. The integration of renewable energy into the energy supply chain requires precise forecast of the output of energy supply chain, thereby reducing energy resource waste and greenhouse gas emissions. In this study, a coupled model system is developed to forecast energy supply chain for the design optimization of distributed energy system, which can be divided into two parts. In the first part, long short-term memory (LSTM) and particle swarm optimization algorithm (PSO) contribute to energy supply chain forecast considering time series, and particle swarm optimization is used to optimize the parameters of the long short-term memory model to improve the forecast accuracy. Results show that the mean absolute error and root mean squared error are 8.7 and 16.3 for the PSO-LSTM model, respectively. In the second part, the forecast results are used as input of the distributed energy system to further optimize the design and operation schemes, so as to achieve the coupling optimization of forecast and design. Finally, a case study is carried out to verify the effectiveness of the proposed method.

### Keywords

• coupled model system
• forecast
• design optimization
• renewable energy system

## 1. Introduction

With the development of social economy and the acceleration of urbanization and industrialization, the global energy consumption and greenhouse gas (GHG) emissions are expected to increase in the next few decades [1, 2]. At present, more than 80% of the world’s primary energy comes from fossil fuels, and its carbon emissions are the biggest cause of global greenhouse effect. Therefore, the development of low-carbon economy renewable energy technologies is an emerging trend and goal of the world. In the past decade, renewable energy power generation has grown at an annual rate of 16%, and China accounted for 45% of global growth [3]. Wind power, one of the most potential renewable energy sources, has entered the rapid development stage. In 2018, the wind power has a largest share (around 50%) in the renewable energy power generation and reached 142 TW h [4], and more than 10% of electricity consumption or 5 GW of electricity will be generated by solar energy by 2020 [5]. As reported in “Clean Energy Trends” published in March 2011, the global production of biofuels, wind power, and solar energy is expected to reach $112.8 billion,$122.9 billion, and \$113.6 billion by 2020, with growth rates of 116, 103, and 60%, respectively. Whether from the point of view of energy saving or environmental protection, renewable energy is certain to play a vital role in power generation [6, 7]. However, renewable energy has the characteristics of strong uncertainty and volatility, which not only increase the operation cost of power system but also reduce the cost-effectiveness of renewable energy resources [8]. Therefore, it is necessary to establish an accurate and stable prediction model for the renewable energy power to ensure the energy supply chain, so as to lay the foundation for optimizing the design and operation strategies of energy system [9, 10].

Many scholars have conducted the research on forecasting and optimizing the renewable energy supply system. Regarding the energy supply system forecast, many studies have developed effective forecasting methods for specific energy sources, which can be divided into three types of models, namely, time series models, data-driven models, and wavelet-based multiscale models [11]. Generally, the time series models and data-driven models are widely accepted. For instance, Lu et al. [12] compared the accuracy of four artificial intelligence methods in forecasting Taiwan’s renewable energy sources based on historical data from 2000 to 2015, and results showed that only grey forecasting model coupled with heuristic fuzzy time series method is suitable for small dataset forecast. Long et al. [13] used four famous data-driven method to forecast daily solar power after dimensionality reduction of data, and they inferred that different algorithms can outperform others in different considered scenarios. There are few literatures on the application of the wavelet-based multiscale models. Reikard [14] proposed a Kalman filter and time-varying regression for the time series prediction of wave energy. Aasim et al. [15] proposed a new repeated wavelet transform based ARIMA model for very short-term wind speed forecasting. Based on data-driven, Li et al. [16] developed a new deep machine learning algorithm to predict short-term wave energy. In summary, different forecast models may vary greatly in different scenarios.

However, most of the previous work has been devoted to the forecast of renewable energy in a certain region considering the limited range of measuring instruments, and few studies pay attention to the power generation in multiple regions. In fact, it is impossible to install the measuring instruments in each region from an economic point of view, thus bringing a great challenge for forecasting renewable energy in multiple regions. In addition, the forecast of renewable energy is not only related to the energy intensity but also depends on climate conditions, which have a strong time series relationship [17]. Meanwhile, the short stochastic characteristics and the dependence of the observation time series of renewable energy must be taken into account. Therefore, this paper is the first work to develop a forecast model based on the data-driven method by collecting the measurement equipment data and climate conditions in different regions and at different times. Also, the LSTM model is adopted to capture the dependence of time series forecasting for renewable energy output, and PSO is used to optimize the parameters of the LSTM model to improve the forecast accuracy.

Regarding the optimization of renewable energy supply system, many scholars are devoted to integrating various renewable energy sources and have made a range of achievements [18, 19, 20]. Acevedo-Arenas et al. [21] described the methodology of hybridizing photovoltaic, wind, and forest biomass energy sources and developed a model to optimize the design and operation schemes of hybrid renewable energy system in consideration of economic and environmental impacts. Tajeddin and Roohi [22] put forward the use of biomass energy to improve the responsibility and efficiency of wind farms. Sakaguchi and Tabata [23] forecasted the power generation potential and proportion of biomass, wind power, and PV in Awaji Island Japan, and results showed that it is possible to achieve self-sufficiency by the sole use of renewable energy. Moreover, the renewable energy plants are usually equipped with the energy storage, which could improve the controllability of the output [24]. Based on the above research, the hybridization of renewable energy sources is able to reduce the uncertainty and volatility, thereby promoting the rational use of renewable energy and increasing environmental benefits.

In this paper, we first focus on the accurate forecast of renewable energy supply chain, which is divided into three steps. The first step is to develop a forecast model based on the data-driven method by collecting the measurement equipment data and climate conditions in different regions and at different times. In the second step, the LSTM model is adopted to capture the dependence of time series forecasting for renewable energy output. In the third step, PSO is used to optimize the parameters of the LSTM model to improve the forecast accuracy. After that, the forecast results are used as input of the distributed energy system to further optimize the design and operation schemes, thereby achieving the coupling optimization of forecast and design. Overall, there are four contributions in this paper:

1. LSTM model is established to forecast the output of renewable energy in multiple regions, considering the correlation of time series and the change of climate conditions.

2. PSO is adopted to optimize the parameters of LSTM model, thereby improving the forecast accuracy.

3. Based on the forecast results of LSTM model, a MILP model is established to optimize the design and operation schemes of renewable energy supply system.

4. Real multi-region renewable energy plants are used as an example to verify the effectiveness and practicality of the proposed coupled model system.

The rest of this paper is organized as follows: Section 2 describes the basic knowledge of LSTM model and PSO algorithm, and the optimization model of distributed renewable energy supply system is explained. Subsequently, the optimal results solved by the coupled model system and corresponding discussions are presented in Section 3. Finally, Section 4 concludes this paper.

## 2. Problem formulation and solution methodology

### 2.1 LSTM model coupled with PSO algorithm

Figure 1 shows the framework of the coupled model system. Firstly, long short-term memory (LSTM) and particle swarm optimization algorithm (PSO) contribute to energy supply chain forecast considering time series, and particle swarm optimization is used to optimize the parameters of the long short-term memory model to improve the forecast accuracy. Then, the forecast results of solar power plants and the known wind power are used as input of the distributed energy system to further optimize the design and operation schemes, so as to achieve the coupling optimization of forecast and design.

### 2.2 LSTM model coupled with PSO algorithm

#### 2.2.1 LSTM model

As a kind of recurrent neural network, LSTM model combines short-term with long-term memory through subtle gate control and overcomes the shortcoming of gradient vanishing. Currently, LSTM model has great applications in time series, such as machine translation and speech recognition. In this section, the basic LSTM cell is introduced firstly.

The basic LSTM cell is shown in Figure 2. At time t, the cell state at t−1, the hidden state at t−1, and the new information are denoted as ct1, ht1, and xt, respectively, which are the input of the cell. Forget gate, input gate, and output gate are used to select information and depended on xtand ht1. The output value of each gate is limited to between 0 and 1 by the activation function, which is the sigmoid function defined in Eq. (1).

σx=11+exE1

The LSTM cell included four steps as follows. Firstly, the cell decides what stored information is going to be thrown away from the previous cell state ct1. Based on xtand ht1, forget gate ftoutputs a value between 0 and 1 for ct1. And 1 means that the stored information is completely retained, and 0 means that the information is completely eliminated. ftis calculated by Eq. (2).

ft=σWxfxt+Whfht1+bfE2

Secondly, the cell decides what new information is going to be stored. At first, tanh function defined in Eq. (3) is to ensure the normalization of the new information and converts xtand ht1to the new format between −1 and 1 denoted as in Eq. (4). Then, the input gate itdefined in Eq. (5) outputs a value between 0 and 1 to select the new information. After that, these two parts are going to be combined to update the cell state in the next step.

tanhx=exexex+exE3
ct¯=tanhWxcxt+Whcht1+bcE4
it=σWxixt+Whiht1+biE5

Thirdly, it is going to update the cell state based on the previous steps. The old cell state is multiplied by ft, forgetting the information decided to be forgotten in step 1. The process information ct¯decided by tanh function is multiplied by it. Then these two parts are added to determine the new cell state ctin Eq. (6).

ct=ftct1+itct¯E6

Finally, the cell decides what is going to be the output. Similar to other gates, output gate otoutputs a value to decide what parts of the cell state are going to be output in Eq. (7). Based on ct, the hidden state htdefined in Eq. (8) is multiplied by otto decide the important information to be stored. At last, the output of the LSTM cell is shown in Eq. (9).

ot=σWxoxt+Whoht1+boE7
ht=ottanhctE8
yt=σWhyht+byE9

In this work, X is the measurement equipment data and climate conditions, and y is the output of the renewable energy. Wxf, Wxi, Wxo, and Wxcare the input weight matrices; Whf, Whi, Who, and Whcare the recurrent weight matrices; and Whyis the hidden output weight matrix. Vectors bf, bi, bo, bc, and byare the corresponding bias vectors.

#### 2.2.2 PSO algorithm

Proposed in 1995, PSO has a great use in the field of optimization, especially coupling with machine learning, such as ANN [25]. In this study, PSO is used to select the optimal parameters for the LSTM model. The process of the algorithm is described as follows.

Firstly, initializing the particle swarm, including the size of population and the dimension of each one. In this work, the number of units, learning rate, and time step are optimized, so the dimension of each individual is 3.

Secondly, evaluating the fitness of each individual. In the process of training the LSTM model, the training loss is the fitness of each particle.

Thirdly, finding the two “extreme value.” In each iteration, by calculating the training loss, the individual optimal value and optimal population value are found, which are used for updating the particles.

Fourthly, updating the velocity and position of each particle. Based on the two “extreme value,” the particles are updated to form the next generation according to Eqs. (10) and (11):

vit+1=w×vi+c1×r1×pitxit+c2×r2×pgtxitE10
xit+1=xit+vit+1E11

where viand xiare the velocity and position of particle i, respectively. piis the best position for a particle iand pgdenotes the best position in the group at the tth iteration.

Fifthly, reaching convergence condition. With the help of iterations, the best particle will be found within the maximum iteration. So the suitable parameters of the LSTM model are determined.

The methodology of LSTM model coupled with PSO algorithm is composed of three parts. Firstly, the data of measurement equipment data and climate conditions are collected into the database with preprocessing. Secondly, the data is divided into two groups, and small part of the data is for the PSO algorithm to train the LSTM parameters. It contains the process of PSO algorithm mentioned in 3.1.2 section. Finally, after finding the optimal LSTM model, train the prediction model with the rest of the data. So far, a prediction model with high accuracy for the output of the renewable energy is established.

### 2.3 The optimization model of energy supply system

#### 2.3.1 Objective function

The objective of this model is to minimize the total annual cost of the energy supply system, CTOT, defined as the sum of the total fixed cost, capital cost, and energy consumption cost. It should be noted that the input energy of the energy supply system is renewable energy sources; thus, the energy consumption cost is equal to zero:

CTOT=CCac+CFE12

where CCacand CFare the total capital cost and fixed cost of the energy supply system, including the PV panels, wind turbines, and batteries [CNY].

The annual capital cost of technology iis obtained by the capital recovery factor CRFi, which is defined as Eq. (15):

CCac=CapiCUCiCRFiE13
CF=BiCFCiCRFiE14
CRFi=r1+rNi1+rNi1E15

where Capiis the rated power of technology i[kW, kWh]; Biis the binary variable, which is equal to 1 if the technology iis selected for installation [−]; CUCirepresents the unit cost of technology i[CNY/kW for energy generation technology and CNY/kWh for energy storage technology]; CFCiis the fixed cost of technology i[CNY]; Nirepresents the lifetime of technology i[year]; and rdefines the discount rate [−].

#### 2.3.2 Constraints

In this section, three types of constraints are considered: energy balances, design, and operation constraints. Regarding the energy balance constraints, the electricity demand is satisfied by the PV panels and wind turbines. When the electric load changes, the batteries are used to effectively adjust the electricity balance and keep the voltage and frequency constant, and Eqs. (17) and (18) are required to describe the operation state of batteries. Notably, the batteries are only able to deal with the daily fluctuations, and Eq. (16) can be applied to any hour except for the first hour of the day, while Eq. (18) can only be applied to the first hour of the day:

Qt,PV+Qt,WT+StdisStch=DtE16
St=St1nloss+StchnchStdis/ndisE17
St=St+23nloss+StchnchStdis/ndisE18

where Dtis the electric load at time-window t[kWh]; Qt,PVand Qt,WTindicate the energy output from the PV panels and wind turbines at time-window t[kWh]; Stchand Stdisare the charging and discharging rate of the battery at time-window t[kWh]; Strepresents the electricity stored in the battery at time-window t[kWh]; and nloss,nch, and ndisrepresent the battery’s loss, charging, and discharging efficiency, respectively, [−].

As for the design and operation constraints, the operating power of technology ishould be less than the rated power, as defined in Eqs. (19) and (20). In addition, Eq. (21) requires that the installation capacity must be within the maximum limit to ensure safe and stable operation of technology i:

Qt,iCapiE19
StCapbatteryE20
0CapiBiMaxiE21

where Maxiis the upper limit of the capacity of technology i[kW, kWh].

#### 2.3.3 Model solving

Based on the computer with 8 GB of RAM memory and solution environment with 1.6 GHz of CPU, the model was programmed with the software MATLAB R2015 and solved by the business solver GUROBI 8.1.0 to obtain the global optimum.

## 3. Case study

### 3.1 The forecast results of LSTM model

Firstly, this part is to predict the solar energy of the solar power plants. In area A, there are eight solar plants located in different regions. Historical data from January to May 2017 is used for experiment with a time interval of 30 minutes. The measurement equipment data including measured temperature and global solar radiation is from the power system, and the weather conditions are from the weather bureau. In this study, in order to evaluate the quality of the LSTM model, the evaluation indexes are root mean squared error (RMSE) and mean absolute error (MAE). The formulas of these two are defined as follows:

MAE=1ni=1npiriE22
RMSE=1ni=1npiri2E23

where n means the total number of the data, piis the predicted value, and riis the real value.

In this part, the data of January is used for training PSO-LSTM. The training sets, validation sets, and testing sets account for 80, 10, and 10%. And RMSE of the testing data is used as the fitness value of PSO. The parameters of the LSTM model are hidden units, learning rate, and time step. The corresponding range is 1–30, 0.0001–0.1, and 1–50 respectively, as shown in Table 1. After executing the PSO-LSTM, the suitable parameters are optimized and shown in Table 1. The convergence of RMSE is figured in Figure 3.

Neural unitsLearning rateTime step
Range1–300.0001–0.11–50
Result200.015

### Table 1.

The parameters of the LSTM network.

After determining the suitable LSTM model, the prediction model for solar energy is established. Data from February to mid-May is used to train this predictive model, and other data is used to test its accuracy. After the data is tested, the MAE and RMSE are 8.7 and 16.3, respectively. In order to illustrate the superiority of PSO-LSTM, the prediction results of basic LSTM and artificial neural network (ANN) are compared. And the predicted results and real value of the last 6 days of May are shown in Figure 4.

### 3.2 The optimal results of the renewable energy system

From the aforementioned analysis, the prediction model for solar energy is accurate. With the input of the measurement equipment data and weather conditions, the output of the solar energy can be predicted precisely. The hourly output forecast curve of the solar power plant and the known wind power energy and the electricity demand are shown in Figure 5. The technical and cost information of technologies are summarized in Table 2 [26, 27, 28], and the loss, charging, and discharging efficiency of battery are set as 99.9, 90, and 90%, respectively [29]. The discount rate is assumed to be 8% to annualize the total investment cost.

TechnologySize range (MW, MWh)EfficiencyCapital cost (CNY/kW, CNY/kWh)Fixed cost (CNY)Lifetime (a)
PV panels0–50017%150034,50020
Wind turbine0–50035%350017,90025
Battery8511,60020

### Table 2.

The technical and cost information of technologies.

By solving the MILP model, the optimal results of the renewable energy system can be obtained. The annual total cost is equal to 109.91 million. Specifically, the total capacities of PV panels, wind turbines, and batteries are 140, 270, and 185 MWh. Obviously, the PV panels are selected due to the low investment cost, and the capacities reach the optimal to match with the limited solar power. The wind turbines are installed to work when the solar power is equal to 0. The batteries are installed to store the energy generated by the energy generation technologies to reduce the investment cost.

## 4. Conclusion

In this work, LSTM model is established to forecast the output of renewable energy in multiple regions, considering the correlation of time series and the change of climate conditions. Then, PSO algorithm is applied to optimize the parameters of the LSTM model. Results show that PSO-LSTM model is highly accurate with small error. Based on the forecast results, a MILP model is established to obtain the configuration of the renewable energy system with minimal total annual cost.

In future work, other intelligent algorithms, such as differential evolution, the simulated annealing algorithm, and ant colony optimization, can also be applied to select suitable parameters for long short-term memory. Besides, it is also important to study solar and wind energy access to power systems.

## Acknowledgments

This work was partially supported by the National Natural Science Foundation of China (51874325) and the Grant-in-Aid for Early-Career Scientists (19 K15260) from the Japan Ministry of Education, Culture, Sports, Science and Technology. The authors are grateful to all study participants and, additionally, thanks to the solar power output data provided by the “PV in HOKKAIDO” contest hosted by Tokyo Electric Power Company Holdings (TEPCO) and Hokkaido Electric Power Company (HEPCO).

## Appendices and nomenclature

 i∈I all technologies: PV panels, wind turbine, and battery t∈T number of time windows CCac total capital cost [CNY] CF total fixed cost [CNY] CFCi fixed cost of technology i [CNY] CUCi unit cost of technology i [CNY/kW, CNY/kWh] CRFi capital recovery factor of technology i [-] ct the cell state at time t ct¯ the new candidate information at time t Dt electric load at time-window t [kWh] ft the forget gate at time t ht the hidden state at time t it the input gate at time t Maxi the upper limit of the capacity of technology i [kW, kWh] nloss the loss efficiency of the battery [-] nch the charging efficiency of the battery [-] ndis the discharging efficiency of the battery [-] Ni lifetime of technology i [year] ot the output gate at time t Qt,i energy output from the technology i, at time-window t [kWh] xt the input information at time t Bi if the technology i is selected for installation, Bi=1; otherwise, Bi=0 Capi rated power of technology i [kW, kWh] Stch charging rate of the battery at time-window t [kWh] Stdis discharging rate of the battery at time-window t [kWh] St electricity stored in the battery at time-window t [kWh]

chapter PDF
Citations in RIS format
Citations in bibtex format

## More

© 2020 The Author(s). Licensee IntechOpen. This chapter is distributed under the terms of the Creative Commons Attribution-NonCommercial 4.0 License, which permits use, distribution and reproduction for non-commercial purposes, provided the original is properly cited.

## How to cite and reference

### Cite this chapter Copy to clipboard

Yamin Yan, Haoran Zhang, Jianqin Zheng and Yongtu Liang (April 1st 2020). Optimal Design of Energy System Based on the Forecasting Data with Particle Swarm Optimization, Advanced Statistical Modeling, Forecasting, and Fault Detection in Renewable Energy Systems, Fouzi Harrou and Ying Sun, IntechOpen, DOI: 10.5772/intechopen.90007. Available from:

### chapter statistics

1Crossref citations

### Related Content

#### Advanced Statistical Modeling, Forecasting, and Fault Detection in Renewable Energy Systems

Edited by Fouzi Harrou

Next chapter

#### Neutral Network Adaptive Filter with Application to Ocean Current Energy Estimation

By Hong Son Hoang and Remy Baraille