LP Scheduling — Single Reservoir, Single Plant
This document explains the LP scheduling model in WeeklyScheduling. It is the building block that will be extended to cascades (Phase 4) and embedded inside SDDP (Phase 6).
The problem
Given a planning horizon of T stages, find the turbine release schedule that maximises total value:
max Σ_t price[t] × prod[t] × Δt + end_val(v[T])
subject to:
v[t] = v[t-1] + inflow[t] − r[t] − spill[t] ∀t (water balance)
v_min ≤ v[t] ≤ v_max ∀t (storage bounds)
0 ≤ r[t] ≤ r_max ∀t (discharge bounds)
spill[t] ≥ 0 ∀t
prod[t] ≤ slope_k × r[t] + intercept_k ∀t, ∀k (PQ curve)
end_val ≤ vf[i] + wv[i] × (v[T] − grid[i]) ∀i (end-value cuts)Units
| Variable | Unit | Notes |
|---|---|---|
v[t] | Mm³ | Reservoir volume, end of stage t |
r[t] | Mm³/stage | Turbine release = q_m3s × step_seconds × 1e-6 |
spill[t] | Mm³/stage | Free spillage (no cost/revenue) |
prod[t] | MW | Power (auxiliary variable for PQ curve) |
price[t] | NOK/MWh | Electricity price (input data) |
| Revenue | NOK/stage | price[t] × prod[t] × step_hours |
Piecewise-linear PQ curve
The PQ curve has breakpoints (q_k [m³/s], P_k [MW]). For each segment:
slope_k = (P_{k+1} − P_k) / (q_{k+1} − q_k) [MW/(m³/s)]
intercept_k = P_k − slope_k × q_k [MW]Converting to Mm³/stage units (dividing slope by m3s_to_Mm3_per_step):
prod[t] ≤ slope_r_k × r[t] + intercept_k ∀t, ∀kSince prod[t] is being maximised and the PQ curve is concave (slopes are non-increasing), the LP forces prod[t] = P(r[t]) exactly.
End-value function
The end_val variable is bounded above by the end-value function.
WaterValueEndValue (Phase 1 SDP)
For each grid point i of the water value table:
end_val ≤ vf[stage, i] + wv[stage, i] × (v[T] − grid[i])These are tangent-line cuts at each grid point. The LP pushes end_val up to the minimum of all cuts, which equals V(v[T]) exactly for a concave value function. No SOS2 variables needed.
ZeroEndValue
end_val = 0 — equivalent to draining all water. Useful as a baseline.
SDDPCutEndValue (Phase 6)
Will use Benders cuts from SDDP: end_val ≤ α + β⃗ · v[T]. Same mechanism as WaterValueEndValue but multi-dimensional.
Using the model
using HydroCore, WaterValues, WeeklyScheduling
# Build inflow + price vectors (Mm³/stage and NOK/MWh, length T)
inflow = fill(3.0, 52) # Mm³/week
price = fill(400.0, 52) # NOK/MWh
# End-value from Phase 1 SDP
wvt = solve_sdp(res, plant, extract_periodic_inflows(series, WEEKLY);
price=400.0)
ev = WaterValueEndValue(wvt, 1) # wrap around to week 1 at end of year
# Solve
result = optimize_schedule(res, plant, inflow, price, ev;
resolution=WEEKLY, v0=75.0)
println(result)
# ScheduleResult: 52 stages, status=OPTIMAL, revenue=X MNOK, end_value=Y MNOK
# Extract results
result.volume # Mm³ per stage
result.production # MWh per stage
result.revenue_NOKResolution
The LP is fully resolution-agnostic. Pass resolution=DAILY for a daily model (365 stages):
inflow_daily = fill(3.0 / 7.0, 365) # same weekly total, spread over days
price_daily = fill(400.0, 365)
result = optimize_schedule(res, plant, inflow_daily, price_daily, ev;
resolution=DAILY, v0=75.0)All energy and volume conversions use step_hours(resolution) and m3s_to_Mm3_per_step(resolution) — no constants are hardcoded.
Connection to the planning hierarchy
WaterValues (Phase 1 SDP)
↓ produces WaterValueTable
WeeklyScheduling LP ← this package
↓ produces ScheduleResult
↓ (Phase 4: extended to cascade)
↓ (Phase 6: embedded in SDDP)
SeasonalPlanning (Phase 6–7)
↓ produces SeasonalPlan with near-term forecast