Microgrid Controller Testing Using Power Hardware-in-the-Loop

Required functions of a microgrid become divers because there are many possible configurations that depend on the location. In order to effectively implement the microgrid system, which consists of a microgrid controller and components with distributed energy resources (DERs), thorough tests should be run to validate controller operation for possible operating conditions. Power-hardware-in-the-loop (PHIL) simulation is a validation method that allows different configurations and yields reliable results. However, PHIL configuration for testing the microgrid controller that can evaluate the communication between a microgrid controller and components as well as the power interaction among microgrid components has not been discussed. Additionally, the difference of the power rating of microgrid components between the deployment site and the test lab needs to be adjusted. In this paper, we configured the PHIL environment, which integrates various equipment in the laboratory with a digital real-time simulation (DRTS), to address these two issues of microgrid controller testing. The test in the configured PHIL environment validated two main functions of the microgrid controller, which supports the diesel generator set operations by controlling the DER, regarding single function and simultaneously activated multiple functions.


Introduction
Electricity is still not a granted service for almost a billion people around the globe, mostly in Sub-Saharan Africa, South Asia, and Latin America [1]. These isolated areas with sparse populations pose a real challenge for electrification efforts. Due to their peculiarities, such areas are not reachable by traditional grid-extension solutions [2]. An unorthodox approach is required to supply electrical energy to these locations with stand-alone systems that can address geographical and physical limitations.
In the microgrid of remote areas, the main source of electricity has always been diesel generator (DG) sets. This has negative aspects such as CO 2 emissions, operation and maintenance costs, fuel costs, and availability. Variable renewable energy (VRE) sources, such as photovoltaic (PV) and wind, are alternative solutions in this domain [3]. They provide energy in a cleaner and more environmentally-friendly way compared to the grid extension solutions [4]. Although they can provide electricity with smaller geographic constraints, their intermittent and variable generation must be addressed. To realize stable and reliable power supply in the microgrid with VREs, energy storages, which compensate for balancing generation and load, and the microgrid controller, which monitors and operates the status of microgrid components, are necessary. Two core functions of the 2 of 15 microgrid controller, i.e., the dispatch function and the transition function are specified [5], and the expected minimum testing requirements of the microgrid controller are discussed [6,7]. Moreover, various functions to meet the requirements and the philosophies of microgrids have been proposed [8].
Since there are many possible configurations that depend on location and purpose, the required functions of microgrid controllers become diverse.
In order to effectively lead the microgrid controller to on-site deployment in a sophisticated condition, thorough validation testing needs to be run on the microgrid controller. The testing can be performed in different ways. Simulation, being one of them, provides quick and flexible testing. It has low fidelity, and this can be mitigated with laboratory testing. However, laboratory testing is performed with real-equipment and setups. This is time-consuming and prone to errors. On the other hand, a new approach called hardware-in-the-loop (HIL) simulation provides flexibility and yields very precise results [9]. Each validation method should be selected depending on the development stages, while HIL is a reasonable option from the viewpoint of testing the prototype and the final product of commercial microgrid controllers.
Laboratory testing has the capability to test hardware with high fidelity conditions. There are power system research testbeds that can provide flexible testing environments composed of inverter-based emulators and some distributed energy resources (DERs) [10][11][12]. Since the control system parts of these labs are built by the flexible modeling tools, it is supposed that they have advantages in the stage of developing microgrid control algorithms. They still have potential to improve the flexibility in terms of power system configurations by integrating with the digital real-time simulation (DRTS) [13].
Controller HIL (CHIL) is a sort of HIL simulation that can evaluate the interaction between the controller hardware and the rest of the simulated system. The testing capability of the microgrid testbed was improved by combining DER controllers and the DRTS [14]. The control and the communication of a microgrid and its protection system were evaluated in the CHIL technique. The ancillary service provided by a PV connected to the microgrid was evaluated in the CHIL simulation [15]. The theoretical control algorithm was improved on the basis of the evidence provided by the practical implementation and the interaction between the simulated microgrid. The data communication and management schemes of the multiple agents distributed control implemented in the microgrid central controller were tested in the CHIL system [16]. The CHIL evaluation of a DG set controller for several microgrid operations was presented [17]. The controller performance for the events that occurred in the simulated microgrid was evaluated. The literature described that the CHIL simulation had the capability to test the hardware controller in various power system configurations thanks to the integration with the DRTS. On the other hand, since no real power was applied, and the power system was modeled in the DRTS, the evaluation concerning the effect caused by the actual power interaction was not available.
Power HIL (PHIL) is another HIL simulation method, which interfaces power devices with power amplifiers emulating the behavior of the remaining power system modeled in the DRTS. The accuracy of PHIL testing was validated to compare with the virtual simulation [18]. The validation was focused on the autonomous frequency droop control of the battery energy storage system (BESS) and the DG sets in islanded microgrid. The PV inverter that provides local control of frequency and voltage support functions was tested [19]. The low-voltage (LV) microgrid was modeled in the PHIL simulation, and the PV inverter under test was connected to a bus of the microgrid via a power amplifier and a current sensor. The PHIL configuration was proposed for the analysis of a direct current (DC) microgrid as well as an alternating current (AC) microgrid [20]. The validity of the PHIL simulation for the DC microgrid and its simulation stability were evaluated. Most studies about microgrid PHIL testing focused on evaluating the autonomous control of DERs, not the microgrid controller. From the perspective of testing the microgrid controller, which includes various functions and controls DERs that may interfere with each other, the communication between the controller and the components of the microgrid as well as the power interaction among them needs to be evaluated. Although the conceptual PHIL setup for evaluating both interactions was shown in [21], only testing of autonomous control of a PV Energies 2020, 13, 2044 3 of 15 inverter was performed. The microgrid composed of DERs and loads were tested in the platform combining PHIL and signal-HIL (SHIL) simulations [22]. The microgrid controller was mainly tested on the SHIL scheme; however, the complex power interaction among DERs was not verified because implemented hardware under test was the only load, which does not interfere with other microgrid components. To evaluate the communication and power interaction among the microgrid controller and the components, the PHIL configuration needs to include the microgrid controller and at least one component that is managed by the controller considering the power interaction. However, such a PHIL configuration that enables the evaluation of the aforementioned interactions has not been discussed. Furthermore, the necessity of power rating scaling has not been mentioned. In the existing PHIL simulations, the current and voltage the values fed back to the DRTS are set to reflect the measured values as they are. However, when the power ratings of the microgrid components are different between the deployment site and the laboratory, these values should be appropriately scaled.
The contribution of this paper is to present a PHIL configuration for testing a microgrid controller that: • can evaluate the communication between the microgrid controller and the components as well as the power interaction among them, i.e., DG set, PV, BESS, and load; • appropriately scales the power rating between physical and simulated devices under test (DUT) by adjusting the feedback current and the voltage values to the DRTS.
Main functions of a developing microgrid controller were tested in the configured PHIL environment. The test scenarios were set to observe the interference between the functions, while each function was validated in our previous work [13]. The ultimate goal is to deploy this controller along with BESS and PV systems to a stand-alone island microgrid energized by only DG sets. This paper is structured as follows: Section 2 presents test facilities in Fukushima Renewable Energy Institute, AIST (FREA). Section 3 depicts the configuration details of the microgrid under consideration. Section 4 shows the setup for PHIL testing. Section 5 shows the test results of the microgrid controller in the PHIL simulation, and Section 6 draws the conclusions.

