Design and Experimental Validation of Power Electric Vehicle Emulator for Testing Electric Vehicle Supply Equipment (EVSE) with Vehicle-to-Grid (V2G) Capability

: Nowadays, the global decarbonization and electriﬁcation of the world’s energy demands have led to the quick adoption of Electric Vehicle (EV) technology. Therefore, there is an urgent need to provide a wide network of fast Vehicle-to-Grid (V2G) charging stations to support the forecast demand and to enable enough autonomy of such devices. Accordingly, V2G charging stations must be prepared to work properly with every manufacturer and to provide reliable designs and validation processes. In this way, the development of power electric vehicle emulators with V2G capability is critical to enable such development. The paper presents a complete design of a power electric vehicle emulator, as well as an experimental testbench to validate the behaviour of the proposal.


Introduction
The development of the Smart Grid is contributing to the integration of renewable energy into the electric grid, which guides the needed decarbonization of energy consumption to deal with climate change and the depletion of fossil fuels. However, this development is increasing the complexity of the electric grid [1], adding new power system elements which must provide reliable operation in all kinds of different situations. One of these new systems is the Electric Vehicle Supply Equipment (EVSE), which is required for the grid integration of the Electric Vehicle (EV), including Battery Electric Vehicle (BEV) and Plug-in Hybrid Electric Vehicle (PHEV). Thanks to the Vehicle-to-Grid (V2G) functionality, the EVSE can work both as a load or as a generation source, using the energy of the EV battery available for secondary purposes, such as peak shaving, load frequency control, demand response or the management of renewable energy surplus [2,3].
It is expected than in 2030, more than the 90% of the EVSE will be private [4], while over the 80% of EV charging currently takes place at home [5]. Accordingly, the main domains for V2G functionality will be Vehicle-to-Building (V2B) or Vehicle-to-Home (V2H), whether the building is connected to the grid or isolated, where several advantages has been proved [6]. In order to use this functionality, EVSE must be integrated into the building Energy Managment System (EMS), which will handle the charging or discharging according to the needs of the building [7,8]. Therefore, to ensure the proper behaviour of these new systems, the research of suitable test systems can establish the Smart Grid development [9,10].
There are several test system techniques in the literature, but the ones that exchange real power with the Hardware-Under-Test (HUT) give the most accurate results, due to the fact that they can probe the full system. A very promising technique to test the full system is the Power Hardware-In-the-Loop (PHIL) technique, which has the best trade-off between test fidelity and test coverage [11]. However, in applications like testing EV chargers, in which the number of tests carried out can be very high and they have a very defined functionality, the PHIL technique can be replaced by a power test bed, or also known as machine emulator [12].
Electric Vehicle Emulators EVE are powerful tools to develop and test EV charging stations. They have been used for a while for testing EVSE communication [13], unidirectional power [14,15] or unidirectional power and communications [16,17]. Besides, the requirements needed for a test bench based on PHIL for testing and verification of EV and EVSE are defined in [18]. However, bidirectional vehicles and chargers have a better impact on the stability of the Smart Grid, offering expanded flexibility services [5]. Therefore, the testing of these systems is an important step in the development of the present and future power electric grid.
This paper presents the details of the design and development for manufacturing the electric vehicle emulator for testing V2G chargers, with power factor grid correction functionality. The paper is organized as follows. Firstly, Section 2 analyses the main needs of the Electric Vehicle Emulator (EVE). The design of the system is described in Section 3, explaining every developed component. Then, in Section 4 the complete test system and some of the main results are shown. Finally, the conclusions are drawn in Section 5.

