Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Case Format Reference

A Cobre case directory is a self-contained folder that holds all input data for a single power system study. load_case reads this directory and produces a fully-validated System ready for the solver.

For a description of how these files are parsed and validated, see cobre-io.

JSON Schema files for all JSON input types are available on the Schemas page. Download them for use with your editor’s JSON Schema validation feature.

Directory layout

my_case/
├── config.json                              # Solver configuration (required)
├── penalties.json                           # Global penalty defaults (required)
├── stages.json                              # Stage sequence and policy graph (required)
├── initial_conditions.json                  # Reservoir storage at study start (required)
├── system/
│   ├── buses.json                           # Electrical buses (required)
│   ├── lines.json                           # Transmission lines (required)
│   ├── hydros.json                          # Hydro plants (required)
│   ├── thermals.json                        # Thermal plants (required)
│   ├── non_controllable_sources.json        # Intermittent sources (optional)
│   ├── pumping_stations.json                # Pumping stations (optional)
│   ├── energy_contracts.json                # Bilateral contracts (optional)
│   ├── hydro_geometry.parquet               # Reservoir geometry tables (optional)
│   ├── hydro_production_models.json         # FPHA production function configs (optional)
│   └── fpha_hyperplanes.parquet             # FPHA hyperplane coefficients (optional)
├── scenarios/
│   ├── inflow_history.parquet               # Historical inflow series (optional)
│   ├── inflow_seasonal_stats.parquet        # PAR model seasonal statistics (optional)
│   ├── inflow_ar_coefficients.parquet       # PAR autoregressive coefficients (optional)
│   ├── external_scenarios.parquet           # Pre-generated external scenarios (optional)
│   ├── load_seasonal_stats.parquet          # Load model seasonal statistics (optional)
│   ├── load_factors.json                    # Load scaling factors (optional)
│   └── correlation.json                     # Cross-series correlation model (optional)
└── constraints/
    ├── thermal_bounds.parquet               # Stage-varying thermal bounds (optional)
    ├── hydro_bounds.parquet                 # Stage-varying hydro bounds (optional)
    ├── line_bounds.parquet                  # Stage-varying line bounds (optional)
    ├── pumping_bounds.parquet               # Stage-varying pumping bounds (optional)
    ├── contract_bounds.parquet              # Stage-varying contract bounds (optional)
    ├── exchange_factors.json                # Block exchange factors (optional)
    ├── generic_constraints.json             # User-defined LP constraints (optional)
    ├── generic_constraint_bounds.parquet    # Bounds for generic constraints (optional)
    ├── penalty_overrides_bus.parquet        # Stage-varying bus penalty overrides (optional)
    ├── penalty_overrides_line.parquet       # Stage-varying line penalty overrides (optional)
    ├── penalty_overrides_hydro.parquet      # Stage-varying hydro penalty overrides (optional)
    └── penalty_overrides_ncs.parquet        # Stage-varying NCS penalty overrides (optional)

File summary

FileFormatRequiredDescription
config.jsonJSONYesSolver configuration
penalties.jsonJSONYesGlobal penalty defaults
stages.jsonJSONYesStage sequence and policy graph
initial_conditions.jsonJSONYesInitial reservoir storage
system/buses.jsonJSONYesElectrical bus registry
system/lines.jsonJSONYesTransmission line registry
system/hydros.jsonJSONYesHydro plant registry
system/thermals.jsonJSONYesThermal plant registry
system/non_controllable_sources.jsonJSONNoIntermittent source registry
system/pumping_stations.jsonJSONNoPumping station registry
system/energy_contracts.jsonJSONNoBilateral energy contract registry
system/hydro_geometry.parquetParquetNoReservoir geometry elevation tables
system/hydro_production_models.jsonJSONNoFPHA production function configs
system/fpha_hyperplanes.parquetParquetNoFPHA hyperplane coefficients
scenarios/inflow_history.parquetParquetNoHistorical inflow time series
scenarios/inflow_seasonal_stats.parquetParquetNoPAR model seasonal statistics
scenarios/inflow_ar_coefficients.parquetParquetNoPAR autoregressive coefficients
scenarios/external_scenarios.parquetParquetNoPre-generated scenario inflows
scenarios/load_seasonal_stats.parquetParquetNoLoad model seasonal statistics
scenarios/load_factors.jsonJSONNoLoad scaling factors per bus/stage
scenarios/correlation.jsonJSONNoCross-series correlation model
constraints/thermal_bounds.parquetParquetNoStage-varying thermal generation bounds
constraints/hydro_bounds.parquetParquetNoStage-varying hydro operational bounds
constraints/line_bounds.parquetParquetNoStage-varying line flow capacity
constraints/pumping_bounds.parquetParquetNoStage-varying pumping flow bounds
constraints/contract_bounds.parquetParquetNoStage-varying contract power bounds
constraints/exchange_factors.jsonJSONNoBlock exchange factors
constraints/generic_constraints.jsonJSONNoUser-defined LP constraints
constraints/generic_constraint_bounds.parquetParquetNoGeneric constraint RHS bounds
constraints/penalty_overrides_bus.parquetParquetNoStage-varying bus excess cost
constraints/penalty_overrides_line.parquetParquetNoStage-varying line exchange cost
constraints/penalty_overrides_hydro.parquetParquetNoStage-varying hydro penalty costs
constraints/penalty_overrides_ncs.parquetParquetNoStage-varying NCS curtailment cost

Root-level files

config.json

Controls all solver parameters. The training section is required; all other sections are optional and fall back to documented defaults when absent.

Top-level sections:

SectionTypeDefaultPurpose
$schemastringnullJSON Schema URI for editor validation (ignored during processing)
modelingobject{}Inflow non-negativity treatment
trainingobjectrequiredIteration count, stopping rules, cut selection
upper_bound_evaluationobject{}Inner approximation upper-bound settings
policyobjectfresh modePolicy directory path and warm-start mode
simulationobjectdisabledPost-training simulation settings
exportsobjectall enabledOutput file selection flags

modeling section:

FieldTypeDefaultDescription
modeling.inflow_non_negativity.methodstring"penalty"How to handle negative modelled inflows. One of "none", "penalty", "truncation", "truncation_with_penalty"
modeling.inflow_non_negativity.penalty_costnumber1000.0Penalty coefficient when method is "penalty" or "truncation_with_penalty"

training section (mandatory fields):

FieldTypeDefaultDescription
training.forward_passesintegerrequiredNumber of scenario trajectories per iteration (>= 1)
training.stopping_rulesarrayrequiredAt least one stopping rule entry; must include an iteration_limit rule
training.stopping_modestring"any"How multiple rules combine: "any" (stop when any triggers) or "all" (stop when all trigger)
training.enabledbooleantrueWhen false, skip training and proceed directly to simulation
training.seedinteger or nullnullRandom seed for reproducible scenario generation
training.cut_formulationstring or nullnullCut type: "single" or "multi"

training.stopping_rules entries:

Each entry has a "type" discriminator. Valid types:

TypeRequired fieldsStops when
iteration_limitlimit: integerIteration count reaches limit
time_limitseconds: numberWall-clock time exceeds seconds
bound_stallingiterations: integer, tolerance: numberLower bound improvement falls below tolerance over iterations window
simulationreplications, period, bound_window, distance_tol, bound_tolBoth policy cost and bound have stabilized

training.cut_selection sub-section:

FieldTypeDefaultDescription
enabledbooleannullEnable cut pruning
methodstringnullPruning method: "level1", "lml1", or "domination"
thresholdintegernullMinimum iterations before first pruning pass
check_frequencyintegernullIterations between pruning checks
cut_activity_tolerancenumbernullMinimum dual multiplier for a cut to count as binding

upper_bound_evaluation section:

FieldTypeDefaultDescription
enabledbooleannullEnable vertex-based inner approximation
initial_iterationintegernullFirst iteration to compute the upper bound
interval_iterationsintegernullIterations between upper-bound evaluations
lipschitz.modestringnullLipschitz constant computation mode: "auto"
lipschitz.fallback_valuenumbernullFallback when automatic computation fails
lipschitz.scale_factornumbernullMultiplicative safety margin

policy section:

FieldTypeDefaultDescription
pathstring"./policy"Directory for policy data (cuts, states, vertices, basis)
modestring"fresh"Initialization mode: "fresh", "warm_start", or "resume"
validate_compatibilitybooleantrueVerify entity and dimension compatibility when loading a stored policy
checkpointing.enabledbooleannullEnable periodic checkpointing
checkpointing.initial_iterationintegernullFirst iteration to write a checkpoint
checkpointing.interval_iterationsintegernullIterations between checkpoints
checkpointing.store_basisbooleannullInclude LP basis in checkpoints
checkpointing.compressbooleannullCompress checkpoint files

simulation section:

FieldTypeDefaultDescription
enabledbooleanfalseEnable post-training simulation
num_scenariosinteger2000Number of simulation scenarios
policy_typestring"outer"Policy representation: "outer" (cuts) or "inner" (vertices)
output_pathstring or nullnullDirectory for simulation output files
output_modestring or nullnullOutput mode: "streaming" or "batched"
io_channel_capacityinteger64Channel capacity between simulation and I/O writer threads
sampling_scheme.typestring"in_sample"Scenario scheme: "in_sample", "out_of_sample", or "external"

exports section:

FieldTypeDefaultDescription
trainingbooleantrueExport training summary metrics
cutsbooleantrueExport cut pool (outer approximation)
statesbooleantrueExport visited states
verticesbooleantrueExport inner approximation vertices
simulationbooleantrueExport simulation results
forward_detailbooleanfalseExport per-scenario forward-pass detail
backward_detailbooleanfalseExport per-scenario backward-pass detail
compressionstring or nullnullOutput compression: "zstd", "lz4", or "none"

Minimal valid example:

{
  "$schema": "https://cobre-rs.github.io/cobre/schemas/config.schema.json",
  "training": {
    "forward_passes": 192,
    "stopping_rules": [{ "type": "iteration_limit", "limit": 200 }]
  }
}

penalties.json

Global penalty cost defaults used when no entity-level override is present. All four sections are required. Every scalar cost must be strictly positive (> 0.0). Deficit segment costs must be monotonically increasing and the last segment must have depth_mw: null (unbounded).

SectionFieldTypeDescription
busdeficit_segmentsarrayPiecewise-linear deficit cost tiers
busdeficit_segments[].depth_mwnumber or nullSegment depth (MW); null for the final unbounded segment
busdeficit_segments[].costnumberCost per MWh of deficit in this tier (USD/MWh)
busexcess_costnumberCost per MWh of excess injection (USD/MWh)
lineexchange_costnumberCost per MWh of inter-bus exchange flow (USD/MWh)
hydrospillage_costnumberSpillage penalty
hydrofpha_turbined_costnumberFPHA turbined flow violation penalty
hydrodiversion_costnumberDiversion flow penalty
hydrostorage_violation_below_costnumberStorage below-minimum violation penalty
hydrofilling_target_violation_costnumberFilling target violation penalty
hydroturbined_violation_below_costnumberTurbined flow below-minimum violation penalty
hydrooutflow_violation_below_costnumberTotal outflow below-minimum violation penalty
hydrooutflow_violation_above_costnumberTotal outflow above-maximum violation penalty
hydrogeneration_violation_below_costnumberGeneration below-minimum violation penalty
hydroevaporation_violation_costnumberEvaporation violation penalty
hydrowater_withdrawal_violation_costnumberWater withdrawal violation penalty
non_controllable_sourcecurtailment_costnumberCurtailment penalty (USD/MWh)

Example:

{
  "$schema": "https://cobre-rs.github.io/cobre/schemas/penalties.schema.json",
  "bus": {
    "deficit_segments": [
      { "depth_mw": 500.0, "cost": 1000.0 },
      { "depth_mw": null, "cost": 5000.0 }
    ],
    "excess_cost": 100.0
  },
  "line": { "exchange_cost": 2.0 },
  "hydro": {
    "spillage_cost": 0.01,
    "fpha_turbined_cost": 0.05,
    "diversion_cost": 0.1,
    "storage_violation_below_cost": 10000.0,
    "filling_target_violation_cost": 50000.0,
    "turbined_violation_below_cost": 500.0,
    "outflow_violation_below_cost": 500.0,
    "outflow_violation_above_cost": 500.0,
    "generation_violation_below_cost": 1000.0,
    "evaporation_violation_cost": 5000.0,
    "water_withdrawal_violation_cost": 1000.0
  },
  "non_controllable_source": { "curtailment_cost": 0.005 }
}

stages.json

Defines the temporal structure of the study: stage sequence, block decomposition, policy graph horizon type, and scenario source configuration.

Top-level fields:

FieldRequiredDescription
policy_graphYesHorizon type ("finite_horizon"), annual discount rate, and stage transitions
stagesYesArray of study stage definitions
scenario_sourceNoTop-level sampling scheme and seed
season_definitionsNoSeason labeling for seasonal model alignment
pre_study_stagesNoPre-study stages for AR model warm-up (negative IDs)

stages[] entry fields:

FieldRequiredDescription
idYesStage identifier (non-negative integer, unique)
start_dateYesISO 8601 date (e.g., "2024-01-01")
end_dateYesISO 8601 date; must be after start_date
blocksYesArray of load blocks (id, name, hours)
num_scenariosYesNumber of forward-pass scenarios for this stage (>= 1)
season_idNoReference to a season in season_definitions
block_modeNoBlock execution mode: "parallel" (default) or "sequential"
state_variablesNoWhich state variables are active: storage, inflow_lags
risk_measureNoPer-stage risk measure: "expectation" or CVaR config
sampling_methodNoNoise method: "saa" or other variants

initial_conditions.json

Initial reservoir storage values at the start of the study.

FieldRequiredDescription
storageYesArray of { "hydro_id": integer, "value_hm3": number } entries for operating hydros
filling_storageYesArray of { "hydro_id": integer, "value_hm3": number } entries for filling hydros

Each hydro_id must be unique within its array and must not appear in both arrays. All value_hm3 values must be non-negative.


system/ files

system/buses.json

Electrical bus registry. Buses are the nodes of the transmission network.

FieldRequiredDescription
buses[].idYesBus identifier (integer, unique)
buses[].nameYesHuman-readable bus name (string)
buses[].deficit_segmentsNoEntity-level deficit cost tiers; when absent, global defaults from penalties.json apply
buses[].deficit_segments[].depth_mwNoSegment MW depth; null for the final unbounded segment
buses[].deficit_segments[].costNoCost per MWh of deficit in this tier (USD/MWh)

system/lines.json

Transmission line registry. Lines connect buses and carry power flows.

FieldRequiredDescription
lines[].idYesLine identifier (integer, unique)
lines[].nameYesHuman-readable line name (string)
lines[].source_bus_idYesSending-end bus ID
lines[].target_bus_idYesReceiving-end bus ID
lines[].direct_mwYesMaximum power flow in the direct direction (MW)
lines[].reverse_mwYesMaximum power flow in the reverse direction (MW)

system/hydros.json

Hydro plant registry. Each entry defines a complete hydro plant with reservoir, turbine, and optional cascade linkage.

Key fields:

FieldRequiredDescription
hydros[].idYesPlant identifier (integer, unique)
hydros[].nameYesHuman-readable plant name
hydros[].bus_idYesBus where generation is injected
hydros[].downstream_idNoDownstream plant ID in the cascade; null = tailwater
hydros[].reservoirYesmin_storage_hm3 and max_storage_hm3 (both >= 0)
hydros[].outflowYesmin_outflow_m3s and max_outflow_m3s total outflow bounds
hydros[].generationYesGeneration model: model, turbine flow bounds, generation MW bounds
hydros[].generation.modelYesCurrently: "constant_productivity"
hydros[].generation.productivity_mw_per_m3sYes (for constant)Turbine productivity factor
hydros[].penaltiesNoEntity-level hydro penalty overrides

system/thermals.json

Thermal plant registry. Each entry defines a dispatchable generation unit.

FieldRequiredDescription
thermals[].idYesPlant identifier (integer, unique)
thermals[].nameYesHuman-readable plant name
thermals[].bus_idYesBus where generation is injected
thermals[].min_generation_mwYesMinimum dispatch level (MW)
thermals[].max_generation_mwYesMaximum dispatch level (MW)
thermals[].cost_per_mwhYesLinear generation cost (USD/MWh)

scenarios/ files (Parquet)

scenarios/inflow_seasonal_stats.parquet

PAR(p) model seasonal statistics for each (hydro plant, stage) pair.

ColumnTypeRequiredDescription
hydro_idINT32YesHydro plant ID
stage_idINT32YesStage ID
mean_m3sDOUBLEYesSeasonal mean inflow (m³/s); must be finite
std_m3sDOUBLEYesSeasonal standard deviation (m³/s); must be >= 0 and finite
ar_orderINT32YesAR model order (number of lags); must be >= 0

scenarios/inflow_ar_coefficients.parquet

Autoregressive coefficients for the PAR(p) inflow model.

ColumnTypeRequiredDescription
hydro_idINT32YesHydro plant ID
stage_idINT32YesStage ID
lagINT32YesLag index (1-based)
coefficientDOUBLEYesAR coefficient for this (hydro, stage, lag)

constraints/ files (Parquet)

All bounds Parquet files use sparse storage: only (entity_id, stage_id) pairs that differ from the base entity-level value need rows. Absent rows use the entity-level value unchanged.