Power System Related Testing Facilities in FREA
In FREA, different testing can be run to validate a range of technologies. Figure 1 shows the overview of FREA highlighting the power system related facilities. On the left stands the Smart System Research Facility (FREA-G), which has the capability to validate devices with or without connection to the grid. The construction was specifically kept flexible to enable the testing to be performed with bidirectional AC sources, e.g., a grid simulator, as well as bidirectional DC sources, e.g., PV/battery simulator, load banks, and line impedances. The features are the gigantic 5 mega volt-ampere (MVA) grid simulator and the 3.3 MVA PV/battery simulator, which are tailor-made for testing that involves power equipment with very high ratings.
The test lab is mainly utilized for research and development of novel technologies, while FREA-G is mainly utilized for authentication testing. It is envisioned that novel testing methods and grid supporting functions of devices developed in the test lab are transferred to FREA-G. The test lab configuration regarding this paper is shown in Figure 2. It is composed of smaller-scale equipment than those in FREA-G. A 500 kW PV demonstration field stands next to the test lab. This field houses PV panels from different manufacturers using several solar cell technologies. This allows one to follow and record performance variations in time [23]. These panels as well as a wind turbine, rated 300 kW, have alternative connections to the test lab and can be integrated for the testing.
Nonetheless, this state-of-the-art facility is no different than others when it comes to flexibility, which is limited by the real equipment in the lab. The PHIL simulation capability is added to FREA to further expand the testing capabilities and cases that can be run. Configurational alterations can be done in a rapid manner, and real power exchange yields reliable results. Figure 3 shows configuration details of the PHIL testing setup. The DRTS simulating the power system transmits necessary signals to the power amplifier, i.e., the grid simulator. The amplifier's output is connected to the device under test (DUT), while the output from the DUT is fed back to the DRTS. Typical PHIL testing consists of only a DUT, and the rest is modeled inside the DRTS; however, this paper describes the PHIL configuration that several devices present in the laboratory are connected to the DRTS as DUTs. Such an integrated approach brings the test case much closer to real-life scenarios and is more likely to convince stakeholders, e.g., grid operators.
Energies 2020, 13, x FOR PEER REVIEW 4 of 15 to the device under test (DUT), while the output from the DUT is fed back to the DRTS. Typical PHIL testing consists of only a DUT, and the rest is modeled inside the DRTS; however, this paper describes the PHIL configuration that several devices present in the laboratory are connected to the DRTS as DUTs. Such an integrated approach brings the test case much closer to real-life scenarios and is more likely to convince stakeholders, e.g., grid operators.

