Tag Archives: gnuplot

ScoobyRom v0.8.2 Released

What’s new in v0.8.2:
  • Export as TunerPro XDF format.
  • Support for ROM type SH72531 (1.25 MiB = 1280 KiB size)
  • Display Reflash Count if known/available (Properties-window).

Project homepage: ScoobyRom Software

Properties

Already implemented in previous version is the ability to parse and display ROM Date (year-month-day), diesel as well as petrol type encodings. May not work for all ROM types (yet), though. AFAIK, ScoobyRom is the only software parsing this Denso specific date.

ScoobyRom 0.8.2 - Properties window, CID JZ4A211B

ScoobyRom 0.8.2 – Properties window, CID JZ4A211B

TunerPro (XDF)

Due to my intense work on BMW ECUs in recent years, I got familiar with TunerPro which is a generic ROM editor. It is quite popular in the BMW community, it can handle lots of data format options. Its definition format “XDF” is XML-based as usual. As an exercise to verify XDF knowledge I implemented XDF output in ScoobyRom.

Compared to RomRaider, reading an XDF containing hundreds of tables is very fast, almost instant. TunerPro is Windows-only and closed-source however.

TunerPro 5.00.8853 screenshot, Windows 10 x64, XDF generated by ScoobyRom

TunerPro 5.00.8853 screenshot, Windows 10 x64, XDF generated by ScoobyRom

ScoobyRom v0.8.0 Released

New in v0.8.0:
  • Navigation bar visualisation.
  • Additional columns (conversion: Multiplier & Offset or NaN if not used; Axes locations: XPos, YPos)
  • Select all/none
  • RomRaider definitions export: choose whether to export all/selected/annotated tables.
  • Roughly 3 times faster when scanning whole ROM.
  • Lots of misc improvements in code at least…

Go to homepage: ScoobyRom Software
Post software specific feedback there, please!
Also, if you find this software useful consider to “like” above page as minimum feedback and motivation for future work!

ScoobyRom v0.7.1 Released

New in v0.7.1:
  • Dynamically adjust icon size (Ctrl-+, Ctrl--, Ctrl-0)
  • Edit -> Copy Table: Can paste values into existing RomRaider table, spreadsheet (LibreOffice Calc, Microsoft Excel), text editor etc.
  • Miscellaneous improvements as always.
  • Also tested on Windows 10, no changes were necessary.

Go to page: ScoobyRom Software
Enjoy and provide software specific feedback there, please!

ScoobyRom v0.7.0 Released

Go to page: ScoobyRom Software

Enjoy and provide software specific feedback there, please!

Fuel Level

Introduction

On Euro 4/5 diesel models fuel level is being measured by BIU and sent onto CAN-bus as sensor resistance value in ohms (Ω). The ECU parses this and does some processing. First it calculates artificial fuel level voltage using standard voltage divider formula. Voltage value is being damped because the source info fluctuates a lot with fluid moving. Then the damped result is being used for LUT (Lookup table).

Euro 6: fuel level is being digitized by combination meter.

Tables (2D Maps)

So far all Euro 4 diesel ROMs contain this table:

Fuel Tank Level, 2D table, Euro 4, CID: JZ2F441A, ScoobyRom screenshot

Fuel Tank Level, 2D table, Euro 4, CID: JZ2F441A, ScoobyRom screenshot

From Euro 5 ROMs, slightly different:

ScoobyRom screenshot portion, viewing 2D table, Euro 5 diesel ROM CID JZ4A211B

Fuel Tank Level, 2D table, Euro 5, CID: JZ4A211B, ScoobyRom screenshot

Math

Did some work using GNU Octave – import table data (ScoobyRom export as CSV), applying formulas, plot (gnuplot backend) – all on GNU/Linux of course. Btw, Octave comes with built-in interpolation functions.

“The Octave language is quite similar to Matlab so that most programs are easily portable.”
Example Octave formula:


