Engee documentation
Notebook

Modelling the motion of an electric vehicle through the WLTC cycle

This example will demonstrate the modelling of an electric vehicle driving on the WLTC driving cycle. The parameters of the vehicle, electrical and mechanical systems follow the characteristics of an electric vehicle like the Nissan Leaf.

Description of parameters and model structure

The motion of the electric vehicle and its inertia are described by the Electric Vehicle block. The left port of this block receives the resultant force from two pairs of wheels connected to gearboxes and electric motors that convert and generate torque. The block also calculates the air resistance force.

The main parameters of the model are:

Block name Basic parameter
Electric vehicle Weight 1000kg
Battery 390 V voltage
Electric motors Constant torque 4 Nm/A
Wheels Radius 0.32 m
Differentials Gear ratio 0.5

| Air resistance coefficient | 0.28 | 0.28

Schematic of the model:

electrocar_disc_brake_drive_mod_1_1739965487918.png

Block Electric Vehicle

Diagram of subsystem Electromobile:

electrocar_disc_brake_drive_mod_1_1740063224412_2.png

The air resistance force in this subsystem is determined by the formula:

$$F_d = \frac{1}{2} C_x \rho S v^2,$$

where: $Cx$ - drag coefficient, $\rho$ - air density, $кг/м^3$, $S$ - midship area (the largest cross-sectional area of the object perpendicular to the direction of motion), $м^2$, $v$ - speed of the electric vehicle.

The main parameters defined in the Electromobile subsystem:

image_2.png

Scheme of subsystem Driver:

electrocar_disc_brake_drive_mod_1_1740063684238.png

The Driver subsystem is a control system that generates control signals for actuators, which are brakes and electric motors of the electric vehicle. Electric motors are represented by blocks Front axle electric motor and Rear axle electric motor, and brakes by block Brake system. The Add block calculates the mismatch signal between the set and measured speeds, which is then fed to the PID controllers that generate the control signals.

Brake system subsystem diagram:

electrocar_disc_brake_drive_mod_1_1740068897907.png

The subsystem consists of 4 brake discs. The input signal to port P determines the pressure in the brake system, port S transmits the braking torque to each of the wheels.

WLTC unit

The WLTC block is a From Workspace block that receives WLTC drive cycle data converted from XLSX format from model callbacks.

Define the function to load and run the model:

In [ ]:
function start_model_engee()
    try
        engee.close("electric_vehicle_performance", force=true) # закрытие модели 
        catch err # в случае, если нет модели, которую нужно закрыть и engee.close() не выполняется, то будет выполнена её загрузка после catch
            m = engee.load("$(@__DIR__)/electric_vehicle_performance.engee") # загрузка модели
        end;

    try
        engee.run(m) # запуск модели
        catch err # в случае, если модель не загружена и engee.run() не выполняется, то будут выполнены две нижние строки после catch
            m = engee.load("$(@__DIR__)/electric_vehicle_performance.engee") # загрузка модели
            engee.run(m) # запуск модели
        end
end
Out[0]:
start_model_engee (generic function with 1 method)

Running the simulation

In [ ]:
start_model_engee() # запуск симуляции с помощью специальной функции, реализованной выше
Out[0]:
SimulationResult(
    "Крутящий момент электродвигателя" => WorkspaceArray("electric_vehicle_performance/Расчёт мощности/Крутящий момент электродвигателя"),
    "Скорость в км/ч" => WorkspaceArray("electric_vehicle_performance/Электромобиль/Скорость в км/ч"),
    "Мощность электродвигателя, кВт" => WorkspaceArray("electric_vehicle_performance/Расчёт мощности/Мощность электродвигателя, кВт"),
    "WLTC.1" => WorkspaceArray("electric_vehicle_performance/WLTC.1"),
    "Тормозной момент, Н*м" => WorkspaceArray("electric_vehicle_performance/Тормозная система/Тормозной момент, Н*м"),
    "Частота вращения электродвигателя" => WorkspaceArray("electric_vehicle_performance/Расчёт мощности/Частота вращения электродвигателя"),
    "Перемещение в км" => WorkspaceArray("electric_vehicle_performance/Электромобиль/Перемещение в км"),
    "Сила сопротивления воздуха" => WorkspaceArray("electric_vehicle_performance/Электромобиль/Сила сопротивления воздуха"),
    "Заряд батареи" => WorkspaceArray("electric_vehicle_performance/Заряд батареи"),
    "From-2.1" => WorkspaceArray("electric_vehicle_performance/From-2.1"),
    "Сила со стороны трансмиссии" => WorkspaceArray("electric_vehicle_performance/Электромобиль/Сила со стороны трансмиссии")
)

Write from simout to variables the signals obtained during simulation (there is a lot of data, the process can take about 4 minutes):

