Skip to content

Commit

Permalink
Merge branch 'jakeholden-patch-1'
Browse files Browse the repository at this point in the history
  • Loading branch information
nreinicke committed Oct 26, 2023
2 parents 902da05 + c1a4c59 commit 7198690
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 26 deletions.
29 changes: 4 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Overview

RouteE-Powertrain is a Python package that allows users to work with a set of pre-trained mesoscopic vehicle energy prediction models for a varity of vehicle types. Additionally, users can train their own models if "ground truth" energy consumption and driving data are available. RouteE-Powertrain models predict vehicle energy consumption over links in a road network, so the features considered for prediction often include traffic speeds, road grade, turns, etc.

The typical user will utilize RouteE's catalog of pre-trained models. Currently, the
catalog consists of light-duty vehicle models, including conventional gasoline, diesel,
hybrid electric (HEV), and battery electric (BEV). These models can be applied to link-level driving data (in the form
Expand All @@ -10,31 +12,6 @@ of [pandas](https://pandas.pydata.org/) dataframes) to output energy consumption
Users that wish to train new RouteE models can do so. The model training function of RouteE enables users to use their
own drive-cycle data, powertrain modeling system, and road network data to train custom models.

## Setup

Clone (or download) the RouteE Powertrain repository and create a compatible python environment to ensure package compatibility.

`git clone https://github.nrel.gov/MBAP/routee-powertrain.git`

routee-powertrain depends on python 3.8 and up. One way to satisfy this is to use [conda](https://conda.io/docs/):

```console
conda create -n routee-powertrain python=3.10
conda activate routee-powertrain
```

This will create a new conda environment that uses python 3.10. Navigate to the the routee-powertrain root directory. Then:

```console
pip install .
```

You will now be able to import routee-powertrain in your code with:

```console
import nrel.routee.powertrain as pt
```

## Quickstart

RouteE Powertrain is available on PyPI and can be installed with `pip`:
Expand All @@ -43,6 +20,8 @@ RouteE Powertrain is available on PyPI and can be installed with `pip`:
pip install nrel.routee.powertrain
```

(For more detailed instructions, see [here](https://nrel.github.io/routee-powertrain/installation.html))

Then, you can import the package and use a pre-trained model from the RouteE model catalog:

```python
Expand Down
40 changes: 39 additions & 1 deletion docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,46 @@ Then, you can import the package and use a pre-trained model from the RouteE mod
import pandas as pd
import nrel.routee.powertrain as pt

# Print the available pre-trained models
print(pt.list_available_models(local=True, external=True))

# [
# '2016_TOYOTA_Camry_4cyl_2WD',
# '2017_CHEVROLET_Bolt',
# '2012_Ford_Focus',
# ...
# ]

# Load a pre-trained model
model = pt.load_pretrained_model("2016_TOYOTA_Camry_4cyl_2WD")
model = pt.load_model("2016_TOYOTA_Camry_4cyl_2WD")

# Inspect the model to see what it expects for input
print(model)

# ========================================
# Model Summary
# --------------------
# Vehicle description: 2016_TOYOTA_Camry_4cyl_2WD
# Powertrain type: ICE
# Number of estimators: 2
# ========================================
# Estimator Summary
# --------------------
# Feature: speed_mph (mph)
# Distance: miles (miles)
# Target: gge (gallons_gasoline)
# Raw Predicted Consumption: 29.856 (miles/gallons_gasoline)
# Real World Predicted Consumption: 25.606 (miles/gallons_gasoline)
# ========================================
# Estimator Summary
# --------------------
# Feature: speed_mph (mph)
# Feature: grade_dec (decimal)
# Distance: miles (miles)
# Target: gge (gallons_gasoline)
# Raw Predicted Consumption: 29.845 (miles/gallons_gasoline)
# Real World Predicted Consumption: 25.596 (miles/gallons_gasoline)
# ========================================

# Predict energy consumption for a set of road links
links_df = pd.DataFrame(
Expand Down

0 comments on commit 7198690

Please sign in to comment.