MAF transfer function from injectior duty and AFM.

It's all about the code!
Post Reply
spags
contributor
contributor
Posts: 136
Joined: Mon Oct 13, 2014 1:04 am

MAF transfer function from injectior duty and AFM.

Post by spags »

Hi everybody,

I've been trying to reverse engineer the transfer function for the MAF in my car. I got some curves from a forum but these look wrong.
I'm posting this here because it should benefit any car with a single MAF and I'm looking for feedback, would it work?, if not why not and how to fix it.

The idea is get the engine running with a known quantity of fuel, at a stable AFR, on a series of different RPM points. From the injector flow rate and the duty cycle we can know how much fuel is going into the engine per unit of time. With the AFR we can turn that into air mass. Once we have air mass and MAF voltage we can calculate voltage per mass flow. Doing this at different rpm points should give us enough data for a curve.

We can go one step further. If we know engine displacement, we can calculate VE by getting the ratio of ideal air flow to calculated air flow.

I realize there is a lot of "slack" with this approach. But with consistent results from run to run the resulting curve should be good enough to tune from. I hope to get some experimental data tomorrow and write a program to calculate this from the logs.
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: MAF transfer function from injectior duty and AFM.

Post by AndreyB »

Different idea, maybe more precise maybe not:

duct-tape an extra MAF with a known transfer function: 0280218037 or 0280218004 from aliexpress.com for about $30 shipped. Transfer functions available @ http://rusefi.com/forum/viewtopic.php?f=8&t=792 will be hard-coded into rusEfi pretty soon.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
spags
contributor
contributor
Posts: 136
Joined: Mon Oct 13, 2014 1:04 am

Re: MAF transfer function from injectior duty and AFM.

Post by spags »

Ok, I can read this statement two ways:

- Just swap the MAF. Tickles my OCD the wrong way. No worky, not reliably anyways. MAF's are very sensitive to intake changes (the reason most tuners just go to SD and ditch the intake). Having mismatched diameters (miata maf's have two different diameters on ether end) joined by duct tape is too much change in my opinion.

- Add an extra known maf to the intake tract and use that one to calibrate the other one. Would be kickass if i had the time and disposition, way too much work, have a stock intake and am not willing to cut it up. Won't fit otherwise.

For my particular case. I have a factory curve from the ecu and a experimental one from a forum post (which according to my data, looks wrong). The factory curve needs to be scaled properly, since i got it from a ROM dump I have the table but no example of the values that the factory ecu sees and what they translate to.

If i get a few points I should be able to fit the curve to the data and get 80 points of glorious factory correctish data. And the approach should be generic enough to be used reverse engineer any MAF if they have a WBO and the car runs with some degree of accuracy. Hell, on cars with electronic throttles this could be automated by the ECU assuming the approach works well enough. And every MAF I've seen matches an exponential function, all we need to figure out is enough points to calibrate that function.

I'm trying to narrow down and minimize the sources of slop (error) with this process. Right now, i see these factors. I'm half asleep and a little drunk. So i'm missing things, feel free to add to this list.
- Inaccuracy of the injector control, I think we are ok here, the firmware is accurate enough for this but some gentle reassuring words from Andrey would be good on this subject. :lol:
- How much of the fuel does not go into the chamber right away. This should be mitigated by sampling for a longer time at a set rpm. That fuel will have to go in sooner or later and when it does it should do it in a steady fashion.
- Wideband sensor error, should be between .2 to .5 as a high value. Not sure what this would translate to in mass air flow numbers. Multiple runs should get us in the center of this range assuming error goes both ways.
- Mechanical out of spec things. Lower than normal fuel pressure, clogged injectors, shit like that. I have a new pump and my injectors should be clean.
- Warming up during the process leading to inconsistent air densities across measurements, so do it on a warm engine.
- Bad fuel, be sure to have a good tank?

