how-to: airflow rate in gm/s or lb/min and mpg
#1
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" />
------
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.
#5
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.
Trending Topics
#9
Evolved Member
Join Date: Mar 2008
Location: Lattitude 48.38°, Longitude 17.58°, Altitude 146m = Slovakia, for common dude
Posts: 730
Likes: 0
Received 2 Likes
on
2 Posts
Heh, ok, keep me updated.
Is there any chance we can get to SAE 1979 spec? I mean besides buying it?
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.
#15
Evolved Member
iTrader: (2)
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