## 3 Modeling of the Microgrid
### PV System  
The PV module can be characterized by a nonlinear I-V curve that changes according to the local temperature and irradiance conditions. Among the different proposals to accurately represent the PV module, the most used is the single-diode model, shown in Figure 3, due to its good compromise between simplicity and accuracy. Furthermore, it is possible to estimate the model's parameters based on the data provided in the panel manufacturer datasheet [7]. Table 1 describes the characteristics of the one-diode model elements.  
Figure 3: Equivalent circuit of the photovoltaic cell.  
Figure 2: Microgrid energy management strategy.  
Equations (1)-(4) demonstrate the equation of the PV panel for the light-generated photocurrent as presented in [7]. The output current of the single diode model is a function of the output voltage, and it can be described as:  
\[I=I_{g}-I_{sat}\left[e^{(\frac{V+I_{g}}{Vt})}-1\right]-\frac{V+IR_{s}}{R_{p}} \tag{1}\]  
\[V_{t}=\frac{N_{s}Akt}{q}\ \ldots \tag{2}\]  
where \(V\) and \(I\) are the module output voltage and current, \(I_{g}\) is the photogenerated current, \(I_{sat}\) is the reverse saturation current of the diode, \(V_{t}\) is the thermal voltage, \(q\) is the electron charge, \(A\) is the ideality factor of the diode, \(k\) is the Boltzmann constant, \(T\) is the module temperature, \(N_{s}\) is the number of series-connected cells forming the PV module, and \(R_{s}\) and \(R_{p}\) are the series and the parallel resistances, respectively.  
The PV module manufacturers do not directly provide the five parameters of the single-diode model. For this reason, it is difficult to determine those parameters using simple analytical methods. Instead, all datasheets provide the following information for the standard test conditions (STC): open-circuit voltage (Voc), short-circuit current (Isc), MPP voltage (Vmp), MPP current (Imp), a temperature coefficient for Voc (kV), a temperature coefficient for Isc (ki), and maximum power (Pmp). An analysis of the electrical model in three operation points of the I-V curve (Isc, Voc, and Pmp) allows the unknown parameters of the electrical model to be related to the datasheet information.  
Several authors propose novel photovoltaic parameter estimation methods. This article uses the method proposed in [7], which involves finding the five unknown parameters that guarantee the absolute minimum error between the P-V curves generated by the electrical model and the P-V curves provided by the manufacturers' datasheets for different external conditions, such as temperature and irradiance. \(I_{g}\) is given by (3), \(I_{sat}\) is obtained from (4):  
\[I_{g}=[I_{sc,STC}+k_{i}(T-T_{R})]\frac{S}{1000}. \tag{3}\]  
\[I_{sat}=\frac{I_{g}-\frac{V_{g}}{R_{p}}}{e^{\frac{V_{g}}{Vt}}-1}\ldots. \tag{4}\]  
A complete scan of all possible values of A (from 1 to 2, with a step of 0.01) and \(R_{s}\) (from 0 to 2 \(\Omega\), with a step of 1 m\(\Omega\)) is made.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Model** & **Feature** \\ \hline One-diode model & Considers the photogenerated current and the diffusion diode current, which correspond to the electronic conduction phenomena in the neutral zone of the semiconductor. \\ Series resistance & Represents the losses of the metal contacts of the module. \\ Parallel resistance & Represents losses from eddy currents circulating in the module. \\ Diode & Represents the recombination of carriers in the semiconductor charge zone. \\ \(I_{PH}\) & Current generated by the PV cell. \\ \hline \hline \end{tabular}
\end{table}
Table 1: Model of photovoltaic modules.