Investigation of performance of fuzzy logic controllers optimized with the hybrid genetic-gravitational search algorithm for PMSM speed control

Fuzzy logic controllers (FLCs) are widely used to control complex systems with model uncertainty, such as alternating current motors. The design process of the FLC is generally based on the designer’s adjustments on the controller until the desired performance is achieved. However, doing the controller design in this way makes the design process quite difficult and time-consuming, so it is often impossible to make a suitable and successful design. In this study, the output membership functions of the FLC are optimized with heuristic algorithms to reach the best speed control performance of the permanent magnet synchronous motor (PMSM). This paper proposes a new hybrid algorithm called H-GA-GSA, created by combining the advantages of the Genetic Algorithm (GA) and Gravitational Search Algorithm (GSA) to optimize FLC. The paper presents a convenient adjustment and design method for optimizing FLC with heuristic algorithms considered. To evaluate the effectiveness of H-GA-GSA, the proposed hybrid algorithm has been compared with GA and GSA in terms of convergence rate, PMSM speed control performance and electromagnetic torque variations. Optimization performance and results obtained from simulation studies verify that the proposed hybrid H-GA-GSA outperforms GA and GSA.


Introduction
Permanent magnet synchronous motors (PMSMs) are widely used in household and industrial applications due to their high power and torque densities, high efficiency, and low dimensions as they can operate in a wide speed range [1]. PMSM can be modelled using different mathematical models. Modelling operations are mostly done with fixed circuit parameters. However, besides the non-linear and non-modelable machine dynamics in the motor structure [2], the winding resistances of the motors vary depending on the temperature and the winding inductances depend on magnetic saturation [3][4][5][6][7]. These problems that cause model uncertainty make it difficult to control permanent magnet synchronous motors with traditional control methods.
Fuzzy logic controllers (FLCs) are widely used especially controlling systems with model uncertainty [8]. This control method, developed based on the dynamic behaviour of the system, is not affected by the uncertainties and non-linear dynamics in the mathematical model of the system to be controlled [8][9][10]. Therefore, FLCs have become a better alternative to traditional control methods. FLCs have many design parameters that need to be adjusted accurately and carefully. In determining these parameters, the traditional trial-and-error method is mostly used by using the knowledge, intuition and experience of the experts. However, FLC parameters are explicitly determined for the system under consideration and cannot be applied to another system. These disadvantages encountered in the design process make the optimal controller design troublesome and time-consuming. Heuristic optimization algorithms are widely preferred to overcome the specified problems. Because heuristic optimization algorithms can provide solutions very close to the optimum solution at a reasonable time in any situation. These algorithms have been used by many researchers in optimizing fuzzy logic membership functions, rule table and scaling factors, reducing rule base size, and optimal controller design. Genetic algorithm (GA) [11][12][13][14][15][16], gravitational search algorithm (GSA) [17][18][19][20], particle swarm optimization (PSO) [21][22][23][24], ant colony algorithm (ACO) [25] and bee colony algorithm (BCO) [26] are some of the popular heuristic algorithms used in FLC optimization.
Although heuristic algorithms give successful results in the solution of optimization problems thanks to their superior features, they have undesirable shortcomings. For instance, GA has a strong global search feature and prevents the problem from falling into local optimum using crossover and mutation operators, but it has a low convergence rate compared to the other algorithms like PSO [27][28][29]. GSA has a rapid convergence at the beginning of the search process and the ability to find the nearest best result, whereas it has some drawbacks such as easily falling into the local optimum and losing the ability of exploration at the end of the search process [30][31][32]. PSO is easy to implement, but it can suffer premature convergence while solving complex problems [33,34]. Overall, when the above-mentioned heuristic algorithms are evaluated, each algorithm has advantageous and disadvantageous features in solving optimization problems. In different studies, to improve optimization performance, many researchers have applied hybrid approaches of heuristic algorithms by combining them with each other. Hybrid structures of GA and PSO [35][36][37][38][39], PSO and GSA [40][41][42][43][44] and GA and GSA [45][46][47][48][49] have been utilized in various applications. Similarly, there are many hybrid structures formed by combining different heuristic algorithms to solve optimization problems. Summary information of these hybrid structures utilized in the optimization problems is presented in Table 1.
In this study, a hybrid heuristic algorithm called H-GA-GSA created by combining the advantages of GA and GSA is proposed to optimize the FLC used in the speed control of the PMSM. Thus, the optimal positioning and tuning of the output membership functions of FLC have been provided for the best speed control performance of PMSM. To verify the proposed controller superiority, the performances of controllers optimized with GA, GSA and H-GA-GSA heuristic algorithms have been analyzed and compared with each other.
The rest of this paper is organized as follows. Mathematical modelling of the PMSM is presented in Section 2. The proposed H-GA-GSA algorithm and a brief review of the GA and GSA algorithms, design and optimization processes of FLC are described in Section 3. Simulation studies and performance analyses are provided in Section 4. Finally, conclusions are presented in Section 5.