A first implementation should be simple enough to write as a script that takes a log and computes the points, can't take more than a few hours to write and see if there is any promise with this approach
.
User avatar
abecedarian
Posts: 386
Joined: Fri Nov 15, 2013 10:49 am

Re: MAF transfer function from injectior duty and AFM.

Post by abecedarian »

... every MAF I've seen matches an exponential function....
Does that apply to both types of MAF sensors... frequency and current?
You can lead the horticulture but you can't make them think.
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: MAF transfer function from injectior duty and AFM.

Post by kb1gtt »

Sources of potential error to add to the list

-- We are at aprox 20% O2 in our atmosphere, but that varies, so your O2 in air ratio. The fuel predicts the number of O2's, which needs to use the O2/air ratio to get the sensor flow. I understand part of japan and china can get as low as 7% O2, and some other areas can get up to 25% O2.
-- MAF is typically temperature specific, make sure you get the thermistor reading from the MAF or at least a measure of the ambient temp.
-- Your fuel will vary, especially if you use low octane. High octane like 91 or better 93 is a more consistent fuel. AKA if they have an excess in 91 or 93 production, they can mix it in the low octane. But they can't go the other way. The octane rating is a minimum rating.
-- Your electrical circuit can account for the differences from the ROM vs forum measured. What is your electrical circuit and how does it compare with the oem? You will probably be best off if you measure the final system, instead of using the ROM file.
Welcome to the friendlier side of internet crazy :)
spags
contributor
contributor
Posts: 136
Joined: Mon Oct 13, 2014 1:04 am

Re: MAF transfer function from injectior duty and AFM.

Post by spags »

Thanks for the input.
abecedarian wrote:Does that apply to both types of MAF sensors... frequency and current?
No idea, only seen hot wire analog signal transfer functions, but I understand the exponential nature of the output is due to the resistance/temperature curve on the hot wire material. Do you have any published transfer functions from a frequency signal MAF you could point me to?
kb1gtt wrote: -- We are at aprox 20% O2 in our atmosphere, but that varies, so your O2 in air ratio. The fuel predicts the number of O2's, which needs to use the O2/air ratio to get the sensor flow. I understand part of japan and china can get as low as 7% O2, and some other areas can get up to 25% O2.
Had not though of this. I'm sticking to 20%, Happen to live in the rural part of a tropical island, close to the coast, I'm assuming the lack of oxigen and large neutral mixing area (atlantic ocean) will keep the o2 level average ish. It's going to have to be one of those assumptions I have to make. :(
kb1gtt wrote: -- MAF is typically temperature specific, make sure you get the thermistor reading from the MAF or at least a measure of the ambient temp.
Yep, making sure the sensor is heat soaked will reduce variance. As long as we are consistent we can apply correction factors. I know pressure is going to change with different speeds and that will mess with the correction as well. Flexing my noggin on that one. :?
kb1gtt wrote: -- Your fuel will vary, especially if you use low octane. High octane like 91 or better 93 is a more consistent fuel. AKA if they have an excess in 91 or 93 production, they can mix it in the low octane. But they can't go the other way. The octane rating is a minimum rating.
I agree, the slower flame flame propagation from the higher octane should not be a problem here, we are not tuning ignition, just for the right AFR so it should not skew the results.
kb1gtt wrote: -- Your electrical circuit can account for the differences from the ROM vs forum measured. What is your electrical circuit and how does it compare with the oem? You will probably be best off if you measure the final system, instead of using the ROM file.
Agreed, if the experimental data can't be made to fit the rom curve, then I'm chucking it and keeping the experimental data. But the idea is to scale the rom curve to fit the data, so we have a "verified" manufacturer curve.
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: MAF transfer function from injectior duty and AFM.

Post by AndreyB »

