Simulation Control

t_end — Simulation Time (s)

Type the simulation time and press Enter to apply.

PID Controller Gains

Kp — Proportional 2.0
Ki — Integral 0.5
Kd — Derivative 0.0

Controller Options (HYSYS-style)

β — P Setpoint Weight 1.00
γ — D Setpoint Weight 0.00
PV Noise σ (m) 0.000
α — Derivative Filter (0 = off) 0.00

β < 1 softens the setpoint response (2-DOF). γ = 0 uses derivative-on-measurement. Turn windup off to see integral windup during saturation.

System Settings

Setpoint (m) 5.0
Tank Area (m²) 2.0
Flow Resistance (R) 1.0
Disturbance (m³/s) 0.0

Setpoint Step (live)

Step the setpoint while running to watch the transient response.

Presets

Transfer Function G(s) = 1 / (A·s + 1/R)
Controller: u = ubias + Kp(β·SP − h) + Ki·∫(SP − h)dt + Kd(γ·dSP/dt − dh/dt)

Tank Schematic

LIVE
Inflow V 0 2.5 5 7.5 10 SP Outflow Sensor PID Controller Process Tank (A = 2.0 m²)
PV Tank Level h — process variable
MV Inflow qin — manipulated variable
e Error (SP − h)
Current Level
0.00 m
Control Input
0.00
Error
0.00 m
Overshoot
0%
Settling Time
— s
SSE
—

Parameters & Equations

Everything this simulation uses, written out for study.

Process Model

Tank mass balance A · dh/dt = qin − h/R + d h — level (m) · qin — inflow (m³/s) · A — cross-section (m²) · R — outflow resistance · d — disturbance inflow (m³/s)
Steady state (open loop) hss = R · (qin + d) Time constant τ = A·R. With A = 2, R = 1 → τ = 2 s.

Controller — 2-DOF PID 2-DOF

Control law qin = clamp[ Kp(β·SP − h) + Ki∫(SP − h)dt + Kd(γ·dSP/dt − dh/dt), 0, 20 ] error e = SP − h. Integral uses the full error; derivative uses the weighted setpoint minus the measurement.

β (beta) is the proportional setpoint weight. β = 1 is a standard PID; β < 1 reacts more gently to setpoint changes (less overshoot) while still rejecting disturbances at full gain.

γ (gamma) is the derivative setpoint weight. γ = 0 gives derivative-on-measurement (no derivative "kick"); γ = 1 gives derivative-on-error.

Parameters

SymbolMeaningDefault
ATank cross-section area2.0 m²
ROutflow resistance1.0
SPLevel setpoint5.0 m
dDisturbance inflow0.0 m³/s
KpProportional gain2.0
KiIntegral gain0.5
KdDerivative gain0.0
qinInflow (actuator, clamped)0–20 m³/s

Controller Options

SymbolMeaningDefault
β 2-DOFProportional setpoint weight1.00
γ 2-DOFDerivative setpoint weight0.00
α filterDerivative filter (0 = off)0.00
σ noisePV sensor noise std-dev0.00 m
AW windupAnti-reset windup (back-calculation)on

Anti-reset windup (back-calculation): when the inflow saturates at its limit, the integral is bled by the over-drive I ← I + (Δt/Tt)(usat − u), so it cannot "wind up". Turn it off to see the slow recovery caused by windup.

PV noise: a zero-mean Gaussian noise of standard deviation σ is added to the measured level only (the true level stays clean): hmeas = h + σ·N(0,1).

Derivative filter (α): the raw derivative is smoothed by a first-order filter Df[k] = a·Df[k−1] + (1−a)·Draw[k] with a = exp(−Δt/τ), where τ is a physical time constant set from α. α = 0 disables filtering; larger α suppresses noise amplification at the cost of a small lag.