Mathematical modelling of PMSM
There are three different mathematical models for modelling PMSM: three-phase a-b-c reference model, twophase d-q rotor reference model and two-phase fixed plane α-β reference model. The complexity of the motor's dynamic equations can be reduced by converting the three-phase reference model structure into two-phase reference models with appropriate transformations [1,50]. The two-phase d-q rotor reference model is similar in structure to the external excited direct current motor model, and the control of the motor is facilitated when this model is used. Thus, in Table 1. Hybrid approaches in optimization problems.

Application
Description Findings In Hybrid GA and PSO Optimization of mathematical benchmark functions with GA and PSO-based hybrid algorithm.
The proposed hybrid approach provides better performance in terms of different comparison criteria. [35] Automatically designing FLCs to minimize the steady-state error of a plant's response.
The proposed GA and PSO-based algorithm provides lower steady-state error and better stability. [36] A study on solving constrained optimization problems with the hybrid GA and PSO technique.
The obtained results show that the hybrid algorithm is effective and efficient for locating the global solution. [37] A study on minimizing the molecular potential energy functions with the hybrid algorithm.
The proposed hybrid algorithm provides faster convergence without trapping in local minimum. [38] A study on mining quantitative and categorical association rules.
Performance improvements have been achieved compared with the basic algorithms in terms of different criteria. [39] Hybrid PSO and GSA Parameter identification of hydraulic turbine governing system with the hybrid algorithm.
PSO-based improved algorithm provides high accuracy results, stability and performance improvement for the GSA. [40] Optimization of static state estimation problem with the proposed hybrid algorithm.
The proposed hybrid technique provides successful results in terms of optimization performance compared to other related techniques. [41] Solving binary problems with the PSO and GSA-based hybrid algorithm.
The proposed algorithm provides better performance than the original versions of other algorithms in terms of avoiding local minimum and exploration. [42] Optimizing process parameters of a bidirectional carbon fibre epoxy composite.
Provides superior performance to the other techniques in terms of computational time and the number of iterations to arrive at the end results. [43] Optimization of energy efficiency in spectrum sensing for a cognitive radio network.
The hybrid PSO and GSA-based algorithm provides performance improvement for PSO in terms of convergence. [44] Hybrid GA and GSA Tuning the damping controller parameters of unified power flow controller with the GA and GSA-based hybrid algorithm.
The proposed algorithm increases the convergence efficiency and provides faster solution in terms of computational time for obtaining the optimum values. [45] Optimization of complex benchmark test functions with the proposed hybrid algorithm.
The hybrid GA and GSA-based algorithm improves the exploration and exploitation ability of GSA. [46] A study on image segmentation for multi-level thresholding with the developed hybrid algorithm.
The developed GSA and GA-based algorithm reduces the computational complexity and also improves the search accuracy and speed of GSA. [47] A study on solving constrained optimization problems with the GA and GSA-based hybrid algorithm.
The obtained results show that the proposed algorithm provides more feasible and more optimal results than the existing ones present in the literature. [48] A study on scheduling the load in the cloud computing environment with the hybrid GA and GSA-based algorithm.
The proposed hybrid algorithm improves the performance of GSA and reduces the total cost of computation considerably compared to the other algorithms.
[49] this study, the d-q rotor reference model of PMSM is preferred. Two-phase d-q rotor reference equivalent circuit of PMSM is seen in Figure 1 [51].
In Figure 1, R s is the synchronous resistance, L d and L q are the d-q axis synchronous inductances, V d and V q are the d-q axis components of the stator voltage, i d and i q are the d-q axis components of the stator current, m is the magnetic flux of the permanent magnet, ω r is the angular velocity of the rotor. Voltage equations for the d-q axis components in an equivalent circuit can be expressed as follows [1,52].
where d and q represent the equivalent magnetic flux linkages of the d-q reference axis are expressed as follows.
when Equations (1)-(4) are used and organized together, d-q axis voltage equations are obtained.
The electromagnetic torque of the motor can be expressed as shown in Equation (7).
Electromagnetic torque of the motor depends on d-q axis current components i d and i q , equivalent magnetic flux m and total pole pairs number of the motor. The dynamic equation of the motor can be expressed as follows: where T L is the electromagnetic torque of the load, B is the static friction and J is the inertia. When Equations (1)- (8) are organized together, state-space equations of the motor will be obtained as follows [1,52].
If a speed controller is designed employing the model presented above, some assumptions must be made to get the controller [52]. Those assumptions reduce the performance of the controller. As shown in [8][9][10], fuzzy logic-based controllers have an acceptable performance to overcome uncertainties because they are not model-based controllers.

