![]() |
Open source Hybrid Speed Density
1 Attachment(s)
Hybrid speed density implementation. This has worked for me; use at your own risk. Each SD table will need to be scaled individually for your own unique intake/FI/engine/AVCS/exhaust profile. I'm happy to share my work, but am not a software engineer, pro tuner, or automotive engineer.
My implementation works on the A01G ROM (not the OFT ones, as the ROM hole is used in the OFT ROMs with FFS/LC). Addresses I use are specific to this ROM - don't apply to yours if you don't know what you are doing. Someone who knows how to patch ROMS or use HEW properly may be able to use this info to develop more elegant code or incorprate into Merp's Merpmod work. I have come up with the following SD implementation. The sensors on the 86/BRZ are read in batches, the subroutine which sends the MAF voltage to the 54x1 MAF sensor scaling table is clumped in with reading of other sensors (IAT, ECT, etc...). To find out how this was processed, I looked at the ROM using IDA and HEW tools - lots of info on the RomRaider site on how to use them from dschultz, merp, Td_d, NSFW and others. Data on how our Renesas SH72531 works downloadable from their site: http://www.renesas.com/products/mpum...umentation.jsp If you find this useful, please consider contributing back to open source tuning efforts by sharing your SD maps with data on your car as well as AVCS/VVT timing details as these affect VE significantly. I would prefer that this code is not incorporated into locked tunes. Now to making the hack: Finding the MAF lookup subroutine. Looking in the ROM for where the MAF sensor scaling table is addressed is the first step. The MAF table pointer is located at 0B86E0 which is in turn listed in a cluster of pointers at 010DF8. This last list is referenced in the subroutine at 02B0D6. Looking at the stock subroutine at 2B0D6: Code:
ROM:0002B0D6 loc_2B0D6: ; CODE XREF: sub_2B0A2+28jBecause the sensor data is pulled in a batch, we need to put a hook into the subroutine. Unfortunately, the data is all indirectly referenced and you can't simply divert a subroutine by address just in case the address value is also referenced by another subroutine. My solution was to take out the block of code at 2B0D6 and move it into a ROM hole. Replacement code at 2B0D6: Code:
ROM:0002B0D6 ; ---------------------------------------------------------------------------The next bit of code is essentially the original code from 2B0D6 which looks up all the values from the appropriate sensor tables then continues on to the speed density code if r13 = 08 and returns directly if not with the return value stored in fr0 and fr9: Code:
ROM:000B91B0The next section operates in the following way: MAF sensor data from the MAF sensor scaling table written to FFF8D400. SD data (in g/s) looked up from a 3D table using MAP as an x-axis and RPM as a y-axis, stored in FFF8D404. I used a straight RPM/MAP to mass flow conversion table rather than full VE conversion to simplify code. SD data (in g/s) compensated for IAT and stored in FFF8D408. MAF sensor checked against 2 thresholds and stored in FFF8D40C: 100% MAF applied below threshold A 100% SD applied below threshold B a Blend of MAF and SD between the values based on how far between the thresholds the sensor value is. Code:
ROM:000B91C8 D6 1E mov.l #h'FFF8D400, r6Code:
ROM:000B9230RomRaider def additions: Code:
<table name="Speed Density MAF" storageaddress="B9360"> |
1 Attachment(s)
Early test with low threshold set at 40, high threshold set at 160, best guess figures based on data from Bill from Delicious Tunings SD thread.
First plot is MAF sensor (FFF8D400) vs raw table output (FFF8D404). Values a bit high between 100-225 g/s. Second plot is MAF sensor vs value compensated for IAT (FFF8D408). Slightly better, but still a bit high between 125-200 g/s and low over 200 g/s. Third plot is the value for hybrid blended MAF (FFF8D40C). You can see the interpolation working over 40g/s but due to the errors low in the range for this map, would be better having a low threshold at 120 or 160. This is done in test mode so final figure can be logged and SD map built without actually applying it. |
1 Attachment(s)
Using a SD Map building script, thresholds are settable for how many data points are needed per MAP/RPM cell to make sure data is not highly skewed:
First plot is MAF sensor data which has been put into MAP/RPM bins and nomalized to 20 degrees Celsius based on IAT sensor data. Second and third plots are closed loop and open loop trims respectively. Last plot is final SD map values having applied an average of the CL and OL trims. Due to the nature of logged data, some of the values will not make sense and need to be discarded. |
Awesome work ztan! Any plans to work on open source flexfuel code?
|
Quote:
However, what I would anticipate being needed: E% read Hooks being put into port injector scaling, GDI pressure multiplier, timing table, and fuel table reads. Interpolatation between normal gas and E85 tables for all the above. Means to compensate for cranking fuelling based on E% - probably a simple multiplier rather than interpolating all the tables. |
Quote:
|
Quote:
For example, can we just use one table for E0 and one for E85 and interpolate (linear or otherwise) timing for E20 at all load/RPM cells, or would we need to look up in a 3D matrix of E%/load/RPM for timing? |
Quote:
-Injector Flow Scaling -Base Timing B -GDI pressure multipier A -GDI pressure multipier B There are also some other tables that would benefit from this approach (cranking and individual cylinder ignition trims for instance) but I think we may be able to compensate for that some other ways. This is exciting stuff! Your a huge resource ztan! |
I love these open-source projects. Really shows what these ECU's are capable off.
I'm very interested in seeing your further developments. Keep up the good work ztan :) I've also added your tables to Kodename47's definitions. If anyone wants to open up your rom in RomRaider. Download them Here. Too bad I don't know anything about programming or tuning. |
Quote:
Base Timing B and Pressure multipliers are easier: they only get looked up once directly. PI Injector Flow Scaling is more complex, as it gets referenced quite a few times in different subroutines. Possibly the way to get around that is to change all the flow scaling references to point to a RAM address for scaling and make subroutine to store the PI flow scaling calculation to RAM at the end of a GDI scaling or timing interpolation routine. |
Quote:
Please do not apply tables to different ROM calibrations especially if the tables don't look like they make sense. I would also highly recommend that you log all the new RAM variables in test mode and build your own SD map for your own car and AVCS settings before touching the real life switch. |
Other ROM calibration users (A02C, A00C, A01C, B01C...) who are interested:
Can you log the following RAM addresses and let us know if they are actively used in your car (should log 0 for all values under all conditions if not): Code:
paramname = MAF_Sensor |
Quote:
It looks like it could be rescaled to be more usefull. Then a simple multiplier applied to that table based on ethanol percent, should be easier than adjusting the whole set of cranking pulse tables. |
Quote:
Quote:
|
| All times are GMT -4. The time now is 07:52 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
User Alert System provided by
Advanced User Tagging v3.3.0 (Lite) -
vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.