1. Introduction

1.1. Overview

The Fuefit calculator was developed to apply a statistical fit on measured engine fuel consumption data (engine map). This allows the reduction of the information necessary to describe an engine fuel map from several hundred points to seven statistically calculated parameters, with limited loss of information.

More specifically this software works like that:

  1. Accepts engine data as input, constituting of triplets of RPM, Power and Fuel-Consumption or equivalent quantities eg mean piston speed (CM), brake mean effective pressure (BMEP) or Torque, fuel mean effective pressure (PMF).
  2. Fits the provided input to the following formula [1] [2] [3]:
\[\mathbf{BMEP} = (a + b\times{\mathbf{CM}} + c\times{\mathbf{CM^2}})\times{\mathbf{PMF}} + (a2 + b2\times{\mathbf{CM}})\times{\mathbf{PMF^2}} + loss0 + loss2\times{\mathbf{CM^2}}\]
  1. Recalculates and (optionally) plots engine-maps based on the coefficients that describe the fit:

    \[a, b, c, a2, b2, loss0, loss2\]

An “execution” or a “run” of a calculation along with the most important pieces of data are depicted in the following diagram:

              .----------------------------.                    .-----------------------------.
             /        Input-Model         /                    /    Output(Fitted)-Model     /
            /----------------------------/                    /-----------------------------/
           / +--engine                  /                    / +--engine                   /
          /  |  +--...                 /                    /  |  +--fc_map_coeffs        /
         /   +--params                /  ____________      /   +--measured_eng_points    /
        /    |  +--...               /  |            |    /    |    n   p  fc  bmep ... /
       /     +--measured_eng_points /==>| Calculator |==>/     |  ... ... ...  ...     /
      /          n    p    fc      /    |____________|  /      +--fitted_eng_points   /
     /          --  ----  ---     /                    /       |    n    p   fc      /
    /            0   0.0    0    /                    /        |  ...  ...  ...     /
   /           600  42.5   25   /                    /         +--mesh_eng_points  /
  /           ...    ...  ...  /                    /               n    p   fc   /
 /                            /                    /              ...  ...  ...  /
'----------------------------'                    '-----------------------------'

Apart from various engine-characteristics under /engine the table-columns such as capacity and p_rated, the table under /measured_eng_points must contain at least one column from each of the following categories (column-headers are case-insensitive):

  1. Engine-speed:

    N        [1/min]
    N_norm   [-]        : where N_norm = (N – N_idle) / (N_rated-N_idle)
    CM       [m/sec]
    
  2. Load-Power-capability:

    P        [kW]
    P_norm   [-]        : where P_norm = P/P_MAX
    T        [Nm]
    BMEP     [bar]
    
  3. Fuel-consumption:

    FC       [g/h]
    FC_norm  [g/KWh]    : where FC_norm = FC[g/h] / P_MAX [kW]
    PMF      [bar]
    

The Input & fitted data-model described above are trees of strings and numbers, assembled with:

[1]Bastiaan Zuurendonk, Maarten Steinbuch(2005): “Advanced Fuel Consumption and Emission Modeling using Willans line scaling techniques for engines”, Technische Universiteit Eindhoven, 2005, Department Mechanical Engineering, Dynamics and Control Technology Group, http://alexandria.tue.nl/repository/books/612441.pdf
[2]Yuan Zou, Dong-ge Li, and Xiao-song Hu (2012): “Optimal Sizing and Control Strategy Design for Heavy Hybrid Electric Truck”, Mathematical Problems in Engineering Volume 2012, Article ID 404073, 15 pages doi:10.1155/2012/404073
[3]Xi Wei (2004): “Modeling and control of a hybrid electric drivetrain for optimum fuel economy, performance and driveability”, Dissertation Presented in Partial Fulfillment of the Requirements for the Degree Doctor of Philosophy in the Graduate School of The Ohio State University

1.2. Quick-start

The program runs on Python-3.3+ and requires numpy/scipy, pandas and win32 libraries along with their native backends to be installed.

On Windows/OS X, it is recommended to use one of the following “scientific” python-distributions, as they already include the native libraries and can install without administrative priviledges:

Assuming you have a working python-environment, open a command-shell (in Windows use cmd.exe BUT ensure python.exe is in its PATH) and try the following console-commands:

Install:
$ pip install fuefit
$ fuefit --winmenus                         ## Adds StartMenu-items, Windows only.

See: Install

Cmd-line:
$ fuefit --version
0.0.7-alpha.1

$ fuefit --help
...

## Change-directory into the `fuefit/test/` folder in the  *sources*.
$ fuefit -I FuelFit_real.csv header+=0 \
    -I ./FuelFit.xlsx sheetname+=0 header@=None names:='["p","n","fc"]' \
    -I ./engine.csv file_frmt=SERIES model_path=/engine header@=None \
    -m /engine/fuel=petrol \
    -m /params/plot_maps@=True \
    -O full_results_model.json \
    -O fit_coeffs.csv model_path=/engine/fc_map_coeffs   index?=false \
    -O t1.csv model_path=/measured_eng_points   index?=false \
    -O t2.csv model_path=/mesh_eng_points       index?=false \

See: Cmd-line usage

Excel:
$ fuefit --excelrun                                             ## Windows & OS X only

See: Excel usage

Python-code:
>>> import pandas as pd
>>> from fuefit import datamodel, processor, test

>>> inp_model = datamodel.base_model()
>>> inp_model.update({...})                                     ## See "Python Usage" below.        
>>> inp_model['engine_points'] = pd.read_csv('measured.csv')    ## Pandas can read Excel, matlab, ... 
>>> datamodel.set_jsonpointer(inp_model, '/params/plot_maps', True)

>>> datamodel.validade_model(inp_model, additional_properties=False)            

>>> out_model = processor.run(inp_model)                                        

>>> print(datamodel.resolve_jsonpointer(out_model, '/engine/fc_map_coeffs'))    
a            164.110667
b           7051.867419
c          63015.519469
a2             0.121139
b2          -493.301306
loss0      -1637.894603
loss2   -1047463.140758
dtype: float64

See: Python usage

Tip

The commands beginning with $, above, imply a Unix like operating system with a POSIX shell (Linux, OS X). Although the commands are simple and easy to translate in its Windows counterparts, it would be worthwile to install Cygwin to get the same environment on Windows. If you choose to do that, include also the following packages in the Cygwin‘s installation wizard:

* git, git-completion
* make, zip, unzip, bzip2
* openssh, curl, wget

But do not install/rely on cygwin’s outdated python environment.

1.3. Discussion