Comparison of Trapezoidal and Sinusoidal PWM Techniques for Speed and Position Control of PMSM

In this article, speed and position controls of Permanent Magnet Synchronous Motor (PMSM) are performed by using a genetic algorithm-based controller. Hall Effect sensors have been used to obtain position data of the motor. Since Hall Effect sensors have been mounted, PMSM has been driven as a Brushless DC (BLDC) motor. Sinusoidal and trapezoidal current reference models have been used in the control system. The proposed control system has been operated for speed control as well as position control of the motor. The developed genetic-based speed and position control method has been tested for both trapezoidal and sinusoidal PWM commutation techniques. The results obtained from these commutation techniques have been compared. Speed and position results of the motor have been obtained under the different load and operating conditions. The results reveal that the proposed control system is reliable, robust and effective.


Introduction
Recently, Permanent Magnet Synchronous Motors (PMSMs) are used in servo systems due to their superiorities, such as high efficiency, power factor, high torque/weight ratio, and high torque/inertia ratio. Therefore, PMSM becomes the first research subject for many industrial variable speed applications that require speed and position control [1] and [2].
However, the performances of the PMSMs are very sensitive to parameter and load variations. To overcome these problems, several modern control strategies, such as PI (Proportional-Integral) or PID (Proportional-Integral-Derivative) control, Fuzzy Logic Control, Neural Network and Genetic Algorithm Control methods are proposed for speed control [3].
In PMSMs, it is crucial to determine the rotor position and to perform commutation exactly at the accurate time. Hall Effect sensors and encoders are used to receive the information of position and speed through the rotor. Position and speed data can be received without using sensors; nevertheless, the microprocessor must have both high memory capacity and rapid process time.

Related Works
Several works have reported speed and position control of the PMSM with different driving and control techniques. C. Wu controlled the speed and position of a BLDC with a Hall Effect sensor through a PI Controller by using trapezoidal commutation technique [4]. A. Simpkins used analogous Hall Effect sensors in order to be able to perform positional estimation in BLDC pancake motor, a quite small type of motor [5]. J. Park proposed the speed test system of the motor by applying current reference with PI-based drive system. In addition, a stepwise position reference was applied to the system and the position control was performed through Hall Effect sensors. Park corrected the position-error arising from paramet-rical errors, impairments of current on commutation points and the waveform of back Electromotive Force (EMF) by using a separate PI Controller with the different current references [6]. S. Dehghan, unlike traditional approaches to speed control of PMSM, carried out offline tuning method and reference speed followed the actual speed smoothly [7]. K. Thangarajan realized the speed control of PMSM with Model Predictive Control (MPC) investigator. In addition, position and torque control was carried out using recommended investigators [8]. S. Sakunthala described the performance and comparisons of BLDC motor and PMSM drives [9]. H. Li developed a new type of sensorless drive with self-correction of commutation points for high-speed control of BLDC motor with nonideal back EMF form [10]. S. Murali proposed a new control scheme for the BLDC motor based on tuning of sliding mode surface parameters, and a search algorithm is used to set the parameters of the sliding mode controller. In this way, speed comparison is realized with PI and PID controls [11]. I. Vesely designed model reference adaptive current controller for PMSM and used d-q axis current equations in the rotating reference frame [12].
In this article, speed and position control of PMSM has been performed by using Hall Effect sensor. A conventional PI Controller has been used for the speed control, while P Controller has been used for the position control. The coefficients of PI and P Controllers have been achieved online through a genetic search algorithm. In this way, optimum coefficients are determined so that the actual speed and position can get rapidly through the reference speed and position without exceeding. In the article, current reference has been firstly applied to the motor in the sinusoidal waveform and then in the trapezoidal waveform. Speed results and position results of the motor have been obtained for each reference and then, these results have been compared under the different load conditions. Current control is carried out with the hysteresis band current controller. The d-q reference frame transformation is not required because the proposed controller has a fast response and no static error. An encoder is generally used to get speed and position data from a PMSM. However, there is no possibility of utilizing an encoder, and cost-effective Hall Effect sensors are also used. When Hall Effect sensors are used, a PMSM needs to be driven as a BLDC. Variations in the speed and position of PMSM using Hall Effect sensors have been shown in the article. The proposed genetic algorithm-based speed and position control of PMSM has been tested for different load and operating conditions. Obtained results show that the control method is precise, effective, available, and applicable for the control of PMSM.

PMSM Dynamics
The equivalent circuit of PMSM motor and a PWM inverter are shown in Fig. 1. The stator voltage equations of PMSM are expressed in Eq. (1).
where v a , v b , and v c are the phase voltages, i a , i b , and i c are the phase currents, R s is the PMSM's stator resistance, e a , e b , e c are the EMFs of phase windings. In Eq. (1), the expression of L ss − M is equal to the PMSM's inductance L s presented by Eq. (2).
In Eq. (2), L ms is self-inductance, L ss is the total phase inductance, including leakage L 1 , and M is the mutual inductance. Equation (1) EMFs generated by field flux connections of the permanent magnet are calculated using the following Eq. (4).
where θ r is the rotor position and the generated electrical torque is defined as: Finally, the rotor position and rotor speed can be written as:

