# PID Controller Parameter Tables for Time-Delayed Systems Optimized Using Hill-Climbing
## 3 The Hill-Climbing Method for Calculating the PID Controller Parameters  
The controller parameters, according to the minimum IAE, ITAE and ISE criteria, can easily be calculated, in theory. To achieve this, all possible parameter combinations of P, I and D (Kp, Ti and Td) are simply simulated for several PTn controlled systems and various controller output limitations. Finally, the parameters with the smallest values are taken as the result. The parameters found in this way can then be stored in table form and used either in the simulation or directly in the practical system. Figure 3: Illustration of the control error e(t) in the closed loop, as a basis for the IAE, ITAE and ISE criteria. Figure 2: Step response of a PTn system. However, this method of calculation currently takes a very long time, due to the required computing power. The three parameters P, I and D span a three-dimensional space. For a single PTn element and a single controller output limitation, a total of \((10\times 10)^{3}\) = 1,000,000 simulations would be necessary if the parameters were increased from 0.1 to 10 in steps of 0.1. Therefore, a hill-climbing method, which is an artificial intelligence method, was selected for the parameter search [20]. First, random start values are generated for Kp, Ti and Td. They can be any value in the entire possible value range, here [0... 10]. The parameters of the controller are changed according to a heuristic function. With each new calculation or measurement, the minimum change in the parameters \(\Delta\)Kp, \(\Delta\)Ti and \(\Delta\)Td is multiplied by a random value from (+1, -1, 0). The change is added to the parameters. Then the criteria are recalculated. If the new value is smaller, the parameters are retained, and if not, the original parameters are recalculated. Figure 4 shows how the heuristic function acts on the PID controller parameters. A flow chart of the method is shown in Figure 5. After a series of iterations, a termination criterion is met, which in the problem at hand was set to 500 (see also Figure 6). Although the hill-climbing method converges quickly for this application, it cannot be guaranteed that the parameters for the absolutely smallest value of the criteria (e.g., IAE, ITAE, ISE) will be found in every case. The hill-climbing method, like the particle swarm optimization method, can end with parameters of local minima. However, since it requires much less computing time than calculating all parameter sets with nested loops, this approach was used here. In addition, a large number of completely randomly calculated starting values Kp, Ti and Td are assumed, and at the end of the comparison of the parameter sets the smallest are selected for the quality criteria. In fact, these calculations show fast convergence, and many of them result in the same PID parameter sets for the same smallest quality criteria of all calculated sets. As an example, the course of the convergence of the parameter Ti (PT2 system and ITAE criterion with a controller output limitation of +/-5), is shown in Figure 6.  
In comparison with the PSO method, the biggest difference is that there, the particles move in parallel as tuples of Kp, Ti and Td through the definition space, and due to the social behavior speed component they show a stronger tendency to end together in local minima. With the hill-climbing method used here, the individual tuples are processed serially, according to the flow chart, and do not influence each other. This has the advantage that as many local minima as possible can be found, and then the smallest of these can be selected. Figure 4: Heuristic function of hill-climbing method, acting on the PID controller parameters. As discussed above, this method does not conclusively prove that these are really the parameter sets which absolutely minimize the quality criteria IAE, ITAE or ISE. However, a large number of randomized starting values were used, and a large number of these resulted in the same parameters for the minima of the ITAE, IAE or ISE criteria.