PDA

View Full Version : Megasquirt tuning using narrowband and MST3K


Matt Dupuis
10-28-2004, 03:56 PM
As a result of the growing number of Megasquirters, I thought I'd relay my method of tuning one with a NB O2 sensor. For tuning with a wideband I have another method that's somewhat less automatic, but it's based on a NB tune. I actually removed my WB sensor in favour of my NB sensor and the following method, with the exception of in-boost tuning, at which point I went back to WB and filtered the resulting datalogs through an excel spreadsheet.

Also note that tuning a 12x12 table is slightly different - you can't actually export your VE table - rather I just set the rows and columns, let MST3K fill in the values, and then I'll manually copy them down on a sheet of paper (printed off a 13x13 grid on a couple dozen sheets for this occasion) and decide which ones to update. This also gives a good indication if things are only changing by 1 or 2 VE points, or more.

Anyway, here goes:

It's important to know how to get good datalogs, and that takes a little practice, but key among the settings are keeping your O2 sensor refresh rate in a decent zone, which is about 3-4 times per second. In the classic B+G code, that involves planning out an RPM range you're going to be datalogging in, calculating how many ignition events happen per second, and dividing by 3-4. I prefer to hack my code so's to get time-based refresh rates, so that it refreshes at the same rate no matter the engine RPM.

It really helps to have a good baseline. If you have a good baseline, you can leave your O2 correction % at a lower value, like 30%, otherwise if you have no idea, you'll set it to 75% or more. The further off your map is, the longer it'll take for your EGO correction to get it to stoich, which is what MST3K is looking for.

Turn off all accleration enrichments, and get used to driving it like it's going to hesitate when you step on the gas. Set your O2 sensor to 1% per step if your map is close, 2% per step if it's wildly out.

Basically over the course of a few days, I'll do maybe 200 miles on the road, datalogging the entire time. While datalogging with a NBO2, 90% of that will be under 100 kPa, with the rest no higher than 110 kPa. That's just to get an idea of the curve as it starts to get under boost. Don't make any changes to the VE table during this time, and don't change any other settings either.

Drive the car with long, slow accelerations. Basically, drive the car as smoothly as possible, with as little shifting as possible, and get as many load/rpm combinations as possible. Get as many samples of each load/rpm combination as you can as well - that'll mean lots of time in 2nd gear on a deserted highway, revving from 800 - 5000 RPM at various throttle openings. Do it again and again - at lunchtime if you're at work, in between classes if you can get to a suitably deserted road, etc.

Once you have 7 or 8 good, long, datalogs, export your VE table and open up your MST3K and check your settings. Make sure you have the O2 voltage to 0.500, set it up for two pass filtering, and leave the "deltas" or "omegas" or whatever they are alone. They matter, but it takes practice to figure out when they matter. Turn on outlier elimination. Set your rev range from 500-6500 RPM.

Open up all of your datalogs at once. If you open one at a time, it'll ask you if you want to append the map or clear it - you're appending it. Let it do it's thing, searching for crossover points and deleting outliers (points in a particular load/rpm area that are way off the average). Eventually it'll plot a colourful map on the main page.

