Small pipeline to build household/vehicle/heat/hot-water demand profiles from raw DAT files, run a Pyomo-based storage/price optimization across many storage volumes, and derive supply/demand curves consumed by Streamlit visualizations.
- Reproducible pipeline from raw time series (DAT) to cleaned CSVs, composited profiles, optimization results and curve CSVs used by interactive Streamlit dashboards.
- Install Python runtime and basic deps:
python -m pip install -r requirements.txt
# additional runtime deps used by scripts (not listed in requirements.txt):
python -m pip install pyomo tqdm- Prepare cleaned time series (reads
data/raw_data/*/*.dat-> writesdata/clean_data/*/*.csv):
python data/preparation.py- Build profile definitions + timeseries (writes
profiles/profiles.csvandprofiles/profile_timeseries.csv):
python profiles/build_profiles.py- Run optimization (requires a Pyomo solver; writes
optimization/optimization_results.csv):
python optimization/run_optimization.pyNotes: run_optimization.py calls PricingFramework.optimize(solver="gurobi"). You can pass another Pyomo-compatible solver (CBC, IPOPT, etc.) but make sure it is installed and available on PATH.
- Build curves and start visualizations:
python curves/build_curves.py
streamlit run curves/visualize_curves.py
streamlit run profiles/visualize_timeseries.pydata/preparation.py— parsesdata/raw_data/*/*.datand writes cleaned CSVs with columnsload_wanddatetimeunderdata/clean_data/*/.profiles/build_profiles.py— constructsprofiles/profiles.csvandprofiles/profile_timeseries.csvby combining cleaned time series according to profiles (addsprofile_id).optimization/pricing_framework.py— core Pyomo model (Storage + PricingFramework). See it when changing model variables, bounds or objective.optimization/run_optimization.py— orchestration: slices profiles, converts to hourly kW, buildsPricingFrameworkinstances for many storage volumes and savesoptimization/optimization_results.csv.curves/build_curves.py— converts optimization results intocurves/demand_curves.csvandcurves/supply_curves.csvused by Streamlit apps.curves/visualize_curves.py,profiles/visualize_timeseries.py— Streamlit dashboards expecting the CSVs above.
- Relative paths: scripts expect to be run from the repo root and often use
index_col=0when reading CSVs. Changing working directories will break file resolution. - Units & columns: cleaned series use
load_w(watts) anddatetime.run_optimization.pyconverts toload_kw(kW) before optimization. - Indexing / time handling:
PricingFrameworkcontains__check_timeseries_indices__()that enforces timezone-awareDatetimeIndex(UTC) and equal indices across inputs. That helper is not invoked automatically in the current pipeline.run_optimization.pyintentionally passesprices=prices_ts.reset_index(drop=True)(a RangeIndex) and accesses timeseries by position (.iloc) when building model timesteps. If you switch the optimizer to use datetime indices, update bothrun_optimization.pyandPricingFrameworkconsistently.
- Markets disabled by bounds: several PV/community variables are created with
bounds=(0,0)inpricing_framework.pyto effectively disable those markets. To enable community or wholesale flows, edit the variable bounds inset_model_variables().
- Optimization errors: first check that a solver is installed and callable (e.g.,
gurobi,cbc). Pyomo will raise solver-specific errors — runpython -c "import pyomo; print(pyomo.__version__)"to confirm installation. - Empty visualizations: confirm
optimization/optimization_results.csv,profiles/profile_timeseries.csv, andcurves/*.csvexist and have the expected columns. - Index/time errors: when errors mention DatetimeIndex or timezone, check how you constructed
prices,solar_generation, anddemand(seepricing_framework.__check_timeseries_indices__).
- Add missing runtime deps to
requirements.txt(e.g.,pyomo,tqdm) if you want easier dev setup. - To change optimization horizons or price inputs, edit
optimization/run_optimization.pystart/enddatetimes and ensure input price/solar CSVs align with that window. - To enable additional markets or storage use-cases, modify
storage_use_caseswhen constructingPricingFrameworkand adjustset_model_variables()/set_model_constraints()accordingly.
If you add new entrypoints, change CSV shapes, or flip the optimizer to use datetime indices, please update .github/copilot-instructions.md and this README.md so future contributors (and AI agents) get the correct guidance.
See SPDX notices in source files; some modules carry an AGPL header. Follow file headers for licensing guidance.