Simulation Control

t_end — Simulation Time (s)

Type the simulation time and press Enter to apply.

PID Controller Gains

Kp — Proportional 0.5
Ki — Integral 15.000
Kd — Derivative 0.00

A level loop sits on an integrator (A·dh/dt = net flow), so a PI controller gives a double integrator. The defaults (Kp = 0.5, Ki = 15) are deliberately reset-heavy: τi = Kp/Ki = 0.033 s gives ζ ≈ 0.007 — the loop overshoots hard and rings between the floor and the rim. Load PI (tuned) for a calm loop (ζ ≈ 0.6), or raise Kp to damp the ring.

Controller Options

PV Noise σ (m) 0.000

Turn σ up with Kd > 0 to see why derivative action is avoided on a noisy level signal — the valve chatters.

Split-Range Setup

Level Setpoint (m) 13.0
Drain Capacity Kv1 1.10
Make-up Capacity Kv2 2.50

The defaults are not authority-matched at the new setpoint: Kv1√hsp/50 = 1.1·√13/50 ≈ 0.079 vs Kv2/50 = 0.050 m³/s per %. The drain branch is ~1.6× stronger. To match them at hsp = 13 m, set Kv2 = Kv1√13 ≈ 3.97, or Kv1 = Kv2/√13 ≈ 0.69. Unbalanced branches behave differently in the two halves of the split.

Surge Drum & Load

Drum Area A (m²) 4.0
Feed qf (m³/s) 1.00
Draw-off qL (m³/s) 1.60

This is the load disturbance. Drag it slowly across qL = qf = 1.0 to hand control from V₂ to V₁ through the split dead band.

Setpoint Step (live)

Step the level setpoint while running and watch which valve takes the move.

Presets

Split-Range Characteristic u ≤ 50 % : V₁ = (50 − u)/50 × 100 , V₂ = 0
u > 50 % : V₂ = (u − 50)/50 × 100 , V₁ = 0

Surge Drum Schematic

LIVE
Surge Drum m 0 5 10 15 SP 5.0 m h = 3.00 m Feed qf Draw-off qL Make-up 0% Drain 0% LT PID split-range one output · two valves SPLIT DEAD BAND 50 % split PID output u V₁ drain V₂ make-up one output → two valves
Level h 3.00 m
PID out 50.0 %
V₁ drain 0.0 %
V₂ make-up 0.0 %
qin 0.000 m³/s
qout 0.000 m³/s
PV Drum level h and setpoint
MV Valve openings V₁ / V₂ and the controller output u
MV Flows: make-up, drain, feed and draw-off
Level
3.00 m
Controller Output
50.0 %
V₁ Drain
0.0 %
V₂ Make-up
0.0 %
Active Branch
dead band
Error (SP − h)
+2.000 m

Parameters & Equations

Everything this simulation uses, written out for study.

Process Model

Surge drum mass balance A · dh/dt = qf + qin − qout − qL h — level (m) · A — cross-section (m²) · qf — constant feed · qL — draw-off load (the disturbance)
Valve flow laws qout = Kv1 (V₁/100) √h   ·   qin = Kv2 (V₂/100) The drain is gravity-driven, so it follows √h (Torricelli). The make-up is pumped, so it is linear in the valve opening. The plant is an integrator — the controller sees A·dh/dt = net flow.
Overflow at the rim (open drum) qov = max(0, (qf + qin − qout − qL) while h = hmax = 15 m) The drum is open: when the inflow would push the level above the 15 m rim, h saturates and the excess leaves as overflow. The mass balance then closes in every state — a setpoint at the very brim behaves like a real overflowing vessel. For a clean steady state keep SP below 15 m (default 5 m).

Split-Range Characteristic complementary

Two bands from one output u ≤ 50 % : V₁ = (50 − u)/50 × 100 , V₂ = 0
u > 50 % : V₂ = (u − 50)/50 × 100 , V₁ = 0 u = 50 % is the split point: both valves shut. This "complementary" split is the standard fail-safe arrangement for a level loop — a failed signal parks both valves closed instead of over-feeding or fully draining the drum.
Branch gain matching drain: dq/du = Kv1√hsp/50  ·  make-up: dq/du = Kv2/50 With Kv1 = 1.1, Kv2 = 2.5, hsp = 5 m: 0.0492 vs 0.0500 m³/s per %. Match them, otherwise the loop is well behaved in one branch and violent in the other.

