Realization of the Sensorless Permanent Magnet Synchronous Motor Drive Control System with an Intelligent Controller

: This paper presents the sensorless control algorithm for a permanent magnet synchronous motor (PMSM) drive system with the estimator and the intelligent controller. The estimator is constructed on the novel sliding mode observer (SMO) in combination with a phase-locked loop (PLL) to estimate the position and speed of the rotor. The intelligent controller is a radial basis function neural network (RBFNN)-based self-tuning PID (Proportional-Integral-Derivative) controller, applied to the velocity control loop of the PMSM drive control system to adapt strongly to dynamic characteristics during the operation with an external load. The I-f startup strategy is adopted to accelerate the motor from standstill, then switches to the sensorless mode smoothly. The control algorithm program is based on MATLAB and can be executed in simulations and experiments. The control system performance is veriﬁed on an experimental platform with various speeds and the dynamic load, in which the speciﬁed I-f startup mode and sensorless mode, inspected by tracking response and speed regulation. The simulation and experimental results demonstrate that the proposed method has worked successfully. The motor control system has smooth switching, good tracking response, and robustness against disturbance.


Introduction
Applying the advanced developments in power electronics, microprocessors and digital signal processors (DSP), permanent magnet synchronous motors (PMSMs) have been extensively used in industrial automatic control applications, from washing machines to electric vehicles, due to their efficient performance characteristics, high power transmission efficiency, large torque-to-weight ratio, and long service life. Among various PMSM drive control techniques, field-oriented control (FOC) has been the most essential and efficient scheme, in which the rotor's position and speed data are required. As a sensor-based solution, these data are managed by a typical sensor, such as a resolver, encoder, or Hall sensor, installed on the motor's shaft. However, this makes the PMSM drive control system more expensive and larger in size. In some cases, the sensors are environment-sensitive, reducing control reliability and adaptiveness. To solve these shortcomings, various back-EMF-based (back electromotive force based) sensorless control techniques are designed and applied, such as the extended Kalman filter (EKF) approaches [1][2][3] or the sliding mode observer (SMO) approaches [4][5][6][7]. The EKF involves current control loops are executed on the PI (Proportional-Integral) controller and the FOC algorithm. The velocity control loop is implemented by an RBFNN-based self-tuning PID controller. The detailed formulation and control algorithm are described as follows.

Modeling of the PMSM
In general, the typical mathematical model of a PMSM is formulated in the d-q synchronous rotating coordinate as: where vd, vq are the voltages of the d and q axis, respectively; rs is the stator winding resistance per phase; Ls = Ld = Lq (for SPMSM) and Ld, Lq are the inductances of the d and q, axis respectively; id, iq are the currents of the d and q axis respectively; ωe is the rotating speed of magnet flux; is the permanent magnet flux linkage.
In Figure 1, the current control of PMSM is decoupled to torque control (iq) and flux control (id) based on the Clarke and Park transformation. Therefore, the PMSM is controlled in a similar way to controlling a DC motor. When the current id is controlled to zero, the torque of PMSM can be expressed by the following equation: with: = where Te is the electromagnetic torque, Kt is the torque constant, Np is the pole pairs. The dynamic equation of a PMSM drive system with the mechanical load can be presented as: where is the rotor speed, TL is the load torque; J and B are the inertia and friction constants of the PMSM, respectively.

Modeling of the PMSM
In general, the typical mathematical model of a PMSM is formulated in the d-q synchronous rotating coordinate as: v d = r s i d + L s d dt i d − ω e L s i q v q = r s i q + L s d dt i q + ω e L s i d + ω e λ f (1) where v d , v q are the voltages of the d and q axis, respectively; r s is the stator winding resistance per phase; L s = L d = L q (for SPMSM) and L d , L q are the inductances of the d and q, axis respectively; i d , i q are the currents of the d and q axis respectively; ω e is the rotating speed of magnet flux; λ f is the permanent magnet flux linkage.
In Figure 1, the current control of PMSM is decoupled to torque control (i q ) and flux control (i d ) based on the Clarke and Park transformation. Therefore, the PMSM is controlled in a similar way to controlling a DC motor. When the current i d is controlled to zero, the torque of PMSM can be expressed by the following equation: with: where T e is the electromagnetic torque, K t is the torque constant, N p is the pole pairs. The dynamic equation of a PMSM drive system with the mechanical load can be presented as: where ω r is the rotor speed, T L is the load torque; J and B are the inertia and friction constants of the PMSM, respectively.

