Chapter 3: PID Tuning Methods

Why Tuning Matters

Poorly tuned PID controllers can cause:

  • Slow response
  • Excessive overshoot
  • Oscillations
  • Instability

Ziegler-Nichols Method

Step Response Method

  1. Apply step input to open-loop system
  2. Measure delay time (L) and time constant (T)
  3. Calculate gains:
Controller Kp Ti Td
P T/L - -
PI 0.9T/L L/0.3 -
PID 1.2T/L 2L 0.5L

Ultimate Gain Method

  1. Set Ki = 0, Kd = 0
  2. Increase Kp until sustained oscillation
  3. Record Ku (ultimate gain) and Tu (period)
Controller Kp Ti Td
P 0.5Ku - -
PI 0.45Ku Tu/1.2 -
PID 0.6Ku Tu/2 Tu/8
def ziegler_nichols_ultimate(Ku, Tu, controller_type='PID'):
    if controller_type == 'P':
        return {'Kp': 0.5 * Ku}
    elif controller_type == 'PI':
        return {'Kp': 0.45 * Ku, 'Ki': 0.45 * Ku / (Tu/1.2)}
    elif controller_type == 'PID':
        Kp = 0.6 * Ku
        Ti = Tu / 2
        Td = Tu / 8
        return {'Kp': Kp, 'Ki': Kp/Ti, 'Kd': Kp*Td}

Cohen-Coon Method

Better for systems with significant dead time.

def cohen_coon(K, T, L):
    r = L / T
    Kp = (1.35/K) * (T/L + 0.185)
    Ti = 2.5 * L * (T + 0.185*L) / (T + 0.611*L)
    Td = 0.37 * L * T / (T + 0.185*L)
    Ki = Kp / Ti
    Kd = Kp * Td
    return {'Kp': Kp, 'Ki': Ki, 'Kd': Kd}

Manual Tuning Guidelines

  1. Start with Kp only, increase until oscillation
  2. Add Ki to eliminate steady-state error
  3. Add Kd to reduce overshoot
  4. Fine-tune iteratively

Next: Chapter 4 - State-Space Representation!