Skip to content

Ratio Controller ​

Maintain ratio between wild and controlled flows with PID trim

Overview ​

The Ratio Controller maintains a specified ratio between a "wild" (leader) variable and a "controlled" (follower) variable. Optional PID trim provides fine adjustment to correct for deviations from the target ratio.

When to Use ​

  • Flow ratio control: RAS/Q ratio, chemical feed to flow
  • Blend control: Multiple stream mixing
  • Load following: Chemical dose proportional to load
  • Feed-forward: Predictive adjustment based on flow

Common Applications ​

Wild VariableControlled VariableTypical Ratio
Influent flowRAS flow0.5-1.5
Influent flowChemical doseVariable
Primary effluentMethanol dosekg/m³
MLSSWAS flow% of inventory

Control Theory ​

Concept ​

mermaid
graph LR
    Wild[Wild Flow] --> Ratio[Ratio Station]
    SP[Ratio SP] --> Ratio
    Ratio --> CV_SP[Controlled SP]
    CV_SP --> Sum((+/-))
    CV[Controlled PV] --> Sum
    Sum --> Trim[PID Trim]
    Trim --> Output[Final Output]

Mathematical Model ​

Base calculation: $$output_{base} = ratio \times wild$$

With PID trim: $$output = output_{base} \times (1 + trim)$$

$$trim = K_p \cdot e_r + K_i \int e_r , dt + K_d \frac{de_r}{dt}$$

Where:

  • $e_r = ratio_{setpoint} - ratio_{actual}$
  • $ratio_{actual} = \frac{controlled}{wild}$

Parameters ​

ParameterUnitRangeDefaultDescription
Ratio-0.1-101.0Target ratio (controlled/wild)
Wild Lagdays0-0.10Delay compensation for wild
PID Trim Enabled-true/falsetrueEnable feedback trim
Trim Kp-0.1-20.5Trim proportional gain
Trim Ki-0.01-0.50.1Trim integral gain
Trim Kd-0-0.10Trim derivative gain
Max Trimfraction0.05-0.30.1Maximum trim adjustment
Output Minvaries-0Minimum output
Output Maxvaries-10000Maximum output

Tuning Guidelines ​

Ratio Selection ​

  1. Steady-state requirement: Based on process stoichiometry
  2. Dynamic requirement: May vary with load
  3. Safety margin: Include buffer for upsets

PID Trim Tuning ​

The trim loop should be:

  • Conservative: Small gains, slow response
  • Secondary: Feedforward does most work
  • Bounded: Max trim ±10-20%
ApplicationRatioKpKiMax Trim
RAS/Q ratio1.00.30.050.15
Chemical/Flow0.0050.50.10.2
Blend ratio0.50.40.080.1

Configuration ​

Example: RAS Ratio Control ​

json
{
  "id": "ras-ratio-1",
  "type": "Ratio",
  "enabled": true,
  "wildNodeId": "influent-1",
  "wildVariable": "flow",
  "controlledNodeId": "clarifier-1",
  "controlledVariable": "flow",
  "targetNodeId": "ras-pump-1",
  "manipulatedVariable": "flow",
  "ratio": 1.0,
  "pidTrim": {
    "enabled": true,
    "kp": 0.3,
    "ki": 0.05,
    "kd": 0,
    "maxTrim": 0.15
  },
  "outputMin": 0,
  "outputMax": 50000,
  "wildLag": 0,
  "mode": "auto"
}

Example: Flow-Paced Chemical Feed ​

json
{
  "id": "chemical-ratio-1",
  "type": "Ratio",
  "enabled": true,
  "wildNodeId": "influent-1",
  "wildVariable": "flow",
  "controlledNodeId": "chemical-tank-1",
  "controlledVariable": "flow",
  "targetNodeId": "dosing-pump-1",
  "manipulatedVariable": "flow",
  "ratio": 0.005,
  "pidTrim": {
    "enabled": true,
    "kp": 0.5,
    "ki": 0.1,
    "kd": 0,
    "maxTrim": 0.2
  },
  "outputMin": 0,
  "outputMax": 1000,
  "wildLag": 0.01,
  "mode": "auto"
}

Integration Example ​

RAS Flow Ratio Control ​

Scenario: Maintain RAS/Q ratio of 1.0

Influent (Wild)     10,000 m³/d
                         │
                         ▼
              ┌──────────────────────┐
              │    Ratio = 1.0       │
              │    Trim = +5%        │
              └──────────────────────┘
                         │
                         ▼
RAS Flow (Output)   10,500 m³/d

Calculation:

  • Base output: 10,000 × 1.0 = 10,000 m³/d
  • Trim: If actual ratio is 0.95, trim adds 5%
  • Final output: 10,000 × 1.05 = 10,500 m³/d

Dynamic Response ​

Flow (m³/d)
15000 ─────────────────────────────
                  ┌────────────────  Wild (Influent)
10000 ────────────┘
                     ┌─────────────  Output (RAS)
                  ┌──┘                with trim tracking
10000 ────────────┘
      └─────────────────────────────

Time      0        1h       2h       3h

Best Practices ​

  1. Measure both flows accurately

    • Wild and controlled need good meters
    • Flow totalizers help verify ratio
  2. Keep trim bounded

    • Max trim ±10-20%
    • Large trim indicates ratio error
  3. Consider transport lag

    • Use wild lag for distance
    • Prevents overshooting
  4. Monitor actual ratio

    • Trend ratio over time
    • Alert on sustained deviation
  5. Coordinate with other controls

    • RAS ratio affects clarifier
    • Chemical ratio affects pH

Troubleshooting ​

IssueCauseSolution
Ratio offsetTrim too conservativeIncrease Ki
OscillationTrim too aggressiveReduce Kp, Ki
OvercorrectionMax trim too highReduce max trim
Lag mismatchWild lag incorrectAdjust wild lag
Ratio huntingMeasurement noiseFilter inputs

Advanced Features ​

Wild Variable Lag ​

Compensate for transport delay:

json
{
  "wildLag": 0.01
}

Uses delayed wild value to match when flow arrives at controlled point.

Bounded Trim ​

Prevents runaway:

json
{
  "maxTrim": 0.15
}

Output limited to ±15% of base calculation.

Comparison: Ratio vs Feedforward ​

AspectRatioFeedforward
FeedbackYes (trim)Optional
ComplexityModerateHigher
ResponseImmediateLead-lag compensated
Best forFlow ratiosDisturbance rejection

References ​

  1. Shinskey, F.G. "Process Control Systems" (4th Edition)
  2. Liptak, B.G. "Instrument Engineers' Handbook: Process Control"