Configuration and Functions of the Microgrid
Microgrid controller testing is run after combining a DRTS and power hardware devices present in the test lab shown in Figure 2. A developing microgrid controller is planned to be used in a standalone island system that is currently energized by DG sets only. Additional BESS and PV  to the device under test (DUT), while the output from the DUT is fed back to the DRTS. Typical PHIL testing consists of only a DUT, and the rest is modeled inside the DRTS; however, this paper describes the PHIL configuration that several devices present in the laboratory are connected to the DRTS as DUTs. Such an integrated approach brings the test case much closer to real-life scenarios and is more likely to convince stakeholders, e.g., grid operators.

Configuration and Functions of the Microgrid
Microgrid controller testing is run after combining a DRTS and power hardware devices present in the test lab shown in Figure 2. A developing microgrid controller is planned to be used in a standalone island system that is currently energized by DG sets only. Additional BESS and PV  to the device under test (DUT), while the output from the DUT is fed back to the DRTS. Typical PHIL testing consists of only a DUT, and the rest is modeled inside the DRTS; however, this paper describes the PHIL configuration that several devices present in the laboratory are connected to the DRTS as DUTs. Such an integrated approach brings the test case much closer to real-life scenarios and is more likely to convince stakeholders, e.g., grid operators.

Configuration and Functions of the Microgrid
Microgrid controller testing is run after combining a DRTS and power hardware devices present in the test lab shown in Figure 2. A developing microgrid controller is planned to be used in a standalone island system that is currently energized by DG sets only. Additional BESS and PV