spags wrote:- Add an extra known maf to the intake tract and use that one to calibrate the other one. Would be kickass if i had the time and disposition, way too much work, have a stock intake and am not willing to cut it up. Won't fit otherwise.
I was vague indeed, I was suggesting using a known MAF to calibrate the stock MAF. Yes, time consuming to set everything up - but usually no cutting required if you remove the air filter box usually you get a round pipe.

I am surprised no one has put that Miata MAF on an air flow bench - do not tuners use these and have these devices? If tuners use and have air flow benches that's what we need. Maybe the data is somewhere maybe it's worth asking a question on the Miata forums?

Funny fact: Festiva people have just tried to test Festiva MAF on a bench (the vane door type) - the bench was too powerful, the vane door was always wide open.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: MAF transfer function from injectior duty and AFM.

Post by kb1gtt »

Also, don't forget that flame front speed will cause the O2 to burn with Nitrogen, which will through off the O2 to air ratio.

About the %02, don't forget humidity will also displace 02's and change the % of O2 in the air. I think there might be a web page where you can get a feel for the how much O2 you can expect. I seem to recall a kind of map that showed several different measured points. I seem to recall such a map can be found with semi live data.

About pressure, that's less important. Your MAF will typically have a thermistor in it, which has a very low thermal mass, so it stabilizes with the intake are in a matter of seconds.
Welcome to the friendlier side of internet crazy :)
Tomin
Posts: 39
Joined: Fri Oct 18, 2013 8:03 pm

Re: MAF transfer function from injectior duty and AFM.

Post by Tomin »

russian wrote:...known transfer function .... from aliexpress.com for about $30 shipped.
I doubt in exactness on it. I saw some cars with cheap chinese MAFs and theirs fuel corrections numbers were huge (out of max. 25%) !
(MIL control follow this situation...)
Some scrapyard as source would be a better source.
Tomas
User avatar
abecedarian
Posts: 386
Joined: Fri Nov 15, 2013 10:49 am

Re: MAF transfer function from injectior duty and AFM.

Post by abecedarian »

@spags - sorry, I do not have any information for freq out MAF sensors.


Not sure if it's been mentioned or considered, but even if you get raw transfer data, or frequency information, from a flow bench, that information is only valid on THAT flow bench. A change in duct shape or a bend, no matter how subtle, can create reversion which affects the sensor reading without actually affecting the net air flow.
You can lead the horticulture but you can't make them think.
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: MAF transfer function from injectior duty and AFM.

Post by AndreyB »

Tomin wrote:
russian wrote:...known transfer function .... from aliexpress.com for about $30 shipped.
I doubt in exactness on it. I saw some cars with cheap chinese MAFs and theirs fuel corrections numbers were huge (out of max. 25%)
Some scrapyard as source would be a better source.
That's a good point. (sorry @ for pulling the thread in the wrong direction)
Do you know if any US-available MAFs have full specs published? The ones I have info for are non US vehicles so no US junk yards.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
spags
contributor
contributor
Posts: 136
Joined: Mon Oct 13, 2014 1:04 am

Re: MAF transfer function from injectior duty and AFM.

Post by spags »

russian wrote: I am surprised no one has put that Miata MAF on an air flow bench - do not tuners use these and have these devices? If tuners use and have air flow benches that's what we need. Maybe the data is somewhere maybe it's worth asking a question on the Miata forums?
Yeah, I've searched and asked, everybody goes sd, it works well enough and easy to do so nobody has done this. I did get one data set from m.net