Go to Edit - Modify Map (something like that - it's been a while) and you'll get an 8x8 table with nothing filled in, and another window beneath it. Import your VE table, and it'll fill in the 8x8. Over on the right, is a button labeled Filter Datalog. Press it and go have a smoke, take a pee, or fix a sandwich. What it's doing at this point is comparing all the points it knows, first along a fixed RPM and then along a fixed MAP, and filling in all the points it doesn't know via interpolation. Your "deltas" or "omegas" or whatever they are in Settings is what determines this curve, and if you left it on one pass filtering it would only compare along the RPM and ignore the MAP. It'll take a while, depending on your computer.

When it's done doing it's thing, in the lower window it'll plot a nice, pretty, colourful 3d VE map in the bottom window, and it'll place your table column/row centers in a grid overtop. Here's where MST3K really comes in handy - you can now see trends in the amount of fuel your engine is looking for. Intake/exhaust tuning, camshaft, port tuning, etc... all the efficiencies and inefficiencies will show up as a series of peaks and valleys. Now you must move your RPM column centers to line up with the major peaks and valleys!

Megasquirt interpolates between the centers in your VE table in straight lines. i.e., if your VE value at 70 kPa and 2000 RPM is 50, and at 70 kPa and 2500 RPM is 60, it'll draw a straight line across the two points so that when you're at 2200 RPM, your interpolated VE value is 54.

Since it does this in straight lines, both across RPM and across MAP gaps, it really helps to have your RPM columns lined up with the peaks and valleys. If you had one column on the upslope and the next column on the downslope of a given peak, the VE table would be correct at those points, but it would slice the top off the peak with a straight line between the points, and you'd be lean everywhere between your columns.

So now figure out where you want your MAP rows. There's no science to the MAP rows, but a good rule of thumb is to concentrate on where your engine is running most of the time. For example, with only 8 rows to choose from, I want maximum resolution between 60 and 90 kPa (maybe 3-4 rows), one at idle kPa, one at the peak boost kPa, probably one at 15-20 kPa for coasting, and the last one will probably go somewhere in your boost range, to space out the gap between 100 and 200 kPa (assuming your peak boost is 200 kPa or so). I see SO MANY maps with 4 rows in the boost, and one each for 25-50-75-100. 80% of my time is spent between 50 and 100 kPa, so why have only 25% of the map dedicated to that time? Of course, you can put too much emphasis on that, if your engine fuel requiremens is very smooth and linear between 50 and 100 kPa, one or two rows might be enough. Who am I to say?

Anyway, having beaten THAT to death, press the button labeled "calculate map", and it'll fill in the applicable areas of the VE table. You will only get values up to about 100-110 kPa, so you can use those same numbers in all the boost rows for now. They won't grow much, as Megasquirt uses manifold pressure as one of the multipliers, so it's not required to make 200 kPa rows much richer than 100 kPa.

Save the VE table, open up Megatune, import the VE table, and go for a drive. You should be within 1-2% of stoich everywhere, according to your gammaEGO. On to the next step!

Make sure you have good gas for this - 92 or better octane, and pull out some timing just to be safe.

Go back to your favourite deserted road, and make a run from 1500 to redline at 100 kPa, checking your gammaEGO to be sure you're close to stoich all the way up. Do more runs, slowly opening the throttle a little per run, to start increasing boost. As you get to 120, 130 kPa, you should see if it's going lean or rich. You're going to want to start modifying the VEs in the next row higher than 100, so that it's JUST switched from lean to rich, indicating stoich all the way up. I've been able to get all the way up to 160 kPa doing this, running right at, below, or above stoich, given that I've filled up with good gas and had a little less than maximum spark advance. Only go as high as you feel comfortable.

Because you left your 100 kPa row at stoich all the way across, and it stayed approximately stoich as you started increasing boost, you know that your next higher MAP row is approximately stoich as well, as the engine's requirements aren't going to change all that much under boost. If you didn't just tune your last row, use your judgement and guess at what the last row needs, based on your 100 and your next rows. i.e., if you have a 100, a 150, and a 200 row, and MST3K said that 68 was what you needed to be stoich at 100 kPa, and your on-road manual tuning came up with 73 for 150 kPa, you can safely assume that you'll need a VE of 78 at 200 kPa.

At this point, I call the VE table as good enough, and save it as a "stoich backup".

Now you may start richening and leaning it up. At 100 kPa I typically multiply my numbers by 1.1 - i.e., 80 becomes 88, 75 becomes 83, etc. This gets you to about 13.3:1 AFR. At peak boost I like to run around 12.2:1 - many go richer than this, but I'm not in a race to see how much fuel I can burn. I multiply my peak boost VE by 1.2, and my "intermediate" boost, if appliccable, by 1.15. For cruise areas - 2500-3000 RPM and 60-80 kPa, I'll lean it out to 16:1 by multiplying the values by .90

Now add your acceleration enrichments back in, set your EGO correction limit to 5% (or less), and hit the road to play with your timing. If you've leaned your car for cruise, turn off your EGO correction entirely by setting the % per step to 0.

Using this method, I was unsure of how good the results were, but when I finally got my wideband installed, I found that I was within 0.2 of an AFR point of where I thought I was, at all times. I think that's pretty good for a week's worth of tuning and a tank of gas!

I don't have time to go back and re-read all this crap, so if anyone sees anything they question, bring it up and I'll address it.

*Edit* - keep watching this space for updates - I will be adding to this article in the future. Topics to come are initial MS setup, tuning steps, and using the other tuning programs such as MSLVV and my own datalog filter.

linuxman51
10-28-2004, 04:21 PM
eeeggggseeelent writeup, sounds fairly straight forward, no rocket science, and one could very easily do that, get things "good" and hit the dyno to sort out peak power/max boost fuel and timing.

EricF
10-28-2004, 06:52 PM
Just wanted to thank you for this write up, Matt. I will test it on my friend's Saturn ;)

blkaplan
10-28-2004, 07:43 PM
Awesome writeup.

this inspires great hope in me for when my MSnS arrives

Matt Dupuis
10-29-2004, 09:08 AM
No problem - I'll add screen captures when I get a chance.

wiggin
10-29-2004, 01:14 PM
awesome writeup matt, ive been tuning my ms for a few months now and there have been several times when i have just not been sure what to do but this article helped me out a lot and i cant wait to get back to tuning and straighten things out the right way...

Matt Dupuis
11-13-2004, 10:38 AM
I was asked about this in a PM, but I'm posting the reply here so that everyone can do it if they want to.

To change your EGO count increment from updating every ignition event to updating on a fixed time basis, you'll first have to download all the appropriate files for you to compile to make a new .s19 so that you can load that onto your Megasquirt. I went searching for the MSnS page by clicking on the link to it on MSEFI, but it took me right to MSnS-E. Maybe Kenny will provide this service for those who want time based EGO increments, as I assume he's got the last versioin of MSnS stored away on his computer and has been loading that up onto your Megasquirts.

If you choose this time to upgrade to MSnS-Extra, which has the option built in for time based EGO increment, you can get it here: http://www.jsm-net.demon.co.uk/msns-extra/files/ Be sure to install 020i9, as there's a bug in 020i for 'nSpark users - it didn't affect me with EDIS, tho. If you load up MSnS-Extra, you won't have to do this modification, and you can enjoy all the new toys I'm playing with currently.

Anyway, first find this section of the .asm file you're working on, whether it be MS, MSnS, or MSnE:

************************************************** *************************
**
** IRQ - Input trigger for new pulse event
**
** This line is connected to the input trigger (i.e TACH signal from ignition
** system), and schedules a new injector shot (injector actually opened in
** 1/10 timer section above)
**
************************************************** *************************
DOSQUIRT:
lda igncount
bne EGOBUMP ; Only increment ase counter if cylinder count is zero
inc asecount ; Increment after-start enrichment counter
EGOBUMP:
inc egocount ; Increment EGO step counter

and put a semicolon in front of the last two lines as shown:

;EGOBUMP:
; inc egocount ; Increment EGO step counter

Now go find the 1/10 second section of the code:

;================================================= =========================
;******************** 1/100 second section ********************************
;================================================= =========================
t100hz:
inc hs
clr ms
;-- Routines running on 100 Hz clock.
inc EGOcount ; Increment closed loop clock.

And add that last line as shown.

Recompile, load onto your MS, and play with your EGO increment value so that the O2 sensor updates 3-4 times per second. Too fast and you can get overshoot & inaccurate data sampling, too slow you'll get poor response from the sensor.

**Edit** Sorry, the formatting of the code looks like ass on Tbricks...

wiggin
11-14-2004, 05:32 AM
thanx matt... :-P

wiggin
12-14-2004, 07:36 PM
maybe this is a dumb question and i will figure it out once i do the flash but is there different software i need to use once i upgrade to MS Extra???? im just a bit confused on how that all works..

adrianpike
12-14-2004, 08:25 PM
maybe this is a dumb question and i will figure it out once i do the flash but is there different software i need to use once i upgrade to MS Extra???? im just a bit confused on how that all works..

You'll want to grab the latest prerelease version of MegaTune, from here (http://not2fast.wryday.com/megasquirt/mt/prerelease/).
Next, you'll have to edit your settings.ini to disable stock MSnS, and enable MSnS-extra. Instructions are here (http://www.jsm-net.demon.co.uk/msns-extra/setup.html)
Good luck, if you run into problems, just ask. :-D

ovlov760
12-15-2004, 07:35 PM
I'm messing with MStweek but I can't get it to make a MAP. I've loaded into it 2 datalogs but when I go to Edit: modify VE map I get a blank table and there is no option to import anything. Pressing any of the buttons does nothing. There are little colored blocks in the lower left hand box but nothing ever shows up in the table.

Matt Dupuis
12-15-2004, 08:23 PM
Well I hate to say it but did you read the MST3K instructions? They're very good.

You've got to make sure the crossover voltage in MST3K is the same as what you used in MT, and that the when you created your datalogs in MT you had the O2 sensor correction turned on. When you load your datalogs into MST3K, it should filter out everything where the O2 sensor DOESN'T "cross over" the 0.495v area. With the remainder, MST3K notes down and tabluates the GammaVE that was used to achieve that particular point, and it averages all of that data to populate a table. This is shown on the screen as a whole bunch of coloured squares, not just one or two.

When you Edit VE Table, you must first hit the "filter datalog" button, which interpolates all points in between the known points derived from the earlier step, and fills in a very complete table, based on how far your particular datalog went and how successful it was in capturing crossover points.

I suspect that you didn't have your O2 sensor correction turned on, or that you didn't give it enough control over your mixture, which were two of the very first things I told you to do in my first post. Go back and try again, making sure that all your settings are correct and making sure that you're logging crossover points that are the result of O2 sensor information.

ovlov760
12-15-2004, 08:35 PM
I can't find any mst3k instructions but yours. When I click help within the program it does nothing. I will go back and look at what you have suggested.

adrianpike
12-15-2004, 11:27 PM
I'm having the problem that I can't load any VE tables into MST3K.
I'm currently poring through the info I can find on MST3K:
http://autos.groups.yahoo.com/group/megasquirt/files/MSTweak3000/
http://home.earthlink.net/~jcgebhart/mstweak.txt

Matt Dupuis
12-15-2004, 11:48 PM
Okay, sorry - I just loaded 2.04 as well and it's fuxored. Got the same problem as Adrian and also no help file. Load up one of the older ones if you're not using MSnS-E, until it's resolved.

Edit - that second link Adrian posted up is basically a reiteration of the help file. Thanks, man.

adrianpike
12-21-2004, 08:46 PM
Giggity giggity!
I'm currently messing around with my 12x12 MSNS-extra fuel map!
It's pretty simple to do:
Edit your .vex file with notepad (or, since I'm using a real computer, vi :-P), and remove everything from "Page 1" on down, including page 1. Basically just remove all the data for the extra fuel maps, the spark maps, etc. All you want is the first table, and it's column and row info.
I'll keep you guys posted as to any further progress with MSTweak and msns-extra

Matt Dupuis
12-22-2004, 08:31 AM
****in' beautiful, Adrian! Good workaround.

Frej
04-04-2005, 04:13 PM
:) :) *HAPPYNESS* :) :)

Have just installed the EXTRA-code with the knowing that Extra+MSTweak=No good

And then next day I read this thread!

Tanks Adrian!!!!!!! :cool: