1. Introduction

1.1. Overview

The calculator accepts as input the vehicle’s technical data, along with parameters for modifying the execution of the WLTC cycle, and it then spits-out the gear-shifts of the vehicle, the attained speed-profile, and any warnings. It does not calculate any CO2 emissions.

An “execution” or a “run” of an experiment is depicted in the following diagram:

        .-----------------.                         .------------------.
        :      Input      :                         :      Output      :
        ;-----------------;                         ;------------------;
       ; +--test_mass    ;     ____________        ; +--pmr           ;
      ;  +--n_idle      ;     |            |      ;  +--wltc_class   ;
     ;   +--f0,f1,f2   ;  ==> |   Cycle    | ==> ;   +--...         ;
    ;    +--wot/      ;       | Generator  |    ;    +--cycle      ;
   ;         +--     ;        |____________|   ;     |    +--     ;
  ;      +--n2vs    ;                         ;      +--gwots    ;
 ;           +--   ;                         ;            +--   ;
'-----------------'                         '------------------'

The Input, Output and all its contents are instances of datamodel (trees of strings, numbers & pandas objects)

1.2. Quick-start

  • Launch the example jupyter notebooks in a private demo server (JupyterLab for WLTP (stable)).

  • Otherwise, install it locally, preferably from the sources (instructions below).

  • pip install “extras”:

    • plot, excel, all, dev, notebook, test, doc

1.2.1. Prerequisites:

Python-3.6+ is required and Python-3.7 or Python-3.8 recommended. It requires numpy/scipy and pandas libraries with native backends.

Tip

On Windows, it is preferable to use the miniconda distribution; although its conda command adds another layer of complexity on top of pip, unlike standard Python, it has pre-built all native libraries required (e.g. numpy/scipy and pandas).

If nevertheless you choose the standard Python, and some packages fail to build when pip-installing them, download these packages from Gohlke’s “Unofficial Windows Binaries” and install them manually with:

pip install <package-file-v1.2.3.whl>

1.2.2. Download:

Download the sources,

1.2.3. Install:

From within the project directory, run one of these commands to install it:

  • for standard python, installing with pip is enough (but might):

    pip install -e .[test]
    
  • for conda, prefer to install the conda-packages listed in Notebooks/conda/conda-reqs.txt, before running the same pip command, like this:

    conda install  --override-channels -c ankostis -c conda-forge -c defaults --file Notebooks/conda/conda-reqs.txt
    pip install -e .[dev]
    
  • Check installation:

      $ wltp --version
      ...
    
      $ wltp --help
      ...
    
    See: :ref:`wltp-usage`
    
  • Recreate jupyter notebooks from the paired *.py “py:percent” files (only these files are stored in git-repo), by executing the bash-script:

    Notebooks/recreate_ipynbs.sh
    
  • Run pyalgo on all AccDB cars to re-create the H5 file needed for CarsDB-compare notebook, etc:

    Notebooks/recreate_pyalgo_h5.sh
    

1.2.4. Usage:

import pandas as pd
from wltp import datamodel
from wltp.experiment import Experiment

inp_mdl = datamodel.get_model_base()
inp_mdl.update({
    "unladen_mass": None,
    "test_mass": 1100,  # in kg
    "p_rated": 95.3,  # in kW
    "n_rated": 3000,  # in RPM
    "n_idle": 600,
    "n2v_ratios": [122.88, 75.12, 50.06, 38.26, 33.63],

    ## For giving absolute P numbers,
    #  rename `p_norm` column to `p`.
    #
    "wot": pd.DataFrame(
        [[600, 0.1],
        [2500, 1],
        [3500, 1],
        [5000, 0.7]], columns=["n", "p_norm"]
    ),
    'f0': 395.78,
    'f1': 0,
    'f2': 0.15,
})
datamodel.validate_model(inp_mdl, additional_properties=True)
exp = Experiment(inp_mdl, skip_model_validation=True)

# exp = Experiment(inp_mdl)
out_mdl = exp.run()
print(f"Available values: \n{list(out_mdl.keys())}")
print(f"Cycle: \n{out_mdl['cycle']}")

See: Python usage

1.3. Project files and folders

The files and folders of the project are listed below (see also Architecture):

+--bin/                     # (shell-scripts) Utilities & preprocessing of WLTC data on GTR and the wltp_db
|   +--bumpver.py           # (script) Update project's version-string
+--wltp/                    # (package) python-code of the calculator
|   +--cycles/              # (package) code & data for the WLTC data
|   +--experiment           # top-level code running the algo
|   +--datamodel            # schemas & defaults for data of algo
|   +--cycler               # code for generating the cycle
|   +--engine               # formulae for engine power & revolutions and gear-box
|   +--vehicle              # formulae for cycle/vehicle dynamics
|   +--vmax                 # formulae estimating `v_max` from wot
|   +--downscale            # formulae downscaling cycles based on pmr/test_mass ratio
|   +--invariants           # definitions & idempotent formulae for physics/engineering
|   +--io                   # utilities for starting-up, parsing, naming and spitting data
|   +--utils                # software utils unrelated to physics or engineering
|   +--cli                  # (OUTDATED) command-line entry-point for launching this wltp tool
|   +--plots                # (OUTDATED) code for plotting diagrams related to wltp cycles & results
|   +--idgears              # (OUTDATED) reconstructs the gears-profile by identifying the actual gears
+--tests/                   # (package) Test-TestCases
    +--vehdb                # Utils for manipulating h5db with accdb & pyalgo cases.
+--docs/                    # (folder) documentation
|   +--pyplots/             # (DEPRECATED by notebooks) scripts plotting the metric diagrams embedded in the README
+--Notebooks/               # Jupyter notebooks for running & comparing results (see `Notebooks/README.md`)
    +--AccDB_src/           # AccDB code & queries extracted and stored as text
+--setup.py                 # (script) The entry point for `setuptools`, installing, testing, etc
+--requirements/            # (txt-files) Various pip-dependencies for tools.
+--README.rst
+--CHANGES.rst
+--LICENSE.txt

1.4. Discussion