CN-122001506-A - Servo driver clock synchronization and position reconstruction method based on CANBUS bus
Abstract
The invention discloses a servo driver clock synchronization and position reconstruction method based on a CANBUS bus. The method mainly solves the problems of clock synchronization and position reconstruction of the servo driver. The clock synchronization is realized by adjusting the period of PWM gradually, and the position reconstruction is realized by compensating the gap between the main shaft and the slave shaft through formula calculation. Compared with the prior art, the invention can solve the problem of poor interference of the traditional pulse synchronization mode, has lower cost and simple structure compared with a synchronization system based on the real-time industrial Ethernet, is a solution with high cost performance and has strong practicability.
Inventors
- BAO XIAOMING
- MA FENGLI
- ZHENG XIAOXIANG
- WEI JUN
- GAO KAIYUAN
- LI WEIJIAN
Assignees
- 中国电建集团华东勘测设计研究院有限公司
- 杭州华辰电力控制工程有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20240202
Claims (6)
- 1. A servo driver clock synchronization and position reconstruction method based on CANBUS bus is characterized by comprising the following steps: S1, using a DSP chip with a CANBUS transceiver as a main control CPU, and configuring a main shaft and an auxiliary shaft to adopt the same system clock frequency and symmetrical PWM and have the same PWM period, opening PWM period interruption and underflow interruption, using a timer in the DSP chip as a task clock timer, wherein the timer runs in a free counting mode, the count value is cleared in the underflow interruption of PWM, and the count value of the timer represents the local clock phase of the servo driver; S2, the main shaft servo driver uses the underflow interruption as the starting time t 0 of the PWM period, and broadcasts and transmits a CANBUS synchronous message, the ith slave shaft servo driver receives the CANBUS synchronous message, the receiving time is recorded as t si , and the synchronous message is opened to receive the interruption; S3, calculating clock phase difference delta t i of the main shaft and the ith slave shaft, and adjusting the slave shaft PWM clock phase according to the clock phase difference delta t i to realize PWM phase synchronization.
- 2. The method for clock synchronization and position reconstruction of a servo driver based on a CANBUS bus according to claim 1, wherein in step S3, a clock phase difference Deltat i =t d -t si between a main shaft and an i-th slave shaft is calculated, wherein t d is the time elapsed between the time t 0 and the time when the clock of the slave shaft is read, the slave shaft PWM clock phase is adjusted, if Deltat i >0, the PWM cycle time of the next beat is reduced to finish the PWM of the next beat in advance, and if Deltat i <0, the PWM cycle time of the next beat is increased to finish the PWM delay of the next beat, so that PWM phase synchronization is realized.
- 3. The method for CANBUS bus based servo driver clock synchronization and position reconstruction as recited in claim 2 wherein the time value of increase or decrease in adjusting the slave axis PWM clock phase is Deltat i /2.
- 4. The method for clock synchronization and position reconstruction of a servo driver based on a CANBUS bus according to claim 1, wherein clock synchronization is performed a plurality of times during initialization of the servo driver, an average value of a phase difference Deltat i is calculated to obtain a more accurate synchronization effect, and phase difference measurement is performed at fixed time during operation after the initialization is completed to compensate for influence of environmental change on transmission delay and clock accuracy.
- 5. The method for clock synchronization and position reconstruction of a CANBUS bus based servo driver of claim 1 wherein the spindle servo driver broadcasts CANBUS data messages for position compensation and reconstruction, the data frame format of the CANBUS data messages comprising { V, P, ΔP k ,ΔP′ k }, wherein: V is the current Speed of the main shaft; p is the current Position of the main shaft; ΔP k =P k -P k-1 is the Position change Δposition within two interpolation periods of the main shaft; ΔP' k =ΔP k -ΔP k-1 is the change rate of the Position change Δposition within two interpolation periods of the main axis, and corresponds to the second derivative of the Position and is equivalent to acceleration.
- 6. The method for clock synchronization and position reconstruction of CANBUS bus based servo driver of claim 5 wherein the steps of performing position compensation and reconstruction of communication delay and data loss in each interpolation period are as follows: (1) reading a CANBUS register from a shaft, if new data is successfully received, turning to the step (2), and if no new data is received, turning to the step (3); (2) The new data is successfully received, which indicates that the slave axis receives the position related data from the main axis servo driver through the CANBUS data message, the given position of the slave axis is calculated according to the formula (1), and then the step (4) is carried out; Wherein: Representing a given position of the kth cycle from the shaft; P Master is the spindle position received from the spindle via CANBUS; P comp (k) is the calculated position compensation quantity, T s is the interpolation period, and T d is the communication delay; (3) If no data is received in the current interpolation period, reconstructing a given position of the shaft according to the formula (2), and then turning to the step (4); Wherein: Representing a given position of the kth cycle from the shaft; representing a given position of the shaft for a previous cycle; P comp (k) is the calculated position compensation quantity, T s is the interpolation period, and T d is the communication delay; P comp (k-1) is the position compensation amount calculated in the previous cycle; (4) The slave axis servo driver adjusts the position of the motor according to the given position of the slave axis, and the next cycle starts from step (1).
Description
Servo driver clock synchronization and position reconstruction method based on CANBUS bus Technical Field The invention relates to the technical field of multi-axis synchronous motion control, in particular to a servo driver clock synchronization and position reconstruction method based on a CANBUS bus. Background As shown in fig. 1, a typical multi-axis synchronous motion control system consists of a plurality of servo units, servo motors, a motion controller and a synchronous network. The multi-axis synchronous control system is a multi-input multi-output, strong-coupling and nonlinear system, and can control displacement deviation among multiple motors through multi-axis synchronization. The method is widely used in the important fields of packaging machines, color printing, textile machines, flying shears, papermaking machines, precision machine tools, industrial robots, high-speed elevators and the like, wherein the automation degree is high, a plurality of motors are required to work synchronously in a coordinated manner, and parameters such as positions, speeds, moments and the like are accurately controlled. Synchronous motion control is evolving towards networking, integration, intellectualization, etc. The control mode for realizing multi-axis synchronization comprises a traditional pulse mode and a novel field bus mode. The servo system designed by adopting the traditional pulse mode is easy to introduce interference, the design has extremely high wiring requirement on the pulse, high-cost differential transmission and electromagnetic shielding are often required, the interference pulse is introduced by a little carelessness, position errors are generated, and the system can not normally operate when serious. The other mode for realizing multi-axis synchronization adopts real-time industrial Ethernet technologies such as EtherCat and Profinet, and has obvious advantages in the aspects of anti-interference, response time and the like, but has the advantages of complex development, higher cost, needs special integrated circuit (ASIC) support, and must depend on an upper computer system, so that point-to-point information transmission cannot be realized. The controller area network CANBUS bus has the advantages of high reliability, mature technology, convenient development, low cost and the like, and is widely applied to economical occasions. CANBUS has a unique "multi-master" feature compared to other fieldbuses, enabling communication between any node within the network. Disclosure of Invention Aiming at the defects of complex pulse mode wiring, easy loss of pulses, poor anti-interference capability, high real-time Ethernet cost and other schemes, the invention provides a servo driver clock synchronization and position reconstruction method based on a CANBUS bus. In particular to a control method for realizing the motion synchronization between a main shaft and an auxiliary shaft by using a multi-shaft synchronous servo system. The aim of the invention is achieved by the following technical scheme. A CANBUS-based servo driver clock synchronization and position reconstruction method, the method comprising the steps of: S1, using a DSP chip with a CANBUS transceiver as a main control CPU, and configuring a main shaft and an auxiliary shaft to adopt the same system clock frequency and symmetrical PWM and have the same PWM period, opening PWM period interruption and underflow interruption, using a timer in the DSP chip as a task clock timer, wherein the timer runs in a free counting mode, the count value is cleared in the underflow interruption of PWM, and the count value of the timer represents the local clock phase of the servo driver; S2, the main shaft servo driver uses the underflow interruption as the starting time t 0 of the PWM period, and broadcasts and transmits a CANBUS synchronous message, the ith slave shaft servo driver receives the CANBUS synchronous message, the receiving time is recorded as t si, and the synchronous message is opened to receive the interruption; S3, calculating clock phase difference delta t i of the main shaft and the ith slave shaft, and adjusting the slave shaft PWM clock phase according to the clock phase difference delta t i to realize PWM phase synchronization. Further, in step S3, the clock phase difference Deltat i=td-tsi between the main shaft and the ith slave shaft is calculated, wherein t d is the time elapsed between the time t 0 and the time when the clock of the slave shaft is read, the slave shaft PWM clock phase is adjusted, if Deltat i >0, the PWM cycle time of the next beat is reduced to enable the PWM of the next beat to be finished in advance, and if Deltat i <0, the PWM cycle time of the next beat is increased to enable the PWM delay of the next beat to be finished, so that PWM phase synchronization is realized. Further, the time value of the increase or decrease in the process of adjusting the phase of the slave axis PWM clock is Deltat i/2. Fur