How to get started with tuning and logging

Original Source / Web Archive

Version 1.3

Get What You Need

Tactrix OpenPort – Tactrix makes a product called an OpenPort that lets you upload and download tuning information using a laptop. The original OpenPort (versions 1.0 – 1.3) was a cable, with a USB connector at one end, and an OBD2 connector at the other end. The current OpenPort (version 2.0) is a little box that plugs into the OBD2 port, and you plug a USB cable into it… but everybody still calls it a “Tactrix cable” anyway. Old habits die hard.

EcuFlash is free software that uses the OpenPort to actually copy a tune to and from the car (copying a tune to the car is called reflashing). EcuFlash will also let you edit the tables in the tune.

RomRaider is free software that also lets you edit the tables in the tune. RomRaider is also a logger – it uses the OpenPort to connect to the car and record parameters from the engine to a file on your laptop. Logging is how you find out if your tune is working well or not.

Timing Editor is free software that makes it easier to edit your timing tables. Read that thread for details.

Learning View is free software that shows the information that your ECU learned while you were driving. Currently there are three kinds of learned information:

1) AF Learning A, B, C, D, also known as “fuel trims.” These indicate whether your MAF scaling is correct or not.
For information about these values, see here:

2) Knock Correction. There is the Ignition Advance Multipler (IAM) and there’s a table of learned knock corrections and different RPM and airflow (load) cells.
For information about these values, see here:

3) Diagnostic Trouble Codes, or DTCs. If present, these indicate problems with your car. For more information about these codes, enter the code number (e.g. “P0420″) into the search engine of your choice, and see what comes up.

A Wideband O2 Sensor is almost, but not quite, essential. The stock O2 sensor is not accurate when the car is under boost. Cars with 16-bit ECUs use O2 sensors that are only accurate in a narrow range around 14.7:1 AFR under any conditions. Cars with 32-bit ECUs use O2 sensors that are accurate over a wider range, but they still located in the up-pipe, where exhaust backpressure renders them inaccurate. Even if you relocate a 32-bit ECU’s O2 sensor downstream of the turbo, they will only read down to 11.1, which is insufficient for most tunes (you could shoot for 11.5:1, but few people do).

Learn the Language

Tuning is a specialized field which has its own specialized vocabulary. You’ll need to understand a few new terms. The list below is not exhaustive (not even close), it is just enough to help you understand this how-to guide. There’s a longer list here.

Engine Control Unit, or ECU – This is the computer that decides when to open and close the fuel injectors, when to fire the spark plugs, and so on. There are a lot of tables of numbers in the ECU that govern these behaviors and others, and tuning is all about tweaking the numbers in those tables to get the ECU to run the engine the way you want it to run.

Mass Air Flow, aka MAF – Engines pull in air, injectors add fuel, spark plugs ignite the mixture. The air:fuel ratio (AFR) is rather important for this process to work correctly. Subarus use a “mass air flow” sensor, usually located just downstream of the air filter, to inform the ECU of how much air the engine is pulling in. Airflow is measured in grams per second. Given the MAF and the desired AFR, the ECU decides who much fuel is necessary, and it uses the information to determine how many millisecones to open the fuel injectors.

Load – Load is MAF divided by engine speed (RPM). This gives you airflow in grams per revolution of the crankshaft. More about this later.

Open Loop / Closed Loop – When your engine is idling, or you’re just cruising around at a constant speed, or accelerating gently, the ECU uses the signal from the O2 sensor to determine whether the actual AFR is higher or lower than the desired AFR. If higher (lean), it will inject a bit more fuel next time. If lower (rich), it will inject less. This inject-measure-adjust cycle is a closed feedback loop, so we generally refer to it as ‘closed loop’ operation. In closed loop, the ECU always tries to achieve an AFR near 14.7, perhaps slightly richer or leaner depending on various compensations (such compensations are outside the scope of this introduction).