Novel Sliding Mode Observer
Applying the inverse Park transformation for (1), the circuit equation of PMSM on the α − β stationary coordinate can be represented by the following equation: v α = r s i α + L s d dt i α + e α v β = r s i β + L s d dt i β + e β (5) where i α , i β are the current, v α , v β are the voltage of the α and β axis, and e α , e β are the back EMF, which are expressed by e α = −ω e λ f sin θ e e β = ω e λ f cos θ e (6) where θ e is the electrical rotor position and . θ e = ω e . Combining (5) and (6), the current equation can be derived as: According to the novel sliding mode observer theory, the current observer formulation is written as follows: whereî α ,î β are the estimated current in the α and β axis. The k is the gain and H(x) is the Sigmoid function, which is defined as: where µ is the shape parameter. Moreover, when (8) subtracts (7), the estimated current error can be represented in the dynamic equation as the following equation: where i α , i β are the estimated current error in the α and β axis, and are defined as: i α =î α − i α , and To analyze the stability of the novel sliding mode observer, the Lyapunov function is chosen as: Taking the derivative of the Lyapunov function by the time, we obtain Furthermore, if we design k > max(|e α |, e β ) and use (10), we have V ≤ 0, the estimated current will converge to the actual current. The back EMF can be obtained as: whereê α ,ê β are the estimated back EMF. Moreover, a low pass filter is implemented to reduce the noise effect in estimated back EMF.
where ω c = 2π f c and f c is the cut-off frequency of the low pass filter.
Once the back EMF can be estimated, the phase-locked loop is executed to estimate the rotor position. The architecture of the novel SMO with a PLL is shown in Figure 2.
where = 2 and is the cut-off frequency of the low pass filter. Once the back EMF can be estimated, the phase-locked loop is executed to estimate the rotor position. The architecture of the novel SMO with a PLL is shown in Figure 2.
From (6), an estimated error is defined by If this error is controlled to zero by a PI controller, the rotor speed is estimated by and, the estimated rotor position can be obtained by Finally, a phase shift compensation is calculated to correct the estimated rotor position, rejecting the phase delay effect in the back EMF's low pass filter.   From (6), an estimated error is defined by ε = −ê αF cos(θ e ) −ê βF sin(θ e ) (16) If this error is controlled to zero by a PI controller, the rotor speed is estimated by and, the estimated rotor position can be obtained bŷ Finally, a phase shift compensation is calculated to correct the estimated rotor position, rejecting the phase delay effect in the back EMF's low pass filter.

The I-f Startup Strategy
During the inter-mode transition from the startup stage to the sensorless FOC algorithm stage, the I-f startup strategy smooths torque and speed transition. It is based on the closed-loop current controller architecture. According to the study of [11], the I-f startup method is implemented in a three-stepped sequence, shown in Figure 3, and described as follows: guarantee the smooth switching condition. * ( + 1) = * ( ) − (23) * ( + 1) = * ( ) = (24) while: where is the angular threshold value of switching condition and Ka is the proportional gain for ramping down the current command * .
Step 3: Switching to the sensorless FOC mode operation based on the novel SMO-PLL estimator at the end of step 2.
The I-f startup strategy flowchart. Figure 3.
The I-f startup strategy flowchart.
Step 1: Ramping up reference speed with the constant i * q regulation at the initial start. This step aims to accelerate the motor from standstill to the switching reference speed where the back-EMF signal is large enough for the novel SMO-PLL estimator, which can obtain the rotor position and speed information accurately. The reference current i * q and reference speed ω * r are set to: where i * q0 is the initial current in q-axis; θ a e , θ i e are the auto-generated rotor position and its initial value; ω sw r is the specific reference speed for switching to the sensorless mode, and K ramp is the proportional gain for ramping up the reference rotor speed.
Step 2: Keeping reference speed constant with decreasing i * q axis current at the end of step 1. The purpose of this step is to reduce the current i * q , while the same torque is generated as before and balanced the load torque. In addition, the load torque angular θ L reduces to a critical threshold to guarantee the smooth switching condition. while: where θ sw e is the angular threshold value of switching condition and K a is the proportional gain for ramping down the current command i * q .
Electronics 2020, 9, 365 7 of 22 Step 3: Switching to the sensorless FOC mode operation based on the novel SMO-PLL estimator at the end of step 2.

PID Controller
In Figure 1, the velocity loop is executed with a PID controller to regulate the reference current i * q in the q-axis. The algorithm of an incremental PID controller can be written as the following discrete-time equation: with: where the rotor speed error is defined as: and k p , k i , k d are the proportional, integral, and differential gains of the controller, respectively. Meanwhile e p (k), e i (k), e d (k) are the proportional, integral, and differential variations in one sampling time, successively.

Radial Basis Function Neural Network
To get a self-tuning PID controller, the PMSM drive control system is identified by an RBFNN. Then, the controller's parameters should be adjusted suitably. Therefore, the RBFNN structure is shown in Figure 4. It comprises the feedforward neural network architecture, consisting of three layers-an input layer with three inputs, a hidden layer with five neurons, and a single output layer.

