Skip to main content

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

Project description

ev-flow

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

License

MIT. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ev_flow-3.0.0.tar.gz (265.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ev_flow-3.0.0-py3-none-any.whl (284.8 kB view details)

Uploaded Python 3

File details

Details for the file ev_flow-3.0.0.tar.gz.

File metadata

  • Download URL: ev_flow-3.0.0.tar.gz
  • Upload date:
  • Size: 265.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ev_flow-3.0.0.tar.gz
Algorithm Hash digest
SHA256 f3a21870292c87f6546b97750f345ae9bd40580b1bb2f6ad70d7760e4fa7dcf6
MD5 0039221a39f55c5449e2f0a78f0c6862
BLAKE2b-256 7be3426e00fc6fb681093b33e16c53260ca4b9b1404ff15ae32687caed906de7

See more details on using hashes here.

Provenance

The following attestation bundles were made for ev_flow-3.0.0.tar.gz:

Publisher: publish.yml on bertravacca/ev-flow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ev_flow-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: ev_flow-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 284.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ev_flow-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 00b100a5eedc815cfccca3e6470e0c202d435bb18b0c3d007d6a6905be4c5380
MD5 eb801759973ad76ebd75631e9f563a26
BLAKE2b-256 121c82d10e5a0c2f705e2fbfcd76167e6a353d1b9b2e081c8fec48758afb1286

See more details on using hashes here.

Provenance

The following attestation bundles were made for ev_flow-3.0.0-py3-none-any.whl:

Publisher: publish.yml on bertravacca/ev-flow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page