Module Overview#
The src package holds every step of the workflow. workflow/main.py calls them in order (see
Workflow Guide); src.reproduce wraps whole runs for the notebook and the batch runner.
Signatures and docstrings for every function are in the generated reference
(src).
Most functions take file paths and plain Python values, read or write OSeMOSYS-style CSV files
(REGION, …, VALUE) and return the path they wrote.
Clustering#
Function |
Module |
What it does |
|---|---|---|
|
|
k-means on daily 48-value vectors (24 scaled CF + 24 scaled demand values). Returns the sorted representative days and, for each of the 365 days, the representative day that stands in for it. |
from src.cluster import cluster_data
days, sequence = cluster_data("data/timeseries/CapacityFactor_Wind.csv",
"data/timeseries/SpecifiedDemandProfile.csv", n_clusters=4)
Building the model inputs#
Function |
Module |
Writes |
|---|---|---|
|
|
A set with members 1… |
|
|
Capacity factor ( |
|
|
|
|
|
Novo: chronological block → representative time slice (dense) |
|
|
The same mapping, non-zero entries only (used for the Kotzur reconstruction) |
|
|
Time slice → day type (or → season with |
|
|
Kotzur: day type → chronological day |
|
|
Welsch: time slice → daily time bracket |
|
|
Welsch: number of days of each day type |
|
|
Sets the default of a parameter in an otoole config file |
Note that conversionld takes the number of representative days as its second argument.
Solving and collecting results#
Function |
Module |
What it does |
|---|---|---|
|
|
Runs |
|
|
Appends one row (LP size, cost, time, memory, capacities, status) to |
|
|
Copies a result CSV into the results folder under a new name |
|
|
Reads the single |
Post-processing#
Function |
Module |
What it does |
|---|---|---|
|
|
Kotzur SoC at every chronological block, accumulated from the representative blocks |
|
|
Welsch SoC in grouped day-type order |
|
|
Returns three matplotlib figures comparing the four SoC trajectories (daily, hourly, two weeks) |
Configuration and console output#
Function |
Module |
What it does |
|---|---|---|
|
|
Reads a YAML file; raises |
|
|
Coloured progress messages |
Reproducing the study (src.reproduce)#
Function |
What it does |
|---|---|
|
Installed versions compared with the paper |
|
Runs one scenario through |
|
Runs a grid of scenarios, skipping completed ones |
|
Tidy results, errors against the k365h1 Novo benchmark, Table 4 of the paper, bit-for-bit comparison |
|
Clustering of one case; stability across k-means seeds |
|
Runs |
|
SoC trajectories and the metrics of Sections 4.3–4.4 |
from src.reproduce import run_case
df = run_case("WND", k=8, h=1)
print(df[["Model", "Total cost", "Storage Capacity"]])