## 2 Main Results  
### PID Controller  
The reader is advised that the goal of this paper is not to provide a new approach to tuning PID controller gains but to improve the performance of previously designed PIDs. For that reason, the reader is recommended to consult textbooks such as [1] where PID tuning is discussed in depth. However, for the completeness of this paper, it is important to briefly recall what a PID controller is.  
Considering the control scheme depicted in Figure 1, a PID controller is a control law designed to regulate a process variable \(x(t)\), such as position, speed, temperature, or pressure. In order to produce the appropriate control signal \(u(t)\), the PID controller needs the following:  
* The error \(e(t)\) at time \(t\), which is the difference between the setpoint and the value of the process variable at the current time \(t\), i.e., \(e(t)=x_{sp}-x(t)\), where \(x_{sp}\) is the desired setpoint, \(x(t)\) is the process variable to be regulated, and \(e(t)\) is the error at time \(t\).
* The integral of the error \(\int_{0}^{t}e(\tau)dt\) at instant \(t\).
* The time derivative of the error \(\frac{dt(t)}{dt}\) at instant \(t\).  
The PID controller works as follows: the proportional gain (\(K_{P}\)) is responsible for reducing the error \(e(t)\) as quickly as possible by applying a correction proportional to the current error. The integral gain (\(K_{I}\)) multiplies the error accumulated over time, i.e., the integral of the error, with the aim of eliminating steady-state errors and ensuring accurate convergence to the setpoint. Finally, the derivative gain (\(K_{D}\)) is used to predict future error trends based on the derivative of \(e(t)\), which helps to reduce overshoot and improve system stability. The mathematical expression of the PID is as follows:  
\[u(t)=K_{p}e(t)+K_{i}\int_{0}^{t}e(\tau)d\tau+K_{D}\frac{de(t)}{dt}, \tag{1}\]  
where \(u(t)\) is the control signal produced by the PID.  
Notice that the derivative part of the PID controller can be problematic if the measurement of \(x(t)\) is contaminated with noise. To address this issue, an alternative version of the PID controller includes a filter to mitigate the effects of noise on the derivative term. The expression for such a PID controller in the frequency domain is as follows:  
\[U(s)=\left(K_{p}+K_{i}\frac{1}{s}+K_{D}\frac{N}{1+N\frac{1}{s}}\right)E(s), \tag{2}\]  
where \(s\) is the Laplace variable; \(U(s)\) and \(E(s)\) are the Laplace transforms of the control signal \(u(t)\) and the error \(e(t)\), respectively; and \(N\) is referred as the filter coefficient.  
Thus, the design of the PID controller involves determining the appropriate gains \(K_{P}\), \(K_{I}\), and \(K_{D}\) and possibly \(N\) such that \(u(t)\) induces the desired behavior in the process variable \(x(t)\). Tuning of the PID controller gains can be performed through the approach proposed by Ziegler and Nichols [1; 2].  
It is important to mention that mathematical software platforms such as MATLAB r2019b with Simulink(tm) offer powerful automatic control toolboxes that allow PID controllers to be automatically tuned. These toolboxes simplify the design and tuning process by automatically determining the optimal controller parameters to achieve the desired system performance. This capability allows for rapid numerical prototyping and testing of control systems within the simulation environment [21].