Ratio control
The controlled flow follows a wild flow that something else sets, at a set ratio: SP = R × wild flow. An analyzer or quality controller may trim the ratio. The product stays right through every production change, and the trim's loop gain stops depending on the rate.
Theory
Many processes care about a proportion: fuel to air, reagent to feed, concentrate to diluent. If the proportion is right, the product is right, whatever the throughput. Ratio control holds the proportion directly:
- is the wild flow, measured but set elsewhere (production rate).
- is the controlled flow, with its own flow loop.
Fixed ratio is pure feedforward: no quality measurement at all. It is right only as long as the recipe ratio is right.
Trimmed ratio adds a slow outer controller on the product quality that adjusts . That is cascade, with a multiplication in the middle. Linearized at one throughput,
that is, feedforward gain from the wild flow, plus the trim's output scaled by .
Why not just additive feedforward? The quality usually depends on the ratio, not on the flow. With ratio control the trim's loop gain, , doesn't depend on the throughput. With additive feedforward it does (here 3 : 1 between low and high rate), so one tuning is too fast at low rate and too slow at high rate.
When it works, and when it breaks
Blending, dosing and dilution: chemicals into water, additives into fuel, concentrate into product.
Combustion: air follows fuel (often with cross-limiting so air leads on increases and lags on decreases).
Any process where the quality depends on a proportion and the throughput is set elsewhere.
The two meters disagree (different bases, drift): the ratio is wrong without anyone seeing it.
Very low wild flow: the ratio of a noisy, near-zero signal is noise. Cut off below a minimum.
Different dynamics on the two streams: one arrives before the other, and the product shows a transient on every rate change (add a lead-lag on the wild flow).
Unmeasured changes in either stream's composition: only a trim on a quality measurement catches them.
How to tune it
- The flow loop first, fast and well damped, on its own setpoint.
- The ratio from the recipe: the mass balance, at the design point.
- The trim on the quality measurement, with the flow loop and the ratio closed. Its process is "ratio → quality": tune it on a step in . It includes the analyzer delay, so it is slow.
- Limit the ratio range the trim may use, so a failed analyzer can't drive it anywhere absurd.
The tuning rules in the lab
Model-based, one tuning knob: the closed-loop time constant τc. τc = θ gives a fast, still robust loop (Ms ≈ 1.6); larger τc is smoother. The min() on Ti keeps lag-dominant and integrating processes from responding too slowly to load upsets. PID uses the second-order model: Td = τ2 in series form.
The process-industry favourite: choose λ, the closed-loop time constant, and the setpoint response is first-order with no overshoot. Ti = τ cancels the process pole, which makes load rejection slow on lag-dominant processes. λ = 1–3 × τ is typical for robustness.
Internal model control worked back into a PID (Rivera, Morari and Skogestad, 1986): the controller that makes the loop a first-order λ response, with the dead time replaced by its first-order Padé approximation. That approximation is what gives the derivative, and why Ti = τ + θ/2 rather than τ. Keep λ above about 0.8θ for the PID and 1.7θ for the PI, where the approximation stops holding. Like Lambda, it cancels the process lag, so load upsets on lag-dominant processes recover slowly. The IMC structure itself (the model running beside the plant) is the Smith predictor on the bench.
For integrating processes such as levels, from the ramp rate k′ (% of span per second, per % of output). λ is the arrest time: how long the level keeps moving after an inflow upset. For a step upset Δ (in % of output) the level swings about k′·Δ·λ/e before it turns round, so choose λ from the room the tank has. A long λ lets the tank absorb the upset and keeps the outflow smooth: averaging level control. P-only: Kc = 1/(k′λ), which leaves an offset that is harmless in a buffer.
The 1942 rules, aiming for a quarter-amplitude decay. Aggressive: Ms is often above 2, so the loop rings and is sensitive to model error. Worth knowing because so many loops in the field were tuned this way.
Like Ziegler–Nichols but corrected for dead time, so it copes better when θ/τ is large. Also aimed at quarter-amplitude decay, so also aggressive.
Derived by optimizing load rejection with a robustness limit (Ms ≈ 1.4) over a large test batch of processes. A safe modern default when you have no reason to choose a speed.
How to implement it
- Ratio station: SP₂ = R × wild flow, limited to the flow loop's range. Below a minimum wild flow, hold a minimum.
- Bumpless: in manual, the trim tracks the ratio actually being run, .
- Windup: while the flow loop is saturated, hold the trim's integral, as in cascade.
- HMI: show the ratio setpoint and the actual ratio side by side.
Siemens and elsewhere
- No ratio block in PID_Compact: one line of SCL computes the setpoint, as in the exported call, before the flow controller.
- Use PID_Compact for the flow loop. Use a second one for the trim, its output scaled 0–100 % → [R_min, R_max].
- Cross-limiting for combustion (air leads fuel up, lags it down) is a MAX/MIN on the two setpoints: the same selector idea as override control.
- DCS: RATIO blocks with ratio limits and bias, and a cascade connection to the slave.
- Combustion control standards (NFPA 85, EN 12952) build on ratio with cross-limiting and an O₂ trim: the same structure as here.
Interactive Controller Sandbox
Test and tune Ratio control live on a process, benchmark against baseline PI, and inspect the resulting code.
Interactive Gains (Outer Loop)
Drag sliders or nudge gains to observe the closed-loop transient responseClosed-Loop Response: Ratio vs Baseline PI
Simulating…// Loop Lab export: In-line blending (ratio), AIC-803
// TIA Portal SCL (S7-1200 / S7-1500). Generated code: review before use on a real plant.
FUNCTION_BLOCK "LL_PID"
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
VAR_INPUT
Setpoint : Real; // engineering units
Input : Real; // measurement, engineering units
ManualEnable : Bool; // TRUE = manual: Output follows ManualValue
ManualValue : Real; // %
Feedforward : Real; // %, added to the output (0 when unused)
HoldIntegral : Int; // +1 / -1: don't integrate up / down (a cascade slave is saturated)
ExtResetEnable : Bool; // override: this controller is not selected, so its integral follows ExtReset
ExtReset : Real; // %, the selected (valve) output, for external reset feedback
Cycle : Real := 0.5; // s, must match the cyclic interrupt the block is called from
END_VAR
VAR_OUTPUT
Output : Real; // %
AtLimit : Int; // +1 / -1 when the output is pinned high / low
END_VAR
VAR
Gain : Real := 0.5; // % output per % of span
Ti : Real := 38.6; // s, 0 = no integral action
Td : Real := 0.0; // s, 0 = no derivative action
PWeighting : Real := 1.0; // setpoint weight b on P
DWeighting : Real := 0.0; // setpoint weight c on D
TdFiltRatio : Real := 0.1; // derivative filter = TdFiltRatio * Td
InLow : Real := 0.0;
InHigh : Real := 20.0;
OutLow : Real := 0.0;
OutHigh : Real := 100.0;
Invert : Bool := FALSE;
Integral : Real; // integral term, in % output (so gain changes don't bump)
DTerm : Real;
LastED : Real;
END_VAR
VAR_TEMP
sp : Real;
pv : Real;
dir : Real;
e : Real;
eP : Real;
eD : Real;
p : Real;
tf : Real;
iNext : Real;
v : Real;
u : Real;
END_VAR
BEGIN
// Scale to % of span: the gains are then independent of engineering units.
#sp := (#Setpoint - #InLow) / (#InHigh - #InLow) * 100.0;
#pv := (#Input - #InLow) / (#InHigh - #InLow) * 100.0;
#dir := 1.0;
IF #Invert THEN
#dir := -1.0;
END_IF;
#e := #dir * (#sp - #pv);
#eP := #dir * (#PWeighting * #sp - #pv);
#eD := #dir * (#DWeighting * #sp - #pv);
#p := #Gain * #eP;
IF #ManualEnable THEN
// Track: preload the integral so switching to auto doesn't bump the output.
#u := LIMIT(MN := #OutLow, IN := #ManualValue, MX := #OutHigh);
#Integral := #u - #p - #Feedforward;
#DTerm := 0.0;
#LastED := #eD;
#Output := #u;
#AtLimit := 0;
RETURN;
END_IF;
// Derivative on c*SP - PV through a first-order filter (backward Euler).
IF #Td > 0.0 THEN
#tf := MAX(IN1 := #TdFiltRatio * #Td, IN2 := 1.0E-6);
#DTerm := #tf / (#tf + #Cycle) * #DTerm
+ #Gain * #Td / (#tf + #Cycle) * (#eD - #LastED);
ELSE
#DTerm := 0.0;
END_IF;
#LastED := #eD;
IF #ExtResetEnable AND #Ti > 0.0 THEN
// External reset feedback: the integral follows the selected output through a Ti lag,
// so this controller's output is the valve signal plus its own P and D.
#iNext := #Integral + #Cycle / MAX(IN1 := #Ti, IN2 := #Cycle) * (#ExtReset - #Integral);
ELSIF #Ti > 0.0 THEN
#iNext := #Integral + #Gain * #Cycle / #Ti * #e;
ELSE
#iNext := #Integral;
END_IF;
#v := #p + #iNext + #DTerm + #Feedforward;
#u := LIMIT(MN := #OutLow, IN := #v, MX := #OutHigh);
// A saturated slave asks its master to stop integrating in that direction.
IF #ExtResetEnable THEN
#Integral := #iNext;
ELSIF #Ti > 0.0 AND NOT ((#HoldIntegral > 0 AND #iNext > #Integral) OR (#HoldIntegral < 0 AND #iNext < #Integral)) THEN
// Conditional integration: stop integrating while the output is pinned and the error pushes it further.
IF NOT ((#v > #OutHigh AND #iNext > #Integral) OR (#v < #OutLow AND #iNext < #Integral)) THEN
#Integral := #iNext;
END_IF;
END_IF;
IF #v > #OutHigh THEN
#AtLimit := 1;
ELSIF #v < #OutLow THEN
#AtLimit := -1;
ELSE
#AtLimit := 0;
END_IF;
#Output := #u;
END_FUNCTION_BLOCK
// OB30 "Cyclic interrupt", cycle time 0.5 s (500 ms).
// "AT-803" is the scaled input (NORM_X/SCALE_X from the analog card), "FV-802" the output to scale back to 0-27648.
// Ratio station: FIC-802 setpoint = R × FT-801 (diluent (wild) flow).
// Give the flow controller its own tuning once at start-up (OB100): "FIC_802_DB".Gain := 0.88; "FIC_802_DB".Ti := 1.75; "FIC_802_DB".InLow := 0.0; "FIC_802_DB".InHigh := 25.0;
// Trim: AIC-803 sets R over 0.0–0.5; in manual it tracks the ratio being run, so auto is bumpless.
"AIC_803_DB"(Setpoint := "SP", Input := "AT-803", ManualEnable := "Manual", ManualValue := ("FT-802" / MAX(IN1 := "FT-801", IN2 := 0.001) - 0.0) / 0.5 * 100.0, HoldIntegral := "FIC_802_DB".AtLimit);
"Ratio" := 0.0 + "AIC_803_DB".Output / 100.0 * 0.5;
"SP2" := LIMIT(MN := 0.0, IN := "Ratio" * "FT-801", MX := 25.0);
"FIC_802_DB"(Setpoint := "SP2", Input := "FT-802", ManualEnable := "Manual", ManualValue := "ManualOut");
"FV-802" := "FIC_802_DB".Output;