Skip to main content
emobility.academy
M.TechVehicle dynamicsAdvanced About 9 weeksMATLAB & Simulink

Electronic Stability Control Using Individual Wheel Torque

Design an electronic stability controller for a four-motor EV that corrects yaw rate and limits sideslip using individual wheel torques, including regenerative torque. Test it in the sine-with-dwell manoeuvre and on low-friction surfaces in the Vehicle Dynamics Blockset.

Tools: Simulink · Vehicle Dynamics Blockset

Electronic Stability Control Using Individual Wheel Torque: Electric scooter in the DIYguru EV lab during a training session
Representative photo from DIYguru's EV lab, not of this specific project.

The problem

Stability control prevents spins and plough-outs by applying corrective yaw moments, traditionally with individual friction brakes. EVs with several motors can apply positive and negative torques at each wheel, giving faster and more flexible corrections without wearing brakes. The controller must decide when to intervene, how large the corrective moment should be and how to distribute it while keeping wheels within their friction limits.

Objectives

  • Build a four-wheel vehicle plant with independent wheel torques and non-linear tyres.
  • Design yaw-rate and sideslip control with intervention thresholds.
  • Allocate corrective yaw moment across four wheels with friction and motor constraints.
  • Evaluate the controller in sine-with-dwell, lane-change and low-friction tests.
  • Compare motor-based stability control with brake-only stability control.

What you need

Tools and toolboxes

  • Vehicle Dynamics Blockset — Dual-track vehicle body and wheel and tyre blocks with combined-slip Magic Formula tyres as the plant.
  • Simulink — Stability controller, sideslip estimator, allocation and manoeuvre inputs.
  • Stateflow — Intervention logic: activation and deactivation thresholds, hysteresis and fault modes.
  • Optimization Toolbox — Optional: quadprog-based optimal allocation of corrective moment; a rule-based allocator works without it.
  • MATLAB — Parameters, test scripts and metric calculation.

Software

  • MATLAB R2023b or later
  • Simulink
  • Vehicle Dynamics Blockset
  • Stateflow

Extra parts and data

None beyond the software above.

Key concepts

Sine-with-dwell test
A steering input of a sine wave with a pause at the second peak, used in stability-control regulations to check that yaw rate decays quickly after the steering returns to centre.
Sideslip limit
Large sideslip means the driver has little control. Stability controllers intervene when sideslip or its rate exceeds limits that depend on friction.
Combined slip
A tyre's friction is shared between longitudinal and lateral forces, so adding wheel torque reduces available lateral force. Allocation must account for this.
Control allocation
Finding wheel torques that produce the requested yaw moment and longitudinal force while respecting each wheel's motor and friction limits, often as a constrained optimisation.

