Posted by: drracing | April 19, 2019

Lap time simulation in Excel – Further development

Hi everybody!

Again a long time since my last entry here.
I was indeed very busy in the last few months. I am currently involved in a couple of projects where DiL simulation plays a major role: one is still linked to CORE Autosport, as they stepped into the DPi class in IMSA and will try to run for the overall win, also in 2019 as a private team fighting against OEMs backed programs.
I am also supporting another team this year, running in the ELMS in the LMP2 class, but i will come to this later on this year, in another post.

Beside this, anyway, I went on improving my Excel Lap Time Simulator, a tool that i am using a lot also as a companion to DiL simulations for the projects i am involved with.

I added some “practical features”, that don’t change what the tool can or cannot actually do, but make its use and the manipulation and analysis of the results a bit easier.
The first of them is an automated function (macro) that allows to export simulation results to an external file, to compile a summary table (where the main performance metrics are logged but also some notes about the specific run) and to save the logged data, for later plotting.
Nothing revolutionary, but it helps to save some time, when going through a series of simulations; it also helps in keeping the results better under control and to have a constant overview of the trends they show.
In terms of automation, I guess the next logical step would be to code something to allow to do a batch of simulations, where a certain parameters varies between given boundaries. This is the next priority in my list right now. 

I am also calculating some more metrics now, some of them exported with the others into the results file, some only meant to give an indication about how much time the car spends in certain condition/situations, see for example left and right cornering, or full throttle.

Last, I now also distinguish between left and right corners. Ok, this is really the least important point, but still makes much easier to compare simulated and logged data and this kind of comparisons are always extremely important to check correlation.

Talking about correlation, i now have a bit more data to base my statistics on and i can say that, although being so simple, this tool normally achieves an accuracy of between 1 and 1.5% in terms of lap times. Now, in tracks where the lap times is about 100 seconds, this means 1 to 1.5 seconds, which could seems a lot.
But if you consider how the solver works and how easy the whole tool is, it is actually a pretty good result.

First point to consider, as I already mentioned in my last entry, is the importance of an accurate “track model”, which in this case is an array of Corner Radii vs Distance values (car’s path), with the add of local elevations and grip levels where needed.  
Logged data, from which normally vehicle’s trajectory is derived, are often very noisy and it takes some care to derive a realistic track out of them. Beside this, sometimes there are some inaccuracies in what sensors read, which could also cause some issues in defining our track file.
To be fair, having an accurate path description for the simulation is important mainly to get correlation with logged data; normally, if the trajectory used in the simulation is at least close to the one the car actually follows on track, we can still at least get realistic trends, when testing what a certain setup or design change would produce, in terms of performance, even if the final performance doesn’t match 1:1 to the real one. 
Anyway, if we deal with a car with substantial aerodynamic features, a few kph of difference can also change the influence of downforce on vehicle’s performance and behavior.

Car’s performance envelope is derived considering steady state cornering, braking and accelerating at different speeds, to account for different levels of downforce.
As in every lap time simulation, the vehicle is always driven at its very limit (of course under steady state assumptions) along its path for the whole lap: sometimes the limit is given by the engine power (see for example at the end of the straight, a power limited condition), sometimes by the cornering, braking and accelerating capabilities (grip limited condition).
To explore each of the three scenarios i mentioned, the tool uses a simplified four wheels vehicle model, where the only important parameter not being considered is suspension kinematics. Still, this simple approach takes into account many other crucial parameters and phenomena, like mass, CG position, track widths, wheelbase, lateral load transfer and load transfer distribution, longitudinal load transfer and aerodynamics, although each of these areas is explored considering fixed values for the parameters of interest (it doesn’t take into account, for example, how the aerodynamic properties of the car vary with ride heights, but simply takes one number each for drag, downforce and balance; the same is true for total lateral load transfer distribution or CG position, which would in the real world also vary depending on ride, roll, pitch and any other body movement).
This means that, even if solving the overall performance around a lap using a point mass approach, this method allows anyway to consider and evaluate the effects of many setup intricacies that could normally not be considered when using a “simple” point mass approach.

All of this, plus the tires being modeled considering their load sensitivity, explains also why some very specific, load related phenomena and settings can be explored in a very realistic way.
As I said in my previous entry about this tool, i was keen in taking tires load sensitivity into account in terms of its effect on cornering, braking and acceleration potential of the car and on its influence on how important downforce is.