At some point in the future it would be awesome to set up a flow bench, not just for maf calibration but for headwork. Not in the cards right now :(
abecedarian wrote: Not sure if it's been mentioned or considered, but even if you get raw transfer data, or frequency information, from a flow bench, that information is only valid on THAT flow bench. A change in duct shape or a bend, no matter how subtle, can create reversion which affects the sensor reading without actually affecting the net air flow.
The flow bench should have been calibrated with something else, a simple manometer and some math is enought to make sure things line up. The problem is building the thing.
kb1gtt wrote:Also, don't forget that flame front speed will cause the O2 to burn with Nitrogen, which will through off the O2 to air ratio.

About the %02, don't forget humidity will also displace 02's and change the % of O2 in the air. I think there might be a web page where you can get a feel for the how much O2 you can expect. I seem to recall a kind of map that showed several different measured points. I seem to recall such a map can be found with semi live data.

About pressure, that's less important. Your MAF will typically have a thermistor in it, which has a very low thermal mass, so it stabilizes with the intake are in a matter of seconds.
Nitrogen burning should not affect the reading more than 5%. Testing and comparing on lower octane fuel would be a cool test if this pans out.

The thermistor sensor itself is not what needs to heatsoak, it's all the intake piping. IAT's rise and fall as the car gets driven, affecting density and throwing the math off. IAT's should be pretty constant accross the test as long as the car is not being driven and warmed up.
User avatar
abecedarian
Posts: 386
Joined: Fri Nov 15, 2013 10:49 am

Re: MAF transfer function from injectior duty and AFM.

Post by abecedarian »

spags wrote:
russian wrote:
abecedarian wrote: Not sure if it's been mentioned or considered, but even if you get raw transfer data, or frequency information, from a flow bench, that information is only valid on THAT flow bench. A change in duct shape or a bend, no matter how subtle, can create reversion which affects the sensor reading without actually affecting the net air flow.
The flow bench should have been calibrated with something else, a simple manometer and some math is enought to make sure things line up. The problem is building the thing.
The point I was making is that a flow bench with an air source "blowing" XYZ air into a meter so the meter's properties can be characterized is not the same as the meter being installed in your vehicle.

A little off topic....
The VAFM on my '91 Toyota truck is mounted on the left side of the engine bay (as viewed from the driver's seat). The duct from that pinches down in one direction and expands in another direction as it moves to the right side, where it then turns to the rear and connects to the throttle body. It all works fine as it is... ;) One modification some people make is to re-locate the VAFM so it has a more direct path to the throttle body, and this involves moving the battery over to where the air filter and VAFM were and ... and ... good times. This modification, in general, makes the engine run better: increases throttle response, seems to make things more "peppy". It also confuses the ECU causing too much fuel at some points, and not enough fuel at others. Given enough time, the ECU will learn to correct for these.

Back on topic....
Point being you can't assume the values you might get on a test bench will transfer directly to, and be immediately applicable to your vehicle unless that test bench has your entire intake tract in place EXACTLY as it sits in your vehicle.

Might be enlightening to learn about how a pitot tube works. ;)
You can lead the horticulture but you can't make them think.
spags
contributor
contributor
Posts: 136
Joined: Mon Oct 13, 2014 1:04 am

Re: MAF transfer function from injectior duty and AFM.

Post by spags »

abecedarian wrote: Back on topic....
Point being you can't assume the values you might get on a test bench will transfer directly to, and be immediately applicable to your vehicle unless that test bench has your entire intake tract in place EXACTLY as it sits in your vehicle.
Yes and no ;)
Yes I agree that testing in situ is better for our purposes because we are not going to transfer the MAF to another car. So inconsistencies introduced by un-steady flow over the MAF, age, duct tape, etc. are ok because we will have to live with them forever (unless one changes the intake and then we have a whole new set of inconsistencies).

No, from a design perspective the bench curve of the MAF should be a right and universal starting point, if the ducting design introduces inconsistencies then they should be addressed either at the ducting or at the control (what we do).
abecedarian wrote: Might be enlightening to learn about how a pitot tube works. ;)
Not sure what you mean here. If it's about how to calibrate a flow bench using a manometer, here is the underlying math http://en.wikipedia.org/wiki/Bernoulli%27s_principle
In a more concrete way you have a fixed volume (box or plenum) under fixed conditions other than pressure, turning pressure into flow rate is straight forward (as long as we assume air is in-compressible, but that's a rabbit hole i don't want to get into). This is how you can build a flow bench out of a vacuum cleaner, a box, and plastic tubing.
spags
contributor
contributor
Posts: 136
Joined: Mon Oct 13, 2014 1:04 am

