## 2 Problem Formulation
### Mathematical Formulation  
Decision variables represent the operating states of the microgrid and the energy flows between its components at time \(t\). As shown in Figure 1, the \(x_{i}^{t}\) variables define the energy produced or purchased by different origins, and each variable is assigned a subscript that indicates the specific type of energy transfer. The notation system shown in Table 1 is employed to characterize these variables and associated energy transfers. The optimization in this case aims to achieve the lowest economic cost and carbon dioxide emissions by adjusting the power generation of different devices while meeting the users' electricity and heat demands and certain constraints involving light and wind limitations. The objective function is formulated as follows:  
\[MinC=C_{\text{M}}+C_{\text{O}}+C_{\text{Eg}}+C_{\text{Hg}}+GC_{\text{co}_{2}} \tag{4}\]  
\[MinG=\sum_{t=0}^{D}{(1+m_{t})P_{\text{BG}}^{t}G_{\text{BG}}} \tag{5}\] \begin{table}
\begin{tabular}{l l} \hline \hline \multicolumn{2}{l}{**General Notations**} \\ \hline \(i\) & The output energy flow index, \(i=1,2,\ldots,9\). \\ \(j\) & The usage energy flow index, \(j=2,3,\ldots,11\). \\ \(m\) & The energy sources index, \(m=\text{WT},\text{SP},\text{BGE},\text{BGH}\). \\ \(k\) & The equipment index, \(k=\text{WT},\text{SP},\text{BG}\). \\ \(t\) & Time step. \\ \hline \multicolumn{2}{l}{**Variables**} \\ \hline \(x_{i}^{t}\) & The initial output amount of energy flow \(i\) at time \(t\). \\ \(y_{j}^{t}\) & The final usage amount of energy flow \(j\) at time \(t\). \\ \(u_{i}^{t}\) & The wasted amount of energy source \(m\) at time \(t\). \\ \(P_{\text{R}}^{t}\) & The produced energy amount of equipment \(k\) at time \(t\). \\ \(E_{\text{E}}\) & The cumulative power generation of equipment \(k\) \\ \(C_{\text{OR}}\) & The operation cost of equipment \(k\). \\ \(P_{\text{PT}}^{t}\) & The battery charge level at time \(t\). \\ \(P_{\text{BG}}^{t}\) & The maximum produced-energy amount of BG at time \(t\). \\ \(P_{\text{PSD}}^{t}\) & The demand for electricity at time \(t\). \\ \(P_{\text{PSD}}^{t}\) & The demand for heat at time \(t\). \\ \hline \multicolumn{2}{l}{**Parameters**} \\ \hline \(C\) & The total economic cost. \\ \(G\) & The total amount of carbon dioxide. \\ \(D\) & The working duration of equipment. \\ \(S\) & The solar radiation. \\ \(S_{\text{Power}}\) & The amount of sunlight per hour. \\ \(C_{\text{O}}\) & The total operation cost. \\ \(C_{\text{M}}\) & The total maintenance cost. \\ \(C_{\text{Eg}}\) & The total amount paid for electricity purchased from external sources. \\ \(C_{\text{Hg}}\) & The total amount paid for heat purchased from external sources. \\ \(C_{\text{co}_{2}}\) & The tax of carbon dioxide. \\ \(G_{\text{BG}}\) & The carbon dioxide generated per unit capacity of bioenergy. \\ \(c_{\text{Eg}}\) & The price of electricity purchased from external sources. \\ \(c_{\text{Hg}}\) & The price of heat purchased from external sources. \\ \(\gamma\) & The efficiency of the engine generator in producing thermal energy. \\ \(BT_{\text{min}}^{\text{tot}}\) & The minimum allowable energy storage levels for the battery at any given time. \\ \(BT_{\text{max}}^{\text{min}}\) & The maximum allowable energy storage levels for the battery at any given time. \\ \(BT_{\text{min}}^{\text{mper}}\) & The minimum allowed charging and discharging rates. \\ \(BT_{\text{max}}^{\text{mper}}\) & The maximum allowed charging and discharging rates. \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Notations and parameters. \[C_{\rm M}=\sum_{k=1}^{K}c_{\rm Mk}\left|\frac{E_{k}}{1000}\right| \tag{6}\]  
\[C_{\rm O}=\sum_{k=1}^{K}c_{\rm Ok}E_{k} \tag{7}\]  
\[C_{\rm Eg}=\sum_{t=0}^{D}\left(1+n_{t}\right)x_{11}^{t}\epsilon_{\rm Eg} \tag{8}\]  
\[C_{\rm Hg}=\sum_{t=0}^{D}\left(1+n_{t}\right)x_{10}^{t}\epsilon_{\rm Hg} \tag{9}\]  
\[E_{k}=\sum_{t=0}^{T}\left(1+n_{t}\right)P_{k}^{t} \tag{10}\]  
where \(n_{t}\in[-0.1,0.1]\) refers to the uncertainty variables of electricity demand.