I’ve recently been trying to improve the efficiency of The Supid Car. Fundamentally, within the ECU is a 16 by 16 table of values. One axis is engine speed, the other is the amount of air the engine is trying to suck in. Each cell in the table contains a value that relates to how long the fuel injectors should fire for. There are a bunch of correction factors thrown in for air temperature, engine temperature, how long the engine has been running etc but simply it’s just a lookup on that table.
These are the theoretical values. I have a wideband O2 sensor in my exhaust that tells me at any given time how far rich (too much fuel) or lean (too little fuel) I am running.
Over time I’ve been doing the following :-
- Drive car and capture logs
- Compare logged rich/lean to ideal
- Create new tweaked table
- Go to step 1
Over time I’ve created about a dozen versions of that table. What I wanted to know was was I tending towards a steady state, was I oscilating around an ideal, or was I diverging wildly?
MSQ files are the standard tune files for Speeduino and Megasquirt2 ECUs. They originally came from the original MS config application MegaTune, and were subsequently used by TunerStudio and MSDroid. They are an XML document that store all the parameters for the ECU.
I wanted a tool that would take all the MSQ files and ‘stack’ them. For each cell I wanted to chart the values over time, and calculate such things as the cumulative average and the standard deviation. This would let me see the hot spots where there has been large variation (big stdDev) and see if the values end up oscilating around the average.
It runs entirely in the browser, I just host a bunch of files on the same server as this blog (which is also a bunch of static files)
If I click on a file, it shows the VE3 table values and colours them by the standard deviation for that cell over the set of tables. The closer to red, the more variation there is. As I mouse over the cells, the chart on the right changes to show the history of that cell. In the screenshot I’m hovering over the reddest cell, and to me it looks like it is slowly trending towards a steady value.
This took me a few evenings to do, but it was good fun and it has restored my confidence that I’m going in the right direction.