Simulator design (draft for discussion)
Source: Doug's Part Four, 2026-11-24. Related notes: rule-curves.md, authorities.md, research-data-map.md. Nothing here is built yet. Items marked Q are questions for Doug.
1. The idea in one paragraph
The user picks a historical date. The simulator rebuilds that water year from October 1 up to the date, using the research database, and draws it: lake level, inflow, releases, snowpack, river flows. From that date forward the user takes over. They set the snowpack, the Boysen and Buffalo Bill releases, the expected inflow and the Afterbay release, and watch the lake and river respond day by day through September 30.
The simulator serves two audiences:
- Learners, who need to see why operators did what they did.
- Doug, who wants to test "what if" scenarios as a prediction tool.
Audience (decided by Doug, 2026-11-24)
The simulator is for Doug, members of the Bighorn River Alliance, students, and possibly Reclamation staff. So:
- Defaults should teach. Every chart and flag needs plain-language explanations, for example "why did the release drop?".
- Numbers must hold up to an operator. Show the sources and the rule-curve set on every printout.
- No logins or saved state. It runs read-only against the research database.
2. The two halves of the timeline
| History (Oct 1 → chosen date) | Simulation (chosen date → Sep 30) | |
|---|---|---|
| Source | Database, read-only | Simulator mass balance |
| Lake elevation | bhr_fb_por |
Computed from storage on bhr_capacity |
| Inflow | bhr_in_por |
User scenario (section 3) |
| Gains below Boysen and Buffalo Bill | bhr_gain_por (= inflow − Boysen − Buffalo Bill releases) |
User scenario |
| Boysen + Buffalo Bill release | Derived: bhr_in_por − bhr_gain_por (combined only; see the data gaps) |
User sliders |
| Afterbay / river release | bhr_qrd_por, total bhr_qd_por, canal bhr_qj_por |
User, or the simulated operator (section 4) |
| Snowpack | bhr_se_por (basin SWE, inches), bhr_nrcs_wteq (25 SNOTEL sites) |
User scenario |
| Downstream | St. Xavier, Yellowstone gauges (USGS) | Routed from the release |
A vertical "today" line marks the chosen date. Everything left of it is fact; everything right of it is the scenario. What actually happened after the date is drawn as a reference line. That is the best teaching device we have: "you did X, Reclamation did Y." Setting (decided by Doug, 2026-11-24): Actual history is Show / Faint / Hide, with Faint as the default. Hide turns a past year into a blind exercise. It applies to every chart, and it has no effect after today in the current water year.
Mass balance (daily). S[t] = S[t−1] + (inflow − dam release − canal − evaporation) × 1.98347
- Here the dam release is the Afterbay release minus the 70 cfs of springs.
- Elevation is then read from the
bhr_capacitytable.
3. Scenario inputs (from the chosen date forward)
Doug's list
- Snow water equivalent (decided by Doug, 2026-11-24).
- Show a small line chart of the 30-year average basin SWE only, in inches, Oct–Sep. The average peaks at 13.3 in. on April 10 (
bhr_swe_30y_avg, 365 days) and melts out by early July. This is the same view as the SWE card in Doug's iosBighorn app. - The user clicks a point on the chart to predict this year's peak: a date and a depth in inches.
- The simulator reshapes the rest of the average curve to pass through that point. Accumulation scales up to the peak, and melt follows the average recession, shifted to the chosen date.
- Source:
bhr_swe_30y_avg. Check which 30-year window it covers before building. - Open: how the predicted peak feeds the inflow. My proposal is to suggest an April–July inflow volume from a peak-SWE-vs-inflow regression on 1978–2025 (
bhr_se_poragainstbhr_in_por). The user can accept it or override it. To confirm with Doug.
- Show a small line chart of the 30-year average basin SWE only, in inches, Oct–Sep. The average peaks at 13.3 in. on April 10 (
- Upstream flows (decided by Doug, 2026-11-24). Phased:
- Now: one combined "Boysen + Buffalo Bill" release, from
boyr_qd_por+bbr_qriv_por(since 2026-11-28; before that it was derived asbhr_in_por − bhr_gain_por, which also counted the Heart Mountain Canal draw). Oct–Mar is a steady winter release (Boysen 750 + Buffalo Bill 375 cfs by default, Doug 2026-11-29); Apr–Sep the user sets the combined release by month, or leaves a month blank to follow the pattern. - Kane and Lovell (Bighorn River at Kane, USGS 06279500; Shoshone River near Lovell, 06285100) carry the majority of the lake's inflow: the dam releases plus the gains above the gauges. They are not the releases themselves (Doug, 2026-11-28). They could later split the inflow into "at Kane and Lovell" and "local below them".
- Later option: set Boysen and Buffalo Bill separately (both histories are loaded), with their capacity tables for an upstream-reservoir view.
- Now: one combined "Boysen + Buffalo Bill" release, from
- Bighorn Lake inflow. The rule: inflow ≥ Boysen + Buffalo Bill releases, because gains can't go negative over a season. Entered either as:
- an April–July (or remaining-season) volume, shaped by a historical hydrograph the user picks (a wet year, a dry year, or "like 2011"), or
- a gain volume added on top of the upstream releases.
- Afterbay release. Either the user drives it (manual mode) or the simulated operator follows the criteria (auto mode). See section 4.
Suggested additions
- Rule-curve set: 2020 no-encroachment (default), 2012 or 2010.
- Starting conditions override, for "what if the lake had been 5 ft lower on April 1?"
- Forecast vs. reality (decided by Doug, 2026-11-24).
- The simulated operator uses the forecast as it stood on each date: April 1, April 15, May 1, May 15 and June 1, plus the Feb/Mar forecasts for the winter adjustments. There is no perfect-foresight option.
- The user predicts how wrong that forecast is with a percentage adjustment (for example −20% … +40%). The inflow that actually arrives in the scenario is forecast × (1 + adjustment), shaped by the chosen hydrograph.
- So the operator plans on the official number while the user decides what nature delivers. For calibration: 2011's actual April–July inflow was 184% of the April 1 forecast (+84%), and 2015's was 228% (+128%). 2025's was 90% (−10%).
- Where no historical forecast exists for the chosen date, the user enters the forecast. The SWE-based suggestion (item 1) pre-fills it.
- For past years with "Actual history" on, the simulator also shows what the adjustment really turned out to be (actual ÷ forecast − 1).
- Storm events. Drop a rain-on-snow or rain event onto a day: extra volume over N days. This is the late-May 2011 case.
- Yellowstone condition. Use the historical Yellowstone flows, or scale them, to drive Corps hold-backs once the lake is in the flood pool (see authorities.md).
- Ramp limit: 500 cfs/day by default, up to 2,000.
- Constraints the user can toggle:
- minimum river flow (e.g. 1,500 / 2,000 / 2,500 cfs);
- maximum release before spill;
- October 31 target band;
- Horseshoe Bend lake-level wishes (e.g. boat ramp usable above X ft).
- Canal diversion (
bhr_qj_por): historical by default, editable. - Evaporation: monthly default; small but real in August–September.
4. Operator modes
| Mode | Who sets the Afterbay release |
|---|---|
| Manual | The user, day by day or as a schedule |
| Auto (Reclamation) | Simulated operator. Uses the Nov–Mar formula and risk sharing, and the Apr–Jul rule curves with RiverWare-style targeting (Apr 30 → minimum → end of May → July fill). Also applies low-flow operations below minimum fill, and the ramp limit |
| Auto + Corps | Same as Auto, plus Corps control above 3640 ft: hold back when the Yellowstone is high, evacuate when it isn't |
| Coach | The user sets releases while the simulator shows what Auto would have done, and flags rule-curve departures, flood-pool entry and missed targets |
Coach mode is the educational heart: learners make decisions and get immediate, explained feedback.
Decided by Doug (2026-11-24): build all of the modes, Manual, Auto and Coach. For any past water year, Coach compares the user's run against two references:
- what the rules say (Auto);
- what actually happened (from the database).
Only the current water year has no "actual" after today.
5. Outputs and graphics
Main chart. Lake elevation with:
- the pool zones;
- the active rule curve for the current forecast, which moves as forecasts change;
- the Oct 31 and Mar 31 targets;
- the history/simulation split;
- the "actual" ghost line.
Flows panel. Inflow, Boysen + Buffalo Bill, gains, Afterbay release, St. Xavier, and optionally Glendive.
Snow panel. The 30-year average SWE curve with the user's predicted peak, as above. Doug asked for the average only, so no clutter from other years.
Status strip (per day):
- who controls the lake (Reclamation or Corps), from authorities.md;
- operating mode: winter, rule curve, low-flow, flood;
- flags for spill, flood pool and ramp violations.
Scorecard at the end of a run:
- Lake. Peak elevation; days above 3640; days the Horseshoe Bend ramps are usable.
- River. Minimum river flow; days below 2,000 cfs; days above 8,000 / 15,000 cfs.
- Power. Spill volume; energy generated (MWh, an estimate from turbine flow and head).
- Targets. Oct 31 and Mar 31 targets hit or missed.
Biology overlays. Thresholds tied to flow and temperature: spawning (redds in spawn), side-channel dewatering, gas supersaturation when spilling. To be defined with the criteria (see the TODO list).
Print (decided by Doug, 2026-11-24). Nothing is saved. Instead, the user prints. The workflow is: select a date, change parameters, print, repeat.
- The print layout is a single page (letter, landscape) with:
- the lake chart and the river chart up to a chosen "as of" date;
- a parameter box listing everything that produced the run: water year, start date, rule-curve set, mode, SWE peak, forecast and % adjustment, upstream flows, ramp limit, storm events and Yellowstone setting;
- the scorecard, plus a footer with the run date and data sources.
- Built as a print stylesheet (
@media print) on the same page, so "Print" and "Save as PDF" come from the browser, with no server work. - Optional, in-session only: keep the previous run as a dashed overlay, to compare two parameter sets before printing. It is lost on reload.
6. Ensemble forecast (deferred)
The idea:
- Take today's state: SWE, soil moisture proxy, lake, upstream reservoirs.
- Run the rest of the season under every historical year's inflow pattern (≈ 1967–2025), scaled to the current snowpack.
- Plot the spread as percentile bands (10/50/90) for inflow volume, lake level and release.
This is the ESP method NRCS and the River Forecast Centers use. A first version needs nothing beyond what's already in the database. Doing it well needs research into snowpack-to-runoff relationships by month. Deferred, per Doug.
7. Data gaps that affect this design
- Kane (06279500) and Lovell (06285100) daily history. In
researchasusgs_kane_porandusgs_lovell_por. They are the main inflow gauges to the lake, not the dam releases. - Boysen and Buffalo Bill releases. In
researchasboyr_qd_porandbbr_qriv_por(Doug, 2026-11-28); the simulator uses their sum. Their capacity tables, for an "upstream reservoirs" view, are still to come from Doug. - Historical forecasts. Done for 1967–2025 in
data/forecasts-yellowtail.json:- 2009–2025 come from Reclamation's Upper Missouri AOP reports: Jan, Feb, Mar and Apr 1 (April–July volumes), May 1 (May–July) and Jun 1 (June–July), plus the actual.
- 1967–2008 come from the 2010 workbook: Apr 1, May 1 and Jun 1 only.
- WY2026 comes from Doug's January–June 2026 monthly plans, including the minimum and maximum forecasts.
- Mid-month (Apr 15, May 15): Reclamation's reports don't include them, so the simulator estimates them (section 13) and marks them "est.".
- Evaporation by month.
- NWS flood thresholds at the Yellowstone gauges, and Afterbay-to-Glendive travel times.
8. Build order (proposal)
Revised 2026-11-24 after Doug's six answers:
Where we are (2026-11-25): steps 1–4 are built and committed. Step 5, Corps mode, is built (section 12), uncommitted. The Yellowstone data is in the Research Library (usgs_<gauge>_por, 2026-11-25).
- History view. ✅ Built 2026-11-24:
/simulateand/api/water-year.- Date picker; rebuild Oct 1 → date from the database.
- Lake and river charts with pool zones.
- Actual-history line, Show / Faint / Hide.
- Print layout.
- Usable on its own as a teaching tool.
- Manual simulation. ✅ Built 2026-11-25. See section 9.
- Mass balance on
bhr_capacity. - SWE peak click, forecast and % adjustment, inflow shaping.
- Combined upstream release.
- User-set Afterbay schedule with the ramp limit.
- Mass balance on
- Auto (Reclamation) operator. ✅ Built 2026-11-25. See section 10.
- Nov–Mar formula, rule curves (2020 default), low-flow operations.
- Validated against WY2010, 2011 and 2018 actuals (and 2015, 2017, 2021, 2023, 2026).
- Coach mode and scorecard. ✅ Built 2026-11-25. See section 11. Your run vs. the rules vs. what actually happened.
- Corps mode. ✅ Built 2026-11-25. See section 12. Flood-pool control with Yellowstone-keyed holds.
- Data work that unlocks more, which can run in parallel with steps 2–5:
- Kane and Lovell
_portables; - historical forecasts from 2009 on;
- Yellowstone gauges;
- upstream capacity tables.
- Kane and Lovell
- Ensemble forecast (deferred).
- Backward solver. ✅ Built 2026-11-25 (section 14). From Doug's 2009 simulator.
- Solve several months at once. ✅ Built 2026-11-25 (section 15). Original note: Let the user mark which months the solver may change (or give each month a minimum and maximum release), and find a schedule of monthly releases that reaches the aim: the 2009 simulator's twelve monthly boxes with a Lookup button. The steady-release solver can't hit a target like 3640 ft on Jul 31 in a normal year, which needs less water out now and more later. Likely an optimizer over the monthly releases (smoothest schedule that meets the aim), bounded by the ramp limit and river minimums.
- Ensemble ("What are the odds?"). ✅ Built 2026-11-25 (section 16, plan in
ensemble-plan.md). TODO: consider a hindcast coverage bar (for example 10-90% bands covering 70-90% of real outcomes); weight by the lake level as well as snowpack; a Web Worker if the sample grows.
9. How the manual simulation works (step 2)
Code: public/js/sim-engine.js (the model) and public/js/simulate.js (the controls). The model runs in the browser from the day after the chosen date to Sep 30.
Water balance
- Lake:
S[t] = S[t−1] + (inflow − dam release) × 1.98347af, with elevation frombhr_capacity(sent to the browser at 0.1 ft steps). - River below the Afterbay: river = dam release + 70 cfs − canal. The 70 cfs is a constant accretion from springs in the Afterbay (Doug, 2026-11-25: "That bit me 20 years ago when my very manual calculation kept coming up exactly 70 cfs short."). The user sets the river release, so the model works back to the dam release: dam release = river − 70 + canal.
- Canal diversion follows the pattern year (average
bhr_qj_por_avg, the analog year, or what happened). - No separate evaporation term:
bhr_in_poris Reclamation's computed inflow, which already nets it out. - Checks against the record, WY2011: the daily storage change from
bhr_in_porandbhr_qd_pormatches the capacity table to 22 af/day on average (8,100 af over the year); the river identity holds to 0 ± 68 cfs/day. - Replaying history (inflow and releases "What happened") reproduces the lake: 2011 from Jun 26 peaks at 3655.3 vs 3655.0 ft; 2018 from Jun 9 peaks at 3645.2 vs 3645.3; 2021 matches to 0.01 ft; 2011 from Oct 1 ends Sep 30 at 3639.8 vs 3640.4.
Inflow
- Forecast (default): the latest forecast issued on or before the chosen date, × (1 + adjust %). The daily pattern (average year from
bhr_in_por_avg, or "like water year N") is scaled so the forecast period (Apr–Jul, May–Jul or Jun–Jul, ending Jul 31) adds up to the volume, counting what had already arrived by the chosen date. Outside the forecast period the pattern is used as is, × (1 + adjust %). With no forecast in effect (Oct–Dec, or after Jul 31) the pattern × (1 + %) is used. - My snowpack: the user clicks the snowpack chart ahead of the chosen date to predict the peak. Apr–Jul volume = average Apr–Jul inflow × (predicted peak ÷ average peak of 13.3 in), and with the average pattern the melt is shifted by the difference between the predicted and average peak dates. The chart draws a projected snowpack line.
- What happened (past years only): the recorded inflow, × (1 + adjust %).
- The adjust slider runs −75% to +150%. For calibration: 2011 came in 84% over its April 1 forecast, 2015 128% over, 2025 10% under.
Boysen + Buffalo Bill
- The pattern year's own upstream release is
boyr_qd_por+bbr_qriv_por(their day-of-year average for the average year). - Oct–Mar uses a steady winter release, Boysen 750 + Buffalo Bill 375 cfs by default (both editable). The average year's winter upstream release is about 1,300–1,700 cfs, so following it made the lake climb about 3 ft too fast by late January. "What happened" keeps the record in winter.
- Apr–Sep: six monthly boxes for the combined release. Blank follows the pattern (its monthly mean shows as the placeholder); "Fill from history" copies those means in. They reset when the date changes.
- A set release swaps the pattern's: inflow = scaled pattern inflow + (set release − pattern's upstream release), so raising the upstream release raises the inflow by the same amount. The ensemble uses the monthly boxes but keeps each year's own winter release.
- Finding: the average gain below Boysen and Buffalo Bill (
bhr_gain_por_avg) is negative from late June through the summer (about −1,500 cfs in mid-July, irrigation depletions). So in summer inflow is normally less than the combined upstream release, and the model doesn't force inflow ≥ upstream. It also can't scale the gain alone to reach a forecast volume; it scales the whole inflow pattern instead. - Confirmed by Doug (2026-11-25): gains often turn negative in dry or drying conditions and when irrigation ramps up. Inflow stays unconstrained by the upstream release.
Afterbay release
- "My schedule": the river holds its flow on the chosen date until the first change; each change ramps at the chosen rate (250, 500 (default), 1,000 or 2,000 cfs/day).
- "What happened" (past years): the recorded releases.
- Warnings: passing 3657 ft (top of the exclusive flood pool), rising past 3660 ft (top of the capacity table and the dam crest), or falling below 3557 ft (bottom of the capacity table).
Results and print
- A results strip under the lake chart: highest lake, days above 3640, Jul 31, Sep 30, lowest lake, highest river, Apr–Jul inflow. Simulated is compared with what happened, which follows the Show / Faint / Hide setting.
- The print header lists the inflow, upstream and release settings.
Forecast story
A one-line plain-language summary above the forecast table, for students: "A steady slide, from 105% to 42% of average", "A steady climb, from 101% to 256% of average. The water that came was 84% more than the April 1 forecast" (2011). In Hide mode it covers only the forecasts known on the chosen date.
10. The auto (Reclamation) operator (step 3)
Code: makeOperator in public/js/sim-engine.js; the rule curves come from /api/rule-curves (managers/rule-curve-manager.ts, built from the three data/rule-curves-*.json files). Choose Auto under Afterbay release. The rule-curve set defaults to the one in force that year (WY ≤ 2011: 2010; 2012–2019: 2012; 2020 on: 2020 no-encroachment), or the user picks one. The rule curve the operator is following is drawn as a dotted line on the lake chart.
The rules, as coded
It follows the 2018 RiverWare review's description of the criteria (rule-curves.md, "How the RiverWare model applies the curves"):
| Period | What the operator does |
|---|---|
| Nov–Mar | One steady winter release, recomputed on the 1st of each month, that reaches 3617 ft on Mar 31. Risk sharing: if under 2,000 cfs, aim at 3615 ft and clamp to 1,500–2,000; if over 2,500, aim at 3619 ft with at least 2,500. |
| Feb–Mar, big year | If the forecast is at or above the upper-quartile (UQ) curve volume, draft toward the Apr 30 rule-curve level instead. |
| Apr–Jul | Interpolate the rule curve for the forecast in effect (storage between the two bracketing curves, by volume, per the spreadsheet) and release to be on it a week ahead. From June 1, release at least the steady flow that fills to 3640 ft on Jul 31 according to the forecast. Floor 2,000 cfs, cap 15,000 cfs. |
| Apr–Jul, dry year | Below minimum fill: low-flow operations, a steady 1,500–2,000 cfs aiming at 3640 ft on Jul 31. |
| Aug–Oct | Reach 3637.5 ft (middle of 3635–3640) on Oct 31, if that allows at least 2,500 cfs. Otherwise release for 3617 ft next Mar 31, clamped to 1,500–2,000 cfs. |
| Any day | If the coming week would carry the lake over 3640 ft, release enough to hold it. |
| Above 3640 ft | The Corps is in control (step 5). For now the operator drains to 3639.5 ft within a week, up to 15,000 cfs. |
- Decisions are weekly, on the 1st of each month, and whenever the guard trips; releases are rounded to 50 cfs.
- The ramp limit (default 500 cfs/day) applies, except that the operator may move 2,000 cfs/day when the lake is in, or headed for, the flood pool (Doug: likely no more than 2,000).
- What the operator knows: the forecast is its plan. With Forecast or My snowpack inflow that is the scenario's Apr–Jul volume. With What happened inflow it sees Reclamation's forecasts as issued, each on its date, so a forecast miss plays out as it did. For the week ahead (curve targeting and the 3640 guard) it uses the scenario's inflow, standing in for short-range forecasts.
- Past Sep 30 (winter and Oct 31 targets) the outlook is average inflow scaled by how the last 30 days compared with average.
- A long steady release can dip far below its target before a late inflow arrives (WY2017 drafted to 3557 ft in testing), so winter releases are also capped at what reaches the target within 30 days.
Validation: full water years, What happened inflow, Auto releases
| Water year | Curves | Peak, auto vs. actual (ft) | Days above 3640, auto vs. actual | Sep 30, auto vs. actual (ft) |
|---|---|---|---|---|
| 2010 | 2010 | 3640.4 vs. 3645.6 | 15 vs. 40 | 3637.5 vs. 3630.1 |
| 2011 | 2010 | 3641.1 vs. 3655.0 | 28 vs. 97 | 3636.8 vs. 3640.3 |
| 2015 | 2012 | 3642.8 vs. 3647.8 | 38 vs. 51 | 3638.0 vs. 3635.7 |
| 2017 | 2012 | 3640.8 vs. 3647.0 | 24 vs. 39 | 3637.1 vs. 3639.5 |
| 2018 | 2012 | 3640.3 vs. 3645.3 | 12 vs. 55 | 3636.7 vs. 3634.1 |
| 2021 | 2020 | 3635.0 vs. 3633.6 | 0 vs. 0 | 3631.4 vs. 3626.7 |
| 2023 | 2020 | 3641.5 vs. 3647.7 | 24 vs. 41 | 3637.1 vs. 3638.3 |
| 2026 | 2020 | 3633.3 vs. 3633.4 | 0 vs. 0 | 3624.7 vs. 3624.2 |
- Dry and average years track closely: WY2026 stays within about 3 ft all year and ends Sep 30 within 0.5 ft.
- In big years the auto operator keeps the lake lower than reality did. Two reasons: it has no Corps holds yet (2011's 3655 ft came largely from the Corps cutting releases while the Yellowstone flooded, which is step 5), and its week-ahead inflow knowledge is better than real operators had. Expect the gap to shrink once Corps mode adds the holds.
- 2011 was the 2010 curves' last year; the 2010 criteria's 3618 ft March target isn't modeled separately (3617 ft is used throughout).
Ideas noted for later
- Make the operator's week-ahead outlook imperfect (e.g. persistence instead of the scenario's inflow) so students see forecast error at short range too.
- Use the published Nov–Mar gain regression (NMG = 0.14 × AOG + 222,402) instead of the scenario's own winter inflow.
11. Coach mode and the scorecard (step 4)
Code: scorecard and coach in public/js/sim-engine.js; rendered by renderResults and renderCoach in public/js/simulate.js.
Coach
- On by default with My schedule ("Coach me: run Reclamation's rules alongside"). The simulator runs the auto operator on the same inflow and draws it as The rules (lake and river, purple), with the rule curve it follows (dotted).
- The Coach card lists feedback, each with a level (warning, note, good):
- Into the flood pool: when your lake passes 3640 ft, its peak, and whether the rules went in too.
- Above the rule curve (more than 3 ft, Apr–Jul): the longest such stretch, the worst day, and what the rules were releasing then. Why it matters: less room for the runoff still coming.
- Below the rule curve (more than 5 ft): the risk of not filling.
- Missed the July 31 fill (below 3638 ft) or Filled on time; March 31 target off by more than 2 ft from 3617.
- Drained the lake (below 3580 ft, where the Barry's Landing and Ok-A-Beh ramps are out of the water).
- River: days below 1,500 cfs (fishery minimum, warning) or 2,000 cfs; more days above 8,000 cfs or more spill than the rules.
- What really happened (past years, unless Actual history is Hide), and Well run when there are no warnings.
- The Coach card is screen-only; it isn't printed.
Scorecard
One row each for your run (or Auto / Replay), the rules (when coaching) and what happened (follows Show / Faint / Hide). Counted from the day after the chosen date:
| Group | Columns |
|---|---|
| Lake | Highest (date), days above 3640 ft, Jul 31, Sep 30, Horseshoe Bend ramp usable (share of May 15–Sep 15 days at or above 3617 ft) |
| River | Lowest and highest (dates), days below 2,000 cfs, days above 8,000 cfs |
| Power | Energy (GWh, estimate) and spill (af) |
- Energy estimate: turbine flow (dam release up to 8,000 cfs, 4 units × about 2,000) × head (lake − 3180 ft, the Afterbay pool, approximate) × 0.85 ÷ 11.8 kW. Release above 8,000 cfs counts as spill. In October 2026 only 3 of 4 units were available (about 6,150 cfs); a unit-availability setting would be a refinement.
- The ramp-usable level (3617 ft) is the 2010 figure; sediment keeps raising it, so it should become a setting.
- The scorecard prints; the printout still fits one landscape page (chart heights were trimmed, the stat notes are hidden and the source note is shortened in print).
12. Corps mode (step 5)
Controller. On each simulated day, if the lake starts the day above 3640 ft the Corps is in control (controller: "COE"); otherwise Reclamation ("BOR"). It applies to My schedule and Auto runs, not to What happened. A tick strip along the bottom of the lake chart shows the Corps days. A Flood pool box in the scenario holds the settings; turning it off restores the old behavior (the Auto operator drains the pool within a week).
Top of joint use under My schedule. If the schedule would carry the lake above 3640 ft, the release follows the inflow to hold it at 3640 ft (ramping up to 2,000 cfs/day), as Reclamation does before the Corps steps in. Without it the Corps took over at 3640.05 ft, evacuated for a day and handed back, and the schedule ramped down again: a saw-tooth river every few days (Doug, 2026-11-29). The Corps still takes over when the inflow outruns the ramp. It looks two weeks ahead (the steady release that keeps the lake at or below 3640 ft on each of the next 14 days), so the release starts rising while the lake is still filling: without that it jumped from the schedule to the full inflow in a few days and overshot (Doug, 2026-11-29, a spike to 8,200 cfs in mid-June).
The release. For each day the Corps is in control (makeCorpsHold, corpsRelease in sim-engine.js):
- For each gauge,
base = flow at the gauge travel_days later − the recorded Afterbay release that day. That is everything the Bighorn's own release is not (the Yellowstone and the Bighorn's tributaries). It is scaled by the Yellowstone % setting. Travel days come fromdata/yellowstone-gauges.json; when the estimate is fractional, the larger base of the two neighboring days is used. headroom = limit − base, with the limit the NWS action flow (else minor) at that gauge, or the minor flow if chosen.- The release is the smallest headroom, held between the hold floor (3,500 cfs) and the evacuation rate: 9,000 cfs at 3640 ft, plus 1,000 cfs per foot above it, up to 15,000.
- Within a foot of the top of the flood pool (3656 ft), dam safety overrides everything: 15,000 cfs.
- The optional Missouri cap limits the release last, except under dam safety. The default is none; Doug will ask Reclamation what, if anything, it is.
- Ramp: the Corps ramp is 2,000 cfs/day each way (the Reclamation ramp does not apply).
- Past the latest data there are no Yellowstone records, so the Corps just evacuates at its rate (a note says so).
Where the numbers come from.
- Limits: NWS flood categories turned into flows with the NWS ratings (see authorities.md).
- Evacuation rate: in the 28 years the lake was above 3640 ft since 1970, the Afterbay release while the Corps was in control had a median of 6,600 cfs and a 75th percentile of 9,000. It rose with the pool: about 14,000 cfs near 3645 ft in 2015 and 2018, and over 16,000 in 2023.
- The default is therefore a fit to history, not a documented rule. The Corps' real criteria are not published here.
Checks (the lake starts in the flood pool, What happened inflow, Auto release; simulated peak vs. the real one):
| Year | Simulated peak | Real peak | Days above 3640 (sim / real) |
|---|---|---|---|
| 2011 | 3656.4 (action) | 3655.0 | 45 / 97 |
| 2018 | 3646.4 | 3645.3 | 32 / 55 |
| 2023 | 3650.6 | 3647.7 | 37 / 41 |
| 2015 | 3646.7 | 3647.8 | 25 / 51 |
| 2019 | 3643.2 | 3648.1 | 32 / 48 |
| 2009 | 3644.9 | 3647.9 | 30 / 97 |
- With the minor flow as the limit, 2011 peaks at 3648.1 ft, 7 ft under reality. The action flow matches 2011 best, so it is the default. The real Corps held at about 8,400 cfs with Glendive near 80,000 cfs, between the two limits.
- Only 2011 and a few other years have the Yellowstone limiting the Corps at all; in the others the evacuation rate decides. The simulator drains faster than the real Corps in 2009, 2015 and 2019 (shorter flood-pool stays, lower peaks), so treat its Corps results as a plausible run, not a prediction.
- In 2011 the real late-July releases (about 9,000–12,000 cfs) were well below what the Yellowstone could take. The Missouri was flooding that year, so a Missouri cap near 12,000 cfs probably explains it. That is the use case for the cap.
- Travel times are estimates (+/- 1 day).
Not built. Hold decisions use today's Yellowstone flow, not a forecast of it; the real Corps surely looks ahead. A user-set Yellowstone hydrograph for future years (the record is the only source now). Mid-month forecasts.
13. Estimated mid-month forecasts
Reclamation's annual reports and monthly plans have no April 15 or May 15 forecast, and I found no public source (2026-11-25). Doug's call: compute our own and mark them as estimated. Reclamation does revise its plans when the weather turns unexpectedly, which is why its plans carry minimum, median and maximum cases.
Method (addEstimates in history-manager.ts): the 1st-of-month forecast is moved by the change in basin snowpack (% of the 30-year average) between the 1st and the 15th:
estimate = forecast x (1 + w x (SWE% on the 15th / SWE% on the 1st - 1)), w = 0.8 for April 15 and 0.57 for May 15, limited to +/-25% and, when Reclamation's plan has a minimum and maximum for that forecast, held within them (only WY2026 on file so far).
How good is it? Not very, and the UI says so. Tested against the actual runoff over 41-48 years (leave-one-out):
| Forecast alone | With the snowpack change | |
|---|---|---|
| Apr 15 (Apr-Jul volume) | 339k af mean error | 333k |
| May 15 (May-Jul volume) | 245k af | 221k |
- Early-month inflow adds nothing: it didn't predict Reclamation's next forecast (correlation 0.24 for April, -0.08 for May) or the actual runoff.
- So an April 15 estimate is really the April 1 forecast with a nudge. May 15 is a small improvement.
- Because the real corrections come from weather and snowpack reports that aren't in the database, these estimates will miss the big unexpected changes Reclamation reacts to.
In the simulator. A box under Inflow ("Use estimated mid-month forecasts", on by default) switches them on or off. They feed the forecast-based inflow, the Auto operator's weekly decisions and the forecast table, where they are italic and tagged "est.". The story line above the table ignores them.
Reclamation's minimum and maximum plans (extracted 2026-11-25). The monthly plans are public PDFs (the live page has February 2020 to January 2023; older ones are in the Wayback Machine). ops/extract-monthly-plans.py reads the January-June plans for 2012-2023 and writes data/forecast-plans.json: for each plan the minimum, median and maximum inflow volume for its forecast period, and each scenario's monthly inflow through July. The same minimum and maximum are in data/forecasts-yellowtail.json (*MinAf, *MaxAf), so the estimate is now held to Reclamation's range in those years.
- Coverage: 61 plans. Missing: 2013 March and May, 2014 January and May, 2020 January, 2022 June, and everything from February 2023 (not posted). Plans before 2012 have only the most-probable run, so there is no range for 2008-2011. WY2024-2025 are not on the site.
- Layouts: 2012-2018 are three text tables ("Based on Most / Minimum / Maximum Probable Inflow Forecast"); 2019-2023 are an infographic with three monthly-inflow rows in no fixed order, sorted by volume. The April 2019 plan states its volumes in words instead.
- Check: the plan's median matches Reclamation's published forecast within 3% for 58 of 61 plans. Three differ: February 2012 (+5.4%), April 2013 (+8.3%) and June 2016 (+10.2%); the range is kept as printed.
Does following the plans' scenarios help? Doug's idea: see which of Reclamation's three cases the real inflow is tracking, and lean the forecast that way. I tested it on the April plans, 2012-2022 (10 years, since the monthly detail exists for them): put the inflow of April 1-14 against each scenario's April inflow, then move the forecast toward the maximum or minimum accordingly. It did worse than the forecast alone (mean error 531k af against 388k), and the snowpack nudge was about the same as the forecast (383k). Early-April inflow is too noisy to say which case the year is in. So the range is used to hold the estimate, not to steer it. A larger sample or a better signal (the real basin precipitation and snowpack reports Reclamation reads) would be needed.
14. The backward solver ("Aim for")
From Doug's Spring 2009 talk to the Friends of the Bighorn River (doug_haacke_reservoir_simulator.pdf on Reclamation's Issues Group 2009 page): that simulator had a "Sep 30 lake elevation, Lookup" box that worked out the releases to reach a target. The simulator here only ran forward, so this adds it.
What it does. In the Afterbay release box, "Aim for [ft] on [date] Solve" finds the steady river release, from the day after the chosen date, that leaves the lake at that elevation at the end of that date (SimEngine.solveSteady, bisection on the forward run, usually under 20 ms). Because it runs the real simulation, the ramp limit, canal, capacity table, Corps mode and the chosen inflow all count. It then sets "My schedule" to that release (steps between the start and the aim date are replaced, later steps kept), draws a ring on the lake chart where you asked the lake to be, and states the release and the monthly average river release. You then edit the schedule to see how the lake and the river respond.
What it can't do.
- One steady release can't do everything. Hitting 3640 ft on Jul 31 in a normal year needs less water out now and more later; the solver says so when the lake would pass 3640 on the way (the Corps then sets the release, not the schedule) and suggests a step schedule or a lower aim.
- Targets the lake can't reach (below the capacity table at 3557 ft, above the dam, or not reachable even at 0 or 30,000 cfs) are reported, and the schedule is left alone.
- It solves one number. The monthly solver in section 15 replaced it in the page (the steady solver remains in the engine as
solveSteady).
15. The monthly solver
Build order item 9. The same "Aim for [ft] on [date] Solve" button now solves month by month, with the 2009 simulator's monthly boxes under the schedule ("River release by month", one box per month from the day after the chosen date to Sep 30).
Using it. Type a release in any month box and that month is yours: it stays as you set it. Months you leave blank (and months the last solve filled, shown in italics) are solved. Press Solve and the solver finds releases for those months that put the lake at the aim on the aim date; the schedule is set to the result, so the lake and river charts show it. Typing in a box edits the schedule directly (one step on the first day of the month; blank removes the month's steps). Months after the aim date keep whatever they had.
How it solves (SimEngine.solveMonthly, a few milliseconds):
- Smoothest first. All solved months get the same release, found by bisection on the forward run. While solving, the Corps is switched off, so the lake responds smoothly to the releases; the answer is then re-run with the real settings.
- If that path would carry the lake over 3640 ft on the way (the Corps would take over and the schedule would stop mattering), it solves in two parts. First, month by month, the smallest release that still lets the lake be held under 3640, assuming the most is released in every later month (the ramp limit makes this a real constraint: the release can't be raised at once, so it has to be started in time). Then the same extra amount is added to every solved month until the aim is met. Raising every release lowers the lake all along the way, so it still stays under. That gives the "less now, more in the runoff, less after" shape a person would pick.
- Fishery floor. Solved months stay at or above 1,500 cfs unless the aim can't be reached that way; then it retries lower and says so.
- Honest about what can't be done. If even no release, or 15,000 cfs, can't reach the aim, or the aim can't be reached without passing 3640 ft on the way, it says why. In the second case it still shows the closest schedule.
Examples (April 1, 2021, April 1 forecast): aim 3625 ft on Sep 30 gives a steady 3,160 cfs, as before. Aim 3638 ft on Jul 31 (which a steady release can't do) gives Apr 1,570 · May 1,910 · Jun 6,370 · Jul 2,360. Aim 3640 ft on Jul 31 can't be met: the closest that stays under 3640 is 3639.3 ft, because monthly steps can't follow the runoff exactly. With June fixed at 5,000 cfs, aim 3630 ft on Sep 30 gives 2,650 cfs in every other month.
Limits. Monthly steps (a release can't change inside a month except by hand in the schedule list, and the solver replaces such steps in the months it solves). The release it prefers is the smoothest, not the best for fish or power: there's no objective beyond hitting the aim and staying under 3640. The ceiling is 3640 ft (or the aim, if higher); a different ceiling isn't offered. Not built: choosing which months may change by a range, or optimizing for river flow targets.
16. The ensemble ("What are the odds?")
Build order item 10. A card under the lake chart runs the chosen date's scenario against every other water year's weather and reports the range of outcomes and the odds. The plan, decisions and test results are in ensemble-plan.md (sections 12 and 13); this is what shipped.
- Members (
SimEngine.makeMember): the chosen year up to the as-of date, then each other year's daily inflow, Boysen and Buffalo Bill release, canal use, Afterbay release and Yellowstone flows, by calendar day. Forecast-based (B): the forecast in effect times that year's actual-to-forecast ratio, with that year's later forecasts (scaled the same) as what the operator sees. Climatology (A): the year as it happened./api/analogsserves all complete years (about 1.1 MB, cached an hour). - Weights (
SimEngine.snowWeights): Gaussian in ln(SWE % of average) on the as-of date, bandwidth 0.5 for B and 0.3 for A (hindcast). - Policies: both "under the rules" (Auto) and "your schedule" run, with the Corps on as set. About 230 runs in under a second after a 350 ms pause.
- Operator error: lake ranges and July 31 odds are widened by 6.5 ft (reached over 90 days) because Auto misses the real July 31 level by 5.2 ft on average even with perfect inflow. Flood-pool odds are not widened (they were unbiased in the hindcast, but only slightly better than the base rate, and worse after June 1).
- Odds shown: flood-pool entry, full by July 31 (3635 ft or higher), short on July 31 (below 3625 ft), river under 2,000 cfs for 10 days or more or over 8,000 cfs before July 31, highest lake level, July 31 level. Both flavours appear side by side; the chart follows the chosen one. Before April 1 Climatology is the default.
- Coach: one tip compares your schedule's flood-pool and shortfall odds with the rules'.
- Hindcast (
ops/ensemble-hindcast*.mts): volume bands cover 78-86% of real outcomes at 80%; B beats A from April 1; lake bands need the operator error to reach about 80%. - Limits: the past 58 years are the whole sample (no climate change, new upstream operation or new criteria); Auto isn't the real Reclamation; the Corps is a fitted model; flood-pool odds are rough, especially after June 1. The card says so.
Reclamation's operating plan (Operations Outlook)
Added 2026-11-29 at Doug's request. Each Yellowtail Monthly Plan has an OPERATIONS OUTLOOK: for the median, minimum and maximum inflow cases, monthly Boysen and Buffalo Bill releases, tributary gain, lake inflow, river release and end-of-month storage and elevation, from the plan's month to March (spring plans run further). scripts/import-operating-plans.py pulls them into data/operating-outlooks.json; /api/water-year returns the plan in effect (latest issued on or before the date, within two months, still covering a later month).
- Inflow basis "Reclamation's plan" with a Median / Minimum / Maximum case. Each month the plan covers gets the plan's inflow volume, spread over the days with the pattern; the month of the chosen date gets what is left of its volume after the observed days (held between half and twice the plan's mean). Boysen + Buffalo Bill follow the plan's monthly values (the Oct-Mar boxes are not used). After the plan's last month inflow follows the average pattern. The ± % applies throughout.
- Check: with the plan's river releases as the schedule, the Nov 2026 median and maximum cases reproduce the plan's end-of-month elevations to 0.1 ft. The minimum case runs 0.4-0.6 ft higher because November's inflow to the 26th was already above the minimum case.
- Boysen + Buffalo Bill by default (Doug, 2026-11-29): whatever the inflow choice (except What happened), blank Boysen, Buffalo Bill and monthly boxes use the plan in effect for each month it covers (the median case, or the chosen case with "Reclamation's plan"). Months it doesn't cover fall back to 750 + 375 cfs (Oct-Mar) and the pattern (Apr-Sep). A typed box overrides the plan.
- Charts: the plan's median end-of-month elevations (joined by straight lines from the day before the plan) and monthly river releases are drawn on the lake and flow charts, with the minimum-maximum range shaded, whenever a plan is in effect, whatever the inflow basis.
- When the simulator moves into the Research Library (Doug, 2026-11-29): import the operating plans from there, not from
data/operating-plans/. The Research Library already stores the Yellowtail Monthly Plan PDFs (public/documents/) and parses part of each intoop_plan_forecasts(3 months, no Boysen/Buffalo Bill or gain). Extend that import to keep the full Operations Outlook (all months, all rows above) and haveoutlookForread it from the database; then retirescripts/import-operating-plans.py,data/operating-plans/anddata/operating-outlooks.json.