RaceCal 'Tech Insight' - Maths Channels (Beginner)

Cosworth, Data, Data Analysis, Motorsport, PiResearch, PiToolbox -

RaceCal 'Tech Insight' - Maths Channels (Beginner)

Evening everyone, whilst a lot of us are self-isolating and no doubt coming close to losing our minds due to boredom, we thought we’d launch the RaceCal ‘Tech Insight’ posts right here on our blog.

The point of this is to give you our customers and followers a better insight into a technology or process that’s used in the motorsport world at both professional and hobbyist levels. As you can probably guess, because of what we do these posts will be in relation to either engine calibration or data analysis.

To kick things off, I thought we’d start with a subject that’s ‘bread and butter’ in the professional motorsport world, however still not so common in the aftermarket world. We have however noticed the aftermarket world changing over the last few years with more and more professional products and processes being transitioned over. Syvecs ECU’s is a great example of this, hardware developed and proven in top end motorsports with Life Racing’s LMP1 programme amongst many others. You can now have this hardware, in your everyday road car at a sensible cost. It's great to see our customers elevating their cars to the next level with this technology.

So moving back to the subject of this blog post, Maths Channels; What are they? Why do we need them? How can we use them? The below will give you a beginner’s insight.

For this tech insight I’m using Cosworth’s hugely powerful PiToolbox. This piece of software can be downloaded free of charge from Cosworth’s website here: https://www.cosworth.com/products/toolbox/?cat=software

You can generate yourself a FOC licence and test out some of the below with the included sample data in the installer package.

I may be called biased for using this software seeing as I've worked for the company; but it gives the best insight into the professional world. As a small insight, the winning privateer team in LMP1 use it, all of the LMP2 grid use it, Aston Martin/Prodrive, Porsche and many many more are all on this toolchain.

Starting with the ‘What’. A maths channel essentially takes an input (or a string/multiple inputs), runs your chosen equation and outputs your calculated channel or state.

Let's start with a nice simple example. Let’s say we want to correct our raw Fuel Pressure channel to be a ‘Relative fuel pressure’ channel.

Maths channels can be hugely complex with multiple math functions/registers etc, but It can also be used as a simple ‘add’, ‘subtract’, ‘multiply’ and ‘divide’.

So to get our channel:


So this takes our raw fuel pressure channel, we subtract MAP, this then outputs our relative fuel pressure channel. A super basic start.

As a second simple example a ‘multiply’ function could be used for a conversion from Lambda to AFR if you wanted to see your data that way.

So to get this channel;


The above is taking our Lambda 1 sensor input in units of Lambda, we then ‘multiply’ by 14.7 (14.7 chosen for this example as this is the stoichiometric figure for a pump fuel) we then get our AFR channel.

If you want to use this with say Ethanol, Methanol or other fuel blends, simply change the 14.7 figure to the stoich value of the fuel you are using.

So how does that look in the software.

First we create the maths channel (Tools > PiMath > Edit)

Insert the above maths channel and click 'ok'.

Once created, this maths channel will show in the availble channel list. Add both channels to your chosen display.

This display is a simple Time/Distance chart below. To add a display head to Insert > Display > Time Distance Chart.

As we can see below where the cursor is left Lam1*14.7 (0.9*14.7)=13.23 AFR.

(Please click image for large view)


So why do we need maths channels then? A very good question; they have multiple uses; the above Lambda example is just a simple conversion to see data in a format that you may prefer working with.

More commonly maths will be used for chassis analysis/development, driver training/development; furthermore, maths are not just used in post processing (offloaded data) you will also use ‘on box’ maths when the car is running. You can use maths to drive certain strategies (Traction Control, Active Aero), trigger alarms, control display pages on the driver dash, diagnostics, timers, filters and more. With a powerful system like Cosworth, the options are almost endless.

The net product of this is a car and driver that can go faster and a team that can work more efficiently at the development stage as well as trackside during a race.

