Mathematical modeling and simulation bring significant benefits in terms of understanding the braking phenomena and the impact of different parameters on the braking performance of a vehicle.

**Anti-lock braking systems (ABS)** are meant to **control the wheel slip** in order to maintain the friction coefficient close to the optimal value. Wheel slip is defined as the relative motion between a wheel (tire) and the surface of the road, during vehicle movement. Wheel slip occurs when the angular speed of the wheel (tire) is greater or less compared to its free-rolling speed.

In order to simulate the braking dynamics of a vehicle, we are going to implement **simplified mathematical models** (quarter-car model) for both vehicle and wheel. Also, a simplified ABS controller is going to be implemented in order to emulate the braking torque in slip conditions.

### Vehicle model

If we consider a vehicle moving in a straight direction under braking conditions, we can write the equations of equilibrium:

- for
**horizontal**direction:

where:

F_{f} [N] – is the friction force between wheel and ground

F_{i} [N] – is the inertial force of the vehicle

- for
**vertical**direction:

where:

N [N] – normal force (road reaction)

W [N] – vehicle weight

We can write the expressions of the **friction force** as:

where μ [-] the friction coefficient between wheel and road.

The vehicle’s **weight** is:

Replacing (2) and (4) in (3) gives the expression of the friction force as:

\[F_f = \mu \cdot m_v \cdot g \tag{5}\]where:

m_{v} [kg] – is the total vehicle mass

g [m/s^{2}] – is the gravitational acceleration

The **inertia force** is the product between the vehicle mass m_{v} [kg] and vehicle acceleration a_{v} [m/s^{2}]:

where v_{v} [m/s] is the vehicle speed.

From equations (1), (5) and (6) we can extract the expression of the **vehicle acceleration**:

**Vehicle speed** is obtained by integration of equation (7).

### Wheel model

During braking, through the braking system, the driver applies a **braking torque** T_{b} [Nm] to the wheels. The friction force F_{f} [N] between the wheel and road creates an opposite torque with the wheel radius r_{w} [m].

For simplification, we are going to consider that the wheel is rigid and the normal force (road reaction) passes through the wheel hub, therefore doesn’t add an additional torque.

We can write the equation of equilibrium for the wheel as:

\[T_b – F_f \cdot r_w – J_w \cdot \frac{d \omega_w}{dt}=0 \tag{8}\]where:

J_{w} [kg·m^{2}] – is the wheel’s moment of inertia

ω_{w} [rad/s] – is the angular speed of the wheel

From equation (8) we can extract the expression of the **wheel acceleration**:

**Wheel speed** is obtained by integration of equation (9).

### Wheel slip

The ABS system has to control the wheel slip s [-] around an optimal target. The **wheel slip** is calculated as:

where ω_{v} [rad/s] is the **equivalent angular speed of the vehicle**, equal with:

where v_{v} [m/s] is the vehicle speed.

### Friction coefficient

The friction coefficient between wheel and road depends on several factors, like:

- wheel slip
- vehicle speed
- the type of the road surface
- environmental conditions (humidity, temperature, etc.)

For our simulation purpose, we are going to take into account only the variation of the **friction coefficient **function on the **longitudinal wheel slip**.

During braking, if the wheel slip is 100 % the wheel is locked but the vehicle is still moving. At 0 % slip, the wheel and vehicle have exactly the same speed.

The optimum friction coefficient (highest value) is obtained when the wheel slip is around 20 %. As you can see, the friction coefficient curve is split into two areas:

**stability zone**: where the friction coefficient increases with the wheel slip increase**unstable zone**: where the friction coefficient decreases with the wheel slip increase

If the wheel slip enters the unstable area, the friction coefficient will decrease and the wheel will **lock** causing skid and vehicle instability.

For this particular example, the ABS systems will have to keep the wheel slip around 20 %, where friction coefficient has the highest values.

The friction coefficient can be expressed as an **empirical function**, where the wheel slip is a function argument:

where:

s [-] – is the wheel slip

A, B, C, D [-] – are empirical coefficients

Depending on the value of the coefficients A, B, C and D, the empirical formula (12) can be used to represent the friction coefficient for different road types/states.

Road type/state | ||||

dry concrete | wet concrete | snow | ice | |

A | 0.9 | 0.7 | 0.3 | 0.1 |

B | 1.07 | 1.07 | 1.07 | 1.07 |

C | 0.2773 | 0.5 | 0.1773 | 0.38 |

D | 0.0026 | 0.003 | 0.006 | 0.007 |

Using a Scilab script we can plot the variation of the friction coefficient functio of slip, for different road conditions.

