Low Complexity MPC-DSVPWM for Current Control of PMSM Using Neural Network Approach

Multilayer neural network-based model predictive control (MLNN-MPC) has received a lot of attention in different power electronic applications. However, the computational burden often imposes limitations in low-order DSPs especially if a large number of voltage vectors (VVs) are used. The execution time of MLNN-MPC in low-order DSPs is affected heavily by the number of input, output, neurons in the hidden layer, and the type of activation function. Furthermore, MLNN contains many parameters that needed to be optimized, such as initial weights, number of iterations, and number of neurons. Therefore, in this study, a creative single-layer neural network-based model predictive control with discrete space vector PWM (SLNN-MPC-DSVPWM) is proposed to overcome these limitations. The main advantages of the proposed method include easy implementation on low-order DSPs, better performance compared with MLNN-MPC, allowing the use of a large number of VVs, and no initialization of lookup tables for all VVs. The proposed SLNN is trained using the Levenberg-Marquardt algorithm and results in an execution time of only $8~\mu \text{s}$ compared with the complexity of the conventional MPC-DSVPWM and recent MLNN-MPC methods. The SLNN-MPC-DSVPWM is validated by both simulation and experimental results for permanent magnet synchronous motors.


I. INTRODUCTION
Permanent magnet synchronous motors (PMSMs) have recently gained popularity, particularly in variable-speed drives, owing to their high torque density and efficiency [1]. Field-oriented control (FOC) and direct torque control (DTC) are the most popular control strategies used in PMSM drives. FOC has better steady-state performance; however, it requires coordinate transformation, fine-tuning for the PI controller, and pulse with modulation (PWM) generation. In contrast, DTC has a fast dynamic response and simple The associate editor coordinating the review of this manuscript and approving it for publication was Amjad Ali.
control structure compared to the FOC, which is preferred for high dynamic applications. However, it produces variable switching frequency and large torque ripple [2], [3].
Owing to the significant development of fast microprocessors, model predictive control (MPC) has recently attracted considerable attention. This can be attributed to its ease of implementation, the inclusion of nonlinearity, multivariable control, and fast dynamics [4], [5], [6], [7], [8], [9], [10], [11]. Despite the advantages of MPC, improving its performance and calculation processing are regarded as key concerns in industrial applications. Conventional MPC has a variable switching frequency, which results in large current ripples with a wide harmonic spectrum. Large current ripples are  common when single actual voltage vector (VV) is applied per discrete sample period (T s ) [12].
Many studies have been conducted to improve the performance of conventional MPCs. One approach is to apply two or more VVs per discrete sample period by calculating the vector duty ratio [13], [14], [15]. The main difficulty of this method is the generation of suitable VVs that produce lower current, torque, and stator flux ripples. In addition, variable switching frequency and high computational burden are the main drawbacks of this approach [16]. Another method implements discrete space vector modulation (DSVM) with MPC to synthesize a wide number of virtual VVs within a T s [17], [18], [19]. The cost function determines the best VV among real, virtual, and zero VVs and is applied to the converter through SVM. A merit of using this approach is that the steady-state performance can be improved by achieving a constant switching frequency. However, the high computational burden and the need for the initialization of lookup tables for a large number of virtual VVs are the limitations of this approach, especially in low-speed/order microprocessors.
The issue of the computational burden of MPC-DSVM has been solved recently. The main solution is using a deadbeat approach [20], [21]. The concept of the deadbeat control is to use a mathematical model to derive a reference which finds the nearest VV that minimizes the cost function. In [20], the deadbeat method has been implemented for predictive torque control (PTC) that utilizes only three VVs and does not require a predefined lookup table. In [21], a robust deadbeat with an improved DSVM method is proposed. The improved DSVM selects the VVs located in a single sector and two concentric hexagonal diagrams. In addition, the proposed method uses a simple equation to generate the VVs without requiring lookup table initialization. Based on the same virtual VV generalization, another recent method uses a unidirectional VV preselection method for PTC of the PMSM [22]. The proposed method uses the stator flux sector and speed direction to reduce the flux and torque ripples. The prior studies are based on model prediction and cost function minimization, which do not change the main concept of MPC and require a longer execution time in high-order horizon lengths and multilevel power converters.
In recent years, artificial neural network (ANN) has emerged as an excellent approach to improve the control performance of MPC in power converters [23], [24]. Multilayer neural network based model predictive control (MLNN-MPC) is proposed to reduce the execution time of MPC. The main idea is to train the MLNN offline by collecting data from a conventional MPC. Once the MLNN can select the optimal VV, a simple mathematical equation of the MLNN can be used in real-time without the computational complexity of the cost function. MLNN-MPC has been implemented only for a small number of VVs and lowlevel topologies, including two-level inverters [25], [26], and modular multilevel converters [23]. Further investigation into the use of MLNN in a large number of VVs and complex multilevel converters is required. In [27], a MLNN-MPC was successfully implemented on a single-phase five-level flying capacitor converter and a three-phase three-level flying capacitor converter using an FPGA-based control system. However, the proposed method can only operate using highspeed microprocessors, such as FPGA. Such controllers can perform more than one operation concurrently and are suitable for high-speed sampling frequencies [28]. For low-speed sampling frequencies, such as the DSP control board, the MLNN proposed in previous studies required a large execution time, which limited its real-time implementation. This is due to the multiplication of two n×n matrices that performed O(n3) operations [29]. In addition, the execution time of MLNN-MPC is affected heavily by the number output which represents the number of VVs that is used, neurons the in hidden layer, and the type of activation function. If only one hidden layer is used, it results in a minimum of two matrix multiplications and two activation functions. Another drawback of the MLNN is that it contains many parameters that are needed to be optimized, such as initial weights, number of iterations, and number of neurons.
On the other hand, single-layer neural networks (SLNN) trained with Levenberg-Marquardt outperformed complex neural networks such as extreme learning machines (ELM) and MLNN in terms of predictive accuracy in a complex multivariable problem [30]. Based on the comprehensive analysis presented in the literature, MPC has not been accompanied by an ANN for motor drive appliances. Therefore, in this study, a SLNN with model predictive control with discrete space vector PWM (SLNN-MPC-DSVPWM) is proposed to overcome the computational problem of MLNN-MPC and conventional MPC-DSVPWM for a large number of VVs in a low-order DSP for PMSM motor drive applications. The SLNN is proposed to use a high computation activation function, such as sigmoid activation, in the training phase, and a low computation activation function, such as a linear activation function, in real-time DSP without degrading the performance.
Furthermore, the proposed SLNN does not require a table for VVs initiation, which is based on selecting a suitable value for each switch signal and implementing a mathematical equation to produce the required VVs using DSVPWM. Importantly, it needs to be mentioned that the proposed method is not intended to outperform the conventional MPC-DSVPWM and MLNN controllers. The main advantage of the proposed method is that its execution time is independent of the complexity and has the lowest execution time for low-order DSP. Therefore, the proposed method can be easily implemented for a large number of VVs to improve the performance of MPC while MPC-DSVPWM and MLNN suffer for high execution time.
The proposed SLNN-MPC-DSVPWM method was simulated and experimentally verified for a three-phase twolevel inverter-fed PMSM drive. The followings are the main contribution of this paper.
1) It is first implemented for motor drive appliances.
2) It is implemented easily on low-order DSPs, with an execution time of 8 µs.

