Stock ECU Closed Loop Wideband Control

All hardware related, disassembly / programming and code discussions belong here.
decipha
Posts: 4954
Joined: 2021 Feb 15, 12:23
Location: Metairie, LA
Vehicle Information: Work Truck
'19 F-150 3.3L

Stock ECU Closed Loop Wideband Control

Unread post by decipha »

Posting this here for any ideas anyone might have.

This is what my basic functioning is:

Code: Select all

---NOTES---
in closed loop the o2 controls fuel
in open loop the wideband corrects fuel

bank1 is narrowband
bank2 is wideband

OL only
wideband correction is lambse2 which saves to kamrf2 eventually


kamrf1 == saved cl data
kamrf2 == saved wb data





new code

ad,02,26           ldzbw R26,2            temp1l = 2;                       // "NUMEGO
28,4c              scall 9d3b0            FUEL_AIR_RATIO_CALC(); }
01 26		// clear R26
c3,27,b2,01,34     stw   R34,[R26+1b2]    [temp1l+f_a_ratio1] = tmp1l;
f0 		//return

////////////
need to replace this code --> 09ff1: a0,67,40           ldw   R40,R67          tmp7l = iego21;
jump to r40 decision
//////////////

wbo2 code

if (!initialized) {
if kam_stoich != kam_stoich_old // done for verification
if kam_stoich < stoich_max_lmt
if kam_stoich > stoich_min_lmt
  then {ful_stoic_af = kam_stoich}
  else ful_stoich_af == nominal_afr (scalar is default)
x=0
lam_old2 = 1
lam_ave2 = 1
set initialized=1 }



if ol_flg==0 // in closed loop else OL
vegobar21 == vegobar11
holdtime_hr2 = holdtime_hr1
hold_time2 = hold_time1
goto exit

;OL
if atmr1 < 15 do { // wbo2 crank delay for startup enrichment 
85802: c3,e8,62,00        stw   R0,[Re8+62]      holdtime_hr2 = 0;  //need to hold timers to 0 while in closed loop to prevent kamrf2 from updating
8580a: c3,e2,62,00        stw   R0,[Re2+62]      hold_time2 = 0;
}


:wideband
r38==iegr;	// a0,59,38           ldw   R38,R59          tmp3l = iegr;
r38 /4

if wbo2_x < 3 { // not ready just save and continue
wb_val[wbo2_x] = r38
wbo2_x++
} //goto continue 

else { // wbo2 is full and ready to update afr
wbo2_x=0
r38 += wb_old_val0
r38 += wb_old_val1 
r38 += wb_old_val2
// wbo2_fil== r38 already

do interpolate r38(input) for AFR conversion (wideband transfer)

wbo2_afr == 3c (output value)

if wbo2_afr > | < spk_lambse {
r40 =  // .2 [50] when lean and .7 [850] when rich as per wideband fuel error
vegobar21 == r40 // egoss[21] will count up on its own
}


:continue
if egoss[21] > 25 // inferred wb_warm from the switching {
if wot && apt != fuel_apt_lst { else goto continue2
then egoss[21] == 25 // reset counter to 25 for ethanol averaging 
goto next
}

:continue2
temp == lam_final1
if lam_final1 != lam_final1(last) then ful_stoic_af = kam_stoich * temp // no enrichment factored in
lam_final1(last) == temp
// above needed to set stoich_afr in OL for bank2 to have enrichment so lambse stays near 1 for kams to be correct
ful_stoic_af = inferred_afr
if lamave2 > | < 5% error then infer ethanol content based on % err

lookup function error vs stoich afr
stoich_afr == result of lookup

} }

:next



:exit
return // end of code



2,$0,0,0,$1061a,1,TOTAL _TRANSPORT DELAY TIME (ADAPTED + CALIBRATED),TD_SEC1,,x/(2^10),6

^^ for hego delay dial in

also need histogram and logging for bank2 to use the longer of the two

-1 0 1


1024
950
900
850
800
750
700
650
600
550
500
475
450
425
400
375
350
325
300
275
250
225
200
175
150
125

that leaves 12 bytes free

allow quick closed loop
if egoss11 > 8 or ego1 is rich for longer than 10 sec then allow c/l

if no wideband is present then use the narrowband to verify fuel error is null at wot and then allow enrichment.
Let me know if you have a better idea.
motorhead1991
Posts: 18
Joined: 2021 Feb 16, 01:22
Location: Caldwell, Idaho
Vehicle Information: 1990 Ford Ranger commercial:
2.3 turbo, FLH2 ECU, tuned with a Quarterhorse

1990 Ford Ranger Custom:
2.3 NA, e85 fed, Boport 1.5 NA grind cam, also tuned with a Quarterhorse.

Re: Stock ECU Closed Loop Wideband Control

Unread post by motorhead1991 »

I'll have to adapt this to a single sensor 4 banger strategy 🤣
decipha
Posts: 4954
Joined: 2021 Feb 15, 12:23
Location: Metairie, LA
Vehicle Information: Work Truck
'19 F-150 3.3L

Re: Stock ECU Closed Loop Wideband Control

Unread post by decipha »

thats what im writing it on

rzasa and kraf5
efloth
Posts: 274
Joined: 2021 Feb 15, 22:12
Location: Sacramento CA
Vehicle Information: 1991 F150 4.9L J1X 80lb Injectors E85
1995 F150 5.8L MOB1

Re: Stock ECU Closed Loop Wideband Control

Unread post by efloth »

Wow this is exciting. Just making sure I understand this: The wideband would not replace the narrowband o2. Would still need to delete egr to hook up wideband correct?

Any possibility of replacing the narrowband with a wideband? Reasons not to? Can't get away with deleting egr in California.
decipha
Posts: 4954
Joined: 2021 Feb 15, 12:23
Location: Metairie, LA
Vehicle Information: Work Truck
'19 F-150 3.3L

Re: Stock ECU Closed Loop Wideband Control

Unread post by decipha »

You dont delete egr it still functions 100% you just bypass the evp.

narrowband is multiplexed so it only accepts up to 1v
efloth
Posts: 274
Joined: 2021 Feb 15, 22:12
Location: Sacramento CA
Vehicle Information: 1991 F150 4.9L J1X 80lb Injectors E85
1995 F150 5.8L MOB1

Re: Stock ECU Closed Loop Wideband Control

Unread post by efloth »

Ok multiplexed In hardware I'm assuming so not feasible.

So bypassing evp would require disabling the egr function. It would likely fail n2o emissions testing in that case if running on gasoline.
decipha
Posts: 4954
Joined: 2021 Feb 15, 12:23
Location: Metairie, LA
Vehicle Information: Work Truck
'19 F-150 3.3L

Re: Stock ECU Closed Loop Wideband Control

Unread post by decipha »

why would you disable egr?
efloth
Posts: 274
Joined: 2021 Feb 15, 22:12
Location: Sacramento CA
Vehicle Information: 1991 F150 4.9L J1X 80lb Injectors E85
1995 F150 5.8L MOB1

Re: Stock ECU Closed Loop Wideband Control

Unread post by efloth »

Evp != Egr valve position sensor?
decipha
Posts: 4954
Joined: 2021 Feb 15, 12:23
Location: Metairie, LA
Vehicle Information: Work Truck
'19 F-150 3.3L

Re: Stock ECU Closed Loop Wideband Control

Unread post by decipha »

yeah that has nothing to do with the egr working correctly
PaulC-turbo5.0
Posts: 104
Joined: 2021 Feb 15, 21:56
Location: Lancaster New York
Vehicle Information: 1989 fox GT convertible
5.0 stock block, E7 heads, stock cam
Explorer GT40 intake flipped to driver side inlet
Single 67mm On3 BB turbo
Flipped JBA headers, custom SS 2.5" hotside built by me
custom 3" coldside thru On3 intercooler
tuning with Moates QH + TPRT
Dechipa's GUFX and supporting files, couldnt have tuned it myself without him!

Re: Stock ECU Closed Loop Wideband Control

Unread post by PaulC-turbo5.0 »

I’m confused as well. When you log the WB I thought you disconnect the egr for the meantime? Doesn’t the evp signal tell the egr valve what to do?

Would this make it to gufx?

Also why is this beneficial? Aren’t the NB o2’s always better and more accurate?
Post Reply