EV Emulator Needs
The EV battery needs a bidirectional power electronics system to charge and discharge its energy to the electric grid. However, current on-board EV chargers are only unidirectional and are not able to give energy to the grid. The main reason is that, as a rule of thumb, the unidirectional topologies can get higher power densities (W/m 3 ) and more specific power (W/kg) than the bidirectional ones. Therefore, the V2G functionality is only available in DC standards, because in this case, the bidirectional power electronics converter is located in the EVSE, where the specific power index is not especially important. Table 1 shows the current status of the DC chargers standards. Among these standards, CHAdeMO [19] is the first and most used standard with V2G capability [20]. There have been five updates of the protocol in order to include the different necessities of the new EV and their uses. Consequently, an electric vehicle emulator compatible with this standard will cover most of V2G EVSE in the market. Accordingly, the EVE also needs a bi-directional power electronics system to test both charge and discharge. If the emulator takes energy from the same point of common coupling as the V2G charger, the electric consumption during the test is only the sum of EV emulator and V2G charger losses, which saves in general more than 90% of the test energy. Furthermore, if the power factor is close to 1, the test can be done in facilities with lower electric power supply, which also saves money and allows testing in several places. This is important for testing unidirectional chargers, especially old EVSE [21], since the Active Front End (AFE) can be a topology with no control of the reactive power consumed during the charging state. Therefore, an EVE with a four-quadrants AFE will be able to test different types of EVSE, ensuring low apparent power consumption during the complete test.
The end user of EVE should be laboratories which need to check the integration of the EV in a specific electric grid; for instance to test stability, time response, compatibility, etc. However, it could also be interesting for EVSE manufacturers to check the behaviour of their developments and for maintenance purposes. Therefore, extra functionality to debug the correct behaviour of the EVSE will be desired.

Overview
A block diagram of the complete EV emulator system proposed with the HUT EV charger connection is shown in Figure 1.   Figure 1. General EVE testbench block diagram, pointing out the main power subsystems of the EVE (blue) and the HUT (red), as well as the communication interfaces defined between them (dark and light green). The power electronics system is built up of one AC/DC grid side converter and one DC/DC vehicle converter, whose specifications are listed in Table 2. The two components communicate through an embedded low cost gateway, which is called Energy Box (EBox) [22], via Modbus RS485. The EBox also communicates via Modbus RS485 with the grid analyzer to measure in real time the active and reactive power of the HUT and with the Human-Machine Interface (HMI) via TCP/IP. Furthermore, a CHAdeMO protocol communication via CAN has been implemented in the DC/DC, which allows the emulator to interact with HUT, setting the power limits and the desired current during the test. In order to have galvanic isolation in the whole system, a three-phase transformer /∆ is connected between the AFE and the electric grid at 400 Vrms and 50 Hz.  Figure 2 shows the schematic of the DC/DC converter. A three-branches in parallel bridge topology to generate the battery output voltage emulation has been designed. Switching frequency of the IGBTs (SEMIKRON SEMIX302GB12E4s) are 20 kHz, working in the non audible spectrum. A carrier phase-shift scheme is adopted to make the equivalent switching frequency up to 60 kHz, reducing the output voltage ripple, and also the selection of IGBTs with less current capability but better switching efficiency. The output filter is an LC filter, with three coils connected in parallel to the output capacitor. It is a second-order low-pass filter with a resonance frequency ω res given by Equation (1): The resonance frequency of the filter needs to be placed at least one tenth of the switching frequency in order to have a sufficient rejection of the switching components. To avoid resonance problems of the filter, ω res is also placed lower than the control frequency of the system. It allows the control to compensate the resonance current implementing a virtual resistance (R virtual ), which is placed in series with each inductor. This control method improves the overall efficiency of the system, avoiding physical resistance in the filter to dampen the resonance. However, due to the lower ω res , the overall dynamic is reduced but is still enough to guarantee the stability and fidelity of the test. In order to decide the R virtual , Figure 3 shows the bode plot of the LC filter (Equation (2)) with different resistance values.
Ideally, it can be seen in Figure 3 that with a higher R the system is damper. However, a high R virtual will also increase the measurement noise of the current, decreasing the steady state performance. A trade-off between dampening and performance has been chosen, selecting a R virtual = 1 Ω. The frequency response of the filter with the selected resistance is shown in Figure 4, obtaining resonance gain close to 10 dB.