II. MPC-DSVPWM FOR PMSM A. PMSM MODELING FOR MPC-DSVPWM
A PMSM fed by a two-level inverter is used to carry out all the necessary explanations in this study, as shown in Fig. 1.
The voltage equations of PMSM in the reference frame of the rotor are shown in (1), where v d , v q , I d , and I q are the voltage and current components of the direct (d) and quadrature (q) axes. R s is the stator resistance per phase, L d and L q are the d-and q-axis inductances, ω e is the electrical rotor speed, and ϕ f is the flux linkage established by the rotor. To obtain the discrete-time model based on forward Euler discretization, the derivative dI/dt can be approximated as shown in (2): where T s denotes the sampling interval. The current prediction of PMSM can be calculated using (1) and (2) as in (3) [22], where I z α(k + 1) and I z β (k + 1) are currents in the stationary reference frame. The cost function (g z ) for measuring the error between the reference and predicted currents to evaluate all the VVs generated by DSVPWM is as described in (4), DSVPWM allows v α(k) and v β(k) to be located in any position of the inverter control region. Fig. 2 shows the control region of a two-level three-phase inverter, where the real and virtual VVs are presented in round and square marks, respectively. In this figure, the VVs are equally divided into three hexagons with 37 VVs. DSVPWM is used in this study instead of DSVM due to its low complexity and better performance owing to its natural ability in generating a constant switching frequency without sophisticated dwelling time calculating for each VV. [31]. Furthermore, it is easy to implement in most of DSPs due to the availability of the ePWM-predefined function. Moreover, SVPWM can improve modulation region by 15.5% compared to sinusoidal PWM [31]. v α(k) and v β(k) are transferred into three-phase reference voltages v * A , v * B , and v * C using an inverse transformation. The injected offset voltage (v * sn ) is calculated based on the principle of DSVPWM as in (5), where v * max and v * min denote the maximum and minimum of the v * A , v * B , and v * C , respectively [31]. To simplify the calculation process for generating the three-phase reference pole voltages, the A-phase reference pole voltage (v * An ) is calculated as shown in (6). The same process can be applied to the other two phases (B and C) as well. As per the procedure, v * sn is added to v * A as expressed in (6), Notably, the normalized A-reference signal can be generated using (7) as, where V dc is the DC-link voltage. Meanwhile, v * Az is compared with a PWM triangular carrier V CA to generate the  switching signals, as shown in (8), where S a andS a are the inverter switching signals. A complete block diagram of the conventional MPC-DSVPWM is shown in Fig. 3.

