---
url: /dyad/stable/examples/FrictionBrakeDemo.md
---

# Friction Brake Demo {#Friction-Brake-Demo}

Download this exampleFrictionBrakeDemo.zipFull project — Dyad model + Julia + data›

An acausal, equation-based model of a vehicle friction brake with coupled thermal effects. It shows how braking energy is converted to heat and how disk and pad temperatures evolve under a realistic driving cycle.

## The model {#The-model}

`VehicleCycleTest` connects the driver, powertrain, friction brake, vehicle, and brake-thermal subsystems into a closed-loop drive cycle:&#xA;

## Running it {#Running-it}

Simulate the drive cycle with a stiff solver and plot the reference and actual vehicle speed. The fast PID dynamics make the default method exhaust its step budget before 2000 s; check the return code and full horizon before plotting:

```julia
using FrictionBrakeDemo, ModelingToolkit, DyadInterface, Plots

@named model = VehicleCycleTest()
res = TransientAnalysis(; model, alg = ODEAlg.Rodas5P(), stop = 2000)
sol = rebuild_sol(res)
@assert ModelingToolkit.SciMLBase.successful_retcode(sol)
@assert last(sol.t) == 2000
plot(res, idxs = [model.vehicle_speed_ref.y, model.vehicle.vehicle_speed])
```

![](awsmpij.svg)
