High-Order Filtered PID Controller Tuning Based on Magnitude Optimum

The paper presents a tuning method for PID controllers with higher-order derivatives and higher-order controller filters (HO-PID), where the controller and filter orders can be arbitrarily chosen by the user. The controller and filter parameters are tuned according to the magnitude optimum criteria and the specified noise gain of the controller. The advantages of the proposed approach are twofold. First, all parameters can be obtained from the process transfer function or from the measured input and output time responses of the process as the steady-state changes. Second, the a priori defined controller noise gain limits the amount of HO-PID output noise. Therefore, the method can be successfully applied in practice. The work shows that the HO-PID controllers can significantly improve the control performance of various process models compared to the standard PID controllers. Of course, the increased efficiency is limited by the selected noise gain. The proposed tuning method is illustrated on several process models and compared with two other tuning methods for higher-order controllers.


Introduction
The PID controllers are widespread in many industries and are frequently included in embedded solutions [1][2][3][4]. This is not surprising, since the basic PID control algorithm is very simple and the control performance, when the controller is tuned appropriately, is usually very good. However, the control performance can be improved by increasing the controller order. The improvement depends on the process order. While the first-order process can be efficiently controlled by the PI controller and the second-order process by the PID controller, the control efficiency for higher-order processes can be improved by increasing the controller order beyond the PID control.
In practice the PI controllers are used more often than the PID controllers, since the latter significantly increase the controller output noise. Naturally, with higher degrees of controllers, the problem becomes aggravated. Therefore, the appropriate higher-order controller filter is inevitable in practical applications.
For easier classification of the HO-PID controllers according to the controller (m) and filter (n) order, let us denote them as PID m n . A general PID m n controller transfer function G CF (s) can be defined as follows: G CF (s) = G C (s)G F (s), where G C (s) = K −1 s −1 + K 0 + K 1 s + · · · + K m s m G F (s) = 1 (1+T F s) n (1) where K −1 , K 0 , K 1 , . . . K m are controller gains, and G F (s) is the binomial filter with filter time constant T F . In practical applications, in order to limit the higher-frequency controller optimum (MO) criteria [31][32][33][34][35][36][37]. The main advantages of the MOMI method are that it combines frequency-domain MO tuning criterion (providing a fast and non-oscillatory closed-loop process output response) with the time-domain method of moments (the calculation of the process characteristic areas directly from the process time responses).
The process The general order process transfer function with time delay is defined by the following expression: G P (s) = K PR 1 + b 1 s + b 2 s 2 + · · · + b r s r 1 + a 1 s + a 2 s 2 + · · · + a p s p e −sT del (2) where K PR is the process gain, T del is the process time delay and a 1 to a p and b 1 to b r are the process dynamic parameters. To simplify the derivation, let us assume that the process transfer function is developed into an infinite Taylor series around s = 0: where G Pk are the k-th derivatives of the G P (s) over s around s = 0. The moments can be calculated from the process impulse response h(t) in the following way [1,38]: Besides measuring the process impulse response, the moments can also be calculated from the process steady-state change by measuring the process input and output time responses [32,34]. By integrating the process input and output time responses, the so-called characteristic areas A k are obtained, which are related to the process moments as follows: The process transfer function, based on the characteristic areas, can be derived from (3) and (5) as follows: Since the calculation of the mentioned areas from the process input and output time responses, during arbitrary steady-state change, are already covered in detail in [36], it will not be repeated herein.
The process moments (4) and, therefore, the characteristic areas A k (5), can also be calculated from the process transfer function (2) by calculating the derivatives of G P (s) over s around s = 0. The result is the following [32,34]: Therefore, the characteristic areas in expression (6) can be calculated either from the process time response or from the process transfer function. This is a very important advantage, since the actual process model can be used, but is not required.
In order to simplify the derivation of the controller parameters, the controller binomial filter G F (s) (1) will be considered as a part of the process. Since the above areas are calculated for the process without the filter, the areas A i should be modified, accordingly. If the filter G F (s) (1) is added to the process (2) and developed into a Taylor series, it can be derived that the new areas, denoted by A iF , can be simply calculated as: Note that n is the binomial filter order (1). Naturally, the chosen size of the matrix and the vectors depends on the number of the required areas.
Note that the characteristic areas with the included controller filter can be obtained a-posteriori, when the process areas A i are already measured either from the process time response (5) or calculated from the process transfer function (7).
For further reference, please note that the process areas with the included controller binomial filter are denoted with index F (A iF ) and the process areas without the controller filter are denoted without index F (A i ).
The closed-loop transfer function In the paper, the process and the HO-PID controller (1) will be considered, as shown in Figure 1. Signals r, r f , e, u, d, n and y stand for the reference, filtered reference, control error, controller output, process input disturbance, process output noise and the process output, respectively. Block G FR represents the second order filter for the reference signal in order to reduce excessive controller output change on reference changes: where T FR denotes the reference filter time constant. Due to simplicity, the filter order in (9) is fixed. However, note that the filter order may be increased by increasing the controller order so as to additionally attenuate the swings of the signal u for step-like changes of the reference signal r. Let us now calculate the process closed-loop transfer function G CL (s) from the filtered reference (r f ) to the process output (y). The closed-loop transfer function is then defined as: where Y(s) and R(s) are the Laplace transforms of the process output and the reference signals, respectively.
When applying the process (6) and the controller (1) transfer functions to (10), and considering that the controller binomial filter is a part of the process (in the process transfer function (6) the areas A i are replaced by A iF ), the closed-loop transfer function becomes: where G OL (s) denotes the open-loop transfer function G OL (s) = G C (s)G P (s). The MO criteria According to [35], the MO tuning criterion states that the closed-loop amplitude (magnitude) should be 1 in as wide a frequency bandwidth as possible (starting from frequency ω = 0). This can be achieved if the open-loop transfer function G OL (jω), in the Nyquist diagram, follows the vertical line with the real value −0.5 (according to M and N circles in control theory).
Replacing s with complex frequency jω in G OL (s) (11) yields: where j denotes the imaginary component j = √ −1. Since merely the real part of the open-loop transfer function is required, only the even powers over frequency in (12) are needed. Therefore: In order to achieve that the Re{G OL (s)} = −0.5 for as high frequencies as possible, the following conditions should be fulfilled: or in matrix form: Note that the matrix and vector dimensions depend on the number of controller parameters (m + 2): The controller parameters (gains) can then be simply calculated from (15): The calculation of the controller and filter parameters is straightforward. However, to make it even simpler, we have provided online MATLAB/Octave scripts via the OctaveOnline Bucket website [39]. The provided scripts calculate all the controller parameters for the given process transfer function and the filter time constant. The website layout is shown in Figure 2. The calculation procedure proceeds as follows: 1.

