Maybe this time I can contribute a bit for my favorite frontend. Using Erorus's VB6 class link I was able to read OBDII data and compute some interesting values. With this implemented one can calculate MPG, HP, and Torque. I was thinking of implementing more stuff but there were some limitations.

The limitations were the fact that OBDII communication is slow. Fastest I was able to retreive the data was around 300ms/sample. To compute MPG HP and Torque, the least information I needed was MAF, VSS, and RPM. Each data can be sampled every 900ms with current implementation. I tried 200ms/sample but this failed in long run. Maybe 250ms/sample will work... I just haven't tried yet.

To work around this limitation I had to create the fake data(interpolation) to fill in the middle. The sampled data looked kind of like this in time (ms)..

0____300____600____900___1200___1500___1800___2100 ___2400___2700___3000

RPM________________RPM_________________RPM________ __________RPM________

_____VSS_________________VSS__________________VSS_ _________________VSS

____________MAF_________________MAF_______________ ___MAF_______________

Computations like MPG requires more than one parameter and it expects instantaneous values rather than delayed value. Also the fact that 300ms is quite a bit of time when it comes to accuracy of the computation (even worse when calculating HP since it requires difference of speed which is 900ms delay) forced me into doing some interpolations.

So I worked on interpolation for a while. The attached code will collect each data in a size 8 circular FIFO. Using those 8 values interpolated values are filled in with 0.1 second resolution.

One method I used for interpolation was using low pass filter to filter out the high frequency data (or non existing data). This generates awesome graphs, with smooth transitions. However, there was a limit for this too where data has to be band limited.... but alot of time people drive in very linear form (crusing at similar speeds... very linear which is outside of band low pass filter can be designed...). I tried this for weeks and didn't get satisfying result. Acceleration and breaking generated with low pass filter implementation worked out great, but any other times it introduced alot of ringing effects that threw off the computations.

So I tried to use above method with piecewise linear interpolation. Anytime low pass filter is outside of two points from previous point to rest of the interpolation points to be linear line increment and decrementing constantly. However this still had quite a bit of errors in computations.... showing something like 1000HP... yay!!

In the end I gave a simple piecewise linear interpolation a chance. Although the graphs didn't look so great, the calculations were surprisingly close to expected values. My WRX usually does 21 MPG and Max HPs are around 200s. I saw around 23 MPG for average value and 215 for my HP when I floored. There are some errors but I figured this is close enough for what I wanted.

Maybe later I will try to add Best 0 to 60 time...

I was able to hack the rr source code and display the Instant MPG, Average MPG, Instant Horse Power, and Instant Torque in numeric values. However due to lack of time and lack of artistic talent I only tried very few. I thought many talented people in this forum can make this look much nicer.. =)

Here are some global values I defined for this. I made it programmable from rr.ini... but depends on how you implement this.

obdiitimer : Interval between each data sample in milliseconds (e.g 300)

obdiisamples : # of samples (e.g for now it needs to be 3, RPM, VSS, MAF)

obdiiport : COMM port number for OBDII device.

obdiimode : Interpolation method (0 for low pass filter with piecewise linear interpolation and 1 for pure linear interpolation. 1 is recommened.)

obdiiweight : Your vehicle weight in pound. (I used car spec's weight + driver's weight + gas weight (tank size in gallons * 6.15 * some constant).)

obdiivolume : Uses OBD VSS value instead of GPS speed value for speed attenuated volume control.

For now I will attach the OBDII code only. Guino do you think this will be worth while to put it in to your code? I guess I can try to diff the codes. I will think of something. My code changes include OBDII integration, "Gain" speed attenuated volume control tweak, and inipath hack. Pick and choose what you like. =)

I hope someone will find this useful.

Regards

The limitations were the fact that OBDII communication is slow. Fastest I was able to retreive the data was around 300ms/sample. To compute MPG HP and Torque, the least information I needed was MAF, VSS, and RPM. Each data can be sampled every 900ms with current implementation. I tried 200ms/sample but this failed in long run. Maybe 250ms/sample will work... I just haven't tried yet.

To work around this limitation I had to create the fake data(interpolation) to fill in the middle. The sampled data looked kind of like this in time (ms)..

0____300____600____900___1200___1500___1800___2100 ___2400___2700___3000

RPM________________RPM_________________RPM________ __________RPM________

_____VSS_________________VSS__________________VSS_ _________________VSS

____________MAF_________________MAF_______________ ___MAF_______________

Computations like MPG requires more than one parameter and it expects instantaneous values rather than delayed value. Also the fact that 300ms is quite a bit of time when it comes to accuracy of the computation (even worse when calculating HP since it requires difference of speed which is 900ms delay) forced me into doing some interpolations.

So I worked on interpolation for a while. The attached code will collect each data in a size 8 circular FIFO. Using those 8 values interpolated values are filled in with 0.1 second resolution.

One method I used for interpolation was using low pass filter to filter out the high frequency data (or non existing data). This generates awesome graphs, with smooth transitions. However, there was a limit for this too where data has to be band limited.... but alot of time people drive in very linear form (crusing at similar speeds... very linear which is outside of band low pass filter can be designed...). I tried this for weeks and didn't get satisfying result. Acceleration and breaking generated with low pass filter implementation worked out great, but any other times it introduced alot of ringing effects that threw off the computations.

So I tried to use above method with piecewise linear interpolation. Anytime low pass filter is outside of two points from previous point to rest of the interpolation points to be linear line increment and decrementing constantly. However this still had quite a bit of errors in computations.... showing something like 1000HP... yay!!

In the end I gave a simple piecewise linear interpolation a chance. Although the graphs didn't look so great, the calculations were surprisingly close to expected values. My WRX usually does 21 MPG and Max HPs are around 200s. I saw around 23 MPG for average value and 215 for my HP when I floored. There are some errors but I figured this is close enough for what I wanted.

Maybe later I will try to add Best 0 to 60 time...

I was able to hack the rr source code and display the Instant MPG, Average MPG, Instant Horse Power, and Instant Torque in numeric values. However due to lack of time and lack of artistic talent I only tried very few. I thought many talented people in this forum can make this look much nicer.. =)

Here are some global values I defined for this. I made it programmable from rr.ini... but depends on how you implement this.

obdiitimer : Interval between each data sample in milliseconds (e.g 300)

obdiisamples : # of samples (e.g for now it needs to be 3, RPM, VSS, MAF)

obdiiport : COMM port number for OBDII device.

obdiimode : Interpolation method (0 for low pass filter with piecewise linear interpolation and 1 for pure linear interpolation. 1 is recommened.)

obdiiweight : Your vehicle weight in pound. (I used car spec's weight + driver's weight + gas weight (tank size in gallons * 6.15 * some constant).)

obdiivolume : Uses OBD VSS value instead of GPS speed value for speed attenuated volume control.

For now I will attach the OBDII code only. Guino do you think this will be worth while to put it in to your code? I guess I can try to diff the codes. I will think of something. My code changes include OBDII integration, "Gain" speed attenuated volume control tweak, and inipath hack. Pick and choose what you like. =)

I hope someone will find this useful.

Regards

## Comment