Re: MAF transfer function from injectior duty and AFM.

Post by spags »

Also, Habemus data!

I ran the car at 3 rpm points, tuned to 14.5 AFR and ran if for a few seconds. Should be enough to get an idea if the approach works.
Now comes the code, sifting through all that data, and getting how much fuel is in the engine per unit of time, finding out how much air should of consumed and start correcting!

[EDIT]: Also kudos to russian, I hadn't run the engine in a couple of weeks. Every time I run it, it seems to run better.
Attachments
2015-02-14_11.54.52.msl
Car: Mazda Miata NA 94 USDM
Humidity: 66%
Altitude above sea level: 3m
Pressure: 1017 mb (close enough to 1bar)
Temperature: 29 C (not really relevant, but sure).
(1.04 MiB) Downloaded 686 times
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: MAF transfer function from injectior duty and AFM.

Post by kb1gtt »

Pitot tube is MAP not MAF.

About the flow bench, vs real world, there are variations due to turbulence. A bend or corregated tube just before or after a MAF can cause a warping. However other MAF's are designed to handle what ever come at them. The MAF device often has specification for the before and after plumbing, you need to read the datasheet for the device to know what is a problem and what is not. More modern MAF's have generally been designed to handle sharp bends and narrow plumbing before and after, which cause allot of turbulence. This is why they usually have that pile of tubes thing or honey comb section. Those tube generally remove the turbulence issues. So if you have those tubes and you don't have a datasheet, you can probably rely on flow bench data. If your MAF doesn't have thsoe tubes, it will probably be significantly altered by sources of turbulence

Also note that faster velocities get into turbulent flow instead of laminar flow. The flow rate will be a problem for any MAF, and is a key reason whey performance people use SD. So keep in mind there is a max RPM / CFM that these devices will work for.
Welcome to the friendlier side of internet crazy :)
Tomin
Posts: 39
Joined: Fri Oct 18, 2013 8:03 pm

Re: MAF transfer function from injectior duty and AFM.

Post by Tomin »

russian wrote:Do you know if any US-available MAFs have full specs published?
My friend uses this 0281002764 Bosch on DYI constructed flow bench.
PDF with charact.graphs are here
https://www.google.cz/search?q=0281002764.pdf&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:cs:official&client=firefox-beta&channel=sb&gfe_rd=cr&ei=YojfVJT1H-uk8weHooCoBw
Don't know about anything else, sorry.
Tomas
spags
contributor
contributor
Posts: 136
Joined: Mon Oct 13, 2014 1:04 am

Re: MAF transfer function from injectior duty and AFM.

Post by spags »

Ok, 1st hack, this is what I have to show for it. Next up is getting cleaner data at a wider and more dense RPM range.

EDIT: Horizontal is voltage, vertical is kg/h

Red is calculated air mass as kg/h and blue is estimated air mass based on RPM, displacement and VE, using a fixed VE of .5, which is obviously wrong at higher RPMs.


Filtered data to certain RPM's and AFR's
Filtered data to certain RPM's and AFR's
filtered.png (21.69 KiB) Viewed 20127 times
Unfiltered data, everything we got with some obvious errors.
Unfiltered data, everything we got with some obvious errors.
unfiltered.png (24.1 KiB) Viewed 20127 times
spags
contributor
contributor
Posts: 136
Joined: Mon Oct 13, 2014 1:04 am

Re: MAF transfer function from injectior duty and AFM.

Post by spags »

Ok, here is a data set I collected back in December. It's across a wider RPM range.