2.
Provide the process parameters, the filter time constant, the controller order and filter order, 3.
press the "Save" button, and 4.
press the "Run" button. The script then calculates the characteristic areas, the controller and the filter parameters. The results are then shown on the right panel of the website.
Illustrative example 1 The D 1 1 , PID 2 2 and PID 3 3 controller parameters will be calculated for the following processes: The chosen controller filter time constants is T F = 0.1. The characteristic areas, without (7), and with controller filter (8) are given in Table 1. Table 1. The calculated areas for the processes (18) without and with the controller filter.
Areas G P1  1  4  10  20  35  56  84  120  165  220 Areas G P1 with controller PID 1 1 filter The calculated controller parameters (17) are given in Table 2. Table 2. The calculated controller parameters. In order to reduce the excessive swing of the controller output when changing the reference, the following reference filter time constant (9) is used for both processes: Note that the second order reference filter is used (9). The closed-loop responses for the processes G P1 (s) and G P2 (s), for all three types of controllers, are shown in Figures 3 and 4. It is clear that tracking and control performance increase by the controller order. Note that the controller output response of PID 3 3 controller is not shown entirely in order to see the responses of PID 1 1 and PID 2 2 controllers more clearly.
When comparing process output responses when using controllers PID 1 1 and PID 3 3 in Figures 3 and 4, it can be seen that the relative difference in performance is larger on higher-order process G P1 (s). This is expected, since lower-order processes can already be optimally controlled by lower-order controllers (e.g., the first-order process with PID 0 0 and the second-order process with the PID 1 1 controller). Since the second-order process G P2 (s) has an additional delay, the closed-loop performance can still be slightly increased with the PID 3 3 controller.  According to the closed-loop responses, it can be concluded that HO-PID controllers can significantly improve the closed-loop performance, especially for higher-order processes. The only required parameter from the user is the controller filter time constant T F . Namely, the amplification of the process output measurement noise depends on the chosen T F . However, the relation between T F and the actual amplification of the high-frequency (HF) noise depends on several other controller parameters and is a rather complex function. Therefore, in practice, it would be more appropriate to define the desired HF noise amplification than the controller filter time constant.

