{'fraction_non_alphanumeric': 0.029651097982387693, 'fraction_numerical': 0.012856240478579126, 'mean_word_length': 4.703326976054249, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A novel fuzzy logic scheme for PID controller auto-tuning

This paper presents a novel method for PID (proportional–integral–derivative) controller auto-tuning based on expert knowledge incorporated into a fuzzy logic inference system. The proposed scheme iteratively tries to improve the performance of the closed-loop system. As performance measures, the proposed scheme uses the characteristics of the step response (rise time, overshoot, and settling time). PID parameters in the first iteration can be calculated based on the basic open-loop step response experiment or it is possible to use current parameters. In each successive iteration, step response characteristics are measured and the relative changes expressed in the percentage of value in the first iteration are calculated and converted into linguistic values. The fuzzy expert system computes fuzzy values that are used after defuzzification as multiplying factors for current PID parameters. To achieve a balance between the aggressive and robust closed-loop response, as well as between the slower and the faster one, the fuzzy expert system works in three operating modes: the one for speeding up the system, the one for reducing the overshoot, and the one for a balanced reduction of rise time and overshoot. The performance and robustness are verified by computer simulation using an extensive range of different processes.


Introduction
All automatic control systems are characterized by a specific control law or control laws. For basic control laws, their effect may linearly depend on the error (P law), integral of error (I law), or the first derivative of the error in time (D law). Combining basic control laws renders the PID (proportional-integral-derivative) law that is the most commonly used control law today due to its simple implementation in modern programmable logic controllers used in industry, as well as home and building automation. The PID controller has three adjustable parameters, one for each control law. The values of the parameters are closely related to closedloop system performance and robustness. However, in addition to its simple implementation, setting up three adjustable PID parameters is not an easy task and has posed a challenge for many authors for years.
The first systematic way to tune PID parameters was proposed by Ziegler and Nichols in 1942 [1]. Inspired by this work, many authors suggested improvements to meet different performance or robustness requirements [2,3]. These methods are given in the form of simple expressions that formalize previously experimentally determined characteristics of process dynamics. Despite its imperfection, the original Ziegler and Nichols method is still widely used today because of its simplicity and ease of use. In the early 2000s, more than 60 years later than the original work, Åström and Hägglund proposed a revitalization of the original method in [4,5] while maintaining simplicity but improving performance for a broader set of different processes. Not long after, Šekara and Mataušek [6] also suggest a revitalization of the original Ziegler and Nichols work. A comprehensive overview of developments in PID controllers theory and practice can be found in [7], while a summary of tuning methods in a systematic way is given in [8].
To reduce the time and knowledge necessary for tuning PID parameters, Åström and Hägglund proposed the first automatic tuning method [9]. Such automatic tuning was accomplished by combining the relay experiment as a method for determining process dynamics with methods for computing the parameters of a PID controller. In recent years, the authors proposed different approaches to the automatic tuning of PID controller parameters [10][11][12][13][14][15]. The most recent comparison of PID auto-tuners is presented in [16,17].
After a parameter of the PID controller is tuned, it is often necessary to manually fine-tune parameters. The tuning is achieved by applying little corrections to the parameters based on practical experience. Fuzzy logic has been recognized as an appropriate method for implementing the operator's experience into the PID controller design. Zadeh proposed a fuzzy set theory in 1965 as an extension of the classical notion of a set [18]. Inspired by this work, in 1974 Mamdani proposed the first application of the fuzzy set theory in the fuzzy logic control algorithm to synthesize the linguistic control mechanism of an experienced operator [19]. In the following years, fuzzy logic has been successfully used in many applications and has resulted in significant achievements [20][21][22][23][24][25][26][27]. A concise overview of fuzzy control research breakthrough results is given in [28], showing the evolution of this field. Tzafestas and Papanikopoulos were among the first ones to propose an approach in which the performance of the closedloop system is improved by slightly changing the values of PID parameters based on a fuzzy matrix that contains the experience of an operator in the condensed rule form [29]. The authors in [30] proposed an auto-tuning algorithm based on a fuzzy inference mechanism for tuning PID parameters online using the response error signal of the closed-loop system as input. Many authors have applied a similar principle and introduced slightly different schemes to implement expert knowledge in the PID tuning process by using the fuzzy logic concept [31][32][33][34][35][36][37][38][39]. A comparison of fuzzy logic auto-tuning methods is presented in [40].
The purpose of this study is to develop a novel scheme for automatic tuning of a PID controller based on expert knowledge incorporated into a fuzzy inference system. The primary aim of the scheme is to enhance the performance of the arbitrary closed-loop system while maintaining robustness within acceptable limits with minimal investment of time, effort, and required knowledge.
The novelty of the approach is that the scheme in an iterative procedure modifies the parameters of the PID controller based on response characteristics. Unlike other previously mentioned methods [30,31,36] that use the error signal and the first derivate of the error signal, this method uses the rise time, overshoot, and the settling time as input in the fuzzy expert system. In addition, this method works offline as the classical auto-tuning method and is not intended for continuous adaptation, unlike most methods that utilize the fuzzy concept. Besides, this approach makes it possible to select an operating mode and, in that way, make an influence on setting performance and robustness tuning goals.
The motivation for this research comes from the real problems that the authors encountered during the implementation of the automatic control system over the years in industry and building automation.

Classical tuning methods
The well-known expression of a PID controller is the following: where e(t) = r(t)-y(t) is a system error signal that represents the difference between setpoint value r(t) and current system output value y(t); u(t) is the control variable, K p is a proportional gain, T i is an integral time constant, and T d is a derivative time constant. Classical tuning methods like Ziegler and Nichols and related methods are model-based methods. These methods are based on the approximation of process dynamics using a simple model. A simple process model can be obtained from an open-loop response. The first-order process with time delay (FOPTD) process model that is commonly used in process control has the following transfer function: where K is the static gain, T is time constant (lag), and L is time delay. There are some processes with the dynamics that contain integration or very long-time constants and that will not reach a steady state under open-loop conditions. A combination of an integrator and a time delay makes the first-order integral process with a time delay (FOIPTD) process model with the transfer function: where K v is velocity gain and L is the time delay. The parameters of the PID controller are then expressed in terms of the obtained process parameters using simple formulas [8].
The present research adopted the revitalization method proposed by Åström and Hägglund [5] as an initial tuning for a new proposed fuzzy expert system method for PID parameter auto-tuning. This method was first used in [4] for PI controller and the same approach was later used for PID control with additional constraints in [5]. For simplicity, the Åström and Hägglund method will be denoted as the A-H method in the rest of this paper. For stable processes, according to this method, PID parameters can be expressed as: For integrating processes, Equations (4)-(6) can be written as:

Proposed fuzzy expert system
A block diagram of the proposed fuzzy expert system (FES) for auto-tuning PID controller parameters is shown in Figure 1. It consists of the performance evaluation part, comparator, fuzzy interference system, and parameter calculation part. The main purpose of the performance evaluation part is to evaluate the closed-loop step response based on current value y(t) and setpoint value r(t). The closed-loop response is evaluated using rising time t r (time from 10% to 90% steady-state value), overshoot o, and settling time t s (time of entering in 2% region of steady-state value) as performance measures. The comparator compares the current values of performance measures with reference values that are saved in the first iteration. The comparator renders the percentage ratios of rise time t r_%−rat , overshoot o_ %−rat , and settling time t s _ %−rat , which can be expressed as follows: The fuzzy interference system based on percentage ratios calculates PID parameter multipliers K p_multp , T i_multp , and T d_multp using expert knowledge within the rule base and fuzzy inference mechanism. The parameter calculation part calculates new PID parameters K p , T i , and T d using multipliers calculated in the previous part and the current value of PID parameters, according to the following equations:

Test batch
The test batch consists of 133 processes whose transfer functions are given in Equations (16)- (24). The test batch is discussed in [5] and it is here used practically unchanged. The test batch is used to derive expert knowledge and test final solutions. The test batch includes delay dominated, lag dominated, and integrating processes. ,

Expert knowledge
Since many methods give only rouge values, it is often necessary to apply manual tuning to obtain better closed-loop properties. This is typically done through experiments with the closed-loop process. The closedloop response is observed and controller parameters are modified. The modifications are based on simple rules that can be expressed as tuning maps. The tuning maps are a matrix of transient responses corresponding to systematic variations in PID parameters whose essential function is to provide insight into how changes in controller parameters influence the behaviour of the closed-loop system. To speed up the synthesis of expert knowledge without losing the generality, only a few processes from the test batch given in Equations (16)-(24) are observed. Each process represents one of the four ways to classify the processes of the test batch. The systems with the integrator are classified into the first group represented by process G 6 given in Equation (21) with parameter L = 0.1. Process G 5 given in Equation (20) with parameter α = 0.5 represents the second group of lag-dominated processes. The third group includes the balanced lag and delay processes represented by process G 4 given in Equation (19) with parameter n = 4. Process G 2 given in Equation (17) with parameter T = 0.02 represents the last group of delay-dominated processes.
Tuning maps are created for all four processes. As an example, a tuning map for process G 4 given by Equation (18) with parameter n = 4 is shown in Figure 2. The  Based on the created tuning maps it is possible to derive the relations between the increasing PID controller parameter and the values of step response characteristics (rise time, overshoot, and settling time). The derived fundamental relations are given in Table 1.

Fuzzy interference system
This study adopted the Mamdani fuzzy interference system with three inputs and three outputs. A block diagram of the proposed system is shown in Figure 3.
The rise time ratio t r_%−rat , overshoot ratio o _%−rat , and settling time ratio t s_%−rat were chosen as input parameters. The value of input parameters was set to range from 0% to 200%. For the ratios greater than 200%, the values of current measures have already been certainly larger than those of referent values, so the upper limit was saturated at level 200. The input variables have been decomposed into three different fuzzy linguistic levels: low (L), medium (M), and high (H). The shape of membership functions for all three inputs is shown in Figure 4.
Multipliers K p_multp , T i_multp, and T d_multp were chosen as output parameters. The value of the output parameters was set to be in the range from −0.5 to 0.5. Therefore, PID parameters could be adjusted by up to 50% of their value up or down in each iteration. The output variables have been decomposed into seven different fuzzy linguistic levels: negative high (NH),  negative medium (NM), negative low (NL), zero (Z), positive low (PL), positive medium (PM), and positive high (PH). The shape of membership functions for all three multipliers can be seen in Figure 5.
A comparative analysis of relations obtained from tuning maps of four representative processes was used to create a rule base. Since each input is described  Table 2.

Operating modes
The trade-off between performance and robustness varies among different control problems, which is why it is desirable to have a design parameter to change the properties of the closed  algorithm can be obtained. This study proposes three operating modes of the FES tuning method.
The first operating mode is Speed up tuning, whose primary objective is to decrease the rise time of the closed-loop system in the first place, and then decrease the settling time and overshoot while keeping sensitivity within reasonable limits. Therefore, the value of parameter P for the first input t r_%−rat was set to 40, for the second input o _%−rat it was set to 100, and for the third input t s_%−rat it was set to 100.
The second operating mode is Reduce overshoot tuning, whose primary objective is to decrease the overshoot of the closed-loop system in the first place, and then decrease rise time and settling time while keeping sensitivity within reasonable limits. Therefore, the value of parameter P for the first input t r_%−rat was set to 100, for the second input o _%−rat it was set to 40, and for the third input t s_%−rat it was set to 100.
The third operating mode is Balanced tuning, whose primary objective is to balance the decrease overshoot and rise time of the closed-loop system in the first place, and then reduce the settling time while keeping sensitivity within reasonable limits. Therefore, the value of parameter P for each of three inputs (t r_%−rat , o _%−rat , and t s_%−rat ) was set to 75.

Tuning procedure
The flow chart of the proposed FES auto-tuning scheme is shown in Figure 7. If there are no initial PID parameters, or the closed-loop system has sluggish performance, new initial parameters can be calculated in the pre-tuning phase. Alternatively, pre-tuning can be skipped if closed-loop performances are satisfactory (Step 2).
In the pre-tuning phase, the PID controller is disconnected. Therefore, initial tuning is performed offline. Based on the open-loop response, the system is approximated with the model given in Equations (2) or (3), depending on whether the system possesses an integrator (Steps 3-4). After successfully obtaining initial parameters (Step 6), the PID controller is connected again, and the second phase can begin.
The second phase is performed online, with initial parameters adopted as current parameters (Step 7).The first iteration of the fine-tuning phase includes setpoint perturbation (Step 8) and calculation of performance measures of the step response (Step 9). The computed performance measures are saved as referent values for this iteration and further ones (Step 10). The relative values of performance measures expressed as the percentage of saved referent values are calculated in Step 11. The fuzzy expert system generates multiplier factors for PID parameters using calculated relative values of performance measures as input in Step 12. Based on computed multiplier factors and current values of PID parameters, new parameters are calculated in Step 13. These steps are repeated until multipliers are greater than tolerance, and the number of iterations does not exceed the maximum number (Step 14). When multipliers become smaller than tolerance, the last PID parameters are adopted as final (Step 15) and the procedure is finished successfully (Step 16). If the number of iterations is exceeded, parameters are set back to initial values (Step 15) and the procedure ends unsuccessfully (Step 16). This stopping criterion based on the number of iterations is beneficial if the process does not converge.

Results and discussion
In addition to the performance measures used in the tuning process, additional performance and robustness measures are used to enable a better comparison of the obtained results. The integral of absolute error IAE is a beneficial measure given in: where e(t) = r(t)-y(t) is a system error that represents the difference between setpoint value r(t) and current system output value y(t). The integral of the absolute error for load disturbance response IAE d is the same as the previously defined measure but it is used in load disturbance response. Robustness is specified through the maximum value of the sensitivity function: where G c is the transfer function of the controller, while G is the transfer function of the process. Value M s can be interpreted as the inverse of the shortest distance between the loop transfer function and the critical point in the Nyquist plot [5]. For all processes from the test batch given in Equations (16)- (24), excluding the four ones used for expert knowledge synthesis, PID parameters are initially tuned by the A-H method. The processes are then fine-tuned by the FES tuning method with all three modes.
The results obtained using both methods are compared below.

Fes tuning method in the speed up mode
Consider process G 6 (21) with parameter T = 0.5 as the first example. Fitting the model given in Equation (3) to the process, it was found that the apparent time delay and velocity gain were T = 1 and K v = 1. By applying A-H tuning, the following PID parameters are obtained: K p = 0.45, T i = 8, and T d = 0.5. The FES tuning method in the speed up mode is applied and the procedure through iterations can be seen in Figure 8. The procedure starts at moment t 1 and ends at moment t 8 . After seven iterations, the following PID parameters are obtained: K p = 0.99, T i = 10.83, and T d = 0.36. Table 3. Overview of PID parameters through iterations of the proposed FES tuning method in the speed up tuning mode for process G 6 (21) with parameter T = 0.5.  Table 3 shows how parameters are changed through iterations, from the first one to the last one. For all seven iterations, the responses of the system to step changes in setpoint and load are shown in Figure 9. From the figure, it can be seen that the rise time is shorter and shorter with each iteration. At the same time, the overshoot hardly changes while the rise time is slightly improved. It can also be seen that the response to the unit step changes in load improves in each subsequent iteration.   Performance and robustness measures are shown in Table 4 to enable a better comparison of results. It can be seen from the table that the proposed method meets the previously set goals but with the degradation of sensitivity, which is expected as the system speeds up.
The procedure is repeated for all other processes, and improvements are calculated. Average improvements grouped by process type are displayed in Table 5. The FES tuning method in the speed up mode achieved a significant average decrease of nearly 60% in rise time, which is the primary goal of this operating mode. At the same time, a visible average improvement of overshoot and settling time can also be observed, excluding a couple of groups of processes with the degradation of settling time. The values of the integral of the absolute error of the reference step response and load step response are also noticeably reduced on average. Speeding up the system degradation of sensitivity is expected and is almost 25% on average, which is satisfactory. Considering all the processes, the average duration of the procedure is about 17 iterations.

Fes tuning method in the reduce overshoot mode
Consider process G 5 (20) with parameter α = 0.1 as the second example. Fitting the model given in Equation Table 6. Overview of PID parameters through iterations of the proposed FES tuning method in the reduce overshoot mode for process G 5 (20) with parameter α = 0.1. (2) to the process, it was found that the apparent time delay and time constants were L = 0.11 and T = 0.99. Applying the A-H method, the following PID parameters are obtained: K p = 4.29, T i = 0.44, and T d = 0.05. The FES tuning method in the reduce overshoot mode is applied and the procedure through iterations can be seen in Figure 10. The procedure starts at moment t 1 and ends at moment t 6 . After five iterations, the following PID parameters are obtained: K p = 5.38, T i = 0.74, and T d = 0.05. Table 6 shows how the parameters are changed through iterations, from the first one to the last one. For all five iterations, the responses of the system to step changes in the setpoint and load are shown in Figure 11. The figure shows that overshoot decreases throughout iterations. At the same time, the rise time changes little while the settling time shows visible improvement. It can also be seen that the response to unit step changes in load is improved.   Performance and robustness measures are shown in Table 7. It can be seen that the proposed method meets the previously set goals with a little improvement of sensitivity.
The procedure is repeated for all processes, and improvements are calculated. The results are grouped by process type and average improvements for all groups are displayed in Table 8. The FES tuning method in the reduce overshoot operating mode achieved a significant average decrease of nearly 64% in overshoot, which is the primary goal of this operating mode. At the same time, there is a minimal average improvement of rising time and settling time. The value of the integral of an absolute error on the reference step response is reduced by nearly 17% on average. At the same time, there is a small average degradation of the integral of an absolute error on the load step response and sensitivity. The average duration of the procedure considering all the processes is nearly ten iterations.

Fes tuning method in the balanced mode
Consider process G 7 (22) with parameter T = 1 and L = 0.1 as the third example. Fitting the model given in Equation (2) to the process, it was found that the apparent time delay and time constants were L = 0.6    Figure 12. The procedure starts at moment t 1 and ends at moment t 6 . After five iterations, the following PID parameters are obtained: K p = 2.05, T i = 1.49, and T d = 0.23. Table 9 shows how parameters are changed through iterations, from the first one to the last one. For all five iterations, the responses of the system to step changes in setpoint and load are shown in Figure 13. The figure shows that overshoot, rise time, and settling time decrease throughout iterations. It can also be seen that the response to the unit step changes in load improves. Based on the performance and robustness measures shown in Table 10, it can be concluded that the proposed method meets the previously set goals.
The procedure is repeated for all processes, and improvements are calculated. The average improvements for all groups of processes are displayed in Table  11. The FES tuning method in the balanced mode achieved a significant average improvement of over 30% in settling time and overshoot, which is the main goal of this mode. At the same time, the average improvement in the settling time and integral of the absolute error of the reference and load step response is significant with approximately equal improvements across groups. A degradation of sensitivity is visible, with a highly satisfactory value of 12% on average. Considering all the processes, the average duration of the tuning procedure is about seven iterations.   (22) with parameters T = 1 and L = 0.1 tuned by the A-H method and fine-tuned by the FES tuning method in the balanced mode.

Conclusions
This paper studied a novel fuzzy expert scheme for PID auto-tuning. The proposed scheme utilizes the power of the fuzzy logic concept to enhance the tuning of the PID controller. This approach incorporates the control engineer's experience into a fuzzy expert system that would take over the tuning and deliver improved performance over the PID controller tuned using the classical tuning method. The proposed scheme updates the PID controller parameters through iterations based on response characteristics. The tuning process is guided by the scheme that analyzes process data much faster than a human, which results in a significant acceleration of manual tuning. The scheme has been tested through simulations on a broad set of different processes. The extensive set of processes was used to emphasize the power of generalization of the proposed solution. The A-H method as a representative of classical tuning methods was used as a reference point for comparison of obtained results. The A-H method already gives a good result for all observed processes, which leaves less room for improvement. However, the results showed that the proposed scheme could produce improvements in performance and at the same time keep the robustness within reasonable ranges. The operating modes raise the usability of the proposed scheme to a higher level by allowing it to prioritize the goals of the tuning procedure. The results demonstrated that all three operating modes achieved performance improvement following the initial set priorities (speeding up, reduce overshot, or balanced) in a relatively short time with little degradation of robustness.
Future work will focus on applying the proposed scheme to real controllers used in the industrial and building automation application, and verification of the scheme in a real environment.