Electric vehicle

Detailed overview of the model definition, components, and capabilities of the Electric Vehicle model in the Microgrid Library.


This model consists of an electric vehicle (EV) with a 270 kW induction motor and a 250 Ah Li-ion battery. The 150 kVA battery charger is implemented using the Battery Inverter component from the Microgrid Library, which supports grid forming and following modes for vehicle-to-grid, grid-to-vehicle, and Uninterruptible Power Supply (UPS) operation. The powertrain control module (PCM) is based on a Field-Oriented Control (FOC) scheme with regenerative braking capability. The model includes a 20 kVA load for simulating the UPS mode. This is done by switching the battery inverter to grid-forming mode and disconnecting the grid.

This application example model does not implement any specific manufacturer’s topology for the drivetrain or for the battery converter. Rather, it demonstrates the use of ready-to-use power electronics and microgrid components in order to build a high-fidelity, system-level application. The Signal Processing toolbox is used to implement the powertrain controller and the mechanical load model.

Model description

The model comprises of three main subsystems:

  1. Grid and Residential Load
  2. Charging Station
  3. Electric Vehicle

Figure 1: Electric vehicle with charging station

The three-phase grid consists of a 240 V / 60 Hz voltage source and an RL-section impedance. The grid is connected to the rest of the circuit by the contactor S1, as can be seen in Figure 2. Next to the contactor is a 20 kVA load, which represents a household load that can draw power either from the grid or from the vehicle battery.

Figure 2: Grid and residential load subsystem

The Electric Vehicle (EV) consists of 4 main components:
  • On-board 22 kVA Battery inverter
  • Lithium-ion Battery
  • Three-Phase Inverter with LC filter
  • Induction motor

Figure 3: Charging station battery inverter

The battery inverter (Figure 3, right from the core coupling) is a component from the Microgrid Library, and it is implemented as a full switching model with its own control both in the grid following and the grid forming mode. In order to scale-down the inverter to 22 kVA, the component model is kept intact and only the mask-level parameters are changed (Table 1).

Table 1. Battery inverter changed parameters
Parameter New values Default values
Nominal power 150 kVA 1.6 MVA
Nominal voltage 240 V 480 V
Nominal DC link voltage 400 V 10 kV

The EV presented in this model is realised using a battery with the following parameters:

Table 2. Battery parameters
Type Lithium-Ion
Nominal voltage 400 V
Capacity 250 Ah

The Electric Vehicle subsystem consists of the EV model and the PCM. The electric vehicle model is shown in Figure 4. The internal modulator of the Three-phase Inverter component is used, and the carrier frequency is set to 20 kHz.

A full description of how the subsystems are mathematically modeled continues below, followed by a description of how the electric vehicle performs under Simulation.

Figure 4: Electric vehicle subsystem

The PWM reference signals ma, mb and mc are generated by the PCM, which can be seen in Figure 5. A Three-Phase Meter component is used to measure the currents and active power flow between the induction motor and the inverter. The PCM employs a simple FOC based scheme, in which the measured three-phase currents are transformed into direct (i_d) and quadrature (i_q) components, which are then controlled with PI regulators. The machine flux is related to i_d while the torque is related to i_q. The rotor flux angle ϴ_e, needed for the abc-to-dq and dq-to-αβ transforms, is calculated (Indirect FOC) from the machine electrical parameters, rotor speed, and measured currents.

Figure 5: Powertrain control module

The motor drive is realized using an induction machine with parameters shown in Table 3.
Table 3. Electrical motor parameters
Type Induction with squirrel cage
Nominal voltage 400 V
Maximum power 270 kW
Maximum frequency 565 Hz
Maximum RPM 16950
Number of pole pairs 2

The flux reference is generated in the flux_ref block and starts as a constant value ψ r e f . As the motor speeds up, however, the armature voltage rises to maintain the flux. When the inverter voltage limit is reached, the rotor speed cannot increase further; this defines the base speed ω b a s e . Then, the Flux Weakening Method is employed to allow the rotor to go beyond the base speed; at this point the maximum flux reference is multiplied by the inverse of the measured rotor speed.

( ψ r e f = ψ m a x ω b a s e ω r )
The torque reference is calculated in the spd_regulator subsystem (Figure 6) from the Throttle input in the SCADA panel. The Throttle is a value ranging from 0 to 100, and this value is first used for speed regulation as a percentage of the maximum speed (230 km/h).

Figure 6: Torque reference generation

The output of the speed regulator is a reference torque, which is further processed by a C block that:
  1. Limits the acceleration power to 270 kW
  2. Limits the acceleration torque to 430 Nm
  3. Limits the regenerative braking power to 60 kW
  4. Limits he regenerative braking torque to 150 Nm
  5. Multiplies the resulting torque by the throttle percentage

The induction motor is loaded with variable torque. The mechanical part of the electric motor is governed by Newton's Law for Rotation:

d ω m d t = 1 J m T e - T l o a d - D f ω m

where ω m is the mechanical speed of the rotor, J m machine moment of inertia, T e machine electromagnetic torque, T l o a d load mechanical torque, and D f linear friction coefficient.

