1. Introduction¶
1.1. Overview¶
The Fuefit calculator performs the following:
- Accepts fuel-consumption engine data points as input (RPM, Power and Fuel-Consumption or equivalent quantities such as CM, PME/Torque and PMF/FC).
- Uses those points to fit the following coefficients:
\[a, b, c, a2, b2, loss0, loss2\]using the following formula:[1]
\[\mathbf{pme} = (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}}\]
- Spits-out the input engine-points according to the fitting, and optionally plots a mesh (grid) with the engine-map.
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-Model /
/----------------------------/ /-----------------------------/
/ +--engine / / +--engine /
/ | +--... / / | +--fc_map_coeffs /
/ +--params / ____________ / +--measured_eng_points /
/ | +--... / | | / | n p fc pme ... /
/ +--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 /
/ / / ... ... ... /
'----------------------------' '-----------------------------'
The Input & Output Model are trees of strings and numbers, assembled with:
- sequences,
- dictionaries,
- pandas.DataFrame,
- pandas.Series, and
- URI-references to other model-trees (TODO).
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):
Engine-speed:
N (1/min) N_norm (1/min) : normalized against N_idle + (N_rated - N_idle) CM (m/sec) : Mean Piston speed
Work-capability:
P (kW) P_norm (kW) : normalized against P_MAX T (Nm) PME (bar)
Fuel-consumption:
FC (g/h) FC_norm (g/h) : normalized against P_MAX PMF (bar)
[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 |
1.2. Quick-start¶
The program runs on Python-3.3+ with numpy/scipy, pandas and win32 native-libraries 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), you can try the following commands:
Install: | $ pip install fuefit
$ fuefit --winmenus ## Adds StartMenu-items, Windows only.
See: Install |
---|---|
Cmd-line: | $ fuefit --version
0.0.5
$ 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.
- CM
- Mean piston speed (measure for the engines operating speed)
- PME
- Mean effective pressure (the engines ability to produce mechanical work)
- PMF
- Available mean effective pressure (the maximum mean effective pressure which could be produced if n = 1)
- JSON-schema
- The JSON schema is an IETF draft that provides a contract for what JSON-data is required for a given application and how to interact with it. JSON Schema is intended to define validation, documentation, hyperlink navigation, and interaction control of JSON data. You can learn more about it from this excellent guide, and experiment with this on-line validator.
- JSON-pointer
- JSON Pointer(RFC 6901) defines a string syntax for identifying a specific value within a JavaScript Object Notation (JSON) document. It aims to serve the same purpose as XPath from the XML world, but it is much simpler.