HO-PID Controller with Specified HF Noise Amplification
As mentioned in the previous section, the n-th order controller filter G F (s) (1) is primarily used to decrease the controller output noise due to the measurement noise (in addition to making the entire controller transfer function proper or strictly proper and, therefore, realisable in practice). High controller amplification of the measurement noise is never desired, since it may also cause large swings of the control output signals and thus may decrease the actuator's life span. In order to limit the amplification of the process measurement noise, the user can try different values of T F until the desired amplification (attenuation) of the noise is achieved. In practice, this may take too long, since the function between T F and the noise amplification is complex and non-linear. Therefore, from the user's perspective, it is easier to define the desired noise amplification of the controller than select filter time constant T F .
The process output noise (n y ) is amplified by the controller (1) in the closed-loop configuration as follows: where N y and U N are Laplace transforms of the measurement noise and the controller output noise, respectively. The negative sign is omitted to simplify the derivation. From (20) it can be seen that at lower frequencies, the transfer function G CN (s) is mostly dominated by the process transfer function G P (s), while at higher frequencies, it is mostly dominated by the controller transfer function G CF (s). At lower frequencies, the process can be approximated by its gain K PR , while at higher frequencies the controller gains K −1 and K 0 can be neglected. Therefore, G CN (s) can be approximated by the following transfer function: On the other hand, the desired controller output noise (U ND ) should be similar to: where K HF is a chosen noise amplification factor. Since amplitudes U N and U ND cannot be compared directly due to different frequency characteristics, it is easier to compare noise powers of both signals in some chosen frequency bandwidth (from ω 1 to ω 2 ). Namely, due to Parseval theorem, the power of the controller output signal (P UN ) is proportional to: The desired noise power is, according to (22), proportional to: When considering the N y as a white noise with amplitude over frequency as N y (ω) = 1, the powers P UN and P UND would become the same when: However, the solution of the integral in (25), due to the denominator (controller filter), becomes very complex and highly non-linear in respect to T F . Therefore, some search algorithm (optimization) must be applied for each calculation of the T F . This would seriously impact the simplicity of the proposed method. Therefore, it is decided to simplify the function inside the above integral. Since at higher frequencies, the most dominant controller term becomes the one with the highest derivative (K m ), the function can be simplified as follows: According to (26), the expression (25) simplifies into: The contribution of noise power in the frequency region below ω F is usually much smaller than at higher frequencies. Therefore, in order to even further simplify the derivation, we can choose ω 1 = 0 without making any significant error in the calculation. Selection of the upper frequency (ω 2 ) in the integral, due to the Shannon theorem, depends on the controller sampling frequency. Without loss of generality, the upper frequency can be selected as: where ω S is controller sampling frequency (in rad/s) and T S is controller sampling time.
By taking into account that: and ω 1 = 0, the expression (27) simplifies even further: Therefore, the final expression, when taking into account that F m = K m 2 , reads as: Therefore, the filter time constant (T F =1/ω F ) can be estimated as follows: Note that the above derivation of the filter time constant takes into account approximations (26) and (29). This means that the final output noise power of the controller may differ from that defined by the selected high frequency gain K HF . However, if the above approximations are not taken into account, then the final expressions for the calculation of ω F in (31) would become those of the higher order without analytic solution for T F . This would significantly complicate the filter calculation.
The entire procedure for the calculation of the controller parameters for a given process is given in Figure 5. As shown in Figure 5, the calculation of the controller and filter parameters is straightforward. However, to make it even simpler, as mentioned before, we have provided online MATLAB/Octave scripts via OctaveOnline Bucket website [39]. The website layout is shown in Figure 6. The calculation procedure proceeds as follows: 1.

