PID tuning by looking at step responses#

Control engineers judge a loop by its step response — rise, overshoot, oscillation, the effort of the actuator, the recovery after a load disturbance — and weigh these properties differently from plant to plant. This was the first application of EASY-IEC (Madár, Abonyi and Szeifert, 2005). The plant is a first-order process with dead time, \(G(s)=Ke^{-\theta s}/(\tau s+1)\); the controller is a two-degree-of-freedom PID with setpoint weight b and derivative filter N. The SIMC rules of Skogestad (2003) give a well-known reference tuning.

An evaluator who prefers the SIMC response#

import matplotlib.pyplot as plt

import easyiec as ei
from easyiec.problems import PIDTuning
from easyiec.strategies import EasyIEC

problem = PIDTuning(K=1.0, tau=10.0, theta=3.0)
simc = problem.presets()["SIMC"]
print(problem.describe(simc))
user = ei.SimulatedUser(problem, target="SIMC", noise=0.04, seed=3)
result = ei.run(problem, EasyIEC(pop_size=9), user, generations=12, seed=3)
print(problem.describe(result.best.genome))
PID controller Kc=1.67, Ti=10 s, Td=0.011 s, b=1.00, N=10.0. Setpoint step: IAE=6.58, overshoot=4.5 %, settling time=18.4 s; disturbance IAE=3.51; control-signal total variation=1.77.
PID controller Kc=1.69, Ti=7.95 s, Td=0.109 s, b=0.78, N=7.5. Setpoint step: IAE=7.21, overshoot=4.4 %, settling time=21.7 s; disturbance IAE=2.82; control-signal total variation=1.64.

Best response against the SIMC reference#

fig, axes = plt.subplots(1, 3, figsize=(11, 3.2))
for ax, (lab, x) in zip(axes, [("sluggish preset", problem.presets()["sluggish"]),
                               ("SIMC (Skogestad, 2003)", simc), ("best found by IEC", result.best.genome)]):
    problem.render(x, ax=ax)
    o = problem.objectives(x)
    ax.set_title(f"{lab}\nIAE {o['iae']:.1f}, overshoot {o['overshoot']:.0f} %", fontsize=8)
plt.show()
sluggish preset IAE 38.5, overshoot 0 %, SIMC (Skogestad, 2003) IAE 6.6, overshoot 5 %, best found by IEC IAE 7.2, overshoot 4 %

Total running time of the script: (0 minutes 1.993 seconds)

Gallery generated by Sphinx-Gallery