Design of Position Loop and Electronic Gear in Fully Digital Servo System
[Copy link]
Abstract: The working principle of the position loop and electronic gear in the servo system is analyzed, and a digital implementation method of the position loop and electronic gear is introduced. Finally, the feasibility of the design is verified through experiments. Keywords: servo system; position loop; electronic gear 0 Introduction With the development of power electronics and digital control technology, more and more control systems adopt digital control methods. In the servo systems currently widely used in CNC lathes and textile machinery, the use of fully digital control methods has become a general trend. Compared with analog control, digital control not only has the advantages of convenient control, stable performance, and low cost, but also opens up development space for the networking and intelligent control of servo systems. The fully digitally controlled servo system can not only easily realize motor control, but also realize a variety of additional functions through software programming, making the servo system more humane and intelligent, which is exactly what analog control cannot achieve. At present, servo systems are mainly used for position control, such as CNC lathes, elevators and other fields. In these applications, it is impossible to achieve precise positioning of the system through speed control, so position control must be introduced. In the servo system, photoelectric encoders are generally used as position feedback signals. The motor is accurately positioned according to the number of pulses generated by the photoelectric encoder when the motor rotates one circle. In practical applications, the motor and other mechanical devices are connected by gears. Once fixed, the mechanical shaft displacement generated by the motor for each rotation is certain. In addition, in the servo control system, position control is usually determined by the upper controller generating a certain frequency and number of pulses to determine the motor speed and the angle of rotation. When the command pulse equivalent and the position feedback pulse equivalent are inconsistent, the electronic gear method must be used for adjustment. This paper focuses on the servo system of permanent magnet synchronous motor, and digitally designs its position loop and electronic gear function. Finally, the rationality of the design is proved by positioning experiments. 1 Design of position loop As a servo positioning system, the following three requirements must be met during positioning control: ——Positioning accuracy, requiring the system steady-state error to be zero; ——Positioning speed, requiring the system to have the highest possible dynamic response speed; ——The system position response is required to have no overshoot. In practical applications, the position loop is usually designed as a proportional control link. By adjusting the proportional gain, the system can ensure that there is no overshoot in the position response, but this usually reduces the dynamic response speed of the system. In addition, in order to obtain high positioning accuracy of the servo system, the host controller is usually required to accumulate the error between the given position and the actual position, and a certain control algorithm is required to compensate. Another method is to design the position loop as a proportional integral link, and ensure the positioning accuracy of the system by integrating the position error. This exempts the host controller from the accumulation of position error and reduces the control complexity. However, like the position controller using proportional adjustment, while there is no overshoot in the position response, the dynamic response performance of the system is reduced. This paper designs the position loop as a proportional controller, and accumulates the position error through an error accumulator to ensure positioning accuracy. At the same time, the value of the proportional coefficient is explained by analyzing the closed-loop transfer function of the position loop. Figure 1 is a control block diagram of the position servo system, where R ( s ) represents the corresponding command pulse input, and C ( s ) represents the corresponding position of the motor. When the speed regulator adopts PI control, when the cutoff frequency of the position loop is much smaller than the cutoff frequency of the speed loop, the closed-loop transfer function of the speed loop can be equivalent to an inertia link, that is, G 2 ( s ) = K v / ( T vs + 1), and the motor is equivalent to an integral link, that is, G 3 ( s ) = K m / s . Let's first analyze the situation when the position loop is designed as proportional control. At this time, G 1 ( s ) = K c , then the closed-loop transfer function of the system is H(s)=(1) Where: K = K c K v K m . Figure 1 Position servo system control block diagram From the open-loop transfer function, the system belongs to the I-type system. There are steady-state errors for the input of ramp function and parabola function. The exponential function, which is currently the most widely used in servo systems, can be approximately equivalent to the ramp function, so there is also a certain steady-state error. At this time, to obtain higher positioning accuracy, it is usually necessary for the upper controller to continuously accumulate the position error signal and compensate it with a certain control algorithm. In addition, since the system requires the position response to have no overshoot, the damping ratio ξ >=1 is required. At this time, Kc<=?(2) Therefore, in order to obtain the fastest possible dynamic response while ensuring that there is no overshoot in the position, the position loop proportional coefficient should be as large as possible. 2 Software Implementation of Position Loop The position signal of the servo system in this article is determined by the command pulse of the upper controller, and its format is pulse sequence + direction signal. The DSP control system obtains the given direction of the motor by judging the direction signal. The pulse frequency in the pulse sequence determines the speed of the motor, and the accumulated number of pulses determines the angle of the motor. Therefore, when the software of the position loop is implemented, the error between the output pulse and the feedback pulse needs to be accumulated. And due to the limitation of the DSP word length, when the command pulse frequency is large and the motor response speed cannot keep up, the overflow of the error pulse needs to be considered. Figure 2 is the control block diagram of the position loop of the entire servo system. Figure 2 Control block diagram of servo position loop The position regulator is equivalent to an accumulator with proportional gain, which accumulates the error of the output pulse. The specific algorithm is as follows: R(KT)=KcΔS=Kc〔DT3(iT)Kg-DT2(iT)〕(3) Where: ΔS is the accumulated number of error pulses; T is the sampling period; DT 3 is the number of instruction pulses obtained in each sampling period; K g is the electronic gear coefficient; DT 2 is the number of feedback pulses in each sampling period. The overflow pulse controller makes overflow judgment on the error ΔS . Here, the number of bits of the DSP word length is taken into consideration (the word length is 16 bits). When the error value ΔS >2 14 , it is overflow. At this time, the corresponding retention pulse controller should be set. Once the pulse overflow occurs, the position loop is controlled to output the maximum value, that is, the given maximum speed. The output of the position loop enters the speed controller after speed limiting. When the tracking speed of the servo system is determined by the frequency of the input pulse, the value of the error ΔS is a certain value. At this time, the dynamic balance equation of the input pulse and the feedback pulse is as follows: DT3(KT)Kg=DT2(KT)(4) When the frequency of the input pulse changes continuously, the tracking speed of the servo system changes continuously. At this time, the value of the error ΔS changes continuously, and finally all the retained pulses in the error ΔS are output , thereby achieving error-free positioning. 3 Design of electronic gear 3.1 Principle of electronic gear In order to make the command pulse equivalent consistent with the feedback pulse equivalent, electronic gears need to be used for adjustment in the actual application of the servo system. Here, assuming that the mechanical displacement corresponding to one revolution of the motor is ΔL, the feedback pulse equivalent can be calculated as follows: ΔPf=ΔL/(4×2500)(5) Here we consider using an incremental photoelectric encoder with 2500 pulses/turn and using it through a 4-fold frequency circuit. When the command pulse equivalent ΔPg does not match the feedback pulse equivalent ΔPf, the electronic gear coefficient Kg must be used to make the two match. The formula is as follows: ΔPgKg=ΔPf(6) As can be seen from Figure 2, the electronic gear Kg is outside the position loop, so changing the value of Kg will not affect the performance of the position loop. In current servo applications, the value range of the electronic gear Kg is 0.01 <= Kg <=100. Usually, two proportional coefficients can be set when implementing electronic gears using software, namely Kg=spdt1/spdt2(7) Then formula (6) becomes ΔPgspdt1=ΔPfspdt2(8) Where: spdt 1 can be regarded as the electronic gear coefficient of the command pulse, and spdt 2 can be regarded as the electronic gear coefficient of the feedback pulse. In order to explain the purpose of electronic gears in more detail, the following two cases will be analyzed. 3.1.1 Tracking the command pulse frequency At this time, the speed of the motor is determined by the frequency of the command pulse. The relationship between its speed v (r/min) and the input pulse frequency f in (Hz) is as follows: v = (9) By setting two electronic gear coefficients, different motor stable speeds can be obtained at the same input pulse frequency. In addition, the highest input pulse frequency cannot exceed the range recognized by DSP. Considering that when DSP reads the level value, the level needs to be maintained for at least 2 machine cycles, so the maximum input pulse frequency is finmax=MHz=5MHz In general applications of servo systems, the input pulse frequency is generally tens to hundreds of kHz. In this case, if the motor is in speed control mode, the speed of the motor can be adjusted by adjusting the command pulse frequency; if the motor is in position control mode, the pulse error between the command pulse and the feedback pulse needs to be accumulated and finally output. This step can be achieved through the pulse error accumulator ΔS of the position loop. 3.1.2 Tracking the number of command pulses In this case, the number of input pulses is determined by the actual displacement of the mechanical shaft connected to the motor. The total mechanical displacement L and the number of input pulses S have the following relationship: L = S Δ P g(10) Combining equation (5) and equation (6), we can get L=(11) By setting spdt 1 and spdt 2 , different mechanical axis displacements can be obtained with the same number of pulse inputs. In addition, in this case, when the frequency of the input pulse is higher than the input pulse frequency corresponding to the rated speed of the motor, a pulse retention situation will occur. Similar to the first case, the pulse retention pulse can be saved by the pulse error accumulator ΔS and finally output, thereby achieving error-free positioning of the motor. 3.2 Software Implementation of Electronic Gear Here, two reversible counters inside the F240DSP are used to complete the reading of command pulses and feedback pulses. There are three timing counters in the F240 chip, of which T1 is used as a periodic timer, T2 is used as a feedback pulse counter, and T3 is used as a command pulse counter. T2 is used in conjunction with the QEP circuit inside the DSP to receive the feedback signal from the photoelectric encoder disk and use it at 4 times the frequency. The working mode of the T3 counter is defined as an external clock, and bidirectional reversible counting is used. In the program, the number of command pulses and feedback pulses is obtained by reading the counting registers of T2 and T3 in each sampling cycle. In each sampling cycle T, the number of pulses obtained by reading the feedback signal is recorded as DT2 , and the number of pulses obtained by reading the command signal is recorded as DT3 . Therefore, when the motor tracks the input pulse frequency, the speed of the motor should be v = (12) The value of the error accumulator ΔS is ΔS=[DT3(iT)spdt2-DT2(iT)spdt1](13) When the motor runs at a steady speed at a fixed input frequency, its dynamic balance equation is: DT3(iT)spdt2-DT2(iT)spdt1=0(14) At this time, the value in ΔS is the retention pulse and needs to be output in full . 3.3 Hardware interface circuit for command pulse input The command pulse is generated by the upper controller, and its format is a command pulse sequence and a direction signal. When designing the hardware interface circuit, the anti-interference of the circuit is considered first, so the differential input form is adopted in the design, and the differential drive chip is AM26LS31. In addition, since the entire control circuit is implemented with a DSP chip, the electrical isolation of the control circuit and other interface circuits must be considered. Here, a 6N137 optical coupler is selected to achieve electrical isolation. Figure 3 is the interface circuit diagram of the command pulse and DSP. Figure 3 Hardware interface circuit of command pulse In Figure 3, the pulse sequence first passes through the differential drive chip AM26LS31 to generate two complementary pulse signals, which are then isolated from the DSP control chip through an optocoupler. This design satisfies both the anti-interference and isolation of the circuit. The interface circuit for the direction signal input is similar to Figure 3. 4 Experiments The servo system in this paper adopts an AC permanent magnet synchronous servo motor with a rated power of 2.5kW, a rated current of 10A, a rated speed of 2000r/min, a rated torque of 6N·m, a stator inductance of 8.5mH, and a stator resistance of 2.8Ω. In the experiment, the power module adopts the PM30RSF060 intelligent module of Mitsubishi Corporation, the input voltage is AC220V, the switching frequency is 15kHz, the position loop sampling period is T=333μs, and the angle feedback adopts a photoelectric encoder with 2500 pulses/turn, and 4 times the frequency is used. Figure 4 shows the positioning process of the servo system under no-load conditions, in which the angle of the motor is determined by the given number of pulses. It is obtained through serial communication. In Figure 4, the horizontal axis represents the time axis, the value represents the number of points, the distance between the two points is 2ms, and the vertical axis represents the position scale of the motor. It can be seen from the figure that the motor has no position overshoot during the positioning process, and the entire positioning process is completed in about 50ms, which meets the actual application requirements. Figure 4 Positioning process of servo system 5 Conclusion This paper analyzes the structure of the servo system position loop and gives a method to implement the position loop by software. At the same time, through the analysis of the principle of electronic gears, the design method of electronic gears and the hardware interface circuit are given. The experimental results show that the designed position loop and electronic gear have the characteristics of no overshoot and precise positioning in the positioning process, and have a high positioning speed. Therefore, this design method is suitable for high-performance servo positioning systems.
|