Letting the computer drive
The equations of Lesson 6.1 can be solved by hand for a step of steer, but add a saturating tire, a driver or a changing speed and closed-form answers run out. Every vehicle simulator, from a team's lap-time tool to a driving game, does the same thing instead: it starts from a known state and steps forward in time, a small interval at a time. This lesson builds the simplest such method and uses it on the classic handling test, the step steer.
The explicit Euler method
Write the equations of motion as \(\dot{\mathbf{x}} = f(\mathbf{x}, t)\), with state \(\mathbf{x} = (\beta, r)\). If you know the state at time \(t_n\), the derivative tells you which way it is heading. Follow that direction for a short time step \(h\):
That is the whole of the explicit Euler method: evaluate the derivatives, take a step, repeat. Its weakness is that it uses the slope at the start of each step, so on a curving solution it drifts off. The error after a fixed time is proportional to \(h\): halve the step and the error roughly halves. Methods such as the fourth-order Runge–Kutta method (RK4, used in this course's interactives) sample the slope several times per step and are far more accurate for the same \(h\).
Choosing a time step
A small step costs computing time; too large a step costs accuracy, and beyond a point something worse happens. For a linear system, each step multiplies every mode by \(1 + h\lambda\), where \(\lambda\) is that mode's eigenvalue (Lesson 6.1). The simulation only settles if \(|1 + h\lambda| < 1\) for every mode:
Break that limit and the numbers grow without bound, even for a perfectly stable car: numerical instability. For the bicycle model the fastest mode is fastest at low speed, where the sideslip mode decays at roughly \((C_f + C_r)/(mV)\). The club racer's limit is about 11 ms at 10 km/h but 95 ms at 90 km/h. For accuracy, not just stability, a step of a tenth of the fastest time constant is a sensible start.
A simulation that runs is not necessarily right. Check it against a smaller time step: if the answer changes, the step was too large.
The step-steer test and its metrics
In a step steer the car drives straight at constant speed and the steer jumps to a fixed angle \(\delta_0\). (Standard tests, such as ISO 7401, use a fast ramp of the steering wheel rather than a true step.) The yaw rate and lateral acceleration rise toward the steady values of Lesson 5.3, and the way they get there is summarized by a few numbers:
- Steady-state yaw rate, \(r_{ss} = \delta_0\,(V/L)/(1 + K V^2/L)\) (Lesson 5.3).
- Response time: how long the yaw rate takes to reach 90% of \(r_{ss}\).
- Overshoot: how far the peak exceeds the steady value, \((r_{\text{peak}} - r_{ss})/r_{ss}\). It grows as the damping ratio falls, so it grows with speed.
Lateral acceleration follows a different path. With ideal tires that respond instantly, it jumps the moment the steer is applied, to \(C_f\,\delta_0/m\), because the front tires push sideways at once. As the car starts to yaw, the front slip angle shrinks and \(a_y\) dips briefly. It then builds as sideslip grows and the rear tires take their share, reaching 90% of its steady value later than the yaw rate does (160 ms against 99 ms for the club racer at 90 km/h). Real tires must roll a short distance, their relaxation length, before their force builds, which smooths out the initial jump.
- With the club racer at 90 km/h and Euler, raise the time step from 10 ms toward 120 ms. When does the response stop looking like the reference, and when does it blow up? Compare with the “stable below” readout.
- Keep a 40 ms step and lower the speed to 20 km/h. Why does a step that was fine at 90 km/h now fail?
- Switch to RK4 at the same steps. How large can the step get before RK4 goes wrong?
- Back at a 5 ms step, compare the overshoot at 90 and 180 km/h. Link the change to the damping ratio of Lesson 6.1.
- Make the car oversteer (front 3000, rear 2000 N/deg) and drive at 200 km/h. What happens, and is it the integrator's fault this time?
Take the first Euler step by hand for the club racer at 90 km/h (25 m/s) after a 1° step of steer, with \(h = 10\) ms. The car starts from \(\beta = r = 0\).
Derivatives at \(t = 0\): only the steer terms are non-zero. With \(C_f = 2000\) N/deg, the front tires produce \(C_f\,\delta_0 = 2000\) N, so \(\dot\beta = 2000/(750 \times 25) = 0.107\) rad/s and \(\dot r = 1.176 \times 2000/955 = 2.46\) rad/s².
One step: \(\beta_1 = 0.010 \times 0.107 = 0.00107\) rad \((0.061°)\) and \(r_1 = 0.010 \times 2.46 = 0.0246\) rad/s \((1.41\) deg/s).
Where it ends up: the steady yaw rate is \(7.65\) deg/s (0.34 g). The reference solution reaches 90% of it after 99 ms, with 1% overshoot; at 180 km/h the overshoot grows to about 20%. Lateral acceleration jumps at once to \(2000/750 = 2.67\) m/s² (0.27 g), then dips before building to 0.34 g.
“If the simulated car spins, the car is unstable.” It might be, or the time step might be past the integrator's stability limit, and the growth is numerical, not physical. Before believing a dramatic result, halve the time step. A real instability stays; a numerical one disappears.
The same simulation in code
The heart of the simulation is a few lines. This is the core of the downloadable Python script, without the lines that record and plot the results; the MATLAB version follows it line for line.
def derivatives(beta, r, delta):
alpha_f = beta + a * r / V - delta # slip angles (Lesson 0.2)
alpha_r = beta - b * r / V
Fyf = -Cf * alpha_f # linear tires (Lesson 2.1)
Fyr = -Cr * alpha_r
beta_dot = (Fyf + Fyr) / (m * V) - r # m V (beta' + r) = Fyf + Fyr
r_dot = (a * Fyf - b * Fyr) / Iz # Iz r' = a Fyf - b Fyr
return beta_dot, r_dot
t, beta, r = 0.0, 0.0, 0.0
while t <= T:
beta_dot, r_dot = derivatives(beta, r, delta0)
beta += h * beta_dot # explicit Euler step
r += h * r_dot
t += h
Download the complete scripts: step_steer.py (plain Python 3; plots if matplotlib is installed) · step_steer.m (MATLAB or Octave).
Both print the steady yaw rate, the response time and the overshoot. Try changing \(h\), the speed or the cornering stiffnesses, and check your results against the simulator above.
Check your understanding
In the worked example, what is the yaw rate after the first Euler step if the step is 10 ms?
\(r_1 = r_0 + h\,\dot r_0\), with \(\dot r_0 = a\,C_f\,\delta_0/I_z\).
\(\dot r_0 = 1.176 \times 2000/955 = 2.46\) rad/s², so \(r_1 = 0.0246\) rad/s \(= 1.41\) deg/s.
A system has one real eigenvalue of \(-40\ \text{s}^{-1}\) (and slower modes). What is the largest time step for which explicit Euler stays stable?
For a real eigenvalue, \(h < 2/|\lambda|\).
\(h < 2/40 = 0.05\) s \(= 50\) ms.
After a step steer the yaw rate peaks at 10.5 deg/s and settles at 8.74 deg/s. What is the overshoot?
\((r_{\text{peak}} - r_{ss})/r_{ss}\).
\((10.5 - 8.74)/8.74 = 0.201\), or 20.1%.
Why does the bicycle model need a smaller Euler time step at low speed?
- Because the car turns more sharply at low speed.The stability limit comes from the eigenvalues, not the turn radius.
- Because the sideslip mode decays at roughly \((C_f + C_r)/(mV)\), which is fastest at low speed, and Euler needs \(h < 2/|\lambda|\).Faster modes demand smaller steps.
- Because the tire forces are larger at low speed.They are not; the issue is how fast the state changes.
The yaw-rate overshoot after a step steer grows from 1% at 90 km/h to 20% at 180 km/h. What causes it?
- The car oversteers at 180 km/h.The club racer understeers at both speeds; overshoot is about damping, not balance.
- The damping ratio falls with speed, because yaw damping weakens as \(1/V\).Lower damping means a larger overshoot (Lesson 6.1).
- The Euler time step is too large at high speed.The reference solution, with a tiny step, shows the same overshoot.
A simulated car spins after a gentle step of steer. What should you check first?
- Halve the time step and run it again: if the spin disappears, it was numerical instability, not the car.A real instability doesn't depend on the step size.
- Increase the time step to speed up the simulation.That makes numerical instability more likely, not less.
- Nothing: a spin always means the car is unstable.Integrators can produce growth that the real system doesn't have.
Going further with Milliken
Read: RCVD Chapter 6, Simplified Transient Stability and Control, on the response to a step of steer.
As you read, look for answers to these questions:
- Which response measures does the book use to compare cars after a step steer?
- How do the yaw-rate and lateral-acceleration responses differ in shape and timing, and why?
- How do speed and the understeer gradient change the step response?
Summary
| Idea | Key relation |
|---|---|
| Explicit Euler | \(\mathbf{x}_{n+1} = \mathbf{x}_n + h\,f(\mathbf{x}_n, t_n)\); error \(\propto h\) |
| Euler stability | \(|1 + h\lambda| < 1\) for every mode; \(h < 2/|\lambda|\) for real \(\lambda\) |
| Step-steer steady state | \(r_{ss} = \delta_0\,(V/L)/(1 + K V^2/L)\) |
| Response metrics | Time to 90% of \(r_{ss}\); overshoot \((r_{\text{peak}} - r_{ss})/r_{ss}\) |
| Good practice | Check results against a smaller step; numerical growth disappears, real instability doesn't |
That completes the transient stretch module. Module 7 turns to the suspension: springs, dampers and how roll stiffness is set.