Academic Journal of Science and Technology ISSN: 2771-3032 | Vol. 7, No. 3, 2023 50 Brushless Motor FOC Control Method for Robot Arm Le Qin, Hangxin Wei, Yukun Wang, Jing Feng, Yijun Liu School of Mechanical Engineering, Xi'an Shiyou University, Shaanxi Xian 710065, China Abstract: With the development of modern industry, more stringent requirements are put forward for the servo control of the mechanical arm, especially the problems of insufficient precision, insufficient dynamic response and poor anti-interference ability. This paper takes the permanent magnet synchronous motor of permanent magnet synchronous motor (PMSM) as the research object, combines the RBF neural network with PID control to improve the traditional magnetic field vector control, improve the lag and dynamic response of traditional PI control, improve the stability of the control system; and introduces the online supervision mechanism to make the control system has good environmental adaptability and adaptive adjustment ability. The experimental results show that the magnetic field vector control algorithm based on RBF-PID has faster response time, higher accuracy and stronger anti-interference ability. Keywords: Permanent magnet synchronous motor (PMSM), RBF neural network, Magnetic field vector control, Adaptive control. 1. Introduction The robot arm plays a pivotal role in the application of modern industry, especially in the field of machinery manufacturing, agriculture, medical, aerospace and national defense is widely used. Taking mechanical manufacturing as an example, in an automated production line, there is a mechanical arm for assembling electronic components, and its main task is to place each device in its specific position. With the gradual upgrading of various components and the improvement of production requirements, the control accuracy and adaptive requirements of the robot arm are also improved. Therefore, as the power source of the robot arm, the research on the motor control system of the robot arm is of great significance to improve the control accuracy and dynamic response of the robot arm. Brushless Motor (BLDC) and Permanent Magnet Synchronous Motor (Permanent Magnet Synchronous Motor) are commonly used to power the robot arm. PMSM). The back electromotive force of the brushless DC motor is square wave, which is simple to control, and can also be driven by sinusoidal back electromotive force and sine wave. The back electromotive force of permanent magnet synchronous motor is sine wave, the torque output is stable, and the PMSM model is a complex nonlinear model, which has the characteristics of multi-variable, parameter, strong coupling and difficult control. In this paper, the stability of permanent magnet synchronous motor vector control is studied. There are two Control methods for permanent magnet synchronous motors: Field Oriented Control (FOC) and Direct Torque Control (DTC). Literature [1] introduces the basic principle of FOC control: taking the rotor flux direction as the reference direction of the rotating coordinate system, according to this coordinate system, the stator current is decomposed into the stator current excitation component in the same direction as the rotor flux and the stator current moment component in the orthogonal direction of the flux through Clark transformation and Park transformation. The two components are orthogonal to each other and are controlled by a controller respectively. Vector control can obtain accurate speed control, good torque response, and then obtain the working characteristics similar to DC motor, but the disadvantage is slow dynamic response and difficult parameter setting. Literature [2] introduced the DTC algorithm. Different from vector control, direct torque control (DTC) abandons the idea of decoupling, cancellations the rotation coordinate transformation, and simply calculates the flux and torque of the motor by means of the instantaneous space vector theory based on the electric voltage and current of the motor, and compares the difference between the given values to achieve direct control of flux and torque. DTC algorithm has the advantages of simple structure and fast response speed, but the disadvantage is that the position control precision is low, the torque runout is large, and it can not meet the high precision control of industry. With the development of artificial intelligence algorithms, there are more and more applications of intelligent algorithms in motor control. Literature [3-5] applies fuzzy PID control to vector control and obtains good control accuracy, but the dynamic response is not very good. In literature [6-7], BP neural network PID is used to adjust the parameters of the speed link in vector control, and the current loop is still controlled by PI. This paper will take permanent magnet synchronous motor as the controlled object, combined with RBF-PID control, to study the stability of its control system. 2. Modeling of Charged Objects 2.1. Motor model The surface of permanent magnet of permanent magnet synchronous motor is designed to be parabolic, so that the generated air gap magnetic field is sinusoidal or quasi- sinusoidal [7]. When used as a motor, sinusoidal alternating current can drive the motor to output a smooth torque. The structure of a three-phase two-pole permanent magnet synchronous motor with built-in external rotation is shown in Figure 1 (a). 51 (a) Permanent magnet synchronous motor structure (b) abc coordinate system Figure 1. Permanent magnet synchronous motor and coordinate system Inside the permanent magnet synchronous motor, there is A pair of symmetrical distribution of two permanent magnets N pole and S pole, A, B, C in the figure are the current input end of the three-phase winding of the motor, X, Y, Z are the current output end of the three-phase winding of the motor. When the motor uses a Y-connection, the output end of the three-phase winding is shorted inside the motor, and the direction of the magnetic field formed by the phase winding is positive when the current of each phase flows into the motor. In order to describe the principle of proper control of permanent magnet synchronous motor more visually, a three- phase coordinate system (abc coordinate system) as shown in Figure 1 (b) is established on the motor. In this coordinate system, the three axes are 120. Included Angle, because when the motor rotates at a constant speed, the three-phase current signal collected in this coordinate system is phase 120. There is a strong coupling relationship between the three phase signals, and the coordinate system is fixed on the stator stationary coordinate system. Since the three quantities aI 、 bI 、 cI are non-orthogonal and difficult to control[8]. Therefore, Clark transform and Park transform are introduced, which can decouple the nonlinear and difficult to control three-phase signal into two easily controlled linear current components. (a) Clark transform (b) Park transform Figure 2. The Clark transform and the Park transformation Clark transform is to project aI 、 bI 、 cI onto the   coordinate system,   as shown in Figure. 2 (a). The coordinate system is a stationary rectangular coordinate system fixed on the stator, whose axis is recombined with axis A,and the transformed signal is the current component, with a phase Angle difference of 90 degrees I 、 I , and the transformation relationship is as follows:        cb cba III IIII ) 3 sin() 3 sin( ) 3 cos() 3 cos(     (1) Park transformation is the rotation degree of the   coordinate system, where is the current Angle of the rotor, the rotation Angle can be obtained by the encoder, and projected I 、 I to the qd  coordinate system, as shown in the figure, the qd  coordinate system can seem to be a rotating rectangular coordinate system fixed on the rotor flux. Thus, a vector of constant rotation becomes a fixed value in this coordinate system, and both control variables are linearized in this coordinate system. The transformed signal is two linear current components dI 、 qI , and the transformation relationship is as follows: 52          sincos cossin III III q d (2) In the qd  coordinate system, the torque equation of permanent magnet synchronous motor with surface protruding structure [2] is as follows: qe IpT 03  (3) Where, p is the number of poles of the motor and 0 is the main flux of each phase of the stator generated by the permanent magnet. After Clark transformation and Park transformation, the nonlinear three-phase AC electrical signal aI 、 bI 、 cI are transformed into two linear current signals dI 、 qI , and it can be seen from formula (3) that the motor torque can only be transformed by adjustment qI , so we only need to control the qI of transformation to achieve the rapid control of the motor torque. 2.2. PMSM control system model The PMSM vector control system model is shown in the figure. Through this control system, simple constant Id and Iq can be obtained after the acquisition of complex sine waves through Clark transform and Park transform. Combined with PI controller and vector pulse width modulation, the permanent magnet synchronous motor can be accurately controlled. Therefore, the control system is very suitable for the application of high precision manipulator control. In Figure 3, the encoder can obtain the position of the rotor   v , and then estimate the rotor speed. Two current components, Id and Iq, are obtained through Clark transform and Park transform. Combined with the PI controller, the direct-axis current Id that does not do work can be eliminated to reduce the energy consumption of the system. The PI controller with cascade structure can control the position, speed and current Iq in a closed loop, and then control the tangential force of the motor shaft to control the output torque of the motor. Figure 3. Structure diagram of the magnetic field vector control system Three PI controllers are used in the FOC algorithm speed loop. The problem of parameter setting in PI controller leads to poor adaptability of the control system. The hysteresis of the integral term leads to insufficient dynamic response of the controller. Many controller parameters may make parameter adjustment very difficult, but the decoupling idea of FOC algorithm is essential for high-precision control [9-10]. 3. RBF-FOC Control System Design In order to solve the problem of FOC algorithm parameter tuning and insufficient dynamic response, this paper adds the RBF network on the basis of FOC algorithm decoupling and modulation, and changes the PI control of the speed loop to the RBF-PID controller to carry out forward propagation of the controller. RBF neural network has the characteristics of simple structure, high identification and fast convergence speed, which is very in line with the requirements for high- precision control motors and will greatly improve the control performance of motors [11]. 3.1. RBF network RBF neural network is a three-layer neural network, which includes input layer, hidden layer and output layer. The transformation from the input space to the hidden layer space is nonlinear, while the transformation from the hidden layer space to the output layer space is linear, and the input layer is mapped to the hidden layer by Gaussian radial basis function. The flow chart is shown in Figure 4: Figure 4. Structure of RBF neural network 53 The basic principle of RBF network is to use RBF as the "base" of the hidden unit to form the hidden layer space, so that the input vector can be mapped directly to the hidden space without the need to pass the weight connection. When the central point of RBF is determined, the mapping relationship is determined. The mapping between the hidden layer space and the output space is linear, that is, the output of the network is the linear weighted sum of the output of the hidden unit, where the weight is the tunable parameter of the network. Among them, the function of the hidden layer is to map the vector from the low dimension p to the high dimension h, so that the low dimension linear indivisible case can become linearly divisible to the high dimension, mainly the idea of kernel function. In this way, the mapping of the network from input to output is nonlinear, while the network output is linear for the tunable parameters. The weight of the network can be solved directly from the linear equations, thus greatly speeding up the learning speed and avoiding the local minimum problem [12]. The activation function of radial basis neural network can be expressed as: ],1[) 2 1 exp()( 2 2 micxcxR ipip   (4) Where xp is the input layer, ci representing the central point of the radial basis function of the ith neuron; i represents the width of the function; ip cx  represents the Euclidean distance from the input to the center point, and the closer the distance is, the stronger the mapping ability of the function is. m is the total number of neurons, which is determined by the resolution and the value range of the input. The structure of radial basis neural network can obtain the output of the network as follows: njcxy ip h i ijj ...,2,1) 2 1 exp( 2 1 2     (5) Loss function with least squares: 2 1    h j ijj cyd (6) 3.2. The RBF network supervision structure RBF is a feedforward neural network with simple structure and fast learning convergence speed, which can approximate any nonlinear function with arbitrary accuracy. Figure 5 shows the supervisory structure of RBF network, the output of RBF network and PI controller, and PI controller provides stable control rate auxiliary online training [13-14]. Figure 5. RBF-PID adaptive structure diagram In this paper, online learning of gradient descent method was adopted to correct the center, width and weight of RBF neural network [15]. The error index of network update is: 2))()(( 2 1 )( kukukE r (7) The weight update formula is:          ))1()(()()()1( )()( )( )( kkkkk khku k E k jjj jp j j     (8) Hidden Layer Center Update:            )]2()1([)()1()( )]()([)( 2 kckckckckc b cx hkyky c J kb jijijijiji j jij jjm ji j   (9) Base width parameter update:            )]2()1([)()1()( )]()([)( 3 kbkbkbkbkb b cx hkyky b J kb jjjjj j j jjm j j   (10) Where: j is the weight of the hidden layer of the network; jc is data centers; jb is the data width;  is the learning rate )1,0( ;  is the momentum coefficient )1,0( . 4. Simulation Experiments In this paper, simulation experiments are carried out in MATLAB/SIMULINK software environment. First, the PID controller based on RBF neural network was built. As shown in Figure 6, the simulation model was built based on S function. 54 Figure 6. Simulation structure of the RBF _ PID neural network based on the S function As shown in Figure 7, it is a SIMULINK simulation model of magnetic field vector control of permanent magnet synchronous motor based on RBF neural network PID control. Figure 7. The magnetic field vector control model of RBF _ PID permanent magnet synchronous motor Simulation experiment 1: The permanent magnet synchronous motor starts no-load, the load is zero, and the rated speed is set to 1000r/min. Observe the change of the motor speed curve after the motor starts. Figure 8. Vector control no-load constant rotational speed response curve As can be seen from the analysis of FIG. 8, when the system is started without load, the speed reaches the rated speed in a short time. Compared with the traditional FOC, the RBF-FOC control system has shorter response time and smaller overshoot, which can reach the rated speed of the system faster and achieve more accurate control. Simulation experiment 2: The starting speed of permanent magnet synchronous motor is set to 1000r/min, the load is constant to 0, and the speed changes to 900r/min, 1100r/min, 800r/min and 900r/min at t=0.5s, t=1s, t=1.5s and t=2s, respectively. Observe the change of speed curve when the motor speed changes. 55 Figure 9. Vector control no-load variable speed speed response curve According to the analysis in Figure 9, when the system is started at the rated speed of 1000r/min, the RBF-FOC control has faster response speed and less overshoot than the traditional FOC control, which is conducive to the accurate and stable control of the motor. When the speed changes, it is obvious that the response speed of RBF-FOC is faster, which has a very important significance for the motor to quickly recover stability after variable speed, and also shows that the control method has a strong anti-interference ability. Simulation experiment 3: The system starts no-load at the rated speed of 1000r/min, suddenly increases the load of 2Nm at 0.5s, and observes the motor speed response curve of the two control algorithms. Figure 10. Vector control surge load speed response curve As can be seen from the analysis in Figure 10, both control algorithms of no-load start-up can be stabilized in the end, and the response speed of RBR-FOC control is faster than that of traditional FOC control. At the same time, when the load is suddenly increased at 0.5s, both of them have a jump, but the response speed of RBF-FOC is still very fast, which indicates that the control system based on the algorithm has a strong anti-interference ability. 5. Conclusion Improving the accuracy, stability and anti-interference ability of motor control is of great significance to the application of motor, especially in the application of mechanical arm, which can be more conducive to the stable operation of the mechanical arm. This paper proposes to apply RBF neural network to magnetic field vector control. The PI control in the velocity loop of the traditional magnetic field vector control system is replaced by the PID control of RBF neural network, namely RBF-PID. The addition of RBF network will greatly improve the integral hysteria of traditional PI control and solve the problem of slow dynamic response of traditional FOC control. At the same time, it also greatly saves the problem of manual adjustment due to excessive parameters, and introduces the online supervision mechanism, so that the control system can adapt to different environments. Simulation experiments show that compared with traditional FOC control, RBF-FOC control system has better dynamic response and anti-interference ability, and is more stable for motor applications. The next step will be to improve the position loop and apply it to the control of the robot arm to observe the stability of the motor control system with the change of the position of the robot arm, and further optimize the control algorithm. References [1] ZHOU Z, XIA C, YAN Y. Torque ripple minimization of predictive torque control for PMSM with extended control set[J]. IEEE Transactions on Industrial Electronics, 2017,64 (9):6930 − 6939. 56 [2] Marcel N,ClaudiuIonel N,Dan S, et al. Control of PMSM Based on Switched Systems and Field-Oriented Control Strategy[J]. Automation,2022,3(4). [3] Mohamed E,Fatih A,M. M A. A Combined Control Scheme of Direct Torque Control and Field-Oriented Control Algorithms for Three-Phase Induction Motor: Experimental Validation[J]. Mathematics,2022,10(20). [4] M. E O Y,G. M H,Wahab E A H. A new simplified sensorless direct stator field-oriented control of induction motor drives[J]. Frontiers in Energy Research,2022,10. [5] AnaMaria P,Marius D P. Adaptive Cruise Control in Electric Vehicles with Field-Oriented Control[J]. Applied Sciences, 2022, 12(14). [6] P. R,M. U,C. B, et al. Development of a PMSM motor field- oriented control algorithm for electrical vehicles[J]. Materials Today: Proceedings,2022,65(P1). [7] Habib B,Nicu B. A Synergetic Sliding Mode Controller Applied to Direct Field-Oriented Control of Induction Generator-Based Variable Speed Dual-Rotor Wind Turbines[J]. Energies,2021,14(15). [8] Khoury G,Ghosn R,Khatounian F, et al. Energy-efficient field- oriented control for induction motors taking core losses into account[J]. Electrical Engineering,2021,104(2). [9] Waleed A M E A,M. M A,M. T, et al. PSO technique applied to sensorless field-oriented control PMSM drive with discretized RL-fractional integral[J]. Alexandria Engineering Journal,2021,60(4). [10] Ho D S,Pavel B,Petr P, et al. Current sensorless method based on field-oriented control in induction motor drive[J]. JOURNAL OF ELECTRICAL SYSTEMS,2021,17(1). [11] Fatamou H,Yves J E,Duckler E F K. Optimization of sensorless field-oriented control of an induction motor taking into account of magnetic saturation[J]. International Journal of Dynamics and Control,2020,8(1).