Control Design
The block scheme control of the DC/DC converter is shown in Figure 5. The current of every coil is measured and multiplied by the R virtual , getting the emulation effect of a real resistance in the LC filter. A PI control has been chosen in order to get no voltage error in the steady state output capacitor voltage. The output of the PI regulator is subtracted in every branch by the previous calculation of the R virtual gain, and then divided by the input voltage V dc to obtain the duty cycle in every branch. After that, a carrier phase-shift is implemented in order to obtain 120°phase in each branch PWM.
The gain of this integrator has been calculated to have a cut-off frequency to 16.7 Hz, which gives a step response of the system close to 3 ms. Figure 6 shows the step response of the system to a 40 V instantaneous set-point change.

Hardware Design
The AC/DC converter, used to exchange power with the electric grid, has been designed and manufactured with a three-level Neutral Point Clamped (NPC) topology with SEMIKRON SK150MLI066T IGBTs, as shown in Figure 7. In comparison with the two level converter, this topology reduces the voltage stress on the IGBTs and their switching losses, increasing the output voltage waveform quality.The attenuation of the current switching ripple is done by a third-order LCL grid filter, which is smaller and lower-priced than the first order L filter [23]. Furthermore, the AC/DC converter can operate in the four quadrants, compensating reactive power if needed, even when the DC/DC converter is not working. This functionality makes it possible to perform the complete set of tests in facilities consuming only the active power losses of the whole testbench. This is because the EVE can compensate whenever the power factor of the charger diverges from 1, especially at low charging levels.  Figure 8 shows the general block scheme control of the AC/DC converter, which is based on [24,25]. The controller is divided into the following four layers:

Control Design
• High-level controller: the higher level control is in charge of generating the appropriate active and reactive power references provided to the low level layers of the controller. The purpose is to lead the system to the desired goal: on the one hand, to maintain the desired DC voltage level by regulating the active power output with the voltage regulator box; on the other hand, to adjust the system's reactive power reference by means of providing the needed reactive power output. • Middle-level controller: the middle-level controller is responsible for saturating the power references in order to guarantee that the system remains in its operation working range and does not exceed its limits. Therefore, safety features and operating constraints such as temperature and over-voltages are considered to evaluate whether the desired power objectives are reached or not. Finally, from the power references, the current references are set.
• Low-level controller: the low-level controller is divided into two parts: the current controller that determines the control actions needed to follow the control current references; and the duty control system, in charge of the converter's modulation technique. • Hardware-level controller: the hardware level controls the power converter's drive system, translating the control signals to the physical pulses of the converter.

Hardware Design
The EBox has been described previously in the literature [22]. It is a low cost gateway that uses a Raspberry Pi computing module to manage the high level power electronics system and to run the reactive control algorithm of the EVE. Furthermore, it can communicate with the HMI and the grid analyzer, which allows the gathering of the information of the complete system.

