# Application of a New Membership Function in Nonlinear Fuzzy PID Controllers with Variable Gains

Authors: Xuda Zhang; Hong Bao; Jingli Du; Congsi Wang
Journal: Journal of Applied Mathematics
 (2014)

---

## Abstract

This paper proposes a nonlinear fuzzy PID control algorithm, whose membership function (MF) is adjustable, is  universal, and has a wide adjustable range. Appling this function to fuzzy control theory will increase system’s tunability. The continuity of this function is proved. This method was employed in the simulation and HIL experiments. Effectiveness and feasibility of this function are demonstrated in the results.


---

## Body

## 1. Introduction

Linear proportional-integral-derivative (PID) controller is currently the most widely used control method, and about 90% of industrial processes employ this controller [1]. Though PID controller is adequate for linear applications, it is found that this controller performs poorly for nonlinear systems, time varying system, and system with time delay. Thus, nonlinear PID controllers are required to deal with this problem. Various nonlinear PID controllers have been proposed for complex plants [2–5], but these controllers are of less practical applicability due to the fact that the control gains are fixed. Therefore, nonlinear controllers with variable gains become the popular research problem.A variable gain controller is a controller in which at least one gain varies with input variables. Fuzzy controller is a kind of variable gain controllers. Fuzzy logic system theory was first proposed by Zadeh in 1965, which has been widely applied in control field. In addition, fuzzy controllers have been proven to be an effective choice to solve many practical problems with less time [6]. It is proved, in the past 1980s, that some simple Mamdani fuzzy controllers are essentially nonlinear PI or PD controllers with variable gains [7, 8]. They all used linear fuzzy sets to fuzzify input variables. The variable gains enabled the fuzzy controllers to outperform their linear counterparts when controlling nonlinear or time-delay systems [9–12]. However, since the relationship between adjustment of the consequents of the rules and properties of controllers is not explicit, big trouble is caused to adjust controller parameters. Hence, T-S fuzzy controllers that use linear or nonlinear input fuzzy sets are related to PID control so that the adjustment of the consequents of fuzzy controller rules can be implemented in a similar way of adjusting PID controller parameters. Haj-Ali and Ying [13] proposed two types of constraint conditions of the MFs of this kind of fuzzy controllers and the condition for controller structures that can be adjusted like PID controller. But, Haj-Ali and Ying [13] only presented the expressions of one kind of MFs, while those of other MFs were not presented. Moreover, the format of these MFs is relatively fixed or of small adjustment range, making them only available to limited plants.Aiming at solving the problems above, this paper presents a new MF. Compared with the MF in Haj-Ali and Ying [13], this MF satisfies both two constraint conditions, which can, therefore, compensate the shortage of the second kind of MF in [13]. The presented MF is of higher tenability and bigger tunable range. Therefore, it is more general. This paper demonstrates effectiveness of the proposed method with a numerical example and a semiphysical experiment.


## 2. Configuration of Fuzzy Controllers

