ev-flow 3.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ev_flow-3.0.0/.gitignore +54 -0
- ev_flow-3.0.0/LICENSE +21 -0
- ev_flow-3.0.0/PKG-INFO +159 -0
- ev_flow-3.0.0/README.md +102 -0
- ev_flow-3.0.0/pyproject.toml +90 -0
- ev_flow-3.0.0/src/pev_synth/__init__.py +68 -0
- ev_flow-3.0.0/src/pev_synth/_meta.py +266 -0
- ev_flow-3.0.0/src/pev_synth/_paths.py +116 -0
- ev_flow-3.0.0/src/pev_synth/_phev_fuel_economy.py +246 -0
- ev_flow-3.0.0/src/pev_synth/_seeds.py +183 -0
- ev_flow-3.0.0/src/pev_synth/_utc_migration.py +497 -0
- ev_flow-3.0.0/src/pev_synth/acs_loader.py +762 -0
- ev_flow-3.0.0/src/pev_synth/api.py +1749 -0
- ev_flow-3.0.0/src/pev_synth/cache_regen.py +1201 -0
- ev_flow-3.0.0/src/pev_synth/donor_matcher.py +1475 -0
- ev_flow-3.0.0/src/pev_synth/hourly_resampler.py +961 -0
- ev_flow-3.0.0/src/pev_synth/nhts_loader.py +713 -0
- ev_flow-3.0.0/src/pev_synth/nhts_nextgen_loader.py +692 -0
- ev_flow-3.0.0/src/pev_synth/plug_in_model.py +2308 -0
- ev_flow-3.0.0/src/pev_synth/regions.py +458 -0
- ev_flow-3.0.0/src/pev_synth/sales_mix_data.py +1094 -0
- ev_flow-3.0.0/src/pev_synth/soc_trajectory.py +1548 -0
- ev_flow-3.0.0/src/pev_synth/travel_week_builder.py +1975 -0
- ev_flow-3.0.0/src/pev_synth/validation_bounds_curator.py +2763 -0
- ev_flow-3.0.0/src/pev_synth/validator.py +3103 -0
- ev_flow-3.0.0/src/pev_synth/vehicle_archetypes.py +1989 -0
ev_flow-3.0.0/.gitignore
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Python build artifacts
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.egg-info/
|
|
6
|
+
build/
|
|
7
|
+
dist/
|
|
8
|
+
.eggs/
|
|
9
|
+
|
|
10
|
+
# Virtual environments
|
|
11
|
+
.venv/
|
|
12
|
+
venv/
|
|
13
|
+
env/
|
|
14
|
+
|
|
15
|
+
# Test / coverage caches
|
|
16
|
+
.pytest_cache/
|
|
17
|
+
.coverage
|
|
18
|
+
.coverage.*
|
|
19
|
+
htmlcov/
|
|
20
|
+
.mypy_cache/
|
|
21
|
+
.ruff_cache/
|
|
22
|
+
|
|
23
|
+
# Notebooks
|
|
24
|
+
*.ipynb_checkpoints/
|
|
25
|
+
|
|
26
|
+
# OS / editor
|
|
27
|
+
.DS_Store
|
|
28
|
+
Thumbs.db
|
|
29
|
+
.idea/
|
|
30
|
+
.vscode/
|
|
31
|
+
*.swp
|
|
32
|
+
*~
|
|
33
|
+
|
|
34
|
+
# Secrets / local config
|
|
35
|
+
.env
|
|
36
|
+
.env.*
|
|
37
|
+
!.env.example
|
|
38
|
+
|
|
39
|
+
# Local data caches (if any are dropped here during development)
|
|
40
|
+
data/
|
|
41
|
+
results/
|
|
42
|
+
|
|
43
|
+
# In-progress scientific-publication work — separate effort with its own
|
|
44
|
+
# tooling/repo; not part of the ev-flow package.
|
|
45
|
+
docs/Scientific publication/
|
|
46
|
+
|
|
47
|
+
# Private / internal: AI-assistant instructions and internal working docs.
|
|
48
|
+
# These stay on the local dev machine and are deliberately NOT published to
|
|
49
|
+
# the public GitHub repo. Public-facing docs live in documentation/ instead.
|
|
50
|
+
CLAUDE.md
|
|
51
|
+
AGENTS.md
|
|
52
|
+
.cursorrules
|
|
53
|
+
.github/copilot-instructions.md
|
|
54
|
+
docs/
|
ev_flow-3.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bertrand Travacca
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
ev_flow-3.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ev-flow
|
|
3
|
+
Version: 3.0.0
|
|
4
|
+
Summary: Synthetic plug-in electric vehicle charging dataset pipeline and library API.
|
|
5
|
+
Project-URL: Homepage, https://github.com/bertravacca/ev-flow
|
|
6
|
+
Project-URL: Repository, https://github.com/bertravacca/ev-flow
|
|
7
|
+
Project-URL: Issues, https://github.com/bertravacca/ev-flow/issues
|
|
8
|
+
Author-email: Bertrand Travacca <bertrand.travacca@gmail.com>
|
|
9
|
+
License: MIT License
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2026 Bertrand Travacca
|
|
12
|
+
|
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
in the Software without restriction, including without limitation the rights
|
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
furnished to do so, subject to the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be included in all
|
|
21
|
+
copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
+
SOFTWARE.
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Keywords: charging,electric-vehicles,energy,ev,grid,nhts,synthetic-data
|
|
32
|
+
Classifier: Development Status :: 4 - Beta
|
|
33
|
+
Classifier: Intended Audience :: Science/Research
|
|
34
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
35
|
+
Classifier: Operating System :: OS Independent
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
41
|
+
Classifier: Topic :: Scientific/Engineering
|
|
42
|
+
Requires-Python: >=3.10
|
|
43
|
+
Requires-Dist: numpy>=1.26
|
|
44
|
+
Requires-Dist: pandas>=2.2
|
|
45
|
+
Requires-Dist: pyarrow>=16
|
|
46
|
+
Requires-Dist: pytz>=2024.1
|
|
47
|
+
Requires-Dist: requests>=2.32
|
|
48
|
+
Requires-Dist: scikit-learn>=1.4
|
|
49
|
+
Requires-Dist: scipy>=1.12
|
|
50
|
+
Provides-Extra: dev
|
|
51
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
52
|
+
Requires-Dist: pytest-cov>=5; extra == 'dev'
|
|
53
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
54
|
+
Requires-Dist: ruff>=0.5; extra == 'dev'
|
|
55
|
+
Requires-Dist: twine>=5; extra == 'dev'
|
|
56
|
+
Description-Content-Type: text/markdown
|
|
57
|
+
|
|
58
|
+
# ev-flow
|
|
59
|
+
|
|
60
|
+
Synthetic plug-in electric vehicle (PEV) charging dataset pipeline and library API.
|
|
61
|
+
|
|
62
|
+
`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.
|
|
63
|
+
|
|
64
|
+
## Install
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install ev-flow
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
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.
|
|
71
|
+
|
|
72
|
+
## Data directory
|
|
73
|
+
|
|
74
|
+
`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:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
export PEV_SYNTH_DATA_ROOT=/path/to/your/ev-flow-data
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
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/`.
|
|
81
|
+
|
|
82
|
+
### First run / bootstrap (dev checkout)
|
|
83
|
+
|
|
84
|
+
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:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# (a) one-time: download (~84 MB ORNL zip) + process NHTS 2017.
|
|
88
|
+
# Writes the California parquets and the national hhpub.csv/vehpub.csv
|
|
89
|
+
# to data/pev/raw/nhts2017/.
|
|
90
|
+
python -m pev_synth.nhts_loader
|
|
91
|
+
|
|
92
|
+
# (b) build a cache for the (region, profile_type) you want.
|
|
93
|
+
# Subcommands are `one`, `batch`, `audit`.
|
|
94
|
+
python -m pev_synth.cache_regen one --region bay_area --profile-type residential
|
|
95
|
+
|
|
96
|
+
# (c) now the library API works:
|
|
97
|
+
python -c "import pev_synth as ps; print(ps.generate_profiles('residential', n=10, region='bay_area'))"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
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.
|
|
101
|
+
|
|
102
|
+
Pip-installed (non-dev) users do not run the bootstrap — instead point `PEV_SYNTH_DATA_ROOT` at a prebuilt data tree as described above.
|
|
103
|
+
|
|
104
|
+
## Quick start
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
import pev_synth as ps
|
|
108
|
+
|
|
109
|
+
ps.list_regions()
|
|
110
|
+
# ['bay_area', 'boston', 'chicago', 'dallas_fort_worth',
|
|
111
|
+
# 'la_basin', 'new_york_metro', 'seattle', 'us_national']
|
|
112
|
+
|
|
113
|
+
ps.list_profile_types()
|
|
114
|
+
# ['residential', 'workplace']
|
|
115
|
+
|
|
116
|
+
fleet = ps.generate_profiles('residential', n=1000, region='bay_area', seed=42)
|
|
117
|
+
prof = fleet[0]
|
|
118
|
+
|
|
119
|
+
pa = prof.generate_presence_absence('2001-01-01', '2001-01-08', freq='15min')
|
|
120
|
+
sess = prof.charging_sessions('2001-06-01', '2001-06-08')
|
|
121
|
+
soc = prof.soc_trajectory('2001-06-01', '2001-06-08', freq='15min')
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The PyPI distribution name is **`ev-flow`** but the Python import name is **`pev_synth`** (this mirrors the `scikit-learn` / `sklearn` convention).
|
|
125
|
+
|
|
126
|
+
## Workplace caveat
|
|
127
|
+
|
|
128
|
+
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.
|
|
129
|
+
|
|
130
|
+
## Modules
|
|
131
|
+
|
|
132
|
+
| Module | Purpose |
|
|
133
|
+
|---|---|
|
|
134
|
+
| `nhts_loader` | National Household Travel Survey 2017 public-use file loader |
|
|
135
|
+
| `vehicle_archetypes` | N-EV archetype sampler |
|
|
136
|
+
| `donor_matcher` | NHTS donor-vehicle matcher |
|
|
137
|
+
| `travel_week_builder` | One-year travel sequence builder |
|
|
138
|
+
| `plug_in_model` | Session plug-in / dwell sampler |
|
|
139
|
+
| `soc_trajectory` | Continuous-time state-of-charge ledger + session extraction |
|
|
140
|
+
| `hourly_resampler` | 15-minute and hourly plug-status rasteriser |
|
|
141
|
+
| `validation_bounds_curator` | Bound curation |
|
|
142
|
+
| `validator` | Validation runner + report writer (11 §10 + 3 integration + 1 DST + 1 winter + 10 workplace + 1 workplace-optim checks) |
|
|
143
|
+
| `regions` | 8-region registry |
|
|
144
|
+
|
|
145
|
+
Full library API reference and methodology rationale live in the [`documentation/`](documentation/) folder (expanding ahead of the docs-site launch).
|
|
146
|
+
|
|
147
|
+
## Development
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
git clone https://github.com/bertravacca/ev-flow
|
|
151
|
+
cd ev-flow
|
|
152
|
+
python -m venv .venv && source .venv/bin/activate
|
|
153
|
+
pip install -e ".[dev]"
|
|
154
|
+
pytest
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## License
|
|
158
|
+
|
|
159
|
+
MIT. See `LICENSE`.
|
ev_flow-3.0.0/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# ev-flow
|
|
2
|
+
|
|
3
|
+
Synthetic plug-in electric vehicle (PEV) charging dataset pipeline and library API.
|
|
4
|
+
|
|
5
|
+
`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.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install ev-flow
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
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.
|
|
14
|
+
|
|
15
|
+
## Data directory
|
|
16
|
+
|
|
17
|
+
`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:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
export PEV_SYNTH_DATA_ROOT=/path/to/your/ev-flow-data
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
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/`.
|
|
24
|
+
|
|
25
|
+
### First run / bootstrap (dev checkout)
|
|
26
|
+
|
|
27
|
+
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:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# (a) one-time: download (~84 MB ORNL zip) + process NHTS 2017.
|
|
31
|
+
# Writes the California parquets and the national hhpub.csv/vehpub.csv
|
|
32
|
+
# to data/pev/raw/nhts2017/.
|
|
33
|
+
python -m pev_synth.nhts_loader
|
|
34
|
+
|
|
35
|
+
# (b) build a cache for the (region, profile_type) you want.
|
|
36
|
+
# Subcommands are `one`, `batch`, `audit`.
|
|
37
|
+
python -m pev_synth.cache_regen one --region bay_area --profile-type residential
|
|
38
|
+
|
|
39
|
+
# (c) now the library API works:
|
|
40
|
+
python -c "import pev_synth as ps; print(ps.generate_profiles('residential', n=10, region='bay_area'))"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
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.
|
|
44
|
+
|
|
45
|
+
Pip-installed (non-dev) users do not run the bootstrap — instead point `PEV_SYNTH_DATA_ROOT` at a prebuilt data tree as described above.
|
|
46
|
+
|
|
47
|
+
## Quick start
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
import pev_synth as ps
|
|
51
|
+
|
|
52
|
+
ps.list_regions()
|
|
53
|
+
# ['bay_area', 'boston', 'chicago', 'dallas_fort_worth',
|
|
54
|
+
# 'la_basin', 'new_york_metro', 'seattle', 'us_national']
|
|
55
|
+
|
|
56
|
+
ps.list_profile_types()
|
|
57
|
+
# ['residential', 'workplace']
|
|
58
|
+
|
|
59
|
+
fleet = ps.generate_profiles('residential', n=1000, region='bay_area', seed=42)
|
|
60
|
+
prof = fleet[0]
|
|
61
|
+
|
|
62
|
+
pa = prof.generate_presence_absence('2001-01-01', '2001-01-08', freq='15min')
|
|
63
|
+
sess = prof.charging_sessions('2001-06-01', '2001-06-08')
|
|
64
|
+
soc = prof.soc_trajectory('2001-06-01', '2001-06-08', freq='15min')
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The PyPI distribution name is **`ev-flow`** but the Python import name is **`pev_synth`** (this mirrors the `scikit-learn` / `sklearn` convention).
|
|
68
|
+
|
|
69
|
+
## Workplace caveat
|
|
70
|
+
|
|
71
|
+
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.
|
|
72
|
+
|
|
73
|
+
## Modules
|
|
74
|
+
|
|
75
|
+
| Module | Purpose |
|
|
76
|
+
|---|---|
|
|
77
|
+
| `nhts_loader` | National Household Travel Survey 2017 public-use file loader |
|
|
78
|
+
| `vehicle_archetypes` | N-EV archetype sampler |
|
|
79
|
+
| `donor_matcher` | NHTS donor-vehicle matcher |
|
|
80
|
+
| `travel_week_builder` | One-year travel sequence builder |
|
|
81
|
+
| `plug_in_model` | Session plug-in / dwell sampler |
|
|
82
|
+
| `soc_trajectory` | Continuous-time state-of-charge ledger + session extraction |
|
|
83
|
+
| `hourly_resampler` | 15-minute and hourly plug-status rasteriser |
|
|
84
|
+
| `validation_bounds_curator` | Bound curation |
|
|
85
|
+
| `validator` | Validation runner + report writer (11 §10 + 3 integration + 1 DST + 1 winter + 10 workplace + 1 workplace-optim checks) |
|
|
86
|
+
| `regions` | 8-region registry |
|
|
87
|
+
|
|
88
|
+
Full library API reference and methodology rationale live in the [`documentation/`](documentation/) folder (expanding ahead of the docs-site launch).
|
|
89
|
+
|
|
90
|
+
## Development
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
git clone https://github.com/bertravacca/ev-flow
|
|
94
|
+
cd ev-flow
|
|
95
|
+
python -m venv .venv && source .venv/bin/activate
|
|
96
|
+
pip install -e ".[dev]"
|
|
97
|
+
pytest
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
MIT. See `LICENSE`.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.24"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ev-flow"
|
|
7
|
+
version = "3.0.0"
|
|
8
|
+
description = "Synthetic plug-in electric vehicle charging dataset pipeline and library API."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Bertrand Travacca", email = "bertrand.travacca@gmail.com" },
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"electric-vehicles",
|
|
17
|
+
"ev",
|
|
18
|
+
"charging",
|
|
19
|
+
"synthetic-data",
|
|
20
|
+
"energy",
|
|
21
|
+
"grid",
|
|
22
|
+
"nhts",
|
|
23
|
+
]
|
|
24
|
+
classifiers = [
|
|
25
|
+
"Development Status :: 4 - Beta",
|
|
26
|
+
"Intended Audience :: Science/Research",
|
|
27
|
+
"License :: OSI Approved :: MIT License",
|
|
28
|
+
"Operating System :: OS Independent",
|
|
29
|
+
"Programming Language :: Python :: 3",
|
|
30
|
+
"Programming Language :: Python :: 3.10",
|
|
31
|
+
"Programming Language :: Python :: 3.11",
|
|
32
|
+
"Programming Language :: Python :: 3.12",
|
|
33
|
+
"Programming Language :: Python :: 3.13",
|
|
34
|
+
"Topic :: Scientific/Engineering",
|
|
35
|
+
]
|
|
36
|
+
dependencies = [
|
|
37
|
+
"numpy>=1.26",
|
|
38
|
+
"pandas>=2.2",
|
|
39
|
+
"pyarrow>=16",
|
|
40
|
+
"requests>=2.32",
|
|
41
|
+
"scikit-learn>=1.4",
|
|
42
|
+
"scipy>=1.12",
|
|
43
|
+
"pytz>=2024.1",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.optional-dependencies]
|
|
47
|
+
dev = [
|
|
48
|
+
"pytest>=8",
|
|
49
|
+
"pytest-cov>=5",
|
|
50
|
+
"ruff>=0.5",
|
|
51
|
+
"build>=1.2",
|
|
52
|
+
"twine>=5",
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
[project.urls]
|
|
56
|
+
Homepage = "https://github.com/bertravacca/ev-flow"
|
|
57
|
+
Repository = "https://github.com/bertravacca/ev-flow"
|
|
58
|
+
Issues = "https://github.com/bertravacca/ev-flow/issues"
|
|
59
|
+
|
|
60
|
+
# --- Hatch build configuration ---------------------------------------------
|
|
61
|
+
# Only the src/pev_synth/ tree is packaged. Everything else at the repo root
|
|
62
|
+
# (README, LICENSE, tests/, CI config, etc.) lives in the repo but is
|
|
63
|
+
# excluded from the published wheel/sdist by packaging only src/pev_synth.
|
|
64
|
+
|
|
65
|
+
[tool.hatch.build.targets.wheel]
|
|
66
|
+
packages = ["src/pev_synth"]
|
|
67
|
+
|
|
68
|
+
# ``only-include`` is an allowlist: the sdist ships exactly these paths (plus
|
|
69
|
+
# the auto-generated PKG-INFO). ``include`` alone is not exclusive under
|
|
70
|
+
# hatchling and was leaking docs/ and .gitignore into the sdist.
|
|
71
|
+
[tool.hatch.build.targets.sdist]
|
|
72
|
+
only-include = [
|
|
73
|
+
"src/pev_synth",
|
|
74
|
+
"README.md",
|
|
75
|
+
"LICENSE",
|
|
76
|
+
"pyproject.toml",
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
# --- Tooling ---------------------------------------------------------------
|
|
80
|
+
|
|
81
|
+
[tool.pytest.ini_options]
|
|
82
|
+
testpaths = ["tests"]
|
|
83
|
+
addopts = "-q"
|
|
84
|
+
|
|
85
|
+
[tool.ruff]
|
|
86
|
+
line-length = 100
|
|
87
|
+
target-version = "py310"
|
|
88
|
+
|
|
89
|
+
[tool.ruff.lint]
|
|
90
|
+
select = ["E", "F", "I", "B", "UP"]
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""pev_synth — Synthetic EV charging dataset pipeline + library API.
|
|
2
|
+
|
|
3
|
+
Library API (v2.0)
|
|
4
|
+
------------------
|
|
5
|
+
The public surface for downstream code is:
|
|
6
|
+
|
|
7
|
+
>>> import pev_synth as ps
|
|
8
|
+
>>> ps.list_regions()
|
|
9
|
+
['bay_area', 'boston', 'chicago', 'dallas_fort_worth', 'la_basin',
|
|
10
|
+
'new_york_metro', 'seattle', 'us_national']
|
|
11
|
+
>>> ps.list_profile_types()
|
|
12
|
+
['residential', 'workplace']
|
|
13
|
+
>>> fleet = ps.generate_profiles('residential', n=1000,
|
|
14
|
+
... region='bay_area')
|
|
15
|
+
>>> prof = fleet[0]
|
|
16
|
+
>>> pa = prof.generate_presence_absence('2001-01-01', '2001-01-08')
|
|
17
|
+
|
|
18
|
+
See ``src/pev_synth/api.py`` and ``docs/pev_synth_api.md`` for details.
|
|
19
|
+
|
|
20
|
+
Pipeline modules (M1..M9, methodology v2.0.0, master seed 20260520)
|
|
21
|
+
-------------------------------------------------------------------
|
|
22
|
+
* ``nhts_loader`` — NHTS 2017 public-use file loader.
|
|
23
|
+
* ``vehicle_archetypes`` — N-EV archetype sampler (M2).
|
|
24
|
+
* ``donor_matcher`` — NHTS donor-vehicle matcher (M3).
|
|
25
|
+
* ``travel_week_builder`` — one-year travel sequence builder (M4).
|
|
26
|
+
* ``plug_in_model`` — session plug-in / dwell sampler (M5).
|
|
27
|
+
* ``soc_trajectory`` — continuous-time SoC ledger + sessions (M6).
|
|
28
|
+
* ``hourly_resampler`` — 15-min + hourly plug-status rasteriser (M7).
|
|
29
|
+
* ``validation_bounds_curator`` — bound curation (M8).
|
|
30
|
+
* ``validator`` — §10 validation runner + report writer (M9).
|
|
31
|
+
* ``regions`` — 8-region registry (Region dataclass).
|
|
32
|
+
* ``_utc_migration`` — package-internal v1.1 → v2.0 UTC cache
|
|
33
|
+
migrator (leading underscore = not part of
|
|
34
|
+
the public API; used only by in-house
|
|
35
|
+
callers with a v1.1 cache to upgrade).
|
|
36
|
+
|
|
37
|
+
The library API wraps the artifacts these modules produce.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
from __future__ import annotations
|
|
41
|
+
|
|
42
|
+
from .api import (
|
|
43
|
+
Fleet,
|
|
44
|
+
Profile,
|
|
45
|
+
ProfileType,
|
|
46
|
+
generate_profiles,
|
|
47
|
+
regenerate_fleet,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
# v2.0: ``list_profile_types`` and the Region registry come from
|
|
51
|
+
# ``pev_synth.regions`` so the public listing returns ``["residential",
|
|
52
|
+
# "workplace"]`` (``fleet_depot`` was de-scoped — plan §2.6).
|
|
53
|
+
from .regions import REGIONS, Region, list_profile_types, list_regions
|
|
54
|
+
|
|
55
|
+
__version__ = "3.0.0"
|
|
56
|
+
|
|
57
|
+
__all__ = [
|
|
58
|
+
"Fleet",
|
|
59
|
+
"Profile",
|
|
60
|
+
"ProfileType",
|
|
61
|
+
"REGIONS",
|
|
62
|
+
"Region",
|
|
63
|
+
"generate_profiles",
|
|
64
|
+
"list_profile_types",
|
|
65
|
+
"list_regions",
|
|
66
|
+
"regenerate_fleet",
|
|
67
|
+
"__version__",
|
|
68
|
+
]
|