2.
Provide the process parameters, the desired noise gain, the controller sampling time, the controller order and filter order, 3.
press the "Save" button, and 4.
press the "Run" button. The script then calculates the filter time constant, the characteristic areas and the controller parameters. The results are shown on the right panel of the website.
Illustrative example 2 Consider the following fourth-order process transfer function G P3 (s) (18): The initially chosen controller filter time constants is T F = 0.1. For all the experiments in this section, the chosen sampling time is T S = 0.002 s. In order to retain clarity of the derivations, the characteristic areas of the process are not mentioned herein; however, they can be calculated (besides all the controller and the filter parameters) on the aforementioned website [39].
a. Changing the parameter K HF According to the procedure given in Figure 5, when choosing parameter K HF , controller PID 3 4 and repeating steps 3-5 a few times (in our case, 3 times), the calculated filter time constants, and the calculated controller parameters (17) are given in Table 3. Table 3. The calculated filter time constants T F and controller parameters at different noise gains K HF . Again, in order to reduce the excessive swing of the controller output when changing the reference, the following second-order reference filter time constant (9) is used: The closed-loop responses for different values of K HF are given in Figure 7. As expected, the speed of the closed-loop response and the controller output signal noise increases by increasing the noise gain factor K HF . However, the improvement of the closed-loop speed is not so significant at the highest factors K HF . On the other hand, the controller output noise increases at higher factors K HF . As expected, there is a trade-off between the closed-loop speed and the amount of the controller output noise. Therefore, in practice, the allowed noise gain should be chosen wisely according to the amount of noise present in the system.
The actual "amplification" of the measurement noise (the actually achieved noise gain K HF ) is measured by dividing standard deviations of the controller output signal (u) and the process output (n) when the process is in the steady-state: The actual amplifications of the measurement noise signals are given in Table 3. It is obvious that the actual gains of the noise (σ rel ) are very similar to the desired ones (K HF ).
b. Changing the filter order (n) On the other hand, the speed of the closed-loop response, for the same K HF and the controller order (m), can also be altered by changing the filter order. In this regard, we tested the performance of the controllers PID 3 n , where n varies from 3 to 6. According to the procedure given in Figure 5, when choosing K HF = 10 and repeating steps 3-5 3 times, the calculated filter time constants and the controller parameters (17) are given in Table 4. The closed-loop responses for different controller filter orders (n = 3 to 6) are given in Figure 8. As can be seen, the speed of the closed-loop response is the highest for controller PID 3 4 . The speed of controllers with higher-order filters (n > 4) are slightly slower. The speed of response for n > 4 is not improving since a higher-order filter also adds some complexity to the closed-loop transfer function. This, in return, may result in lower closed-loop speeds.
The practical question is how to find the most optimal controller filter order in advance, before making the closed-loop experiment on the process. This can be answered by calculating the integral of control error (IE), which can be considered as a measure of the closed-loop speed: If the closed-loop responses have small overshoots, the higher values of IE indicate slower closed-loop responses. For such responses, the IE can be a useful tool to measure the closed-loop speed. The IE value can be relatively easily calculated by transforming the Equation (36) into Laplace domain. It can be shown that: Therefore, for the process with the same steady-state gain K PR (2), the closed-loop speed is inversely proportional to the integrating gain (K −1 ) of the controller. Therefore, the controller with the highest gain K −1 will produce the fastest closed-loop response (providing that the closed-loop responses have small or negligible overshoots). Indeed, from Table 4 it is evident that the highest gain K −1 is calculated for controller PID 3 4 . This corresponds to our previous observations.
The actual amplifications of the measurement noise signals, according to (35), are given in Table 4. The actual noise gains (σ rel ) are very similar to the desired ones (K HF ) for filter orders 3 and 4, while for higher-order filters the actual noise gain is lower. This is due to various assumptions (simplifications) made when deriving the filter time constant (32).
c. Changing the controller order (m) As is already known, the speed of the closed-loop response can also be altered by changing the controller order. In this regard, we tested the performance of the controllers PID m n , where m varies from 1 to 4. In all cases the controller filter is chosen to be 1 order higher than the controller order (n = m + 1). The desired noise gain remains the same as in the previous experiment (K HF = 10).
The calculated filter time constants and the controller parameters (17) are given in Table 5. Table 5. The calculated filter time constants T F and controller parameters at different controller order m (n = m + 1). The closed-loop responses for different controller orders (m = 1 to 4) are given in Figure 9. As can be seen, the closed-loop speed increases by increased controller order, similar to the results in Figures 3 and 4. The difference is that now the controller output noise is under control (K HF = 10), so the level of control noise is similar for all of the controllers. The fastest responses are obtained with PID 4 5 . In a similar manner as in the previous case, the speed of responses can be estimated by comparing the values of the calculated integrating gains (K −1 ) in Table 5. Indeed, K −1 is the highest for PID 4 5 . The actual amplifications of the measurement noise signals, according to (35), are given in Table 5. The actual gains of the noise (σ rel ) are very similar to the desired ones (K HF ) for all controller orders.