Configuration and Functions of the Microgrid
Microgrid controller testing is run after combining a DRTS and power hardware devices present in the test lab shown in Figure 2. A developing microgrid controller is planned to be used in a stand-alone Energies 2020, 13, 2044 5 of 15 island system that is currently energized by DG sets only. Additional BESS and PV deployments are also planned. Figure 4 shows the configuration of the microgrid. The current consumers are represented by an aggregated load, and the nominal system values are 200 V and 50 Hz. The controller was designed by Nippon Koei on the basis of the battery control system for providing ancillary service in a bulk power system (NK-EMS in [24]). After PV and BESS deployments, grid voltage and frequency are set by the DG set, and the controller tries to maximize renewable energy use. The DG set is the utility operator's property and cannot be managed by the controller. The communication link with it is only used to monitor its operating conditions. In this paper, two main capabilities of the controller are tested. The first one pertains to frequency control, while the latter is about controlling the DG set's power output.
renewable energy use. The DG set is the utility operator's property and cannot be managed by the controller. The communication link with it is only used to monitor its operating conditions. In this paper, two main capabilities of the controller are tested. The first one pertains to frequency control, while the latter is about controlling the DG set's power output.
Function 1: It focuses on frequency control. The controller's responsibility is to support the DG set capability to maintain the frequency at around the nominal one by controlling the DERs. Should a swing occur, the controller is expected to command the BESS to charge or discharge so as to stabilize the frequency.
Function 2: This function keeps the DG set's output between certain limits. The DG set's output needs to be higher than a certain amount in order to not stop its operation as it is setting the frequency and the voltage of the grid. PV and BESS outputs need to be coordinated by the controller so that the DG set's output is kept above this threshold. Although grid forming functions of inverter-based sources are also studied [25], here, only grid supporting functions are focused on. On the other hand, it is desirable to keep the DG set's output below a certain value because there is one unit inside the DG set, and going beyond this certain limit would require the second unit to be fired. This needs to be avoided as much as possible.

PHIL Testing Configuration
Figure 5 depicts the testing configuration in the lab. A real PV inverter is coupled with a DC simulator, which represents PV modules/arrays. A battery inverter and a battery emulator that is capable of mimicking different characteristics are utilized to implement BESS. The aggregated customer load is emulated by a load bank. Due to the lack of a DG set, the DRTS, which is NovaCor of RTDS Technologies, is utilized to integrate a DG set through the PHIL application. The simulated output of the DG set is amplified via AMETEK MX30 power amplifier and applied to the microgrid power components. Comparing Figures 4 and 5, the mismatch between real ratings of the microgrid equipment and the available test equipment becomes evident. The lab's PV and battery inverters are rated 10 kW and 50 kW, respectively, which are smaller than those in the real microgrid (see Figure  4). Moreover, the DRTS interface with the lab equipment is achieved through a power amplifier, and the upper limit of allowed power exchange is 30 kW. As a workaround of this issue, the testing set up is scaled to 10% of actual ratings, as shown in Table 1. When the actual proportion between equipment ratings is preserved, the interaction between their outputs and how this affects the system frequency and the voltage stays constant. All three pieces of equipment in the lab, i.e., the load as well as two inverters, are monitored by the data acquisition system (DAS) composed of YOKOGAWA WT3000 and WT1800 that capture root means square values of current and voltage with 50 ms. The Function 1: It focuses on frequency control. The controller's responsibility is to support the DG set capability to maintain the frequency at around the nominal one by controlling the DERs. Should a swing occur, the controller is expected to command the BESS to charge or discharge so as to stabilize the frequency.
Function 2: This function keeps the DG set's output between certain limits. The DG set's output needs to be higher than a certain amount in order to not stop its operation as it is setting the frequency and the voltage of the grid. PV and BESS outputs need to be coordinated by the controller so that the DG set's output is kept above this threshold. Although grid forming functions of inverter-based sources are also studied [25], here, only grid supporting functions are focused on. On the other hand, it is desirable to keep the DG set's output below a certain value because there is one unit inside the DG set, and going beyond this certain limit would require the second unit to be fired. This needs to be avoided as much as possible. Figure 5 depicts the testing configuration in the lab. A real PV inverter is coupled with a DC simulator, which represents PV modules/arrays. A battery inverter and a battery emulator that is capable of mimicking different characteristics are utilized to implement BESS. The aggregated customer load is emulated by a load bank. Due to the lack of a DG set, the DRTS, which is NovaCor of RTDS Technologies, is utilized to integrate a DG set through the PHIL application. The simulated output of the DG set is amplified via AMETEK MX30 power amplifier and applied to the microgrid power components. Comparing Figures 4 and 5, the mismatch between real ratings of the microgrid equipment and the available test equipment becomes evident. The lab's PV and battery inverters are rated 10 kW and 50 kW, respectively, which are smaller than those in the real microgrid (see Figure 4). Moreover, the DRTS interface with the lab equipment is achieved through a power amplifier, and the upper limit of allowed power exchange is 30 kW. As a workaround of this issue, the testing set up is scaled to 10% of actual ratings, as shown in Table 1. When the actual proportion between equipment ratings is preserved, the interaction between their outputs and how this affects the system frequency and the voltage stays constant. All three pieces of equipment in the lab, i.e., the load as well as two Energies 2020, 13, 2044 6 of 15 inverters, are monitored by the data acquisition system (DAS) composed of YOKOGAWA WT3000 and WT1800 that capture root means square values of current and voltage with 50 ms. The microgrid controller, on the other hand, monitors terminal data of all equipment with a resolution of 100 ms. multiplied by ten and provided as input to the DRTS. In this test, since the nominal voltage is set to an identical value (200 V) in DRTS and the test lab, only the current value fed back to the DRTS is scaled for adjusting the power rating. This set up enables running validation testing for the microgrid controller by realizing real power exchanges between different components as well as the communication between the controller and the components, although the test lab is not sufficient in terms of equipment variety or sizing. This shows the advantage of the PHIL simulation in testing. In this PHIL setup, the microgrid controller developed by Nippon Koei was brought into the test lab in FREA. Once the communication interface of the microgrid controller and the lab devices is set, it can be tested as a blackbox. In other words, the lab test can be performed without the need to know the internal design of the controller.

Results of Microgrid Controller Testing in PHIL Simulation
Validation testing is run on the PHIL configuration to monitor performance of the microgrid controller. A main focus of this testing is to validate the mutual interference between functions 1 and 2. The operation of the microgrid controller is validated when both functions 1 and 2 are simultaneously activated, while each single function was tested in our previous work [13]. The test is carried out in two scenarios. In the first test, the performance of function 1 is assessed. Then, the test is carried out with both functions 1 and 2 activated. The PV output is set to zero throughout all test scenarios. Figure 6 shows the testing results of a load increase event with and without function 1, which support to maintain the frequency around the nominal one by controlling the BESS. The load is  The PHIL application is utilized to couple the lab setup with the DRTS where a DG set is simulated. The second component, i.e., dynamic PQ source, is utilized to model the lab inside the DRTS. Since the simulation does not have any rating limitations, it follows real rating values, e.g., 225 kW for the DG set. The interface through the amplifier scales down the simulated power values to 10% and reflects as the output. The opposite is also true; power outputs of all other components are multiplied by ten and provided as input to the DRTS. In this test, since the nominal voltage is set to an identical value (200 V) in DRTS and the test lab, only the current value fed back to the DRTS is scaled for adjusting the power rating. This set up enables running validation testing for the microgrid controller by realizing real power exchanges between different components as well as the communication between the controller and the components, although the test lab is not sufficient in terms of equipment variety or sizing. This shows the advantage of the PHIL simulation in testing. In this PHIL setup, the microgrid controller developed by Nippon Koei was brought into the test lab in FREA. Once the communication interface of the microgrid controller and the lab devices is set, it can be tested as a blackbox. In other words, the lab test can be performed without the need to know the internal design of the controller.

Results of Microgrid Controller Testing in PHIL Simulation
Validation testing is run on the PHIL configuration to monitor performance of the microgrid controller. A main focus of this testing is to validate the mutual interference between functions 1 and 2. The operation of the microgrid controller is validated when both functions 1 and 2 are simultaneously activated, while each single function was tested in our previous work [13]. The test is carried out in two scenarios. In the first test, the performance of function 1 is assessed. Then, the test is carried out with both functions 1 and 2 activated. The PV output is set to zero throughout all test scenarios. Figure 6 shows the testing results of a load increase event with and without function 1, which support to maintain the frequency around the nominal one by controlling the BESS. The load is initially Energies 2020, 13, 2044 7 of 15 set to 7 kW. The DG set meets all of the demand (70 kW inside the DRTS), and the frequency value is at 50 Hz. When time t = 1.0 s, the load is increased to 19 kW. The frequency profiles, shown in Figure 6a, indicate that frequency deviation from the nominal frequency is mitigated after the second to the third swing by activating function 1. The frequency stays beyond 49.8 Hz for 1.02 seconds with function 1, while it takes 2.09 s without one. Figure 6b,c show the output of DG set and BESS. It can be found that the mitigation of frequency swing is caused by the BESS discharging control, which results in supporting the DG set control based on the command from the microgrid controller. Since function 2 is not activated in this test, the higher boundary for the output of DG set is exceeded.