Control Design
To control and ensure the compensation of the EVSE reactive power consumption, the EBox communicates with a grid analyzer to know the reactive power value and send the calculated set-point to the emulator AFE, which generates the desired current. As shown in Figure 9, there are three different grid analyzer configurations: in the output of the V2G charger under test, in the Point of Common Coupling (PCC) of the facility or in both (V2G and PCC).
Depending on the location of the analyzer, the control algorithm implemented in the EBox has to be changed, achieving different performances: • V2G: in this case, the grid analyzer can only measure the power consumed or returned by V2G charger. The control algorithm implemented in this context is an open loop control, which is shown in Figure 10a. This control loop is easy to implement and has a very good time response. However, it is not possible to determine the reactive power at the PCC, and problems such as an incorrect calibration or installation of the EVE could even increase the power consumption in the facility. • PCC: the grid analyzer is located at the point where the facility is connected to the grid. Figure 10b shows the control algorithm, which is a closed loop control with a PI regulator to ensure zero error in steady-state operation. The problem is that the time response of this control is minimum 5-10 times the time step, so loads with an abrupt change of power can be over the limits for a few seconds. • V2G and PCC: the two grid analyzers are installed, one in the V2G charger and the other one in the PCC. The control algorithm is shown in Figure 10c, which is based on the previous closed loop control with a PI regulator. However, in this case, the reactive power of the charger is measured and directly compensated at the output of the regulator. In order to avoid the integration of the error produced by the charger, the derivative of this measure is compensated in the input of the regulator. In this way, the controller achieves a better time response capability. However, it has to be highlighted that the use of two grid analyzers increases close to 2% the final price of the solution.    Figure 11 shows the simulation in MATLAB/Simulink of the reactive power consumption of the three different types of control that have been shown in previous Figure 10. It can be seen that in Figure 11a without any external loads, the reactive consumption in the PCC with open control loop as well as with closed control loop with V2G compensation are the same, while with closed control loop the response is slower than the previous case. However, if there is reactive power consumption by an external load, Figure 11b shows different behaviour. On one hand, with open control loop the reactive power consumption at the PCC in steady-state is determined by the external loads. On the other hand, with closed control loop, the power at the PCC can be fully compensated by the EVE, with a better time response to the V2G power demand by compensating it using two grid analyzers.
Comparing the last two control modes in Figure 11b, it should be noticed that the reactive power error given by the abrupt change of the V2G power at time t = 32 s, is quickly balanced with the third type of reactive control strategy. The reason is that the compensation of the V2G power avoids the error integration in the PI control, improving the time response and performance of the reactive power control at the PCC. Reactive Power (VAr) 10 4 Closed loop with V2G compensation Reactive Power (VAr) 10 4 Closed loop with V2G compensation PCC Reactive V2G Reactive Load Reactive Figure 11. Simulation of the reactive power consumption using the same V2G consumption profile with abrupt consumption changes. Two scenarios have been considered: (a) without power consumption of the external loads; (b) with power consumption of the external loads. In every scenario, all three different control strategies have been tested: open loop, closed loop, and closed loop with V2G compensation.

Test Description
The main equipment involved in the tests is shown in Figure 12. A V2G charger has been used as a HUT and it has been connected to the EVE through a CHAdeMO connection. The bottom box of the emulator is the AC/DC converter and the upper box is the DC/DC converter. Both of them are connected to the EBox, which is also connected to the grid analyzer (Circutor CVM-MINI) via RS-485 and to the HMI through TCP/IP. The transformer is also inside an enclosure for safety reasons. The simplified sequence of the complete test is shown in Figure 13, where it is explained how the system works, and the main processes with their interactions that are running, which are needed to emulate the behaviour of an EV. First, the user has to start the EVE system through the HMI and wait until the DC/DC system is ready to initiate the charge/discharge operation in order to test the HUT accordingly. Then, the user has to plug-in the cable and begin the operation needed to launch the charging/discharging process of the HUT. The user can change the voltage and/or power manually at any time or load a script with the profile of EV charging/discharging, indicating every 0.5 s the required voltage and power via HMI. The test will be finished whenever: the user stops it via HMI, the EVE battery model determines that it has finished the charging/discharging process, or there is any error during the operation.

Manual Set-Point Adjustment
With the aim to test the stability of the emulator, the voltage response at different set-points has been analyzed. Figure 14 shows the manual change of current set-point from 65 to −65 A, with the emulator controlling the same set-point voltage at 300 V. It must be noticed that the slope of the current increment by the charger is 10 A/s, which is within the limits of the CHAdeMO standard [19]. Furthermore, the PI controller implemented in the emulator has a reduced velocity error during the transition of this current variation in the HUT.   Furthermore, it is possible to verify the behaviour of the system for grid management purposes. For example, thanks to this test, it has been verified that this charger could be used to perform frequency grid operation for current set-point changes up to 50 A [26]. Furthermore, the smooth transition between the two set-points, indicates that it is possible to use this EVSE with V2G capability for operations such as peak shaving or management of renewable energy surplus.
The variation of the set-point voltage from 300 V to 200 V is shown in Figure 15. These kinds of battery voltage fluctuations are abnormal in EV batteries, but they allow the user to know the stability and response of the charger to be tested. In this case, the emulator keeps the same set-point power, which produces an increment in the demanded current to the V2G charger. Depending on the time response of the chargers, maximum or minimum power peaks can appear during the voltage transition, which will be larger if the voltage transition is more abrupt.

