View Single Post
Old 06-12-2009, 12:26 PM   #40 (permalink)
rmccomiskie
EcoModding Lurker
 
Join Date: Aug 2008
Location: Massachusetts USA
Posts: 84

Ziggy - '95 Audi S6 Sedan

Manfred - '97 Audi A6 Quattro Sedan
90 day: 20.61 mpg (US)

Clarabell - '03 Audi A4 Quattro Avant

Sherman - '98 Audi A6 Quattro Avant

Cab - '96 Audi Cabriolet
Thanks: 0
Thanked 2 Times in 2 Posts
High MPG When Coasting

I've resolved the high MPG reading when coasting. It turns out that the ECU shuts off the injectors when coasting. The injector signal from the ECU is normally negative going. However, when the injectors are shut off, there's still a very small positive spike for each injector pulse. MPGuino inadvertently interprets the small spikes as verrry long injector on pulses. The behavior is observed as an instantaneous jump to a very high MPG value after a couple of seconds of coasting.

I've made the following code mod to fix this behavior.

Code:
//This code resolves very high MPG values when coasting (1997 Audi A6)
//Based on MPGuino v0.75
//Injector signal taken from ECU, negative going signal, injectors shut off when coasting
//Adds pulse width limit parameter = 4000
//Assume any pulse width greater than the limit is invalid and sets it to zero
//Results: Out of range pulsewidths are never added to total injector open time

//insert new parameter, in this case "PW Lim", 4000ul for Audi A6

unsigned long  parms[]={69ul,13406ul,128900000ul,6ul,420000000ul,19800ul,72ul,4097ul,0ul,2ul,4000ul};//A6 defaults w/ECU signal
char *  parmLabels[]={"Contra","VSSPPM", "uS/gal","P/2rev","Timout","Tk Gal","iDeluS","WgtLbs","Scrach","VSSdel","PW Lim"};

//define new parameter

#define pulsewidthLimit 10  //insert new parameter

//modify processInjClosed() routine

void processInjClosed(void){      
  unsigned long t = microSeconds();
  unsigned long s = parms[injectorSettleTimeIdx];
  unsigned long pwLimit = parms[pulsewidthLimit];
  unsigned long x = elapsedMicroseconds(injHiStart, t);
  
  if (x >= s && x < pwLimit) {  //if elapsed time > settling time and < upper threshold
    x -= s;                     //then normal pulse, subtract settling time
  }else{
    x = 0;                      //otherwise pulse width out of range and assumed to be zero
  }
  
  tmpTrip.injHius += x;       
  tmpTrip.injPulses++;      

  if (tmpInstInjStart != nil) {
    tmpInstInjTot += x;     
    tmpInstInjCount++;
  } else {
    tmpInstInjStart = t;
  }
  tmpInstInjEnd = t;
}
I determined the 4000 uSec pulsewidth limit for my car by creating a display screen that showed the currently measured pulsewidth. I observed that the maximum normal pulsewidth was below 3000 uSec and that it would jump immediately to about 10000 uSec when coasting. So, I set my limit to 4000 uSec. Anything greater than that is assumed to be invalid and the pulse is ignored, i.e. set to zero.
  Reply With Quote