Optimization studies
In this section, first, a brief description of the operation structures of GA and GSA algorithms is summarized. Then, a hybrid GA-GSA algorithm that combines the features of GA and GSA algorithms is proposed. Finally, the FLC optimization process is described.

Genetic algorithm
GA is a population-based optimization method developed based on the theory of evolution and natural selection mechanism [53,54]. According to the theory of evolution, the genetic structure of a living population changes over time through random mutations. Individuals, who better adapt to environmental conditions, will have a higher chance of survival and reproduction. Individuals, who cannot adapt to environmental conditions, will have less chance of survival and thus will not pass on their heritable traits to the next generations. The genetic algorithm optimization process consists mainly of steps [55].
Step i. The initial population is generated. The initial population can be generated randomly or using possible solutions to the problem.
Step ii. The fitness values of the all individuals are calculated.
Step iii. Selection, crossover and mutation genetic operators are applied, respectively. Genetic operators expand the solution space by enabling individuals who provide better solutions.
Step iv.
Step ii and iii is repeated until the stopping criterion is satisfied.

Gravitational search algorithm
Gravitational search algorithm (GSA) is a novel population-based heuristic optimization algorithm developed based on Newton's law of gravity and motion [56]. This law states that all objects in the universe attract every other object with a force of gravitational attraction that is directly proportional to the product of masses and inversely proportional to the square of the distance that separates their centres. Inspired by this law, GSA starts with the first population consisting of masses called agents, representing a potential solution of the optimization problem. Each agent in the population will have a bigger mass in direct proportion to its closeness to the best solution. Bigger and heavier masses that correspond to good solutions will move more slowly than smaller and lighter masses that correspond to bad solutions. Agents with bigger masses will attract the agents with smaller masses towards themselves. The GSA algorithm process consists mainly of the following steps [56,57].
Step i. The initial population is generated by a randomly generated (Nxm) size set of agents.
Here N is the number of agents, m is the problem size and X i d represents the position of i-th agent in the d-th dimension.
Step ii. Fitness values of all agents in the population are calculated.
Step iii. The best and worst agent in the population is determined.
For a minimization problem, best(t) and worst(t) solution values are calculated as above. If the problem under consideration is a maximization problem, the best and worst solution values are replaced.
Step iv. The coefficient G (gravitational constant) is updated.
Here, G 0 indicates the initial value, α is the constant coefficient, t is the current number of iterations and T is the maximum number of iterations.
Step v. The masses of the agents are calculated.
where, m i (t) represents the relative mass, M i (t) represents the mass and fitness i (t) represents the fitness value of the agent i at time t.
Step vi. The forces of the agents are calculated.
In Equations (18) is the force acting on mass "i" from mass "j" at time t, G(t) is the gravitational constant at time t, M pi is the passive gravitational mass of i, M aj is the active gravitational mass of j, R ij is the Euclidean distance between the mass "i" and mass "j", is a small constant, r 1 is a random number in the interval [0, 1] and F i d (t) represents the force of i-th agent in the d-th dimension.
Step vii. Assuming the equality of the active, passive and inertial mass of i-th agent in Equation (21), the acceleration, speed and position of the agents are updated by the following equations.
The acceleration value of the agent, calculated from Equation (22), is added to the current speed of the agent, and its new speed is obtained, as shown in Equation (23). The new speed of the agent varies depending on the previous speed and acceleration.
Where r 2 is a random number in the interval [0, 1]. The agent's position in the next population is determined according to Equation (24) using its current position and current speed.
Step viii. Steps ii, iii, iv, v, vi and vii are repeated until the stopping criterion is satisfied.