When you’re asking the engine to make nontrivial amounts of power, the ECU wants a richer mixture. Due to the aforementioned lack of accuracy for our O2 sensors, the engine stops using feedback from the O2 sensor – it just looks at the MAF signal, the desired AFR, and it injects what it thinks is the right amount of fuel. The feedback loop is broken – there is no feedback – so this is called ‘open loop’ operation.

MAF Scaling – The MAF sensor puts out a voltage from about 0-5 volts, and the ECU has a table to figure out what airflow (in grams per second) the current voltage indicates. This tables is referred to as the MAF scaling table. Most of the sensors have a corresponding scaling table, this one just happens to come up in conversation the most.

AF Learning, or “Fuel Trims” – Subaru knew that the MAF scaling would not by perfectly accurate, so they gave the ECU the ability to learn around those inaccuracies to some extent. Most Subarus have 4-5 fuel trims, each corresponding to an airflow range (e.g. 10-20 grams per second). The ECU will apply a percentage to the airflow indicated by the MAF, based on the difference it has observed between the actual AFR and desired AFR for that air flow range.

Knock, or Detonation – Two words for the same thing, used interchangeably. Knock is a leading cause of death for modified Subaru motors. It has also killed a surprisingly large number of non-modified Subaru motors, particularly in the 07 and later model years. Generally, when the spark plug ignites the air/fuel mixture in the combustion chamber, the flame front expands outward in a continuous orderly fashion, pushing the piston downward to create power. Occasionally, the heat and pressure resulting from the expansion of this flame front will trigger smaller explosions around the edge of the combustion chamber, which leads to much of the remaining air/fuel mixture to ignite simultaneously. This is detonation. The heat and pressure from detonation are far higher than normal combustion – so much higher that engine damage will result from enough of this abuse.

Timing – This is short for “ignition timing advance.” When people speak of adding more timing, what they really mean is igniting the air/fuel mixture sooner during the compression/ignition process. It might be intuitively reasonable to ignite the air/fuel mixture when the piston is at the top of the combustion chamber (aka top dead center, or TDC), but in fact this is not ideal. It helps to ignite the mixture before the piston reaches the top of its stroke, so that the peak cylinder pressure will occur when the crankshaft has moved roughly 20 degrees past TDC.

As the engine speed increases, the spark must be advanced further to get best power. However, as load increases, the spark must be retarded to compensate for changing flame front speed and to avoid detonation. Subaru motors running on pump gas cannot run the (theoretically) ideal timing for maximum power because detonation will set in before that much ignition advance is achieved. Generally we run as much ignition timing advance as we can run without causing detonation.

Logging – Logging is how you find out what’s going on in your engine. You tell the logging software which parameters you care about, and it interrogates the ECU to get the values of these parameters, which are written to a log file. Log files are “comma separated value” files, and the file extension is “.csv” but you can open them with any text editor if you like. They’re not easy to read that way though.

Make Sure Your Car is Healthy

You’ll generally start by logging to make sure that (or find out if) your car is healthy. First, just do some mild driving, and use Learning View to make sure that your fuel trims are all in the range of −5% to +5%. If they are not, stop here and work on your MAF scaling.

If your fuel trims are all reasonable, you may start to log some pulls. A “pull” means going from 2000–2500 RPM to redline. Find a safe place for this. For most of us, that means going far outside of populated areas, preferably to an interstate freeway onramp that will allow you to reach redline in 3rd gear, then slow down a bit before coming near any other cars oh the freeway.

Start by logging a pull at half-throttle. Then stop the car and examine the log. Log examination is beyond the scope of this introduction, but essentially you want to look for knock, look at your boost level, and look at your AFR. If the car is not knocking and if nothing weird is happening to the boost and AFR, repeat the process, adding a bit more throttle each time, until you are pulling at wide open throttle (WOT) from 2500 to redline.

Most of us prefer to look at logs using a spreadsheet such as Excel, because that makes it much easier to visualize the information in the logs. If you don’t know how to use Excel, this is an excellent time to learn.

Turn it Up

