Wednesday, August 30, 2006

Unscrewing a Bad Tune

This is something I keep happening time over time: you build up your car, you get a mail tune, or a dyno tune done by some hack, and you hate how the car drives and performs, so you save your pennies, get yourself a tuning package, and you try to do it all yourself. This is exactly how I started, and back then there was little in terms of writeups. These days the problem is that there's too many writeups, and some of them are better than others, however, as a newbie, you have no way of telling. Another big question that keeps coming up is 'What do I do first?' which is a great question, however there's no good answer to, as that depends on what's screwed up.

So this writeup is pieced together from a long collections of emails and forums posts.

1. Set IFR to your injectors and fuel pressure. Please measure it,
see if it holds fairly stable when you give it some gas, you might be able to find a weak spot or a deficiency in your fuel system.
2. Set Primary VE to something that makes sense. Start with a known good tune for a similar camshaft, heads, and headers. It doesn't have to match perfectly, as every car is different regardless, but it will get you in a good starting position.
It wont be perfect, but it should be much closer to what you need than a stock tune.
3. If you have older car with Primary and Secondary VE tables, then do an 'adaptive copy' (just
copy the relevant rows) of the new Primary VE to Secondary VE , or use
to do it for you
has a description of what does it do)
4. Copy high and low octane spark tables from that 'good' tune into yours. If you can't find a good one, I like to start with 02+ Z06 spark tables, as they account for more compression, better flowing heads and a higher lift cam, which makes it closer to what most modded cars have.
5. Blend in the idle areas of spark with values that start at 36* at low rpm and end at about 30-32* at your rpm/cylinder airmass.
6. Use the same blended values in idle areas of spark in the "idle
spark in gear" table. If you have an automatic, also copy it over to "idle spark in park/neutral".
7. Copy RAF drive table over from a good known tune. Again, just like in #3, it won't be perfect, but will be closer than stock. If you dont have a well tune RAF example, up the RAF values in the usual range of ECT by about 3g/sec.
8. Put the car in SD (MAF Fail Frequency set to 0Hz). Start it up, verify
that it goes into SD by reading DTC's (it should throw P0103). if it
doesnt, turn it off, start it again, sometimes it takes 2 or 3 starts.

At this point, you have 2 processes to go through: RAF and VE. VE
has multiple ways of doing it, and of course everyone claims their to
be the best, I'll show you the simplest one that should work perfect
to get the initial 'daily drivability' to be really good, and can be done on any car as it uses stock oxygen sensors.

If the car doesn't die, start driving around, logging for LTFT and
STFT and O2s on both banks. (default setup will do that if you're unsure of what to log, just hit 'reset' in the 'Display Table')

Again, these procedures only make sense in SD, so make sure you're truly in SD.
One trick is to set the codes to set SES light upon the MAF faliure, this
way when MAF fails (aka SD takes over) you get the SES light. I refer
to it by now as the SD light ;)

Drive around in SD, let's get the daily drivability done first, so
keep it under 3-4krpm (depending on gearing and powerbands) logging
fuel trims.

Once you get about 25 samples per cell across the whole range you're
trying to tune, stop, save the log. Then open up the VE2bar.xls I
mentioned earlier, and copy and paste the appropriate tables into it.
Let it do it's thing, and copy the results out of the full- and half- resolution tables, and apply them to the corresponding VE tables. On the
beginning do 'paste special--% full' so it will get big changes done
quickly. Once you get much closer to the target (less than 5% off) I do 'paste
special--%half' so the changes are more subtle and you dont 'overshoot.'
This spreadsheet is made so once you get some values within that -4 to
0 range, it doesn't try to adjust them. The reason for it is that if
you'll tune it perfectly for 0%, you'll have what I call a 'knifeedge'
tune, a tune that will run rich or lean depending on atmospheric
conditions, and as such, will be unpredictable. Once we're a little
bit on the rich side, computer treats is as the same safe set of
settings, and will not try to preemptively pull timing, like it would
if some of the tune was on the lean side.

Once you get a correction done, save it to a new copy of your tune,
flash it, and then reset the fuel trims (that's in the live controls
section of the scanner).
Go for a 10-15 min drive. Because of the reset, the fuel trims will
initially go nuts. That's good, that means it's learning aggresively, and
trying to find it's new set of 'happy' settings. Stop the car, turn
it off, start it up again, do NOT reset fuel trims now, just start
another logging session. The second session has dual function:
1. It verifies that the changes made sense, and they do work better
than the previous setup.
2. It gathers data for another iteration of the VE tuning.