Testing Results When Function 1 Is Only Activated
in Figure 6a, indicate that frequency deviation from the nominal frequency is mitigated after the second to the third swing by activating function 1. The frequency stays beyond 49.8 Hz for 1.02 seconds with function 1, while it takes 2.09 s without one. Figures 6b and 6c show the output of DG set and BESS. It can be found that the mitigation of frequency swing is caused by the BESS discharging control, which results in supporting the DG set control based on the command from the microgrid controller. Since function 2 is not activated in this test, the higher boundary for the output of DG set is exceeded. Figure 7 shows the similar test results regarding a load decrease event. The load is initially set to 19 kW. The DG set meets all of the demand (190 kW inside the DRTS), and the value of operation frequency is at 50 Hz. When time t = 1.0 s, the load is reduced to 7 kW. Figure 7a shows that function 1 can mitigate the frequency deviation from the nominal frequency after the second swing. When function 1 is implemented, the frequency value is higher than 50.2 Hz for 0.87 s. Otherwise, 2.14 s of recovery time is required. The effect of BESS charging control commanded from the microgrid controller, which mitigates the frequency fluctuation, can be observed in Figures 7b and 7c.  1 can mitigate the frequency deviation from the nominal frequency after the second swing. When function 1 is implemented, the frequency value is higher than 50.2 Hz for 0.87 s. Otherwise, 2.14 s of recovery time is required. The effect of BESS charging control commanded from the microgrid controller, which mitigates the frequency fluctuation, can be observed in Figure 7b,c.  Figure 8 shows the testing results of a load increase event when both functions 1 and 2 are activated and not activated. The load is initially set to 7 kW. The DG set meets all of the demand (70 kW inside the DRTS) and keeps a frequency at 50 Hz. When time t = 1.0 s, the load value is increased to 19 kW. Figure 8a shows frequency variation with and without the functions. It suggests that the frequency fluctuation is mitigated after the second to the third swing due to the functions. The frequency stays beyond 48.9 Hz for 0.59 s with the functions, while it takes 2.09 s without any function. This result suggests that the frequency nevertheless mitigated the activation of function 2.   Figure 6b, the DG set output is reduced and maintained lower than the upper threshold by additional activation of function 2. The upper threshold is set to prevent the output of the DG set from requiring generation exceeding its capacity. Although the assumed value here would be lower than the realistic value, the test condition is sufficient to confirm the intended reaction of the microgrid controller. Comparison of Figures 8c and 6c clarifies the difference of BESS control contributions. The discharging amount of the BESS increases by function 1 and stays on around 5 kW by function 2 in Figure 8c, while it gradually decreases along to the reduction of the frequency fluctuation in Figure 6c.