Steady States

qL (m³/s)BranchNeeded flowu (%)Valve (%)
0.2drain0.8033.74V₁ 32.5
0.4drain0.6037.80V₁ 24.4
0.8drain0.2045.93V₁ 8.1
1.0dead band0.0050.00both 0
1.2make-up0.2054.00V₂ 8.0
1.6make-up0.6062.00V₂ 24.0
2.0make-up1.0070.00V₂ 40.0

Every row above is reproduced by the running simulation to within 0.01 m. At exactly qL = qf the loop needs no flow at all, so it parks at u = 50 % with both valves shut — the split dead band, where the loop temporarily has zero gain. It is not an error: it is the price of the fail-safe split.

Controller — 2-DOF PID 2-DOF

Control law u = clamp[ 50 + Kp(β·SP − h) + Ki∫(SP − h)dt + Kd(γ·dSP/dt − dh/dt), 0, 100 ] Bias 50 % places the controller output at the split point when the level is on setpoint, leaving equal authority on both branches.

Why the defaults look odd (Kp = 0.5, Ki = 15): the plant is an integrator, so the loop transfer function with PI control is KpK(τis+1)/(τiAs²). Comparing with the standard second-order form gives

Damping of the level loop ζ = ½ √( Kp K τi / A ) ,   τi = Kp/Ki With A = 4, K ≈ 0.05 m³/s per %, the defaults Kp = 0.5, Ki = 15 give τi = 0.033 s and ζ ≈ 0.007 — far underdamped. The loop overshoots hard, reaches the 15 m rim (overflow engages) and the floor, then rings. The PI (tuned) preset (Kp = 12, Ki = 1.2245) restores ζ ≈ 0.6 with the same A = 4.

Derivative action is avoided here. A level signal is noisy, and Kd amplifies that noise straight onto the valve stem. Set σ = 0.05 m and raise Kd — the valve opening becomes a blur and the stem would wear out in the field. The default is Kd = 0.

Parameters

SymbolMeaningDefault
ADrum cross-section4.0 m²
Kv1Drain capacity coefficient1.10
Kv2Make-up capacity coefficient2.50
qfConstant feed1.00 m³/s
qLDraw-off load (disturbance)1.60 m³/s
SPLevel setpoint (1–15 m)13.0 m
usplitSplit point (fixed)50 %
KpProportional gain0.5
KiIntegral gain15.0
KdDerivative gain0.00

What to Try

1 — Walk the load across the split. Run (10x default — crank to 100x for a quicker walk), then drag Draw-off qL slowly from 1.8 down to 0.4. The controller output slides from 62 % to 37.8 %: V₂ closes, both valves are briefly shut at u = 50 %, then V₁ takes over. The level barely moves.

2 — Unbalance the valves. Set Kv1 = 2.5 to make the drain as big as the make-up. Now 1 % of output buys far more drain flow than make-up flow: the drain branch overshoots and rings while the make-up branch stays calm.

3 — Sit in the dead band. Set qL = qf = 1.0 and step the setpoint. Both valves stay shut and nothing happens — the loop has no authority until the level drifts far enough to push the output off 50 %.

4 — Feel the new default ring. With Kp = 0.5 and Ki = 15 the loop is far underdamped (ζ ≈ 0.007): the level swings from the drum floor to the 15 m rim, the drum overflows at the top, and control hands back and forth between V₁ and V₂. Press PI (tuned) to see the same load handled calmly (ζ ≈ 0.6).

5 — Make it noisy. Set σ = 0.05 m and raise Kd to 2. The valve strokes chatter continuously — the classic reason derivative action is left off level loops.

6 — Run the drum up to its new 15 m range. Drag the Level Setpoint slider up to 12–14 m and watch the level scale and the schematic fill re-range automatically. Push it all the way to 15 m (the rim): the drum saturates at the brim, the excess spills as overflow (the mass balance still closes exactly), and the level can no longer overshoot — the setpoint line, water, and V₁/V₂ all stay consistent on the new scale.