Operational Constraints

Source: HydroCore/src/constraints.jl


Two kinds of constraints

Real hydropower operation is bounded by two overlapping sets of rules:

Physical constraints — set by the laws of physics and engineering safety:

  • Turbine maximum discharge (mechanical limit)
  • Reservoir maximum volume (civil structure limit)
  • Penstock pressure limits

Regulatory constraints — set by the water licence (vannkraftkonsesjon):

  • Minimum environmental flow (minstevannføring)
  • Maximum reservoir drawdown rate
  • Seasonal flood-control curves

In an optimisation model, both kinds become constraints. The difference matters for violation handling: physical constraints are always hard (violating them is physically impossible); regulatory constraints might sometimes be relaxed with a penalty cost if no feasible solution exists.


FlowConstraint

Bounds on discharge through a single edge (Plant or Waterway).

struct FlowConstraint
    edge_id::String
    min_flow::Float64   # m³/s
    max_flow::Float64   # m³/s
    hard::Bool
end
# Maximum flow through a plant
fc1 = FlowConstraint("P1"; max_flow=120.0)

# Environmental bypass: must always flow at least 2 m³/s
fc2 = FlowConstraint("bypass_A"; min_flow=2.0, hard=true)

In the LP, these become simple bounds on the discharge variable q:

fc.min_flow ≤ q[edge, t] ≤ fc.max_flow   ∀ t

VolumeConstraint

Bounds on stored volume in a reservoir. Can be time-varying.

struct VolumeConstraint
    reservoir_id::String
    min_volume::Float64          # Mm³
    max_volume::Float64          # Mm³
    time_varying::Bool
    profile::Vector{Tuple{DateTime, Float64, Float64}}   # (time, min, max)
    hard::Bool
end

Constant bounds

vc = VolumeConstraint("R1"; min_volume=20.0, max_volume=300.0)

Time-varying (seasonal flood-control curve)

A common regulatory requirement in Norway: before the spring flood season, the reservoir must have headroom for incoming snowmelt. This is expressed as a maximum volume curve that varies by date:

vc = VolumeConstraint("R_UPPER";
    min_volume = 20.0,
    max_volume = 300.0,
    profile = [
        (DateTime(2020,1,1),  20.0, 300.0),   # winter: full range
        (DateTime(2020,4,1),  20.0, 220.0),   # pre-flood: max 73%
        (DateTime(2020,6,1),  20.0, 300.0),   # summer: back to full
    ]
)

bounds_at(vc, DateTime(2020,5,1))   # → (20.0, 220.0)
bounds_at(vc, DateTime(2020,7,1))   # → (20.0, 300.0)

bounds_at finds the most recent profile entry at or before the query time.


RampConstraint

Limits how fast discharge can change per hour.

struct RampConstraint
    plant_id::String
    max_ramp_up::Float64   # m³/(s·h)
    max_ramp_dn::Float64   # m³/(s·h)
    hard::Bool
end
rc = RampConstraint("P1"; max_ramp_up=30.0, max_ramp_dn=20.0)

In the LP this adds constraints between consecutive time steps:

q[t] - q[t-1] ≤  max_ramp_up × Δt_h     (ramp-up limit)
q[t-1] - q[t] ≤  max_ramp_dn × Δt_h     (ramp-down limit)

Why ramp constraints?

  1. Civil engineering: Rapid pressure changes in the penstock risk water hammer.
  2. Ecology: Rapid flow changes in the downstream river strand fish and invertebrates on exposed banks — a major concern under Norwegian environmental law.
  3. Regulation: Many water licences explicitly state maximum ramp rates.

Ramp constraints are typically hard=false in the initial LP — violations trigger a penalty but not infeasibility, because in practice the plant can always reduce output to zero in one step.


MinEnvFlow

Minimum ecological flow in a downstream river reach.

struct MinEnvFlow
    edge_id::String
    min_flow::Float64                         # m³/s (baseline)
    seasonal::Bool
    profile::Vector{Tuple{Int, Float64}}      # (week_of_year, min_flow)
end

Constant minimum flow

mef = MinEnvFlow("bypass_river"; min_flow=2.0)

Seasonal (typical Norwegian licence condition)

# 5 m³/s in summer spawning season (weeks 20–40), 1.5 m³/s otherwise
mef = MinEnvFlow("bypass_river"; min_flow=1.5, seasonal=true,
                 profile=[(20, 5.0), (41, 1.5)])

min_flow_at(mef, 25)   # → 5.0 m³/s
min_flow_at(mef, 45)   # → 1.5 m³/s

MinEnvFlow is conceptually similar to FlowConstraint but is a distinct type because:

  • It is always defined on a waterway (not a plant)
  • It has regulatory status and is often reported separately
  • Seasonal profiles use week number rather than DateTime

ConstraintSet

All constraints for a cascade, grouped by type.

cs = ConstraintSet()
push!(cs.flow,     FlowConstraint("P1"; max_flow=120.0))
push!(cs.volume,   VolumeConstraint("R1"; min_volume=20.0, max_volume=300.0))
push!(cs.ramp,     RampConstraint("P1"; max_ramp_up=30.0))
push!(cs.env_flow, MinEnvFlow("bypass"; min_flow=2.0))

println(cs)
# ConstraintSet:
#   flow:     1 constraint(s)
#   volume:   1 constraint(s)
#   ramp:     1 constraint(s)
#   env_flow: 1 constraint(s)

The planning layer receives the ConstraintSet and translates each constraint type into the appropriate JuMP constraint syntax.


What's missing (future work)

  • Coupled constraints: e.g., total discharge summed over a set of plants must not exceed a shared transmission capacity. Needs a GroupConstraint type.
  • Penalty formulation: soft constraints need a penalty cost; currently hard=false is stored but the penalty magnitude is not.
  • Unit-level constraints: min_discharge per unit vs. per plant (affects MIP).