III. PROPOSED SLNN-MPC-DSVPWM FOR PMSM A. THE MAIN DIFFERENCES BETWEEN MLNN AND SLNN
MLNN has a hidden layer and each hidden layer has a number of neurons that need to be optimized, whereas the SLNN has a simpler structure where no hidden layers are required. Implementing SLNN and checking the accuracy of the SLNN is one technique to evaluate whether the problem is linear or not; if the SLNN gives high accuracy, the problem is linear and can be solved using SLNN. In addition, advanced algorithms such as Levenberg-Marquardt algorithm can improve the performance of SLNN and outperform MLNN and ELM [30].  prediction model and cost function evaluation. The input and output of the MPC are collected for training the proposed SLNN using PSIM software. The input parameters are I α , I β , I α * , and I β * currents in a stationary reference frame, where the output is the optimal value of the switching signals S a , S b , and S c . Then, using MATLAB software, the data collected is split into 70% for training and 30% for testing. The training of proposed SLNN is done offline to avoid the large computation time for training process. The proposed method comprises three SLNNs, and each SLNN selects a suitable switch state for each phase. Then by calculating the v α and v β as in (9) [31], any real and virtual voltage vector can be easily generated without the need for initialization for each VV. For example, if the proposed SLNN selects S a = 1, S b = 0, and S c = 0 as optimal switching state, then by substituting the switching state in (9), the v α = 2/3V DC and v β = 0, which represent V 1 .
Then v α and v β are transferred to v A , v B , and v C using inverse transformation and are applied to the inverter through DSVPWM. The advantage of using three SLNNs is to avoid lookup table initialization for a large number of virtual VVs. In addition, this method can reduce the execution time of the SLNN-MPC-DSVPWM which does not require a large multiplication matrix of the input with all VVs. Instead, it simply multiplies the input with suitable switch states for each phase. Fig. 6 shows the process of SLNN. Data collection and splitting of training and testing is the first step in any neural network model. The second step is building the neural network model, the initial weights (W ) and biases (b) are set to VOLUME 10, 2022 zero, sigmoid function is chosen as activation function, the number of iterations is 10, and the Levenberg-Marquardt is chosen for training and updating the W and b. After the training process is finished, the optimal W and b are extracted and the linear activation function is used instead of the sigmoid activation function. Theses parameters are only used in realtime DSP to classify and choose the optimal switching state. A further discussion of the design and mathematical of the proposed SLNN is followed in the next section.