There are two filters applied. Green is AFR's between 14.4 and 15
Red is AFR's between 0 and 9.
good_bad_ugly.png
good_bad_ugly.png (40.83 KiB) Viewed 20127 times
I have to get a similar data-set at an even wider range to get a healthy curve.
User avatar
abecedarian
Posts: 386
Joined: Fri Nov 15, 2013 10:49 am

Re: MAF transfer function from injectior duty and AFM.

Post by abecedarian »

spags wrote:
abecedarian wrote: Back on topic....
Point being you can't assume the values you might get on a test bench will transfer directly to, and be immediately applicable to your vehicle unless that test bench has your entire intake tract in place EXACTLY as it sits in your vehicle.
Yes and no ;)
Yes I agree that testing in situ is better for our purposes because we are not going to transfer the MAF to another car. So inconsistencies introduced by un-steady flow over the MAF, age, duct tape, etc. are ok because we will have to live with them forever (unless one changes the intake and then we have a whole new set of inconsistencies).

No, from a design perspective the bench curve of the MAF should be a right and universal starting point, if the ducting design introduces inconsistencies then they should be addressed either at the ducting or at the control (what we do).
And looking at your latest images posted suggests there's inconsistencies right there, on the bench...?
abecedarian wrote: Might be enlightening to learn about how a pitot tube works. ;)
Not sure what you mean here. If it's about how to calibrate a flow bench using a manometer, here is the underlying math http://en.wikipedia.org/wiki/Bernoulli%27s_principle
In a more concrete way you have a fixed volume (box or plenum) under fixed conditions other than pressure, turning pressure into flow rate is straight forward (as long as we assume air is in-compressible, but that's a rabbit hole i don't want to get into). This is how you can build a flow bench out of a vacuum cleaner, a box, and plastic tubing.
Pitot tube, though most often used as a relative air-speed calculation aid, would allow you to measure and infer flow based on differential pressure and temperature, as a cross check against your vacuum cleaner, box, tubing and MAF.
You can lead the horticulture but you can't make them think.
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: MAF transfer function from injectior duty and AFM.

Post by kb1gtt »

@sprags, is there a picture of the setup for those graphs? I'm not sure what those are trying to tell me. Seeing the hip bone to let bone connections would help me understand the graphs.
Welcome to the friendlier side of internet crazy :)
spags
contributor
contributor
Posts: 136
Joined: Mon Oct 13, 2014 1:04 am

Re: MAF transfer function from injectior duty and AFM.

Post by spags »

abecedarian wrote:And looking at your latest images posted suggests there's inconsistencies right there, on the bench...?
I don't have a bench and I don't want to build one right now. The source of this data is from the car running, those inconsistencies right there are the reason I stand by the "a bench is always better" point. Those inconsistencies are they are due to the AFR's being off, on a bench those don't enter into the calculation, less variables, less error.
kb1gtt wrote:@sprags, is there a picture of the setup for those graphs? I'm not sure what those are trying to tell me. Seeing the hip bone to let bone connections would help me understand the graphs.
Yeah, sorry, you have a point, kinda posted in a hurry. Here follows a more coherent explanation with more coherent graphs.

These graphs are produced by a program I'm working on, and will be posted as soon as it's better documented (Hopefully later today). They show the extrapolated MAF signal to o2 flow though the engine using an msl log as the data source, and some engine parameters. Particularly data from the injectors and the AFR sensor. It currently applies no environmental corrections.

This particular graph shows how the results can be skewed by an engine running rich. Otherwise I'm very happy with the definition of the curve, this particular data-set is back from December, a newer one with similar density and larger range has to be produced. Note that I'm only filtering by AFR and there is still a lot of noise in there.
Legends and labels added
Legends and labels added
good_bad_ugly.png (66.77 KiB) Viewed 20217 times

EDIT: Fixed swaped axes on labels.
spags
contributor
contributor
Posts: 136
Joined: Mon Oct 13, 2014 1:04 am

Re: MAF transfer function from injectior duty and AFM.

