gtopt::Reservoir struct

Water reservoir in a hydro cascade system.

The reservoir accumulates and releases water between time blocks. The volume balance per block is:

V[t+1] = V[t] × (1 − annual_standing_loss/8760 × duration)
       + flow_conversion_rate × (inflows − outflows) × duration

where inflows/outflows include waterway flows, turbine discharges, natural inflows (Flow), and seepage (ReservoirSeepage).

Public static variables

static LPClassName class_name

Public variables

OptActive active
Activation status (default: active).
OptTRealFieldSched annual_standing_loss
OptTRealFieldSched capacity
Total usable storage capacity [hm³].
OptBool daily_cycle
OptName description
Array<ReservoirDischargeLimit> discharge_limit
OptReal dual_scale
OptTBRealFieldSched ecost
OptReal efin
OptReal efin_cost
OptReal eini
OptTBRealFieldSched emax
OptTBRealFieldSched emin
OptReal flow_conversion_rate
OptReal fmax
OptReal fmin
SingleId junction
ID of the associated hydraulic junction.
OptReal mean_production_factor
Name name
Human-readable name.
Array<ReservoirProductionFactor> production_factor
OptTBRealFieldSched scost
Array<ReservoirSeepage> seepage
OptTBRealFieldSched soft_emin
OptTBRealFieldSched soft_emin_cost
OptSingleId spill_junction
OptReal spillway_capacity
OptReal spillway_cost
OptName storage_integration
OptName type
Optional element type/category tag.
Uid uid
Unique identifier.
OptBool use_state_variable
OptReal water_value_hint

Default physical constants

static Real default_flow_conversion_rate
[hm³/(m³/s·h)]
static Real default_mean_production_factor
[MWh/hm³] — fallback when no turbine data available

Variable documentation

static LPClassName gtopt::Reservoir::class_name

Canonical class-name constant used in LP row labels and config fields like VariableScale::class_name. Single source of truth — ReservoirLP exposes no separate ClassName member; callers reach the constant via Reservoir::class_name directly (or ReservoirLP::Element::class_name in generic contexts).

OptTRealFieldSched gtopt::Reservoir::annual_standing_loss

Annual fractional evaporation/seepage loss [p.u./year]

OptBool gtopt::Reservoir::daily_cycle

Enable PLP-style daily cycle operation (see Battery::daily_cycle). Default for reservoirs is false (disabled); can be enabled explicitly for small reservoirs that operate on a daily cycle.

OptName gtopt::Reservoir::description

Optional free-text description (e.g. conversion provenance)

Array<ReservoirDischargeLimit> gtopt::Reservoir::discharge_limit

Inline discharge limit definitions for this reservoir. Each entry needs only waterway and segments; reservoir is set automatically.

OptReal gtopt::Reservoir::dual_scale

Explicit post-equilibration row factor c for the energy-balance row (overrides water_value_hint / auto). LP dual becomes y_LP / c; physical duals, cuts and outputs are unchanged. Unset/1 = off.

OptTBRealFieldSched gtopt::Reservoir::ecost

Shadow cost of stored water (water value) [$/hm³] per-(stage, block); accepts a scalar (broadcasts), a 2-D nested array, or a file-backed schedule.

OptReal gtopt::Reservoir::efin

Minimum required stored volume at end of horizon [hm³]. Sets a >= constraint vol_end >= efin in the last stage of the last phase (not an equality).

OptReal gtopt::Reservoir::efin_cost

Penalty cost per unit of efin shortfall [$/hm³]. When set (and > 0), the hard vol_end >= efin row becomes soft: vol_end + slack >= efin with slack priced at efin_cost in the objective. This mirrors PLP's per-stage rebalse-cost slack on the end-of-horizon volume target, letting the LP miss efin at a cost rather than going infeasible when upstream Benders cuts have clamped sini below what one stage of inflows can recover. Without this field, efin is enforced as a hard >= constraint (the historical behaviour).

OptReal gtopt::Reservoir::eini

Initial stored volume at start of horizon [hm³]. Sets an equality constraint vol_start = eini in the first stage of the first phase only.

OptTBRealFieldSched gtopt::Reservoir::emax

Maximum allowed stored volume [hm³] — same shapes as emin.

OptTBRealFieldSched gtopt::Reservoir::emin