Robustness
The proposed design of HO-PID controllers results in a relatively fast and nonoscillatory response. In addition, the controller noise is under control by choosing parameter K HF . However, the designed closed-loop system can still be not robust enough to process variations. Namely, due to nonlinearity or time-variations of the process, its characteristics (gain, delay, time constants, etc.) can vary by working point or by time.
The robustness of a stable closed-loop system is usually measured by maximum sensitivity (M S ) [1,38]. Maximum sensitivity is related to the distance of the open-loop transfer function G C (jω)G P (jω) from the critical point (−1+j0). Namely, M S is the inverse of the minimum distance between the open-loop transfer function and the critical point. Generally, a smaller value of M S denotes a more robust closed-loop system to process variations. Usual values of M S for stable processes are between 1.4 and 2.0 [1,38].
The robustness of the closed-loop system for the proposed HO-PID controllers has been tested on the following third-order process with delay: where the nominal values are K PR = 1, T del = 1 and T = 1. Three different HO-PID controllers are selected: PID 2 3 , PID 3 4 , and PID 4 5 . The calculated controller parameters, when choosing K HF = 10, T S = 0.002 s and according to the proposed tuning method, are shown in Table 6.
The calculated values of the maximum sensitivity M S , for all three controllers, are shown in the same table. It can be seen that the M S values slightly increase with the increased controller order. However, the differences are not large and all the values are below 2.0. Table 6. The calculated filter time constants T F and controller parameters at different controller orders m (n = m + 1) for G P4 (s). Besides calculating the M S values, we were also simulating the closed-loop responses using all three controllers on the nominal process, and on the changed process (±10% change of process gain K PR , time-delay T del and time constant T). The closed-loop responses are shown in Figures 10-12. It is evident that the closed-loop responses under perturbed parameters are still stable without significant oscillations. When comparing Figures 10 and 12 it can be noticed that the perturbed parameters with controller PID 4 5 result in slightly more deviation from the nominal response than with controller PID 2 3 . This is all in accordance with the calculated values of M S in Table 6.

Comparison with Other Tuning Methods
The proposed tuning method was compared with some other methods for PIDA controllers. The chosen methods, which were tested on a particular process model, are from Lurang and Puangdownreong [21] (denoted as the Lurang method from here on) and Jung and Dorf [11] (denoted as the Jung method from here on). The Lurang method involves calculating the PIDA controller parameters by optimizing the tracking and disturbance rejection response under several limitations given on rise time, overshoot, settling time, steady-state error and similar. The optimization is carried out with a modified bat algorithm proposed by the authors. The Jung method analytically calculates the PIDA controller parameters for the third-order process according to provided desired overshoot and settling time. Both methods do not take into account the controller's filter. Therefore, the actual implementation in practice could be questionable if the filter dynamics become slower.
Case 1 The following process model has been selected, according to [21]: The Lurang method suggests the following PIDA controller parameters: The chosen controller filter time constant was very low (T F = 0.01), since we did not want to spoil the closed-loop response of the Lurang method. Namely, as already mentioned, the Lurang method does not take into account the controller filter in the design phase.
For comparison, we chose the controller structures with the lowest possible controller filter order n: PID 2 2 . For illustrative purposes, the one-order higher controller structure (PID 3 3 ) was also tested. Note that the closed-loop results of our proposed method, for the same level of controller noise, can be improved by using n > m.
The calculated controller parameters, for the given process and controller filter were the following: We tested, separately, the tracking response and the disturbance rejection when using all three controllers. For tracking response, the reference (r) changed from 0 to 1 at t = 1 s and for disturbance response the process input disturbance (d) changed from 0 to 1 at t = 1 s.
The closed-loop responses are shown in Figure 13. As can be seen, the responses of the proposed method with PID 2 2 controller are superior to the Lurang method. Certainly, the one-order higher controller (PID 3 3 ) has a better result.
For a more objective comparison, the integral of squared error (ISE) signal has been calculated for all three controllers. The results are shown in Table 7. It is obvious that the ISE values for the PID 2 2 controller are much lower than the ones for the Lurang controller.