Proposed hybrid H-GA-GSA algorithm
The search speed of the GSA decreases exponentially due to the gravitational constant in the last stage of the searching process. Therefore, the convergence speed of the GSA decreases which often causes the optimization problem to get stuck in the local optimum or optimization process becomes inactive. In addition, the GSA is memory-less, and only the current position of the agents is used in the speed updating process. In contrast, GA can prevent the problem from falling into local optimum using its crossover and mutation operators; nevertheless, it can suffer from premature convergence, and so it can take more time to reach the optimal solution. In this study, it is proposed a new hybrid algorithm,H-GA-GSA, by combining the global exploration feature of GA and rapid convergence feature of the GSA to overcome above-mentioned drawbacks of GA and GSA. In the proposed hybrid algorithm, the speed updating procedure introduced in the improved gravitational search algorithm [40] (IGSA) is used. IGSA is a hybrid algorithm that combines the searching strategy of PSO with GSA [40]. During the speed update process in the PSO algorithm, which is similar to a kind of in-swarm memory and interaction, particles in the swarm update their positions based on those particles, following the previous best particle (best particle in the current swarm) and the best-so-far particle (the best particle in the swarms ever achieved). In the proposed hybrid algorithm, the speed update equation used instead of Equation (23) is given below.
where V i d represents the speed of the i-th agent in the dth dimension. r 2 , r 3 and r 4 are random numbers in the interval [0, 1]. c 1 is the social acceleration rate and c 2 is the cognitive acceleration rate. P best is the position of the best agent in the current population, and G best is the position of the best agent obtained among all populations. The proposed hybrid algorithm provides a more effective and efficient optimization by combining the advantages of GA and GSA. The proposed H-GA-GSA algorithm process consists of the following steps.
Step i. An initial population of randomly generated N agents/individuals is created.
Step ii. The fitness values of all agents/individuals in the population are calculated. (GA and GSA algorithms) Step iii. The three best and worst agents/individuals in the population are identified. (GA and GSA algorithms) Step iv. A total of (N/2) agents, consisting of the three best agents and the rest (N-6)/2 agents selected randomly and without repetition, are used for GSA.
Step v. A total of (N/2) agents, consisting of the three best individuals and the rest (N-6)/2 individuals selected randomly and without repetition , are used for GA.
Step vi. Procedures of GA and GSA algorithms are executed.
(a) a. Crossover and mutation operators are applied for GA. (b) b. For GSA, calculating the gravitational coefficient G, calculating the mass of the agents, calculating the force of the agents, updating the acceleration, updating the velocity using Equation (25) and updating positions of the agents.
Step vii. The population consisting of (N/2) individuals is updated with GA, and the population consisting of (N/2) agents is updated with GSA. The updated populations are then combined, and a new population consisting of N agents/individuals is obtained.
Step viii. Steps ii, iii, iv, v, vi and vii are repeated until the stop criterion is satisfied.
The flow chart for the proposed H-GA-GSA algorithm is presented in Figure 2.

