## 3 BIPV Microgrid System  
The structure of the BIPV microgrid system is shown in Figure 1.  
The system is connected to the main grid. PV is the distributed generation in the system. The PV units are connected to the system via a smart inverter to increase the utilization of PV power and maximize the benefits of PV [21; 22]. The battery is the energy storage equipment in the system. The loads in the system are divided into controllable loads and uncontrolled loads. Controllable loads include AC and EWH, which provide the VES effect for the system. Uncontrolled loads include lighting, computers, monitoring equipment, etc. The hot water demand is supplied by the EWH. The heat power and cold power are provided by AC. They all meet the demands of the system through a centralized supply.  
The generated power of the PV depends on solar irradiance and the terminal voltage [23]. The PV power generation works in the maximum power point tracking (MPPT) mode, which is combined with one-cycle control method, its output power is described as follow [24]:  
\[P_{\mathrm{PV}}=\frac{U_{\mathrm{o}}^{2}}{R_{\mathrm{s}}}(K+\frac{K_{\mathrm{ g}}T_{\mathrm{s}}}{R_{\mathrm{1}}C_{\mathrm{1}}}-\frac{U_{\mathrm{c}}T_{ \mathrm{s}}}{U_{\mathrm{g}}R_{\mathrm{1}}C_{\mathrm{1}}}) \tag{1}\]  
where \(U_{\mathrm{g}}\) is the output voltage of PV. \(U_{\mathrm{o}}\) is the effective value of grid-connected voltage of PV. \(R_{\mathrm{s}}\) is the sampling resistance. \(T_{\mathrm{s}}\) is the clock cycle of the flip-flop. \(K\), \(K_{\mathrm{g}}\), \(U_{\mathrm{c}}\), \(R_{\mathrm{1}}\),\(C_{\mathrm{1}}\) are the parameters of one-cycle control.  
Battery mathematic model can be represented as:  
\[\left\{\begin{array}{l}\mathrm{charge:E_{b,t}=(1-\lambda)\times E_{b,t-1}+ P_{b,t}\times\Delta t\times\eta_{\mathrm{bch}}}\\ \mathrm{discharge:E_{b,t}=(1-\lambda)\times E_{b,t-1}+P_{b,t}\times\Delta t \times\frac{1}{\eta_{\mathrm{bch}}}}\end{array}\right. \tag{2}\]  
where \(E_{b,t}\) is the amount of energy stored in the battery. \(P_{b,t}\) is the charging/discharging power of the battery. \(\Delta t\) is the simulation time step. \(\eta_{\mathrm{bch}}\) and \(\eta_{\mathrm{bch}}\) are the charging/discharging efficiency of the battery. \(\lambda\) is the self-discharge rate of the battery. The monthly self-discharge rate of lead-acid batteries is about 3%, which can be ignored in daily optimal scheduling of microgrid [25].  
AC consumes electric energy to meet the demand of heat and cold. Its mathematic model can be given as:  
\[Q_{\mathrm{ec}}=P_{\mathrm{ec}}\times\eta_{\mathrm{ec}} \tag{3}\]  
where \(Q_{\mathrm{ec}}\) represents the output cold or heat power of AC. \(P_{\mathrm{ec}}\) is the electrical power consumed by the AC. \(\eta_{\mathrm{ec}}\) is the energy efficiency ratio of AC.  
Figure 1: The structure of building integrated photovoltaic (BIPV) microgrid system.  
EWH consumes electric energy to provide hot water for the system. Its mathematic model is described as:  
\[Q_{\rm h}=P_{\rm h}\times\eta_{\rm h}, \tag{4}\]  
where \(Q_{\rm h}\) represents the output heat power of EWH. \(P_{\rm h}\) is the electrical power consumed by the EWH. \(\eta_{\rm h}\) is the energy efficiency ratio of EWH.