Page 1 of 1

iRacing - calculate average lap time

PostPosted: Thu Feb 21, 2019 12:44 pm
by Gyster
Hi. I am learning to use MoTeC in an effort to help me improve car setups in the iRacing Nascar series. One of the things I would like to do is to display lap times in a table view and display the average lap time for the stint in the last column. I have found a couple ways to display lap times, but have not figured out how to add a column to average the values for each lap. The expression "stat_mean" looks promising, but I do not know how to apply this to get the desired result. Any help is certainly appreciated.

Guy Seela

Re: iRacing - calculate average lap time

PostPosted: Sat Feb 23, 2019 10:12 am
by Gyster
Still working on this average lap time problem, I've been trying to use an outing graph to log lap times (and eventually an average). I notice the function LapLastLapTime channel returns the value of the previous lap time for each lap run. Using this, I can capture lap times for lap numbers 2 and up. So now I just need an expression that will average these values. I've tried lots of variations of the stat_mean function like

stat_mean('LapLastLapTime' [s],'Lap Number'>3,'LapCompleted'), but I'm not familiar enough with math expressions.

I thought this expression would return the last lap time (in seconds), while lap number is greater than 3, and reset the value at each lap completed. I think it may be because I do not understand what the lapCompleted channel returns as a value and whether that is valid input for the "reset" function in this expression. I've also tried stat_start, stat_end, stat_max, and stat_min, but...no joy. :oops: Are there any resources that explain what these channels and functions need for input and produce as output? Or is there an expression that someone has already worked out to calculate average lap times?

Re: iRacing - calculate average lap time

PostPosted: Mon Feb 25, 2019 9:54 am
by adrian
I'm not sure what the "LapLastLapTime" or "LapCompleted" channels are but if you have a "Lap Time" (the actual duration of the lap in seconds) channel then stat_mean() will just work with that. It will take include In and Out laps so you will have to take that into account when you set the conditions.

You can also use a Channel Report with the Lap Time channel, set the worksheet data set to 'Outings' and then in the Channel Report, select the Lap Time channel and 'avg'. You will need to delete "Outings:Laps" from the Headings list.

If you don't have a 'Lap Time' channel you can create one using stat_max() on a 'Running Lap Time' channel and resetting it with Range_Change(Outings:Laps).