The error and error rate are selected as inputs for the fuzzy controller as follows:(1)E(n)=S(n)-y(n),D(n)=E(n)-E(n-1),
where S(n) is the reference output of the plant at sampling time n and y(n) is the actual output of the plant. Here a two-dimensional fuzzy controller is considered with the inputs E(n) and D(n). The fuzzy rules are as follows.IFE(n) is P AND D(n) is P THEN Δu(n) is PIFE(n) is P AND D(n) is N THEN Δu(n) is ZIFE(n) is N AND D(n) is P THEN Δu(n) is ZIFE(n) is N AND D(n) is N THEN Δu(n) is N,whereΔu(n) denotes the change in controller output and “P” stands for positive and “N” for negative. Detailed explanation of these four rules can be found in [13].A class-1 fuzzy set satisfies the following conditions:(2)eP(x)=1-eN(x),eP(0)=dN(0)=0.5,eP(x)=1-dP(-x),eN(x)=1-dN(-x),
and a class-2 fuzzy set satisfies
(3)eP(x)=eN(-x),eP(x)=dP(x),eN(x)=dN(x).For a fuzzy controller with the inputsE(n) and D(n), the singleton output fuzzy sets, and the following MFs, consider
(4)eP(x)=11+exp⁡(-KPx),eN(x)=11+exp⁡(KPx),(5)dP(x)=11+exp⁡(-Kdx),dN(x)=11+exp⁡(Kdx).We can use the four rules above, product AND operator, and the centroid defuzzifier to structurally convert it into a nonlinear PI or PD controller with variable gains [13] as follows:
(6)Δu(n)=(eP(E)dP(D)H+eN(E)dN(D)(-H))×(eP(E)dP(D)+eP(E)dN(D)+eN(E)dP(D)+eN(E)dN(D))-1.Theorem 1.
A fuzzy controller that usesE(n) and D(n), the singleton output fuzzy sets, product AND operator, the four fuzzy rules, and the centroid defuzzifier structurally becomes a nonlinear PI or PD controller with variable gains in [-L,L]×[-L,L] if and only if ep(E)=1-dp(-D),eN(E)=1-dN(-D), if the class-1 input fuzzy sets are used, or ep(E)=dP(x),eN(x)=dN(x), if the class-2 input fuzzy sets are employed.We will only prove the class-1 input fuzzy sets as follows. Consider(7)Δu(n)=eP(E)dP(D)H+eN(E)dN(D)(-H)eP(E)dP(D)+eN(E)dN(D).NumDen:Num=eP(E)dP(D)H+eN(E)dN(D)(-H)num=eP(E)dP(D)+(1-eP(E))(1-dP(D))numnum×(-H)num=eP(E)dP(D)H-eP(E)dP(D)Hnumnum+(eP(E)+dP(D))H-Hnumnum+(eP(E)+dP(D))H-Hnum=(eP(E)+dP(D)-1)HDen=eP(E)dP(D)+eP(E)dN(D)numnum+eN(E)dP(D)+eN(E)dN(D)num=eP(E)dP(D)+eP(E)(1-dP(D))numnum+(1-eP(E))dP(D)+(1-eP(E))(1-dP(D))num=1Then,(8)Δu=(eP(E)+dP(D)-1)H.Taylor expansion of the fuzzy sets gives(9)eP(E)=a10+a11KeE(n)+a12(KeE(n))2+a13(KeE(n))3+⋯,dP(D)=a20+a21KdD(n)+a22(KdD(n))2+a23(KdD(n))3+⋯.Substituting them into (8) produces
(10)Δu=((KdD(n))3-1+a10+a20+a11KeE(n)+a21KdD(n)+a12(KeE(n))2+a22(KdD(n))2+a13(KeE(n))3+a23(KdD(n))3+⋯)H.By noting thatΔu=0, ∀(KeE(n)+KdD(n))=0 and replacing KdD(n) with -KeE(n), we can rewrite (10) in a polynomial of KeE(n) as follows:
(11)Δu=((KeE(n))3-1+a10+a20+(a11-a21)KeE(n)+(a12+a22)×(KeE(n))2+(a13-a23)(KeE(n))3+⋯)H≡0.The condition the equation above holds is that all the coefficients ofKeE(n) must be zero, leading to
(12)a10+a20=1,a1(2k-1)=a2(2k-1)≜a2k-1,a1(2k)=-a2(2k)≜a2kk=1,2,3,…;
namely, eP(E)=1-dP(-D),eN(E)=1-dN(-D).Here, the symbol “≜” stands for “defined as.” Substituting all these equations back into (10) yields
(13)Δu=((KdD(n))3a1(KeE(n)+KdD(n))+a2((KeE(n))2-(KdD(n))2)+a3((KeE(n))3+(KdD(n))3)+⋯)·H.The proof is then completed by a direct application of the binomial rules to this equation, which allows us to factor outKeE(n)+KdD(n) in the following equation:
(14)Δu=∂(E,D)(KeE(n)+KdD(n)),∂(E,D)=(((KeE(n))2-KeE(n)KdD(n)+(KdD(n))2)a1+a2(KeE(n)-KdD(n))+a3((KeE(n))2-KeE(n)KdD(n)+(KdD(n))2)+θ)·H,
where θ represents the truncating error in Taylor expansion. The variable proportional gain and integral gain are ∂(E,D)Ke and ∂(E,D)Kd, respectively.In practical applications,H is a design parameter and H could be P or 0 for Z and -H for N. The determination of KP and Kd in MFs is similar to that in PID controllers; therefore, this method can be easily used in practical applications. But, we can see that the format of the MFs of the fuzzy controller is fixed and as a consequence, it only applies to limited plants.


