The mixing tank: two loops that fight

Hot and cold water set both the level and the temperature. Which valve should control what, and is it worth decoupling them, or handing both to an MPC?

🚰 Mixing tank: level and temperaturePID falls short8 guided steps
Step 1
Step 1 of 8

The situation

A tank blends hot water (70 °C) and cold water (15 °C) and supplies the mix by gravity. Both its temperature and its level are controlled, at 35 °C and 1 m. The mechanical view shows the catch: either valve raises the level, and each pulls the temperature its own way.

Step 2
Step 2 of 8

One loop: temperature on the hot valve

A PI on the temperature, the cold valve left where it is. The temperature is fine, but the level goes wherever the flows take it: it moves by up to 64 cm when the temperature setpoint changes, and by up to 72 cm as the demand changes. A second loop is needed.

Running the tests…
Step 3
Step 3 of 8

Two loops, each tuned alone

Add a PI on the level, on the cold valve, each loop tuned by SIMC on its own pair with the other open. Now watch the temperature when only the level setpoint moves: it swings by 6 °C, because the level loop's cold water hits the temperature, and the temperature loop's hot water then disturbs the level again. A 30 % demand change costs 3.8 °C.

Comparing in this step:PI on the temperatureTwo loops
Running the tests…
Step 4
Step 4 of 8

Which valve for which variable? The relative gain

The steady-state gains give the relative gain for "hot → temperature": λ11=(Th−T)/(Th−Tc)\lambda_{11} = (T_h - T)/(T_h - T_c), the cold share of the inflow. It is 0.64 at 35 °C: the right pairing, but with real interaction. At 55 °C it is 0.27, and the pairing should cross: the hot valve should hold the level and the cold valve the temperature.

The hot-recipe test runs at 55 °C. Paired the 35 °C way, a level change pulls the temperature by 7.3 °C; crossed, by 2.6 °C. The best pairing depends on the recipe.

Comparing in this step:Two loops, directTwo loops, crossed
Running the tests…
Step 5
Step 5 of 8

A static decoupler

Between the PIDs and the valves, add uhot=w1+caw2u_{hot} = w_1 + c_a w_2 and ucold=w2+cbw1u_{cold} = w_2 + c_b w_1 with ca=−g12/g11c_a = -g_{12}/g_{11}, cb=−g21/g22c_b = -g_{21}/g_{22} from the bump-test gains. When the level loop opens the cold valve, the hot valve opens in proportion, so the temperature doesn't notice; and the other way round.

A level change now moves the temperature by 0.1 °C instead of 6, and the demand change by 0.03 °C instead of 3.8. Two numbers did that. The same thing done physically is to control total flow and hot fraction; that version is exact at any temperature.

Comparing in this step:Two loopsTwo loops + decoupler
Running the tests…
Step 6
Step 6 of 8

MPC

An MPC with the linearized model at 35 °C, planning 5 moves of both valves over 200 s, equal weights, and a Kalman filter estimating a load at each valve. On interaction it is about as good as the decoupler (0.4 °C on the level change, 0.15 °C on demand). It is faster on temperature steps (IAE 17 against 67) and better when the hot water cools (0.7 °C against 1.6 °C), because it sees the load directly rather than waiting for the error.

Comparing in this step:Two loops + decouplerMPC
Running the tests…
Step 7
Step 7 of 8

When not everything can be met

At 50 °C, demand goes to 120 %. Holding 1 m at 50 °C would need more hot water than FV-901 can pass, so something has to give.

  • Two plain loops let the temperature sag to 47 °C. When demand falls again, the temperature overshoots to 55 °C as the hot loop unwinds.
  • The decoupler and MPC with equal weights also settle at about 47 °C and 1 m, but recover cleanly.
  • MPC with the temperature weighted 10× holds 48.4 °C and lets the level float down to 0.92 m instead.

Only MPC lets you say which variable gives. A PID structure would need an override for that.

Comparing in this step:Two loopsMPC, equal weightsMPC, temperature first
Running the tests…
Verdict
Step 8 of 8

Verdict

For one tank: decouple. Check the relative gain, pair accordingly, and add a static decoupler, or better, restructure to total flow and hot fraction. Two numbers remove almost all the interaction.

MPC matches it on interaction and wins on setpoint changes, on load upsets and at the limits, where its weights decide what gives; it has the lowest error overall in the Compare controllers table. On a single tank that doesn't always pay for a model someone has to keep right. On a unit with many interacting variables and constraints that bind every day, it does, which is why refineries and chemical plants run it.

Either way, the operating point matters: the relative gain runs from 0.82 at 25 °C to 0.27 at 55 °C, so a decoupler or a model taken at one recipe is off at another.

Everything in this case, through every test

Running the tests…