Fuzzy logic controller optimization process
The concept and theory of fuzzy logic modelling was introduced by Zadeh (58) [58]. FLCs are made up of three interconnected sections: fuzzification, rule-based inference mechanism and defuzzification [59]. In the fuzzification section, the membership degrees of the membership functions corresponding to the input variables are determined and converted into verbal expressions. In the rule-based inference mechanism section, the fuzzy conclusions are reached by evaluating the degrees of membership according to the rules of verbal supervision, as in the process of human decisionmaking. Here, fuzzy output expressions are obtained using fuzzy relation operators. In the defuzzification section, the sum of fuzzy expressions from the rulebased inference mechanism is converted into a crisp output value that can be applied to the system to be controlled.
In the optimization studies carried out, speed error and change in speed error are used as input variables. Here, seven different verbal entries are used for membership functions: Negative Big (NB), Negative Medium (NM), Negative Small (NS), Zero (ZE), Positive Small (PS), Positive Medium (PM) and Positive Big (PB). The rules created based on the input variables for the rule base are presented in Figure 3. In the study, while rules and output membership functions are defined, breaking and bidirectional rotation are not considered because the primary purpose of the study is to verify the effectiveness of the proposed hybrid algorithm. Membership functions used for input variables are shown in Figure 4. The Mamdani fuzzy inference method [59] is used in the rule-based inference mechanism of the controller, and the weighted average method [59] is used in the defuzzification unit. All design units and sub-units (fuzzification, rule-base, inference mechanism and defuzzification) were designed and implemented using fully userdefined software in MATLAB/Simulink environment. The same operating structure was used for all designed and optimized FLCs.
In optimization studies, FLC output membership functions are optimized with GA, GSA and proposed H-GA-GSA heuristic algorithms. The optimized output membership functions are expressed with individuals in the population for GA and with agents in the population for GSA. Here individuals and agents represent the centres of gravity of the output membership functions to be optimized. Integral absolute error (IAE) and integral time-weighted absolute error (ITAE) performance indices were used for fitness functions in optimization studies. The mathematical equations for these performance indices are given below.
Optimization studies minimized the fitness functions, IAE and ITAE error performance indices. The areas and change intervals of the membership functions have been updated automatically throughout the iterations. The maximum number of iterations has been used as the stopping criterion for optimization processes. The basic structure of the optimization scheme is shown in  In the optimization studies, the speed error (e) and change in speed error ( e) values obtained by comparing the motor speed information with the input reference speed information were used as input variables for the FLC. These variables are multiplied by the scaling factors s 1 and s 2 , respectively. The output of the FLC is multiplied by the scaling factor s 3 to obtain the actual output value that will be applied to the system to be controlled. Scaling factors are considered s 1 = 1, s 2 = 1           Figures 6 and 7, fitness values were calculated for each individual/agent in the population in circuits created in the MATLAB/Simulink environment according to the IAE and ITAE error performance indices. The fitness values that provide the most successful results are determined, and then each heuristic algorithm is executed using the aforementioned steps of GA, GSA and H-GA-GSA. The new population obtained from the optimization process enables the creation of updated output membership functions to be used for the next iteration. The output membership functions will be optimized as specified until the stopping criterion is satisfied.