Step-by-step guide

  1. 1

    Define vehicle, tests and pass criteria

    Use an example four-motor EV with stated motor torque limits, mass, inertia and tyre data. Define tests: sine-with-dwell at increasing amplitude, double lane change on dry and wet surfaces and a low-friction step steer. Write pass criteria modelled on regulatory ideas, such as yaw rate falling below a fraction of its peak within a set time after the dwell, and lateral displacement exceeding a minimum for responsiveness.

    Checkpoint: A test matrix with pass criteria written before any controller design.

  2. 2

    Build the plant

    Assemble a dual-track vehicle with Vehicle Dynamics Blockset blocks, four wheels with combined-slip Magic Formula tyres and four torque inputs that can be positive or negative. Add a friction-brake model as a backup actuator. Use a fixed-step solver at 1 ms and log all wheel slips and forces. Check combined-slip behaviour by applying braking torque during steady cornering and confirming lateral force falls as longitudinal slip rises.

    Checkpoint: Uncontrolled sine-with-dwell at high amplitude shows yaw-rate overshoot or a spin, confirming the test is demanding enough.

  3. 3

    Build the reference and estimator

    Generate desired yaw rate from a bicycle model with friction saturation. Build a sideslip estimator, for example integrating lateral acceleration minus speed times yaw rate with drift correction, or a kinematic–model blend. Compare estimated sideslip with the plant's true value across manoeuvres. Test the estimator with sensor noise and accelerometer bias, because integration-based estimates drift. Record the error at the end of each manoeuvre and explain any drift, since the controller will rely on this estimate rather than the true value.

    Checkpoint: Sideslip estimate within a stated error of the true value in all test manoeuvres.

  4. 4

    Design the yaw and sideslip controller

    Design a corrective yaw moment from yaw-rate error with a PI or sliding-mode law, plus a sideslip term that grows as sideslip approaches its limit. Make gains depend on speed. Check stability margins on a linearised model at several speeds. Limit the corrective yaw moment to what the tyres can provide at the estimated friction. Test the controller in an always-on mode first to check its behaviour before adding intervention logic, and record any oscillation in yaw rate.

    Checkpoint: Linear analysis shows adequate margins, and the controller reduces yaw error in a moderate test without causing oscillation.

  5. 5

    Add intervention logic

    Implement a Stateflow chart that activates the controller only when yaw-rate error or sideslip exceeds thresholds, with hysteresis and minimum active time. Add states for actuator fault, where control falls back to friction brakes, and for low speed, where control is disabled. Choose thresholds that avoid intervention during normal driving, and check this with a set of gentle manoeuvres where the controller should stay inactive. Log the active state together with yaw-rate error and sideslip for every test.

    Checkpoint: A scripted test shows activation only during the demanding part of each manoeuvre and correct fall-back to brakes in the fault case.

  6. 6

    Allocate the corrective moment

    Write a rule-based allocator that applies negative torque to the inner rear or outer front wheel depending on oversteer or understeer, then improve it with quadprog: minimise deviation from the requested moment and longitudinal force plus a penalty on wheel slip, subject to motor and friction limits estimated from normal loads. Compare the two allocators. Measure the allocator's computation time per step.

    Checkpoint: Both allocators deliver the requested moment when feasible, and the optimised version uses tyre capacity more evenly.

  7. 7

    Run the test matrix

    Run all tests with no control, brake-only stability control and motor-based control. Compute pass criteria, peak sideslip, path deviation and speed loss. Plot sine-with-dwell yaw rate for the three cases on one graph. Use the same steering inputs for all three cases. Calculate yaw-rate ratios at the defined times after the dwell and compare them with the pass criteria. Record speed loss, because brake-only control usually slows the vehicle more, and present a summary table with pass or fail for each test and controller.

    Checkpoint: Motor-based control meets the pass criteria in all tests where the uncontrolled vehicle fails, with results tabulated.

  8. 8

    Robustness and failure cases

    Repeat tests with friction misestimated, increased mass and one motor failed. Check that the fault logic and brake fall-back keep the vehicle stable. Discuss differences between motor torque and friction brakes, such as response speed and the ability to add positive torque. Script all combinations with sim() and present results as a pass or fail table. For each failure, plot the time history, identify whether the estimator, the controller or the allocator caused it and suggest a design change.

    Checkpoint: A robustness table with pass or fail for each case and an explanation for any failure.

  9. 9

    Report

    Present the test matrix, plant, estimator, controller, intervention logic, allocation and results. State clearly that the pass criteria are modelled on regulatory ideas but this is not a certification test, and that results are simulation only. Include the test matrix, pass criteria, controller gains, intervention thresholds and allocation method. Present results as tables with key time histories, compare motor-based and brake-only control in a dedicated section and keep all scripts with the report for reproducibility.

    Checkpoint: A report with complete test results and a clear scope statement.

Testing & validation

  • Uncontrolled vehicle fails the demanding tests.
  • Sideslip estimator accuracy.
  • Intervention logic activates only when needed.
  • Pass criteria met with motor-based control across the test matrix.
  • Robustness to friction error, mass change and motor failure.

Expected results

A motor-based stability controller with intervention logic and optimised torque allocation that passes sine-with-dwell style criteria in simulation and compares favourably with brake-only control.

Research angle for your M.Tech thesis

Research questions: what are the performance and robustness benefits of motor-based stability control over brake-only control, and how much does optimised allocation that accounts for combined slip improve over rule-based allocation? Metrics: yaw-rate decay after dwell, peak sideslip, path deviation, speed loss and actuator effort. Baselines: no control and brake-only control. Validation: a full test matrix across surfaces, loads and actuator faults on a plant with combined-slip tyres. Systematic fault-tolerance results for multi-motor EVs are a useful publishable angle.

Take it further

  • Add an online friction estimator to adapt thresholds and limits.
  • Integrate stability control with torque vectoring for normal driving.
  • Use MPC for combined yaw and sideslip control.
  • Test the controller in software-in-the-loop with generated code.

Viva and review questions

Why does the sine-with-dwell test pause at the second peak?

The dwell holds a large steer angle long enough to build up sideslip, and the test then checks that yaw rate decays quickly once steering returns, which reveals spin tendency.

Why can motors give better stability control than brakes?

Motors respond faster and can apply both positive and negative torque, so they can create yaw moment while keeping speed, whereas brakes can only decelerate.

Why must allocation consider combined slip?

Applying longitudinal force at a wheel reduces its available lateral force, so a poorly chosen wheel torque can reduce stability rather than improve it.

Learn it at DIYguru

These DIYguru courses and programmes teach what this project needs.

Related EV projects

All 100 MATLAB & Simulink EV projects