Case 2
The second process model has been selected according to [11]: The Jung method suggests the following PIDA controller parameters: As before, the controller filter time constant was chosen very low (T F = 0.005), since we wanted to preserve the closed-loop response of the Jung method, which was obtained without the controller filter.
The calculated PID 2 2 and PID 3 3 controller parameters, for the given process and controller filter were the following: As in the previous case, the closed-loop responses were tested on the tracking response and the disturbance rejection. The closed-loop responses are shown in Figure 14. Again, the responses of the proposed method with PID 2 2 and PID 3 3 controllers are superior to the Jung method. The comparison of ISE values in Table 8 shows PID 2 2 controller has lower values than the Jung controller. However, note that the disturbance rejection settling time is the best with the Jung method.

Case 3
The fourth-order process model has been selected according to [6]: The Puangdownreong method suggests the following PIDA controller parameters: The method calculated the following controller filter: which was also used in design of the proposed PID 2 2 controller parameters. For the given process and controller filter transfer function, the following controller parameters were calculated: As in the previous case, the closed-loop responses were tested on the tracking response and the disturbance rejection. The closed-loop responses are shown in Figure 15. Again, the responses of the proposed method with the PID 2 2 controller are superior to the Puangdownreong method. The comparison of ISE values in Table 9 shows the PID 2 2 controller has lower values than the Puangdownreong controller.

Conclusions
In the paper, the method for tuning the parameters of the m-th order controller with the n-th order binomial filter has been presented. The proposed tuning method is based on the MO criteria which aims to produce non-oscillatory and fast closed-loop reference step responses. The calculation of the controller parameters is analytical and does not require any kind of optimization. An additional advantage of the proposed method is that the process can be described either by the process model or by the process time responses during the steady-state change.
To keep the noise gain of the controller under control, the filter time constant of the controller can also be calculated according to the specified noise gain. The calculation procedure is still analytical, and the results confirm that the level of controller noise is consistent with the given noise gain. The only exception is the use of larger relative degrees between the controller and the filter order, which is the consequence of some simplifications in the calculation of the filter time constant.
The proposed method was tested on six different process models (from second to fourth-order process models with or without time delay). The results confirmed that the control performance can be improved by increasing the controller order or by selecting the filter order appropriately without increasing the controller output noise. The study shows that increasing the filter order improves the performance only up to a certain level, after which the performance starts to decrease. The optimum degree of controller and filter order can be easily determined by the value of integral gain of the controller.
The tuning method was compared with three other tuning methods for PIDA controllers (Lurang [21], Jung [11] and Puangdownreong [6] methods). Although the selected process models were the same as in the aforementioned methods, the proposed method resulted in a better control performance. Therefore, the proposed higher-order controller design is efficient, and the controller output noise gain is under control. However, it does not mean that the proposed method cannot be improved. Indeed, the proposed method is based on optimizing the reference tracking performance. In our further research, we plan to improve the disturbance rejection performance as well. Namely, the article shows that the MO controller design leads to a strong asymmetry in the dynamics of tracking and disturbance rejection behaviour. While the HO-PID controller design leads to an increase in the number of pulses of the control signal after reference step changes, the responses of the control signal after the change of disturbance remain monotonic. This motivates us to deal with the modification of the MO controller design with regard to a faster response to disturbances.
Moreover, we also plan to design a method that will find the most optimal controller and filter order for the given process and noise amplification considering the complexity of the controller and filter order. We plan to calculate the optimal parameters of the reference filter to control the change of the controller output signal when the reference signal is changed.
Another planned modification is adding a user-defined parameter for changing the speed of the closed-loop control. Slowing down the control speed would further increase the robustness of the system. Funding: This research was funded by the grants P2-0001 financed by the Slovenian Research Agency, APVV SK-IL-RD-18-0008 platoon modelling and control for mixed autonomous and conventional vehicles: a laboratory experimental analysis, and VEGA 1/0745/19 control and modelling of mechatronic systems in e-mobility.