# Power Sharing Control in a Grid-Tied DC Microgrid: Controller Hardware in the Loop Validation
## 5 Conclusions  
Analysis of the MGISE response shows that the developed platform satisfactorily reproduces the behavior of the real system. This is verified by comparing the responses of the MGISE with the simulations. In the case of the variable \(i_{a}\), in open loop, mean absolute errors of between \(-0.27\) and \(-0.06\) A were obtained. These errors represent a variation of between 0.58% and 1.94% with respect to the maximum and minimum values of this variable in the stable state, ranging from \(\pm\) 10.28 A to \(\pm\) 13.93 A, for the inverter and rectifier modes, respectively. Similarly, the errors obtained for the variable \(v_{dc}\), in open loop, represent a variation of between 0.41% and 1.38% with respect to the average values that this variable reaches in stable state. In the case of closed loop experiments, the variable \(i_{a}\) presents variations between 0.44% and 1.96%, the variable \(v_{dc}\) presents variations between 0.19% and 0.22% and the variable \(P\)--between 0.4% and 0.88%; the average value of the variable \(Q\) in steady state oscillates the value of 0, so a relative error value was not calculated for it. Given that the variation observed in the open loop is small, with a maximum error of 1.94%, it is concluded that the MGISE reproduces the behavior of the real system with acceptable fidelity. Conversely, even though the responses in closed loop differ to a greater extent compared to the responses in open loop, it is worth mentioning that the controller implemented in PSIM is a continuous controller, while the controller implemented for C-HIL platform validation is a discrete controller. Another important aspect is that in PSIM, both the controller and the MGIS operate simultaneously and synchronously, in the same simulation, so the PLL in PSIM will inherently present better results than in the embedded system. These two differences between the simulated controller in PSIM and the embedded controller influence the observed difference in the response of the controlled system. The HILP execution time is a feature to take into consideration in the difference between systems. A C-HIL simulation presents, generally, a time delay between acquisition and HILP signal generation, due to the hardware's propagation time. This time affects the total harmonic distortion, as discussed in [41]; nonetheless, the spectral analysis presented in the results section shows that the implemented platform integration time does not affect this variable significantly. In conclusion, the proposed platform demonstrates its usefulness in the validation of controllers for the management of power sharing between the MG and a DC uG. The IT of the proposed platform is 6 us; in the studies presented in Section 1, the ITs range between 10 ns and 2 ms, being more common order times of us. Of the 16 ITs \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Operation Mode** & **Variable** & **Mean Absolute Error** \\ \hline \multirow{4}{*}{Open loop rectifier} & MATLAB & \(i_{a}\) & \(-0.26\) A \\  & & \(v_{dc}\) & \(-1.47\) V \\ \cline{2-4}  & PSIM & \(i_{a}\) & \(-0.27\) A \\  & & \(v_{dc}\) & \(-3.75\) V \\ \hline \multirow{4}{*}{Open loop inverter} & MATLAB & \(i_{a}\) & \(-0.07\) A \\  & & \(v_{dc}\) & \(-4.92\) V \\ \cline{2-4}  & PSIM & \(i_{a}\) & \(-0.06\) A \\  & & \(v_{dc}\) & \(-3.13\) V \\ \hline \multirow{4}{*}{Closed loop rectifier} & \(i_{a}\) & \(-0.3\) A \\  & & \(v_{dc}\) & \(-0.67\) V \\ \cline{1-1}  & & \(P\) & \(-10.79\) W \\ \cline{1-1}  & & \(Q\) & \(-45.32\) VAR \\ \hline \multirow{4}{*}{Closed loop inverter} & \(i_{a}\) & \(-0.05\) A \\ \cline{1-1}  & & \(v_{dc}\) & \(-0.81\) V \\ \cline{1-1}  & & \(P\) & \(3.46\) W \\ \cline{1-1}  & & \(Q\) & \(115.89\) VAR \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Mean absolute errors. presented, 12 are in the range of 1 to 200 \(\upmu\)s. In this respect, the proposed platform presents an IT similar to those reported in the literature, being even lower than those reported in [15; 16; 17; 18; 22; 23; 24; 25; 27; 34; 41].