Jordi Wippert
← All writing
· · 6 min · #cs #paper

F1 simulation

“Simulating Formula 1 crashes in the start-section including the first turn”

Abstract – Crashes in Formula 1 are influenced by certain properties of circuits. A computer simulation model, based on the Nagel-Schreckenberg traffic model, is used to study the effects of acceleration, turn speed, distance and braking. The goal is to find unsafe conditions in a small part of a circuit. The results show that crashes are influenced by speed but that there is no significant factor that shows how or when a crash will happen.

F1 crash simulation result, chart 2 F1 crash simulation result, chart 1

GitHub repository
CS Course: Research Methods

A fellow student and I did this project together.

Formula 1 has a lot of unexpected events in it, which made it seem like the perfect research subject.

The research question

The question was whether properties of a circuit make the start of a race less safe. We only looked at the start section, from the grid up to and including the first turn. Nine of the first 16 races of 2017 had an incident there.

The FIA circuit rules say “There should preferably be at least 250 m between the start line and the first corner.” We tested that kind of rule with four variables: the distance from the start line to turn one, the braking distance, the turn speed and the acceleration.

From traffic model to race start

The Nagel-Schreckenberg traffic model has four steps per car: acceleration, slowing down, randomization and car motion. The original has a single lane and cars that can’t collide, so our model keeps the four steps but changes most of the rest.

The track width is split into five rows, so a car can pass on both sides, and a car is 5 metres long and 2 metres wide. Twenty cars start on two sides, 8 metres apart and alternating from the pole position side, in an order sampled from the 16 qualifying results of 2017 so far.

A car accelerates until it reaches its braking point. The acceleration values come from the 0 to 100 km/h time of about 2.6 seconds and from times for a few specific cars, so a Ferrari gets 11.2 m/s² and a Toro Rosso 9.6 m/s². The braking follows from the current speed and the maximum speed of the turn, spread over the metres left until the turn.

A faster car overtakes towards the optimal row, which we defined as the opposite side of the turn, and a car with a faster one behind it moves into that row to block it. If the move is blocked, the car stays in its row. One step is one second, and a run stops when the last car has passed the turn or at the first crash.

When is it a crash?

Crashes only happen between two cars in the same row, when the gap to the car in front drops below zero. The car first tries to switch rows, and if no row is free, the randomization step decides between braking and crashing with equal odds. From models/car.rb:

def crash_check
  return unless car_in_front && car_in_front.row == row # no car is blocking
  return if m <= (car_in_front.m - length) # there's still space
  return if m - length > car_in_front.m # take over
  return switch_rows? if space next_row # switching rows could prevent crashes

  if rng.rand(1.0) > 0.5
    @crash = true
    write_crash
  else
    @m -= 20
  end
end

Braking here means the car drops back 20 metres.

Simulation setup

We ran 10,000 Monte Carlo runs for each of the 20 circuits on the 2017 calendar. For every circuit, circuits.json holds the distance to turn one, the braking distance, the turn speed, the side of the turn and the pole position side.

The randomness comes from Ruby’s own generator, a modified Mersenne Twister. We tested it as if it were a die: 50,000 rolls gave a chi-square of 1.2834, well below the critical value of 11.07 (α = 0.05, 5 degrees of freedom), so we accepted the generator as fair.

Results

The 200,000 runs produced 121,747 crashes. Since a run stops at its first crash, each number below is the number of starts out of 10,000 that ended in a crash.

CircuitStart to turn 1 (m)Braking (m)Turn speed (km/h)Crashes
UAE305501509449
Malaysia620100748849
Singapore274501268724
USA364100868217
Azerbaijan206501167926
Australia3811001507837
Bahrain476.4100707792
China324.7501707664
Hungary576100857550
Monaco111751037477
Italy615125807393
Spain690.51001307211
Canada2581251546334
Mexico8902001076279
Brazil334501095129
Belgium251150772887
Russia205.2-3002103
Japan373101521262
GBR270-281991
Austria318200122673

This is the table from our paper, although the crash log and the plots in the paper use 25 m of braking for Monaco and 252 km/h for Japan.

Braking distance didn’t have a clear effect, its regression line against crashes is almost flat. A longer start straight gave more crashes, which could be because of the higher speed or simply because there are more metres to crash in. A faster first turn gave fewer crashes, since smaller speed differences mean fewer cars running into the back of each other under braking. And we found no hard correlation in the distances, so no hard safety reason for the FIA’s 250 metre preference either.

In the raw log, crashes-final.json, the peak is at second 11, with 40,115 of the 121,747 crashes. Overall the crashes in the model look random, and no single factor shows how or when a crash will happen.

Limitations

Five rows is wider than real turns, where 2 or 3 cars fit next to each other, and the width of the start straight also differs per circuit. The angle of a turn isn’t modelled, so turns that need hard braking are missed. Each car has a single linear acceleration value for the whole season, taken from the first 100 metres, while real acceleration drops as the speed goes up.

Only head-to-tail collisions exist, no side-to-side ones, and weather, the rules on defending a position and driver reaction time are left out. In the paper we suggested looking at all crashes on one circuit in depth, instead of comparing all circuits at once.

Another simulation from the same MSc is Estimating the Uithoflijn’s operational performance with simulation.

Disclaimer: The above content and related documentation, papers, essays, code and other references, were created during a course of the MSc Computing Science. No rights can be derived from the content. Much work has been done in collaboration with other students. If there is any reference to your person in any way that you would like to see removed or to be named (more) explicitly, at any time, please let me know.

← GTA1 in Haskell 2nd place Startup Weekend Groningen - Omapost →