One extremely useful consequence of using this approach is that you can get a concrete estimation not only of the effects of weight, downforce and track grip, just to mention a few, but also a pretty good pictures of the effects of tuning parameters more related to the balance of the car.

Despite being pretty simple, the tire model i consider enable me to identify which axle saturates first, as speed, downforce, acceleration and load transfer grows.
This makes possible to quantify the effects on both cornering speed and final lap time of changing parameters like the aerodynamic balance of the car, brake balance, static weight distribution and lateral load transfer distribution.
Playing with these parameters is eye opening and brings to a much better understanding about what really matters in each track, depending on its characteristics and why it is so important to adapt car’s setup depending on the circuit. It also gives an immediate feeling about how much different tires could change the car and about how important it is to adapt vehicle tuning to them, in order to extract the maximum possible performance.

To make a specific example, it could happen that, in a track where top speed is crucial, aerodynamic balance could still be the main performance driver, even if this means compromising top speed. Of course, with some cars you are able to tune overall downforce and drag always keeping the desired aerodynamic balance, but this is not always the case. In such cases and with certain tires characteristics, it could be a bigger benefit on lap times to improve car’s cornering potential, even if sacrificing top speed.

This is a simple example of an area where i am happy i could bend my own tool in my very own direction. In this case, for example, despite being the tool principally very simple, it still allows to consider effects and intricacies that a simple point mass solver would not be in a position to analyze.
Again, the approach i used to tackle this is surely a simplified one, above with the respect to the way car’s potential in combined grip situation is estimated.

One final note is that, using lap time simulation in parallel to DiL simulation, one can also get a good picture of how important is to have a driver in the loop sometimes.
The two tools normally show the same trends, which means if you see an improvement in the lap time simulator, normally the same change is also beneficial when tested in the driving simulator.
Anyway, the entity of performance gains or losts, caused by changing a certain setup parameter by a certain amount, is normally different. Lap time simulation normally shows small deltas: this could sometimes lead to underestimate the importance of a certain modification to the car, because one could fall in the trap of thinking the delta is so small that it would barely count.
Anyway, most of the times these deltas gets bigger when we test the same change in the simulator. My opinion is that this depends on many factors, but also that three of them are the most important (here shown in which i consider an order of importance):

1. The driver, which could add on top of an “objective” performance gain or lost his/her own “appreciation” or “disregard” for a certain change. If, say, a certain driver doesn’t tolerate understeer or oversteer in a certain phase of the corner, a modification producing exactly this could exaggerate the performance delta because he/she would not be in a position to drive with confidence anymore. This would put the driver out of its optimum zone, which normally emphasizes the lap time lost following a certain setup change. In a similar way, the opposite could be true when changing car’s behavior in a way the driver likes and that would help to express his/her full potential. 

2. Areas or phenomena which are ignored in the lap time simulator, like suspension kinematics or a complete aeromap, where downforce, drag and aerodynamic balance change with ride heights and, hence, with speed or driving conditions (braking produce a “nose down” situation, where the front diffuser is closer to the road; the opposite is true when the car accelerates). 

