Monte Carlo Simulation — Validating Water Values

Monte Carlo simulation is the primary tool for validating the SDP water value table from Phase 1. Running the operating policy over many historical inflow years tells us whether the water values lead to sensible behaviour.


The operating policy

At each stage t the operator applies the rule derived from the SDP:

Release the discharge r* that maximises price_t × P(r) × Δt + V_{t+1}(v_t + q_t − r)

where V_{t+1} is the value function looked up from the WaterValueTable.

This is a greedy 1-D search — no optimisation over multiple stages. It is exactly what a reservoir operator would do if they trusted the water value table.


What the simulation tells us

Running 50–100 simulated years gives:

MetricWhat it reveals
P10/P50/P90 reservoir trajectoriesTypical filling cycle; dry vs wet years
Spill fractionHow often water is wasted (water value too low?)
Shortage fractionHow often reservoir hits v_min (water value too high?)
Mean annual revenueExpected economic performance
Revenue distributionRisk quantification (dry year downside)

Calibration signal: If the simulated reservoir hits v_min frequently, the water values are too high (over-saving) and should be revised down. If spill is frequent, water values are too low (releasing too aggressively). See Kompendium 1, §6.4.


Usage

using HydroCore, WaterValues, HydroSimulation

# Build system and SDP water values
wvt     = solve_sdp(res, plant, inflows; price=400.0)
inflows = extract_periodic_inflows(series, WEEKLY)
prices  = fill(400.0, 52)

# Run 100 Monte Carlo years
result = monte_carlo(wvt, res, plant, inflows, prices;
                     n_scenarios=100, seed=42)

# P10/P50/P90 reservoir trajectories (Vector{Float64}, length 52)
v10 = volume_p10(result)
v50 = volume_p50(result)
v90 = volume_p90(result)

# Annual production distribution
ap = annual_production(result)   # MWh per simulated year

# Risk metrics
sf  = spill_fraction(result, res.max_volume)
shf = shortage_fraction(result, res.min_volume + 5.0)
println("Spill $(round(100*sf, digits=1))% of stage-years")
println("Shortage $(round(100*shf, digits=1))% of stage-years")

Connection to the planning hierarchy

Phase 1 SDP  →  WaterValueTable
                    ↓
Phase 3 Simulation  →  P10/P50/P90 trajectories
                    ↓
             Calibration: if spill_fraction > threshold, lower water values
                    ↓
Phase 1 SDP re-run with adjusted terminal water value

This calibration loop was the standard practice in Norwegian hydro planning before modern SDDP tools. In our implementation, Phase 6 SDDP automatically finds the correct water values without manual calibration.