## 3 EV Emulator Design
### EBox
#### 3.4.2 Control Design  
To control and ensure the compensation of the EVE 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  
Figure 8: Control Scheme of the AC/DC converter of the proposed EVE pointing out four control levels: high, middle, low and hardware level. 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 10: Three types of different reactive compensation control strategies: (**a**) Open loop control, measuring reactive power at the output of the V2G charger. (**b**) Closed loop control, measuring reactive power at the PCC of the facility. (**c**) Closed loop control with V2G compensation, measuring both V2G charger and the PCC of the facility. Figure 9: Representation of the two possible locations of the grid analyzer in order to compensate the reactive power injected by the EVE. 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.