Tuesday, September 27, 2016

Speeding up your section time/performance analysis, using maths and sciences.

(originally posted on facebooks, this is edited/updated version)

I know that most of you pick your data system based on cost and "peer pressure". Let me make a case for the importance of choosing a system that gives you access to real analysis capabilities, for example, basic statistical analysis. This could mean that you may need to go outside of software package provided by the manufacturer of your data logging device.


Today, even Excel gives you tools for fairly advanced statistical analysis and visualizations - so if your "racing" data logger software suite does not, and you do want to unlock the miracles of modern data analysis and visualization technologies, you can export your data to a different analysis package. For example, Microsoft Excel! Or, if you want to really impress your friends, MATLAB...

OK, so let's consider specific example having to do with section times and "fastest laps". If you ever switched back and forth between your segment time charts and trace views, trying to figure out if your best lap still "left some time on the table", perhaps in specific sections, you may find it easy to relate to this example.

If, on the other hand,  you are not sure what's the deal with delta/lamda/variance/diff traces, or segment/split reports, you can start by watching James Colborn's video about driver/lap comparison:



Watch the video for an example of how both difference/variance trace and segment time reports can be used for the analysis, and how valuable the data encoded in both of those views can be - as a very nice bonus, it also has an example of how exporting data into Excel for analysis can help you get around limitations of "native" analysis software.

Anyhow, onward to the example.

So, the Variance trace (or "Delta") trace can be used to compare laps (again, if you are not sure how, check out the video above). Orange highlight in the screenshot shows pretty typical one.


While occasionally, those traces are straightforward, if you look at enough of them, especially from the same car, you will come across many that go up, then down, then up, then down, etc., when comparing 2 or more laps, likely creating somewhat mixed and confusing picture.

Maybe it goes down sharply, then gradually rises? And then does the reverse? Does it go down in the corners, then up on the straights? Up in left handers, down in right handers? Up under braking, down on turn-ins? Up when your spotter is keying the radio accidentally, down when you remember about that cold beer you stashed in the cooler?


In fact, I am willing to bet that most drivers or aspiring race engineers, who give up on going deeper into data analysis (and/or on applying it to better their racing program), do so after seeing really bewildering things that such trace can do...  We hear a lot about importance of variance/delta traces - but aside from a views like the one above, there are not really any tools or examples on how to "un-confuse" what real world data often looks like.


Of course, you can flip to section/segment time view (or put it on the second monitor, etc):



while it does allow you to review all of the data at once, unfortunately, this is really good way to overload your brain when you switch to, and away from this view, repeatedly.
"Wait, was I looking for times in Turn 5 or 6? Is difference between 7.995 and 8.071 more important than difference between 5.841 and 5.728? Let me flip back to trace view... Then back again. Where was I?"
For whatever reason, our brains do not work well when trying to put together tables of numbers with a bunch of squiggly lines, to form a comprehensive answer to a complex question. I guess that's what happens when your brain evolves as a result of chasing venison across grassy plains. Bummer. Why couldn't cavemen spend more time on maths, statistics and race cars? Oh, right...

Well, since we already have the concept of track segments, why not make the Variance trace run "per-segment". After all, really interesting questions are not "How this lap came to be this much faster than that one" or "Which car/driver is faster", but the ones like:

  • "Where can I do something differently as far as my driving technique, to improve my time, and what exactly should it be?"
  • "Which specific segment/transition should I optimize my setup for?
  • "Which section may be exposing a mechanical problem, holding me back"? 
  • "How can I do all this in 10 minutes I have before the car goes to the grid for the next race/session"?
The idea is that if you can, at a glance, see where there is significant gain/loss between two laps, instead of dicking around with comparison cursor (drawing even more lines - ugh) or introducing another view of data (segment tables) - if you can do that in the same view you do most of your analysis in, you get to important insights faster, meaning that you will find more of them in the time you have. Perhaps, more than your competitors will, given the same time!

Well, such view is quite possible, and here it is:


Is that easier to read? I highlighted some obvious patterns. This view , actually, turns out to have sort of a language of it's own:

  • "Shallow slope" triangles (i.e. green highlights above):  acceleration/drag  differences, or grip in sustained load/sweeping corners - see green highlighted sections
  • "Steep slope" triangles: throttle or brake application differences  - see beginning and middle of first red highlighted section)
  • "Very steep slop" triangles, nearly rectangular in shape: difference resulting from brake applications - see second red highlighted section
  • "Up-and-down/sine wave" shapes (in the same corner-straight sequence) - these are usually trade-offs between entry speeds and early/mid corner grip and throttle application - see last red highlighted section
While it may take a little getting used to, this view has proven very effective at not only identifying significant/important areas of the track, or aspects of tuning changes that go in the right or wrong direction, but also at classifying them quickly, which focuses more detailed level of analysis on areas likely to produce useful, actionable insights.

Real analysis software makes it relatively simple to set up. I added some information of how such view can be created in MoTeC software, at the end on this article.

Another idea - what if, looking at traces of your "best" lap, you could add a trace that tells you which sections of it are not actually "best" - and, by how much. Perhaps, best lap has 8 sections, which, on 2 other laps, had better times (and 3 of those sections had significantly better times), even though those other 2 laps were not faster overall?

With the approach commonly taught/practiced (and the only one possible with more basic analysis software), you will need to look through segment time table OR go through variance traces for at least 2 more laps. See how long it takes you to find 3 sections on laps other than 1.46.9 lap, which are significantly faster (at least 0.1s)?



Are you SURE you found the right 3? Maybe there are 4 of those! 2? Better check again...
And this is just 6 laps! What if your data set has 40 laps? How about 400?

Why not have a trace that simply tells you how far each section time is from your "best" time for that section?


Ah, so there are only 2 sections that have times faster by at least 0.1 sec on other laps, not 3! The third one is only 0.096s faster :)

How long did it take you to find 3 sections that are "not like the others" on this last view?

I really love this view - it allows me to see right away, how much important information there is in the "fastest lap", vs other laps in the session.  And, there is no need to go to section time tables, or to spend hours of my life untangling endless variance/delta squiggles, until I know exactly which section of which lap I want to look at.

It also makes it easy to see that even  though the reference lap was the fastest in session, it left about 0.3 sec on the table, based on section times collected from ALL laps - again, without any need to switch the view away from trace view.

Now, imagine how powerful this method is, if you are looking at data from endurance race, with possibly hundreds of laps..

Well, congratulations if you have gotten to this point :)


Here's how by-section Variance can be set up in MoTeC I2 Pro:

First, you need to set up "SectionRunningTime" as
'Calc Outing Time' [s]-stat_start('Calc Outing Time' [s],1,range_change("Outings:Laps:Track Sections:Default"))
If you did it right, it should show up like this:

 (This is where AiM stuff chokes, as it doesn't seem to allow a way to reference data by-segment. It could do some stuff by lap, but it does not expose ability to create and manipulate ranges/segments inside laps without some serious hacking that would need to be replicated for each track - if you can figure out reasonably portable way how to do that - let me know)

Next, we need to take care of timing "jumps" around edges of segments, otherwise the chart looks a little insane.

For this, I create function called DeltaSectionSmoothness:
derivative(variance_dist('SectionRunningTime' [s]))
Here's what it does:



Think of it as "alarm" that goes off when there is a sudden "jump" between running total for a section distance across 2 laps - which is what happens when the transition between 2 segments n 2 laps is slightly shifted in relation to each other (you can search for "GPS Drift" if you are interested in underlying reasons for why that happens, sometimes)

Now, we can write a formula for our section-specific Variance:

choose(abs('DeltaSectionSmoothness') > 0.8, invalid(), variance_dist('SectionRunningTime' [s]))
What it says, is: Calculate by-distance Variance, between 'SectionRunningTime' values of two laps, EXCEPT when 'DeltaSectionSmoothness' has triggered the "un-smoothness" condition.

If we were to remove that condition, we'd get some ugly vertical lines between some sections, here's example of both un-smoothed, and "smoothed" versions:




Well, that's it. Building "Delta with Session Best" trace is a little more complicated, so I will leave that out.

2 comments:

  1. Just want to say, this was absolute gold for me. Granted, I do rally sim racing, but being able to see delta by segments has really exposed where I need to improve. Thanks so much for writing this up.

    If you ever get around to showing how to do delta by session best, that would be fantastic!

    ReplyDelete
  2. Also, do you also do posts on facebook? Where can we find you there?

    ReplyDelete