gtopt::FlowRight struct

Flow-based water right (derechos de caudal)

Models the flow entitlement of a right holder at a river point. Always represents a consumptive outflow (direction = -1, fixed). When a junction is referenced, the flow variable is subtracted from the junction's physical balance row.

A deficit variable with penalty cost allows soft-constraint violation when water is scarce, analogous to demand_fail_cost for unserved electrical load.

The purpose field indicates the use case: "irrigation", "generation", "environmental", etc.

Public variables

OptActive active
Activation status (default: active)
std::optional<RightBoundRule> bound_rule
OptInt direction
STBRealFieldSched discharge
OptTBRealFieldSched fail_cost
OptTBRealFieldSched fmax
OptSingleId junction
Name name
Human-readable name.
OptReal priority
Priority level for allocation ordering [dimensionless].
OptName purpose
Uid uid
Unique identifier.
OptBool use_average
OptTBRealFieldSched use_value

Variable documentation

std::optional<RightBoundRule> gtopt::FlowRight::bound_rule

Volume-dependent bound rule for dynamic fmax adjustment. When set, update_lp evaluates the piecewise-linear function at the referenced reservoir's current volume and updates the flow column upper bound to min(fmax, rule_value). This implements PLP cushion zone logic (Laja/Maule).

OptInt gtopt::FlowRight::direction

Direction sign for LP coupling: +1 = supply (inflow to balance point) -1 = withdrawal (outflow / consumptive extraction)

STBRealFieldSched gtopt::FlowRight::discharge

Required extraction flow schedule [m³/s]. The demand that must be met — unmet demand incurs the fail_cost penalty. Indexed by [scenario][stage][block].

OptTBRealFieldSched gtopt::FlowRight::fail_cost

Penalty cost for unmet flow demand [$/m³/s·h]. Analogous to demand_fail_cost for electrical load curtailment. Higher values give this right higher priority in the LP. Supports per-stage-block scheduling for monthly cost modulation.

OptTBRealFieldSched gtopt::FlowRight::fmax

Maximum flow for variable-mode rights [m³/s]. When set (and discharge is 0 or unset), the flow column becomes variable [0, fmax] instead of fixed [discharge, discharge]. This enables partition constraints where the optimizer decides how to split flow among rights categories.

OptSingleId gtopt::FlowRight::junction

Reference junction where the right is exercised. When set, the FlowRight's flow is subtracted from the junction's balance row (consumptive extraction).

OptName gtopt::FlowRight::purpose

Purpose of the water right: "irrigation", "generation", "environmental", etc. Metadata only — does not affect LP.

OptBool gtopt::FlowRight::use_average

Whether to create a stage-average hourly flow variable (qeh). When true, FlowRightLP creates a stage-level LP variable equal to the duration-weighted average of the block-level flows: qeh = Σ_b [ flow(b) × dur(b) / dur_stage ] This mirrors PLP's IQDRH, IQDEH, etc. — the "H"-suffix stage-average variables used in volume accumulation constraints and rights limit bounds. Default: false (block-level only).

OptTBRealFieldSched gtopt::FlowRight::use_value

Value of exercising the right [$/m³/s·h]. Subtracted from the objective (benefit): positive = incentivizes use, negative = penalizes use. Added as −use_value to the flow variable's objective coefficient. Supports per-stage-block scheduling for monthly value modulation.