C. STRUCTURE OF SLNN
The mathematical representation of SLNN is expressed in (10), where I is the input vector of the network, H is the output vector of the output layer, W is the weight matrix of the output layer, b is the bias vector, and g is a sigmoid function, which can be expressed by (11), However, the execution time of the sigmoid function is high when applied to a low-order DSP. Therefore, the proposed method uses the sigmoid function only in the training phase Fast sigmoid and linear activation functions have lower execution times, as described in (12) and (13), respectively, Fig. 7 show the structure of the SLNN during the training and testing phases. In the training phase, the sigmoid function is used to achieve good input-output mapping. In the testing phase, optimal W and b are used with a linear activation function to obtain the lowest execution time. Advanced algorithms can improve the SLNN and outperform MLNN and ELM. The Levenberg-Marquardt algorithm is used to update the weights, as shown in (14), where J is the Jacobian matrix, e is the error function, W(t+1) is the weight update for each iteration, µ is the combination coefficient, and I is the identity matrix. The calculation numbers of SLNN are compared with those of MLNN as proposed in [27], and are shown in (15) and (16), where m is the hidden layer, and a and b are the number of calculations in the activation function.

D. TRAINING PROCESS OF SLNN
The SLNN was iteratively trained offline using MATLAB software. The input parameters are I α , I β , I * α , and I * β currents   in a stationary reference frame, where the target is the optimal value of the switching signals S a , S b , and S c . The parameter settings for SLNN contained 10 iterations. Increasing the number of iterations to a value greater than 10 did not lead to any further improvement. Therefore, 10 was selected as the optimal value. The data were split into 70% for training and 30% for testing as shown in Table 1. In addition, it is important to test the performance using a PSIM simulation with different current and speed values to ensure that the SLNN is learning and not memorizing. Furthermore, in the training process, the training set should be large (e.g., tens or hundreds of thousands or more), uniform, and cover different current and speed values. Therefore, More than one million data points were collected under different conditions. An adequate training process prevents the SLNN from overfitting and underfitting and improves the stability of the proposed method. The SLNN-MPC showed good accuracy in the overall performance for switching state a, with an accuracy of approximately 80% as shown in Fig. 8. Switching state b and c have also similar accuracy. In general, MPC-DSVPWM requires observers to compensate for parameter variations in motor-drive applications. SLNN-MPC-DSVPWM can address this issue by adding new input elements to correct the system parameters using observers [27].

