Skip to main content

ev-flow

CI codecov security PyPI version Python versions DOI License: MIT

Synthetic plug-in electric vehicle (PEV) charging dataset pipeline and library API.

ev-flow generates realistic, fleet-scale charging behavior for residential and workplace EVs, grounded in the National Household Travel Survey (NHTS) and a regional sales-mix model. It exposes both a low-level pipeline (NHTS loading, donor matching, travel-week building, plug-in modeling, state-of-charge trajectory, hourly rasterisation) and a clean Fleet / Profile library API for downstream studies.

Install

pip install ev-flow

Then set PEV_SYNTH_DATA_ROOT to point at your data tree — see the next section. Without that step, generate_profiles(...) will raise FileNotFoundError because the wheel does not bundle the cached fleet bundles.

Data directory

ev-flow ships only the Python package; the cached fleet bundles (NHTS-derived parquets etc.) are not bundled in the wheel. Point the package at your local data directory via the PEV_SYNTH_DATA_ROOT environment variable:

export PEV_SYNTH_DATA_ROOT=/path/to/your/ev-flow-data

The directory should contain the pev/processed/<region>/<profile_type>_ev_synth/ layout that python -m pev_synth.cache_regen one ... writes. If PEV_SYNTH_DATA_ROOT is unset, the package falls back to <repo_root>/data/ — only useful in a pip install -e . dev checkout where the data/ tree sits next to src/.

First run / bootstrap (dev checkout)

The cached fleet bundles are not in the repo and not in the wheel — you build them from NHTS 2017 microdata, which is also not bundled. For a fresh pip install -e . dev checkout the one-time sequence is:

# (a) one-time: download (~84 MB ORNL zip) + process NHTS 2017.
#     Writes the California parquets and the national hhpub.csv/vehpub.csv
#     to data/pev/raw/nhts2017/.
python -m pev_synth.nhts_loader

# (b) build a cache for the (region, profile_type) you want.
#     Subcommands are `one`, `batch`, `audit`.
python -m pev_synth.cache_regen one --region bay_area --profile-type residential

# (c) now the library API works:
python -c "import pev_synth as ps; print(ps.generate_profiles('residential', n=10, region='bay_area'))"

Step (a) runs once: the loader persists the national hhpub.csv / vehpub.csv, so non-CA regions (boston, chicago, dallas_fort_worth, new_york_metro, seattle) are then handled automatically by cache_regen one without re-downloading.

Pip-installed (non-dev) users do not run the bootstrap — instead point PEV_SYNTH_DATA_ROOT at a prebuilt data tree as described above.

Quick start

import pev_synth as ps

ps.list_regions()
# ['bay_area', 'boston', 'chicago', 'dallas_fort_worth',
#  'la_basin', 'new_york_metro', 'seattle', 'us_national']

ps.list_profile_types()
# ['residential', 'workplace']

fleet = ps.generate_profiles('residential', n=1000, region='bay_area', seed=42)
prof  = fleet[0]

pa   = prof.generate_presence_absence('2001-01-01', '2001-01-08', freq='15min')
sess = prof.charging_sessions('2001-06-01', '2001-06-08')
soc  = prof.soc_trajectory('2001-06-01', '2001-06-08', freq='15min')

The PyPI distribution name is ev-flow but the Python import name is pev_synth (this mirrors the scikit-learn / sklearn convention).

Workplace caveat

In v2.0 the workplace cluster centres are fit from the 105-vehicle public EVWatts cohort, whose plug-in median is ~12:00 LT — approximately 3 hours later than the literature-canonical workplace median of ~09:00 LT. The W1-W4 validator checks flag this divergence as EXPLAINED_FAIL rather than as a bug. pev_synth surfaces this caveat as a RuntimeWarning at Fleet.__init__ whenever profile_type == 'workplace'. See src/pev_synth/plug_in_model.py:42-48 for the full discussion.

Modules

Module Purpose
nhts_loader National Household Travel Survey 2017 public-use file loader
vehicle_archetypes N-EV archetype sampler
donor_matcher NHTS donor-vehicle matcher
travel_week_builder One-year travel sequence builder
plug_in_model Session plug-in / dwell sampler
soc_trajectory Continuous-time state-of-charge ledger + session extraction
hourly_resampler 15-minute and hourly plug-status rasteriser
validation_bounds_curator Bound curation
validator Validation runner + report writer (11 §10 + 3 integration + 1 DST + 1 winter + 10 workplace + 1 workplace-optim checks)
regions 8-region registry

Full library API reference and methodology rationale live in the documentation/ folder (expanding ahead of the docs-site launch).

Development

git clone https://github.com/bertravacca/ev-flow
cd ev-flow
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest

Versioning

ev-flow follows Semantic Versioning. See documentation/versioning.md for what counts as a major/minor/patch change, the deprecation policy, and the distinction between the package version and a cache's methodology_version.

Data sources & attribution

ev-flow is grounded in public data sources. Two upstream notices are required:

  • SPEECh Original Model (Powell, Cezar & Rajagopal, Mendeley Data, 2021) is licensed CC BY 4.0. ev-flow consumes a modified (pickle→JSON, reweighted) subset of its driver-group mixtures. https://doi.org/10.17632/gvk34mybtb.1
  • This product uses the U.S. Census Bureau Data API but is not endorsed or certified by the Census Bureau.

Full per-source licensing, citations, and the modification statement are in ATTRIBUTION.md (NHTS, Census ACS PUMS, EPA fueleconomy.gov, EV WATTS, CVRP, NYSERDA, Argonne EV-FACTS, NOAA, NREL).

License

MIT. See LICENSE. Note that the MIT license covers the ev-flow code; the upstream data sources retain their own licenses — see ATTRIBUTION.md.

Metadata

Release files for ev-flow 3.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ev-flow 3.0.2
File Size Uploaded
ev_flow-3.0.2.tar.gz 269.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ev-flow 3.0.2
File Interpreter ABI Platform
ev_flow-3.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 555.3 kB

Release files / ev_flow-3.0.2.tar.gz

Download URL ev_flow-3.0.2.tar.gz
Size 269.5 kB
Tags Source
SHA-256 checksum
How to use checksums
145e2b5984848fb65efc0d6bd26ef5a82b6adc07d68ae870b3e1c740b7018dd6
BLAKE2b-256 checksum
How to use checksums
fa435aeea4594e14798ef9888b4c1348d2104b18e8898b58154775e266b47b03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 10, 2026.

Transparency log

Release files / ev_flow-3.0.2-py3-none-any.whl

Download URL ev_flow-3.0.2-py3-none-any.whl
Size 285.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0484269e4c25494aff5a156f97565cacb52503200ee7430fe32beef326a1a0c
BLAKE2b-256 checksum
How to use checksums
b367c1378593b1316038a932ed364745a2dd23ebf0f9396af9e41c046bb07f34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

3.0.2 This release

2 release files

3.0.1

2 release files

3.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page