# Fuzzy PID Control of the Three-Degree-of-Freedom Parallel Mechanism Based on Genetic Algorithm
## 4 PM Control System
### Fuzzy PID Controller  
The PID controller is a feedback element commonly used in industrial control [24]. The input value can be adjusted according to the feedback value and the difference value so that the system is more accurate and stable. PID algorithms can be divided into positional PID and incremental PID. \[u(k)=K_{P}e(k)+K_{I}\sum_{i=0}^{k}e(i)+K_{D}[e(k)-e(k-1)] \tag{8}\]  
\[\Delta u(k)=K_{P}[e(k)-e(k-1)]+K_{I}e(k)+K_{D}[e(k)-2e(k-1)+e(k-2)] \tag{9}\]  
Equations (8) and (9) are place style and increment style, respectively. \(e(K)\) represents the error. Fuzzy logic control (FLC) has the advantage of using human brains to solve problems, with its core divided into the fuzzification interface, fuzzy rule base, fuzzy decision, and defuzzification. Fuzzy inferences include membership function and rule table, and the knowledge base is obtained from expert experience. Fuzzy PID (FPID) combines Fuzzy control and PID control, with a simple structure and strong self-adaptability [25]. The fuzzy controller takes error \(E\) as the input. The output is the modified values of PID parameters \(\Delta K_{p}\), \(\Delta K_{i}\), and \(\Delta K_{d}\) through quantization factors, fuzzy control rules, and scale factors. \(K_{e}\) and \(K_{ec}\) are quantization factors; \(K_{up}\) is the scale factor for \(\Delta K_{p}\); \(K_{ui}\) the scaling factor for \(\Delta K_{i}\); and \(K_{ud}\) the scaling factor for \(\Delta K_{d}\). Figure 4 shows the block of the fuzzy PID structure. The expression of the fuzzy PID controller is shown in Equation (10). \[ \begin{cases}K_{p}=K_{p0}+\Delta K_{p}\\ K_{i}=K_{i0}+\Delta K_{i}\\ K_{d}=K_{d0}+\Delta K_{d}\\ \end{cases}  \tag{10}\]  
where \(K_{p0}\), \(K_{i0}\), and \(K_{d0}\) represent the proportional, integral, and differential initial coefficients in the traditional PID controller, respectively. Based on the fuzzy rule table, the fuzzy inference results show that \(\Delta K_{p}\), \(\Delta K_{i}\), and \(\Delta K_{d}\) are the change values of proportion, integral, and differential coefficients, respectively. The corresponding membership function is generated by the fuzzy toolbox of mathematical software. Correctly constructing the membership function is one of the keys to using fuzzy control. Figure 5 shows the quantization domain and fuzzy subset. The fuzzy subset with a sharp shape of the membership function has high resolutions and a high control sensitivity. On the contrary, the shape of the membership function curve is relatively flat, with good stability. Figure 4: Fuzzy PID controller. The relationship between the three input parameters of the PID controller and the general tuning principles summed up by expert experience are as follows:  
1. The absolute value of the input error is large. The \(K_{i}\) value is zero; the larger the \(K_{p}\) value, the smaller the \(K_{d}\) value taken simultaneously. 2. The absolute value of the input error is the median. \(K_{i}\) takes an appropriate value, and \(K_{p}\) should take a small value. The \(K_{d}\) value significantly affects the system. Figure 5: Membership function: (**a**) error; (**b**) changes in errors; (**c–e**) \(K_{p}\), \(K_{i}\), and \(K_{d}\) membership functions for fuzzy self-tuning PID, respectively. 3. The absolute value of the input error is small. \(K_{i}\) and \(K_{p}\) values should be large, and the \(K_{d}\) value depends on the absolute value of the change rate of the input error. When the change rate is small, \(K_{d}\) takes an intermediate value; otherwise, \(K_{d}\) takes a small value. Tables 1-3 show fuzzy rules. The input fuzzy variable derivative of position errors has seven linguistic variables, namely NB (negative big), NM (negative medium), NS (negative small), ZO (zero), PS (positive small), PM (positive medium), and PB (positive big). Three points, \(\Delta K_{p}\), \(\Delta K_{i}\), and \(\Delta K_{d}\), are defined as the fuzzy set in the defuzzification process.