If you gather enough data (it's very useful to set the 'minimal cell
count' to 25 on the LTFT and STFT charts, this way nothing will show
up until you get 25 samples, which guarantees a clean, consistent
dataset) just start looping through the process of
scan/calculate/adjust/flash/reset/ride to adjust until the fuel trims
will all come back in the -4 to 0 range.

Once that's done, do RAF:
1. Scan from full cold start to full warm. Turn off fans for this
purpose to let the car warm up to ~220F. Scan for ECT and STIT.
2. Create a custom histogram of ECT vs STIT, and display the gathered data in it.
3. Do "Paste--Add" the resulting table to the corresponding RAF table.
4. Wait till next time the car is fully cold, and redo the whole
process again. Repeat until the STITs are <0.1g/sec>
throughout the whole range.
5. (automatics only) You get to redo the whole process again, but not in Park, but in Drive, as the RAF tables in Park/Neutral are little different.

If the car doesn't want to idle with the initial settings, you have to
ballpark the VE some more. Usually you're overfueling (which is made
very visible by a 'surging' idle) so cut down the idle range VE values
by 10% (select the cells in question, put it 0.9 and press * to bring it down to 90% of previous values), flash, try again, until it's reasonable enough to do a real VE scan which will get the VE tables set precisely. The whole goal of this 'ballparking' is to get it close enough that it can idle on its own, thus allowing us to gather data for a proper adjustment.

If you're familiar with tuning VE with OL and WB, then you can do that
instead, but it's really not much different, just few extra steps.


Monday, August 21, 2006

From Airflow to Pulse Widths

Ultimately, the function of the PCM is simple: measure airflow, and provide engine with enough fuel to match that airflow.

As just about anything in life, it's easier said than done. Airflow measurement is a notoriously tricky subject, and injecting fuel with a constant size injector against wildly varying pressures in the manifold isn't exactly easy either.
However, the principles of Physics always hold. Things like density, ideal gas law, proportions, and timing allow us to approximate the duration at which we want to hold the injector open. Putting all these things together, I was able to come up with a model that can approximate the pulse widths based on airflow fairly accurately. The concepts however weren't trivial, so I decided to make a full standalone application to demonstrate these concepts.

The real motivation behind this project were people, miserably failing at understanding the relationships between airflow, fuel, pressures, temperatures and all the other important. I am not the teacher type, and I do not take pleasure at explaining the same basics over and over, and have them doubt me. I remove doubt by introducing physics and quantification of entities involved.

So here it is, my first GUI application. I've always sucked as a coder, but the new VB express 2005 I must say made my life easier on this project.

During the development I tried to remember everything that annoys me about most applications, and keeping that in mind, I tried to avoid it. There is no annoying 'calculate' button, the whole application is 'live'--every time you change a value, all the results and prerequisite intermediate steps get updated. Another annoyance of Windows programs is the inability of looking at more than one instance of what I'm playing with at the same time, thus: the Clone button, which gives you another instance of the program, for your 'compare and contrast' pleasure. Also, there's no limits (beyond available memory) to how many you can look at simultaneously. Defaults make sense, I made it with SVO 30s and stock cube LS1's in mind, but of course all of this can be changed to any value you want. I checked it by trying values describing BPU'ed Supras and stockish S2000's and they all make sense too.

So the most basic mode of operation is to check if what my setup flows can be supplied with enough fuel at my operational AFR, temps, altitudes and RPM range. This is simple, merely adjust the numbers for your hardware, and you will get the pulse width needed to complete a full injection cycle. If it's bigger than the duration of the cycle, you're in trouble (one of fields will go red/yellow to alter that you're past the limits). If it's in the safe zone, you can start playing with it. Here's some questions it can answer:
  • How much higher can I rev with these injectors?
  • Is my fuel system big enough to handle heads and cam?
  • Why do Forced Induction setups eat so much more gas?
  • What if one of my injectors flows 10% off others, what kind of conditions are gonna be in that cylinder?
  • If I go racing to some good Density Altitude track, what kind of fuel consumption can I expect?
  • Why do I run lean when I went to more cubes?
and so on... This is a useful litttle utility, especially for educating yourself on what makes injectors work harder, what kind of hardware is really needed to race safely, and what conditions are desirable.

I'm planning on expanding this utilty to have a more precise Air Density calculations, helpers for injector sizing and cylinder displacement, etc.
Please comment, report bugs, give me ideas, etc.

The only problem with this software is that it requires Dot Net 2.0 on your computer. Most HPT users already have it on their computers, and if not, please download/update what you need.


enjoy, Marcin