Waterway struct
#include <gtopt/waterway.hpp>
Water channel connecting two hydraulic junctions.
A waterway carries water from an upstream junction (junction_a) to a downstream junction (junction_b). Flow is constrained between fmin and fmax. An optional lossfactor models seepage or evaporation in transit. Turbines are attached to waterways to generate electricity.
Public static variables
- static LPClassName class_name
Public variables
- OptActive active
- Operational status (default: active when unset).
- OptTRealFieldSched capacity
- OptName description
- OptTRealFieldSched fcost
- OptTBRealFieldSched fmax
- OptTBRealFieldSched fmin
- OptTBRealFieldSched fmin_fcost
- SingleId junction_a
- OptSingleId junction_b
- OptTRealFieldSched lossfactor
- Name name
- OptName type
- Optional element type / category tag (free-text).
- Uid uid
- Unique waterway identifier.
Variable documentation
static LPClassName gtopt:: Waterway:: class_name
Canonical class-name constant used in LP row labels and config fields like VariableScale::class_name. Single source of truth — WaterwayLP exposes no separate ClassName member; callers reach the constant via Waterway::class_name directly (or WaterwayLP::Element::class_name in generic contexts).
OptTRealFieldSched gtopt:: Waterway:: capacity
Per-stage capacity ceiling [m³/s] applied to the flow column as a fallback when fmax is unset. Accepts scalar, [stage] 1-D array, or a filename string referencing a Parquet/CSV schedule under input_directory/Waterway/.
OptName gtopt:: Waterway:: description
Optional free-text description (e.g. conversion provenance from PLP / PLEXOS).
OptTRealFieldSched gtopt:: Waterway:: fcost
Per-flow cost [$/(m³/s)/h] charged on the waterway_flow column — applied via CostHelper::block_ecost(...) so the LP pays fcost × flow × duration per block. Used to model PLP qrb-style spillway penalties on _ver arcs (rebalse cost from plpvrebemb.dat). Per-stage scheduling.
OptTBRealFieldSched gtopt:: Waterway:: fmax
Maximum allowed water flow [m³/s] (per-stage × per-block). When unset the LP treats the column as having no upper bound (+∞), same semantics as fmax = DblMax after the flatten-time clamp. When set, fmax overrides capacity.
OptTBRealFieldSched gtopt:: Waterway:: fmin
Minimum required water flow [m³/s] (per-stage × per-block). The LP enforces flow ≥ fmin on every block. Defaults to 0.0. Accepts scalar, [stage][block] 2-D array, or a filename string referencing a Parquet/CSV schedule.
OptTBRealFieldSched gtopt:: Waterway:: fmin_fcost
Optional penalty cost [$/(m³/s)/h] that turns the fmin floor into a SOFT constraint, mirroring Generator.pmin_fcost. When set (> 0) and fmin > 0, the hard flow ≥ fmin is relaxed to flow + unserved ≥ fmin with a non-negative unserved slack priced at fmin_fcost — so a forced river / ecological flow (e.g. Caudal_Eco, a bypass minimum) can under-deliver at a penalty when the upstream reservoir is water-short, instead of rendering the LP infeasible. Water still routes junction_a → junction_b (non-consumptive); only the floor becomes soft. Unset keeps fmin hard. Per-(stage, block) schedulable.
SingleId gtopt:: Waterway:: junction_a
Upstream junction reference (uid or name). REQUIRED — the waterway debits this junction's water balance by -1.0 × flow per block.
OptSingleId gtopt:: Waterway:: junction_b
Downstream junction reference (uid or name) — OPTIONAL. When set, the waterway credits this junction's balance with +(1 - lossfactor) × flow. When unset, the waterway acts as an outflow: it debits junction_a and the carried flow drains out of the modelled system (no downstream credit), so no synthetic ocean / sink junction is required. Mirrors Turbine.junction_b's built-in waterway drain mode.
OptTRealFieldSched gtopt:: Waterway:: lossfactor
Transit loss coefficient [p.u., dimensionless, 0..1]. The downstream junction credit becomes +(1 - lossfactor) × flow — models seepage / evaporation in transit. Defaults to 0.0 (lossless).