Tag Archives: plot

Log Graphs 1

Specification

Car: 2009 Impreza 2.0 Turbo Diesel, 110 kW / 148 hp / 150 PS, European domestic market, Euro 4 spec.

Important: Newer Boxer Diesel generations (Euro 5/6) may show different behaviour!

ECU firmware: patched ROM for unlimited logging, otherwise stock.
Protocol: SSM2 via CAN
More than 120 items had been logged, plenty of RAM variables (*) plus standard SSM2 items at roughly 170 ms interval.

Graphs

I prepared two graph images plotting some interesting parameters, click picture for full resolution:


Image 1/2

loggraphs1_p1


Image 2/2

loggraphs1_p2

Additional details

… at specific time positions:

#1: State before active regeneration

Time @ ~ 33 ½ min
Cruise Control: active
Vehicle Speed*: 110 km/h
Engine Speed: 2300 rpm
Gear: 5
Coolant Temperature: 93 °C
Injections: 2 (pre + main)
Soot Accumulation Ratio: 64 %
DPF Pressure Difference: ~ 5 kPa
Exhaust Gas Temperature (EGT) Catalyst Inlet: 345 °C
EGT DPF Inlet: 370 °C
Intake Air Amount: 430 mg/cyl
Mass Air Flow: 33.8 g/s
Manifold Absolute Pressure (MAP)*: 126 kPa
Inlet Air Temperature: 25 °C
Manifold Air Temperature: 48 °C
Fuel Temperature: 58 °C
Throttle Opening Angle: 79 deg
EGR Valve Opening Angle: 38 deg
Final Oil Dilution Rate*: -1.9 mg/s (evaporation)
Oil Dilution Amount: 282.0 g (4.6 %)

#2: Soot 65%, preparing for DPF regeneration

@ 33 ¾ min
Soot Accumulation Ratio* reaches 65%, this triggers active regeneration preparations. Note: I am referring to the actual RAM value, diagnostic parameter may indicate 65% earlier due to rounding.
Apparently ECU now does 3 injections (pre + main + after) when power demand is high enough, no post injections yet

#3: Active Regen ON

@ 34:04; = 20 seconds after #2, DPF Regeneration Switch turns ON
EGR valve closes instantly, 0 deg
Manifold Air Temperature dropping
Boost Control opens VGT immediately, from 52 to 25%
Manifold Absolute Pressure* dropping
pilot-injection kicks in, 2 injections (pilot C + main)
post-injections begin to fade in but not active yet

#4: Post-Injections

@ 33 seconds after #2, post-injections A + B become operational (injection amount > 0)
oil dilution rising
EGTs climbing
Manifold Absolute Pressure*: 75 kPa (~ 25 below ambient), varying, stays below ambient most of the time during regen at low power demand
EGT Catalyst Inlet: 340 °C
EGT DPF Inlet: 320 °C
injections: 4 (pilot C + main + post A + post B)

#5: Coasting Fuel Cut-Off During Regen

Example @ 35:12
EGR valve opens instantaneously, 70 deg; EGR behaves rather digitally during regen – either fully closed (0 deg, for max EGT) or max opened (70 deg, less fresh air)
Throttle Opening Angle: rising up to 31 deg
injections: 0
Fuel Consumption*: 0 mm³/s
oil dilution going down slowly due to estimated evaporation
EGT Catalyst Inlet: decreases fast, EGT at DPF inlet (> 600 °C) follows with a delay
Engine Speed: gear change from 5th to 6th to reduce engine braking effect

#6: Idling with Active Regen ON

@ 45:30
Engine Speed: 800 rpm
Post A Injection Amount*: 0
Post B Injection Amount*: ~ 8 mm³/st
Apparently while idling the ECU prefers the 2nd post-injection (“B”), otherwise during driving it’s rather mixed
Final Oil Dilution Rate: ~ 20 mg/s (medium)
Boost Control: 25 % (VGT fully open)
Manifold Absolute Pressure*: 74 kPa
Throttle Opening Angle: 5.5 deg
EGR Valve Opening Angle: 0 deg
Intake Air Amount: 370 mg/cyl
Mass Air Flow: 9.8 g/s

#7: DPF Regeneration OFF

@ 46:15, decision is based on elapsed time from #2, achieved soot level does not matter (!)
DPF Regeneration SW had been ON for 12.2 minutes
all post-injections off
Oil Dilution Amount*: 299.6 g (4.9 %) = + 0.3 % during regeneration
EGR back to normal operation
Boost Control: 65 % instantly (max speed, spooling up turbo)
MAP rising
EGT Catalyst Inlet: 270 °C
EGT DPF Inlet: 490 °C

Yet another color map for EcuFlash

Perhaps another color map for EcuFlash might be interesting? I wrote a little SageMath python script to generate a ScoobyRom-like color map file.

EcuFlash using ScoobyRom color map

EcuFlash using ScoobyRom color map

Note: Although generated color map matches ScoobyRom’s precisely, EcuFlash applies colors based on “min” and “max” specified in XML definitions.

Excerpt from EcuFlash definition file: 32BITDIESELBASE.xml


<scaling name="ChargeAirPressure" units="kPa" toexpr="x" frexpr="x" format="%.0f" min="0" max="255" inc="1" storagetype="uint8" endian="big"/>

Whereas ScoobyRom scales colors ranging from a map’s actually used mininum and maximum. For example, if you would change min="0" to min="100" in above scaling definition, low value colors would appear bluish like in ScoobyRom, effectively making map graphics cover more/most of available color range.

Install

1) Download file scoobyrom-map.odt

2) Rename downloaded file to ScoobyRom.map, since normal file extension is not allowed on wordpress.com.

3) Move file into EcuFlash’s color maps folder, i.e.

