The bcnexus package & workflow
How the Python package is organised, and how one RunModel.run() call turns raw CSVs into
a solved CLEWs model and results. Click any module or step for details.
Package structure
Modules at a glance
A simplified map of bcnexus/. The clews/ sub-package is the engine โ
a Runner (orchestrator) that drives a Builder plus helper modules; vis/ renders results.
bcnexus / (package root)
cli.py
utils.py
attributes_parser.py
constants.py
plots.py
bcnexus / clews / โ the CLEWs engine
runner.pyRunner
builder.pyBuilder
model_structure.pyhelper
schema.pyhelper
sets_n_ratios.pyhelper
update_global_params.pyhelper
update_yearly_params.pyhelper
preprocess_data_Kotzur.pystorage
preprocess_data_Niet.pystorage
solver.pyhelper
datapackage.pyhelper
livestock.pyoptional
bcnexus / vis / โ visualization
dashboard/Dash
plot_Energy ยท plot_Land ยท plot_Climate ยท โฆplots
vis_utils.py
Pick a module
Click any file on the left to see what it does and where it sits in the workflow.
How it connects to the workflow
One run() call, end to end
Creating a RunModel auto-creates a BuildModel
(ClewsBuilder). Calling .run(build=True, threads=N) executes the whole
pipeline. Click any step for detail.
โ Configure
๐๏ธ Scenario config UI
utils.build_scenario_ui()
๐ฆ model_builder_args
scenario ยท storage_algorithm ยท clustering
โ
โก Instantiate clews/runner.py clews/builder.py
๐งฉ RunModel(**args)
creates ClewsBuilder inside
๐ bcnexusRun.run(build=True, threads=N)
drives everything below
โ
โข Builder phase writes data/clews_data
๐๏ธ Build SETs & params + temporal clustering + storage case
model_structure ยท schema ยท sets_n_ratios ยท update_global/yearly_params ยท preprocess_data_Kotzur/Niet
โ
โฃ Runner phase โ solve
๐ Prepare datafile
otoole ยท datapackage report
๐งฎ Solve
solver.py ยท Gurobi / CBC
๐พ Write solution
.sol ยท duals / shadow price
โ
โค Results & visuals
๐ Get result CSVs
get_result_csvs() ยท otoole
๐ Plots & dashboard
plots.main() ยท vis/dashboard
Data flow on disk
Where files live
Everything happens inside data/clews_data. The build creates
clews_build_data/ with three sub-folders; results and plots land in their own trees.
Set build=False to reuse a built structure and only re-cluster.
data/clews_data/clews_build_data/
โโ input_csvs/ templates, updated per clews_builder.yaml
โโ inputs_csv_8760/ hourly (8760 h) profiles used for clustering
โโ Model_<storage_algorithm>/<scenario>/ final datafiles
results/clews/Model_<storage_algorithm>_<scenario>/ result CSVs (via otoole)
vis/<scenario>/<timeslices>ts_<RUNTAG>/ saved figures