Anti-lock Braking System (ABS)
This example demonstrates an anti-lock braking system (ABS) using nonlinear tire dynamics and event-driven slip control. The system prevents wheel lockup during braking by modulating brake torque to maintain optimal tire-road friction.
You can also find this example as a single file in the GitHub repository.
The ABS control system features:
- Pacejka tire model: Realistic nonlinear friction coefficient vs. slip ratio characteristic - Multi-body dynamics: Separate vehicle and wheel rotational dynamics - Event-driven control: Zero-crossing events detect slip threshold crossings for precise brake modulation - Physical constraints: Prevents unphysical negative wheel speeds
System Dynamics
The ABS system consists of coupled vehicle and wheel dynamics. The vehicle longitudinal motion is governed by:
MATHDISPLAY0ENDMATH
where MATHINLINE2ENDMATH is the vehicle mass, MATHINLINE3ENDMATH is the vehicle velocity, and MATHINLINE4ENDMATH is the tire friction force.
The wheel rotational dynamics are described by:
MATHDISPLAY1ENDMATH
where MATHINLINE5ENDMATH is the wheel inertia, MATHINLINE6ENDMATH is the wheel angular velocity, MATHINLINE7ENDMATH is the brake torque, and MATHINLINE8ENDMATH is the wheel radius.
Tire Friction Model
The tire friction force depends on the slip ratio MATHINLINE3ENDMATH, defined as:
MATHDISPLAY0ENDMATH
where MATHINLINE4ENDMATH represents free rolling (no slip) and MATHINLINE5ENDMATH represents locked wheels.
We use the Pacejka "Magic Formula" to model the friction coefficient:
MATHDISPLAY1ENDMATH
The friction force is then:
MATHDISPLAY2ENDMATH
where MATHINLINE6ENDMATH is the normal force on the tire. The Pacejka model exhibits a characteristic peak at an optimal slip ratio (typically around 15%), after which friction decreases for higher slip values.
ABS Control Strategy
The ABS controller uses a bang-bang control strategy with zero-crossing events:
- Event 1: When MATHINLINE0ENDMATH, release brake (MATHINLINE1ENDMATH)
- Event 2: When MATHINLINE2ENDMATH, apply brake (MATHINLINE3ENDMATH)
where MATHINLINE4ENDMATH is the optimal slip ratio and MATHINLINE5ENDMATH is the control deadband.
Import and Setup
First let's import the required classes and blocks:
Vehicle and Tire Parameters
We define realistic parameters for a mid-size vehicle with Pacejka tire model coefficients:
Friction and Slip Models
Define the tire friction characteristic and slip calculation functions:
System Definition with ABS
Now we construct the vehicle braking system with ABS control:
The connections implement the coupled vehicle-wheel dynamics with Constant brake torque modulated by events:
ABS Control Events
The ABS controller uses ZeroCrossing events to detect when the slip ratio exceeds the control thresholds and modulates brake torque accordingly:
Simulation with ABS
We initialize the simulation with the RKCK54 solver and ZeroCrossing events for accurate slip control:
12:43:14 - INFO - LOGGING (log: True) 12:43:14 - INFO - BLOCKS (total: 15, dynamic: 2, static: 13, eventful: 0) 12:43:14 - INFO - GRAPH (nodes: 15, edges: 18, alg. depth: 7, loop depth: 0, runtime: 0.184ms) 12:43:14 - INFO - STARTING -> TRANSIENT (Duration: 5.00s) 12:43:14 - INFO - -------------------- 1% | 0.2s<4.7s | 1002.6 it/s 12:43:15 - INFO - #------------------- 7% | 1.2s<14.0s | 1247.6 it/s 12:43:16 - INFO - ##------------------ 13% | 2.2s<01:03 | 1018.6 it/s 12:43:17 - INFO - ###----------------- 18% | 3.2s<30.4s | 1072.7 it/s 12:43:17 - INFO - ####---------------- 20% | 3.4s<4.1s | 1027.0 it/s 12:43:18 - INFO - #####--------------- 26% | 4.4s<29.0s | 1018.8 it/s 12:43:19 - INFO - ######-------------- 30% | 5.4s<5.7s | 1024.8 it/s 12:43:20 - INFO - #######------------- 35% | 6.4s<01:17 | 1000.0 it/s 12:43:21 - INFO - ########------------ 40% | 7.3s<3.6s | 953.7 it/s 12:43:22 - INFO - ########------------ 44% | 8.3s<26.2s | 945.1 it/s 12:43:23 - INFO - #########----------- 48% | 9.3s<58.5s | 926.1 it/s 12:43:24 - INFO - ##########---------- 53% | 10.3s<16.2s | 1128.7 it/s 12:43:25 - INFO - ###########--------- 58% | 11.3s<01:27 | 666.2 it/s 12:43:26 - INFO - ############-------- 60% | 11.7s<3.0s | 935.2 it/s 12:43:27 - INFO - ############-------- 64% | 12.7s<3.2s | 1000.8 it/s 12:43:28 - INFO - #############------- 67% | 13.7s<5.4s | 1414.3 it/s 12:43:29 - INFO - ##############------ 72% | 14.7s<2.5s | 1184.5 it/s 12:43:30 - INFO - ###############----- 76% | 15.7s<22.8s | 911.2 it/s 12:43:31 - INFO - ################---- 80% | 16.7s<1.4s | 983.3 it/s 12:43:32 - INFO - ################---- 84% | 17.7s<1.1s | 1272.4 it/s 12:43:33 - INFO - #################--- 87% | 18.7s<1.4s | 949.3 it/s 12:43:34 - INFO - ##################-- 91% | 19.7s<10.1s | 956.1 it/s 12:43:35 - INFO - ##################-- 94% | 20.7s<5.5s | 902.5 it/s 12:43:36 - INFO - ###################- 98% | 21.7s<10.9s | 1105.1 it/s 12:43:36 - INFO - #################### 100% | 22.1s<--:-- | 1041.3 it/s 12:43:36 - INFO - FINISHED -> TRANSIENT (total steps: 22965, successful: 15038, runtime: 22149.28 ms)
Comparison: System without ABS
To demonstrate the effectiveness of ABS, let's simulate the same scenario without ABS control (constant maximum braking):
12:43:36 - INFO - LOGGING (log: True) 12:43:36 - INFO - BLOCKS (total: 15, dynamic: 2, static: 13, eventful: 0) 12:43:36 - INFO - GRAPH (nodes: 15, edges: 18, alg. depth: 7, loop depth: 0, runtime: 0.144ms) 12:43:36 - INFO - STARTING -> TRANSIENT (Duration: 5.00s) 12:43:36 - INFO - -------------------- 1% | 0.0s<0.3s | 901.8 it/s 12:43:36 - INFO - #################### 100% | 0.0s<--:-- | 914.9 it/s 12:43:36 - INFO - FINISHED -> TRANSIENT (total steps: 9, successful: 9, runtime: 14.20 ms)
Results and Comparison
Let's plot and compare both scenarios:
Analysis
The results demonstrate the effectiveness of ABS:
With ABS:
- Slip control: System maintains slip ratio near optimal value (0.15) through event-driven brake modulation
- Wheel speed: Wheels continue rotating (no lockup), maintaining steering control
- Friction utilization: ABS keeps friction coefficient near peak value (~1.0) throughout braking
- Braking efficiency: Optimal slip control provides maximum deceleration
Without ABS:
- Wheel lockup: Wheels lock immediately (wheel speed drops to zero)
- Slip saturation: Slip ratio quickly reaches 1.0 (complete lockup)
- Reduced friction: Friction coefficient drops significantly below peak value
- Longer stopping distance: Reduced friction leads to increased braking distance
- Loss of control: Locked wheels prevent steering corrections
The friction-slip characteristic plot clearly shows how ABS maintains operation near the peak friction region, while constant braking quickly pushes the system into the unstable high-slip region where friction degrades.
This example demonstrates PathSim's capability to model complex multi-domain systems with event-driven control, combining:
- Nonlinear multi-body dynamics (vehicle-wheel coupling)
- Nonlinear tire friction characteristics (Pacejka model)
- Zero-crossing event detection for precise control switching
- Physical constraints (preventing negative wheel speeds)
- Comparative analysis between controlled and uncontrolled systems