*3.3. EV Control during Driving and Parking*

The operation of EV devices is managed by an EV CONTROLLER block. For each operation mode it determines the value of reference current vector *iref* applied to the inverter. In the DRIVING mode the vector module is the function of control signal INV CTRL setting (representing accelerator and brake pedals). Its angular speed is equal to the synchronous machine angular velocity *w*.

In this case the vector of stator current is practically equal to *iref* vector, i.e., it rotates with the same angular velocity as the permanent magnet magnetic flux of the rotor. This results in the electromagnetic torque *Te* driving or braking the vehicle depending on sign of the INV CTRL signal.

In the PARKING mode, after closing the switch CNT, all control and power circuits of the car are connected to the EVSE (part of "EV USER INSTALLATION" module). The EV can perform a chosen function (charging or ancillary services). Two control options are possible depending on the state of the supply network:


In the first option the inverter transmits active power equal to the value set on the INV CTRL slider (in this case the INV CTRL setting can be determined by the Home Energy Management System). For positive signal value the current is in phase with the supplying voltage, which means that the EV batteries are charging. If the signal has a negative value, the current is in opposite phase to the voltage, which means energy is supplied to the consumer installation. EV CONTROLLER block determines reference current vector according to the formula:

$$\dot{a}\_{ref} = \frac{P + jQ}{1.5\left(|\upsilon\_h|\right)^2} \upsilon\_h \tag{4}$$

where:

*P*, *Q*—active and reactive power transmitted by the inverter.

Equation (4) is based on the definition of instantaneous power in the machine stator. Its derivation is provided in Appendix A.

The second option (UPS) is activated if there is a fault in the supply network. It results in the BR switch opening. In this case the EV function is to supply the consumer loads with voltage close to nominal. The reference current values are determined to ensure active and reactive power balance within the consumer installation. Simultaneously the voltage in the home installation is compared with the supplying network voltage in block BRAKE CTRL. If the network fault is eliminated the switch BR can be reclosed. Then, the EV CONTROLLER module comes back to performing the function it did before the disturbance.

### **4. Simulation**

In order to demonstrate the performance of the developed model, the following scenarios were simulated in sequence, in single calculation cycle, i.e.,:


Time constant representing the inertia of the car was reduced in such a way that all states could be examined in one simulation and presented in one graph, Figure 3. The states of all switches included in the simulator diagram and the waveforms of quantities enabling the evaluation of the modelled devices work in transient states were recorded. Individual operation states are presented in Figures 4–8, respectively.

**Figure 3.** Main parameters describing processes during all EV operation states, breakers positions, voltages, currents, engine torque and speed.

**Figure 4.** (**a**) EV driving state (accelerating and braking); (**b**) The zoom of the upper diagram, period (1.2–2) s.

**Figure 5.** (**a**) EV operates as energy storage system in normal network state. (**b**) The zoom of the upper diagram, period (5–5.5) s.

**Figure 6.** Inverter voltage and current and the network voltage during charging, 3-phase short circuit, island operation and again charging. The BR signal equeal "0" means that BR breaker is closed.

**Figure 7.** Inverter voltage and current and the network voltage during charging, 2-phase short circuit, island operation and again charging. The BR signal equal "0" means that BR breaker is closed.

In the first scenario (driving state) it was assumed that the vehicle accelerates and brakes to adapt its speed (*w*) to the road traffic conditions, see Figure 4. During the EV acceleration, electromagnetic torque (*Te*) of the EV motor reaches its maximum value. When the road conditions prevent further acceleration (the driver releases the accelerator pedal), the electromagnetic torque reverses and the vehicle begins to decelerate. During the acceleration, when the invertor current (*iinv*) and voltage (*vinv*) are in opposite phases, the energy is transferred from batteries to the engine. Conversely, during regenerative braking, the engine operates as a generator, thus the inverter current and voltage are in phase, the energy is transferred from engine to the batteries.

**Figure 8.** Inverter voltage and current and the network voltage during charging, 1-phase short circuit, island operation and again charging. The BR signal equal "0" means that BR breaker is closed.

During the next scenario the vehicle is parked and connected to the supply network, see Figure 5. The bi-directional power flow is enabled, thus the execution of V2H services can be applied. This service can be controlled by the home energy management system on the basis of factors such as energy prices, user requirements, SOC of EV battery or home installation rated power. The voltages of the traction invertor (*vinv*), the voltage in the home installation (*vh*) and the voltage in the supply network (*vn*) are equal. The inverter current (*iinv*) changes (amplitude, phase) so the power can be transferred from or to the supply network. In Figure 5 the phase of inverter current corresponds to the battery current (*IDC*). When the on-board motor inverter operates as the battery charger (*IDC* is positive) the voltage and invertor current are in phase. When energy is transferred to the customer installation (battery discharging, *IDC* is negative) the phase between current and voltage is shifted by 180 degrees.

The next three drawings correspond to the third scenario, i.e.,: the 3-phase short circuit—Figure 6, the 2-phase short circuit—Figure 7 and the single-phase short circuit—Figure 8. In all the figures, the order of events is the same. The simulation starts with the EV battery being charged. The voltages of the motor invertor, home installation and supplying network are the same. The motor invertor current and voltage are in phase. Then, the fault in the supply network occurs, which results in *vinv*, *vn* and *vh* voltages decreasing, respective to the type of short circuit. In the response to the network fault, the protection controller trips the BR breaker. The vehicle inverter changes control strategy from battery charger to UPS and the home installation starts the islanded operation. One can notice that the home installation voltage reaches nominal value immediately. Moreover, the amplitude of invertor current changes respective to the customers loads. During island operation the EV inverter operates autonomously. When the fault in the supply network is removed, the synchronization process can be started. When the voltages in the home installation and in the supply network are in phase the BR breaker is reclosed and the EV inverter returns to the battery charging operation that can be controlled by the HEMS again.
