**4. Simulations and Discussions**

To validate the hierarchical control developed in the paper, the simulation code of multiple ESs tied to a microgrid has been worked out on the MATLAB/Simulink platform, as drawn in Figure 8. Parameters for the case study of an ES system is shown in Table 1. In the figure, switch *S* is set to activate or deactivate the load *R* from the system to realize the mismatch of the active power between the power source and the load, which will lead to the system frequency variation. The code includes a grid simulator and three ESs. The grid simulator is mainly used to emulate the voltage and frequency excursions during islanded situation. Each ES is packaged into a separate module so as to dispose of a code with plug-and-pull characteristics. The parameters of each module are set at the same value, which is convenient to enter the data for a microgrid with multiple ESs.

**Figure 8.** MATLAB/Simulink platform for microgrid with three ES-2.


**Table 1.** Parameters for the case study of an ES system.