Simulation studies and performance analysis
In this section, simulation studies have been carried out with each optimized FLC applied to PMSM. Table 2 shows the parameters of PMSM and Table 3 shows  the parameters used for GA, GSA and the proposed H-GA-GSA algorithms. For a fair comparison, each optimization method use the same general parameters, such as the number of the maximum iterations, the number of population size, limits of the problem and the problem size, as indicated in Table 3. The optimized output membership functions using IAE and ITAE performance indices are shown in the graphs in Figures 8 and 9, respectively. Rule surfaces obtained depending on the input variables of optimized FLCs using IAE and ITAE performance indices are presented in Figures 10 and 11, respectively.
The convergence performances of GA, GSA and proposed H-GA-GSA algorithms for IAE and ITAE performance indices are shown in Figures 12 and  13, respectively. Here, the variations of the minimum fitness function values obtained for three different algorithms throughout the iterations are seen. Figures 12 and 13 show that GSA converges quickly at the beginning of the searching process compared to the other two algorithms. But, after running the algorithm about 10-20 times, it is seen that the GSA no longer searches, and so it loses its exploration ability. Although the GA seems to be more successful than the GSA in preventing stuck at the local optimum, the GSA outperforms the GA significantly in terms of convergence rate. The GA needs more time to converge to an optimum solution, which the GSA reaches much earlier. Figures 12 and 13 show that the proposed H-GA-GSA hybrid algorithm is very successful in overcoming the problem of getting trapped in the local optimum and is superior in terms of convergence rate to the GA and GSA. Speed control performance and electromagnetic torque variations of PMSM for variable reference speed, respectively, and constant load operating conditions are shown in Figures 14-17. PMSM is started with 50 rad/s reference speed; then the speed is reduced to 25 rad/s at 0.025 s and increased to 40 rad/s at 0.05 s; meanwhile, the load torque was kept constant at 2 Nm during the simulations.  When the torque variation and stator i di q current variation graphs in Figures 16-19 are evaluated, torque variation graphs are similar to stator i di q current variation graphs. Figures 18 and 19 demonstrate the stator i d and i q currents for optimized FLCs for IAE and ITAE performance indices. As the d-axis current i d is equal to zero, the electromagnetic torque of the PMSM directly depends on i q current. To satisfy the required electromagnetic torque during the acceleration stage of the PMSM, the i q current converges to the load torque after reaching the reference speed while initially above the load torque value.
Stator flux trajectories are presented in Figures 20  and 21, where flux trajectory waveforms rotate along the circular curve. As seen in the figures, the d-axis current i d is equal to zero. In this case, flux trajectories constituted using inverse park transformation showed that stator flux is adjusted with i q current obtained from the output of the FLC. Evaluation of the simulation results obtained by considering the speed control graphs in  Table 4. Here, rise time, settling time and torque ripple (peak to peak) values are listed for different reference speeds.
The obtained results for the three different reference speeds are given in Table 4. For the reference speed of 50 rad/s, FLC optimized with the proposed H-GA-GSA based on ITAE performance indices has provided the shortest rise time of 1.458 ms and the shortest settling time of 2.016 ms. Additionally FLC optimized with the proposed H-GA-GSA based on IAE performance indices has provided the minimum percentage of torque ripple of 14.559%. Table 4 shows that FLC optimized with the proposed H-GA-GSA provides an average of 0.032 ms better rise time, 0.078 ms better    For the last reference speed (40 rad/s), the performance indexes of the FLCs were also obtained similar to previous reference speeds. FLC optimized with the proposed H-GA-GSA has provided the shortest rise time

Conclusion
In this paper, we performed a study to optimize FLCs employed in the speed control of the PMSM using the GA, GSA and the proposed hybrid H-GA-GSA. The main purpose of this research is to develop a new hybrid algorithm that effectively combines GA and GSA to optimally locate and tune the output membership functions of the FLC to achieve the best speed control performance of PMSM.
Simulation results show that GSA has a quite fast convergence rate at the beginning of the search process, but after a certain number of the running of the algorithm, GSA stops searching due to its operating structure and optimization process losing its activity. On the other hand, that the GA could overcome the problem of getting stuck in the local optimum, but it has a very low convergence rate compared to the other two algorithms. When the proposed H-GA-GSA algorithm is involved, it effectively prevents the problem of entrapment in the local optimum, and the algorithm can continue the search process thanks to the crossover and mutation operators of the GA. Furthermore, the proposed H-GA-GSA is superior to the GA and GSA in terms of minimum fitness function values and convergence rate; thus, it provides a closer and better convergence to the optimum solution. Table 4 demonstrates the superiority of the proposed hybrid H-GA-GSA algorithm that provides better speed control performance, shorter rise and settling times and fewer electromagnetic torque ripples.
Overall, the results apparently indicate that in the optimization studies based on IAE and ITAE performance indices, the proposed hybrid H-GA-GSA algorithm outperforms the GA and GSA. The main contribution of the proposed H-GA-GSA algorithm to the study is to obtain a more effective and efficient optimization procedure by eliminating the disadvantages of GA and GSA. For future works, the proposed hybrid optimization algorithm will be designed based on different objective functions to investigate performance improvements. In addition, the study scope will be expanded to reduce the electromagnetic torque ripples of PMSM by including different membership functions and the other design parameters of the FLC in the optimization process.

Disclosure statement
No potential conflict of interest was reported by the author(s).

Ethical approval/patient consent
This article does not contain any studies with human participants or animals performed by any authors.