Reverse engineering a PID controllers parameters

410 Views Asked by At

In an attempt to copy an existing PID controller, I wish to identify the active PID controllers parameters.

I found this formula for discrete PID controllers, like the one I want to build.

$$ u(k) = u(k-1) + K_{R} \cdot \left(1+ \frac{T_{0}}{2 \cdot T_{I} }+ \frac{T_{D}}{T_{0}}\right) \cdot e(k) -K_{R} \cdot \left(1 -\frac{T_{0}}{2 \cdot T_{I} } +\frac{2 \cdot T_{D}}{ T_{0}} \right) \cdot e(k-1) + K_{R} \cdot \frac{T_{D}}{T_{0}} \cdot e(k-2) $$ where

  • $u(k)$ is the control variable
  • $u(k-1)$ is the previous control variable
  • $K_{R}$ is the gain factor
  • $T_{0}$ is the sampling time
  • $T_{I}$ is the integral time
  • $T_{D}$ is the derivative time
  • $e(k)$ is the error

To identify the right parameters $T_{I}$, $T_{D}$, and $K_{R}$ for the right sampling time $T_{0}$ I could just analyse the data, find the values for the error and the control variable with a sampling time in between, solve the equation, and then I'd have the parameters. However, the sampling time in between data measurements is inconsistent, so I don't really know how to calculate this.

If, for example, the data would be as follows

  • Second = 0, control variable = 50, error = 10
  • Second = 15, control variable = 55, error = 8
  • Second = 18, control variable = 56, error = 7

How can I solve this equation for $T_{I}$, $T_{D}$ and $K_{R}$ ?