PID Controller
In Figure 1, the velocity loop is executed with a PID controller to regulate the reference current * in the q-axis. The algorithm of an incremental PID controller can be written as the following discrete-time equation: with: where the rotor speed error is defined as: and kp, ki, kd are the proportional, integral, and differential gains of the controller, respectively. Meanwhile ̃ ( ), ̃ ( ), ̃ ( ) are the proportional, integral, and differential variations in one sampling time, successively.

Radial Basis Function Neural Network
To get a self-tuning PID controller, the PMSM drive control system is identified by an RBFNN. Then, the controller's parameters should be adjusted suitably. Therefore, the RBFNN structure is shown in Figure 4. It comprises the feedforward neural network architecture, consisting of three layers-an input layer with three inputs, a hidden layer with five neurons, and a single output layer.

Input Layer
Hidden Layer Output Layer The input vector is defined as: with: In the hidden layer, the activation function is implemented by a Gaussian function The input vector is defined as: with: Electronics 2020, 9, 365 8 of 22 In the hidden layer, the activation function is implemented by a Gaussian function and b j , c ij are the width and center of the Gaussian function. In the output layer, the output is a linear sum of hidden nodes: Furthermore, to simplify the online adaptive updating law for the parameter of RBFNN, the cost function is defined as: According to the stochastic gradient descent (SGD) method, the learning algorithm can be calculated and updated by the below equations [15]: where i = 1, 2, 3; j = 1, 2...5; η is the learning rate; α is the momentum factor. Furthermore, the Jacobian transformation can be obtained as:

Adjusting Mechanism Of PID Controller
In the closed-loop control, the parameters of the PID controller are adjusted online to minimize the square rotor speed error between the reference speed and the estimated rotor speed. Therefore, the cost function can be expressed as: Then, using the SGD method, the parameters of the PID controller can be updated and optimally tuned as the following equations [16]: Electronics 2020, 9, 365 where η is the learning rate.

Implementation of a Sensorless Speed Control Algorithm in MATLAB Simulink
Among the motor control system realization approaches, the DSP-executed hardware solution requires transforming the system description equation from the continuous-time domain to the discrete-time domain. The sliding mode observer is represented by the discrete-time equation as: where T s is the sampling time. The motor control system expression is standardized in the per-unit system, so the current observer is rewritten as: with: F = e − rs Ls T s and G = U m I m 1 r s (1 − e − rs Ls T s ) where U m and I m are the base phase voltage and current, F and G are the feedback and gain factors of the SMO block system, respectively.
Additionally, the back EMF's low pass filter is also represented by the discrete equation, as: where K LPF = ω c T s . Generally, a DSP-based control system is programmed in C/C++ languages, which requires some coding and debugging skills. However, in the case of using the Texas Instruments' DSP controller, the algorithm is not only being implemented directly by Code Composer Studio (CCS) software but is also enhanced by utilizing MATLAB and CCS software. The algorithm is firstly designed in MATLAB Simulink, then compiled the block system into C/C++ languages by Embedded Coder. Successively, the code is imported into CCS to execute, debug, and monitor the real-time system. Moreover, with enhanced functions of the Embedded Coder Support Package for Texas Instruments in MATLAB, it is very convenient to develop a motor control algorithm with Simulink. This shortens the DSP application development time significantly.
For developing the FOC algorithm, the Digital Control Motor (DCM) blocks are provided with the pre-built functions of not only the Clarke, Park, and Inverse Park transformations, but also for SVPWM, and current PI controllers. The FOC block is not shown in this paper with these functions, because it is already described in MATLAB manuals. Moreover, the TI IQmath library is supported for highly optimized and high precision mathematical functions of cosine, sine, magnitude, etc. Therefore, the sensorless PMSM control algorithm is easily developed in MATLAB Simulink for both simulation and experiment. Figure 5 presents the detailed block diagram of the novel SMO, the sigmoid function, the low pass filter, and the PLL in Simulink.

The Simulation Results
The platform of a motor speed control system was built on the PMSM's parameters, shown in Table 1. The control algorithm is verified in both the simulation and experiment under three cases. The first case is the I-f startup mode and switching to the sensorless FOC algorithm. The second one is the tracking response for checking the transient specification and the steady-state error. The last one is the speed regulation for evaluating the system stability regarding external disturbances. All the instances are operated with the dynamic load system, which includes an electrical circuit and a generator, coupled to the PMSM. The electrical circuit consists of a rectifier, a capacitor, and resistors, which are connected in parallel.
The complete design of the sensorless PMSM drive control system is shown in Figure 7, which includes three blocks. The first block (A) is built for real-time platform modeling. The discrete times of the PMSM model, the inverter, and the generator are 50 µs. The second block (B) is the motor control algorithm, which is executed in simulation and the real-time experiment. The third block (C) is used to monitor and acquire the simulation data. Within the control algorithm block, five subblocks are executed as the reference speed regulator, the discrete RBFNN-based self-tuning PID controller, the * regulator of I-f mode, the FOC algorithm, and the novel sliding mode observer with a phaselocked loop, respectively. The sampling time of the velocity loop is 1ms, while the sampling times of the FOC algorithm and the novel SMO-PLL estimator are 50 µs. In the current control loop, two PI controllers are adopted for the currents in d-q axis. Those PI controllers' parameters are set as KPd = According to the design technique in the literature [15,17], the discrete PID controller algorithm in (26)-(28), (39)-(41) and an RBFNN identification algorithm in (29)-(37) are implemented as two function blocks, integrated in the closed velocity control loop ( Figure 6).

