A synthetic monthly streamflow record Qt is generated from a seasonal cycle plus lognormal noise, with periodic multi-month drought clusters whose depth and frequency scale with the drought-severity slider. Given a constant withdrawal demand D, the reservoir obeys simple mass balance each month:
S_t = clamp( S_(t-1) + Q_t − D , 0 , Capacity )
Spill_t = max(0, S_(t-1) + Q_t − D − Capacity)
Shortfall_t = max(0, D − Q_t − S_(t-1))
The minimum reservoir capacity that would deliver the demand D through the entire record without ever running dry is found independently of any assumed capacity, using the sequent-peak (mass-curve / Rippl) algorithm — the standard hand-calculation method taught in water-resources engineering before software optimization:
K_0 = 0
K_t = max( 0, K_(t-1) + D − Q_t ) for each month t
Required capacity = max_t( K_t )
Kt is the cumulative deficit of a hypothetical reservoir that starts full and is never allowed to spill; its running maximum is exactly the storage a real reservoir must hold in reserve to survive the worst drawdown sequence in the record. This is why real reservoirs (and this simulator) size capacity as a multiple of that number — undersizing (slider below 1×) reintroduces shortfall months even though the average inflow comfortably exceeds demand.
- Demand — constant monthly withdrawal, as a fraction of the record's mean inflow.
- Drought severity — widens inflow variance and lengthens/deepens the periodic drought clusters embedded in the synthetic record.
- Reservoir capacity — sets the physical tank size as a multiple of the sequent-peak requirement for the current demand and record; 1.00× is theoretically just enough.
- Reliability — the fraction of simulated months in which demand was fully met without shortfall.