The mechanical load which is calculated inside the Load block is represented by the following formula:

T l o a d = F l o a d d w h e e l 2 i g

where F l o a d is the force that affects the vehicle, d w h e e l the diameter of the wheels, and i g is the gear ratio.

F l o a d = F g r a d e + F r o l l i n g +   F w i n d

where F g r a d e is a component of the gravitational force projected to the surface, F r o l l i n g the rolling resistance force and F w i n d is the wind resistance force.

F g r a d e = W s i n α

where W is the weight of the vehicle and α is the slope angle.

F r o l l i n g = V k m h f r

where V k m h is the vehicle speed in k m h and f r is the rolling resistance.

F w i n d = A d ρ V 2 2

where A d is the drag area and ρ is the air density.

A d = c D A

where c D is the drag coefficient and A is the frontal area of the vehicle.

Additionally, to load torque in case of activating the brake, an additional moment will be added to the machine:

T b r a k e = V C b

where C b is the adjustable braking coefficient (0-100).

Table 4. HIL device resource utilization
No. of processing cores 3
Max. matrix memory utilization 78%
Max. time slot utilization 78%
Simulation step, electrical 1 µs
Execution rate, signal processing 100 µs
In order to avoid topological conflicts snubbers are added to the coupling elements:
  • Core Coupling1 (inside Charging Station) – the red (current) side of the coupling is facing the contactor, so a fixed R-C snubber should be added with the following parameters: R 1 = 1   Ω ,     C 1   =   0.4 e - 5   F  
  • Core Coupling2 (inside Electric Vehicle) – the green (voltage) side of the coupling is facing the capacitor, so it should be added a fixed R-L snubber with the following parameters: R 2 = 0 . 1   Ω ,     C 1   =   1 e - 3   F

More information about the use of snubbers and their parametrization can be found here.


This application comes with a pre-built SCADA panel (Figure 7). The panel offers most essential user interface elements (widgets) to monitor and interact with the simulation in runtime. You can customize it freely to fit your needs.

Figure 7: Electric vehicle SCADA panel

The SCADA Panel consists of the following parts:
  • Capture/Scope
  • Car Dashboard subpanel
  • Inverter Mode Presets Group
  • DC Fast Charging Station subpanel
  • Status LED Group
The Status LED group contains 5 LEDs that indicate if the EV is connected to the grid and the inverter operation mode based on the power flow direction (stand by mode if there is no power exchange). The DC Fast Charging Station subpanel controls all functions of the Battery Inverter (status, mode, voltage, frequency and P-Q references). The EV can be connected to the charging station only when the motor speed is zero and stopped from the Car Dashboard Start/Stop button. Similarly, the motor cannot be started if the DC charger is connected. The subpanel can also be used for monitoring the voltage and frequency of the grid, power exchange and synchronization status. For EV charging operation, P_ref must to be set to negative, and vice-versa for discharging. If the Inverter Mode is changed to Grid following, the S1 contactor inside Charging Station changes its status to open, and the local load will be powered from the battery. This would correspond to residential blackout situations where EVs can act as a backup power supply (V2G). The Inverter Mode Presets group contains macro buttons that automatically sets the parameters summarized in Table 5.
Table 5. Operations presets
  P_ref Grid connection Operation Mode
EV Charging -150 kW On Grid following
Grid-to-vehicle 150 kW On Grid following
UPS 0 kW Off Grid forming

From the Car Dashboard the user can start and stop the motor and adjust the throttle and brake signals with the help of sliders. EV dynamics can be monitored using:

  • Two gauges for speed and active power
  • A trace graph for speed history
  • A bar graph for SOC
  • Four digital displays for rotational speed, electrical and load torques, and total distance
  • Two LEDs for motor status and regenerative braking (Typhoon ReGen) status
  • The Power/Torque Graphs subpanel

Figure 8: EV dashboard sub-panel

The Capture/Scope widget can be used to observe waveforms of the circuit quantities. Figure 9 displays the machine armature currents and voltages during motor acceleration.

Figure 9: Armature currents and voltages

Figure 10and Figure 11 illustrate a possible driving cycle of the EV. Initially, with the EV stopped, the throttle slider is set to 100%, which results in constant maximum torque reference being applied. When the maximum power is reached at 85 km/h, the torque reference is gradually reduced to maintain a constant power region. After the breakdown point at approximately 150 km/h, the maximum power cannot be maintained anymore (constant slip region).

Figure 10: Power and torque graphs during acceleration

When the vehicle reaches the maximum speed of 230 km/h, the throttle slider is set to zero. A negative torque reference is applied, which slows down the vehicle while charging the battery at the same time with the maximum regenerative power of 60 kW. As the speed is reduced, the torque magnitude increases for the same power. At 50 km/h, the 150 Nm torque limit starts acting, gradually reducing the regenerative power until the car stops.

Figure 11: Power and torque graphs during deceleration

Table 6. Minimum requirements
Typhoon HIL files

examples\models\automotive\electric vehicle

electric vehicle.tse,

electric vehicle.cus
Minimum hardware requirements
No. of HIL devices 1
HIL device model HIL402
Device configuration 1