A = [0.9 0.7 0.3 0.1]; B = [1.07 1.07 1.07 1.07]; C = [0.2773 0.5 0.1773 0.38]; D = [0.0026 0.003 0.006 0.007]; slip_x = [0:100]; colors = ["b","r","g","k"] for i=1:length(A) for j=1:length(slip_x) miu_y(i,j) = A(i)*(B(i)*(1-exp(-C(i)*slip_x(j)))-D(i)*slip_x(j)); end figure(1) hf=gcf(); hf.background=8; plot(slip_x,miu_y(i,:),colors(i)) end ha=gca(); xlabel("Wheel slip [%]","FontSize",2) ylabel("Friction coefficient, miu [-]","FontSize",2) xgrid(); title("x-engineer.org","FontSize",2) legend("dry concrete","wet concrete","snow","ice")

From the image above we can see that the maximum value of the friction coefficient decreases sharply for a road covered by snow or ice. Even if the value of the friction coefficient is not significantly lower for 100 % slip, preventing wheel lock improves vehicle maneuverability (steering).

### Model parameters

For our simulation example, we are going to use a vehicle with the following parameters:

Symbol | Unit | Value | Description |

m_{v} | kg | 1200 | total vehicle mass |

J_{w} | kg·m^{2} | 0.01 | wheel inertia |

r_{w} | m | 0.28 | wheel radius |

v_{0} | m/s | 28 | initial vehicle speed |

v_{min} | m/s | 1.4 | minimum vehicle speed for slip control active |

g | m/s^{2} | 9.81 | gravitational acceleration |

There are also a couple of other parameters used by the slip controller and other settings:

Symbol | Unit | Value | Description |

K | – | 1000 | hydraulic system amplification factor |

T | s | 0.01 | time constant to simulate braking system inertia |

T_{bmax} | Nm | 2000 | maximum braking torque applied to the wheels |

ε | – | 2.2204·10^{-16} | division by zero protection constant |

ON | – | 1 or 0 | logic variable for activation/deactivation of the slip controller |

road type | – | 1, 2, 3 or 4 | constant for road type setting |

### Xcos block diagram

The vehicle and wheel model used for the simulation is known in the literature as a **quarter-car model**. This means that a quarter of the vehicle mass is considered with only one wheel. Also, only the longitudinal vehicle dynamics is considered, disregarding the impact of the suspension system.

Before starting modeling the Xcos block diagram, we need to define and load in the Scilab workspace the model parameters, which are defined in a Scilab script:

mv = 1200; Jw = 0.01; rw = 0.28; v0 = 28; vmin = 1.4; g = 9.81; K = 1000; T = 0.01; Tbmax = 2000; eps = 2.2204e-16; ON = 1; roadType = 1;

The high level Xcos diagram contains the main components (as user defined functions) and the interfaces between them. All the outputs of each component are fed into `Goto`

blocks which are merged in a `MUX`

block.

The multiplexed outputs are saved in the Scilab workspace using a `To workspace`

block sampled at `0.01`

s.

Further, we are going to describe in detail each component and its input and output signals

**VEHICLE**

The vehicle model is implementing equation (7). Since we are using a quarter-car model, the total weight of the vehicle is divided by 4, assuming equal distribution on each wheel.

The input of the model is the friction coefficient μ [-], which is function of the wheel slip.

The `integrator`

block has the initial value `v0`

and it is saturated to maximum `1000`

m/s and minimum `0`

m/s. To avoid numerical instabilities in the wheel slip calculation, the `saturation`

block limits the minimum vehicle speed at `0.001`

m/s keeping the same maximum limit.

The distance covered by the vehicle is calculated by `integration`

of the vehicle speed.

Outputs:

- friction force F
_{f}[N] - vehicle speed v
_{v}[m/s] - equivalent vehicle speed ω
_{v}[rad/s] - vehicle distance d
_{v}[m]

**WHEEL**

The wheel model is implementing equation (9). The wheel speed (angular) ω_{w} [rad/s] integrator is initialized with `v0/rw`

[rad/s] and saturated to maximum `1000`

rad/s and minimum `0`

rad/s. The linear wheel speed v_{w} [m/s] is obtained by multiplying the angular speed with the wheel radius r_{w} [m]. The distance covered by the wheel d_{w} [m] is obtained by integrating the linear speed.

Inputs:

- braking torque T
_{b}[Nm] - friction force F
_{f}[N]

Outputs:

- angular wheel speed ω
_{w}[rad/s] - linear (tangential) wheel speed v
_{w}[m/s] - wheel distance d
_{w}[m]

**SLIP**

Wheel slip is calculated using equation (10). When the vehicle speed is zero, to avoid division by zero, the ε constant is used as a denominator. The calculated slip value is further saturated to a maximum `1`

and minimum `0`

.

Inputs:

- wheel angular speed ω
_{w}[rad/s] - vehicle angular speed ω
_{v}[rad/s]

Outputs:

- wheel slip s [-]

**FRICTION**

