I’ve wrote a bit about my lap sim program before, but today I wanted to give a full demonstration. The goal will be to build up a model of a modern F1 car and correlate it to real telemetry data. My main tool will be my MATLAB quasi-static lap time simulation program, but the process will also involve a bit of driver-in-loop simulation and some CFD.
This lap sim project is something that I started a few years ago and have been slowly refining in my free time. It is a constant work in progress and I’m always finding things to improve, but I think it’s at a level now where I can really start to get some use out of it. At any rate its been a fun project and forced me to think deeper about both vehicle dynamics and programming.
If you’ve read my last post you’ll know that I’ve been spending a lot of time looking into the technical aspects of F1 recently, so I figured it would be useful to have a working lap sim model of an F1 car (or at least something similar to an F1 car). Data to build an F1 model is hard to come by, so I’ve had to piece things together the best I can. I’m sure that much of the information I’m using here is not really very accurate, but as you’ll see at the end I’m still able to create a pretty decent simulation of an F1 lap.
The Track
The first step in building a new lap sim project is logged data — this serves primarily to build the track model and to correlate the baseline simulation. In order to obtain this data I used a plugin to record telemetry while I drove a lap in my racing simulator of choice, Automobilista (AMS). While AMS does include a modern F1 car in its catalogue, I took the liberty of modifying many of its parameters to get a better starting point. Among other things I replaced the suspension geometry and the aero ride height map with those of the 2021 Williams car. Even on a simulator a modern F1 car is difficult for a mere mortal like me to drive at the limit, so I also scaled down some of the parameters (torque, downforce, tire MU, etc.) with the goal of slowing the car down to roughly F2 levels while maintaining the ratio of aerodynamic to mechanical grip in order to keep the same F1 driving characteristics.
So, I took to the virtual Circuit de Barcelona-Catalunya with this “70% F1 car” to log some laps. My best effort clocked in at 87.048 seconds, just over 10 seconds off the 2021 F1 pole time, and about a second faster than the 2019 F2 pole. I then imported the telemetry from this lap into MATLAB to create the track data.
At this point you’re probably thinking “simulating a simulator?” but again, the main goal here is to get the driving line (distance and radius) around the circuit, and a driver-in-loop simulator like AMS actually does a very nice job of this in lieu of real data. Below is the speed and lateral acceleration of the logged lap, and the resulting track radius calculation.
I’ve found that using an uncorrected track profile like above does not always match the logged data as well as I’d like, so I also use a script which compares a simulated lap with the logged data to calculate a local grip correction factor. I chalk this up to the cumulative effect of all the things I’m not simulating or have poor data for. It’s a bit of a crude method and by no means a necessity, but it helps get the last couple kph of the sim lap to match the log.
The Car
With the track sorted, the next step is the car itself. Currently I have something like 100 input parameters to fully define a vehicle file. Most of these are basic chassis and suspension settings and I won’t be covering them all today. I do however want to touch on two of the most critical parameters, tires and aerodynamics.
One of the nice things about the AMS / rFactor engine is that compared to more modern sims is has a relatively simple (but not bad) tire model which can be easily manipulated. Because of this I’ve chosen to use the same model in my lapsim program. Here I’m using a modified version of the standard AMS formula 3 tire — the model specifies 3 separate normalized slip curves for lateral, acceleration, and braking, and then transforms these curves based on load, pressure, temperature, camber, and velocity. Currently I don’t calculate pressure and temperature in my program, and instead use the average values from the logged lap. Starting from the f3 tire I scaled up some of the parameters to get something that can be used to represent an F1 tire.
For aero I’m using a ride height map from my CFD on the 2021 Williams ( I hope to have a full post about ride height mapping that car at some point in the future). This is characterized by maximum downforce at a high rake angle, and an extreme balance shift with ride height change. The magnitude of the coefficients have been scaled to about 70% to match the rest of the car.
The Lap
Once all of the vehicle parameters have been entered I can run the initial simulation and see how it compares to the logged lap. The goal of-course is to have the sim lap and the logged lap match as closely as possible, although I’m not too concerned with having a perfectly accurate correlation. The reality is that my program is still highly simplified compared to the subtleties of the DiL simulator or real life, so plus or minus a few kph is the best I can hope for.
The plots below show the simulated lap in blue vs. the logged AMS lap in pink:
All things considered I’m quite happy with the correlation here. While there are definitely differences, they are mostly small, and the general behavior of the car throughout the lap is captured well.
The steering angle trace is interesting. There seem to be two distinct “modes” in the understeer gradient plot — in high speed corners the gradient remains nearly linear throughout the entire range, while in low speed corners the gradient increases near the limit. As you can see above my solution is only capturing the low speed mode and overpredicting steering angle in fast corners. More investigation will be needed to resolve that issue, but for now I’m not too concerned about it.
With a vehicle and track model successfully correlated to the logged AMS data, I can now scale the 70% F1 car back up to its full potential by increasing the power, tire grip, downforce, and final drive ratio as listed below. I also needed to increase spring rates to maintain the same ride heights, and make a small adjustment to the aero pitching moment to maintain the same balance. The results of these changes are plotted in pink below:
The goal of the 70% car was to make something that was a bit slower but still behaved like a full F1 car, and you can see here that goal was accomplished.
The real question though is how this full F1 car simulation stacks up to real life. Fortunately it’s possible to get a glimpse of a real car’s performance by extracting the telemetry data shown during F1 onboard videos. Below is the lap sim (blue) vs. real telemetry from Bottas’ 2019 pole lap (red).
Not bad, eh? The simulated lap comes in at 75.477 seconds vs. 75.406 for the real lap. There are some larger differences in turn 1 – 2 but I think that could probably be resolved with a bit of fine-tuning.
In the next post I can dig into the details of how this car generates lap time, and start to change some of the parameters to see how they effect performance. If there are certain things you’d like me to look at let me know in the comments. Thanks for reading!