FACTA UNIVERSITATIS Series: Electronics and Energetics Vol. 34, No 2, June 2021, pp. 203-217 https://doi.org/10.2298/FUEE2102203G Β© 2021 by University of NiΕ‘, Serbia | Creative Commons License: CC BY-NC-ND Original scientific paperο€ͺ PSO BASED TAKAGI-SUGENO FUZZY PID CONTROLLER DESIGN FOR SPEED CONTROL OF PERMANENT MAGNET SYNCHRONOUS MOTOR Hamid Ghadiri1, Hamed Khodadadi2, Hooman Eijei3, Milad Ahmadi4 1Faculty of Electrical, Biomedical and Mechatronics Engineering, Qazvin Branch, Islamic Azad University, Qazvin, Iran 2Department of Electrical Engineering, Khomeinishahr Branch, Islamic Azad University, Isfahan, Iran 3Engineering and Technical Department, Electricity Distribution Company of Lahijan, Lahijan, Iran 4School of Control Science and Engineering, Shandong University, Jinan 250061, PR China Abstract. A permanent magnet synchronous motor (PMSM) is one kind of popular motor. They are utilized in industrial applications because their abilities included operation at a constant speed, no need for an excitation current, no rotor losses, and small size. In the following paper, a fuzzy evolutionary algorithm is combined with a proportional-integral-derivative (PID) controller to control the speed of a PMSM. In this structure, to overcome the PMSM challenges, including nonlinear nature, cross-coupling, air gap flux, and cogging torque in operation, a Takagi-Sugeno fuzzy logic-PID (TSFL-PID) controller is designed. Additionally, the particle swarm optimization (PSO) algorithm is developed to optimize the membership functions' parameters and rule bases of the fuzzy logic PID controller. For evaluating the proposed controller's performance, the genetic algorithm (GA), as another evolutionary algorithm, is incorporated into the fuzzy PID controller. The results of the speed control of PMSM are compared. The obtained results demonstrate that although both controllers have excellent performance; however, the PSO based TSFL-PID controller indicates more superiority. Key words: Particle Swarm Optimization (PSO), Takagi-Sugeno Fuzzy Logic (TSFL), PID, PMSM, Genetic Algorithm (GA). Received September 7, 2020; received in revised form December 2, 2020 Corresponding author: Hamid Ghadiri Faculty of Electrical, Biomedical and Mechatronics Engineering, Qazvin Branch, Islamic Azad University, Qazvin, Iran E-mail: h.ghadiri@qiau.ac.ir 204 H. GHADIRI, H. KHODADADI, H. EIJEI, M. AHMADI 1. INTRODUCTION The PMSM has been broadly used in many industrial applications and rapid replacement of induction and DC motors in servo applications. PMSMs are very favorite due to their efficiency, high power density, underweight, and small size comparing to DC and induction machines [1-3]. Synchronous motors are constant speed machines that the frequency of the armature current determines their speed. The armature current depends on armature voltage. Therefore, the simplest way to control the synchronous motor speed is to use the frequency of the voltage applied to the armature. However, in steady-state conditions, the synchronous motor speed is determined by the excitation frequency, but the frequency control speed is limited practically. The main reason is that it is difficult for a synchronous machine's rotor to follow an arbitrary change in the voltage frequency applied to the armature. Control of synchronous motors can be facilitated by control algorithms where the stator flux and its relation to the rotor flux are directly controlled. This structure leads to torque control of the synchronous motors. Some control methods such as model predictive control (MPC) [4], terminal sliding mode control [5,6], application of support vector machine in internal model control [7], adaptive control [8], input-output feedback linearization technique [9], and neural network control approach [10,11] are employed to control the speed and position of PMSMs. However, traditional PID control approaches are well-known yet, whereas these controllers are applicable readily while working well around the desired point [12,13]. Notably, conventional PID controllers fail to guide the system to a high-performance operation due to integral windup. Also, the model-based control approaches are presented in [14-16]. In [17,18], researchers have explained demagnetization fault diagnosis and fault model recognition as a significant issue on the PMSM derive system. In [19], the presented method aims to reject voltage disturbances with an internal model control (IMC); however, the IMC method fails when the system's parameters vary during their operation significantly. A fuzzy control system is analyzed in [20] with a lack of indicating transient speed responses under the load torque variations. Predictive model methods are considered by several researchers so far. A beneficial MPC method is applied to PSMS derives [21]. As a significant disadvantage in this method, solving the optimization problem requires a burdensome computational process for each instant sampling. As follow, a PID controller is considered to minimize the error signal; however, the constant PID coefficients are inefficient due to the system's nonlinear behavior. Several studies have been assigned to perform the self-tuning PID coefficients. Fuzzy logic can be identified as the most effective method to offer excellent flexibility for PID coefficients, changes under the system's nonlinear behavior [22]. The combination of fuzzy and PID controllers can create a reliable controller for nonlinear models. However, there are considerable deficiencies in some applications. When the system behavior becomes highly nonlinear, it is virtually impossible to use the PID controller under the fuzzy rules. This study's presented approach is based on optimizing the fuzzy rules in the Takagi- Sugeno fuzzy logic PID (TSFL-PID) controller to be more flexible than the conventional TSFL-PID controller. The TSFL-PID control parameters are tuned based on PSO. Besides, the TSFL-PID controller is optimized with GA for the comparison. The obtained results indicate that the PSO algorithm performs better than GA. The rest of this paper is organized as follows. The PMSM model and design procedure of the fuzzy PID controller will be explained in sections 2 and 3. Afterward, the TSFL-PID controller is presented and optimized using PSO and GA in section 4. Section 5 is dedicated PSO based Takagi-Sugeno Fuzzy PID Controller Design for Speed 205 to present the simulation results and the resultant discussion. Finally, this paper is concluded in section 6. 2. MATHEMATICAL MODEL OF PMSM The mathematical model of PMSM in the 𝑑 βˆ’ π‘ž coordinates is shown below. The voltage equation is [23]: π‘’π‘ž = π‘…π‘ π‘–π‘ž + πΏπ‘ž π‘–Μ‡Μ‡π‘ž + 𝑀𝑒 𝐿𝑑 𝑖𝑑 + 𝑀𝑒 𝛹𝑓 , 𝑒𝑑 = 𝑅𝑠 𝑖𝑑 + 𝐿𝑑 𝑖̇̇𝑑 βˆ’ 𝑀𝑒 πΏπ‘ž π‘–π‘ž , (1) where 𝑒𝑑 and π‘’π‘ž present the direct and quadrature-axis input voltages, 𝑖𝑑 and π‘–π‘ž represent the direct and quadratic-axis currents. Besides, the resistance of the stator phase and inductances of the direct and the quadrature-axis are demonstrated as 𝑅𝑠, 𝐿𝑑 as well as πΏπ‘ž , respectively. Furthermore, 𝛹𝑓 , and 𝑀𝑒 denote the excitation magnetic field and rotor angular speed. The magnetic bond equation is considered by the following equation [24]: 𝛹𝑑 = 𝐿𝑑 𝑖𝑑 + 𝛹𝑓 , π›Ήπ‘ž = πΏπ‘ž π‘–π‘ž , (2) where 𝛹𝑑 , and π›Ήπ‘ž are the existed magnetic fields in the stator winding of the direct-axis and quadrature-axis, respectively. The d-q coordinates, PMSM electromagnetic torque is [25]: 𝑇𝑒 = 𝑛𝑝(𝛹𝑓 π‘–π‘ž βˆ’ (𝐿𝑑 βˆ’ πΏπ‘ž )π‘–π‘ž 𝑖𝑑 ) , (3) where 𝑛𝑝 indicates the pole pairs value. The PMSM motion equations denote as follows: π½π‘β„¦Μ‡π‘Ÿ = 𝑇𝑒 βˆ’ 𝑇𝑙 βˆ’ π΅β„¦π‘Ÿ , β„¦π‘Ÿ = 𝑀𝑒 𝑛𝑝 . (4) where β„¦π‘Ÿ is the mechanical angular speed of the rotor, 𝐽 is the moment of inertia of the rotor and 𝑇𝑙 is the load (external) torque. Therefore, the state-space equations can be concluded using the above equations as: 𝑖̇�̇� = 1 πΏπ‘ž (π‘’π‘ž βˆ’ π‘…π‘ π‘–π‘ž + 𝐿𝑑 𝑖𝑑 πœ”π‘’ βˆ’ 𝛹𝑓 πœ”π‘’ ) , 𝑖̇�̇� = 1 𝐿𝑑 (𝑒𝑑 βˆ’ 𝑅𝑠𝑖𝑑 + πœ”π‘’ πΏπ‘ž π‘–π‘ž ) , �̇�𝑒 = 1 𝐽 (1.5𝑛𝑝 2 (𝛹𝑓 π‘–π‘ž + (𝐿𝑑 βˆ’ πΏπ‘ž )𝑖𝑑 π‘–π‘ž ) βˆ’ 𝑛𝑝𝑇𝑙 βˆ’ π΅πœ”π‘’ ). (5) In the PMSM vector control system, 𝑖𝑑 is assumed to be zero. Thus, the equation of state space (5) can be rewritten as follows: π‘–Μ‡Μ‡π‘ž = 1 πΏπ‘ž (π‘’π‘ž βˆ’ π‘…π‘ π‘–π‘ž βˆ’ 𝛹𝑓 πœ”π‘’ ) , �̇�𝑒 = 1 𝐽 (1.5𝑛𝑝 2 𝛹𝑓 π‘–π‘ž βˆ’ 𝑛𝑝𝑇𝑙 βˆ’ π΅πœ”π‘’ ). (6) A field-oriented vector-controlled isotropic PMSM dynamic equation can be obtained as follow: 206 H. GHADIRI, H. KHODADADI, H. EIJEI, M. AHMADI οΏ½Μ‡οΏ½(t)=πœ‘1π‘–π‘žπ‘  (𝑑) - πœ‘2πœ”(𝑑) - πœ‘3𝑇𝐿 (𝑑), (7) where πœ” = οΏ½Μ‡οΏ½ is the electrical rotor angular speed, ΞΈ is the electrical rotor angle, 𝑇𝐿 illustrates the load torque disturbance input, and πœ‘π‘– > 0, 𝑖 = 1, . . . , 3 are as follows: πœ‘1= 3𝑃2 8𝐽 πœ†π‘š , πœ‘2 = 𝐡 𝐽 , πœ‘3 = 𝑃 2𝐽 (8) while 𝑝 is the number of poles, 𝐽, 𝐡, and πœ†π‘š are the rotor inertia, the viscous friction coefficient, and the magnetic flux, respectively. Fig. 1 demonstrates the block diagram of the control system applied for PMSM. Fig. 1 Block diagram of a field-oriented PMSM control system [26]. As can comprehend, the three-phase current commands can be calculated via converting the controller commands π‘–π‘žπ‘ π‘‘ , 𝑖𝑑𝑠𝑑 . In which, 𝑖𝑑𝑠𝑑 assumed as the direct-axis reference current is typically equal to zero. In a field-oriented PMSM control system, the three-phase current commands are computed by converting the current controller commands π‘–π‘žπ‘ π‘‘ , 𝑖𝑑𝑠𝑑 . Thus, the main challenge can be described as proposing an evolutionary algorithm (EA) based FL-PID for speed control of PMSM. 3. FUZZY-PID CONTROLLER DESIGN 3.1. PID control structure One of the most widely used controllers in various industries is the PID controller. The main reason for this type's extensive use is its simplicity, where the control signal can be calculated as follows [27]: 𝑒(𝑑) = π‘˜π‘π‘’(𝑑) + π‘˜π‘– ∫ 𝑒(𝑑)𝑑(𝑑) + π‘˜π‘‘ 𝑑 𝑑𝑑 𝑒(𝑑) 𝑒(𝑑) = π‘Ÿ(𝑑) βˆ’ 𝑦(𝑑). (8a) where 𝑒(𝑑) is the control signal, 𝑒(𝑑) is error signal, π‘Ÿ(𝑑), and 𝑦(𝑑) are reference and output signals, respectively. The proportional, integral, and derivative terms are identified as π‘˜π‘, π‘˜π‘– , and π‘˜π‘‘ , respectively. The closed-loop system's operation can be affected directly by the mutation of controller parameters [28]. 3.2. Fuzzy logic controller Uncertainty is one of the inseparable parts of the industrial system [29-31]. The fuzzy logic approach controls a system intelligently without dependency on an accurate system model PSO based Takagi-Sugeno Fuzzy PID Controller Design for Speed 207 [32,33]. A fuzzy inference system (FIS) consists of a fuzzifier, rule base, inference engine, and defuzzifier. A set of fuzzy if-then rules the central part called the knowledge base. 3.3. Designing fuzzy-PID controller The traditional PID controller should be modified by using a Takagi-Sugeno fuzzy controller to tune the PID gains as follows [26]: Rule i : IF πœ”π‘’ and �̇�𝑒 is 𝐹𝑖 , THEN π‘–π‘žπ‘ π‘‘ = βˆ’ 𝐾𝑖 π‘ƒπœ”π‘’ βˆ’ 𝐾𝑖 𝐼 ∫ πœ”π‘’ π‘‘πœ 𝑑 0 βˆ’ 𝐾𝑖 𝐷 �̇�𝑒 (9) where πœ”π‘’ = πœ” βˆ’ 𝑣𝑑 , πœ”π‘‘ is the desired speed, 𝐹𝑖 (𝑖 = 1, … , 2𝑛 βˆ’ 1) are fuzzy sets, 𝑛 > 1, π‘Ÿ = 2𝑛 βˆ’ 1 is the number of fuzzy rules, and π‘˜π‘– 𝑃 , π‘˜π‘– 𝐼 , π‘˜π‘– 𝐷 are the constants. The fuzzy sets 𝐹𝑖 can be determined by the membership function π‘šπ‘– . We assume that the fuzzy set 𝐹𝑛 computes for πœ”π‘’ = 0, 𝐹𝑖 calculates for more negative πœ”π‘’ than 𝐹𝑖+1 does for 1 ≀ 𝑖 ≀ 𝑛 βˆ’ 1, and 𝐹𝑖+1 accounts for more positive πœ”π‘’ than 𝐹𝑖 does for 𝑛 ≀ 𝑖 ≀ 2𝑛 βˆ’ 2. Fig. 2 illustrates the membership function of the input variable "πœ”π‘’ " and �̇�𝑒 that the inputs are normalized into [-1,1]. In this figure, ZO(𝐹3) denotes zero, NB(𝐹1) represents negative big, NM(𝐹2) is the negative medium, PM(𝐹4) is a positive medium, and PB(𝐹5) is positive big. Fig. 2 Membership functions of the input variables "πœ”π‘’ " and �̇�𝑒 . 208 H. GHADIRI, H. KHODADADI, H. EIJEI, M. AHMADI The controller gains are set as [29]: 𝐾1 𝑃 β‰₯ 𝐾2 𝑃 β‰₯ β‹― β‰₯ πΎπ‘›βˆ’1 𝑃 β‰₯ 𝐾𝑛 𝑃 β‰₯ 0 𝐾2π‘›βˆ’1 𝑃 β‰₯ 𝐾2π‘›βˆ’2 𝑃 β‰₯ β‹― β‰₯ 𝐾𝑛+1 𝑃 β‰₯ 𝐾𝑛 𝑃 β‰₯ 0 𝐾1 𝐼 β‰₯ 𝐾2 𝐼 β‰₯ β‹― β‰₯ πΎπ‘›βˆ’1 𝐼 β‰₯ 𝐾𝑛 𝐼 β‰₯ 0 𝐾2π‘›βˆ’1 𝐼 β‰₯ 𝐾2π‘›βˆ’2 𝐼 β‰₯ β‹― β‰₯ 𝐾𝑛+1 𝐼 β‰₯ 𝐾𝑛 𝐼 β‰₯ 0 0 ≀ 𝐾1 𝐷 ≀ 𝐾2 𝐷 ≀ β‹― ≀ πΎπ‘›βˆ’1 𝐷 ≀ 𝐾𝑛 𝐷 0 ≀ 𝐾2π‘›βˆ’1 𝐷 ≀ 𝐾2π‘›βˆ’2 𝐷 ≀ β‹― ≀ 𝐾𝑛+1 𝐷 ≀ 𝐾𝑛 𝐷 (10) Using the typical fuzzy inference approach, the PID control input can be obtained as: π‘–π‘žπ‘ π‘‘ = βˆ’ βˆ‘ β„Žπ‘– (πœ”π‘’ ) [ 𝐾𝑖 𝑃 (πœ”π‘’ ) + 𝐾𝑖 𝐼 ∫ πœ”π‘’ π‘‘πœ 𝑑 0 +𝐾𝑖 𝐷�̇�𝑒 ] π‘Ÿ 𝑖 (11) where β„Žπ‘– = π‘šπ‘– / βˆ‘ π‘šπ‘— π‘Ÿ 𝑗=1 is the normalized weight of each IF-THEN rule, and it states β„Žπ‘– β‰₯ 0, βˆ‘ β„Žπ‘– = 1 π‘Ÿ 𝑖 . Fig. 3 shows a graphic interpretation of the fuzzy logic method to obtain the PID control input. Fig. 3 Flowchart representation of the FIS [26]. According to Fig. 3, the input premise variables are the speed error and its derivative. Hence, the number of initial fuzzy sets for input is equal to 2, and only one output variable π‘–π‘žπ‘ π‘‘ is utilized. Thus, the proposed approach is more straightforward and easier than the previous heuristics-based fuzzy control techniques, such as [34]. It should be noted that if the controller gains are set: 𝐾1 𝑃 = 𝐾2 𝑃 = β‹― = 𝐾2π‘›βˆ’1 𝑃 = 𝐾 𝑃 > 0 𝐾1 𝐼 = 𝐾2 𝐼 = β‹― = 𝐾2π‘›βˆ’1 𝐼 = 𝐾 𝐼 > 0 𝐾1 𝐷 = 𝐾2 𝐷 = β‹― = 𝐾2π‘›βˆ’1 𝐷 = 𝐾 𝐷 > 0 (12) PSO based Takagi-Sugeno Fuzzy PID Controller Design for Speed 209 The fuzzy control law can be changed into the conventional PID control law: π‘–π‘žπ‘ π‘‘ = βˆ’(𝐾 π‘ƒπœ”π‘’ + 𝐾 𝐼 ∫ πœ”π‘’π‘‘πœ 𝑑 0 + 𝐾 π·πœ”οΏ½Μ‡οΏ½ ) (13) Using the error vector 𝑒 = [𝑒1, 𝑒2] 𝑇, 𝑒1 = πœ”π‘’ = πœ” βˆ’ πœ”π‘‘ and 𝑒2 = 𝑑𝑒1 𝑑𝑑 , the error dynamics can be gained as follows: οΏ½Μ‡οΏ½1 = 𝑒2 οΏ½Μ‡οΏ½2 = βˆ’ βˆ‘ β„Žπ‘– (𝑒1)πœ‘1[𝐾𝑖 𝑃𝑒1 + 𝐾𝑖 𝐼 ∫ 𝑒2π‘‘πœ 𝑑 0 + 𝐾𝑖 𝐷 οΏ½Μ‡οΏ½2] + πœ‚(𝑑) π‘Ÿ 𝑖 (14) where πœ‚(𝑑) = βˆ’πœ‘2πœ”(𝑑) βˆ’ πœ‘3𝑇𝐿 (𝑑) (see equations (7) and (8)). 4. FUZZY-PID CONTROLLER OPTIMIZED BY PSO The constancy of PID coefficients included π‘˜π‘– , π‘˜π‘, and π‘˜π‘‘ makes this controller operation is not appropriate in nonlinear systems. On the other hand, when some variation has happened in the system condition, the designed controller doesn't have excellent performance [27,28,32,33]. Employing the optimal PID controller is a suitable solution for dominating these conditions. The PSO algorithm is one of the most effective methods that help shape fuzzy rules to be changed and optimized under a specific cost function. PSO algorithm is a meta-heuristic algorithm that solves the problems with the least information. The genetic algorithm can also act as an optimizer with three basic operators: crossover and mutation operators, to create a new population and one operator to distinguish between the generated population [35]. Albeit, the populations that are classified as inappropriate for survival, will be eliminated. Additionally, in terms of performance, GA has some significant weaknesses. High running costs can be the main GA problem where we need to keep hundreds of chromosomes in memory and perform the algorithm for thousands of generations. Howbeit, it is notable that GA is a meta-heuristic algorithm, and its time required for complete running is faster and more optimal than systematic methods. There are numerous problem solutions known as particles in a space with a specific PSO algorithm position. PSO is a population- based algorithm and considerably similar to evolutionary computational techniques like GA. The PSO's system begins to work by collecting random solutions, searching for optimization, and generational updates. Unlike GA, PSO has no evolutionary operator, such as crossover and mutation. As previously mentioned, particles are potential solutions while flying through the problem space by looking for optimum particles [36,37]. The equations describing the behavior of particles in PSO are given below: 𝑣𝑖 [𝑑 + 1] = 𝑀 𝑣 𝑖 [𝑑] + 𝑐1π‘Ÿ1(π‘₯ 𝑖,𝑏𝑒𝑠𝑑 [𝑑] βˆ’ π‘₯ 𝑖 [𝑑] + 𝑐2π‘Ÿ2(π‘₯ 𝑔𝑏𝑒𝑠𝑑 [𝑑] βˆ’ π‘₯ 𝑖 [𝑑]) π‘₯ 𝑖[𝑑 + 1] = π‘₯ 𝑖 [𝑑] + 𝑣𝑖 [𝑑 + 1] (15) (16) In these equations, 𝑖 specifies a pseudo time increment; 𝑣 𝑖 and π‘₯ 𝑖 describe the speed and position of the ith particle; π‘₯ 𝑖,𝑏𝑒𝑠𝑑 and π‘₯ 𝑔𝑏𝑒𝑠𝑑 denote the best earlier position and best global position of the swarm, respectively. Besides, 𝑐1 and 𝑐2 assigned to the personal and collective learning indices, 𝑀 demonstrates the inertia index, and π‘Ÿ1, π‘Ÿ2 are the random numbers varying between 0 and 1. 210 H. GHADIRI, H. KHODADADI, H. EIJEI, M. AHMADI To find a solution using PSO, steps are as follows [38]: Step 1: Select an approach to encode variables into particles. Step 2: Initialization and start with an accidentally generated population of 𝑁𝑝 particles. Step 3: Evaluate the fitness for 𝑁𝑝 population. Step 4: Initialization the position and fitness of global and local variables and calculate the velocity vector. Step 5: Calculate the new position that obtained the velocity vector and evaluate the fitness corresponding to the new position. Step 6: Get the local best fitness and global best fitness and continue until stopping criteria. Step 7: Stop the procedure when the necessary criterion is realized. Otherwise, repeat the algorithm by Step 4. 4.1. Fitness function Several objective functions can be considered for improving the PMSM performance. In this research, the integral time absolute error (ITAE) index is utilized. ITAE is defined as follows: 𝐼𝑇𝐴𝐸 = ∫ 𝑑|𝑒(𝑑)| 𝑇 0 𝑑𝑑 (17) Velocity vector obtained based on the following equation: π‘π‘œπ‘π‘’π‘™π‘Žπ‘‘π‘–π‘œπ‘› (𝑖). π‘£π‘’π‘™π‘œπ‘π‘–π‘‘π‘¦ = 𝑀 βˆ— π‘π‘œπ‘π‘’π‘™π‘Žπ‘‘π‘–π‘œπ‘›(𝑖). π‘£π‘’π‘™π‘œπ‘π‘–π‘‘π‘¦ +π‘Ÿπ‘Žπ‘›π‘‘ βˆ— 𝐢1 βˆ— π‘π‘œπ‘π‘’π‘™π‘Žπ‘‘π‘–π‘œπ‘›(𝑖). 𝑃𝑏𝑒𝑠𝑑 π‘π‘œπ‘π‘’π‘™π‘Žπ‘‘π‘–π‘œπ‘›(𝑖). π‘π‘œπ‘ π‘–π‘‘π‘–π‘œπ‘›) +π‘Ÿπ‘Žπ‘›π‘‘ βˆ— 𝐢2 βˆ— (𝐺𝑏𝑒𝑠𝑑. π‘π‘œπ‘ π‘–π‘‘π‘–π‘œπ‘› βˆ’ π‘π‘œπ‘π‘’π‘™π‘Žπ‘‘π‘–π‘œπ‘›(𝑖). π‘π‘œπ‘ π‘–π‘‘π‘–π‘œπ‘›) 4.2. Calculating new position New position obtained using the following equation: π‘π‘œπ‘π‘’π‘™π‘Žπ‘‘π‘–π‘œπ‘›(𝑖). π‘π‘œπ‘ π‘–π‘‘π‘–π‘œπ‘› = π‘π‘œπ‘π‘’π‘™π‘Žπ‘‘π‘–π‘œπ‘›(𝑖). π‘£π‘’π‘™π‘œπ‘π‘–π‘‘π‘¦ + π‘π‘œπ‘π‘’π‘™π‘Žπ‘‘π‘–π‘œπ‘›(𝑖). π‘π‘œπ‘ π‘–π‘‘π‘–π‘œπ‘› π‘π‘œπ‘π‘’π‘™π‘Žπ‘‘π‘–π‘œπ‘›(𝑖). π‘π‘œπ‘ π‘–π‘‘π‘–π‘œπ‘› = π‘šπ‘–π‘›(π‘šπ‘Žπ‘₯(π‘π‘œπ‘π‘’π‘™π‘Žπ‘‘π‘–π‘œπ‘›(𝑖). π‘π‘œπ‘ π‘–π‘‘π‘–π‘œπ‘›, π‘™π‘œπ‘€π‘’π‘Ÿπ‘π‘œπ‘’π‘›π‘‘), π‘’π‘π‘π‘’π‘Ÿπ‘π‘œπ‘’π‘›π‘‘) In this paper, the max iteration equal to 15 is considered as the maximum of iteration. 5. SIMULATION RESULTS Fig. 4 illuminates the block diagram of the suggested EA based TSFL-PID control system. An optical encoder calculates the rotor position (πœƒ), and motor speed (πœ”). The switching frequency is assumed 5 kHz, and a space vector modulation (SVM) technique is in charge of controlling pulse-width modulation (PWM). Also, PMSM parameters are given in Table 1. The controlled system involves two control loops (See Fig. 4). The outer loop is suggested EA-based TSFL-PID controller, and the inner is a traditional PI current controller. The output generated by the considered controller (π‘–π‘žπ‘ π‘‘ ) is applied to the input of PI current controller. PSO based Takagi-Sugeno Fuzzy PID Controller Design for Speed 211 Fig. 4 Block diagram of the suggested EA based TSFL-PID controller for the PMSM system. Table 1 PMSM Parameters Parameter Value Rated output 400 W Rated current 3.5 A Rated speed 3000 rpm Voltage constant (Vpeak L-L) 300 v Number of poles (𝑝) 4 Stator resistance (𝑅𝑠) 0.18 ohm Stator inductance (𝐿𝑠 = πΏπ‘ž = 𝐿𝑑) 0.71mh Magnetic flux (πœ†π‘š) 0.413497 Equivalent inertia (𝐽) 0.0008 kg.m^2 friction factor (𝐡) 0.0001 N.m.s In the first step, simulations are performed considering no load is affect on the PMSM. Assuming three determining speeds, including 1, 1000, and 2500 rpm, as cases a, b and c, are employed to the PMSM at start time. Membership functions are considered in the Quasi form. The fuzzy rules for designing the output based on the error and its changes are given in Table 2, in which, 𝛼 is considered as 𝑃, 𝐼, 𝐷. Table 2 Fuzzy rules for computing PID gains (𝐾𝑗 𝛼 , 𝛼: 𝑃, 𝐼, 𝐷) πœ”π‘’ /�̇�𝑒 NB NM ZO PM PB NB 𝐾1 𝛼 𝐾2 𝛼 𝐾3 𝛼 𝐾4 𝛼 𝐾5 𝛼 NM 𝐾6 𝛼 𝐾7 𝛼 𝐾8 𝛼 𝐾9 𝛼 𝐾10 𝛼 ZO 𝐾11 𝛼 𝐾12 𝛼 𝐾13 𝛼 𝐾14 𝛼 𝐾15 𝛼 PM 𝐾16 𝛼 𝐾17 𝛼 𝐾18 𝛼 𝐾19 𝛼 𝐾20 𝛼 PB 𝐾21 𝛼 𝐾22 𝛼 𝐾23 𝛼 𝐾24 𝛼 𝐾25 𝛼 212 H. GHADIRI, H. KHODADADI, H. EIJEI, M. AHMADI With the increase in π‘Ÿ, the control performance can be improved at the expense of the computational burden. It is well visible in the simulation results that π‘Ÿ = 5 gives a satisfactory control performance. It should be noted that the proposed approach is similar to the GA-based Fuzzy-PID controller presented in [29] and simpler than the previous fuzzy methods given in [34]. Figs. 5 and 6 demonstrate the convergence diagram of the PSO and GA methods. The PSO convergency is realized faster compared to the GA. Besides, the final value of the cost function in the PSO algorithm (0.01554) is much less than GA (0.01787). Thus, the better optimal control parameters and control speed can be obtained using PSO in the current control issue. The optimal control parameters for each meta-heuristic algorithm (PSO and GA) are indicated in Table 3. Fig. 5 The convergence of the GA algorithm Fig. 6 The convergence of the PSO algorithm The number of decision variables and control parameters are assumed equal for both methods. Given the following mathematical equations, the coefficients of the EA based TSFL- PID controllers for each meta-heuristic algorithm are shown in Tables 4-6. For avoiding prolongation, the first five parameters of the PID gains are mentioned in these tables. PSO based Takagi-Sugeno Fuzzy PID Controller Design for Speed 213 𝐾1 𝑃 = 𝐾2π‘›βˆ’1 𝑃 = 𝐾 𝑃, 𝐾2 𝑃 = 𝐾2π‘›βˆ’1 𝑃 = 𝛼1𝐾 𝑃 , … , 𝐾𝑛 𝑃 = (∏ 𝛼𝑗 π‘›βˆ’1 π‘—βˆ’1 ) 𝐾 𝑃 𝐾1 𝐼 = 𝐾2π‘›βˆ’1 𝐼 = 𝐾𝐼 , 𝐾2 𝐼 = 𝐾2π‘›βˆ’1 𝐼 = 𝛽1𝐾 𝐼 , … , 𝐾𝑛 𝐼 = (∏ 𝛽𝑗 π‘›βˆ’1 π‘—βˆ’1 ) 𝐾𝐼 𝐾𝑛 𝐷 = 𝐾 𝐷, 𝐾𝑛+1 𝐷 = πΎπ‘›βˆ’1 𝐷 = 𝛾1𝐾 𝐷 , … , 𝐾1 𝐷 = 𝐾2π‘›βˆ’1 𝐷 = (∏ 𝛾𝑗 π‘›βˆ’1 π‘—βˆ’1 ) 𝐾 𝐷 (18) Table 3 The Achieved Optimal Control Parameters for the PSO and GA methods Optimizers Parameters PSO GA 𝛼1 0.9814 0.8137 𝛼2 0.5277 0.4721 𝛽1 0.9116 0.8133 𝛽2 0.7984 0.7107 𝛾1 0.7221 0.6510 𝛾2 0 0.1575 𝛿1 0.2319 0.6591 𝛿2 0 0.3394 1 0 0.8594 2 0.5411 0.9733 3 0.9412 0.9508 Table 4 Achieved 𝐾𝑗 𝑃 Parameters Related to EA based TSFL-PID controller PSO GA 0.04 0.0400 𝐾1 𝑃 0.04 0.03176 𝐾2 𝑃 0.000228 0.000228 𝐾3 𝑃 0.04 0.023076 𝐾4 𝑃 0.04 0.040 𝐾5 𝑃 Table 5 Achieved 𝐾𝑗 𝐷 Parameters Related to EA based TSFL-PID controller PSO GA 0 0.00972 𝐾1 𝐷 0.01 0.008155 𝐾2 𝐷 0.01 0.01 𝐾3 𝐷 0.01 0.003055 𝐾4 𝐷 0 0.00627 𝐾5 𝐷 214 H. GHADIRI, H. KHODADADI, H. EIJEI, M. AHMADI Table 6 Achieved 𝐾𝑗 𝐼 Parameters Related to EA based TSFL-PID controller PSO GA 8 8 𝐾1 𝐼 8 5.238 𝐾2 𝐼 8 2.011 𝐾3 𝐼 8 5.901 𝐾4 𝐼 8 8 𝐾5 𝐼 Whereas the fuzzy outputs feed the PID coefficients, Takagi-Sugeno fuzzy system is used instead of the Mamdani fuzzy system structure. In the TS fuzzy structure, only the input variables have a membership function, and the output variables don't have these. To evaluate the proposed controller's performance in speed tracking for the PMSM system, figure 7 is presented. In this figure, the PMSM responses to variation of speed and external load disturbance are demonstrated. Besides the proposed approach of this paper as the PSO based TSFL-PID, the GA based TSFL-PID and PI controllers are employed for the comparison. Figure 7 is composed of three sub-figures. In the first sub-figure (case a), the setpoint is determined at 1 rpm. In the second and third sub-figures (cases b and c), these values are set at 1000 and 2500 rpm. Besides, for assessing the proposed method's ability in disturbance attenuation, external load disturbances have been added to the PMSM system. While a step disturbance with 0.5 rpm is applied to case 1, the amplitudes of adding the step disturbances are 200 and 1000 rpm for cases b and c, respectively. In all cases, the time of inserting external disturbances is 10 seconds. For a comprehensive comparison, the transient characteristics consist of overshoot, settling, rise, and peak times for PSO and GA based TSFL-PID and PI controllers are presented in Table 7. As can be seen, the proposed approach has the best performance in transient and settling times and overshoot for both speed tracking and disturbance attenuation. In other words, the disturbance effect on the PMSM performance is reduced via the proposed controller. Table 7 Transient characteristic of PMSM speed control for PSO and GA Optimization Algorithm and PI Controller Case 1 Case 2 Case 3 PSO GA PI PSO GA PI PSO GA PI Overshoot (Mp%) 0 3.5 21.5 0 8.75 22.7 0 6.84 14 Settling Time (ts) 0.41 1.52 3.68 0.4 1.55 3.7 0.811 1.55 6.03 Rise Time (tr) 0.22 0.582 0.685 0.229 0.485 0.659 0.636 0.539 1.4 Peak Time (tp) -- 1.28 1.57 -- 1.138 1.4 -- 1.002 3.04 PSO based Takagi-Sugeno Fuzzy PID Controller Design for Speed 215 (a) (b) (c) Fig. 7 Comparison between the speed response of the PMSM applying the PSO-TSFL- PID, GA-TSFL-PID, and PI controllers in three cases 0 5 10 15 0 0.2 0.4 0.6 0.8 1 1.2 1.4 Time (sec) S p e e d ( rp m ) Speed response of the PMSM in the presence of external load disturbance PSO-TSFL-PID GA-TSFL-PID PI 0 5 10 15 0 200 400 600 800 1000 1200 1400 Time (sec) S p e e d ( rp m ) Speed response of the PMSM in the presence of external load disturbance PSO-TSFL-PID GA-TSFL-PID PI 0 5 10 15 0 500 1000 1500 2000 2500 3000 Time (sec) S p e e d ( rp m ) Speed response of the PMSM in the presence of external load disturbance PSO-TSFL-PID GA-TSFL-PID PI 216 H. GHADIRI, H. KHODADADI, H. EIJEI, M. AHMADI 6. CONCLUSION The challenge of the speed control of the PMSM consist of nonlinear nature, cross- coupling, and air gap flux is considered in this paper. By introducing the TSFL-PID controller for this purpose, the system's overall performance is determined. Two meta- heuristic algorithms consist of the PSO and GA are individually combined by the proposed controller for the parameter's optimization. The simulation results demonstrate that although both optimization algorithms' performances are suitable in the speed control of PMSM, the PSO based TSFL-PID controller shows superiority in this particular issue. Moreover, compared to the PI controller, the best transient response in speed tracking and disturbance attenuation belongs to the proposed approach. REFERENCES [1] K. Zhao et al., "Sliding mode observer-based current sensor fault reconstruction and unknown load disturbance estimation for PMSM driven system", Sensors, vol. 17, no. 12, p. 2833, December 2017. [2] H. Ghadiri, "Real-time Stability Assessment of Power System using ANN without Requiring Expert Experience", Majlesi J. Electr. Eng., vol. 14, no. 2, pp. 43-49, June 2020. [3] S. Heidarpoor, M. Tabatabaei and H. Khodadadi, "Speed control of a DC motor using a fractional order sliding mode controller", In Proceedings of the 2017 IEEE International Conference on Environment and Electrical Engineering and 2017 IEEE Industrial and Commercial Power Systems Europe (EEEIC/I&CPS Europe), 2017, pp. 1-4. [4] M. Preindl, and S. Bolognani, "Model predictive direct torque control with finite control set for PMSM drive systems, part 2: Field weakening operation", IEEE Trans. Industr. Inform., vol. 9, no. 2, pp. 648-657, May 2013. [5] Y. Wang, H. Yu, Z. Che, Y. Wang and Y. Liu, "The direct speed control of PMSM based on terminal sliding mode and finite time observer", Processes, vol. 7, no. 9, p. 624, September 2019. [6] K. Zhao et al., "Robust model-free nonsingular terminal sliding mode control for PMSM demagnetization fault", IEEE Access, vol. 7, pp. 15737-15748, February 2019. [7] G. Liu et al., "Internal model control of permanent magnet synchronous motor using support vector machine generalized inverse", IEEE Trans. Industr. Inform., vol. 9, no. 2, pp. 890-898, May 2013. [8] Y. Zhan, J. Guan and Y. Zhao, "An adaptive second-order sliding-mode observer for permanent magnet synchronous motor with an improved phase-locked loop structure considering speed reverse", Trans. Inst. Meas. Control, vol. 42, no. 5, pp.1008-1021, March 2020. [9] K. Zhou, M. Ai, D. Sun, N. Jin and X. Wu, "Field weakening operation control strategies of PMSM based on feedback linearization", Energies, vol. 12, no. 23, p. 4526, November 2019. [10] F. F. El-Sousy, "Intelligent optimal recurrent wavelet Elman neural network control system for permanent- magnet synchronous motor servo drive", IEEE Trans. Industr. Inform, vol. 9, no. 4, pp. 1986-2003, November 2013. [11] B. Zhang and X. Gao, "Hybrid Adaptive Integral Sliding Mode Speed Control of PMSM System Using RBF Neural Network", In Proceedings of the 2020 International Symposium on Power Electronics, Electrical Drives, Automation and Motion (SPEEDAM), 2020, pp. 17-22. [12] F. Cao, "PID controller optimized by genetic algorithm for direct-drive servo system", Neural Comput. Appl., vol. 32, no. 1, pp. 23-30, September 2020. [13] J.-W. Jung et al., "Adaptive PID speed control design for permanent magnet synchronous motor drives", IEEE Trans. Power Electron., vol. 30, no. 2, pp. 900-908, February 2014. [14] C. Zhang et al., "Sliding observer-based demagnetisation fault-tolerant control in permanent magnet synchronous motors", J. Eng., vol. 2017, no. 6, pp. 175-183, June 2017. [15] C. Zhang et al., "Robust fault-tolerant predictive current control for permanent magnet synchronous motors considering demagnetization fault", IEEE Trans. Ind. Electron., vol. 65, no. 7, pp. 5324-5334, July 2018. [16] H. Mekki et al., "Fault tolerant design for permanent magnet synchronous motor using fuzzy speed controller", IFAC-PapersOnLine, vol. 49, no. 5, pp. 315-320, June 2016. [17] L. Hongmei, C. Tao, and Y. Hongyang, "Mechanism, diagnosis and development of demagnetization fault for PMSM in electric vehicle", Transactions of China Electrotechnical Society, vol. 28, no. 8, pp. 276-284, August 2013. PSO based Takagi-Sugeno Fuzzy PID Controller Design for Speed 217 [18] H. Li and T. Chen, "Demagnetization fault diagnosis and fault mode recognition of PMSM for EV", Transactions of China Electrotechnical Society, vol. 32, no. 5, pp. 1-8, March 2017. [19] C. Xia et al., "Voltage disturbance rejection for matrix converter-based PMSM drive system using internal model control", IEEE Trans. Ind. Electron., vol. 59, no. 1, pp. 361-372, January 2011. [20] H. H. Choi and J.-W. Jung, "Discrete-time fuzzy speed regulator design for PM synchronous motor", IEEE Trans. Ind. Electron., vol. 60, no. 2, pp. 600-607, February 2013. [21] S. Chai, L. Wang, and E. Rogers, "A cascade MPC control structure for a PMSM with speed ripple minimization", IEEE Trans. Ind. Electron., vol 60, no. 8, pp. 2978-2987, August 2013. [22] I. Hassanzadeh, H. Ghadiri, and R. Dalayimilan, "Design and implemention of a simple fuzzy algorithm for obstacle avoidance navigation of a mobile robot in dynamic environment", In Proceedings of the 5th International Symposium on Mechatronics and Its Applications (ISMA), 2008, pp. 1-6. [23] S. Wang, "Windowed least square algorithm based PMSM parameters estimation", Math. Probl. Eng., vol. 2013, Article ID 131268, September 2013. [24] Q. Xu et al., "Multiobjective optimization of PID controller of PMSM", J. Contr. Sci. Eng., vol. 2014, Article ID 471609, August 2014. [25] S. Wang, "ADRC and feedforward hybrid control system of PMSM", Math. Probl. Eng.,, vol. 2013, Article ID 180179, December 2013. [26] H. H. Choi et al., "Precise PI speed control of permanent magnet synchronous motor with a simple learning feedforward compensation". Electr. Eng., vol. 99, no. 1, pp. 133-139, March 2017. [27] M. Ahmadi and H. Khodadadi, "Self-tuning PD2-PID Controller Design by Using Fuzzy Logic for Ball and Beam System", in Fundamental Research in Electrical Engineering, Springer, 2019 pp. 217-225. [28] A. Dehghani and H. Khodadadi, "Designing a neuro-fuzzy PID controller based on smith predictor for heating system", In Proceedings of the 17th International Conference on Control, Automation and Systems (ICCAS). 2017, pp. 15-20. [29] H. Ghadiri and M. R. Jahed-Motlagh, "LMI-based criterion for the robust guaranteed cost control of uncertain switched neutral systems with time-varying mixed delays and nonlinear perturbations by dynamic output feedback", Complexity, vol. 21, no. S2, pp. 555-578, November 2016. [30] H. Ghadiri, M. R. Jahed-Motlagh and M. Barkhordari Yazdi, "Robust stabilization for uncertain switched neutral systems with interval time-varying mixed delays", Nonlinear Anal.-Hybri., vol. 13, pp. 2-21, August 2014. [31] H. Ghadiri, M. R. Jahed-Motlagh and M. B. Yazdi, "Robust output observer-based guaranteed cost control of a class of uncertain switched neutral systems with interval time-varying mixed delays", Int. J. Control, Autom. Syst., vol. 12, no. 6, pp.1167-1179, October 2014. [32] H. Khodadadi and H. Ghadiri, "Fuzzy Logic Self-Tuning PID Controller Design for Ball Mill Grinding Circuits Using an Improved Disturbance Observer", Mining, Metallurgy & Exploration, vol. 36, no. 6, pp. 1075-1090, July 2019. [33] H. Khodadadi and A. Dehghani, "Fuzzy logic self-tuning PID controller design based on smith predictor for heating system", In Proceedings of the 16th International Conference on Control, Automation and Systems (ICCAS), 2016, pp. 161-166. [34] Y.-S. Kung, C.-C. Huang and M.-H. Tsai, "FPGA realization of an adaptive fuzzy controller for PMLSM drive", IEEE Trans. Ind. Electron., vol. 56, no. 8, pp. 2923-2932, August 2009. [35] A. Abdollahi, A. Foruzan Tabar and H. Khodadadi, "Optimal controller design for quadrotor by genetic algorithm with the aim of optimizing the response and control input signals", Cumhuriyet Üniversitesi Fen- Edebiyat FakΓΌltesi Fen Bilimleri Dergisi, vol. 36, no. 3, pp. 135-147, May 2015. [36] H. B. Novin and H. Ghadiri, "Particle swarm optimization base explicit model predictive controller for limiting shaft torque", In Proceedings of the 5th Iranian Joint Congress on Fuzzy and Intelligent Systems (CFIS), 2017, pp. 35-40. [37] M. Mohammadhosseini and H. Ghadiri, "A Combination of Genetic Algorithm and Particle Swarm Optimization for Power Systems Planning Subject to Energy Storage", J. Comp. Robot., vol. 12, no. 1, pp. 65-76, November 2019. [38] H. H. Choi, H. M. Yun and Y. Kim, "Implementation of Evolutionary Fuzzy PID Speed Controller for PM Synchronous Motor", IEEE Trans. Indust. Inform., vol. 11, no. 2, pp. 540-547, April 2015.