The friction coefficient diagram is implementing four variants of the equation (12), each one for a different road state. The mathematical expressions of the friction coefficient expect as argument the wheel slip in [%] therefore s [-] is multiplied with `100`

using a `Gain`

block. The road dependent friction coefficient is selected using a `Dynamic index`

block, which is controlled by the variable `roadType`

. The friction coefficient is saturated between a minimum `0`

and a maximum `1`

.

Inputs:

- wheel slip s [-]

Outputs:

- friction coefficient μ [-]

**CONTROL**

The slip controller is fairly simple. It’s a **bang-bang type controller**, reacting on wheel slip feedback, emulating the ABS controller. As discussed in the friction coefficient section above, the maximum value of the friction coefficient is obtained around a slip of 20 %. Therefore we set a target (reference) slip of `0.2`

. A slip error is calculated by subtracting the actual slip from the target slip. To avoid the action of the controller at low speeds, the actual slip s [-] is only used when the vehicle speed is higher than `vmin`

[m/s].

Depending on the slip error, the `SIGN`

block will output:

`1`

, if s > 0`0`

, if s == 0`-1`

, if s < 0

The hydraulic system is modeled as a **first order transfer function**, with the amplification factor `K`

and time constant `T`

. The output of the transfer function is the brake torque T_{b} [Nm] which is accumulated over time by the integrator. The integrated torque is limited between `0`

Nm and `Tbmax`

[Nm].

Inputs:

- wheel slip s [-]
- vehicle speed v
_{v}[m/s]

Outputs:

- braking torque T
_{b}[Nm]

### Simulation results

The simulation scenario is braking from an initial speed of v_{0} [kph] until a complete vehicle stop, with the driver braking heavily.

There are two test cases:

**without ABS**: the slip controller is disabled by setting the parameters`ON = 0`

**with ABS**: the slip controller is enabled by setting the parameters`ON = 1`

The Xcos simulation will is run for `20`

s.

The simulation results are described below, on the left side the vehicle is braking without ABS, on the right side with ABS.

When the ABS system is disabled, the braking torque ramps up to maximum value (2000 Nm) in just 2 s. With the ABS system active (slip control), the braking torque is modulated to keep the wheel slip around target value (20 %). When the wheel speed is less than the minimum value (1.4 m/s), the braking torque is not controlled anymore and it increases to maximum value.

When the ABS system is deactivated, as the torque increases, the wheel slip climbs up rapidly towards 1 (wheel lock). With the ABS system active, the wheel slip is regulated around 20 %. Since the wheel slip control is not active below 1.4 m/s, the wheel locks and the slip goes to 1.

Without ABS, since the wheel locks, the friction coefficient decreases to approx. 0.7. With the slip control active (with ABS), the friction coefficient is kept near maximum value 0.9. This gives higher friction force between wheel and road, which will help stop the vehicle faster.

When the ABS system is deactivated, the wheel locks before the vehicle comes to complete stop. Also, it is noticeable that the gradient of the speed changes after the wheel lock. This happens because the friction force becomes smaller and the braking distance increases.

With the ABS active, the wheel is prevented from locking. Having the wheel slip around optimal value provides a higher friction force between wheel and road thus a shorter braking distance (the vehicle comes to a complete stop faster).

When braking without ABS, the braking distance for the vehicle to come to a complete stop is around 220 m. When the wheel slip is controlled (ABS active), the braking distance is decreased with around 10 m, which is quite significant.

From the simulation we can see that the ABS system is **reducing the braking distance** of a vehicle. Also, preventing wheel lock allows the drive to **steer and avoid road hazards**.

The source code for the simulation plots is in the Scilab script below.

Tb=sOut.values(:,1); mu=sOut.values(:,2); s=sOut.values(:,3); Ff=sOut.values(:,4); vv=sOut.values(:,5); wv=sOut.values(:,6); dv=sOut.values(:,7); ww=sOut.values(:,8); vw=sOut.values(:,9); dw=sOut.values(:,10); time=sOut.time; figure(1) hf=gcf(); hf.background=8; ha=gca(); plot(time,Tb) xlabel("time [s]","FontSize",2) ylabel("Braking torque, Tb [Nm]","FontSize",2) xgrid(); title("x-engineer.org","FontSize",2) figure(2) hf=gcf(); hf.background=8; ha=gca(); plot(time,s) ha.data_bounds = [0,0;max(time),1] xlabel("time [s]","FontSize",2) ylabel("Wheel slip, s[-]","FontSize",2) xgrid(); title("x-engineer.org","FontSize",2) figure(3) hf=gcf(); hf.background=8; ha=gca(); plot(time,mu) xlabel("time [s]","FontSize",2) ylabel("Friction coefficient, miu [-]","FontSize",2) xgrid(); title("x-engineer.org","FontSize",2) figure(4) hf=gcf(); hf.background=8; ha=gca(); plot(time,vv*3.6) plot(time,vw*3.6,"r") xlabel("time [s]","FontSize",2) ylabel("Speed [kph]","FontSize",2) xgrid(); title("x-engineer.org","FontSize",2) legend("vehicle","wheel",1) figure(5) hf=gcf(); hf.background=8; ha=gca(); plot(time,dv) plot(time,dw,"r") xlabel("time [s]","FontSize",2) ylabel("Distance [m]","FontSize",2) xgrid(); title("x-engineer.org","FontSize",2) legend("vehicle","wheel",1) figure(6) hf=gcf(); hf.background=8; ha=gca(); plot(time,wv) plot(time,ww,"r") xlabel("time [s]","FontSize",2) ylabel("Angular speed [rad/s]","FontSize",2) xgrid(); title("x-engineer.org","FontSize",2) legend("vehicle","wheel",1)

