Toyota GR86, 86, FR-S and Subaru BRZ Forum & Owners Community - FT86CLUB

Toyota GR86, 86, FR-S and Subaru BRZ Forum & Owners Community - FT86CLUB (https://www.ft86club.com/forums/index.php)
-   Software Tuning (https://www.ft86club.com/forums/forumdisplay.php?f=88)
-   -   Open Source Flex Fuel (https://www.ft86club.com/forums/showthread.php?t=94751)

ztan 11-11-2015 08:19 AM

Coding for Ethanol based scalings
 
1 Attachment(s)
Coding for Ethanol based scalings (A01G ROM base)

The code below returns and stores a few values based on ethanol content; will describe how to modify ROM and do cranking comp to use these later on:

The clutch switch has been added to use as a failsafe in case the code added after is no good for testing purposes so fewer ECUs get bricked - the code only executes if clutch is depressed. Change the "branch if true" instruction at B97E6 to "00 09" (nop) to turn this switch off.

Initially the ethanol value in fr9 in passed to fr4 and this value is limited by the Check_Bounds routine at 011260 (max value in fr6 and min value in fr5)

The value returned in fr0 (Ethanol content) is stored to RAM_Ethanol and a Fuelling Multiplier is looked up from that table (E0=1.00, E85=1.40 in linear scale)

This value is used to multiply the PI Injector Flow Scaling BRZ value for Port injector operation and a GDI multiplier that works on GDI pressure multiplier tables A and B (I call this GDI multiplier C).

An interpolating value is then looked up in a table to scale between 2 Primary OL fuelling tables (E0=0.00, E85=1.00).

A further interpolating value is looked up for use between 2 base timing tables (E0=0.00, E85=1.00) which are then added to the Knock Correction advance table which remains un-modified. This interpolation value is multiplied by the AVCS active value (0.00 = AVCS not active (looks up Base Timing A), 1.00 = AVCS active (looks up Base Timing B) to use the E0 map as a AVCS inactive map also.

Theoretical table values input in image below. Please feel free to contribute data to discussion as to how best to scale these multipliers or interpolants to hit optimal fuelling and MBT with the 12.5:1 compression ratios with or without boost.


Code:

000B97DE
000B97DE            Check_Clutch:
000B97DE 02 80 93 9B                movi20  #RAM_Clutch_SW, r2
000B97E2 60 20                      mov.b  @R2, r0
000B97E4 88 00                      cmp/eq  #0, r0          ; Clutch out = 0 (A33-15=12V)
000B97E4                                                    ; Clutch depressed = 1 (A33-15=GND)
000B97E6 89 2A                      bt      loc_B983E
000B97E8
000B97E8            FlexFuel_Scalings:
000B97E8 F4 9C                      fmov    fr9, fr4
000B97EA F5 8D                      fldi0  fr5
000B97EC D2 39                      mov.l  #Check_Bounds, r2
000B97EE D6 36                      mov.l  #Ethanol_Max, r6
000B97F0 42 0B                      jsr    @R2 ; Check_Bounds
000B97F2 F6 68                      fmov.s  @r6, fr6
000B97F4 D8 2C                      mov.l  #RAM_Ethanol, r8
000B97F6 F8 0A                      fmov.s  fr0, @R8
000B97F8 02 10 13 88                movi20  #Pull_2D_A, r2
000B97FC F1 0C                      fmov    fr0, fr1
000B97FE F4 1C                      fmov    fr1, fr4 ; Pull_2D_A
000B9800 D4 38                      mov.l  #Ethanol_Fuelling_Comp_Table, r4
000B9802 42 4B                      jsr/n  @R2 ; Pull_2D_A
000B9804 D4 29                      mov.l  #RAM_Fuelling_Multiplier, r4
000B9806 F4 0A                      fmov.s  fr0, @r4
000B9808 D6 30                      mov.l  #Injector_Flow_Scaling_BRZ, r6
000B980A F6 68                      fmov.s  @r6, fr6
000B980C F6 02                      fmul    fr0, fr6
000B980E D4 28                      mov.l  #RAM_Flex_PI_Scaling, r4
000B9810 F4 6A                      fmov.s  fr6, @r4
000B9812 D6 2F                      mov.l  #GDI_Pressure_Multiplier_C, r6
000B9814 F6 68                      fmov.s  @r6, fr6
000B9816 F6 02                      fmul    fr0, fr6
000B9818 D4 26                      mov.l  #RAM_Flex_GDI_Mult_C, r4
000B981A F4 6A                      fmov.s  fr6, @r4
000B981C 02 10 13 88                movi20  #Pull_2D_A, r2
000B9820 D4 31                      mov.l  #Ethanol_Fuelling_Interp_Table, r4
000B9822 42 0B                      jsr    @R2 ; Pull_2D_A
000B9824 F4 88                      fmov.s  @R8, fr4
000B9826 D4 25                      mov.l  #RAM_Flex_Fuelling_Interpolant, r4
000B9828 F4 0A                      fmov.s  fr0, @r4
000B982A D4 30                      mov.l  #Ethanol_Timing_Interp_Table, r4
000B982C 02 10 13 88                movi20  #Pull_2D_A, r2
000B9830 42 0B                      jsr    @R2 ; Pull_2D_A
000B9832 F4 88                      fmov.s  @R8, fr4
000B9834 D4 22                      mov.l  #RAM_Flex_Timing_Interpolant, r4
000B9836 D2 23                      mov.l  #RAM_AVCS_Timing_Interp, r2
000B9838 F2 28                      fmov.s  @R2, fr2
000B983A F2 02                      fmul    fr0, fr2
000B983C F4 2A                      fmov.s  fr2, @r4
000B983E
000B983E            loc_B983E:                              ; CODE XREF: sub_B97C0
000B983E                                                    ; sub_B97C0
000B983E 4F 26                      lds.l  @r15+, pr
000B9840 00 6B                      rts/n

000B98A4 FF F8 93 9B off_B98A4:      .data.l RAM_Clutch_SW  ; DATA XREF: sub_B97C0:Check_Clutch
000B98A8 FF F8 D4 10 off_B98A8:      .data.l RAM_Ethanol    ; DATA XREF: sub_B97C0
000B98AC FF F8 D4 14 off_B98AC:      .data.l RAM_Fuelling_Multiplier
000B98AC                                                    ; DATA XREF: sub_B97C0
000B98AC                                                    ; sub_B97C0
000B98B0 FF F8 D4 18 off_B98B0:      .data.l RAM_Flex_PI_Scaling ; DATA XREF: sub_B97C0
000B98B4 FF F8 D4 1C off_B98B4:      .data.l RAM_Flex_GDI_Mult_C ; DATA XREF: sub_B97C0
000B98B8 FF F8 D4 20 off_B98B8:      .data.l RAM_Flex_Crank_Comp ; DATA XREF: sub_B97C0
000B98BC FF F8 D4 24 off_B98BC:      .data.l RAM_Flex_Fuelling_Interpolant
000B98BC                                                    ; DATA XREF: sub_B97C0
000B98C0 FF F8 D4 28 off_B98C0:      .data.l RAM_Flex_Timing_Interpolant
000B98C0                                                    ; DATA XREF: sub_B97C0
000B98C0                                                    ; sub_B97C0
000B98C4 FF F8 AD B8 off_B98C4:      .data.l RAM_AVCS_Timing_Interp
000B98C4                                                    ; DATA XREF: sub_B97C0
000B98C8 00 0B 98 DC off_B98C8:      .data.l Ethanol_Max    ; DATA XREF: sub_B97C0
000B98CC 00 10 C6 80 off_B98CC:      .data.l Injector_Flow_Scaling_BRZ
000B98CC                                                    ; DATA XREF: sub_B97C0
000B98D0 00 10 C6 14 off_B98D0:      .data.l GDI_Pressure_Multiplier_C
000B98D0                                                    ; DATA XREF: sub_B97C0
000B98D4 00 01 12 60 off_B98D4:      .data.l Check_Bounds    ; DATA XREF: sub_B97C0
000B98D4                                                    ; sub_B97C0
000B98D8 FF FF FF FF                .data.l h'FFFFFFFF
000B98DC 42 AA 00 00 Ethanol_Max:    .float 85.0            ; DATA XREF: sub_B97C0
000B98DC                                                    ; ROM:off_B98C8
000B98E0 00 0B 99 10 off_B98E0:      .data.l Ethanol_Cranking_Comp_Table
000B98E0                                                    ; DATA XREF: sub_B97C0
000B98E4 00 0B 99 24 off_B98E4:      .data.l Ethanol_Fuelling_Comp_Table
000B98E4                                                    ; DATA XREF: sub_B97C0
000B98E8 00 0B 99 38 off_B98E8:      .data.l Ethanol_Fuelling_Interp_Table
000B98E8                                                    ; DATA XREF: sub_B97C0
000B98E8                                                    ; sub_B97C0
000B98EC 00 0B 99 4C off_B98EC:      .data.l Ethanol_Timing_Interp_Table
000B98EC                                                    ; DATA XREF: sub_B97C0


thambu19 11-11-2015 10:21 AM

@ztan
Any reason you chose to use the DI fuel pressure signal instead of the injector PW to mass scaling like you plan to do for PFI?

Kodename47 11-11-2015 10:53 AM

Quote:

Originally Posted by thambu19 (Post 2448071)
@ztan
Any reason you chose to use the DI fuel pressure signal instead of the injector PW to mass scaling like you plan to do for PFI?

Because it's probably the simplest way and is in effect doing the same thing. Have you looked at how to change direct injection PW yet?

ztan 11-11-2015 06:14 PM

Quote:

Originally Posted by thambu19 (Post 2448071)
@ztan
Any reason you chose to use the DI fuel pressure signal instead of the injector PW to mass scaling like you plan to do for PFI?

The logic behind GDI quantity is not entirely teased out, but the value that I chose for GDI scaling is a single one that acts on both GDI pressure multiplier tables.

Previous open source E85 implementations have multiplied the result in the GDI pressure multiplier tables A and B (Axes are engine load and fuel pressure) to come up with a value that, I understand, approximates DI quantity. I did disassemble the ROM to find the derivation of the axes in another post: http://www.ft86club.com/forums/showthread.php?p=2387636

The value from the GDI pressure multipliers A and B then gets multiplied by a scaling factor (GDI pressure multiplier C which I am using to scale for E85). I believe that this is the scaling factor that changes the number from a fuel quantity to a pulsewidth value.

This raw DI pulsewidth value is then passed to the GDI flow rate table which is what is used to finalize the DI pulsewidth (compensations for quantity on one axis and fuel pressure on the other).

thambu19 11-11-2015 06:41 PM

Quote:

Originally Posted by ztan (Post 2448568)
The logic behind GDI quantity is not entirely teased out, but the value that I chose for GDI scaling is a single one that acts on both GDI pressure multiplier tables.

Previous open source E85 implementations have multiplied the result in the GDI pressure multiplier tables A and B (Axes are engine load and fuel pressure) to come up with a value that, I understand, approximates DI quantity. I did disassemble the ROM to find the derivation of the axes in another post: http://www.ft86club.com/forums/showthread.php?p=2387636

The value from the GDI pressure multipliers A and B then gets multiplied by a scaling factor (GDI pressure multiplier C which I am using to scale for E85). I believe that this is the scaling factor that changes the number from a fuel quantity to a pulsewidth value.

This raw DI pulsewidth value is then passed to the GDI flow rate table which is what is used to finalize the DI pulsewidth (compensations for quantity on one axis and fuel pressure on the other).

Awesome! Thanks for taking the time to explain it. So with this changed we do not have to rescale the MAF for E85 if I am not mistaken.
From experience the MBT spark timing does not shift so much for E85 to command any attention. It is just the actual spark timing that shifts. Some OEMs have MBT spark timing as a table in the ECU which makes it easy for tuners to tune for E85 because you just have to make the Base spark = MBT spark.

steve99 11-11-2015 07:58 PM

@ztan

So theoreticly on an A01G rom i could test this without a flex kit by making up a simple circuit to feed in 0 to 5 volts onto the evap input pin.

Or just a switchable voltage divider with say 0 ,2.5 and 5 v and effectivly map switch between E85 e40 and petrol.

assume you have added an extra Base TimingB and OL fuel map somewhere ?

Shiv@Openflash 11-12-2015 12:28 AM

ztan is a freakin' rock star :party0030:

ztan 11-12-2015 03:18 AM

Quote:

Originally Posted by steve99 (Post 2448676)
@ztan

So theoreticly on an A01G rom i could test this without a flex kit by making up a simple circuit to feed in 0 to 5 volts onto the evap input pin.

Or just a switchable voltage divider with say 0 ,2.5 and 5 v and effectivly map switch between E85 e40 and petrol.

assume you have added an extra Base TimingB and OL fuel map somewhere ?

Yes.
All to be revealed after more testing etc... but in short:

Base Timing A only gets used when AVCS off. FFF8ADB8 reads 0 when inactive (after ECU reset for a couple of minutes) and 1.0 when AVCS active. The value at FFF8ADB8 is use to interpolate between Base Timing A and Base Timing B. My plan is to hijack Base Timing A as E0 and Base Timing B as E85.

Primary OL Fueling map is added to by the OL Fueling additive map on the basis of IAM value (no additive applied when IAM = 1.0, full additive when IAM=0.0). I am going to assume, rightly or wrongly, that folks who are applying this have the nouse to be monitoring IAM and that IAM will not drop far enough below 1.0 to require extra fuel. Hence I would plan to use Primary OL Fueling map for E85 and OL Fueling additive map for E0 with above interpolant values.

It would be quite easy to add in completely new tables for the above, but this is the way I am thinking.

ztan 11-12-2015 03:27 AM

Quote:

Originally Posted by thambu19 (Post 2448588)
Awesome! Thanks for taking the time to explain it. So with this changed we do not have to rescale the MAF for E85 if I am not mistaken.
From experience the MBT spark timing does not shift so much for E85 to command any attention. It is just the actual spark timing that shifts. Some OEMs have MBT spark timing as a table in the ECU which makes it easy for tuners to tune for E85 because you just have to make the Base spark = MBT spark.

No MAF rescaling needed - we have reasonably good fuel control, although a little more complex due to having DI and PI systems to understand, and there are a lot of compensations applied to these values which are not clearly defined.

Unfortunately MBT spark is not visible in the ROM that I can find. I assume Shiv's E85 NA ROM will be pretty close on the money and hopefully we get some more data on where MBT lies higher in the load range on boosted engines in the future.

steve99 11-12-2015 09:26 AM

@ztan

For E85 cranking @Wayno s tables are very reliable even on united E85

E85 Cranking changes

0C/32F stock values multiplied x 1.5
10C/50F stock values multiplied x 2.0
20C/68F stock values multiplied x 2.0
30C/86F stock values multiplied x 1.3
40C/104F stock values multiplied x 1.2
50C/122F stock values multiplied x 1.1
60C/140F stock values multiplied x 1.05


http://www.ft86club.com/forums/attac...1&d=1442118398



For Dash fuel display multiply be 33% ie same ratio as GDI pressure multiplier offset or PI injector scaling offset.

http://www.ft86club.com/forums/attac...1&d=1442115733

ztan 11-12-2015 04:23 PM

Quote:

Originally Posted by steve99 (Post 2449144)
@ztan

For E85 cranking @Wayno s tables are very reliable even on united E85

E85 Cranking changes

0C/32F stock values multiplied x 1.5
10C/50F stock values multiplied x 2.0
20C/68F stock values multiplied x 2.0
30C/86F stock values multiplied x 1.3
40C/104F stock values multiplied x 1.2
50C/122F stock values multiplied x 1.1
60C/140F stock values multiplied x 1.05

Thanks, and thanks for the donation mate.

My idea is to hijack the IAT cranking compensation table (returns 1.0 across the board for all IAT values) part of the routine and use that as an ECT cranking compensation. This sits just below the accel cranking compensation in the code (the latter table returns 0.0 when the accelerator is fully down when cranking and no fuel is delivered).

I am thinking:
We want a cranking multiplier of 1.0 with E0 and ECT compensation to be applied with higher E%, based on the Flex scaling multiplier.

One way to do the maths is to return a multiplier of 1.0+((Flex scaling multiplier - 1.0)*ECT cranking multiplier). At E85 with a Flex scaling multiplier of 1.4, this would give us a cranking multiplier of 1.4 at 20C with the table that I posted in post #15. A table value of 2.5 would return 2.0 as a cranking multiplier.

ztan 11-12-2015 04:27 PM

Quote:

Originally Posted by steve99 (Post 2449144)
For Dash fuel display multiply be 33% ie same ratio as GDI pressure multiplier offset or PI injector scaling offset.

http://www.ft86club.com/forums/attac...1&d=1442115733

This one is easy - get the normal table return and multiply it by the Flex scaling multiplier. The code would involve hooking the table lookup, scaling with multiplier and returning with all the values in the expected registers.

steve99 11-12-2015 09:24 PM

Quote:

Originally Posted by ztan (Post 2449587)
Thanks, and thanks for the donation mate.

My idea is to hijack the IAT cranking compensation table (returns 1.0 across the board for all IAT values) part of the routine and use that as an ECT cranking compensation. This sits just below the accel cranking compensation in the code (the latter table returns 0.0 when the accelerator is fully down when cranking and no fuel is delivered).

I am thinking:
We want a cranking multiplier of 1.0 with E0 and ECT compensation to be applied with higher E%, based on the Flex scaling multiplier.

One way to do the maths is to return a multiplier of 1.0+((Flex scaling multiplier - 1.0)*ECT cranking multiplier). At E85 with a Flex scaling multiplier of 1.4, this would give us a cranking multiplier of 1.4 at 20C with the table that I posted in post #15. A table value of 2.5 would return 2.0 as a cranking multiplier.

Their is also another Cranking compensation table relative to Intake Air Temp, in stock roms its all zero.

It might be easier to rescale and offset the IAT vs Cranking IPW table rarther than the cranking Vs Coolant tables.

have you seen kodename47 defs he has intergrated the opensource stuff with Ecutek stuff
http://www.ft86club.com/forums/showp...&postcount=411

ztan 11-12-2015 11:55 PM

Quote:

Originally Posted by steve99 (Post 2449939)
Their is also another Cranking compensation table relative to Intake Air Temp, in stock roms its all zero.

I use Kodename47s defs which get modified each time I disassemble something that makes more sense in my head. I haven't actually kept track of which tables I've altered and which I haven't...

That IAT cranking compensation table that reads 0.0 in Kodename47's def means 0% compensation applied. When looking at the disassembly and running that bit of code through the HEW simulator, that table returns a value of 1.0 (scaling factor 1.0 = 0% compensation). I changed my def to suit as well as started thinking in terms of scaling factors rather than % compensation.


All times are GMT -4. The time now is 07:32 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
User Alert System provided by Advanced User Tagging v3.3.0 (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.


Garage vBulletin Plugins by Drive Thru Online, Inc.