The Simulation Results
The platform of a motor speed control system was built on the PMSM's parameters, shown in Table 1. The control algorithm is verified in both the simulation and experiment under three cases. The first case is the I-f startup mode and switching to the sensorless FOC algorithm. The second one is the tracking response for checking the transient specification and the steady-state error. The last one is the speed regulation for evaluating the system stability regarding external disturbances. All the instances are operated with the dynamic load system, which includes an electrical circuit and a generator, coupled to the PMSM. The electrical circuit consists of a rectifier, a capacitor, and resistors, which are connected in parallel.
The complete design of the sensorless PMSM drive control system is shown in Figure 7, which includes three blocks. The first block (A) is built for real-time platform modeling. The discrete times of the PMSM model, the inverter, and the generator are 50 µs. The second block (B) is the motor control algorithm, which is executed in simulation and the real-time experiment. The third block (C) is used to monitor and acquire the simulation data. Within the control algorithm block, five subblocks are executed as the reference speed regulator, the discrete RBFNN-based self-tuning PID controller, the * regulator of I-f mode, the FOC algorithm, and the novel sliding mode observer with a phaselocked loop, respectively. The sampling time of the velocity loop is 1ms, while the sampling times of

The Simulation Results
The platform of a motor speed control system was built on the PMSM's parameters, shown in Table 1. The control algorithm is verified in both the simulation and experiment under three cases. The first case is the I-f startup mode and switching to the sensorless FOC algorithm. The second one is the tracking response for checking the transient specification and the steady-state error. The last one is the speed regulation for evaluating the system stability regarding external disturbances. All the instances are operated with the dynamic load system, which includes an electrical circuit and a generator, coupled to the PMSM. The electrical circuit consists of a rectifier, a capacitor, and resistors, which are connected in parallel. The complete design of the sensorless PMSM drive control system is shown in Figure 7, which includes three blocks. The first block (A) is built for real-time platform modeling. The discrete times of the PMSM model, the inverter, and the generator are 50 µs. The second block (B) is the motor control algorithm, which is executed in simulation and the real-time experiment. The third block (C) is used to monitor and acquire the simulation data. Within the control algorithm block, five subblocks are executed as the reference speed regulator, the discrete RBFNN-based self-tuning PID controller, the i * q regulator of I-f mode, the FOC algorithm, and the novel sliding mode observer with a phase-locked loop, respectively. The sampling time of the velocity loop is 1ms, while the sampling times of the FOC algorithm and the novel SMO-PLL estimator are 50 µs. In the current control loop, two PI controllers are adopted for the currents in d-q axis. Those PI controllers' parameters are set as   Figure 7. The simulation structure of the sensorless speed control algorithm for the PMSM drive system with a dynamic load system in MATLAB Simulink. Figure 8 shows the motor's speed responses while speeding up the rotor speed from 0 to 2000 rpm. The reference speed is changed in a period of 1s with a sequence of 200 → 400 → 700 → 1000 → 700 → 1000 → 1400 → 1700 → 2000 rpm. Figure 8a refers that the novel SMO-PLL estimated rotor speed is closely tracked to the reference speed, and overlaps the actual rotor speed, calculated by the encoder. Figure 8b presents the current response in the d-q axis. The current iq is varied and regarded   Figure 8a refers that the novel SMO-PLL estimated rotor speed is closely tracked to the reference speed, and overlaps the actual rotor speed, calculated by the encoder. Figure 8b presents the current response in the d-q axis. The current i q is varied and regarded to the reference speed. When the rotor speed is increased, the external load becomes higher. Therefore, the more torque is required in the motor, and the current i q is regulated to be larger. The current i d almost is equal to zero and has some small pulses when changing the speed. Figure 8c-f illustrates the electrical positions of the rotor, separately calculated by the novel SMO-PLL estimator and the encoder, with the estimated errors at the speeds of 700, 1000, 1400, and 2000 rpm. There are 7, 10, 14 and 20 position cycles in a period of 0.15s, respectively. Correspondingly, the rotation frequencies are 46.67, 66.67, 93.33, and 133.33 Hz. These values are suitable for the mentioned rotor speed. The estimated and actual positions are approximated to each other; thus, the estimated error is equal to zero. The PID gains are updated during the operating time. At = 3.5 s (as ω r = 700 rpm), the PID gains are tuned to K Ps = 0.7424, K Is = 0.0107, and K Ds = 0.4806. At = 4.5 s (as ω r = 1000 rpm), the PID gains are tuned to K Ps = 0.7694, K Is = 0.0110, and K Ds = 0.4768. At t = 7.5 s (as ω r = 1400 rpm), the PID gains are tuned to K Ps = 0.8549, K Is = 0.0117, and K Ds = 0.4648. Lastly, the rotor speed reaches 2000 rpm and the PID gains are also tuned to K Ps = 1.0288, K Is = 0.0131, and K Ds = 0.4400 at t = 9.5 s. Figure 9 demonstrates the detailed speed response for the startup motor mode and switching to the sensorless control mode at the speed of 200 rpm. The ramp-up speed ratio is set at 500 rpm/s. As mentioned in step 1 of the I-f strategy, the rotor speed is increased, following the ramp function, with the initial reference current i * q of 0.63 A. The actual rotor speed reaches 200 rpm in 0.415 s. At t = 0.441 s, the actual rotor speed reaches the maximum of 207.6 rpm, so the maximum error is +7.6 rpm. In step 2 of the I-f strategy, from t = 0.5 s, the reference current i * q decreases down to 0.183 A, with a current down ratio of 0.42 A/s. The actual rotor speed is kept close to 200 rpm. At t = 1.585 s, the actual rotor speed is reduced to a minimum of 191.3 rpm, so the minimum error is −9.7 rpm. At t = 1.682 s, the switching operation occurs, when the deviation of the estimated position and the auto-generated position is 3.6 degrees. Three rotor position curves are almost overlapped together. The current i q has a small ripple, while the small pulse (about 0.05 A) appears in the current i d . Therefore, the switching transient is smooth. Then, the motor begins to operate in the sensorless control mode. Figure 10 shows the motor's speed responses while slowing down the rotor speed from 2000 to 400 rpm. The reference speed is sequentially varied as 2000 → 1700 → 1400 → 1200 → 800 → 1000 → 1200 → 1400 → 1000→ 700 → 400 rpm. Figure 10a shows that the estimated rotor speed is closely tracked by the reference speed and overlaps the actual rotor speed. Figure 10b presents the current response in the d-q axis. The current i q is also varied to the rotor speed. When the rotor speed is decreased, the external load becomes lower. Therefore, the less torque is required to the motor, and the current i q is regulated to be smaller. Moreover, the self-tuning PID controller's parameters are also tuned successfully. At t = 12.5 s (as ω r = 1200 rpm), the PID gains are tuned to K Ps = 0.8490, K Is = 0.0115, K Ds = 0.4666. At t = 17.5 s (as ω r = 1000 rpm), the PID gains are tuned to K Ps = 0.6567, K Is = 0.0094, K Ds = 0.4947. Lastly, the rotor speed decreases to 400 rpm and the PID gains are also tuned to K Ps = 0.6020, K Is = 0.0087, K Ds = 0.5026 at t = 19.5 s. Figure 11 presents the system performance when changing the external load. In the beginning, the dynamic load system is operated with a capacitor of 470 µF, and the total resistor of 100 Ω, connected in the electrical circuit. The motor starts up and increases the rotor speed following the sequence of 200 → 500 → 1000 → 1500 → 2000 rpm. The rotor speed reaches 2000 rpm after 5 s. The current i q is approximately 1.79 A. At t = 6 s, the resistance load is changed from 100 Ω to 50 Ω by turning on some resistors in parallel connection. The external load is enhanced. The rotor speed reduces to the minimum of 1838 rpm, at t = 6.037 s, and stabilizes at 2000 rpm again at t = 6.468 s. The speed reduction is 162 rpm, and the recovery time is 0.431 s. The current i q is increased to 2.51 A. Additionally, at t = 8 s, the resistance load is returned to the initial value of 100 Ω by turning off the same resistors. The motor speed is increased to the maximum of 2170 rpm at t = 8.041 s and stabilized at 2000 rpm again at t = 8.492 s. The speed increment is 170 rpm, and the recovery time is 0.451 s. The current i q is decreased to the previous value of 1.79 A because the additional external load is removed. It can be inferred that the motor still operates stably with the sensorless control algorithm by the novel SMO-PLL estimator in the dynamic load condition.   current down ratio of 0.42 A/s. The actual rotor speed is kept close to 200 rpm. At t = 1.585 s, the actual rotor speed is reduced to a minimum of 191.3 rpm, so the minimum error is −9.7 rpm. At t = 1.682 s, the switching operation occurs, when the deviation of the estimated position and the auto-generated position is 3.6 degrees. Three rotor position curves are almost overlapped together. The current iq has a small ripple, while the small pulse (about 0.05 A) appears in the current id. Therefore, the switching transient is smooth. Then, the motor begins to operate in the sensorless control mode.  Figure 10 shows the motor's speed responses while slowing down the rotor speed from 2000 to 400 rpm. The reference speed is sequentially varied as 2000 → 1700 → 1400 → 1200 → 800 → 1000 → 1200 → 1400 → 1000→ 700 → 400 rpm. Figure 10a shows that the estimated rotor speed is closely tracked by the reference speed and overlaps the actual rotor speed. Figure 10b presents the current response in the d-q axis. The current iq is also varied to the rotor speed. When the rotor speed is decreased, the external load becomes lower. Therefore, the less torque is required to the motor, and the current iq is regulated to be smaller. Moreover, the self-tuning PID controller's parameters are also tuned successfully. At t = 12.  As a summary, the various reference speed changes and the dynamic load condition are investigated in Figures 8-11 to analyze the controller performance. Referring to those results, it is easy to find that the rotor speed almost tracks to the commands very well, in which all the steady-state errors approach zero, and the overshoot or undershoot is also too small. The estimator works successfully because the estimated position approaches the actual position. The estimated error is almost zero. Moreover, the system has a good mode transition and robust performance against disturbance. The simulation results confirm that the proposed estimation and control algorithm for the sensorless PMSM drive system are correct and effective.