C:\Program Files (x86)\OpenECU\EcuFlash\colormaps\

4) Launch or restart EcuFlash.

5) Via EcuFlash menu: File → Options → Appearance → Default Color Map
Select “ScoobyRom.map”
(Btw., default color map directory can also be defined in Options)

Color Map File Format

Color map format is plain text ASCII file, usually 256 lines as in this case, specifying RGB values which will be applied to maps, from low to high:


153 153 255
153 154 255
153 156 255
152 157 255
...
255 110 103
255 107 102
255 105 102
255 102 102

Fuel Level

Introduction

On Euro 4 and early EU 5 (MY till including 2011) diesel models fuel level is being measured by BIU and transmitted on CAN-bus as 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 level information fluctuates a lot with fluid moving. Then the damped result is being used for LUT (Lookup table).

Euro 5 gen3 and EU 6, = MY 2012+: Fuel level is being digitized by combination meter. ECU ROM does more sophisticated damping/averaging.

Math

Did some math, using exact ROM table data (ScoobyRom, export as CSV), applying formulas, creating plots.


For above voltage divider, where:

  • Vin: Battery Voltage (assumed constant in this case)
  • R1: constant series resistor
  • R2: variable fuel level resistance (two sensors in series, one per tank half)
  • 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 [Ω] (CAN value) and volume [litre].

ROM Tables and Calculated Results

gen1 Euro 4 (MY 2008-2010)

Fuel tank capacity: 64 litres.

Fuel Tank Level, 2D table, Euro 4, ScoobyRom screenshot

gen2 Euro 5 (MY 2010-2011)

Fuel tank capacity: 65 litres.

Fuel Tank Level, 2D table, gen2 Euro 5, ScoobyRom screenshot

gen3 Euro 5 (MY 2012-2014) and gen4 Euro 6 (MY 2015+)

Fuel tank capacity: 60 litres.

There seems to be a calibration data error as the vertical step (at 19 ↔ 23 litres) does not make sense! ECU’s LUT code can handle this but technically it is a flaw. The averaging algorithm after table lookup will mitigate this issue. Same map data was found in newer Euro 5 and Euro 6 ROMs.

Fuel Tank Level, 2D table, Euro 6, ScoobyRom screenshot

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)

For some reason, above codes are not publicly exposed in Euro 6 spec models, also not available in service manual DTC listing. They are processed internally however.

Fuel Gauge

Fuel gauge and fuel warning light, Subaru Impreza diesel Euro 4. At depicted position, there are still 5 to 10 litres left in the tank.

I tested the fuel gauge by inserting a variable resistor after disconnecting a fuel level sensor connector from the wiring harness, below the rear seats. The Euro 4 fuel gauge at least reacts very slowly. It takes more than 20 seconds from empty to full and vice versa. The combination meter does its own damping obviously. Therefore, gauge hijacking, i.e. abusing the fuel gauge in order to display something fluctuating like manifold air pressure (MAP) is not feasible (without hacking combination meter ROM, of course).

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
######

Power Graphs and Calculations v2

Updated 2011-01-16: corrected data, added details

Official graphs

These are official Boxer Diesel power graphs from Subaru press info, dated 2008:

Digitizing with Inkscape, zoomed in, bitmap layer in background:

Saved as SVG (Inkscape’s default format) coordinates are plain readable. Some conversion had to be done – SVG origin is top left, scaling, relative coordinates etc.

Digitized torque data


Engine Speed [1/min],Torque [Nm]
1193.55,202.578
1313.36,249.619
1443.78,298.872
1472.12,307.111
1518.49,317.562
1555.84,326.697
1575.2,334.011
1617.03,340.603
1669.37,345.07
1736.66,347.988
1808.8,349.379
2383.36,349.662
2421.46,349.484
2461.55,348.549
2522.98,346.099
2650.91,340.182
2798.88,332.502
2994.03,324.842
3300.6,312.663
3478.52,304.245
3661.72,288.783
3787.83,275.768
3830.03,268.687
3878.16,261.977
4129.99,232.604
4232.87,220.772
4372.64,202.82
4419.5,195.276

Function plot, linear interpolation:

Digitized power data


Engine Speed [1/min],Power [W]
1201.24,25496.7
1419.95,43784.2
1565.12,55739.5
2025.77,73824.5
2310.73,84411.4
2376.1,86717.
2436.11,88110.1
2548.37,91706.8
2941.28,100369.
3125.55,104148.
3278.06,107158.
3442.58,109944.
3514.2,110805.
3589.68,110856.
3690.33,110450.
3835.49,108829.
3947.75,106904.
4058.08,104219.
4149.05,100927.
4261.31,95607.5
4347.44,91681.5
4396.8,89908.4

Since power can be calculated from torque and angular velocity, this can be used to check the official power curve. Looks like someone put “lipstick” on the last part of the curve…

Drive force

After applying some math (torque curve, vehicle speed vs. RPM, gear ratios)…

View above graph as SVG (best quality).

Theoretical shift points

Calculated intersection points (drive force equality solutions), slightly rounded:

v [km/h] Gear1 RPM1 [1/min] Gear2 RPM2 [1/min]
75 2 4340 3 2630
116 3 4070 4 3010
151 4 3920 5 3170
181 5 3800 6 3340

Engine Speed vs. Vehicle Speed


View/download above graph as SVG (best quality).
Unfortunately SVG graphics cannot be inlined directly in here.

X-axis is actual vehicle speed as reported from a GPS device or logging using OBD-II protocol. Speedometer shows 6-8% higher e.g. 107 km/h instead of actual 100 km/h.
By the way, tachometer indication seems accurate, this one is driven by square-wave signal generated by the ECU.

Might also apply to other models (same final drive ratio, wheel size)! For gearbox information (gear ratios) see this page: Transmission – 6MT