3. The basic assumption behind (this kind of) lap time simulation: the car always being operated in steady state. Despite being true that the best drivers are normally extremely smooth and “unsettle” the car in very few occasions (and normally in a controlled way), it is also true that it would be very naive to believe that a car could always operate in steady state conditions. This actually never happens fully. This assumption make writing a lap time simulator much easier and probably don’t take too much out of the results we get, but real life is another story! With this respect, i think it could be fair to believe that a well done DiL simulation could depict the reality better. But we have seen in my previous entry, which are other pros of lap time simulation compared to DiL. 


  1. Hi Andrea,

    This project is exceptionally interesting, and the changes you have made seem to have brought it to a whole new level!

    Is a version of the Excel file available for download or purchase to investigate for interest (with restrictions of course)?

    Kind regards

    • Hi there,

      thank you very much for your kind words! I really appreciate it.

      I am sorry, but the file is not public and i am not planning any release or purchase in the short term.

      It is more of a tool i use for my own projects and something i use as a learning exercise.

  2. One thing always missed by ‘Lap Time Simulators’ is the establishment of realistic vehicle performance traits and metrics. This means running ISO tests on the car models (NOT stop watch measurements on a track). So, this means (for lateral statics & dynamics) measuring steering gain, understeer, Ay response times, peak frequencies and damping metrics. I use specific vehicle parameters in simple but analytically formulated datasets which have known ISO metric values and rates of change. ISO tests I run are constant radius, step steer, frequency response, constant speed steer sweep and constant steer speed sweep. All of these are established road tests that all vehicle manufacturers use.

    If you are interested, I can both send you model parameters (linear & nonlinear tires and steering systems) and show you how to analyze YOUR vehicle models. All my stuff is in Matlab and I can read in spreadsheet material with it. For tire data, I can give you a 4 term Pacejka-Lite model that can even be turned into a perfectly linear representation for diagnosis purposes.

    This process is called ‘validation’ and gives credibility to your efforts. If the vehicle model is NFG, then your efforts are a waste of time. You might be surprised at how good your model(s) are or the other way around. Plus you might surprised at how handling characteristic terms have good engineering descriptors that your whole team will need to step up to if they are still all hand-wavers. This ‘New School’ racing ! I sure hate to see valiant efforts wasted on classical mistakes made in unknown territory…

    • Hi Bill,

      thank you very much for your comment. It is amazing to have you commenting here!

      I can immediately say that the purpose of this simple tool is much easier than what you describe, because more than being something able to characterize the car in terms of typical vehicle dynamics terms (steering gain, response, connectedness, understeer gradient, etc), it mainly something aimed to investigate only the overall performance envelope of the car, under the given assumptions (both in terms of solver and given data).

      Indeed, setup parameters influencing which axle saturates first in something which should resemble a constant speed / reducing cornering radius test come into play, because this is the way i extrapolate the maximum acceleration the car can achieve at each velocity step. I repeat this procedure at speed ranging from very low to very high (depending on car type) to detect how car’s behavior change depending on downforce. Anyway, the tire model is extremely simplified and i don’t consider any compliance in suspension or steering system, as this is already beyond the scope of this simple tool.

      In any case I would be extremely interested in your input about what you describe. I would be more than happy to get in contact to discuss this further.

      Thanks again for reaching out here!

  3. OK. First take a look at this tire model. I call it Pacejka4 because it has 4 terms. Slip is nonlinear and so is load dependency. You might find it familiar because this model is/was used in the Bosch/Lapsim program. I made up a Matlab fitter to produce the 4 coefficients from Flat-Trac or TIRF data. With some trickery, you can even represent a completely linear tire (constant cornering stiffness with load dependency which is useful for the validation procedure I mentioned. BTW: You can easily implement any compliance or kinematic effects by making up the 4 coefficients from the Cornering Compliance elements (tires, Fy and Mz steer, etc. as a function of g-level with an Excel table lookup or quick basic UDF (user defined function).

    I’m not sure what tires you use but if you have some lab data you can fit it (even full blown MF 5.2 if necessary). The Pacejka4 model does a really good fit to most tires , but race tires have a special operating region that can require a weighting function along side slip angle data. No problems usually with load data. Race tires like load.

    Here’s the Pacejka4 code (Matlab basis). It woks for Fy, Mz, Mx, Fx, etc. Watch your signs. Input units are degrees and +Newtons. If you have Matlab, I have some Pacejka4 GUI demos of usage in vehicle modeling (Mostly FSAE).

    Here are some coefficients to play with:
    Hoosier 225/45R17 248 kPa 9″ rim.
    Fy Mz Mx
    D1 1.4647 -.00012504 -.01142
    D2 .041123 .0036391 .0023342
    B .22715 .38321 .07409
    C 1.6031 2.3602 2.5811

    I hope I got it right, if not I’ll send a snippet from the fitter.

    BTW: how do you post a picture (.jpg) on here ???

    function fy = Pacejka4_Model(P,X)
    % x1 = X(:,1); %Slip
    % x2 = X(:,2); % Fz
    % D1 = P(1);
    % D2 = P(2);
    % B = P(3);
    % C = P(4);
    % D = (D1 + D2/1000.*x2).*x2; % peak value (normalized
    % fy = D.*sin(C.*atan(B.*x1));

    % x1 = X(:,1); %Slip
    % x2 = X(:,2); % Fz
    % D1 = P(1);
    % D2 = P(2);
    % B = P(3);
    % C = P(4);
    D = (P(1) + P(2)/1000.*X(:,2)).*X(:,2); % peak value (normalized
    fy = D.*sin(P(4).*atan(P(3).* X(:,1)));

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.


%d bloggers like this: