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.