## 4 Real-Time Experimental Tests  
The real-time experimental tests were done in the testbed presented in Figure 17a that emulates the IIREVs, having a step time of 1/14 kHz. The chargers are emulated with two DC emulators having each 6 kW, designated by charging terminals equipped with multi-electrical outlets as shown in Figure 17b. It is considered that the DC emulator 1 is a charging terminal with two electrical outlets to emulate EV1 and EV2 and the DC emulator 2 is a charging terminal with three electrical outlets to emulate EV3, EV4, and EV5. The existing testbed allows the PV power profile to be emulated, which permits it to repeat the experimental test and compare it in two scenarios, with and without optimization. \(SOC_{EV\_{m}re}\), \(SOC_{EV\_{des}}\), \(tar_{v}\), and \(M_{v}\) are randomly generated. Table 3 provides the parameters used for \"real-time exp\" and power balancing control. Figure 17: (**a**) Testbed for the IIREV experimental platform and (**b**) representative image of the multi-outlet charging terminals. The parameter values used in Table 3 were chosen with a scale divided by ten, compared to the simulation, due to the physical limitations of the available sources and equipment. The existing stationary storage had an energy capacity of 37.44 kWh, which is considered high; therefore, the SOC limits were chosen to be between 60% and 35% instead of 80% and 20%. In the real-time experiment, at each EV arrival, the optimization was executed when the EV user came to the charging station and input their preferences, which were communicated with the dSPACE. Then, Python read the data from dSPACE and created the files required to run the optimization in C++, solved by CPLEX. Then, Python calculated \(k_{D}\) and sent it in dSPACE to be read in a real-time experimental model. Figure 18 shows the flowchart of the optimization solving for the \"real-time exp\". The corresponding \(k_{D}\) was calculated as in (33) from the optimized power flow for the corresponding EV arrival event. The obtained \(k_{D}\) was then updated into the Simulink model. To be specific, at the start of the real-time experimental test, when there were no EVs, the optimization algorithm was executed for the first time, using only the prediction of PV power. Then, when the first EV arrived at the station, the EV data were acknowledged, and the EV user chose his desired SOC and charging mode. These data were communicated instantly by the real-time experimental model and were sent through a real-time target via a fiber optic cable that ensured communication with analog input/output ports. After that, dSPACE received the EV data as an analog input; next, Python read these data and created the files required, including the parameters and the profiles of PV predicted power and EV power profiles acquired from the HMI. Later on, Python called C++ to resolve the optimization problem using the CPLEX solver. Once the problem was resolved, Python calculated \(k_{D}\) and sent it as analog output to the dSPACE; in turn, it sent it to the real-time experimental model. When another EV came to the station, the same procedure was performed with the actualized data of the DC microgrid (thus, the SOC of the stationary storage and SOC of the current EVs charging were actualized). The following subsections present two case studies to prove the feasibility of the optimization problem in real-time experimental tests formulated as MILP under different meteorological conditions. Figure 18: Flowchart of optimization solving.