In robotics, variables that control processes (usually voltage output to actuators) are continually adjusted by a PID (Proportional Integral Derivative) Control algorithm to improve the result of a process (usually, the process is volatile or not well understood). More formally, $v(t)$ is the aforementioned variable that is defined by a PID Control algorithm at a given time, $t$, $e(t)$ is the error in the result of some process at a given time, $t$. The PID Control algorithm can be modeled with the equation
$$ v(t) = K_pe(T) + K_i\int_0^t{e(\tau)}d\tau+K_d\frac{de(t)}{dt} $$ where $K_p$, $K_i$, $K_d$ are tuning parameters for the algorithm (these are called "gains"). Normally, the PID gains are adjusted heuristically by a human until the algorithm is sufficiently optimized.
My question: In an ideal setting, what factors should be taken into consideration to optimize the PID gains, and how can those factors be used to mathematically optimize the PID gains without testing? I am not looking for a definitive answer, rather a variety of mathematical insights into this problem.
Some possible factors may include:
- the time interval between each successive calculation of $v$
- some inertial property of the process
- the volatility of the process ($e$ may experience uncontrollable jitters)
- the initial error, $e(0)$
- $v$'s mathematical roll in the process
- the units assigned to $v$ and $e$ (e.g. $v$ may be expressed in volts, while $e$ may be expressed in $\frac{m}{s}$)
The ideal compensator $C$ (whether it is a $PID$ or other type of control) for a process $P$ is simply the inverse of the process $C = P^{-1}$. This would ensure that all dynamics of the process are perfectly cancelled, and that the output of the system (compensator plus process) will follow your commands perfectly.
But this is useless, because the actual reason that we need control (as in control engineering) is because we can never know the process $P$ perfectly, there will always be external disturbances, noise, un-modeled dynamics, etc. Lets call these disturbances unknowns.
You will always have a tradeoff between performance (ability to control) and robustness (ability to overcome the unknowns). So given a process $P$, there is no such ideal $PID$ gains, because if you choose them to perfectly invert your assumed $P$, as soon as disturbances kick in, you will find instabilities and your control system will fail miserably. That is why there is still to this day a lot of heuristics regarding $PID$ tuning, because even if you are trying to control the same process, the disturbances will change. For example, a temperature control system, even with the exact same hardware, will not behave the same in the Netherlands, than in Mexico.
The best known approach is to $PID$ tuning is:
Find a model of the $P$ such that capture as best as you can the input/output dynamics of your real process (without disturbances). This part is called model identification, and is probably the most important and most difficult part of control design.
Obtain $PID$ gains such that the $PID$ block approximates the inverse of the process $PID = P^{-1}$. The approximation has to be as close as possible but with enough difference such that it gives enough room for disturbances. Check out this paper for details.
Test your $PID$ design and if it does not perform to desired specifications, then repeat the step before allowing for a more robust design.
These days there are tools to help you in this process. Most of them are commercial and require you to pay. You can find a free one at pidtuner.com. Disclaimer: I am the developer of that tool.