Minimum allowed stored volume [hm³] — per-(stage, block); accepts a scalar (broadcasts), a 2-D nested array, or a file-backed schedule.

OptReal gtopt::Reservoir::flow_conversion_rate

Converts m³/s × hours into hm³ [hm³/(m³/s·h)]

OptReal gtopt::Reservoir::fmax

Maximum net flow into the reservoir junction [m³/s]. When unset, ReservoirLP::add_to_lp falls back to +DblMax (clamped to solver +inf at flatten time).

OptReal gtopt::Reservoir::fmin

Minimum net flow into the reservoir junction [m³/s]. When unset, ReservoirLP::add_to_lp falls back to -DblMax (clamped to solver -inf at flatten time).

OptReal gtopt::Reservoir::mean_production_factor

Expected turbine production factor [MWh/hm³]. Converts the global state_violation_cost ($/MWh) into reservoir-specific units ($/hm³). Defaults to 5.0 MWh/hm³.

Array<ReservoirProductionFactor> gtopt::Reservoir::production_factor

Inline production factor definitions for this reservoir. Each entry needs only turbine and segments; reservoir is set automatically.

OptTBRealFieldSched gtopt::Reservoir::scost

State cost: elastic penalty for SDDP state variable violations [$/hm³] — per-(stage, block). If not set, computed as state_fail_cost × mean_production_factor.

Array<ReservoirSeepage> gtopt::Reservoir::seepage

Inline seepage definitions for this reservoir. Each entry needs only waterway (and optionally slope/constant/segments); reservoir is set automatically from this reservoir's uid.

OptTBRealFieldSched gtopt::Reservoir::soft_emin

Soft minimum volume [hm³] — per-(stage, block); accepts a scalar (broadcasts), a 2-D nested array, or a file-backed schedule. Creates a penalized constraint: efin + slack >= soft_emin, where the slack variable has a penalty cost (soft_emin_cost) in the objective. Unlike emin (a hard variable bound), this allows the volume to drop below the threshold at a cost. Corresponds to PLP's plpminembh.dat "holgura" (slack) constraint.

OptTBRealFieldSched gtopt::Reservoir::soft_emin_cost

Penalty cost per unit of soft_emin violation [$/hm³] — per-(stage, block). Applied to the slack variable that relaxes the soft_emin constraint. Must be > 0 for the constraint to be active.

OptSingleId gtopt::Reservoir::spill_junction

Optional downstream junction for spill routing. When set, the reservoir's drain (spillway) variable is also added with coefficient +1.0 (m³/s as inflow) to that junction's balance row, so spilled water flows downstream instead of vanishing. Mirrors PLP's qv chain where the vertimiento variable appears in BOTH the source reservoir's balance AND the downstream junction's balance (PLP SerVer field in plpcnfce.dat). When unset (default), drain depletes storage only — matches the behaviour for reservoirs whose SerVer = 0 (spill to sea).

OptReal gtopt::Reservoir::spillway_capacity

Maximum uncontrolled spill capacity [m³/s]. When unset, StorageLP falls back to +DblMax (clamped to solver +inf at flatten time), so the drain teleport is unbounded.

OptReal gtopt::Reservoir::spillway_cost

Penalty cost per unit of spillway flow [$/(m³/s)/h] — applied via CostHelper::block_ecost(...) on the drain column (m³/s), so the LP pays spillway_cost · q · duration per block. Same unit convention as Waterway.fcost.

OptName gtopt::Reservoir::storage_integration

Point-stage storage integration rule of this element (block = cc | trapezoid | lg4 | lg6 | lg4_pos | lg6_pos); unset: the per-type / global model option (see ModelOptions).

OptBool gtopt::Reservoir::use_state_variable

Whether to propagate volume state across stage/phase boundaries via StateVariables (SDDP-style coupling). When true (the default for reservoirs), the final volume of one phase is carried over as the initial volume of the next. When false, an efin==eini constraint is added to close each phase independently.

OptReal gtopt::Reservoir::water_value_hint

Expected magnitude of the reservoir's water value |dual| [$/hm³] (e.g. from PLP boundary cuts). Only used when lp_matrix_options.water_dual_target > 0: the energy-balance row is multiplied post-equilibration by c = expected|y_LP| / target so its LP dual lands near the target. Unset = use the state-violation cost.