Two decentralized PID controllers act on the exothermic CSTR simultaneously: the temperature loop manipulates coolant temperature Tc, the concentration loop manipulates feed flow q.
Drag these while running to watch both loops reject the disturbance.
Changing an initial condition restarts the simulation.
The reactor model and both control loops, written out for study.
β (beta) — proportional setpoint weight · γ (gamma) — derivative setpoint weight. β = 1, γ = 0 is a standard PID with derivative-on-measurement.
| Symbol | Meaning | Default |
|---|---|---|
| CAin | Feed concentration | 1.00 mol/L |
| V | Reactor volume | 100 m³ |
| Ti | Feed temperature | 350 K |
| UA | Heat-transfer coefficient | 5.0×10⁴ W/K |
| k0 | Pre-exponential factor | 7.2×10¹⁰ 1/s |
| E/R | Activation temperature | 8750 K |
| ΔHr | Heat of reaction | −5.0×10⁴ |
| ρ | Density | 1000 kg/m³ |
| Cp | Heat capacity | 0.239 |
| Tc0, q0 | Controller bias (operating point) | 300 K, 100 |
| Symbol | Meaning | Default (T / CA) |
|---|---|---|
| Kp | Proportional gain | 3 / 30 |
| Ki | Integral gain | 1 / 8 |
| Kd | Derivative gain | 0.3 / 1.5 |
| Tsp, CA,sp | Setpoints | 350 K / 0.5 mol/L |
| β 2-DOF | Proportional setpoint weight | 1.00 / 1.00 |
| γ 2-DOF | Derivative setpoint weight | 0.00 / 0.00 |
| α filter | Derivative filter (0 = off) | 0.00 / 0.00 |
| σ noise | PV sensor noise std-dev | 0 K / 0 mol/L |
| AW windup | Anti-reset windup (back-calculation) | on / on |
PV noise: each measurement is corrupted by zero-mean Gaussian noise: Tmeas = T + σT·N(0,1) and CA,meas = CA + σCA·N(0,1). The reactor state itself remains noise-free.
Anti-reset windup: when the actuator saturates, back-calculation bleeds the integral by the over-drive I ← I + (Δt/Tt)(usat − u), so I settles at the value that holds the actuator on its limit instead of accumulating error. It is robust to noisy PVs (unlike an error-sign freeze test), and the integral is always kept within its own limits. Disable it to observe windup.
Derivative filter (α): Df[k] = a·Df[k−1] + (1−a)·Draw[k] with a = exp(−Δt/τ) and τ set from α. α = 0 disables filtering; larger α smooths the derivative (useful with noisy sensors). Because the filter is defined by a physical time constant τ (not a fixed per-sample weight), the same α gives the same smoothing at every integration step.