Post by spags »

Ok, more progress.
- I modified the program to feed on many logs so I can fill in the blanks of the parts i'm missing.
- I added a curve fitting function that exports the transfer function into a csv.
- Documented and cleaned the code enough to be able to publish it.

What remains to be done.
- Extrapolate all the way to 5 volts.
- Confirm this, if somebody out there can generate some .msl logs with a known MAF sensor (one of the bosch ones that have published transfer functions). The more data the better.
- Add this data to a patch and submit it for commit.

Here is a shot of data from 5 different runs and the final fitted data.
Aggregated and fitted to power law function.
Aggregated and fitted to power law function.
aggregated_and_fitted.png (99.65 KiB) Viewed 20205 times
I've also attached a csv dump of the processed data, along with the current version of the script.
Attachments
munch.py
Script that generates this.
(4.12 KiB) Downloaded 701 times
out.csv
CSV dump of the fitted data
(6.99 KiB) Downloaded 701 times
spags
contributor
contributor
Posts: 136
Joined: Mon Oct 13, 2014 1:04 am

Re: MAF transfer function from injectior duty and AFM.

Post by spags »

Ok, update.
Progress
- Run the function all the way to 5 volts.
- Scaled from o2 mass to air mass (what the MAF actually sees). Errors be here.
- Script now generates c code for pasting into a maf transfer function for the firmware.

Remaining
- Validation using known MAF logs.
- Test this sucker on a real car.
- Once this is running get more log data at wider range to further fit the data.

Now for the money shot:
end_product.png
end_product.png (55.3 KiB) Viewed 20189 times
EDIT: Updated image with correct units.
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: MAF transfer function from injectior duty and AFM.

Post by kb1gtt »

What's the expected kG/Hr at idle, and at full RPM? AKA what at the expected min and max you'll see on that chart?

Also don't forget that as the flow rate exceeds the sensors ability, it will create turbulence, which will cause the sensor to fail to get to the 5V limit. At faster RPM / faster flow rates it won't follow that nice curve, but will start to level off.
Welcome to the friendlier side of internet crazy :)
spags
contributor
contributor
Posts: 136
Joined: Mon Oct 13, 2014 1:04 am

Re: MAF transfer function from injectior duty and AFM.

Post by spags »

kb1gtt wrote:What's the expected kG/Hr at idle, and at full RPM? AKA what at the expected min and max you'll see on that chart?
Those numbers are going to depend on the VE of the engine at that RPM and load value. I did a comparasion on this in this post http://rusefi.com/forum/viewtopic.php?f=5&t=825&start=10#p14256 I was using a VE of 0.5 and those are three spots correspond to 1200, 1800 and 2200 RPM. The red is calculated o2 mass as kg/h and blue is estimated air mass based on RPM and VE. You see how the fixed 0.5 VE falls short at higher RPM's (as it should), a better guess would be around .7 in those areas, going up until peak VE (and torque) is reached.
kb1gtt wrote: Also don't forget that as the flow rate exceeds the sensors ability, it will create turbulence, which will cause the sensor to fail to get to the 5V limit. At faster RPM / faster flow rates it won't follow that nice curve, but will start to level off.
Yeah I expected that too, I haven't seen data yet leading to that so It's not in the model yet. I am curious to see what happens when I take this to higher RPM's.

One thing though, the curve on the ECU ROM is shaped just like this one I came up with and there is no leveling off at higher RPM's. In fact for shits and giggles i decided to scale the ROM curve so it fits into the same range. After playing with the scaling (i ended up using .18 of the value in the ROM). This is what I got.
Screenshot_2015-02-16_12-34-08.png
Screenshot_2015-02-16_12-34-08.png (21.37 KiB) Viewed 20182 times
I've attached the spreadsheet, it's kind of a mess.
Attachments
maf_adjustment.ods
(38.72 KiB) Downloaded 504 times
Post Reply