# Research on Optimized Energy Scheduling of Rural Microgrid
## 5 Energy Scheduling Model of Rural Microgrid  
The rural microgrid is a micro power system that integrates bidirectional power flow, renewable energy generation, CES system and multiple loads. The research content of this section is to solve the optimal power-dispatching scheme of the rural microgrid containing cloud energy storage. The scheduling cycle is for one day, and the decision taken is for day-ahead scheduling. The goal of scheduling is to minimize the total electricity cost of the microgrid. The electricity cost mainly includes grid electricity charge, CES service fee and renewable energy generation cost. So, the objective function can be expressed as:  
\[mitcost\ =\sum_{h=1}^{H}\left[E_{buy}^{grid}(h)V_{buy}^{grid}(h)-E_{cell}^{ grid}(h)V_{cell}^{grid}(h)\right]\ +\ C_{cas}^{storage}+C_{gener}, \tag{17}\]  
Figure 4: Thermodynamic diagram of residential sample data. Figure 5: Thermodynamic diagram of agricultural sample data. According to the actual charging/discharging behavior, the equivalent throughput of the cloud battery is calculated. The calculated throughput is used to estimate the battery life loss. We then refer to the method in the literature [31; 32] to convert the battery depreciation cost into the CES service fee. The calculation formula of the CES service fee is as follows:  
\[f_{w}(x_{SOC})=\left\{ \begin{array}{ll}1.3,&0\leq x_{SOC}\leq 0.5\\ -1.6\,x_{SOC}+2.1,&0.5\,<\,x_{SOC}\leq 1\end{array} \right., \tag{18}\]  
\[E_{\textit{cas,loss}}^{H}=\Delta h\sum_{h=\,1}^{H}\Big{[}|p_{\textit{cs}}^{ \textit{ddh}}(h)-P_{\textit{ccs}}^{\textit{ch}}(h)\big{]}f_{w}(S_{\textit{css} }(h))\,\Big{]}, \tag{19}\]  
\[C_{\textit{css}}^{\textit{storage}}=\,\alpha E_{\textit{css,loss}}^{H}, \tag{20}\]  
The calculation formula for the cost of renewable energy generation is as follows:  
\[C_{\textit{gener}}=\,C_{\textit{wind}}\cdot\sum_{h\,=\,1}^{H}P_{\textit{wt}} (h)+C_{\textit{pv}}\cdot\sum_{h\,=\,1}^{H}P_{\textit{pv}}(h), \tag{21}\]  
In the process of electric energy dispatching, the microgrid system satisfies the energy conservation:  
\[E_{\textit{resi}}+E_{\textit{agri}}=\sum_{h=1}^{H}\big{[}E_{\textit{buy}}^{ \textit{grid}}(h)-E_{\textit{cell}}^{\textit{grid}}(h)\,+\,[P_{\textit{css} }^{\textit{ddh}}(h)-P_{\textit{css}}^{\textit{ch}}(h)+P_{\textit{pv}}(h)+P_{ \textit{wt}}(h)]\Delta h\big{]}, \tag{22}\]  
The energy structure relationship of each part in the rural microgrid is as shown in Figure 6 and the research methodology is as shown in Figure 7.  
Figure 6: Rural microgrid energy system structure diagram. Figure 7: Research methodology. The optimization variables of electric energy scheduling include the working state of household appliances, the power of greenhouse electrical equipment, the charging and discharging power of the CES battery and the power purchased from the grid. It is a typical mixed integer programming problem. At present, the methods for solving the optimal problem mainly include mathematical programming methods, solvers and heuristic algorithms. The problems of the mathematical programming method and heuristic algorithm are easy to fall into local optimal solution and slow convergence. However, highly integrated business solvers have fast-solving speed and global searching ability, and do not easil fall into a local optimal. They can solve various linear or nonlinear, optimization problems. This method is applied to the microgrid dispatching optimization problem [21], which proves to be a feasible method. Therefore, the Linear Interactive and General Optimizer (LINGO) is adopted in this paper to solve the daily power dispatching scheme of the rural microgrid and its scheduling optimization process is as follows. Firstly, the XGBoost algorithm is used to predict power consumption of household loads and greenhouse loads according to information provided by users. Then, on the basis of all users participating in the CES, the solver is used to solve the optimal power scheduling scheme of a rural microgrid.