Testing Results When Both Functions 1 and 2 Are Activated
DRTS) with 50 Hz frequency. When time t = 1.0 s, the load value is reduced to 7 kW. Figure 9a shows the frequency variation with and without the functions. Similarly, it suggests that the frequency fluctuation is mitigated after the third swing by implementation of the functions. The frequency value stays above 50.2 Hz for 0.92 s when the functions are on and 2.13 s otherwise. This result suggests that the frequency nevertheless mitigated activation of function 2. Figures 9b and 9c show that the BESS discharging due to function 2 becomes zero after the load reduction, and the DG set output becomes lower than the threshold. For more detailed information, the voltage and the current measurements are shown in Appendix A. Figure 10 summarizes the time duration that frequency deviation from the nominal frequency 50 Hz is larger than 0.2 Hz. The time duration is reduced by implementation of function 1 in both load change events. Furthermore, the additional activation of function 2 provides equal or better effect on the frequency deviation. These results as well as Figures 6b, 7b, 8b, and 9b, which show the validity of function 2, indicate functions 1 and 2 of the microgrid controller are valid, even when both functions are simultaneously activated.  Figure 9 shows the similar testing results regarding a load decrease event. The load is initially set to 19 kW. The BESS provides 5 kW (50 kW in the DRTS) due to function 2 so that the DG set output is not over the upper threshold. The DG set supplies the remaining power 14 kW (140 kW inside the DRTS) with 50 Hz frequency. When time t = 1.0 s, the load value is reduced to 7 kW. Figure 9a shows the frequency variation with and without the functions. Similarly, it suggests that the frequency fluctuation is mitigated after the third swing by implementation of the functions. The frequency value stays above 50.2 Hz for 0.92 s when the functions are on and 2.13 s otherwise. This result suggests that the frequency nevertheless mitigated activation of function 2. Figure 9b,c show that the BESS discharging due to function 2 becomes zero after the load reduction, and the DG set output becomes lower than the threshold. For more detailed information, the voltage and the current measurements are shown in Appendix A. (c)

Conclusions
Flexible testing capabilities are required to account for more dynamic power systems of the future. This means the conventional laboratory testing setups have become too limited, as they have specific configurations and ratings. The simulation is very flexible, yet the results are not as reliable. The PHIL testing technology is a solution that address these issues. It gives the necessary adaptable nature to test labs while keeping the test results as close as possible to real life. In this paper, a PHIL testing was performed to validate the operation of a microgrid controller. The main contribution of this paper was to configure the PHIL environment that:


can validate the communication between microgrid controller and components as well as the power interaction among microgrid components;  scales the power rating between physical and simulated DUT for compensating the difference between the deployment site and the laboratory.
Necessary steps of the PHIL modeling and interface were presented. Two main functions of the controller, which stabilize the frequency and maintain the DG set's output within the certain limits by controlling the BESS, were investigated. The testing results validated the functions when a single function was independently activated as well as when both functions were simultaneously activated. Furthermore, it was shown that the built PHIL testing environment is capable of handling testing with a resolution of 100 milliseconds. These results lead us to the conclusion that other power system control or generator dispatch studies can be performed with the proposed PHIL setup. Building on the obtained results herein, a faster frequency control capability is being developed and will be integrated with the microgrid controller. The other functions of the microgrid controller are based on the power dispatching for supporting microgrid operations such as PV curtailment and peak shaving. They could be tested in the proposed PHIL configuration.

Conclusions
Flexible testing capabilities are required to account for more dynamic power systems of the future. This means the conventional laboratory testing setups have become too limited, as they have specific configurations and ratings. The simulation is very flexible, yet the results are not as reliable. The PHIL testing technology is a solution that address these issues. It gives the necessary adaptable nature to test labs while keeping the test results as close as possible to real life. In this paper, a PHIL testing was performed to validate the operation of a microgrid controller. The main contribution of this paper was to configure the PHIL environment that: • can validate the communication between microgrid controller and components as well as the power interaction among microgrid components; • scales the power rating between physical and simulated DUT for compensating the difference between the deployment site and the laboratory.
Necessary steps of the PHIL modeling and interface were presented. Two main functions of the controller, which stabilize the frequency and maintain the DG set's output within the certain limits by controlling the BESS, were investigated. The testing results validated the functions when a single function was independently activated as well as when both functions were simultaneously activated. Furthermore, it was shown that the built PHIL testing environment is capable of handling testing with a resolution of 100 milliseconds. These results lead us to the conclusion that other power system control or generator dispatch studies can be performed with the proposed PHIL setup. Building on the obtained results herein, a faster frequency control capability is being developed and will be integrated with the microgrid controller. The other functions of the microgrid controller are based on the power dispatching for supporting microgrid operations such as PV curtailment and peak shaving. They could be tested in the proposed PHIL configuration. bus, the voltage profiles are almost identical; therefore, only voltage measured at the BESS terminal is shown.  Figures 8 and 9. These figures describe the voltage and the current measurements of the DG set and BESS. Since they are connected to the same bus, the voltage profiles are almost identical; therefore, only voltage measured at the BESS terminal is shown.