Notices
ECU Flash

how-to: airflow rate in gm/s or lb/min and mpg

Thread Tools
 
Search this Thread
 
Old Oct 14, 2008 | 10:07 PM
  #1  
mrfred's Avatar
Thread Starter
EvoM Guru
iTrader: (50)
 
Joined: Mar 2006
Posts: 9,675
Likes: 132
From: Tri-Cities, WA // Portland, OR
how-to: airflow rate in gm/s or lb/min and mpg

Introduction

I recently decided it would be kinda nice to be able to log airflow rate in gm/s or lb/min so that it would be possible to log mpg. There is an algorithm for OBD-II diagnostics (recently found by acamus) that calculates temperature and baro corrected airflow rate in gm/s. I was hoping that we could log this value with EvoScan, but there was no easy way to log it with EvoScan. I checked around in the code and found that its calculated in several other places, but the algorithms are not in the main loop, so the ECU performs the calculations very infrequently. That left the final alternative of writing a patch which I just finished and tested this afternoon. Its working perfectly for my 88590015 ROM. Don't know when I'll get around to porting it to other ROMs, but at least its available for the 88590015. This patch is compatible with all tephra 88590015 ROMs.

The output from the algorithm is a 2-byte airflow rate and also a 1-byte airflow rate. I've only logged the 2-byte value as it will be much more precise than the 1-byte value.

After the patch is applied, the following items can be logged:

airflow rate in gm/s
airflow rate in lb/min
mileage in mpg for either gasoline or E85

I can't say anything about the accuracy of the airflow rate except that it exactly matches the value produced for OBD-II diagnostics. I can say, however, that my initial mpg logs are damn close to what I expected for my overall mileage. It should be very handy for fine tuning daily driver performance and optimizing driving technique for mileage.

Instructions

There are three basic steps:

1) Copy some definitions to your ECUFlash 88590015.xml file. The definitions are below.
2) Launch ECUFlash and copy table data from a base ROM to your ROM. The base ROM can be downloaded here.
3) Add some entries to your EvoScan Data.xml file. The entries are below. Add the entries that you prefer. Note that to log mpg, both "speed" and "AFRMAP" need to be logged as well. Its also possible to get mpg using wideband AFR data as well. This would be the preferred method for open loop conditions, but it will bounce all over the place during closed loop cruise because of closed loop feedback. If you want to use wideband AFR data instead of AFRMAP, then replace "AFRMAP" in the mpg definition with whatever LogReference value you have for your wideband data definition.


Entries to add to your ECUFlash "88590015.xml" file

