VolumeRight struct
#include <gtopt/volume_right.hpp>
Volume-based water right (derechos de volumen).
Models the accumulated volume entitlement of a right holder from a reservoir. Behaves like a storage element for LP/SDDP purposes: accumulates delivered volumes over time with state variable coupling across phases.
This is purely a rights accounting entity — it is NOT part of the hydrological topology. The physical water delivery is modeled through the existing hydro cascade; this entity tracks whether enough water has been allocated to satisfy the right.
The purpose field indicates the use case: "irrigation" for consumptive agricultural rights, "generation" for non-consumptive hydroelectric rights.
Public static variables
- static LPClassName class_name
Public variables
- OptActive active
- Activation status (default: active).
- OptTRealFieldSched annual_standing_loss
- Annual fractional loss [p.u./year].
- std::optional<RightBoundRule> bound_rule
- OptTRealFieldSched demand
- OptInt direction
- OptTBRealFieldSched ecost
- OptReal efin
- Minimum required accumulated volume at end [hm³].
- OptReal efin_cost
- OptReal eini
- Initial accumulated volume at start of horizon [hm³].
- OptTBRealFieldSched emax
- OptTBRealFieldSched emin
- OptReal fail_cost
- OptReal flow_conversion_rate
- Converts m³/s × hours into hm³ [hm³/(m³/s·h)].
- OptTBRealFieldSched fmax
- OptBool forfeit
- Name name
- Human-readable name.
- OptReal priority
- OptName purpose
- OptSingleId reservoir
- OptSingleId reset_credit_right
- OptSingleId reset_debit_right
- std::optional<MonthType> reset_month
- OptBool reset_monthly
- OptReal reset_value
- OptSingleId right_reservoir
- OptTBRealFieldSched saving_rate
- OptTBRealFieldSched soft_emin
- OptTBRealFieldSched soft_emin_cost
- Uid uid
- Unique identifier.
- OptBool use_state_variable
Default constants
- static Real default_flow_conversion_rate
- [hm³/(m³/s·h)]
Variable documentation
static LPClassName gtopt:: VolumeRight:: class_name
Canonical class-name constant used in LP row labels and config fields like VariableScale::class_name. Single source of truth — VolumeRightLP exposes no separate ClassName member; callers reach the constant via VolumeRight::class_name directly (or VolumeRightLP::Element::class_name in generic contexts).
std::optional<RightBoundRule> gtopt:: VolumeRight:: bound_rule
Volume-dependent bound rule for dynamic extraction adjustment. Serves two purposes:
- Per-block: caps extraction rate to min(fmax, rule_value)
- At reset_month: provisions eini = rule_value (annual quota) Both evaluated from the referenced reservoir's current volume via a piecewise-linear function. Implements PLP cushion zone logic (Laja/Maule).
OptTRealFieldSched gtopt:: VolumeRight:: demand
Required volume delivery per stage [hm³]. This is the demand that must be met — unmet demand incurs the fail_cost penalty.
OptTBRealFieldSched gtopt:: VolumeRight:: ecost
Shadow cost of accumulated rights [$/hm³] — per-(stage, block); accepts a scalar (broadcasts), a 2-D nested array, or a file-backed schedule.
OptTBRealFieldSched gtopt:: VolumeRight:: emax
Maximum accumulated right volume [hm³] — same shapes as emin.
OptTBRealFieldSched gtopt:: VolumeRight:: emin
Minimum accumulated right volume [hm³] — per-(stage, block); accepts a scalar (broadcasts), a 2-D nested array, or a file-backed schedule.
OptTBRealFieldSched gtopt:: VolumeRight:: fmax
Maximum extraction rate from the right [m³/s]. Physical capacity limit on the rate at which the right can be exercised.
OptBool gtopt:: VolumeRight:: forfeit
Free disposal of unused rights (default false). When true, a zero-cost forfeit column per block may drop remaining volume from the ledger, the rights analogue of a free spillway. A remaining- rights ledger whose volume sits at its cap (eini = emax, right unused) is otherwise a degenerate vertex: the cap and the zero- extraction bound both bind and the solver may return a NEGATIVE balance dual, which an SDDP cut then propagates as a negative value of holding rights. With free disposal the state value is provably >= 0. Primal-neutral for depletion ledgers (dropping a permission never helps); NOT for up-counters (reset_value) or debit sources, where disposal would erase a debt.
OptSingleId gtopt:: VolumeRight:: reservoir
Reference to the physical source reservoir. When set, the VolumeRight's input flow is subtracted from the Reservoir's energy balance (consumptive extraction — water exits the reservoir).
OptSingleId gtopt:: VolumeRight:: reset_credit_right
Credit reference for the reset provisioning (PLP compensation recompute at INICIOANO, genpdmaule.f:942-957):
provision = min(emax, own_incoming + credit_incoming)
where own_incoming is this bucket's carried state and credit_incoming the referenced bucket's remaining volume (e.g. the annual electric bucket: unused annual rights convert into compensation, capped at emax = VCompElecMax). Evaluated NUMERICALLY per stage in update_lp (mirroring PLP's FijaMaule, which fixes IVMDCEN from VarMaulePrev each stage/sim); the horizon's first stage keeps its config eini.
ORDERING: the referenced VolumeRight must appear EARLIER in volume_right_array.
OptSingleId gtopt:: VolumeRight:: reset_debit_right
Debit reference for the reset provisioning. When set, the reset does NOT pin eini to the provision; instead it emits the PLP row eini + debit.vol_in = provision (genpdlajam.f:234-239): the referenced VolumeRight's incoming volume (an up-counter of early spending, e.g. the anticipado counter IVGAF) is subtracted from this bucket's seasonal provision. With eini ≥ 0, spending more in advance than the provision covers is infeasible — the same guard PLP gets from IVDRF ≥ 0.
ORDERING: the referenced VolumeRight must appear EARLIER in volume_right_array (same constraint as right_reservoir).
std::optional<MonthType> gtopt:: VolumeRight:: reset_month
Calendar month at which rights are re-provisioned. When the stage's month matches reset_month, eini is set to:
- reset_value if set (explicit provision, e.g. 0 for the PLP IVGAF anticipado up-counter reset at INICIOANTIC)
- evaluate_bound_rule(reservoir_volume) if bound_rule is set (dynamic provisioning based on current reservoir level, PLP: DerRiego = Base + Σ(Factor_i × Zone_Volume_i))
- emax if no bound_rule (simple full reprovision) This implements seasonal accounting (e.g., Laja irrigation rights re-provisioned each December for the Dec-Apr season).
OptBool gtopt:: VolumeRight:: reset_monthly
Reset at EVERY stage that starts a new calendar month (PLP: TipoEtaDE != INTRAETA, genpdmaule.f:937 — the monthly electric counter IVMGEMF re-provisions each month). Requires stage months; the first stage of the horizon keeps its config eini (PLP resets only for IEta > 1). May be combined with reset_month (either condition fires the reset). Note: update_lp bound_rule refresh only tracks reset_month stages — do not combine reset_monthly with a bound_rule provision.
OptReal gtopt:: VolumeRight:: reset_value
Explicit provision value at reset_month [hm³]. Overrides both the bound_rule provisioning and the emax fallback. Use 0 for PLP-style up-counters that restart each season (IVGAF resets to zero at INICIOANTIC, genpdlajam.f:656-660).
OptSingleId gtopt:: VolumeRight:: right_reservoir
Optional reference to another VolumeRight for volume balance. When set, this VolumeRight's input flow is added to the target VolumeRight's energy balance row with the given direction sign. This enables hierarchical rights structures (e.g., a parent VolumeRight distributing volume among child rights).
OptTBRealFieldSched gtopt:: VolumeRight:: saving_rate
Maximum saving deposit rate per block [m³/s]. Only meaningful for economy VolumeRights (purpose="economy"): represents the rate at which unused rights are converted into savings. When set, a saving LP variable is created per block. PLP: IVESN/IVERN/IVAPN.
OptTBRealFieldSched gtopt:: VolumeRight:: soft_emin
Soft minimum volume [hm³] — per-(stage, block); accepts a scalar (broadcasts), a 2-D nested array, or a file-backed schedule.
OptTBRealFieldSched gtopt:: VolumeRight:: soft_emin_cost
Penalty cost for soft_emin violation [$/hm³] — per-(stage, block).
OptBool gtopt:: VolumeRight:: use_state_variable
Whether to propagate accumulated volume state across phases via StateVariables (SDDP-style coupling — Tilmant's "dummy reservoir").