×

Sale ends todayGet 30% off any course (excluding packages)

Ends in --- --- ---

Professional Motorsport Data Analysis: Advanced Math Channel Uses

Watch This Course

$197 USD

-OR-
Or 8 easy payments of only $24.63 Instant access. Easy checkout. No fees. Learn more
Course Access for Life
60 day money back guarantee

Advanced Math Channel Uses

16.35

00:00 - In this module, we're going to continue to explore building math channels within a data analysis project by making use of a few more of the built in tools that the software package provides.
00:12 There are statistical functions built into our software that allow us to calculate things like averages, maximums and minimums.
00:20 While we'll be using some specific examples within this module, really I just want to demonstrate some of the more advanced math functions that are available.
00:29 As we more further through this course, we'll be making use of some of these specific functions as well as building others based on these principles to perform specific tasks.
00:41 Let's start with a problem that can sometimes sneak in and take a while for us to pick up on.
00:45 An offset in the steering angle data.
00:48 What we want is for the steering angle data to show close to 0 when we're travelling in a straight line.
00:54 If it doesn't, there's going to be an offset in the data which will make it appear as if the driver is using more steering angle in one direction compared to the other when the car's in a turn.
01:04 This can easily happen in cases where a belt is driving the sensor from the steering column and it slips.
01:11 Or where some aero was introduced when the toe was set during setup.
01:15 You want to catch this as early as possible in a race weekend so the sensor can be zeroed and avoid big headaches later on down the road.
01:23 One approach for this is to use the average stats function to calculate the average steering value when the car is travelling in a straight line.
01:31 To decide how we're going to do this, let's take a look at some raw data.
01:35 Looking at the speed trace, steering angle, lateral G and a track map, we can easily identify an area where the car is travelling sufficiently straight.
01:45 One of the simplest methods is to look for when the lateral G is close to 0 but first we need to identify a sensible range with which we can class as close to 0.
01:55 Zooming in on this straight section, and looking at the kind of variations we're getting while the car is travelling straight, we could use a value of +/- 0.05 G.
02:07 In general, when we're deciding thresholds like this, you want to make them to be relevant to every track you go to so this needs to be considered.
02:15 But in this situation, these values will be fine.
02:17 After opening the math channel editor and configuring this new channel as required, we can scroll to and select the stat mean function.
02:26 In MoTeC's i2 software we're using, the stat mean is simply the name they give to an averaging function.
02:33 This function averages the value of the channel you pass it and gives you some different options for how to do that.
02:39 When we select it, we can see that there are 3 different ways this function can be used as shown in the examples in the help area to the right.
02:47 We're going to use the second option, which will allow us to calculate the average value of the steering angle but it will only do the calculation when a certain condition is true.
02:59 So the first input is the steering angle and the condition we want to use is going to be based on the lateral G force.
03:05 Note that I've used another function here for the condition which is the abs function.
03:10 This is simply taking the absolute value of the lateral acceleration.
03:15 The definition of the absolute value is taking the magnitude of the number and ignoring the sign.
03:21 So the absolute value of a number is always positive.
03:24 We'll use absolute value quite extensively in math channels and in this particular case, it's useful because we don't care if the lateral acceleration is positive or negative, we just want to check if the magnitude is small.
03:36 So reading this expression left to right it says, give me the average of the steering angle across the entire log file but only when the lateral G force channel is within the bounds of +/- 0.05 G.
03:51 The idea being, it's giving us the average value of the steering angle from the whole time the logger was recording, while the car was travelling in a straight line.
03:59 Adding that channel to the plot from before, we can see that there is indeed an offset that roughly lines up with what we saw in the raw data.
04:08 Obviously this channel is relying on the lateral acceleration channel in order to be correct which again, reinforces how important correct calibration and zeroing of sensors are.
04:19 If the lateral acceleration channel has an offset itself, we'll end up with the wrong output.
04:25 By adding a channel report here for this channel, it can be reviewed quickly during an event to see if there's any offset issues.
04:31 If we saw that there was a significant offset here, as in this case, we would certainly want to investigate why we had an offset and correct it on the car.
04:40 This is a good example of where a channel report is more suitable than a time/distance graph to quickly summarise something without having to pour over all of the log data.
04:50 Another parameter that can be very useful to calculate is steering smoothness.
04:54 Which is influenced both by the driving style and car setup.
04:58 One way to quantify the smoothness of the steering inputs is by comparing the actual signal to a smooth version of the original signal.
05:06 The larger the difference between them, the less smooth or more rough the steering inputs are.
05:13 The first things we need to do is to make a smoothed version of the steering channel and using the built in smooth functionality, this makes it very simple.
05:21 We have the option to smooth over time or distance using a moving average filter.
05:27 And for this example, I'm going to use it over time.
05:30 The trick is smoothing the correct amount and each situation is different and will require different smoothing.
05:37 If I oversmooth, I won't be representing anything close to the real channel.
05:41 If I undersmooth, it'll be exactly the same as the real channel.
05:45 Here I have the channel smoothed over different time ranges to show you the effect of the extremes compared to the original channel.
05:52 What we want to do is remove the fast changes in the signal but keep the same general overall shape.
05:58 Looking at this data, a value of 0.5 seconds looks about right to me to get rid of the high frequency noise in the data while preserving the general shape of the steering trace.
06:09 Now we want to find the difference between the original and the smoothed version.
06:14 Which I've done here using absolute value as I'm interested in the magnitude and not the sign.
06:21 Plotting this channel and zooming into a few areas of interest, we can see the smoothness channel is peaking in places where the steering input is least smooth.
06:30 This is something we can use to quickly see differences between different drivers.
06:34 Next we'll look at a way we can quantify throttle aggression by using a built in function called the derivative.
06:42 Which mathematically is essentially just the rate of change of a parameter or the slope.
06:48 If the value of something is changing quickly then it will have a large derivative.
06:52 The slope is steep.
06:54 If we're going to quantify throttle aggression, we need to make sure that we evaluate the slope in places only where the driver is ramping up on the throttle in corner exit.
07:03 For example, we wouldn't want to calculate the aggression when the driver was blipping the throttle on downshifts or releasing the throttle on corner entry as these would distort the output of our new channel.
07:15 One way to identify the times that we want to look at throttle aggression would be to use the acceleration data to look for places where we have both lateral and positive longitudinal accelerations which should only occur at corner exit.
07:29 First let's take a look at the raw data that we're going to use in a conditional to decide on the values to use in the limits.
07:36 Looking at the lateral and longitudinal accelerations in the areas where the throttle is ramping, I've decided to only calculate throttle aggression in areas where the absolute lateral acceleration is greater than 0.5 G and the longitudinal is greater than 0.
07:53 Keep in mind that these values are not generic.
07:56 When formulating conditions, you need to decide on values that make the most sense for your application.
08:02 The channel we're using to calculate the aggression value may look a little intimidating at first but going through it piece by piece makes it quite mangeable.
08:10 Note that I've split it up into different lines which can help make longer math channels more readable.
08:16 The top line is simply all the conditions that must be met in order for the calculation to take place.
08:22 So we're saying the throttle value must be between 5 and 95%, the car must have some lateral acceleration and positive longitudinal acceleration and finally that the derivative of the throttle position must be positive.
08:37 This last condition is simply checking if the throttle is being applied or released.
08:42 And we only care about it when it's being applied.
08:45 When the value of throttle position is increasing, the derivative of the throttle position channel will be positive.
08:52 The next line is taking the derivative of the smoothed throttle position.
08:57 This is where the actual aggression is calculated.
08:59 We are using the smoothed value to help ignore some of the unsteadyness in the signal that can make the derivative calculation unreliable.
09:09 The higher this value, the more aggressive the throttle application.
09:12 The final line is just what the expression will return if any of these conditions on the top line are not met.
09:19 Invalid, which means return nothing.
09:22 Looking at the output of this channel against the throttle position, shows us how this is working quite well.
09:29 We can see that the magnitude of the throttle aggression channel matches the rate of throttle application.
09:35 Another math concept that can be helpful to us in data analysis is integration.
09:39 In this context, we can think of integration as the summation of the areas under the curve.
09:46 Let's again look at the steering trace and zoom in on one corner when the data is displayed as points, rather than lines.
09:53 We can represent the same data instead by a series of bar graphs where the height of each bar is defined by each data point and the width, the distance between each data point.
10:06 If we add up the total area of each of these bar graphs, this gives us an approximation for the area under the curve.
10:14 In the context of data analysis, this area is a useful way to visualise what the integration of a channel is.
10:22 Applying that to something in the real world, and we'll get into analysing the steering trace itself later on in the course, one thing we know already is that the amount of understeer a car has, has some relationship to how much steering input we'll need to use.
10:37 The more the balance is towards understeer, the more steering will tend to be used and for a longer time within the turn.
10:47 So for this case, we can make a metric called steering integral where we add up the area under the steering curve to help give us a generic metric to help characterise the balance.
10:57 Looking at the built up channel, we only want to integrate the steering angle when we're cornering.
11:03 We don't want to add up the area on the straights and for small corrections so we use a condition for the absolute value of lateral acceleration to be greater that 0.5 G because we want to integrate it in both corner directions.
11:17 Then we simply apply the steering integral to the absolute value of the steering trace which is going to add up all of the area under the curve for us in both steering directions.
11:27 It's important to note that this lateral acceleration value, as with all the limits set within this course is dependent on the car you're working with.
11:35 You need to apply it to your specific case and decide what's suitable for the behaviour you're trying to capture.
11:41 Again, the final part of the expression is just making it equal to nothing if the condition is not met.
11:48 Plotting this channel in the data against the steering angle shows us that the parts of the steering trace where the area under the curve is greatest, align with were the steering integral is increasing.
11:59 The integral is cumulative so it only gets added to across a lap and it never decreases.
12:05 The last thing we need to cover in this module is reset conditions.
12:09 Reset conditions are used to break the track up into areas of interest.
12:13 Most often, this reset is done per lap but it can also be done by sector or by corner, or over a number of other custom parameters.
12:24 We're going to focus on breaking things up by lap using some of the channels we've already put together in this section.
12:30 Maybe we want to see how a driver's steering smoothness is evolving over a long run of continuous laps.
12:37 Let's say a whole race stint.
12:39 We could go through it all looking lap by lap but this is a slow and tedious process.
12:43 By summarising each lap down into a single value metric and zooming out to look at how that metric evolves over a number of consecutive laps, we can start to analyse the trends rather than the detail which is a critical part of advanced data analysis.
12:59 Here we want to take the average steering smoothness value per lap.
13:04 Looking at this channel, we can do that by using the stat mean function.
13:08 Although in this case, we want to make use of all of the inputs to the stat mean function we have available to us.
13:16 In the help area, we can see that if we use the last version of the stat mean function, that there is a reset parameter.
13:23 This means that the average can be calculated for each lap individually and then will be reset for the next lap which will be calculated separately.
13:32 The syntax that the MoTeC i2 software uses to define reset conditions is called range change.
13:39 And within the brackets, you enter the range over which you want the reset to occur.
13:45 So this expression reads, calculate the average of the steering smoothness channel, the one is used in the condition input because we always want this to happen, and then our reset condition which says reset at the start of every lap.
14:00 Looking at this channel on a time/distance plot and zooming out over an entire stint, we can see that in this case, the value is increasing over a stint, meaning that the steering inputs are getting rougher as the stint goes on.
14:13 Going back and having a look at the steering integral we made earlier, we can see that the integrate function has a reset option as well that we didn't make use of when we first made the channel.
14:25 It also has a conditional check that we can make use of to refactor our expression to make it a bit cleaner.
14:33 So let's move that condition inside the integrate statement.
14:36 Using double forward slashes like this in MoTeC's i2 means that the software ignores the text.
14:43 This is useful if you want to keep previous versions of the calculation for reference or add some comments to your formulas which is a good idea if they start getting complex.
14:53 So let's add the range change to this expression to reset after each lap and go back and have a look at what the updated channel looks like.
15:01 It's behaving in a similar way to before, except it's resetting at the end of each lap rather than showing nothing when the car isn't cornering.
15:09 The value is remaining constant.
15:11 Now let's turn this into a useful value to track per lap.
15:15 In order to track the trend, we can do much the same as for the steering smoothness except we want to look at the max value, not the average.
15:23 So we use stat max instead.
15:26 Looking at this in the data over a stint, we can see that steering integral is reducing as the stint progresses.
15:34 This indicates that the balance is shifting towards oversteer as the stint goes on but we'll get more into how to use this later on in the course.
15:42 In this section, I've tried to use some practical examples to introduce you to many of the basic math channel tools that we'll use as we move throughout the course.
15:52 There's an enormous range of ways we can use different types of math channels and how they can be applied to your data analysis and this has just been an introduction to some of the main parts that you'll likely make use of.
16:04 This section will have been a lot to take in for some people and if that's you, I encourage you to spend some time playing around with the channels that we've been dealing with.
16:13 If a channel is too complex to follow, pull out certain pieces of it and plot it individually.
16:19 By breaking them up into smaller parts and experimenting, you'll start to quickly understand things for yourself.
16:26 We'll also see some more examples of these types of math channels being built up and used in later sections of the course.

We usually reply within 12hrs (often sooner)

Need Help?

Need help choosing a course?

Experiencing website difficulties?

Or need to contact us for any other reason?