## 3. Adjustable Membership Function

### 3.1. Construction of New Membership Function

To overcome the drawbacks that the MF in Section2 is of fixed format and poor adjustability, we propose the following function:
(15)f(x)={0x≤-lx+l1+K(A0-x-l)-l<x≤A0-lA0+(x+l-A0)(1+K~A~)1+K~(x+l-A0)A0-l<x≤A1-l1x>A1-l,
where A~=A1-A0 and A1-A0=1. This function satisfies membership function constraints in (3), and, in particular, the function will be moved left or right by changing l. But, the range of (15) will be changed with the change of the range of “x,” that is, changing A0 and A1. In order to satisfy the condition that the range of MF must be limited to [0,1], we multiply it by 1/A1. Then A0 and A1 can be set by arbitrary values. So the final adjustable membership function is determined as follows:
(16)f(x)={0x≤-l1A1(x+l1+K(A0-x-l))-l<x≤A0-l1A1[A0+(x+l-A0)(1+K~A~)1+K~(x+l-A0)]A0-l<xA0-l≤A1-l1x>A1-l.The shape of the adjustable function is shown in Figure1. We defined G=A0-l as the inflexion point, Al=-l as the left endpoint, Ar=A1-l as the right endpoint, and K as function rate. And they can be adjusted by changing Al, Ar, and G. Thereby, control performance is improved. This membership function satisfies (2) and (3); furthermore, it has wide adjustment range.Figure 1
Examples of adjustable membership function.The MFs with different values ofK when Al=-0.5, Ar=0.5, and G=-0.1 are shown in Figure 2. It can be seen that the curves of the functions vary significantly with different values of K. Similarly, we can adjust other parameters, such as Al, Ar, and G, to improve control performance.Figure 2
Membership functions with different values ofK.A mutation of the controller output may occur if the membership function is not smooth and continuous, thus the control performance of the controller. The continuously derivable condition is given below.


### 3.2. Continuously Derivable Condition

The partial derivative of the piecewise function (15) is
(17)∂f∂x={0x≤-l1+KA0[1+L(A0-x-l)]2-l<x≤A0-l1+K~A~[1+K~(x+l-A0)]2A0-l<x≤A1-l0x>A1-l.As long as (17) is continuous at the subsection points, (15) will be continuously differentiable. Hence, the continuous derivable condition is
(18)KA0=K~A~.In addition, this condition will not reduce the regulation ability of (16).


## 3.1. Construction of New Membership Function

To overcome the drawbacks that the MF in Section2 is of fixed format and poor adjustability, we propose the following function:
(15)f(x)={0x≤-lx+l1+K(A0-x-l)-l<x≤A0-lA0+(x+l-A0)(1+K~A~)1+K~(x+l-A0)A0-l<x≤A1-l1x>A1-l,
where A~=A1-A0 and A1-A0=1. This function satisfies membership function constraints in (3), and, in particular, the function will be moved left or right by changing l. But, the range of (15) will be changed with the change of the range of “x,” that is, changing A0 and A1. In order to satisfy the condition that the range of MF must be limited to [0,1], we multiply it by 1/A1. Then A0 and A1 can be set by arbitrary values. So the final adjustable membership function is determined as follows:
(16)f(x)={0x≤-l1A1(x+l1+K(A0-x-l))-l<x≤A0-l1A1[A0+(x+l-A0)(1+K~A~)1+K~(x+l-A0)]A0-l<xA0-l≤A1-l1x>A1-l.The shape of the adjustable function is shown in Figure1. We defined G=A0-l as the inflexion point, Al=-l as the left endpoint, Ar=A1-l as the right endpoint, and K as function rate. And they can be adjusted by changing Al, Ar, and G. Thereby, control performance is improved. This membership function satisfies (2) and (3); furthermore, it has wide adjustment range.Figure 1
Examples of adjustable membership function.The MFs with different values ofK when Al=-0.5, Ar=0.5, and G=-0.1 are shown in Figure 2. It can be seen that the curves of the functions vary significantly with different values of K. Similarly, we can adjust other parameters, such as Al, Ar, and G, to improve control performance.Figure 2
Membership functions with different values ofK.A mutation of the controller output may occur if the membership function is not smooth and continuous, thus the control performance of the controller. The continuously derivable condition is given below.


## 3.2. Continuously Derivable Condition

The partial derivative of the piecewise function (15) is
(17)∂f∂x={0x≤-l1+KA0[1+L(A0-x-l)]2-l<x≤A0-l1+K~A~[1+K~(x+l-A0)]2A0-l<x≤A1-l0x>A1-l.As long as (17) is continuous at the subsection points, (15) will be continuously differentiable. Hence, the continuous derivable condition is
(18)KA0=K~A~.In addition, this condition will not reduce the regulation ability of (16).


## 4. Simulation and Experiment

### 4.1. Simulation

Simulation on an inverted pendulum system shown in Figure3 is conducted.Figure 3
The inverted pendulum.The dynamics of the system is given by(19)x˙1=x2,x˙2=[g·sinx1-m·l·x22·cos⁡x1·sinx1mc+m]+cos⁡x1mc+m·ul(4/3-mcos⁡2x1/(mc+m))y=x1,
in which x1 is the angular position of the pendulum, x2 is the angular velocity, mc is the mass of the cart, and m is mass of the pendulum.A sinusoidal signal is chosen as input signal in the simulation. Control parameters are as follows:H=21, K=1, A1=0.4, A2=1.8, and l=0.6. The simulation results are shown in Figures 4, 5, and 6.Position and velocity tracking curves; (a) position tracking curves and (b) velocity tracking curves.
(a)
(b)Figure 5
System inputu.Comparison of position and velocity tracking errors; (a) position tracking error and (b) velocity tracking error.
(a)
(b)From Figures4 and 5, it can be found that the tracking error at the initial stage is relatively large since the initial position error is somewhat big. Then tracking curve essentially coincides with the ideal curve after 1 s and is in a steady state.Furthermore, a comparison with the control result using the membership function given in literature [13] is made to illustrate the effectiveness of the method proposed. A comparison of the tracking error under the same conditions is shown in Figure 6.We can conclude from Figure6 that tracking errors fluctuate up and down around zero. The simulation results show that the position error of the controller with the adjustable MF is about 0.005 rad; on the other hand, that using the MF presented in literature [13] is about 0.01 rad, as shown in Figure 6(a). Control performance of the adjustable membership function can be demonstrated in this comparison.


### 4.2. Experiment

A typical industrial mechatronic drives unit (IMDU) is depicted in Figure7. This is a versatile system that can be used to illustrate fundamentals of servo control as well as advanced topics, such as haptics and teleoperation, web winding control, backlash compensation, friction compensation, and high order coupling of complex industrial processes. The unit contains 4 shafts configured in a square pattern. Two of the shafts are motor driven while the other two can freely rotate. All shafts are instrumented with optical encoders. Each motor is driven by a linear current control amplifier with the capability of 100 watts.Figure 7
IMDU.In this paper, fuzzy controller and adjustable membership function are used to control one shaft of IMDU to track step signal and sinusoidal signal. Tracking errors of reference step signal and sinusoidal signal are shown in Figures8 and 9, respectively. These figures are drawn based on the data collected from real system.IMDU tracking step signal and tracking error; (a) IMDU tracking step signal and (b) IMDU tracking error.
(a)
(b)IMDU tracking sinusoidal signal and tracking error; (a) IMDU tracking sinusoidal signal and (b) IMDU tracking error.
(a)
(b)We can conclude from Figures8 and 9 that the control performance of controller using adjustable membership function is in the experiment’s permissible error range. The rise time is about 0.1 s and the steady-state error is around 0 when tracking step signal. The system error is within four degrees when tracking sinusoidal signal. Although the result does not reach our expectation, it still shows its practicality.


## 4.1. Simulation

Simulation on an inverted pendulum system shown in Figure3 is conducted.Figure 3
The inverted pendulum.The dynamics of the system is given by(19)x˙1=x2,x˙2=[g·sinx1-m·l·x22·cos⁡x1·sinx1mc+m]+cos⁡x1mc+m·ul(4/3-mcos⁡2x1/(mc+m))y=x1,
in which x1 is the angular position of the pendulum, x2 is the angular velocity, mc is the mass of the cart, and m is mass of the pendulum.A sinusoidal signal is chosen as input signal in the simulation. Control parameters are as follows:H=21, K=1, A1=0.4, A2=1.8, and l=0.6. The simulation results are shown in Figures 4, 5, and 6.Position and velocity tracking curves; (a) position tracking curves and (b) velocity tracking curves.
(a)
(b)Figure 5
System inputu.Comparison of position and velocity tracking errors; (a) position tracking error and (b) velocity tracking error.
(a)
(b)From Figures4 and 5, it can be found that the tracking error at the initial stage is relatively large since the initial position error is somewhat big. Then tracking curve essentially coincides with the ideal curve after 1 s and is in a steady state.Furthermore, a comparison with the control result using the membership function given in literature [13] is made to illustrate the effectiveness of the method proposed. A comparison of the tracking error under the same conditions is shown in Figure 6.We can conclude from Figure6 that tracking errors fluctuate up and down around zero. The simulation results show that the position error of the controller with the adjustable MF is about 0.005 rad; on the other hand, that using the MF presented in literature [13] is about 0.01 rad, as shown in Figure 6(a). Control performance of the adjustable membership function can be demonstrated in this comparison.


## 4.2. Experiment

A typical industrial mechatronic drives unit (IMDU) is depicted in Figure7. This is a versatile system that can be used to illustrate fundamentals of servo control as well as advanced topics, such as haptics and teleoperation, web winding control, backlash compensation, friction compensation, and high order coupling of complex industrial processes. The unit contains 4 shafts configured in a square pattern. Two of the shafts are motor driven while the other two can freely rotate. All shafts are instrumented with optical encoders. Each motor is driven by a linear current control amplifier with the capability of 100 watts.Figure 7
IMDU.In this paper, fuzzy controller and adjustable membership function are used to control one shaft of IMDU to track step signal and sinusoidal signal. Tracking errors of reference step signal and sinusoidal signal are shown in Figures8 and 9, respectively. These figures are drawn based on the data collected from real system.IMDU tracking step signal and tracking error; (a) IMDU tracking step signal and (b) IMDU tracking error.
(a)
(b)IMDU tracking sinusoidal signal and tracking error; (a) IMDU tracking sinusoidal signal and (b) IMDU tracking error.
(a)
(b)We can conclude from Figures8 and 9 that the control performance of controller using adjustable membership function is in the experiment’s permissible error range. The rise time is about 0.1 s and the steady-state error is around 0 when tracking step signal. The system error is within four degrees when tracking sinusoidal signal. Although the result does not reach our expectation, it still shows its practicality.


## 5. Conclusion

(1) This paper presents a novel membership function, that is, adjustable membership function. This membership function is a supplement to the structural study of fuzzy controller and PID controller. This function can be adjusted flexibly, including the adjustment of the left and right endpointsAl and Ar, inflexion point G, and the function rate K to meet the control requirements.(2) WhenG point is in the y-axis and Al=-Ar, this function becomes class-1 MF in literature [13]. So class-1 MF can also be seen as a special case of adjustable membership function.(3) Although this membership function can be adjusted flexibly, the structure of this fuzzy controller is too simple to satisfy the strong nonlinear control tasks’ requirements, due to the fact that nonlinear fuzzy PID are better in handling nonlinear control problems and type-2 fuzzy controllers have better performance compared with type-1 fuzzy controllers. So our future work is extending the nonlinear fuzzy PID controller to type-2 fuzzy PID controller and analyzing the internal relations between the fuzzy controllers and nonlinear PID controller.



---

*Source: 482489-2014-08-28.xml*