## 3 Distribute Generation Unit Model and Lower Converter Control
### Battery Energy Storage Unit Model and Control  
The relationship between the internal parameters of the battery is complex, and there is a nonlinear relationship between these parameters. So, the modeling of the storage battery is also the research  
Figure 4: The DC side photovoltaic #1 control strategy. Figure 5: The AC side photovoltaic #2 control strategy. focus of relevant experts. For the convenience of modeling, the general basic model is selected in this paper. Its physical circuit model is shown in Figure 6, which is formed by the controlled voltage source and an equivalent internal resistance in series [24]. In this paper, the \"Battery\" module in Matlab/Simulink is selected as the model of battery energy storage unit, and the lithium-ion (Lithium-Ion) battery model is used. When the controlled voltage source is discharged, the unload voltage is:  
\[U_{\text{battery}}=U_{0}-k\frac{Q}{Q-I_{\text{battery}}^{*}}(I_{\text{battery}}+ I_{\text{battery}}^{*})+A\exp(-BI_{\text{battery}}^{*}). \tag{5}\]  
When the controlled voltage source is charged, the unload voltage is:  
\[U_{\text{battery}}=U_{0}-\frac{k\cdot Q\cdot I_{\text{battery}}}{0.1Q+I_{\text {battery}}^{*}}-\frac{k\cdot Q\cdot I_{\text{battery}}^{*}}{Q-I_{\text{battery}}^ {*}}+A\exp(-BI_{\text{battery}}^{*}), \tag{6}\]  
where, \(I_{\text{battery}}^{*}=\int I_{\text{battery}}\text{d}t\) is the actual charge and discharge capacity of the battery, \(U_{0}\) is the rated voltage of the battery, \(k\) is the polarization voltage, \(Q\) is the battery capacity, \(A\) is the voltage drop in the exponential domain, \(B\) is the reciprocal of the time constant in the exponential domain. The output voltage and \(SOC\) are two important variables of the battery. For the general basic model, they are defined as:  
\[U_{\text{bat}}=U_{\text{battery}}-I_{\text{battery}}R_{\text{battery}}, \tag{7}\]  
\[SOC{=100\Bigg{(}1{+}\frac{I_{\text{battery}}^{*}}{Q}\Bigg{)}}, \tag{8}\]  
where \(R_{\text{battery}}\) is the equivalent internal resistance of the battery. In this paper, the battery energy storage units are connected to the AC and DC sub-microgrids. When connected to the public grid, the DC side battery mainly works with the interlinking converter to maintain the DC bus voltage stability, and the constant voltage charging is used when the battery charge is low. In the isolated island, the droop discharge is used to stabilize the DC bus voltage within a certain range. If the photovoltaic unit power generation power is greater than the power consumption, the constant voltage control charging of the DC bus is required. In addition, to protect the battery, the SOC charge and discharge threshold should be set. The battery #1 of the DC side battery energy storage unit is connected to the DC bus through a Boost/Buck circuit, and its control strategy is shown in Figure 7.  
Figure 6: General physical model for batteries. In Figure 7, the droop control of battery #1 can be expressed as:  
\[U_{\text{dc}}=U_{\text{dc}}^{\text{ref}}+k_{2}(P_{\text{dc}}^{\text{bat,ref}}-P_ {\text{dc}}^{\text{bat}}), \tag{9}\]  
where, \(U_{\text{dc}}\) is the DC bus measurement voltage, \(U_{\text{dc}}^{\text{ref}}\) is the DC bus reference voltage, \(P_{\text{dc}}^{\text{bat}}\) is the measured output power of the DC side battery #1, \(P_{\text{dc}}^{\text{bat,ref}}\) is the reference output power of the DC side battery #1, \(k_{2}\) is the voltage-power droop coefficient. When battery #1 is in rechargeable and dischargeable mode, \(P_{\text{dc}}^{\text{bat,ref}}\)= 0, \(k_{2}=\left(U_{\text{dc}}^{\max}-U_{\text{dc}}^{\min}\right)/2P_{\text{dc}}^{ \text{bat,max}}\). When battery #1 can only be discharged, \(P_{\text{dc}}^{\text{bat,ref}}=0.5P_{\text{dc}}^{\text{bat,max}}\), \(k_{2}=\left(U_{\text{dc}}^{\max}-U_{\text{dc}}^{\min}\right)/P_{\text{dc}}^{ \text{bat,max}}\).