Load an EV Battery Profile
In this case, a user defined EV battery charge profile has been defined. It consists of a charging process of 5 min, starting the voltage at 350 V with a demanded power of 12 kW. This demanded power decreases until reaching 6.5 kW and the voltage increases up to 358 V, the moment when the emulator sends a stop command to the charger through CHAdeMO communication. The evolution of the voltage and current measured at the emulator output is shown in Figure 16. At the beginning of the charging process, the CHAdeMO's isolation test procedure is performed by the charger, setting 500 V at the input of the emulator. Once the charger verifies that there is not any isolation problem, it closes the emulator power relay. From this point, the emulator control the output voltage and it sends the demanded power to the EVSE, which is defined in the loaded profile of the emulator. This profile can be modified in order to perform different user tests, changing current, voltage and time of the vehicle charge and executed as many times as needed. This feature allows the repeatability of the test, which makes it possible to compare and analyze the response of different HUTs. To test the reactive power compensation, the previous EV battery charging profile has been used, but also adding a profile of reactive power consumption to the charger. A profile with abrupt changes in the reactive consumption has been configured in order to verify the behaviour of the emulator. In this case, the grid analyzer has been placed at the output of the HUT, with an open-loop control implemented in the EBox. Figure 17 shows the results of the test, measured with a power analyzer data logger (Fluke 435-II) at the PCC of the facility. Firstly, the reactive power consumption, without compensating it by the emulator, has been measured by a grid analyzer. Secondly, the same test has been repeated and measured, but this time compensating the reactive power consumption by the emulator. The data from the two measurements have been downloaded and synchronized. The steady reactive power consumption of the HUT is completely compensated by the emulator. However, if the HUT has quick step changes in the reactive power consumption in less than the execution time control of the EBox, it cannot be compensated properly. This behaviour can cause problems in the facility's PCC if the electric protection devices are less than the peak current occurred during the transition. To resolve this issue, it is possible to perform a power consumption characterization of the HUT at every charge/discharge current, and configure a charge/discharge profile in the emulator, including the reactive power that has to be generated by the emulator in order to compensate it.

Conclusions
EVs and V2G chargers have attracted a lot of attention for being considered as part of the solution to increase the share of renewable energy in the electric grid. Since most the EVSE are expected to be at home, these systems are an important tool towards the building EMS to achieve near-zero energy buildings. Therefore, the study and verification of the proper behaviour of these elements can smooth the path to the energy transition. This paper has presented the design, test and results of a power EV emulator with V2G capability. The ability to emulate a real V2G EV to handle fast charge/discharge with an EV charger, consuming only the losses of the complete system, has been validated experimentally. In addition, for small and medium enterprises which only want to test EVSE and do not need the flexibility of a PHIL test bench, it is more economically affordable due to not requiring a fast real-time simulator and a high bandwidth power amplifier.
Future tests will consist of increasing the implemented EVSE protocol to CCS, due to the importance of this standard in Europe. Moreover, testing the AFE of the EVSE under test using the PHIL technique, allows us to verify the complete system: grid and vehicle side. Furthermore, thanks to the recirculation power of the EVE during test, a low power amplifier could be used to emulate the grid behaviour during the PHIL test. In order to test the fast dynamics behaviour of the DC side of a V2G charger, the implementation of a real-time battery model could be done in the EVE. Another future work will be the development of an EVE to test EVSEs which work on a DC grid.