Simulink Logic Exercise – Beginner Level
By: Prakash Shakti

Requirement
Hello and welcome to MAE Learning .In this tutorial we will see how to develop ABS control system and below you can see key requirement.
- 1st of all we need to detect wheel slip when the difference between wheel speed and vehicle speed exceeds 20%.
- 2nd we need to prevent wheel lock by modulating brake pressure.
- At last we should maintain vehicle traction and steering control during braking.
- APPLY (high pressure) while slip is small.
- Switch to RELEASE (low pressure) when slip > 20%.
- Return to APPLY after slip falls back below 15% (a little hysteresis so it doesn’t chatter).
Slip definition used here (common in ABS):
where V = vehicle speed, W = wheel speed (same units), and ϵ\epsilonϵ is a tiny number to avoid divide-by-zero.
We flag slip if slip_ratio > 0.20 (20%).
Model Logic as Described
Blocks Used
- Sum, MinMax, Divide → to calculate slip ratio
- Relational Operator → to detect Slip > 20%
- Saturation → to limit slip to the range of [0,1]
- Stateflow Chart → to implement Control strategy (Apply → Release → Apply)
Logic Behavior
- When braking starts if slip > 20% → Brake Release mode is activated.
- When slip is < 15% → Brake is re-applied.
- This hysteresis band (15–20%) ensures that brakes do not switch on/off rapidly.


Wheel Speed & Vehicle Speed Inputs
- Constant / Signal Source blocks → represent vehicle speed and wheel speed.
- Sum Block à This gives the slip numerator: how much faster the vehicle is moving compared to the wheel. calculate the slip ratio (Wheel Speed – Vehicle Speed)/Vehicle Speed.
- MinMax block à This ensures that when the vehicle is stopped or nearly stopped, we don’t divide by zero.
- Divide block à Compute slip ratio

Relation to Logic:
These signals feed into the slip detection condition. If slip > 20%, it triggers the ABS control logic.

Slip Detection Logic
Saturation Block
- So, in this logic, saturation block limits the slip ratio in the [0, 1] range.
Why so?
- Negative slip does not make sense in case of braking (means wheel speed is more than vehicle speed, which does not happen in physical braking).
- Slip above 100% is also not practically possible in normal ABS scenario.
Means, saturation block ensures that the value of slip remains in realistic and valid range.
Relational Operator Block
- This block generates slip flags with hysteresis.
- Its job is to decide:
- When will Brake Release trigger happen (when slip > 20%).
- When will Brake Re-Apply trigger happen (when slip < 15%).
Meaning, the relational operator block tells the ABS when to release and when to apply it again, so that the system remains smooth and stable.
Relation to Logic:
This acts as the trigger condition. When TRUE, it sends a signal to the Stateflow chart to start brake modulation.
Logic Behavior
- When braking starts, if slip exceeds 20%, Slip_High = true → ABS enters pressure release phase.
- ABS stays in release mode until slip drops below 15%, when Slip_Low = true → ABS can reapply brakes.
- This hysteresis band (15–20%) prevents rapid oscillations.

Stateflow Chart (Core Control Logic)
Stateflow chart with states:
- Apply → Brake pressure increases.
- Release → Brake pressure decreases.
- Re-Apply → Brake pressure gradually re-engages.
Relation to Logic:
This cyclic strategy is divided: Apply → Release → Apply, which does not prevent wheel lock.

Result of the Model Logic
If we talk about the result, when the slip condition is met (i.e. slip is more than 20%), the system automatically starts brake pressure modulation.
- This modulation is cyclic (Apply → Release → Apply), due to which the wheels are not fully locked.
- And when the wheels keep rotating (rotational movement is maintained).
- As a result, the steering control and stability of the vehicle remains safe.
- And this is the main objective of ABS system – to control and maintain safety during braking.
Consistency Between Requirement, Model, and Result
| Aspect | Requirement | Model Implementation | Simulation Result | Alignment |
| Slip Detection | Slip > 20% | slip_raw > 0.2 as Slip_High | slip_raw rises above 0.2 | Matches perfectly |
| Slip Release Threshold | Slip < 15% | slip_raw < 0.15 as Slip_Low | slip_raw falls below 0.15 | Matches perfectly |
| Brake Pressure | Apply → Release → Apply cycle | Stateflow three states with 0.1s timed transition | Pulse brakecmd between 1.0 and 0.3 | Matches well |
| ABS Activation | ON at slip > 0.2, OFF when slip < 0.15 | Stateflow signals public ABS_Active | ABS_Active signal toggling as expected | Fully consistent |
| Timing and Modulation | Modulation interval ~0.1s | after(0.1 sec) transitions in chart | Observed pulse widths ≈ 0.1s | Correctly modelled |
Simulation Graph
Input

Output

Conclusion
The Simulink/Stateflow model design matches and implements the ABS requirements.
- Slip detection thresholds (20% and 15%) are correctly applied and are logically consistent.
- Brake modulation occurs in a controlled and timed sequence via the Stateflow chart that matches the real behaviour of the ABS.
- Simulation results clearly show that the responses to slip, brake command and ABS activation are expected and stable.
- Overall, the system design, logic and output are completely consistent and suitable for an ABS control system that detects slip > 20% and modulates braking.