function retval = FuelLevelVoltage (R1, R2, Vin)
         retval = Vin * R2 / (R1 + R2)
endfunction


For above voltage divider, where:

  • Vin: Battery Voltage (assumed const in this case)
  • R1: const series resistor
  • R2: variable fuel level resistance (two sensors in series)
  • Vout: fuel level voltage (artificial ECU value in this case)

This way I eliminated ECU’s artificial fuel level voltage, creating direct relationship between resistance [ohm] (CAN value) and volume [litre].

Results: volume [litre] vs. resistance [ohm]

Euro 4

Fuel Level vs. Resistance (Euro 4)

Euro 5

(to do…)

Diagnostic Trouble Codes

DTCs are triggered when (artificial) fuel level voltage is outside range. As usual it’s not that simple, many conditions may affect this, too – battery voltage, CAN state etc.

  • P0462 Fuel Level Sensor Circuit (Low Input)
  • P0463 Fuel Level Sensor Circuit (High Input)

gnuplot Power Graph

Created gnuplot script file which plots 2.0D 110 kW power graphs out of two CSV files (torque & power). For CSV data origin see post Power graphs and Calculations. gnuplot experience might come handy from time to time…

Script + data files in here: gnuplotPowerGraph1.zip

By the way, thanks go to http://www.pariaonecu.com for file hosting support.

Tested on Linux, script file displays graph on screen, also creates SVG vector graphics file.
View SVG result (best, good web browser needed): PowerGraph(Subaru).svg

Raster screenshot in case you cannot view SVG:

Assuming gnuplot is installed. To run script type:
gnuplot -p 'PowerGraph(Subaru).gpl'


# gnuplot script
# Linux: gnuplot -p "thisscriptfilename"
# -p  --persist		to keep graph window

# set custom variables
fileTorque = "Torque(Subaru).csv"
filePower = "Power(Subaru).csv"
color1 = "blue"
color2 = "brown"
plotFile = "PowerGraph(Subaru).svg"

# debug: show variable content
#print fileTorque

# necessary for CSV data, input file contains comma-separated values fields
set datafile separator ","

###### terminal settings
set termoption enhanced
set term wxt font "sans,14"

###### title, labels
set title "Boxer Diesel 2.0 110 kW Power Graphs (digitized official Subaru data)"

set xlabel "Engine Speed [1/min]"
set xrange [800 : 4700]	# optional

set ylabel "Torque [Nm]" textcolor rgb color1
set y2label "Power [kW]" textcolor rgb color2

###### define linestyles
#
# 1: Torque curve
set style line 1 linetype 1 linecolor rgb color1 linewidth 3
# 2: Power curve
set style line 2 linetype 1 linecolor rgb color2 linewidth 3
# 10: grid lines
set style line 10 linetype 1 linecolor rgb "gray"

###### grid lines (independent settings for x, y, y2 are not possible?)
#set grid xtics ytics y2tics linestyle 10
set grid xtics ytics linestyle 10

###### axis tics & labels
# nomirror: don't display tic marks on other side/axis
# x axis tics+grid: increment = 200 1/min
set xtics 200
set ytics nomirror textcolor linestyle 1
set y2tics nomirror textcolor linestyle 2

set autoscale y
set autoscale y2

###### legend
# set key default
# set key bottom center box

###### plot
plot fileTorque title "Torque" with lines linestyle 1, filePower title "Power" with lines linestyle 2 axes x1y2

# quit script immediatly for debugging
#quit

pause -1 "Hit return to create SVG file"

###### SVG output (commands sent via standard input from app)
# could also do PDF, LaTeX, PNG etc.
## remember current terminal
set terminal push

# page size affects page layout, relative font size etc. - defaults may not look nice
#set terminal svg size 1200,800 dynamic enhanced font "sans,16"
set terminal svg size 1600,1000 dynamic enhanced

# plot into file, using own variable set at beginning
set output plotFile
refresh

## switch back to previous terminal
set terminal pop
refresh
######