Engee documentation
Notebook

Simulation of an anti-lock braking system

This example will demonstrate the simulation of an anti-lock braking system (ABS). The model simulates the dynamic behavior of a vehicle under severe braking conditions and consists of a single wheel that can be reproduced several times to create a model of a multi-wheeled vehicle.

General view of the model:

absbrake--1708524133239.png

The wheel rotates at an initial angular velocity, which corresponds to the speed of the vehicle before pressing the brake pedal. To calculate the slippage, which is defined in the block of equations, we use two speeds. The speed of a vehicle is expressed as angular velocity.

(equal to the angular velocity of the wheel, if there is no slip)

Block of equations

where:

  • - the speed of the vehicle divided by the radius of the wheel,
  • - linear speed of the vehicle,
  • - wheel radius,
  • - the angular velocity of the wheel.

From these expressions, we can see that the slip is zero when the wheel speed and vehicle speed are equal, and the slip is one when the wheel is locked. The target slip value is 0.2, which means that the number of revolutions of the wheel should be 0.8 times higher than the number of revolutions in non-braking mode at the same vehicle speed. This maximizes the tire's grip on the road and minimizes braking distance when there is friction.

The coefficient of friction between the tire and the road surface, mu, is an empirical sliding function known as the mu-slip curve. We created mu-slip curves by passing MATLAB variables to a flowchart using the Simulink lookup table. The model multiplies the coefficient of friction, mu, by the weight of the wheel to obtain the friction force acting on the circumference of the tire. The friction force is divided by the mass of the vehicle to obtain deceleration, which the model integrates to obtain speed.

In this model, we used an ideal anti-lock braking controller that uses control based on the difference between actual and desired slippage. We set the desired slip to the amount of slip at which the mu-slip curve reaches its maximum value, which is the optimal value for the minimum stopping distance (see note below).

Note: In a real vehicle, the slip cannot be measured directly, so this control algorithm is impractical. In this example, it is used to illustrate the conceptual construction of such a simulation model. The real engineering value of such modeling is to show the potential of a management concept before addressing specific implementation issues.

Starting the model with the ABS enabled

Enabling the backend method for displaying graphics:

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

Initial conditions that determine whether the ABS is turned on or off:

In [ ]:
ctrl = 1.0; # АБС включена

Loading and launching the model:

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

try
    engee.run(m, verbose=true) # запуск модели
    catch err # в случае, если модель не загружена и engee.run() не выполняется, то будут выполнены две нижние строки после catch
        m = engee.load("$(@__DIR__)/absbrake.engee") # загрузка модели
        engee.run(m, verbose=true) # запуск модели
    end
Building...
Progress 0%
Progress 49%
Progress 100%
Progress 100%
Out[0]:
SimulationResult(
    "stopping distance.main_out" => WorkspaceArray{Float64}("absbrake/stopping distance.main_out")
,
    "slp" => WorkspaceArray{Float64}("absbrake/slp")

)

Extracting data describing braking distance and sliding from the simout variable:

In [ ]:
data1 = collect(simout)
Out[0]:
2-element Vector{WorkspaceArray}:
 WorkspaceArray{Float64}("absbrake/stopping distance.main_out")
 WorkspaceArray{Float64}("absbrake/slp")

Defining data from the model into the corresponding variables:

In [ ]:
slp1 = collect(data1[2])
stop_distance1 = collect(data1[1])
Out[0]:
1501×2 DataFrame
1476 rows omitted
Rowtimevalue
Float64Float64
10.00.0
20.010.88
30.021.76
40.032.64
50.043.52
60.054.4
70.065.28
80.076.15999
90.087.03998
100.097.91997
110.18.79996
120.119.67994
130.1210.5599
149014.89720.743
149114.9720.743
149214.91720.743
149314.92720.743
149414.93720.743
149514.94720.743
149614.95720.743
149714.96720.743
149814.97720.743
149914.98720.743
150014.99720.743
150115.0720.743

Visualization of the time slip value:

In [ ]:
plot(slp1[:,1],slp1[:,2])
Out[0]:

Starting the model with the ABS turned off

In [ ]:
ctrl = 0.0;

Changing the model parameter:

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

try
    engee.run(m, verbose=true) # запуск модели
    catch err # в случае, если модель не загружена и engee.run() не выполняется, то будут выполнены две нижние строки после catch
        m = engee.load("$(@__DIR__)/absbrake.engee") # загрузка модели
        engee.run(m, verbose=true) # запуск модели
    end
Building...
Progress 0%
Progress 28%
Progress 100%
Progress 100%
Out[0]:
SimulationResult(
    "stopping distance.main_out" => WorkspaceArray{Float64}("absbrake/stopping distance.main_out")
,
    "slp" => WorkspaceArray{Float64}("absbrake/slp")

)

Extracting data describing braking distance and sliding from the simout variable:

In [ ]:
data2 = collect(simout)
Out[0]:
2-element Vector{WorkspaceArray}:
 WorkspaceArray{Float64}("absbrake/stopping distance.main_out")
 WorkspaceArray{Float64}("absbrake/slp")

Defining data from the model into the corresponding variables:

In [ ]:
slp2 = collect(data2[2])
stop_distance2 = collect(data2[1])
Out[0]:
1501×2 DataFrame
1476 rows omitted
Rowtimevalue
Float64Float64
10.00.0
20.010.88
30.021.76
40.032.64
50.043.52
60.054.4
70.065.28
80.076.15999
90.087.03998
100.097.91997
110.18.79996
120.119.67994
130.1210.5599
149014.89795.675
149114.9795.783
149214.91795.891
149314.92795.998
149414.93796.105
149514.94796.211
149614.95796.316
149714.96796.422
149814.97796.526
149914.98796.63
150014.99796.733
150115.0796.836

Visualization of the time slip value:

In [ ]:
plot(slp2[:,1],slp2[:,2])
Out[0]:

Comparison of braking distance calculation results with and without ABS:

In [ ]:
plotlyjs()
plot(stop_distance1[:,1], stop_distance1[:,2]./3.28084, label="Торможение с АБС", xlabel="Время, с", ylabel="Тормозной путь, м")
plot!(stop_distance2[:,1], stop_distance2[:,2]./3.28084, label="Торможение без АБС", legend=:bottomright)
Out[0]:

Conclusion:

In this example, the simulation of an anti-blocking system was demonstrated. A comparison of the braking distance with and without ABS has shown that braking with ABS is the most effective.