So, another example, we will still keep things simple, but this time introduce more than one calculation.

This time, we will calculate brake balance; a handy channel to have.

To get this channel you will need to have front and rear brake pressure sensors fitted (these channels are available in the Toolbox installer sample data);

choose ( [Press Brake F] > 2 , ( [Press Brake F] / ( [Press Brake F] + [Press Brake R] ) ) , 0 ) * 100

Using the ‘choose’ function, this channel will only be calculated if ‘Brake Pressure Front’ is greater than 2. i.e 2 bar. This means the channel will only be calculated when the driver is on the brakes.

So again, how does that look in the software:

As before, if you add the new brake balance channel to the display, you will see the trace updating. 

(Please click image for large view)


Let's look at another example used for driver coaching. This time it's reviewing ‘coasting’ data. This is when the driver is neither on the throttle nor the brake.

Below we have calculated when the driver is coasting, the amount of time they are coasting for and the distance they are coasting for also.

You will notice some new functions in these maths channels.

Firstly, for the ‘Coasting’ Channel:

choose ( ( [Press Brake F] | [Press Brake R] ) < CONST (Brake Threshold) , 1 , 0 )


choose ( [Throttle] < 10 , 1 , 0 )

‘CONST’ stands for constant, and it's just that. A figure the maths channel can look up that will never change.

Our Brake Threshold constant is set at ‘5’. You can create this constant by going to Tools > Constants > Edit.

So this maths is essentially saying ‘if Press Brake F / Press Brake R is less than the Constant Brake Threshold (5), the channel should be 1 (i.e active) otherwise be 0.

This is the same for the Throttle line below, ‘If Throttle is less than 10 degrees be 1 (i.e active) otherwise be 0.

The ‘&&’ operator designates the maths returns 1 (i.e active) if both x and y (x and y are the brake and throttle lines in this instance) are non-zero, otherwise be zero.

Adding this to the Time/Distance chart shows the channel rising to ‘1’ when the driver is coasting and back to ‘0’ when they are not.

(Please click image for large view)

We can further build on this with two more channel examples:

‘Coasting Time’

integral ( [Coasting] , Hold )


‘Coasting Distance’

integral ( ( [Coasting] * [Speed] ) , Hold)

Here they are now all on the display.

(Please click image for large view)


I thought id finish this post with a snapshot of things to look out for when using maths if you aren’t getting the expected results as well as a few final tips.

  • When doing maths calculations, you must pay attention to the units you are using. Consistency/using SI units is very important. If you are using a mix of units in your maths channels you may inadvertently be corrupting the calculation. The maths channel will still compute, but if the results are not as expected, double check the units. On PiToolbox this is done under the Maths Management and by clicking the ‘More’ button.


  • Sample and calculation rates in maths channels and how they effect the output value – again one to be careful of (if used incorrectly!). Are you accidentally filtering your source channels in the calculation? Are the channels you are using in your maths already exposed to an external filter, before you are using them in a calculation? This is of course important in control maths to ensure the control isn’t being interfered with by a channel that is being utilised at a very slow rate.
  • Maths comments. You will see in my screenshots in this article at the top of the maths channel you have a section to fill in comments. These comments take up no computational effort, but allow clear explanation of what a channel is doing/calculating. This is helpful if you have a lot of complex maths so a) you can remember yourself exactly what the maths is doing if you ever have to revisit it and b) if anyone else/colleagues at the track need to take a look at the maths also – this all comes back to the efficient working point. (As this is an example i've shown bad habits and have not got comments on all the maths; get into the habit of using them if you can!) These comments can either be ‘on the box’ or in PiToolset math. 

    So there we have it, a quick insight into some basic maths channels. Download the software, have a go and let us know how you get on!

    If you’d like to learn more, please let us know in the comments what you’d like to see!


    Leave a comment

    Please note, comments must be approved before they are published