P and PI Controller
The speed loop is a dynamic model of motor and includes reference speed, speed feedback, and speed controller. In speed loop, measured or estimated motor speed is approximated to reference speed by using actual speed controller [13].
Artificial intelligent control techniques like fuzzy logic, artificial neural networks or genetic algorithms are used as speed controllers of the motor, besides adaptive control techniques, such as sliding mode control and variable structure control [14].
The block diagram on the time scale of PI controller is demonstrated in Fig. 2. Here, e t expresses the error signal, K p and K i modulation and integral gain, and y t the output signal. Equation (8)

Hysteresis Band Current Controller
All sources fed by 3-phase voltage source inverters generally use current feedback. Therefore, the performance of the inverter depends largely on the current control technique used in [15], [16], [17], and [18], respectively. The task of the hysteresis band current controller is to ensure that the actual current of the motor follows the reference current generated within a predetermined band. Hysteresis band's current controller is easy to implement and provides effective current control against changes in load and source parameters presented in [19], [20], [21], and [22], respectively.
Hysteresis current controllers switch the power switches in the inverter with the appropriate sequence to keep the error signal obtained by comparing the current measured from the motor windings with the reference current in a given range. The structure of the hysteresis current controller is given in Fig. 3. Here i * a is the reference current of phase a, i a is measured actual current of phase, ∆i a is hysteresis bandwidth, and S a is switching signal.
The value of the switching frequency in hysteresis current controllers depends on the bandwidth. Reducing the hysteresis bandwidth ensures that the actual current is closer to the reference current, but should not exceed the switching frequency of the power switches used in the inverter circuit [23].   Furthermore, the switching frequency varies depending on the size and frequency of the reference signal. Besides the advantages of being simple in structure and high accuracy, it has disadvantages like switching frequency is variable, and switching losses are high. When examining Fig. 3, the actual current value is subtracted from the reference current for any phase current. Switch S a is switched-on if the obtained value is greater than or equal to the positive value of the hysteresis band value. Switch S a is switched-on if the obtained value is less than or equal to the negative value of the hysteresis band value [24].

PMSM Drive System
The configuration of the PMSM drive and control system used for the simulations is shown in Fig. 4. The model has not required any transformation such as Park and Clark reference frame transformation because it is able to estimate nominal operating conditions easily.
The actual speed value of the motor, ω r , is calculated through the use of the signals from the position sensor. Speed error e ω is calculated, which is the difference between the desired speed value ω * r and the actual speed value. In the study, PI Controller is used as a speed controller and P Controller as a position controller. The optimum coefficients of K p , K i in PI and P Controllers were produced by the genetic search algorithm. Three-phase reference currents are obtained by using electrical position information with control signals passed through the controllers. The resulting reference currents are used in the hysteresis band current controller. PWM signals are generated by comparing the actual current values obtained from the current sensor with the reference positions [25].

Structure of Genetic Search Algorithm
In the genetic algorithm search steps, each variable/data structure used as a solution candidate is called a chromosome (individual). All of these chromosomes are called the population, and the chromosomes in the population at each stage in the program cycle are defined as a generation. In addition, according to the data structure chosen to be used as a chromosome at the beginning of the program, each chromosome consists of genes that represent bits of the data structure if it is an integer, and elements of the sequence if it is a sequence. According to the "strong is survived" rule, the fitness calculated for each chromosome is chosen according to the degree of eligibility of the chromosome in each step in order to survive other operations that need to be determined.
Each conventional controller coefficient represents a gene. In classical genetic algorithms, the binary coding technique is used. In the present study, integer decimal numbers were preferred to reduce the genetic algorithm processing time.
When determining the population, the number of chromosomes and the selection of initial value are important. If the population is large, it takes a long time for the genetic algorithm to reach the desired solution. Conversely, if the population is selected too small, the diversity of chromosomes within the population will decrease, and population remains at local minimum. Therefore, it is very important to select as large a population as possible, taking into account the algorithm cycle time. In this article, a population of 100 chromosomes is determined according to the trial and error method. The fitness function used in the study is defined as follows [25]: The fitness function is the basic parameter that indicates which chromosome will be present in the next generation. The higher suitability value of a chromosome is so important. The PMSM drive system is run for each chromosome sequence. Fitness values are available for all chromosomes in the population. The genetic algorithm is terminated if the previously determined conformity value is captured. The chromosome with the highest fitness value is stored so that the most appropriate activity functions are obtained. In order to produce the next generation, families are determined among the chromosomes in the population based on their fitness values. In this study, Rank-based and elitism methods, which are a special method used in the selection of families, were applied [25], [26], [27], and [28].
First of all, chromosomes in the population were ranked from the highest to the lowest according to their value. The chromosomes with the highest eligibility value were both selected as a family and directly involved in the next generation. Thus, the best performance is maintained until the chromosome algorithm is completed. In addition, the crossing process was carried out at several points to form the chromosomes required for the next generation [25].
The chromosomes crossed were randomly selected and the optimum value of 0.75 was used as the probability value. The crossing points were again determined by random selection.
The mutation was applied to increase the diversity of the chromosomes obtained at the end of the crossing and the probability of each chromosome mutation was selected as the optimum value of 0.25.
The following parameters are used in the genetic algorithm. Rank-based and elitism methods were used and 100 chromosomes were determined according to the trial and error method. The chromosomes crossed were randomly selected and a probability value of 0.75 was used. The probability of each chromosome mutation was selected as the optimum value of 0.25.

