One Plan or Three Loops, With Preview
Open the Irrigation Canal Reach Control app
Advanced Control Exercise 20 of 30 in Linear MPC · All exercises · Time: 15 minutes
Water released at the head of a canal reaches the tail an hour later. A farm order published in advance can be planned for; an unannounced offtake can only be corrected after it is seen. This exercise times the release of a known order, then compares one predictive plan for all three gates with three local loops on known orders and on a surprise.
Learning Outcomes
- Use a known future disturbance inside a prediction, released one transport delay ahead.
- Explain why feedback alone, or feedforward that ignores the delay, cannot beat a transport delay.
- Compare a centralized MPC with decentralized loops on published orders and on an unannounced offtake.
Book Chapter
Model Predictive Control and Economic Optimization (Volume 9), Chapter 5, Irrigation Canal Simulator for Distant Downstream Control, Resonance and Releasing Water Ahead of Demand. Read the chapter, open the PDF, or watch the lecture slides.
Theory in Brief
Each reach of length `L` behaves at its downstream end like an integrator behind a dead time: the level `h` rises with inflow `q_{in}` that arrives `\theta` later, and falls with the gate below and any offtake `q_o`:
$$A_s \frac{dh}{dt} = q_{in}(t - \theta) - q_{out}(t) - q_o(t), \qquad \theta \approx \frac{L}{\sqrt{g\,y} + v}$$
A published order `q_o(t)` known over the horizon enters the prediction as a measured future disturbance:
$$x_{k+1} = A x_k + B u_k + B_d\, d_k, \qquad d_k, d_{k+1}, \ldots, d_{k+N} \ \text{known}$$
so the plan releases water early enough that it arrives as the order starts. A gate that adds the order to its flow at the moment it starts draws water out of the reach above before that reach's extra supply can arrive, so instant feedforward moves the shortage upstream. A centralized MPC plans all gates together on one model; decentralized loops each see their own reach, and a distributed MPC lets local plans agree on the flows between them by exchanging prices.
Model: Physics-based shallow-water reaches, reduced for control to integrators behind dead times fitted over three hours.
Decision: The flow through each gate, from one plan for the canal or one loop per reach.
Learning: The reduced model is fitted from the detailed one; a learned demand forecast would enter the plan as the preview does.
Exercise
Read 2 min · Predict 1 min · Run 7 min · Explain 3 min · Check your AI 2 min.
Predict. An order is known two hours ahead. How early should the head gate start releasing it, compared with the last gate before the farm? Will one plan for all gates beat three loops on published orders, on a surprise, or both?
Run the Irrigation Canal Reach Control app. Use the fastest speed, 1200×, and press Run again to pause at the times in each step.
- Open 8 · A published order, released one travel time ahead. Press Run and pause at 4 h. Read Worst level error.
- Press Reset, set Order feedforward to Now (feedforward at the moment of the order), and run to 4 h. Read the same tile.
- Open 10 · One plan or three loops (MPC) (MPC with the orders previewed) and run to 9 h. Read Worst level error and the per-reach errors on the trends before and after the unannounced offtake at 7 h.
- Press Reset, set Control philosophy to Distant downstream (feedforward stays on Ahead), and run to 9 h.
Explain.
- Why does releasing the order at the moment it starts do worse than releasing it a travel time ahead?
- Where does the single plan do better than the three loops, and why there?
Generative AI Learning
Check the answer against your run: A good answer says each gate opens one travel time per reach ahead of the order, the head gate first, and that opening all at once draws water from upstream reaches before their supply arrives. Your step 1 and 2 tiles test it. The assistant is your tutor and reviewer; you answer for every claim you turn in.
What to Turn In
A four-row table (ahead, now, MPC, downstream loops) with the worst level error, your written prediction, and three sentences that answer the two questions.

Released one travel time ahead at each gate, the order leaves a worst level error of 2.2 cm. Released at the moment of the order, the same water is late everywhere and the error is 16.2 cm. Each gate then draws its extra flow out of the reach above at once, and that reach's own supply arrives a travel time later, so every reach upstream gives up water. The lead is not a tuning knob: it is the transport delay.
Over nine hours with the orders and the unannounced offtake at 7 h, the single plan's worst level error is 2.8 cm and the three loops' 5.7 cm. On published orders there is little left to gain, because releasing ahead is already a plan for the whole canal; the app's case text notes that the loops even keep the reach ends slightly closer there. The plan wins on the surprise: when the offtake appears, it decides how much each gate gives and when, for the whole canal at once, while each loop adds the whole new flow to its own gate and pulls water from the reach above before its supply arrives.
Measured with the app build of December 3, 2026 by a scripted replay of the steps above. Numbers that no tile shows come from the replay's record; your readings from the trends will be close. A later app release may move the last digit.
Partial Differential Equations solves PDEs by the method of lines. Discretize the advection equation `\partial h/\partial t + c\,\partial h/\partial x = 0` along one reach and step the inflow: the outflow is the dead time. Then fit an integrator with dead time to the simulated level at the reach end and compare the two responses.
Related
- Check yourself: three-question quiz
- Course pages: Control Objectives, Partial Differential Equations, Model Predictive Control
- Exercises: previous: 19 · Explicit MPC: The Optimizer Solved in Advance; next: 21 · MPC on the Unstable Branch of a Nonlinear Reactor
References
- Hedengren, J. D. (ed.), Model Predictive Control and Economic Optimization, Volume 9 of Interactive Control Engineering, Chapter 5, "Irrigation Canal Simulator for Distant Downstream Control, Resonance and Releasing Water Ahead of Demand", pp. 98–124, Advanced Process Solutions, 2026. PDF (CC BY 4.0).
- Malaterre, P.-O., Rogers, D. C., Schuurmans, J., Classification of canal control algorithms, Journal of Irrigation and Drainage Engineering 124(1), 3–10, 1998.