constraints/thermal_bounds.parquet

Stage-varying generation bound overrides for thermal plants.

ColumnTypeRequiredDescription
thermal_idINT32YesThermal plant ID
stage_idINT32YesStage ID
min_generation_mwDOUBLENoMinimum generation override (MW)
max_generation_mwDOUBLENoMaximum generation override (MW)

constraints/hydro_bounds.parquet

Stage-varying operational bound overrides for hydro plants.

ColumnTypeRequiredDescription
hydro_idINT32YesHydro plant ID
stage_idINT32YesStage ID
min_turbined_m3sDOUBLENoMinimum turbined flow (m³/s)
max_turbined_m3sDOUBLENoMaximum turbined flow (m³/s)
min_storage_hm3DOUBLENoMinimum reservoir storage (hm³)
max_storage_hm3DOUBLENoMaximum reservoir storage (hm³)
min_outflow_m3sDOUBLENoMinimum total outflow (m³/s)
max_outflow_m3sDOUBLENoMaximum total outflow (m³/s)
min_generation_mwDOUBLENoMinimum generation (MW)
max_generation_mwDOUBLENoMaximum generation (MW)
max_diversion_m3sDOUBLENoMaximum diversion flow (m³/s)
filling_inflow_m3sDOUBLENoFilling inflow override (m³/s)
water_withdrawal_m3sDOUBLENoWater withdrawal (m³/s)

constraints/line_bounds.parquet

Stage-varying flow capacity overrides for transmission lines.

ColumnTypeRequiredDescription
line_idINT32YesTransmission line ID
stage_idINT32YesStage ID
direct_mwDOUBLENoDirect-flow capacity override (MW)
reverse_mwDOUBLENoReverse-flow capacity override (MW)

constraints/pumping_bounds.parquet

Stage-varying flow bounds for pumping stations.

ColumnTypeRequiredDescription
station_idINT32YesPumping station ID
stage_idINT32YesStage ID
min_m3sDOUBLENoMinimum pumping flow (m³/s)
max_m3sDOUBLENoMaximum pumping flow (m³/s)

constraints/contract_bounds.parquet

Stage-varying power and price overrides for energy contracts.

ColumnTypeRequiredDescription
contract_idINT32YesEnergy contract ID
stage_idINT32YesStage ID
min_mwDOUBLENoMinimum power (MW)
max_mwDOUBLENoMaximum power (MW)
price_per_mwhDOUBLENoPrice override (USD/MWh)

Penalty override files

All penalty override files use sparse storage. Only rows for (entity_id, stage_id) pairs where the penalty differs from the entity-level or global default are required. All penalty values must be strictly positive (> 0.0) and finite.

constraints/penalty_overrides_bus.parquet

ColumnTypeRequiredDescription
bus_idINT32YesBus ID
stage_idINT32YesStage ID
excess_costDOUBLENoExcess injection cost override (USD/MWh)

Note: Bus deficit segments are not stage-varying. Only excess_cost can be overridden per stage for buses.


constraints/penalty_overrides_line.parquet

ColumnTypeRequiredDescription
line_idINT32YesTransmission line ID
stage_idINT32YesStage ID
exchange_costDOUBLENoExchange flow cost override (USD/MWh)

constraints/penalty_overrides_hydro.parquet

ColumnTypeRequiredDescription
hydro_idINT32YesHydro plant ID
stage_idINT32YesStage ID
spillage_costDOUBLENoSpillage penalty override
fpha_turbined_costDOUBLENoFPHA turbined flow violation override
diversion_costDOUBLENoDiversion penalty override
storage_violation_below_costDOUBLENoStorage below-minimum violation override
filling_target_violation_costDOUBLENoFilling target violation override
turbined_violation_below_costDOUBLENoTurbined below-minimum violation override
outflow_violation_below_costDOUBLENoOutflow below-minimum violation override
outflow_violation_above_costDOUBLENoOutflow above-maximum violation override
generation_violation_below_costDOUBLENoGeneration below-minimum violation override
evaporation_violation_costDOUBLENoEvaporation violation override
water_withdrawal_violation_costDOUBLENoWater withdrawal violation override

constraints/penalty_overrides_ncs.parquet

ColumnTypeRequiredDescription
source_idINT32YesNon-controllable source ID
stage_idINT32YesStage ID
curtailment_costDOUBLENoCurtailment penalty override (USD/MWh)