The Experimental Verification and Results
After finishing the simulation, to verify the algorithm and analyze the system performance, the motor control algorithm is implemented by the platform in Figure 12. The hardware platform consists of a PMSM coupled to a generator, with an electrical load system, an inverter, a DSP F28379D (as TI-DSP), and a control circuit. The parameters of PMSM are listed in Table 1. The DSP F28379D is equipped with 200 MHz dual C28xCPUs and dual CLAs, 1 MB Flash, 16-bit/12-bit ADCs, comparators, 12-bit DACs, HRPWMs, eCAPs, eQEPs, CANs, etc. The control circuit is designed to isolate the PWM signal between the inverter and TI-DSP, process the phase current measurement, and protect the overcurrent status. When the overcurrent happens, the PWM control signal generated by TI-DSP will be locked. The electrical load system includes a rectifier, a capacitor of 470 µF-450 V, and power resistors of 100 Ω-100 W.
to find that the rotor speed almost tracks to the commands very well, in which all the steady-state errors approach zero, and the overshoot or undershoot is also too small. The estimator works successfully because the estimated position approaches the actual position. The estimated error is almost zero. Moreover, the system has a good mode transition and robust performance against disturbance. The simulation results confirm that the proposed estimation and control algorithm for the sensorless PMSM drive system are correct and effective.

