# Power Sharing Control in a Grid-Tied DC Microgrid: Controller Hardware in the Loop Validation
## 2 MGIS: Description, Modeling, and Design
### H Full Bridge Converter Description and Modeling  
In order to propose the HFBC model, a sinusoidal type \(u\) modulating function is initially defined as described by Equation (7).  
\[u=msin(\omega t+\alpha) \tag{7}\]  
where \(m\) is the amplitude of the modulator, \(\alpha\) is its phase angle with respect to the MG voltage, \(\omega\) is its angular frequency defined as \(\omega=2\pi f\) and \(f\) defines the operating frequency of the HFBC, which is equal to the frequency of the MG. To generate the switching function of the power switches \(Q_{1}\), \(Q_{2}\), \(Q_{3}\) and \(Q_{4}\), the sinusoidal pulse width modulation (SPWM) unipolar technique type was used [50]. The HFBC power circuit and the schematic SPWM modulator are shown in Figure 2.  
Once the switching strategy has been defined, a simplified HFBC circuit is generated by replacing the two power switches on each branch with a single pole double throw (SPDT) switch. With this simplification, the power circuit of Figure 2 is reduced to the form shown in Figure 3, where \(Q_{1}-Q_{2}\) are replaced by \(SW_{1}\) and \(Q_{3}-Q_{4}\) by \(SW_{2}\).  
Figure 2: Schematic SPWM modulator and the stage formed by the power devices.  
From the simplified representation of the power circuit shown in Figure 3, the dependence between the voltages and currents of the AC side and the DC side is obtained. Table 1 shows the possible combinations of the switching functions of the SPDT switches, and the values obtained _for_\(v_{ab}\) and i\({}_{dc}\) in terms of \(v_{dc}\) and \(i_{a}\). The variables \(q_{1}\) and \(q_{2}\) are the switching functions of \(SW_{1}\) and \(SW_{2}\), respectively, and the variable \(q\) is defined as \(q=(q_{1}-q_{2})\).  
The switching function \(q\) is equivalent to the sum of the modulating signal, \(u\), and several high frequency components, due to the presence of the triangular signal in the modulator, which are neglected because the frequency of the triangular signal is much higher than the frequency of the modulating signal, so that \(q=u\)[51]. From this equivalency and Table 1, expressions for \(v_{ab}\) and \(i_{dc}\) are obtained in terms of \(v_{dc}\) and \(i_{a}\), as shown in Equations (8) and (9).  
\[v_{ab}=uv_{dc} \tag{8}\]  
\[i_{dc}=ui_{a} \tag{9}\]  
With Equations (8) and (9), a new simplification of the power stage of the scheme presented in Figure 1 is generated, replacing the switches with dependent current and voltage sources, obtaining the simplified scheme of the MGIS as illustrated in Figure 4. By applying [PERSON]'s voltage law (KVL) in the loop that includes the inductor \(L\), the expression presented in Equation (10) is obtained. Subsequently, when using [PERSON]'s current law (KCL) on the node that includes the capacitor \(C\), the expression of Equation (11) is generated.  
\[\frac{di_{a}}{dt}=\frac{1}{L}[uv_{dc}-i_{a}r-v_{g}] \tag{10}\]  
\begin{table}
\begin{tabular}{c c c c c} \hline \(q_{1}\) & \(q_{2}\) & \(q\) & \(v_{ab}\) & \(i_{dc}\) \\ \hline
0 & 1 & \(-1\) & \(-v_{dc}\) & \(-i_{a}\) \\
1 & 0 & 1 & \(v_{dc}\) & \(i_{a}\) \\
1 & 1 & 0 & 0 & 0 \\ \hline \end{tabular}
\end{table}
Table 1: Definition of the switching functions.  
Figure 4: Representation of the switched model.  
Figure 3: H full bridge converter simplified circuit using SPDT switches.  
\[\frac{dv_{dc}}{dt}=\frac{1}{C}\bigg{[}-ui_{a}-\frac{1}{R}v_{dc}+i_{PV}\bigg{]} \tag{11}\]