Don’t forget to Like, Share and Subscribe!

## Shahid

Hi Anthony. I hope you are fine. I am automotive student. And i want to make a project of physical working ABS system which i can represent to my university . Can i make a complete ABS system using this article or i need more information. Already i know how ABS work but not knowing how to ABS ECU or Micro controler programmed which process wheel sensor and other input data to control hydroulic pressure on wheel. Will you help me out of this trouble.

## Gustavo

Hello from Brazil,

I got the same result as the article, but for some reason, the values of the wheel slip and friction coefficient, after 15.4 [s] they are unstable. can you help me?

## Alex

Hiya, I’m trying to learn xcos and came across this project. I love cars so this is perfect for me, however after making the models and copying the scripts I do not get the same results… could you help?

Thanks

## Anthony Stark

Hi Alex,

What kind of issues do you have? If you want the source files, you can support my Patreon page. You can also post question here and I’ll answer.

## Ionut

Hello! Is it possible to use this system in order to develop functions like Traction Control or Electronic Stability Program?

## Anthony Stark

For ESP you’ll need also the lateral dynamics of the wheel and also the intervention on the engine torque. This model is focused only on the longitudinal dynamics of the wheel so is suitable mainly for ABS.

## Stark

Can you please explain why “- ” is used in “-jw” and “-1/mv”. But in theoretical equation no negative term is used and in control subsystem can you explain the transfer function block what if i used hydraulic modulator value to 500 instead of 1000.

Please help me in sorting out this. Thanks in advance

## Anthony Stark

I don’t have a response for the negative term but without it the wheel doesn’t decelerate.

The K factor represent the amplification of the hydraulic system, for example think of it as the ratio of amplification between the force on the brake pedal and the force on the brake caliper. The value 1000 means that if you put 1 N on the brake pedal, you get 1000 N on the brake caliper. You can use 500 instead but then the braking force will be slower and the wheel will decelerate slower.

## Shane Chung

Hi Anthony, I get stuck with the problem above, could i get your email please ?

From Australia

## Shane

Hi can i get an email from you to further discuss about this ?

## Mechanical design

As a background from Mechanical engineer this blog was very useful with information stuff. Keep writing such articles. Looking forward for more post.Thanks

## Anthony Stark

I’ve received an e-mail with the following content:

“Hello from Germany!

We are a group of four students who are studying mechatronics. At the moment we have a modul where we have to find a scilab project to present it in class and we thought that your \”Anti-lock braking system (ABS) modeling and simulation (Xcos)\” project looks really good for our given task. First of all, we are absolut beginners with scilab and xcos. So we tried to implement the project for us, but nothing really happens. When we run the code it just says \’Simulation in progress….\’ but we don\’t get any outputs (or we don\’t know how to get them ??).

Could you help us, please? How do we run the programm properly? And why does the simulation does not stop in our case?

Kind regards,

Maik, Josefine, Olli and Julia”

I’ve replied to it but the e-mail address seems to be wrong therefore I’ll post here the reply:

“Hello,

First of all you have to setup the simulation time. I think this is the reason for which it doesn’t stop.

If you look in the Image: Wheel braking torque (without ABS) you can see the the simulation takes 20 seconds (x-axis, time [s]).

To setup the simulation time, in the block diagram window (Xcos) click Simulation->Setup. In the “Final integration time” edit box enter 20. To finish press Ok and the window will close.

Run the simulation.

After the simulation is finished, all the results are saved in the variable “sOut”. There is a “To workspace” block in the model which is doing that.

At the end of the article there is a script which plots the results, run it. You need to copy and paste the code into an *.sce file and run it.

Hope this helps, let me know if you still get stuck, I’ll be happy to help you.

Best regards, Anthony”

## Oliver Meyer

Dear Anthony,

thank you very much for your reply.

We were able to solve our problems with Xcos thanks to your advice.

Sorry for the delayed reply, we didn’t find the time earlier.

Best regards,

Maik, Josefine, Olli and Julia