gtopt/flow_right.hpp file

Flow-based water right (derechos de caudal).

Defines the FlowRight structure representing a flow-based water right. It tracks the required extraction rate (m³/s) that right holders are entitled to. When a junction is set, the flow is always consumptive: it subtracts from the junction's physical water balance.

The direction is always outflow (consumptive extraction from the river system), fixed and not configurable.

A purpose field indicates the right's use case (irrigation, generation, environmental, etc.) — all share the same LP structure.

Unified bounds + cost model

The bound triple (fmin, target, fmax) selects the LP shape:

  • fmin is a hard lower bound on the served flow. Default 0.
  • fmax is a hard upper bound on the served flow. Defaults to target when target is set, else to fmin (i.e. a forced flow).
  • target is the soft kink point. Below the target, fcost penalises shortfall; above the target, uvalue rewards excess. When target is unset, no kink exists and the column is a plain hard band [fmin, fmax].

The legacy discharge field is preserved as an alias of target for back-compat with existing fixture JSONs. Setting both discharge and target is an error.

Unit conventions

  • Flow fields (fmin, target, fmax): m³/s
  • Cost fields (fcost, uvalue): $/m³/s·h (penalty / reward per unit of unmet / excess flow per hour)

JSON Example

{
  "uid": 1,
  "name": "laja_nuevo_riego",
  "purpose": "irrigation",
  "junction_a": "laja_downstream",
  "target": [0, 0, 0, 0, 19.5, 42.25, 55.25, 65, 65, 52, 32.5, 13],
  "fcost": 5000
}

Namespaces

namespace gtopt

Classes

struct gtopt::FlowRight
Flow-based water right (derechos de caudal).