How much power your car can make is beyond the scope of this article, but it helps to look at what boost, AFR, and timing other people are making with similar cars and similar modifications. Generally speaking, you make more power by adding boost, adding timing, and perhaps by leaning out the mixture (Subaru’s factory tunes run quite rich). However, if you get too greedy with any of those, the engine will knock, and knock will eventually destroy your engine. It is critical that you monitor detonation after making any changes to your tune.

The Tuning Workflow

1. Decide what you want to accomplish. More boost? More timing? Leaner mixtures? Richer mixture and more timing, or vice versa? Tune out boost spikes? Tune out knock? Just look for knock? Or do you just want to find out what boost, AFR, and timing you have now, and make sure knock is negligible? Decide what you need to learn from your next logging session.

2. Choose a set of parameters to log. Log the ones that will show you what you need to know to accomplish your goal, and not much else. The more parameters you log, the fewer rows you’ll have in your logs. I’ve written a separate how-to about logging: topic5384.html” onclick=”;return false;

3. Log. Create the conditions you are interested in, and use the logger to create files that show what’s going on under those conditions. When tuning for power, this usually means WOT pulls, but part-throttle pulls and low-boost pulls are also useful to get smooth driveability. When tuning for cruise, you can just log your regular commute or a trip to the grocery store. If there’s a specific scenario that interests you – for example, shifting – then find a place where you can do that.

In any case, recreate the scenario several times (whether it’s pulls, shifting, or several minutes of cruise, or whatever) so you can find trends in your logs. There’s a fair amount of “noise” in data logs so it takes a few logs to really see the “signal.”

4. Study the logs. Look for detonation. Look for deviations between the actual boost, AFR, and timing, an the numbers that you want or expect. This is somewhat tedious, but it’s how you find out what’s going on in the motor.

5. Tweak the tune. Depending on what you see in the logs, revise the appropriate tables in the tune, and save the tune to a file on your hard drive. Make small changes. If you over-do anything, the car will run like crap. Or blow up. So make small changes and verify the results of those changes. It is generally preferable to change only one thing at a time, until/unless you have done it enough times to accurately predict how each change will affect the results of the next set of logs.

It’s also a good idea to save all of your tunes. I save each tune in a directory with log files that were generated with that particular tune. This makes it easy to look at the last few changes, or roll back to a known-good tune if I make a mistake.

6. Flash the tune. Use EcuFlash to write the revised tune to the ECU.

7. Repeat. Go back the step 3.

Tenets of Good Tuning

Think about causes and effects. Before you make a change, ask yourself, what’s the effect that you want? What can you log to find out if you’ve had the effect that you want? What changes will cause that effect? Do you already have a log that you can use as a baseline to measure the effect? If not, make one – or better yet, make five, so that you can see how much variation there is without even making any changes to the tune.

When you see an unexpected change in your logs, ask yourself, what caused it? If you undo your last change, do things return to normal? (If not, you may have a mechanical problem.) If you do a second log, without making any changes to the tune, do you still see the same change in the log? (If not, you might just be looking at random variation – there will always be some.)

Change one thing at a time. If you change two things, you don’t know which of those things caused the effect that you ended up with. You can guess, but you shouldn’t need to guess – you should know, based on data logs that demonstrate the effects of a single change. There are a lot of myths and half-truths circulating around the various internet forums – don’t believe what you haven’t seen in your own logs.

Make small changes If you make a large change, and you do it wrong, you can destroy your motor. If you make a small change, and you do it wrong, Subaru’s knock protection will probably keep your mistake from doing much damage. But don’t reply on it too much – it was intended to keep your motor alive longer with the factory tune, it should not be counted on to keep your motor alive forever when it’s been tuned for more power, or even to keep your motor alive for very long when it’s been tuned beyond the knock threshold.

Have fun!

P.S. There’s more here: … deToTuning

Revision history:
1.0 – first draft
1.1 – minor style changes
1.2 – adding links to Learning View how-tos, and timing editor thread
1.3 – added tenets