IV. SIMULATION RESULTS
The effectiveness of the proposed SLNN-MPC-DSVPWM was analyzed and proved by simulation results obtained using the PSIM tool. The performance of the proposed method was compared with that of the MPC-DSVPWM. The simulation parameters are listed in Table 2. Table 3 lists the performance of each activation function in the testing phase, showing total harmonic distortion for theA-phase current, and the rise time of theI q current. For 37 VVs,Linear activation function exhibited a THD of 2.1% similar as fast sigmoid and sigmoid activation functions with THD of 2% and 2.1%, respectively. However, linear activation function has faster dynamic response of 1.17 ms compared to fast sigmoid and sigmoid activation function with dynamic response of 1.2 ms and 1.6 ms, respectively.The linear activation function provides better performance than the sigmoid and fast sigmoid activation functions in the testing phase. However, in the training phase, the sigmoid function was used to achieve good learning between the input and output of the MPC-DSVPWM. The main use of linear activation function in the testing phase is to reduce the execution time of the proposed model without affect the performance of the model which clearly proved in Table 3.
Figs. 9 and 10 show the A-phase and I q current waveforms, respectively. Fig. 9 shows I q performance during the steady-state response of the MPC-DSVPWM and the proposed SLNN-MPC-DSVPWM, respectively. The speed was 150 rpm and the I * q was 10 A. SLNN-MPC-DSVPWM VOLUME 10, 2022  exhibited better performance than MPC-DSVPWM with THD of 2.1% compared with 3.7%. A percentage of reduction in the THD of 43% for the proposed model using 37 VVs compared with conventional MPC-DSVPWM using 12 VVs For the dynamic response performance, I * q was increased from 2 A to 10 A at 150 rpm as shown in Fig. 10. Both methods demonstrated fast dynamic response for I q current waveform. MPC-DSVPWM has faster response of 0.9 ms compared to 1.17 ms for SLNN-MPC-DSVPWM. In addition, a clear reduction in the I q current ripple was observed for the proposed SLNN-MPC-DSVPWM compared  with MPC-DSVPWM. The performance of SLNN-MPC-DSVPWM with varying motor speeds is shown in Fig. 11. The speed varies from 0 to 875 rpm (i.e., the base speed) in accordance with the applied DC-link voltage. From results, it can be seen that the I q current waveform follows the I * q current. In addition, a small I q current ripple with a sinusoidal A-phase current was achieved using SLNN-MPC-DSVPWM. As a result, the 80% accuracy of the SLNN has demonstrated a better performance in terms of THD reduction for the MPC-DSVPWM when large VVs are used. In addition, the proposed method successfully implemented under various operational conditions, as verified by the simulation results.

V. EXPERIMENTAL RESULTS
The advantages of the proposed SLNN-MPC-DSVPWM over the conventional MPC-DSVPWM and recent MLNN-MPC were verified experimentally. Fig. 12 shows the experimental setup using a two-level inverter and a low-order DSP TMS320F28335. To load the machine, an induction motor (IM) controlled by a commercially available YASUKAWA inverter was used. Due to hardware limitations, the applied DC-link voltage was 300 V, hence the base speed was reduced to 875 rpm. In addition, because of the high execution time of MPC-DSVPWM and MLNN-MPC-DSVPWM, only up to 12 VVs can be implemented in this DSP module. Meanwhile, the execution time was calculated using MPC-DSVPWM without running the full system where the algorithm was applied to the DSP to calculate the execution time at different VVs. The proposed SLNN-MPC-DSVPWM with 37 VVs was smoothly applied and operated due to its low execution time.  Fig. 13 shows the execution time for recent MLNN-MPC implemented in TMS320F28335. The execution time with a MLNN structure of 8/42/6 is 250 µs, where 8 is the input followed by 42 as the number of neurons in the hidden layer and 6 as the output. The tanh activation function is used in the hidden layer and the sigmoid activation function is used in the output layer [27]. It is clearly observed that the execution time is heavily affected by the number of neurons in the hidden layers as shown in Fig. 13a [27]. In [27] used 42 neurons in the hidden layer which requires large matrix multiplication and calculation of sigmoid function which needs large execution time especially when low order DSP and serial execution are used. Parallel execution time have to be adopted in order to have an execution time less than 100 µs. In addition, the other two MLNN structures of 4/15/7 and 8/15/7, presented in the literature [25], [26]. Their execution time is obtained as shown in Fig. 13b and Fig. 13c, respectively. From these results, it is clearly shown that MLNN-MPC cannot be implemented in low-order DSPs if a large number of neurons in the hidden layer are used. In addition, using a larger number of VVs affects significantly the execution time of MLNN due to the number of VVs is equal to the number of outputs as in [25] and [26]. However, the output of the proposed method is the switching states instead of VVs which reduces the execution time significantly.

