The Windows 9x/Me/XP software application you use to tune and configure your MegaSquirt® or MegaSquirt-IITM is called MegaTune by Eric Fahlgren. (Version 2.25 or higher is needed to work with MegaSquirt-II, all versions work with MegaSquirt®). You also need Windows 9x/Me/XP on a computer (a laptop or notebook computer if you want to tune in the car) and a conventional serial port to communicate with MegaSquirt-II. USB will may work, and many people have reported that they have been successful using a USB-serial adapter. Just about any computer that is capable of booting Windows 95 (or better) will be fast enough, but get the fastest laptop computer you think is reasonably priced, obviously.
| Introduction to MegaTune | Installation | File | Settings |
| Table | VE Table 1
|
VE Table 2
|
Ignition Table
|
| Tuning | Communications | Tools | Help |
MegaTune2.25+ is the Windows 95 (and later) configuration editor by Eric Fahlgren for the MegaSquirt® and MegaSquirt-II EFI controller. It allows all of the tuning and set-up parameters to be modified and has a real-time VE table editor, which allow a vehicle passenger to tune the engine while driving.
General Advice and Operation Some general principles to follow when setting the configuration parameters are:
Note that it is possible to damage your engine by choosing inappropriate tuning or set-up parameters in MegaTune. Be sure to read this document, and all associated tuning documents that apply to your engine, vehicle, and tuning circumstances. In particular, read the safety precautions.
Information on tuning using MegaTune with MegaSquirt® or MegaSquirt-II is listed separately from this section, and depends on the processor you have.
MegaTune has an 'automated' install package, similar to most other modern Windows software. You download the set-up file (see below), click on it, and the package installs itself. You may have to select some options, or you may chose to select all the defaults. Files Get the latest version of MegaTune from http://www.megamanual.com/files/software/. Generally, you need MT2.25 for MegaSquirt-II. All versions will work with MregaSquirt, later versions often have more features. Install Process To get the latest version of MegaTune:
While you are in the setting.ini files, you can verify or change the EGO sensor option under LAMBDA_SENSOR if necessary.
You can use mtCfg to change the color depth, temperature units (°F/C) and a large number of other parameters for MegaTune. See the documentation in the files displayed in mtCfg.
Be sure to 'Save' the file. You should now be able to launch MegaTune. Double-click the MegaTune icon (created above) on the desktop.
Communications/Settings dialog on the MegaTune menu.
You should always uninstall MegaTune before installing newer versions.
There are two parts for any firmware release:
If you download a different .s19 file to your MegaSquirt® EFI Controller, then you must install the corresponding INI file in the place expected by MegaTune.
The error you are seeing is telling you that the signature in the INI doesn't match what MegaTune is receiving from MegaSquirt. This can be for a number of reasons, the most common are:
Also, be SURE to set the CODE_VARIANT as well as activating the appropriate INI file, both actions are necessary.
Creating and Selecting New Projects
MegaTune allows you to manage data for multiple MegaSquirt® installations. First you must use the installer to build yourself a default setup. Once you have a basic MegaTune setup, use mtCfg.exe to create a new project. Open mtCfg, then click on 'Project/New', type in the project's name, then click on okay.
Instead of "carN", use a real name, for example "Corvette" and "Audi" (the actual names are of no significance to MegaTune, it is there for your purposes, so give it a descriptive name that works for you.
Then use mtCfg to configure the new projects code variant, ego sensor, etc.
When you have only a single car directory, MegaTune assumes that you want to use that one, so starts there automatically. When you have more than one, MegaTune will present you with a list of choices at startup, so you can work on the correct one. By typing the initial letters of the project name, you can jump down the select list to the desired one quite quickly. Once you have the desired project highlighted, just hit the enter key or use the mouse to click "Ok."
In the processor specific file (megasquirt-I.ini, megasquirt-II.ini, etc.) in the MegaTune folder, you can edit the gauges to show ranges and warning appropriate to your combination. To do this, open the file using Notepad or another text editor.
Each gauge has a number of properties, these are:
Examples:
Name Var Title Units Lo Hi LoD LoW HiW HiD vd ld
advBucketGauge = veTuneValue, "Advance Bucket", "degrees", 0, 55, -1, -1, 999, 999, 1, 1
advdegGauge = advance, "Ignition Advance", "degrees", 0, 50, -1, -1, 999, 999, 1, 1
Note that many of the variables are represented on the runtime, tuning, and front pages, and you may need to set additional parameters to get them all to look the way you want. For example, the EGO display on the front page is set in this section:
[FrontPage] #if NARROW_BAND_EGO egoLEDs = 0.0, 1.0, 0.5 ; Voltage settings. #elif LAMBDA egoLEDs = 1.5, 0.5, 1.0 ; Lambda settings. #else egoLEDs = 19.7, 9.7, 14.7 ; Afr settings. #endif
To change the gauges on the front page, find a section of your code's INI file similar to:
[FrontPage] #if NARROW_BAND_EGO egoLEDs = 0.0, 1.0, 0.5 ; Voltage settings. #elif LAMBDA egoLEDs = 1.5, 0.5, 1.0 ; Lambda settings. #else egoLEDs = 19.7, 9.7, 14.7 ; Afr settings. #endif ; Gauges are numbered left to right, top to bottom. ; ; 1 2 3 4 ; 5 6 7 8 gauge1 = tachometer gauge2 = throttleGauge gauge3 = pulseWidth1Gauge #if NARROW_BAND_EGO gauge4 = egoGauge #elif LAMBDA gauge4 = lambda1Gauge #else gauge4 = afr1Gauge #endif gauge5 = mapGauge #if IAC_GAUGE gauge6 = IACgauge #elif PWM_GAUGE gauge6 = PWMIdlegauge #else ; FIDLE_GAUGE gauge6 = matGauge #endif gauge6 = xTauGauge gauge7 = advdegGauge gauge8 = dwellGauge
Change the gauge assignments to those you prefer. Note that the value after the 'gaugeX =' label MUST appear in the [GaugeConfigurations] section of the INI file.
So while the type of sensor is set in the vehicle specific folder, the limits are set here. In most cases the defaults work well, but you can change them to suit your purposes. The format is name, upper limit, lower limit, switch point.
Expressions
MegaTune allows you to compute values from MegaSquirt's output channel data or from constants and settings in the database. These can then be used in datalogs or gauges.
Data types:
Operators in order of descending precedence:
Built-in math functions and constants:
MegaSquirt-specific functions:
#unset AUTOMARK_LOGGING_FEATURES
#if AUTOMARK_LOGGING_FEATURES
[OutputChannels]
; Make up some variable names...
highLoad = { rpm >= 3500 && throttle >= 50 }
enable = { rpm >= 2000 }
[Datalog]
enableWrite = enable ; Log entries are only written when the variable
; "enable" is true, see it's definition above.
markOnTrue = highLoad ; A datalog marker is written when "highLoad"
; transitions from false to true. The marker
; looks like "MARK 001 highLoad" to distinguish
; it from the manual markers.
#endif
|
Change the #unset AUTOMARK_LOGGING_FEATURES to # set AUTOMARK_LOGGING_FEATURES (note we have changed unset to set), and edit the enable conditions (tps/rpm/map/etc.) to your liking.
Datalogging will start when the conditions are met. You still have to start the datalog - Alt+L, <enter>, but MegaTune will only record lines when the conditions are met. So you can start the datalog 20 minutes in advance, knowing the lines are not being added until you want.
As noted in the code snippet above, you can also have MegaTune 'mark' the datalog on specific events by defining other variables (for example 'highload' in the snippet above).
You can uninstall MegaTune in three ways:
MegaTune 2.25 has a menu structure that depends on the hardware and software you have loaded. This document covers only the standard MegaSquirt® and MegaSquirt-II hardware and code configurations. For other configurations, please see the developer's site. Below is a list of all the menu items in MegaTune 2.25. Click on any of them to navigate to specific information on that topic.
When MegaSquirt® is loaded and communicating with MegaSquirt® EFI Controller, the first thing you will see is the front page, which shows eight of the more useful gauges. A number of the sensor readings are displayed, as well as some outputs. For example, the injector pulse width is the measure in milliseconds of how long the injector is opened for each pulse, regardless of how many times it is opened in a cycle. Duty cycle gives the percentage of time the injector is open irrespective of individual pulse duration.
There is a bar gauge across the bottom of the window shows the oxygen sensor reading. The scale is determined by egoGauge value in the Tuning section of the MegaTune2.25+.ini file. This same setting controls the analog and bar gauges on the tuning page. The first value of this setting controls the lowest voltage displayed on the gauges, the second number controls the highest and the optional third value specifies the “alert” value, above which the LEDs are red. The bottom of the front page contains a status bar. The current file name (used for Save operations) is displayed in the left part of the status bar, followed by “saved” status. When the memory image (i.e., the settings you have chosen) has been modified since the last Open or Save operation, this entry shows SAVED in bold face.
The front page also indicates how many times MegaSquirt® has reset since MegaTune was started. These resets can be due to the user manually turning off the power to MegaSquirt® (cycling the ignition switch) OR they could be due to problem with MegaSquirt® or it's power supply.
When MegaSquirt® resets, MegaTune displays RESET X in the lower right corner (where X is the cumulative number of resets, including restarts) - MegaTune will also beep. Resets can cause a number of problems that cause the engine to run badly, including messing up the baro correction and enabling after start enrichment. So you should try to cure any reset issues before putting a lot of effort into tuning.
Resets generally indicate that the power to the processor was interrupted. This could mean that the input power actually was cut, but it can also mean that there was a power surge into the back plane (ground), so that there was no longer a 5v differential between the inputs and the grounds...
Resets are often caused by noisy power supplies (usually the alternator), or poor grounds. So you might recheck that the grounds are good, and add a car stereo power filter to MegaSquirt's 12V supply. These are cheap (~$5) and widely available. They typically have three wires: one from a switched 12V source (the original source for MegaSquirt), one to go to MegaSquirt® (with clean power), and a ground wire.
Ignition noise, solenoids turning on or off, and that sort of thing can also cause resets. Check your harness routing to see if any ground or signal wires are near noise sources such as spark plug wires or the coil.
Solve reset issues as they come up, as they will confound your tuning efforts if you proceed without fixing them.
As well as the RESET indicator, MegaSquirt® has a number of other indicators that can be set manually. This is set by editing the variables and values in the indicators sub-section of the [FrontPage] section of the INI file you have activated:
;----------------------------------------------------------------------------
; Indicators
; expr off-label on-label, off-bg, off-fg, on-bg, on-fg
; indicator = { tpsaen }, "Not Accelerating", "AE", cyan, white, red, black
;
; Look in the new colorScheme.ini for the basic ones, add more or tell me what to add.
indicator = { ready }, "Not Ready", "Ready", white, black, green, black
indicator = { crank }, "Not Cranking", "Cranking", white, black, black, white
indicator = { startw }, "ASE off", "ASE ON", white, black, cyan, black
indicator = { warmup }, "WUE off", "WUE ON", white, black, blue, white
indicator = { tpsaen }, "Accel Enrich", "Accel Enrich", white, black, green, black
indicator = { tpsden }, "Decel Cut", "Decel Cut", white, black, green, black
indicator = { tps > floodClear && crank }, "Flood clear off", "FLOOD CLEAR ON", white, black, red, black
indicator = { batteryVoltage < 10.5 }, "Battery OK", "Battery LOW", green, black, red, black
indicator = { port0 }, "Port 0 Off", "Port 0 On", white, black, red, black
The front page is limited to eight gauges, which may not be enough, especially when you are learning to use MegaTune. If you go to the 'Tuning/Realtime Display', you can see many more variables at once. This is a good page to monitor while experimenting with the stimulator and MegaSquirt. MegaTune2.25+ allows you to save and restore configurations as disk files (they have an .msq extension). Use the Open, Save and Save As menu items to do this.
MegaSquirt has two types of memory RAM, which requires that the power be on for values to be retained, and flash, which retains it's values even when the power is shut off. In MegaTune, values that are edited are change in RAM (and thus affect engine operation) as soon as you move to another field (with the tab key or the cursor). To retain the values when shutting off MegaSquirt's power, you must 'burn' the to flash. You do this using the 'burn to ECU' button on the dialogs.
In general, MegaTune only burns the values on the current dialog when you click on the Burn to ECU button. To burn all the values you might have edited, the best method is to save them as a MSQ (which saves the values in RAM) then load and burn it (to flash).
MegaTune can store and retrieve set-up files, both entire set-ups (.msq files), and VE table files (.vex).
This allows you to export a VE table. You can export or import VEX files into any of the VE tables. These are saved in the VEX format. Be sure to give your saved files descriptive names. With MegaSquirt-II, you load the files from the tables menu.
This allows you to import a VE table. You can export or import VEX files into any of the VE tables. These are saved in the VEX format. The table will import VEX files of different sizes and automatically adjust them to match the current table size. With MegaSquirt-II, you load the files from the tables menu.
Start up the MT Configurator (from the Start menu under MegaSquirt® EFI Controller, or from MegaTune under 'File/Configurator'). Open the MegaTune2.25 tree item, and you'll see a number of megasquirt-II.ini.N.N files. Pick the one where N.N matches the version of embedded code you are running, highlight the .ini file version that you wish to use and execute File -> Activate. This will rename it to be "megasquirt-II.ini" (deleting the existing megasquirt-II.ini file first). It will then be used by MegaTune when it starts up.
(Note that all 2.XY use the same 2.X INI file. For example, the 2.35 code uses the 2.3 INI file. This is the way the code upgrades are designed. Major revisions are incremented by +0.1 and require a new INI file, minor revisions (+0.01) use the same INI file.)
You need to tell MegaTune which version of MegaSquirt® and code you have (MS, MS-II, etc.), as well as the EGO type, etc. To do this, use the mtCfg program, which opens automatically during the installation process (it can be opened directly from the MegaTune folder at any later time). Look for the CODE_VARIANT variable, it will be in 'Car1/settings.ini/Settings/CODE_VARIANT' in the directory tree on the left side of the mtCfg window. Click on CODE_VARIANT. You can then use the drop box in the upper right section of the window to select your code variant.
While you are in the setting.ini files, you can verify or change the EGO sensor option under LAMBDA_SENSOR if necessary. You can use mtCfg to change the color depth, temperature units (°F/C) and a large number of other parameters for MegaTune. See the documentation in the files displayed in mtCfg.
Be sure to 'Save' the file.
This will close
MegaTune.
On the main MegaTune2.25+ menu is an item called 'Settings/General'. You can set these as follows:
Input Smoothing Lag Factors Input Smoothing Lag Factors Lag factors force the variables to change more slowly than the actual input value. Note that in all cases, 100 is no lag effect at all, and smaller numbers slow the input response speed. The lag factors are used as follows:
The basic idea of IAC is that the motor or PWM solenoid starts out with a large opening of the air valve at cold startup, then gradually closes as the coolant temperature rises. The basic motor position at any given time is determined from the input table of step position versus coolant temperature. To this basic control algorithm, several features have been added as described below. You need to set MegaSquirt-II to tell it if you have a fast idle "solenoid type" valve or a stepper motor IAC, or neither. These are selected under Settings/Idle Control in MegaTune:
So, for example, if the motor last moved at 140°F, and the hysteresis is set to 5°F, then it won't move again until the temperature reaches 145°F. The setting prevent from moving the motor back and forth constantly, heating it unecessarily.
A value from 5°F to 10°F is good for most installations. This input can be used to avoid continuous motor motion (and wear) for small coolant temperature changes and random 'jitter' in the coolant temperature signal . Changes to the motor are only made when new coolant temperature > coolant temperature on the last move, or, new coolant temperature < (coolant temperature on the last move - Hysteresis temperature). What this does is allow constant motor motion while the coolant temperature is rising, but when it peaks, there will be no further motion unless things cool back down - which is unlikely.

The two spare port "T" pins (PT6 and PT7) are normally used to drive the stepper motor chip (IAC1,2). When you set pin PT6 high, it will make 1 of the 4 stepper output pins high and the other low, and no effect on the last two - which are controlled in the same way by pin PT7. So, by picking 2 of the 4 IAC outputs, you have two 12V spare pins that will directly drive about 0.5 Amps with no transistor needed. This is more than enough to drive a relay directly. If you are going to use port PT6 or PT7 as spares (IAC1,2), IdleCtl should be set to 0. This will keep the the stepper chip 'always enabled' and not turn it on and off, which would prevent the port from working as intended.
The pin on/off commands are set by pointers. When a user wants to use say an LED as a spare output, then the pointer is set to point to a dummy register in RAM (random access memory), and that's it. It's just like setting a jumper on the PCB to route a signal one way or another.
The spare pins have generic logic based on the values of up to two of the real time display variables. The user can specify these in MegaTune and they will be passed to MegaSquirt-II as offsets. The user can also specify:
The optimal PWM current limit frequency is correlated with the inductance of the injector, resistance of the loop, and elapsed time/duty. The goal is to switch the injector current on and off without an appreciable change in *average* injector current - the current which holds the injector open. Faster PWM frequencies mean less current deviation. But since the injector is already held wide open (or should be) a faster PWM frequency will not hold it open any more than it already is.
A overall PWM setting above several kiloHertz (kHz) works based on most automotive injectors, and there is no advantage of running the frequency higher. In fact the higher switching will require a little more heat dissipation. Electromagnetic interference (EMI) with other circuits on MegaSquirt® is also an increasing possibility as frequency rises.
If you want to calculated the optimal period, then measure the injector inductance, and run it through the relation for inductor current:
When the inductor is charging, use the battery voltage for E, and when it is discharging use the voltage drop across the PNP Darlington, about 1.5 volts. You can then see the amount of current deviation based on PWM frequency.
If you want to measure this directly, install a low value resistor (like 0.05 ohms) in series with the injector and monitor the voltage drop across the resistor with a scope. You will then see the hold current and the deviations cased by frequency.
Alternatively, you can add resistors in series with the injectors. See the Injectors and Fuel Supply section of the MegaSquirt® manual for more details. To run low-impedance injectors with the PWM current limit mode, you need to set two parameters - the "PWM Current Limit %" and the "Time Threshold for PWM Mode" - both are on the “Constants” page. The current limit % is the percent duty cycle when the current limit is invoked. The time threshold is the amount of time from when the injector is first opened until the current limit is activated.
High impedance injectors can run on 12 Volts without problems. Low-inpedance injectors require some form of current limiting. MegaSquirt® has pulse width modulation to limit the current. You need to set the PWM parameters to match your injectors:
Set the initial PWM% to 75% if and only if you have you impedance injectors and have NOT installed:
Note that most distributors are shipping the V3 main board with the flyback circuit installed. If you are not sure, look for the presence of Q3 and Q11 on the heat sink (3rd and 7th from the left), or ask the distributor.
You will tune these after getting the engine running.
See “Setting the PWM Criteria” in the tuning section of the MegaSquirt® manual.
Failure to perform the tuning steps can result in damage to your injectors. If you have high-impedance injectors, set these values to 25.4 ms and 100%, and you do not need to tune them further.
| Fuel | AFR |
| Methanol | 6.4 |
| Ethanol | 9.0 |
| Gasohol (10% ethanol) | 14.2 |
| Gasoline | 14.7 |
| Propane | 15.7 |
Number of Cylinders | ||||||||||
| 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | ||
| 1 | OK | simultaneous only | simultaneous only | simultaneous only | simultaneous only | simultaneous only | simultaneous only | simultaneous only | simultaneous only | |
| 2 | no | OK | no | OK | no | OK | OK | OK | OK | |
| 3 | no | no | simultaneous only | no | no | simultaneous only | no | no | simultaneous only | |
| 4 | no | no | no | OK | no | no | OK | no | OK | |
| 5 | no | no | no | no | simultaneous only | no | no | simultaneous only | no | |
| Number | 6 | no | no | no | no | no | OK | no | no | OK |
| of | 7 | no | no | no | no | no | no | no | no | no |
| squirts | 8 | no | no | no | no | no | no | OK | no | no |
| 9 | no | no | no | no | no | no | no | no | no | |
| 10 | no | no | no | no | no | no | no | OK | no | |
| 11 | no | no | no | no | no | no | no | no | no | |
| 12 | no | no | no | no | no | no | no | no | OK | |
"OK" means the combination will work with either simultaneous or alternating. "no" means it will not work with either, i.e., not at all.
You can also set:
These parameters define the closed loop behavior of MegaSquirt. You must have a narrow band O2 sensor hooked up for this mode to work in v.1.0 controller code; either a narrow band or wide band will work with v.2.0 of controller code. To disable closed loop operation altogether, set the EGO Step value to zero.
Dual Sensors: The dual lambda sensor feature has been in the MS-II code since V1.0. You connect the second sensor to the ADC6 input with appropriate circuitry and it adjusts the PW2 output independently of PW1. You connect the second sensor to the JS5 hole (on a V3 main board) - X7 on a V2.2 main board, duplicating the R10, R11, C10 circuit from the v3.0 PCB in the proto grid area. There is only one calibration because it is assumed you are going to use the same type of sensor on each side. If there is a small difference, you can compensate for it in the separate AFR target tables.
The two parameters for characterizing transport delay come form the two causes: one is the response time of the sensor itself even if you had it stuck on the cylinder head exhaust port + it includes averaging done in WB controllers. The second parameter is a function of the transport of gas from the cylinder head to the sensor - which is a function of geometry and speed/load.
It assumes you have a measured transport delay at a fixed rpm and map value, e.g, at idle, and you can put the specific rpm, map and measured delay into the eq and you get out a program input (KDly2) needed by the MS II code to approximate the transport delay at any arbitrary rpm and map. KDly1 is the sensor response delay and include the averaging done by whatever WB interface system you are using. You could get some idea of the K2 delay by estimating exhaust flow velocity and measuring pipe/ port lengths or by maybe using a spare port to energize a solenoid to squirt a small single shot of extra gas into the intake at a fixed time. You then datalog everything and measure how long it took from the time the solenoid was energized to when the extra gas showed up on the afr reading.
Automatic Mixture Control (AMC) allows MegaSquirt® to adjust the VE table based on the exhaust gas sensor without a laptop computer attached, much like OEM ECUs.
In the 'Settings/Ignition Options' dialog you can select the:
The missing tooth code uses the teeth of the missing tooth crank wheel to create 'tach teeth'. That is, it creates a tach signal from a particular tooth, then skips a number of teeth before declaring another tooth a tach signal. This means that all the tach teeth must correspond to real teeth. For a four stroke cycle engine, this means that the total number of teeth, including missing ones, must be evenly divisible by ½ the number of cylinders (or by the number of cylinder for a 2-stroke).
There is more information on the trigger wheel usage in the missing tooth trigger wheel decoder page.
The trigger wheel settings are:
| Bin | Voltage (V) | Duration (ms) | Comment |
| 1 | -4.0 | 2.0 | Increases dwell by 2.0 milliseconds at 8.0 Volts |
| 2 | -2.0 | 0.9 | Increases dwell by 0.9 milliseconds at 10.0 Volts |
| 3 | 0.0 | 0.0 | No compensation is applied at 12.0 volts |
| 4 | 2.0 | -0.5 | Decreases dwell by 0.5 milliseconds at 14.0 Volts |
| 5 | 4.0 | -0.9 | Decreases dwell by 0.9 milliseconds at 16.0 Volts |
In general, you should have small positive numbers in the negative bins, and small negative numbers in the positive bins. DO NOT rearrange the order of the voltage bins.
The -4.0 and -2.0 bins are useful for generating a good 'hot' spark for cranking. Note that normal running voltage is often about 14 volts, which in this case would remove 0.5 milliseconds. Be very careful not to put overly large numbers in these bins. You engine may now run at all or may run poorly with large negative numbers, and may burn out the coil with large positive numbers.
This table tells MegaSquirt-II how to position the IAC stepper motor at various temperatures. There are ten temperature bins. At start-up, MegaSquirt-II 'retracts' (opens) the stepper motor by the number of steps specified in the 'Idle Control/Start Value' field. The number specified in this table are how many steps the stepper closes when the coolant temperature reaches the specified temperature. So if you want the stepper to be completely closed at idle, you would set the last bin (160°F) to equal the start value.
For those that have PWM style idle valves (typically Ford, as well as others), this is the ten element table that specifies the duty cycle (in percent) at each of ten temperatures. Generally, higher temperatures require higher duty cycles.
This is the MAP table that is used for alpha-N fuelling computations when the hybrid alpha-N option is selected.
This lets the user define a 6-element table of barometric correction (based on either the initial MAP value, or a second baro MAP sensor value). A 6 point table of baro pressure vs a correction change will allow you to modify the baro correction equation for your particular car, compensating for things like exhaust size. With this you can take EGO feedback vs barometric data at various elevations or barometric pressures. From this you can determine the % additional/ less correction you need to get your AFR where you want it. This does require that you add a second MAP sensor for baro. But you should be able to tune the table to give you a very stable AFR at any altitude.
Some users have found that the ideal gas law calculation of air mass does not work especially well for them. This could be because the air entering the cylinder does not reflect the measured temperature. The MAT correction table lets the user define a 6-element table of MAT (intake air temperature) correction.
The concept of "X-Tau" compensation is very simple: for every squirt of the fuel injector, the majority of the fuel makes it into the cylinder, but some of the fuel from the squirt collects on the wall of the intake manifold and intake valve. In simplistic terms, a certain percentage of fuel (1-X) gets into the cylinder, the remainder sticks to the walls (X), hence the term 'wall wetting'.
The fuel that sticks to the walls eventually evaporates back into the airstream and is drawn into the cylinder. This is a time variable, call it Tau, which is the amount of time it takes to get the fuel clinging to the wall back into the cylinder.
Both X and Tau can be a function of RPM/MAP, coolant temp, etc. X value is pretty much constant but the Tau is a function of several parameters.
Note that if the injection pulse width is the same, and if it arrives with a fixed time interval (i.e. same RPM) then a equilibrium is reached where the amount of fuel sticking to the walls is in equilibrium with the wall film dissipating back into the airstream. However, a change in pulse width or a change in the time between injections upset this equilibrium, requiring an "adjustment" in the delivered fuel if one wants to compensate, hence the term "transient fuel compensation".
There is more on X-Tau here: www.megamanual.com/ms2/xtau.htm.
There are a number of user-configurable settings for X-Tau.
If X-Tau is enabled under 'Settings/General/X-Tau Usage', then you'll find the 12x12 Tau time table (rpm vrs. kPa) under 'Tables/X-Tau Settings'. In addition, there are:
This is a 10 element table that defines how tau changes as a function of coolant temperature.
This is a 10 element table that defines how tau changes as a function of intake air temperature.
If you have selected 'Table' for the 'Prime, ASE, WUE Tables' under 'Settings/General', then you can fill in a 10-element table for the priming pulse versus temperature (the pulse that occurs before MegaSquirt® receives an rpm signal) instead of linearly interpolating between two points.
If you have selected 'Table' for the 'Prime, ASE, WUE Tables' under 'Settings/General', then you can fill in a 10-element table for the cranking pulse width versus temperature (the pulse with that occurs while MegaSquirt® is in cranking mode, generally under 300 rpm) instead of linearly interpolating between two points.
If you have selected 'Table' for the 'Prime, ASE, WUE Tables' under 'Settings/General', then you can fill in a 10-element table for the afterstart enrichment (ASE) versus temperature (the percentage of additional fuel added when MegaSquirt® has transitioned from cranking mode to running mode) instead of linearly interpolating between two points.
If you have selected 'Table' for the 'Prime, ASE, WUE Tables' under 'Settings/General', then you can fill in a 10-element table for the afterstart enrichment (ASE) taper versus temperature (the number of cycles during which additional fuel is added when MegaSquirt® has transitioned from cranking mode to running mode) instead of linearly interpolating between two
All interpolation in MS uses table end points (NOT extrapolation) when the indexing value exceeds the limits of the table, but that fact is especially important when considering the computations of volumetric efficiency from the VE table. This means that if your biggest MAP bin contains 100%, then any MAP value over this will produce 100% (for a given RPM). This does NOT mean that the pulse width will be the same for MAP readings of 100 kPa and 200 kPa, the MAP value is used to scale the pulse width accordingly, so for this example you will get twice as much fuel.
To clarify how all these factors are used, the basic pulse width calculation (containing no enrichments, etc.) is.
Volumetric efficiency is a function of many factors (intake and exhaust tract design, camshaft lobe shape, and so on) but can be characterized very well for a given engine by MAP and RPM. I could go on about resonance and laminar flow, but it is sufficient to say that at low MAP (30 kPa), the VE is typically very poor due to turbulence effects, so VE is low (maybe 10-30%). At the MAP values 100 kPa and higher, the torque curve is a close reflection of the VE curve, so expect the VE values to peak at about the same point.
Very Important Note The VE values in MS do not reflect the true VE in your engine, since you usually do not want to run stoichiometric combustion in all operating regimes! They are a combined value giving the VE multiplied by any enrichments or enleanments that you desire. When your turbo motor is running at 250 kPa and has a true VE of 100% at 14.7:1 AFR, you would enter 111% to get 13.2:1 AFR.
The Required Fuel value determines the ideal pulse width at 100% VE. The entries in this table scale that value to determine the actual pulse width (neglecting all correction factors and enrichments). As such, both the required fuel and the VE table entries are more or less arbitrary, but it is useful to make them as close to correct as possible. In other words, if your required fuel value is 15.0 ms and the VE table entry being used is 100%, you could achieve the same pulse width with 10.0 ms and 150%, respectively. It is also important to understand that these VE values do not indicate the amount of fuel delivered over time. For example, if you have a row in the table that is 100% across the board, then fuel delivered is proportional to RPM. Say that the engine is running at 2500 RPM and the pulse width is 12.0 ms. If you speed the engine up to 5000 RPM the pulse width will remain at 12.0 ms, but this delivers twice as much fuel because there will be twice as many injection events in a given time interval.
The MAP bins define the range over which you can vary the VE values used for pulse width calculations. These values are in kPa (absolute) and can vary from 0 to 255 kPa; usually 0 to 100 for a naturally aspirated motor and 0 to max boost on a turbo- or supercharged one. The biggest value might be 100%, even for a turbo motor, IF you want the fuel at boost to be linearly proportional to MAP. Typically, though, you want some values above the 100 kPa value to add fuel as coolant when boosting. This might result in a table that looks like this: MAP VE (%) ... 100 80 150 100 200 100 250 120 4000 RPM to ensure that extra fuel is delivered when boost is applied. I've got no good way to determine spacing of the bin values, as I do for RPM bins, but read below and you can probably rationalize something. The MAP bins must be ordered from top to bottom in strictly ascending order (i.e., small ones on top, big ones on the bottom). The low value should be around 20 kPa and the top value should be around the maximum pressure that you expect your engine to see (100 kPa for NA motors, somewhat over max boost on a turbo- or supercharged motor to give yourself some headroom). The MAP bin values are stored in MS as "KPARANGEVE."
The RPM bins define the range over which you can adjust VE based on engine speed. If you have a representative torque curve for a motor like yours (ideally from a dyno run, but probably nearly as good from one of the many engine simulation packages available), you can set the spacing of these values from that. Find the places on the graph where the curve is "bending" the fastest (i.e., has big second derivatives; usually from idle to up near the torque peak) and use smaller RPM intervals over these. For long stretches where the curve is straight, but not necessarily horizontal, you can use bigger gaps in the bins. The reason for this is that the algorithm is going to do linear interpolation between these points (that is, it is going to play connect-the-dots), so you will have smaller error between bin points if you choose them well. It is usual to have the low end of the torque curve well represented, down to idle, and the top end should be somewhere near your redline value. For a street engine, the torque curve is usually dropping rapidly at redline, dictating that you have that top value up near redline. On a race motor, you are much nearer the torque peak, so will probably group the RPM bin values more tightly up there for finer control over the range of interest. The RPM bin values are stored in MS as "RPMRANGEVE."
These constants are derived from the:
1. Inputs Fill in all of the values (use your best estimate if you don't have measured numbers, but remember your table will only be as good as your estimates, and sometimes quite a bit worse).