In [ ]:
t = simout["electric_vehicle_performance/Электромобиль/Скорость в км/ч"].time[:]; # время
T = simout["electric_vehicle_performance/Расчёт мощности/Крутящий момент электродвигателя"].value[:]; # крутящий момент электродвигателя
speed = simout["electric_vehicle_performance/Электромобиль/Скорость в км/ч"].value[:]; # скорость автомобиля
forces_left = simout["electric_vehicle_performance/Электромобиль/Сила со стороны трансмиссии"].value[:]; # силы, действующие на автомобиль со стороны трансмиссии 
forces_right = simout["electric_vehicle_performance/Электромобиль/Сила сопротивления воздуха"].value[:]; # силы, действующие на автомобиль со стороны окружающей среды
w = simout["electric_vehicle_performance/Расчёт мощности/Частота вращения электродвигателя"].value[:]; # частота вращения электродвигателя
q = simout["electric_vehicle_performance/Заряд батареи"].value[:]; # заряд батареи
P = simout["electric_vehicle_performance/Расчёт мощности/Мощность электродвигателя, кВт"].value[:]; # мощность электродвигателя
WLTC1 = simout["electric_vehicle_performance/WLTC.1"].value[:]; # цикл WLTC
pos = simout["electric_vehicle_performance/Электромобиль/Перемещение в км"].value[:]; # перемещение электромобиля
;

Visualisation of simulation results

Launching the library for plotting graphs:

In [ ]:
using Plots
gr()
Out[0]:
Plots.GRBackend()

Plotting graphs of forces acting on an electric car and its velocity:

In [ ]:
p1 = plot(t, forces_left, label="Усилие от трансмиссии, Н", linewidth=2)
p2 = plot(t, forces_right, label="Сопротивление воздуха, Н", linewidth=2, linecolor=2)
p3 = plot(t, speed, label="Скорость, км/ч", linewidth=2, linecolor=3)
plot(p1, p2, p3, layout=(3,1))
Out[0]:

Analysing the force graphs allows us to conclude that the greatest contribution to energy consumption is made by the stages of the driving cycle with high speed. This is due to the fact that the aerodynamic drag force acting on the electric vehicle increases in proportion to the square of the speed.

Plot the torque, speed and power of the electric motor:

In [ ]:
p1 = plot(t, T, label="Крутящий момент, Н*м", linewidth=2)
p2 = plot(t, (w * 9.55), label="Частота вращения, об/мин", linewidth=2, linecolor=2)
p3 = plot(t, (T .* w ./1000), label="Мощность, кВт", linewidth=2, linecolor=3)
plot(p1, p2, p3, layout=(3,1))
Out[0]:

As the vehicle accelerates, the torque decreases and the speed of the electric motor increases. The mechanical power produced by this electric motor increases as the air resistance force increases as a function of speed.

The power of the electric motor is calculated using the formula: $$P = \frac {M*w}{1000}, $$

where $M$ is the torque, in $Н \cdot м$, and $w$ is the speed, in $\frac {рад}{с}$.

Graph of measured and set speed:

In [ ]:
plot(t, speed, label="Измеренная скорость, км/ч", linewidth=2)
plot!(t, WLTC1, label="Заданная скорость, км/ч", linewidth=2)
Out[0]:

The graph shows that the electric vehicle adheres to the set speed with slight deviations. These deviations can be reduced by fine-tuning the controls in the Driver block.

Graphs of electric vehicle movement and battery charge:

In [ ]:
p1 = plot(t, pos, label="Перемещение электромобиля, км", linewidth=2)
p2 = plot(t, (q * 0.0002777777777778), label="Заряд батареи, А*ч", linewidth=2)
plot(p1, p2, layout=(2,1))
Out[0]:

By analysing the graphs of battery charge and electric vehicle travel, it is possible to calculate how much energy was used to cover the distance:

In [ ]:
println("Энергия, затраченная на один ездовой цикл: ", round(maximum(q * 0.000277) - minimum(q * 0.000277), digits=3), " А*ч")
Энергия, затраченная на один ездовой цикл: 20.83 А*ч

A simple calculation can be used to estimate the driving range of an electric vehicle on one full battery charge:

In [ ]:
total_tange = maximum(q * 0.000277) / (maximum(q * 0.000277) - minimum(q * 0.000277)) * maximum(pos)
println("Запас хода электромобиля: ", round(total_tange, digits=3), " км")
println("Удельный расход энергии: ", maximum(q * 0.000277) / total_tange, " А*ч/км")
Запас хода электромобиля: 111.33 км
Удельный расход энергии: 0.9136257264575948 А*ч/км

Conclusion:

This example demonstrates the modelling of an electric vehicle driving on a WLTC driving cycle. Performance calculations have been carried out, in particular the driving range and specific energy consumption. The model can be refined by further parameterisation of the blocks and by adjusting the controllers. Other driving cycles can also be loaded into the From Workspace block, which can be used to evaluate the performance of the electric vehicle under different conditions.