------ (Don't copy the "-------")

<table name="Airflow Rate Calc On/Off" category="Airflow Rate Meas" address="873E" type="1D" level="1" scaling="uint8"/>

<table name="MUT46 (Read 2-byte airflow rate high byte)" category="Airflow Rate Meas" address="3ef9e" type="1D" level="1" scaling="Hex16"/>
<table name="MUT47 (Read 2-byte airflow rate low byte)" category="Airflow Rate Meas" address="3efa2" type="1D" level="1" scaling="Hex16"/>

<table name="MUT48 (Read 1-byte airflow rate)" category="Airflow Rate Meas" address="3efa6" type="1D" level="1" scaling="Hex16"/>

<table name="0x80 for Airflow Rate" category="Airflow Rate Meas" address="8744" type="1D" level="1" scaling="uint16"/>


<table name="Airflow Rate Patch ROM Addr" category="Airflow Rate Meas" address="1780c" type="3D" level="1" scaling="Hex16">
<table name="Code" type="Static X Axis" elements="1" scaling="Hex16">
<data>Hex16</data>
</table>
<table name="Address" type="Static Y Axis" elements="2">
<data>1780C</data>
<data>1780E</data>
</table>
</table>


<table name="Airflow Rate Patch Part 1" category="Airflow Rate Meas" address="47e80" type="3D" level="1" scaling="Hex16">
<table name="Code" type="Static X Axis" elements="1" scaling="Hex16">
<data>Hex16</data>
</table>
<table name="Address" type="Static Y Axis" elements="40">
<data>47E80</data>
<data>47E82</data>
<data>47E84</data>
<data>47E86</data>
<data>47E88</data>
<data>47E8A</data>
<data>47E8C</data>
<data>47E8E</data>
<data>47E90</data>
<data>47E92</data>
<data>47E94</data>
<data>47E96</data>
<data>47E98</data>
<data>47E9A</data>
<data>47E9C</data>
<data>47E9E</data>
<data>47EA0</data>
<data>47EA2</data>
<data>47EA4</data>
<data>47EA6</data>
<data>47EA8</data>
<data>47EAA</data>
<data>47EAC</data>
<data>47EAE</data>
<data>47EB0</data>
<data>47EB2</data>
<data>47EB4</data>
<data>47EB6</data>
<data>47EB8</data>
<data>47EBA</data>
<data>47EBC</data>
<data>47EBE</data>
<data>47EC0</data>
<data>47EC2</data>
<data>47EC4</data>
<data>47EC6</data>
<data>47EC8</data>
<data>47ECA</data>
<data>47ECC</data>
<data>47ECE</data>
</table>
</table>


<table name="Airflow Rate Patch Part 2" category="Airflow Rate Meas" address="47ed0" type="3D" level="1" scaling="Hex16">
<table name="Code" type="Static X Axis" elements="1">
<data>Hex16</data>
</table>
<table name="Address" type="Static Y Axis" elements="24">
<data>47ED0</data>
<data>47ED2</data>
<data>47ED4</data>
<data>47ED6</data>
<data>47ED8</data>
<data>47EDA</data>
<data>47EDC</data>
<data>47EDE</data>
<data>47EE0</data>
<data>47EE2</data>
<data>47EE4</data>
<data>47EE6</data>
<data>47EE8</data>
<data>47EEA</data>
<data>47EEC</data>
<data>47EEE</data>
<data>47EF0</data>
<data>47EF2</data>
<data>47EF4</data>
<data>47EF6</data>
<data>47EF8</data>
<data>47EFA</data>
<data>47EFC</data>
<data>47EFE</data>
</table>
</table>

-------


Definitions to add to your EvoScan "Data.xml" file

If you want to log in lb/min, use these definitions:

------ (Don't copy the "-------")

<DataListItem DataLog="N" Color="" Display="Airflow Rate lb/min" LogReference="lbamin" RequestID="46" RequestID2="47" Eval="0.00312*x" Unit="lb/min" MetricEval="" MetricUnit="" ResponseBytes="1" GaugeMin="0" GaugeMax="10000" ChartMin="0" ChartMax="10000" ScalingFactor="1" Notes="" Priority="1" Visible="False" />
<DataListItem DataLog="N" Color="" Display="Mileage Gasoline" LogReference="mpg" RequestID="CALC" Eval="5.9*[Speed]*[AFRMAP]/[lbamin]" Unit="mpg" MetricEval="" MetricUnit="" ResponseBytes="1" GaugeMin="0" GaugeMax="10000" ChartMin="0" ChartMax="10000" ScalingFactor="1" Notes="" Priority="1" Visible="False" />
<DataListItem DataLog="N" Color="" Display="Mileage E85" LogReference="mpge" RequestID="CALC" Eval="4.18*[Speed]*[AFRMAP]/[lbamin]" Unit="mpg" MetricEval="" MetricUnit="" ResponseBytes="1" GaugeMin="0" GaugeMax="10000" ChartMin="0" ChartMax="10000" ScalingFactor="1" Notes="" Priority="1" Visible="False" />

------

If you want to log in gm/s, use these definitions:

------ (Don't copy the "-------")

<DataListItem DataLog="N" Color="" Display="Airflow Rate gm/s" LogReference="gmas" RequestID="46" RequestID2="47" Eval="0.0236*x" Unit="gm/s" MetricEval="" MetricUnit="" ResponseBytes="1" GaugeMin="0" GaugeMax="10000" ChartMin="0" ChartMax="10000" ScalingFactor="1" Notes="" Priority="1" Visible="False" />
<DataListItem DataLog="N" Color="" Display="Mileage Gasoline" LogReference="mpg" RequestID="CALC" Eval="0.78*[Speed]*[AFRMAP]/[gmas]" Unit="mpg" MetricEval="" MetricUnit="" ResponseBytes="1" GaugeMin="0" GaugeMax="10000" ChartMin="0" ChartMax="10000" ScalingFactor="1" Notes="" Priority="1" Visible="False" />
<DataListItem DataLog="N" Color="" Display="Mileage E85" LogReference="mpge" RequestID="CALC" Eval="0.552*[Speed]*[AFRMAP]/[gmas]" Unit="mpg" MetricEval="" MetricUnit="" ResponseBytes="1" GaugeMin="0" GaugeMax="10000" ChartMin="0" ChartMax="10000" ScalingFactor="1" Notes="" Priority="1" Visible="False" />

------

Last edited by mrfred; Oct 14, 2008 at 10:22 PM.
Reply
Old Oct 14, 2008 | 10:10 PM
  #2  
mrfred's Avatar
Thread Starter
EvoM Guru
iTrader: (50)
 
Joined: Mar 2006
Posts: 9,675
Likes: 132
From: Tri-Cities, WA // Portland, OR
Here's a road dyno log showing airflow rate in lb/min along with whp, torque, boost, and AFR.

Attached Thumbnails how-to: airflow rate in gm/s or lb/min and mpg-airflowrate_evo9.gif  
Reply
Old Oct 14, 2008 | 10:12 PM
  #3  
mchuang's Avatar
Evolved Member
iTrader: (11)
 
Joined: Sep 2005
Posts: 2,180
Likes: 1
From: h town
Wow nice, some people are too dam smart :P
Reply
Old Oct 14, 2008 | 10:24 PM
  #4  
tephra's Avatar
EvoM Guru
15 Year Member
iTrader: (6)
 
Joined: Feb 2007
Posts: 9,486
Likes: 67
From: Melbourne, Australia
good on ya - I was just trying to work out how to convert Hz to lb/min as well
Reply
Old Oct 14, 2008 | 10:35 PM
  #5  
mrfred's Avatar
Thread Starter
EvoM Guru
iTrader: (50)
 
Joined: Mar 2006
Posts: 9,675
Likes: 132
From: Tri-Cities, WA // Portland, OR
Originally Posted by tephra
good on ya - I was just trying to work out how to convert Hz to lb/min as well
Working out the details was a bit more of a PITA than I though it would be considering how simple the calc is. Calc from the OBD-II subroutine is below. My calc is a bit quicker as I avoid using long division. You are welcome to add it to your next tephra ROM series if you want.

Code:
ROM:0003AA34                 mov.l   @(h'D4,pc), r10 ; [0003AB0C] = unk_FFFF6C74 ; airflow per Hz
ROM:0003AA36                 mov.w   @r10, r10
ROM:0003AA38                 extu.w  r10, r10
ROM:0003AA3A                 mov     #h'76, r11 ; 'v' ; 0x76, #118 -> r11
ROM:0003AA3C                 mulu    r10, r11
ROM:0003AA3E                 sts     macl, r2        ; airflowrate*#118 -> r2
ROM:0003AA40                 mov.l   @(h'C4,pc), r10 ; [0003AB08] = unk_FFFF6C7E ; 0.625*baroADC
ROM:0003AA42                 mov.w   @r10, r10
ROM:0003AA44                 extu.w  r10, r10
ROM:0003AA46                 mov.l   @(h'BC,pc), r11 ; [0003AB04] = unk_FFFF6C7C ; air temp compensation
ROM:0003AA48                 mov.w   @r11, r11
ROM:0003AA4A                 extu.w  r11, r11
ROM:0003AA4C                 mulu    r10, r11
ROM:0003AA4E                 sts     macl, r12       ; 0.625*baroADC*airtempcomp -> r12
ROM:0003AA50                 mov.l   @(h'AC,pc), r4 ; [0003AB00] = unk_FFFF6B9E ; 2-byte MAF Hz
ROM:0003AA52                 mov.w   @r4, r4
ROM:0003AA54                 extu.w  r4, r4
ROM:0003AA56                 mov     r12, r5         ; 0.625*baroADC*airtempcomp -> r5
ROM:0003AA58                 mov.l   @(h'A0,pc), r10 ; [0003AAFC] = sub_EEE
ROM:0003AA5A                 jsr     @r10 ; sub_EEE  ; r4 * r5 -> r0
ROM:0003AA5C                 nop
ROM:0003AA5E                 mov     r0, r4          ; MAFHz*0.625*baroADC*airtempcomp -> r4
ROM:0003AA60                 mov     r2, r5          ; airflowrate*#118 -> r5
ROM:0003AA62                 mov.w   @(h'56,pc), r6 ; [0003AABC] = h'1900 ; #6400
ROM:0003AA64                 mov.l   @(h'90,pc), r10 ; [0003AAF8] = sub_5E8
ROM:0003AA66                 jsr     @r10 ; sub_5E8  ; r4*r5/r6 -> r0
ROM:0003AA68                 nop
ROM:0003AA6A                 mov     r0, r4          ; airflowrate*#118*MAFHz*0.625*baroADC*airtempcomp/#6400 -> r4
ROM:0003AA6C                 mov.l   @(h'84,pc), r10 ; [0003AAF4] = sub_86A
ROM:0003AA6E                 jsr     @r10 ; sub_86A  ; shlr16 r4 -> r0, i.e., r4/65536 -> r0
ROM:0003AA6E                                         ; (shift right 16 bits [1 word])
ROM:0003AA70                 nop
ROM:0003AA72                 extu.w  r0, r1          ; airflowrate*#118*MAFHz*0.625*baroADC*airtempcomp/(#6400*#65536) -> r4
ROM:0003AA72                                         ; 1.758e-07*airflowrate*MAFHz*baroADC*airtempcomp -> r4

Last edited by mrfred; Oct 15, 2008 at 06:51 AM.
Reply
Old Oct 15, 2008 | 04:21 AM
  #6  
acamus's Avatar
Evolved Member
 
Joined: Mar 2008
Posts: 730
Likes: 3
From: Lattitude 48.38°, Longitude 17.58°, Altitude 146m = Slovakia, for common dude
mrfred, Thank you for the credit.
So it seems you actually have got time to look at OBDII part.
What about mode 6 tid 7?
Reply
Old Oct 15, 2008 | 06:22 AM
  #7  
l2r99gst's Avatar
Evolved Member
iTrader: (2)
 
Joined: Mar 2004
Posts: 3,499
Likes: 4
From: CA
Awesome. When I get some time, I will port this to 96940011. I'm a bit busy this week, so it should be next week sometime.


Eric
Reply
Old Oct 15, 2008 | 06:51 AM
  #8  
mrfred's Avatar
Thread Starter
EvoM Guru
iTrader: (50)
 
Joined: Mar 2006
Posts: 9,675
Likes: 132
From: Tri-Cities, WA // Portland, OR
Originally Posted by acamus
mrfred, Thank you for the credit.
So it seems you actually have got time to look at OBDII part.
What about mode 6 tid 7?
I'll spend the next couple weeks on that. :-)
Reply
Old Oct 15, 2008 | 09:39 AM
  #9  
acamus's Avatar
Evolved Member
 
Joined: Mar 2008
Posts: 730
Likes: 3
From: Lattitude 48.38°, Longitude 17.58°, Altitude 146m = Slovakia, for common dude
Heh, ok, keep me updated.
Is there any chance we can get to SAE 1979 spec? I mean besides buying it?

Last edited by acamus; Oct 15, 2008 at 09:43 AM.
Reply
Old Oct 15, 2008 | 01:34 PM
  #10  
dudical26's Avatar
Evolved Member
iTrader: (17)
 
Joined: Nov 2005
Posts: 2,544
Likes: 0
From: NNJ
hmmm, this should be really helpfull for evaluting tuning changes.

I'm gonna put this on the Evo tonight and play around with it this weekend.

Thanks
Reply
Old Oct 15, 2008 | 10:34 PM
  #11  
mrfred's Avatar
Thread Starter
EvoM Guru
iTrader: (50)
 
Joined: Mar 2006
Posts: 9,675
Likes: 132
From: Tri-Cities, WA // Portland, OR
I wanted to plot pressure ratio vs airflow, so I went looking for a TD05HRA-16G6C (Evo 9) compressor map, but only could find the TD05HR-16G6 (Evo 8) compressor map. Here's where I'm at on that map:

Attached Thumbnails how-to: airflow rate in gm/s or lb/min and mpg-td05hr-16g6-lbmin_mrfred.gif  
Reply
Old Oct 15, 2008 | 10:58 PM
  #12  
tephra's Avatar
EvoM Guru
15 Year Member
iTrader: (6)
 
Joined: Feb 2007
Posts: 9,486
Likes: 67
From: Melbourne, Australia
i could never understand those comp-maps...
Reply
Old Oct 16, 2008 | 06:37 AM
  #13  
MR Turco's Avatar
EvoM Staff Alumni
iTrader: (16)
 
Joined: May 2007
Posts: 3,233
Likes: 3
From: Massachusetts
Mrfred, what is the equation for figuring out lb/min or are you using logged values?
Reply
Old Oct 16, 2008 | 06:52 AM
  #14  
mrfred's Avatar
Thread Starter
EvoM Guru
iTrader: (50)
 
Joined: Mar 2006
Posts: 9,675
Likes: 132
From: Tri-Cities, WA // Portland, OR
Originally Posted by MR Turco
Mrfred, what is the equation for figuring out lb/min or are you using logged values?
I'm logging it. The purpose of the patch is to use the ECU to calculate airflow rate. :-)
Reply
Old Oct 16, 2008 | 03:32 PM
  #15  
l2r99gst's Avatar
Evolved Member
iTrader: (2)
 
Joined: Mar 2004
Posts: 3,499
Likes: 4
From: CA
Originally Posted by mrfred
I wanted to plot pressure ratio vs airflow, so I went looking for a TD05HRA-16G6C (Evo 9) compressor map, but only could find the TD05HR-16G6 (Evo 8) compressor map. Here's where I'm at on that map:

I used to do this on my old Eclipse and the compressor map for the turbo that I had. This is very good to help with seeing where you are on your map and how efficiently you are running in regards to the compressor.

It would be nice to see someone who is maxing out a stock turbo to show how far in the inefficient areas they are and how far to the right they manage to get to.


Eric
Reply



All times are GMT -7. The time now is 03:29 AM.