B. PERFORMANCE COMPARISON FOR A SMALL NUMBER OF VVs
A comparison between MPC, MLNN-MPC, and SLNN-MPC for a small number of VVs is implemented first in order to show the superiority of SLNN-MPC compared with MLNN-MPC for small number of VVs. Seven VVs are used and the I * q was increased from 2 A to 10 A at 150 rpm. MLNN structure that is used is 4/2/7, where 4 is the input followed by 2 as the number of neurons in the hidden layer and 7 as the output. The tanh activation function is used in the hidden layer and the sigmoid activation function is used in the output layer [27].   Fig. 16 and Fig. 17 show the experimental results of I q , A-phase current waveform, THD, and FFT, for a large number of VVs respectively. SLNN-MPC-DSVPWM showed a better performance than MPC-DSVPWM with THD of 10% compared with 28.9%, respectively. In addition, the frequency spectrum located within the first 10 kHz division shows a noticeable reduction of the harmonics of the proposed SLNN-MPC-DSVPWM compared with MPC-DSVPWM. However, MPC-DSVPWM has faster response time compared with SLNN-MPC-DSVPWM. Furthermore, the proposed SLNN-MPC-DSVPWM was tested with speed variation, as shown in Fig. 18. It can be observed that the I q current waveform perfectly follows its desired value I * q .  Moreover, SLNN-MPC-DSVPWM can implement higher step prediction horizons to improve system performance without increasing the calculation burden. However, for MPC-DSVPWM method, the implementation of higher step prediction horizons increases the number of possible switches exponentially which increases the computation time exponentially.

D. AFFECT OF ACTIVATION FUNCTION ON THE EXECUTION TIME
The activation function significantly affects the size of the execution time. As shown in Table 4, the linear activation function took approximately 8 µs compared with 80 µs and 40 µs for the sigmoid and fast sigmoid activation functions, respectively. However, in the training phase, the sigmoid function was used to achieve good learning between the input and output of the MPC-DSVPWM.

E. AFFECT OF HIDDEN NEURONS AND OUTPUT LAYER ON THE EXECUTION TIME
The hidden neurons significantly affects the performance of the execution time. As shown in Fig. 13, when the number of hidden neurons increase from 15 to 42 neurons, the execution time was increase from the 120 µs to 200 µs. Therefore, the MLNN structure proposed in previous studies could not be implemented for low sampling time when low-order DSP   [25] and [26].
Consequently, The MLNN structure could not be implement if 37 VVs are used. The proposed method solves this limitation by using three SLNN to avoid lookup table initialization for a large number of virtual VVs. In addition, the proposed method does not require a large multiplication matrix of the input with all VVs. Instead, it simply multiplies the input with suitable switch states for each phase.

F. AFFECT OF NUMBER OF VVs ON THE EXECUTION TIME
The main limitation of MPC-DSVPWM is the execution time increases exponentially when a large number of VVs are used. In contrast, A maximum of 8 µs was only required for all the calculations of the proposed method for 37 VV compared with 75 µs using conventional MPC-DSVPWM with the same number of VVs.

VI. CONCLUSION
A creative control method for the current control of a PMSM was proposed in this study. The proposed SLNN-MPC-DSVPWM can be implemented using a low-order microprocessor for a large number of VVs. The proposed method used SLNNs to avoid lookup table initialization of all VVs and large matrix multiplication. In addition, the use of the linear activation function in the testing phase while using the sigmoid activation in the training phase significantly reduces the execution time compared with other previous research studies which use high computation activation functions in both the training and testing phases. The effectiveness of the proposed method was verified through simulations and experimental results. The proposed SLNN-MPC-DSVPWM shows a promising steady-state performance with an execution time of only 8 µs. The limitation of the proposed method is the training process based on MPC-DSVPWM which in general requires observers to compensate for parameter variations in motor-drive applications. Therefore, adaptive neural networks should be used in a future direction. Adaptive SLNN-MPC-DSVPWM can add new input elements to correct the system parameters using observers. In addition, a SLNN-MPC-DSVPWM can implement higher step prediction horizons to improve system performance without increasing the calculation burden which can be as a future improvement of the method.