Results
Tests for different speed and position references were performed using the PMSM drive system and controller described in Sec. 3. and Sec. 4. . The actual parameters of the PMSM used in the simulations are given in Tab. 1. Using the proposed PMSM drive and control system described in Sec.
3. , simulations were performed for both speed and position references with sinusoidal reference and trapezoidal reference currents. The performance of the controller is determined by the actual speed and position of the motor precisely follows the reference commands. For this purpose, the reference current was taken as a sinus wave by sinusoidal commutation technique; at 500 rpm, 1500 rpm, and 3000 rpm. The actual speed changes were investigated according to the reference speed. Then the reference current was taken as a trapezoidal wave by trapezoidal commutation technique; the actual speed follows the reference speed of 500 rpm, 1500 rpm, and 3000 rpm.
The reference current was taken as sinus by the sinusoidal commutation technique and it was investigated how much the actual position changes according to the reference position in 2π, π and π 2 radians. Then the reference current was taken as trapezoidal by trapezoidal commutation technique and it was investigated how much the actual position changes according to the reference position in 2π, π, and π 2 radians. For each value, the variations of the speed and positions under the different load conditions were also examined. Figure 5 shows the sinusoidal reference current applied to the system. The reference current is limited to 10 A in order to avoid high current at initial stage. Sinusoidal reference current shape for 500 rpm reference speed can be seen in the figure.  Figure 6 shows the trapezoidal reference current applied to the system. The reference current is limited to 10 A in order to avoid high current at initial state. Trapezoidal reference current shape for 500 rpm reference speed is shown in the figure. In Fig. 7, Fig. 8 and Fig. 9, the results obtained in both sinusoidal reference current and trapezoidal reference current are given for the reference speed of 500 rpm, 1500 rpm, and 3000 rpm, respectively.
The tests were carried out under no-load condition. The coefficients of PI Controller system were determined by Genetic Search Algorithm. K p = 99.945 and K i = 3.0776 coefficients were obtained from the genetic algorithm. As can be seen from the figures, the speed in the sinusoidal reference current is much faster and ideal for climbing and reaching stability than the actual speed in the trapezoidal reference. In Fig. 10, Fig. 11 and Fig. 12, the results obtained in both sinusoidal reference current and trapezoidal reference current are given for the reference speed of 500 rpm, 1500 rpm, and 3000 rpm. Tests were carried out at 3 Nm. The coefficients of the PI Controller system were determined by genetic search algorithm. Since only the fitness function of the genetic search algorithm is determined as in Eq. (10), the value of the load torque increases and some overshoot occurs at PMSM speeds. As can be seen, the actual speed in the sinusoidal reference current can rise, and reaching stability is much faster and ideal than the trapezoidal reference current.      Fig. 15 show the results for both the sinusoidal reference current and the trapezoidal reference current for the reference position, which is 2π, π and π 2 radians. The tests were carried out under a no-load condition. The coefficient of P control system is determined by Genetic Search Algorithm. K p = 72.36 coefficient was obtained from the genetic algorithm. As seen, the actual position tracking and stability in the sinusoidal reference current are much faster and ideal than the actual position tracking and stability in the trapezoidal reference current.     Fig. 17 and Fig. 18 show the results for both the sinusoidal reference current and the trape-zoidal reference current for the reference position, which is 2π, π and π 2 radians, respectively. Tests were performed at 3 Nm load torque. The coefficients of the PI Controller system were determined by Genetic Search Algorithm. Since only the Genetic Search Algorithm is determined as in the fitness function defined in Eq. (10), as the load torque increases, some overshoots occur at actual speeds. As seen from the figures, the rising and stability of the actual velocity in the sinusoidal reference current are much faster and ideal than the trapezoidal reference current.

Conclusion
In this article, speed and position control of the PMSM was performed using a genetic algorithm-based controller. In order to get position information of PMSM, Hall Effect sensors are preferred owing to cost-effective than the encoder. When using a Hall Effect sensor, PMSM should be driven like BLDC. In this case, the reference speed and position tracking of the motor will be slower than the sinusoidal state as described above. The genetic algorithm-based model has been applied both for speed and position control of the motor successfully. Sinusoidal and trapezoidal reference current models were applied to the system and simulation studies of the control system were carried out at different speeds and positions. As seen from the results, when sinusoidal reference current is applied to the PMSM, where the back EMF shape is sinusoidal, the reference speed and position applied to the motor are observed to be much faster and more stable than the trapezoidal reference current.