The Experimental Verification and Results
After finishing the simulation, to verify the algorithm and analyze the system performance, the motor control algorithm is implemented by the platform in Figure 12. The hardware platform consists of a PMSM coupled to a generator, with an electrical load system, an inverter, a DSP F28379D (as TI-DSP), and a control circuit. The parameters of PMSM are listed in Table 1. The DSP F28379D is equipped with 200 MHz dual C28xCPUs and dual CLAs, 1 MB Flash, 16-bit/12-bit ADCs, comparators, 12-bit DACs, HRPWMs, eCAPs, eQEPs, CANs, etc. The control circuit is designed to isolate the PWM signal between the inverter and TI-DSP, process the phase current measurement, and protect the overcurrent status. When the overcurrent happens, the PWM control signal generated by TI-DSP will be locked. The electrical load system includes a rectifier, a capacitor of 470 µF-450 V, and power resistors of 100 Ω-100 W.  In the simulation structure in Figure 7, only the second block (B) is compiled to generate the algorithm code in C/C++ language, which is imported into the CCS software. The CCS software was responsible for connecting, downloading, debugging, and monitoring online the variables during the operation of the system. Moreover, some data in the block (C) are acquired online by MATLAB, based on the SCI function.
The sampling times of the velocity loop, the current loop and the novel SMO-PLL estimator, are still set as the same as the simulation values. The inverter's switching frequency is set at 15 Khz. The parameters of PI current controller are set as K Pd = 0.25, K Id = 0.025, K Pq = 0.25, and K Iq = 0.025. The RBFNN's initial parameters are setup as the node centers (c 1 = -0.0025, c 2 = -0.00125, c 3 = 0.0, c 4 =0.00125, c 5 = 0.0025), the node widths (b 1 = b 2 = b 3 = b 4 = b 5 = 0.5), the connective weights (w 1 = w 2 = w 3 = w 4 = w 5 = 0.0000625). The learning rate is 0.435 and the momentum factor is 0.75. Additionally, the discrete PID's initial parameters are designed as K Ps = 0.735, K Is = 0.00435, and K Ds = 0.478. All experimental results are implemented with an initial resistance load of 100Ω-400 W, a capacitor of 470µF-450V in the dynamic load system. Figure 13 shows the motor's speed responses while speeding up the rotor speed from 0 to 2000 rpm. The reference speed is changed in a period of 5s with the sequences as 300 → 500 → 700 → 1000 → 800 → 1200 → 1600 → 1800 → 2000 rpm. Figure 13a refers that the novel SMO-PLL estimated rotor speed is closely tracked to the reference speed, and overlapped the actual rotor speed, measured by the encoder. Although there is the oscillation of the current responses in Figure 13b, their average value still follows the current command. In the simulation structure in Figure 7, only the second block (B) is compiled to generate the algorithm code in C/C++ language, which is imported into the CCS software. The CCS software was responsible for connecting, downloading, debugging, and monitoring online the variables during the operation of the system. Moreover, some data in the block (C) are acquired online by MATLAB, based on the SCI function.   Figure 14 demonstrates the detailed speed response for the startup motor mode and switching to the sensorless control mode at the speed of 300 rpm. The ramp-up speed ratio is set up at 66.67 rpm/s. At t = 0.623 s, the motor starts to speed up. The rotor speed is increased, following the ramp function with the initial reference current i * q of 0.635 A. The actual rotor speed reaches 295 rpm at t = 5.2 s. Then, the reference current i * q decreases down to 0.336 A with a current down ratio of 0.085 A/s. The reference speed is kept at 300 rpm, and the actual rotor speed is still close to 300 rpm. At t = 6.403 s, the actual rotor speed reaches the maximum of 302.7 rpm. The maximum speed error is +2.7 rpm. At t = 8.832 s, the actual rotor speed drops to a minimum of 286.1 rpm. The minimum speed error is −13. RBFNN's initial parameters are setup as the node centers (c1 = -0.0025, c2 = -0.00125, c3 = 0.0, c4 =0.00125, c5 = 0.0025), the node widths (b1 = b2 = b3 = b4= b5 = 0.5), the connective weights (w1 = w2 = w3 = w4 = w5 = 0.0000625). The learning rate is 0.435 and the momentum factor is 0.75. Additionally, the discrete PID's initial parameters are designed as KPs = 0.735, KIs = 0.00435, and KDs = 0.478. All experimental results are implemented with an initial resistance load of 100Ω-400 W, a capacitor of 470µF-450V in the dynamic load system. Figure 13 shows the motor's speed responses while speeding up the rotor speed from 0 to 2000 rpm. The reference speed is changed in a period of 5s with the sequences as 300 → 500 → 700 → 1000 → 800 → 1200 → 1600 → 1800 → 2000 rpm. Figure 13a refers that the novel SMO-PLL estimated rotor speed is closely tracked to the reference speed, and overlapped the actual rotor speed, measured by the encoder. Although there is the oscillation of the current responses in Figure 13b, their average value still follows the current command. Figure 13c- Figure 15 shows the motor's speed responses while slowing down the rotor speed from 1800 to 300 rpm. The reference speed is sequentially varied as 1800 → 1600 → 1400 → 1000 → 1200 → 800 → 500 → 300→ 500 → 700 → 1000 rpm. Figure 15a shows that the estimated rotor speed is closely tracked by the reference speed and overlaps the actual rotor speed. Figure 15b presents the current response in the d-q axis. The current i q is also varied according to the rotor speed. When the rotor speed is decreased, the external load becomes lower. Therefore, the less torque is required by the motor, and the current i q is regulated to be smaller. Moreover, the self-tuning PID controller's parameters are also tuned effectively. The PID gains are tuned to K Ps = 0.832, K Is = 0.0039, K Ds = 0.4531 at t = 62 s (as ω r = 1400 rpm); K Ps = 0.7280, K Is = 0.0044, K Ds = 0.4580 at t = 77 s (as ω r = 800 rpm); and K Ps = 0.7046, K Is = 0.0044, K Ds = 0.4639 at t = 87 s (as ω r = 300 rpm). Figure 15 shows the motor's speed responses while slowing down the rotor speed from 1800 to 300 rpm. The reference speed is sequentially varied as 1800 → 1600 → 1400 → 1000 → 1200 → 800 → 500 → 300→ 500 → 700 → 1000 rpm. Figure 15ashows that the estimated rotor speed is closely tracked by the reference speed and overlaps the actual rotor speed. Figure 15b presents the current response in the d-q axis. The current iq is also varied according to the rotor speed. When the rotor speed is decreased, the external load becomes lower. Therefore, the less torque is required by the motor, and the current iq is regulated to be smaller. Moreover, the self-tuning PID controller's parameters are also tuned effectively. The PID gains are tuned to KPs = 0.832, KIs = 0.0039, KDs = 0.4531 at t = 62 s (as ωr = 1400 rpm); KPs = 0.7280, KIs = 0.0044, KDs = 0.4580 at t = 77 s (as ωr = 800 rpm); and KPs = 0.7046, KIs = 0.0044, KDs = 0.4639 at t = 87 s (as ωr = 300 rpm).   Figure 16 presents the system performance when the external load is varied. In the beginning, the dynamic load is set up with a capacitor of 470 µF-450 V, the total resistor of 100 Ω-400 W. The motor starts up and increases the rotor speed, reaching 2000 rpm. The current i q fluctuates around 1.56 A. At t = 37.99 s, the total resistance load is changed to 50 Ω-800 W by turning on more resistors. At t = 38.11 s, the actual rotor speed (red line) drops to a minimum of 1797 rpm while the minimum estimated value (blue line) is 1817 rpm. The recovery time is 2.99 s when the motor reaches 1995 rpm again at t = 40.98 s. The average current i q reaches 2.42 A due to the external load increment. In addition, at t = 45.60 s, the total resistance load is returned to the initial value of 100 Ω-400 W by turning off the same resistor. The actual rotor speed is increased to the maximum of 2171 rpm at t = 45.71 s, while the maximum estimated value is 2157 rpm. The recovery time is 1.06 s when the motor stabilizes at 2000 rpm again at t = 46.66 s. The average current i q is decreased to 1.57 A because of the external load reduction. Within the speed regulation at 2000 rpm, the estimate speed error is about +5 rpm, while this error is larger at the up peak (20 rpm) or the low peak (14 rpm). The maximum control speed steady-state error is ±5 rpm at 2000 rpm. Although the system is affected by the disturbance of the external load, the motor still operates stably and successfully with the sensorless control algorithm based on the novel SMO-PLL estimator.
stabilizes at 2000 rpm again at t = 46.66 s. The average current iq is decreased to 1.57 A because of the external load reduction. Within the speed regulation at 2000rpm, the estimate speed error is about +5 rpm, while this error is larger at the up peak (20 rpm) or the low peak (14 rpm). The maximum control speed steady-state error is ±5 rpm at 2000 rpm. Although the system is affected by the disturbance of the external load, the motor still operates stably and successfully with the sensorless control algorithm based on the novel SMO-PLL estimator. Finally, similar to the simulation, the experimental results in Figures 13-16 show that the rotor speed almost tracks to the command very well, all the steady-state errors approach zero (within ±5 rpm in tolerance), and the overshoot or undershoot is also too small. The novel SMO-PLL estimator works successfully. The estimated position approaches the actual position. The estimated error is close to zero. Additionally, the real-time system has a good mode transition and robust performance against disturbance. The experimental results again confirm that the proposed estimation and control algorithm of the PMSM system are correct and effective in the real-time system. Furthermore, the DSP application for the PMSM drive control system is built in MATLAB Simulink properly, and is deployed to CCS software to realize the real-time system successfully. This deployment method shortens the application development time. Finally, similar to the simulation, the experimental results in Figures 13-16 show that the rotor speed almost tracks to the command very well, all the steady-state errors approach zero (within ±5 rpm in tolerance), and the overshoot or undershoot is also too small. The novel SMO-PLL estimator works successfully. The estimated position approaches the actual position. The estimated error is close to zero. Additionally, the real-time system has a good mode transition and robust performance against disturbance. The experimental results again confirm that the proposed estimation and control algorithm of the PMSM system are correct and effective in the real-time system. Furthermore, the DSP application for the PMSM drive control system is built in MATLAB Simulink properly, and is deployed to CCS software to realize the real-time system successfully. This deployment method shortens the application development time.

Conclusions
In this paper, a self-tuning PID controller based on a radial basis function neural network and a rotor position estimator based on the novel SMO in combination with a PLL for the sensorless PMSM drive control system have been described and developed successfully. The control algorithm, consisting of the I-f startup strategy, novel SMO-PLL estimator, RBFNN-based self-tuning PID controller, and FOC algorithm, was deployed properly in both the simulation and the real-time hardware, established on a DSP F28379D. The system performance has been verified in three terms: startup mode, tracking response, and speed regulation with the dynamic load system. The simulation and experimental results indicate that the motor control system has a smooth transition from the startup mode to the sensorless control mode with the low ripple in the current and the rotor speed. The novel SMO-PLL estimator is stable, and the estimated position approximates to the actual position, so the estimated error is almost minimal and negligible. The PID gains are tuned effectively. The rotor speed tracks properly to the reference speed, and the overshoot or undershoot is very small. The steady-state