CN116455501A - Data frame synchronous communication method, system and numerical control machine tool - Google Patents

Data frame synchronous communication method, system and numerical control machine tool Download PDF

Info

Publication number
CN116455501A
CN116455501A CN202310398383.1A CN202310398383A CN116455501A CN 116455501 A CN116455501 A CN 116455501A CN 202310398383 A CN202310398383 A CN 202310398383A CN 116455501 A CN116455501 A CN 116455501A
Authority
CN
China
Prior art keywords
numerical control
time
control system
interval
servo
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310398383.1A
Other languages
Chinese (zh)
Inventor
王太勇
曹立波
董靖川
赵志丹
田冲
韩超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianjin University
Original Assignee
Tianjin University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianjin University filed Critical Tianjin University
Priority to CN202310398383.1A priority Critical patent/CN116455501A/en
Publication of CN116455501A publication Critical patent/CN116455501A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0658Clock or time synchronisation among packet nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0682Clock or time synchronisation in a network by delay compensation, e.g. by compensation of propagation delay or variations thereof, by ranging
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Numerical Control (AREA)

Abstract

The invention belongs to the technical field of numerical control data processing in mechanical manufacturing engineering, and discloses a data frame synchronous communication method, a system and a numerical control machine tool. The data frame synchronous communication method comprises the following steps: the master station interrupt time is adjusted to realize master-slave synchronization of the real-time Ethernet protocol EtherCAT; obtaining clock deviation of a master station and a slave station by using time measurement of the slave station; the period of the master station is adjusted to make the deviation stable in half of the interpolation period T s And/2. The invention provides a clock synchronization mechanism based on a reference slave station stabilization sync 0. Sync0 is very stable with little jitter, only tens of ns. The master station adjusts the triggering time in the interpolation period to adaptively and dynamically solve the problem of packet loss caused by the asynchronous master-slave operation. In addition, the proposed method adds little computational and communication load, and can modify the EtherCAT frame by only adding 4 bytes in the interpolation period.

Description

Data frame synchronous communication method, system and numerical control machine tool
Technical Field
The invention belongs to the technical field of numerical control data processing in mechanical manufacturing engineering, and particularly relates to a data frame synchronous communication method, a system and a numerical control machine tool.
Background
EtherCAT is a real-time Ethernet protocol specially designed for industry and has the characteristic of high communication efficiency. Many scientific articles about EtherCAT are emerging in the mechanical field due to excellent real-time communication performance. Heretofore, chen Xu proposed a new method for synchronizing the master clock with the reference clock on Windows. Other scholars, such as s.park, introduced a new synchronization algorithm on Linux. Some papers introduce a high-precision time synchronization method of a numerical control platform based on DSP+FPGA. Some articles embed the synchronization frame into the EtherCAT frame, so that the synchronization precision of the EtherCAT master-slave station is improved. In addition, some scholars focus on analysis of distributed clocks. An article on the accuracy of EtherCAT distributed clocking schemes analyzed from several aspects of distributed clocking schemes. Some papers focus on improving synchronization performance in EtherCAT, and despite the distributed synchronization mechanism between EtherCAT slaves, synchronization errors still exist between them. For this reason, this article proposes a method of reducing errors. Some articles propose an evaluation method to evaluate the distributed synchronization performance of EtherCAT. Some articles consider many possible influencing factors. Some articles measure and evaluate the accuracy of a distributed clock mechanism in a real network. Sung is interested in the process delay of EPU.
The distributed clock mechanism has excellent performance in a driving system composed of servo, but few students study EtherCAT synchronous mechanism between the numerical control system and the servo, and the numerical control system and the servo present a chain structure, and the synchronous mechanism applied to an embedded numerical control system without an Operating System (OS) is less.
Furthermore, etherCAT has been widely used in the field of motion control due to its advantages of high-speed transmission of 100Mbps or 1000Mbps, low processor occupancy, good synchronization performance, and the like. The distributed clock synchronization mechanism shows stronger performance among the slave stations, but the clock synchronization method between the master station and the slave station is still blank, and less research is performed in the field.
Through the above analysis, the problems and defects existing in the prior art are as follows: in machine tool control, the control synchronization precision is low, and the time (beat) synchronization between a numerical control system and a servo system of an embedded architecture cannot be effectively solved, so that further work cannot be performed for synchronous cutting more accurately; in the prior art, the master station can not adaptively and dynamically solve the problem of data packet loss easily caused by the asynchronous master station and the slave station when adjusting the trigger time in the interpolation period, so that the synchronous performance in the machine tool processing is poor and the processing precision is low.
Disclosure of Invention
In order to overcome the problems in the related art, the disclosed embodiment of the invention provides a data frame synchronous communication method, a system and a numerical control machine tool, and particularly relates to a data frame synchronous communication method based on an EtherCAT bus in an embedded numerical control system.
The technical scheme is as follows: the data frame synchronous communication method is used for a numerical control system and a reference servo of a distributed architecture, and comprises the following steps:
s1, realizing master-slave synchronization of a real-time Ethernet protocol EtherCAT by adjusting the interrupt time of a master station;
s2, obtaining clock deviation of a master station and a slave station by using time measurement of the slave station;
s3, adjusting the period of the master station to ensure that the deviation is stabilized at half an interpolation period T s And/2.
In step S1, the master-slave synchronization of the real-time ethernet protocol EtherCAT is implemented by adjusting the interrupt time of the master station, which includes:
the master station is a numerical control system, and obtains the time t of periodically triggering interruption from a servo driver interrupt IO data processing time T IO Calculation time T of numerical control system CNC_calc The method of (2) eliminating the time t of periodically triggering the interrupt interrupt IO data processing time T IO Calculation time T of numerical control system CNC_calc And time t at which the servo slave periodically triggers sync0 sync0 Deviation between t sm The timing of receiving the command position by the servo driver after the CNC sends the command position is acquired from a servo driver register by the FPRD command; time t when a servo compliant station receives a data frame sm Formula (VI)The method comprises the following steps:
t sm =t interrupt +T IO +T CNC_calc +T Frame +T Wire_delay
T safety_interval the updating is as follows:
T safety_interval =t sync0 -t sm +T Wire_delay
in IO data processing time T IO Calculation time T of numerical control system CNC_calc And the time overhead T of loading data frames by the master station of the numerical control system Frame Vanishing and transfer delay T Wire_delay Is irrelevant to a numerical control system; t (T) safety_interval Is a safe interval, T wire_delay Is the transmission delay.
In step S2, obtaining a master-slave clock bias using the slave time measurement includes:
the slave station includes a plurality of servo compliant stations, a first servo compliant station serving as a reference servo;
the numerical control system modifies the communication period according to the sync0 of the reference servo, and the numerical control system starts time t with the task of the servo period sync0 For reference, and at a distance from the servo period task start time t sync0 Is used for transmitting a data packet t by a numerical control master station transmit Transmitting command positions at the moment; t (T) interupt The time when the period interrupt is generated in ARM; after interruption, the numerical control system loads IO data into a communication buffer zone, and then the numerical control system processes the IO data and at t transmit Transmitting IO data frames to a real-time Ethernet protocol EtherCAT by using a time-oriented cross Ethernet; IO data processing time T IO And calculation time T of numerical control system CNC_calc Obtained by a timer in a numerical control system; transmission delay T wire_delay After time delay, the reference servo receives the IO data of the command position, T represents a moment, and T represents a time interval; if the command position is at t sync0 Previously sent, namely:
T safety_interval =t sync0 -t sm +T wire_delay >0
wherein T is safety_interval Is a safe interval, t sync0 Is the moment, t, at which the servo slave generates the sync0 signal transmit Is the time t of the data packet transmitted by the numerical control master station sm Is the moment when the servo slave station receives the data frame sent by the numerical control system, T wire_delay Is a transmission delay as long as it is within the safe interval T safety_interval And if the data is sent internally, the data is not lost.
In one embodiment, the reference servo is at t sm The command position is received after a period of time, namely t sync0 -t sm Then at t sync0 The process enters a periodic task; if when the drive system is at t sync0 When the command position is acquired, the numerical control system does not send the command position, and the lost data packet occurs; the time response of receiving the command position becomes smaller or larger if t sync0 -t sm If the result of (2) is less than zero, packet loss occurs; if t sync0 -t sm And (2) the data packet is not lost if the result is constant, wherein the constant reference safety interval expression is:
t sync0 -t sm =T refs_interval =T s /2
wherein T is refs_interval For reference to safe interval, T s For interpolation period, T s And/2 is half an interpolation period.
In step S3, the master period is adjusted to stabilize the deviation at half the interpolation period T s Included in/2 are: compensating between the numerical control system and the reference servo, and ensuring a safety interval T safety_interval And a reference safety interval T refs_interval The larger one decides whether to trigger the interpolation period of the numerical control system in advance or in delay; the safety interval is:
T safety_interval =t sm -t sync0 +T wire_delay
wherein T is safety_interval Is a safe interval, t sm The time when the servo slave station receives the data frame sent by the numerical control system; t is t sync0 Is the moment the servo slave generates the sync0 signal; t is t sm And t sync0 From reference servo by FPRD commandObtaining in a register; t (T) wire_delay Is the transmission delay.
In one embodiment, the compensation between the numerical control system and the reference servo specifically includes:
if the safety interval T safety_interval Greater than the reference safety interval T refs_zone The clock frequency of the numerical control system is greater than that of the reference servo, then t sm And the numerical control system delays triggering the interpolation period, otherwise, the numerical control system triggers the interpolation period in advance.
In one embodiment, the average precompensation in a numerical control systemThe formula is:
in the method, in the process of the invention,is the average precompensated length s CNC Sum s ref_s The sum of n interpolation periods in CNC master station and reference servo, respectively, +.>Is the pre-compensation amount of the servo slave station, +. >Is the sign of the pre-compensation amount of the servo slave.
In one embodiment, the compensation length T of the numerical control system compensation Is the average precompensated lengthAnd the compensatory length T remaining in the interpolation period remain_interval The minimum value between the two is expressed as:
wherein T is compensation Is the compensation length, T CNC Is the communication period of the numerical control system, T ref Is a communication period of a reference servo compliant station, T safety_interval Is a safe interval, T refs_interval Is a reference safety interval, T frame Is 5 mu s overhead plus 80ns time overhead per byte of data, T IO Is IO data processing time, T CNC_calc Is the calculation time of the numerical control master station, N is the period number, T remain_interval Is the compensatory length remaining in the interpolation period.
Another object of the present invention is to provide a data frame synchronization communication system for implementing the data frame synchronization communication method, the system comprising:
the master-slave synchronization module is used for realizing master-slave synchronization of the real-time Ethernet protocol EtherCAT by adjusting the interrupt time of the master station;
the master-slave station clock deviation acquisition module is used for acquiring master-slave station clock deviation by using slave station time measurement;
a deviation stabilizing module for adjusting the period of the master station to stabilize the deviation in half the interpolation period T s And/2.
Another object of the present invention is to provide a numerically-controlled machine tool for implementing the data frame synchronous communication method, where the numerically-controlled machine tool includes a master station and five slave stations composed of servos, the five servos communicate with the master station in a chain structure, the master station operates in the numerically-controlled system, and the first slave station is a reference servo.
By combining all the technical schemes, the invention has the advantages and positive effects that: aiming at the technical problems in the prior art and the difficulty in solving the problems, the technical problems solved by the technical proposal of the invention and the results, data and the like in the research and development process are closely combined, the technical problems solved by the technical proposal of the invention are analyzed in detail, and some creative technical effects brought after the problems are solved are specifically described as follows:
the present invention is different from the prior art in that the adjustment of the interpolation period control amount is based on PD control, and the present invention is based on the adjustment amount set by the deviation speed.
The main object of the prior art is mainly to be oriented to a numerical control machine tool, and the invention can be applied to various fields with real-time control requirements, such as controllers and the like; the invention can be industrial products such as a motion controller, a PLC controller and the like.
The object oriented in the prior art is based on an embedded system architecture, and the invention is not limited to an embedded architecture system, and is applicable to any architecture system for adjusting the communication period.
The ASA method provided by the invention takes the stable sync0 of the servo as a reference, and adaptively adjusts the interpolation period of the numerical control system, so that the problem of time synchronization between the numerical control system and the reference slave station in the distributed architecture is effectively solved.
The invention provides a concept of a safe zone, which ensures that the time of a command position sent by a numerical control system always differs from sync0 by about T s /2. Whether the numerical control clock is faster than the servo clock or the numerical control clock is slower than the servo clock, the method can effectively ensure that the servo enters the periodic task time t sync0 The numerical control system may be at a distance T from sync0 s And/2, sending the command position finished in advance. The problem of packet loss is effectively solved by ASA.
Experiment 1 of the present invention was conducted with ASA method and comparative experiment without any synchronization method, and it can be seen from FIG. 11 that in case of non-synchronization, the synchronization error is the actual safety interval T safety_interval With reference to a safe area T refs_interval The deviation of the (d) is always fluctuated, the trend is gradually increased, and finally, a plurality of interpolation periods are deviated between the numerical control system and the reference servo, so that data packets are lost, and contour errors are caused. The experimental time is only 300 cycles, if the interpolation period is 2ms, i.e. 600ms, the synchronization error has reached about 30 mus. With the trend of increasing synchronization errors, a deviation of one interpolation period size occurs at 20000 interpolation periods. That is, when the time is 40s, one packet loss occurs. The numerical control system cannot at all And (5) stable processing. However, by adopting the ASA method, the synchronization error always fluctuates around 0, and stable processing is ensured. As can be seen from fig. 11, the use of ASA can significantly improve the synchronization performance between CNC and the reference slave, verifying the effectiveness of the ASA method in compensating in a numerical control system. Meanwhile, the algorithm enriches the synchronization method applicable to the embedded platform without an operating system.
The synchronization performance of the asynchronous, ACF and ASA methods was compared by the comparative experiment of experiment 1. Without the synchronization mechanism, time drift between the numerical control system and the drive system occurs in each interpolation period and even varies by a few periods due to accumulation. The same applies to ACF. But with ASA, the numerical control system and the drive system can achieve good synchronization performance.
In experiment 2, the ASA method provided by the invention shows good performance in different interpolation periods of 500 mu s, 1ms and 2ms, and the average synchronization precision can reach 32-71ns. Furthermore, the synchronization accuracy can be controlled.
The method of the invention adds little computational load, and the formula (2) is used for obtaining the length T of the compensation interval compenate While FPRD cmd increases the traffic load of only four bytes. It can be concluded that as the processor frequency increases, the synchronization accuracy can also be further improved. Therefore, the ASA method can effectively solve the problem of time (beat) synchronization between the numerical control system and the servo system of the embedded architecture, and further work can be more accurate in synchronization mechanism and compared with a real cutting experiment.
Considering the technical scheme as a whole or from the perspective of products, the technical scheme to be protected has the technical effects and advantages as follows: etherCAT is a real-time ethernet protocol with transmission rates up to 100Mbps or 1000 Mbps. With its excellent Distributed Clock (DC) synchronization mechanism, it is widely used in the field of industrial control. The distributed clock synchronization mechanism is built into the slave chip ET1100 and is used in large numbers by the master servo driver slave vendor. However, the CNC master station cannot directly use the ET1100 slave station chip, and exhibits excellent synchronization performance of the distributed clock. For a numerical control system master station without a real-time operating system (RTOS), the reliability of communication cannot be guaranteed. In order to realize the purpose of applying the EtherCAT with high real-time and high bandwidth to the numerical control field, the invention provides a processing position self-adaptive synchronous control method between a numerical control system and a servo driver, which starts with a distributed clock synchronous mechanism and displays the outstanding synchronous characteristic of the servo driver from stations. Then, the phenomenon that data packets are lost due to the fact that the master station of the numerical control system and the slave stations of the servo driver are out of synchronization is analyzed, and the numerical control system cannot stably process. The reason of the packet loss phenomenon is analyzed, and a safety interval concept and a master-slave self-adaptive synchronization method based on sync0 are provided. Finally, the data transmission delay between the numerical control system and the servo driver is eliminated, the loss phenomenon of the communication data packet is eliminated, and the synchronous control of the position information between the numerical control system and the servo driver is realized. And the application of the EtherCAT master station is promoted to a brand new height, so that the EtherCAT master station is completely separated from a real-time operating system. The applicability of the whole algorithm is verified through experiments.
The ASA method uses stable sync0 of a reference servo driver as a reference, and adjusts the interpolation period T in a self-adaptive way s And pre-compensation is carried out, so that the problem of packet loss caused by asynchronous time between the numerical control system and the reference servo driver is effectively solved, and the data transmission delay is eliminated. The concept of a safe interval is presented. The safety interval ensures that the instant at which the CNC issues the commanded position is always about T from sync0 s 2, no matter the CNC clock is faster than the reference servo clock or the CNC clock is slower than the reference servo clock, the method can effectively ensure that at t sync0 The CNC may be advanced by a distance of sync 0T when the servo enters the periodic task s And (2) sending the command position completed at the moment, thereby solving the problem of message loss. The comparative experiment of experiment 1 shows that the ASA method can effectively solve the problem of packet loss. Without synchronization, the numerical control system and servo driver may drift in time during each interpolation period, and over time, the cumulative drift may even be several periods. However, with ASA, CNC and servo drives have good synchronization performance. In the comparison experiment of MSTS, ASA synchronization is wrong if the comparison experiment is not limited by an interrupt moduleThe difference was 4.182 times lower than MSTS. In addition, the algorithm is not limited by a real-time system, so that the packet loss phenomenon is solved, and the processing is accurate. Moreover, the time spent taking the average of multiple (e.g., 500) measurements is almost half less ASA than MSTS. The result of experiment three shows that the algorithm is suitable for servo drives of different brands or factories. In experiment four, under different interpolation periods of 500 mu s, 1ms and 2ms, the ASA method provided herein shows good synchronization performance, and the average synchronization precision can reach 32-71ns. Importantly, ASA promotes EtherCAT to a brand new level, and completely realizes that the EtherCAT master station does not depend on RTOS any more. It is superior to the previous study of scholars. Moreover, the method is based on a simple arithmetic series summation formula, and accurate pre-compensation delta T is obtained in a way of hardly increasing the calculation amount pre-compensation . Only two or four bytes need to be added to the FPRD command, which hardly increases the communication load. In addition, the CNC master station transmits command position and the servo reception command position have a common reference t sync0 Accumulated errors generated by absolute time of CNC and reference servo relatively independent are eliminated. As the processor frequency increases, the synchronization accuracy can increase to 1ns. Therefore, the ASA method can effectively solve the problem of time (beat) synchronization of an embedded numerical control system without an operating system and a servo driver. The method can also be used for time-synchronized communication of a distributed multi-master system.
Compared with the prior art, the invention has the advantages that: the invention provides a clock synchronization mechanism based on a reference slave station stabilization sync 0. sync0 is very stable with little jitter, only a few tens of ns. The master station adjusts the triggering time in the interpolation period to adaptively and dynamically solve the problem of packet loss caused by the asynchronous master-slave operation. Furthermore, the proposed method adds little computational and communication load, only 4 bytes in the interpolation period. The EtherCAT frame can be modified. Experiments on machine tools prove that the method has the advantage of improving the synchronous performance, and the average frame jitter is only 32-71ns.
The invention ensures that the EtherCAT master station is not limited to a real-time operation system, and widens the application range. The invention provides an Adaptive Synchronization Algorithm (ASA) for an embedded numerical control system and a reference servo of a distributed architecture. The synchronization mechanism provided by the invention can adaptively and dynamically adjust the interpolation period to replace an adjustment clock so as to improve the processing precision and synchronously fill the gap of the EtherCAT protocol. The proposed method adds little computational and communication load and only requires the addition of four bytes in the interpolation period to modify the EtherCAT frame. The invention solves the problem that EtherCAT is limited by a real-time operating system.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure;
fig. 1 is a flowchart of a data frame synchronization communication method provided in an embodiment of the present invention;
fig. 2 is a schematic diagram of a data frame synchronous communication method according to an embodiment of the present invention;
FIG. 3 is a block diagram of EtherCAT data frames provided by an embodiment of the present invention;
FIG. 4 is a diagram illustrating analysis of the cause of packet loss according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a clock model of a numerical control system and a driving system provided by an embodiment of the present invention;
FIG. 6 is a schematic diagram of temperature drift of a clock source provided by an embodiment of the present invention;
FIG. 7 is a schematic diagram of communication timing of a data frame transmitted from a numerical control system to a drive system according to an embodiment of the present invention;
FIG. 8 is a schematic diagram of a reference safety interval according to an embodiment of the present invention;
FIG. 9 is a flowchart of an ASA algorithm provided by an embodiment of the present invention;
FIG. 10 is a schematic diagram of an axial experiment platform provided by an embodiment of the present invention;
FIG. 11 is a schematic diagram of a secure interval-based ASA provided by an embodiment of the present invention;
FIG. 12 is a schematic diagram of a safe interval transfer to a servo driver provided by an embodiment of the present invention;
FIG. 13 shows a half interpolation period T provided by an embodiment of the present invention s Reference is made to the safety zone length schematic diagram.
Detailed Description
In order that the above objects, features and advantages of the invention will be readily understood, a more particular description of the invention will be rendered by reference to the appended drawings. In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention. The invention may be embodied in many other forms than described herein and similarly modified by those skilled in the art without departing from the spirit or scope of the invention, which is therefore not limited to the specific embodiments disclosed below.
Embodiment 1, as shown in fig. 1, the data frame synchronous communication method provided by the embodiment of the invention is used for an embedded numerical control system and a reference servo of a distributed architecture, and comprises the following steps:
s1, realizing master-slave synchronization of a real-time Ethernet protocol EtherCAT by adjusting the interrupt time of a master station; the EtherCAT master station is completely separated from the limitation of a real-time system.
S2, obtaining clock deviation of a master station and a slave station by using time measurement of the slave station; the traditional master-slave station time bias uses the master station time minus the slave station bias, with an inherent bias. The method completely eliminates the inherent deviation of the two, and realizes accurate measurement of the deviation.
S3, adjusting the period of the master station to ensure that the deviation is stabilized at half an interpolation period T s And/2.
In the embodiment of the present invention, in step S1, the master station is a digital control system; in step S2, the secondary station includes a plurality of servo compliant stations, a first servo compliant station being a reference servo.
In the embodiment of the present invention, fig. 2 is a schematic diagram of a data frame synchronization communication method according to the embodiment of the present invention.
In step S1 of the embodiment of the present invention, by adjusting the interruption time of the master station, the master-slave synchronization of the real-time ethernet protocol EtherCAT is implemented, including:
to solve the problem of numerical control system and servo driver The problem of data packet loss between the two is solved, the data transmission delay between the two is eliminated, the ASA dynamically modifies the interpolation period of the numerical control system, and the aim of time synchronization with the reference servo is fulfilled. As described above, the numerical control system modifies its own interpolation period according to sync0 of the reference servo. In FIG. 11, t interrupt Is the interruption time, t, of the interpolation period in ARM transmit The time when the data packet is sent by the numerical control master station. t is t interrupt After completion, CNC loads IO data into the communication buffer, processes the IO data and at T transmit And transmitting the IO data frames to the Ethernet through the crossed Ethernet line at the moment. CNC system at start time t of servo cycle task sync0 Based on, far from t sync0 T of (2) transmit And sending the command position to the network at any time, receiving IO data of the command position by the servo driver, delaying for a period of time, and entering the task period. T represents a moment and T is a time interval. If the command position is at t sync0 Previously sent, namely:
T safety_interval =t sync0 -(t interrupt +T IO +T CNC_calc +T Frame )>0
no packet loss occurs. t is t transmit And t sync0 The interval between them is called T safety_interval 。t sync0 Can be retrieved from the driver registers by FPRD cmd.
However, t interrupt T is as follows IO And T CNC_calc All from CNC system, t sync0 Then from the servo driver. Due to the difference of clock sources, t interrupt And t sync0 There is still a deviation between them. The present invention therefore proposes a method that does not obtain t from the CNC system interrupt 、T IO And T CNC_calc And time t of periodically triggering interrupt is obtained from servo driver interrupt IO data processing time T IO Calculation time T of numerical control system CNC_calc The method of (2) eliminating the time t of periodically triggering the interrupt interrupt IO data processing time T IO Calculation time T of numerical control system CNC_calc And servo slave station circumferenceTime t of periodic trigger sync0 sync0 Deviation between t sm The moment when the servo driver receives the command position after the CNC sends the command position is directly obtained from a servo driver register by the FPRD command; time t when a servo compliant station receives a data frame sm The formula is:
t sm =t interrupt +T IO +T CNC_calc +T Frame +T Wire_delay
T safety_interval the updating is as follows:
T safety_interval =t sync0 -t sm +T Wire_delay
in IO data processing time T IO Calculation time T of numerical control system CNC_calc And the time overhead T of loading data frames by the master station of the numerical control system Frame Vanishing, T Wire_delay Is irrelevant to a numerical control system; t (T) safety_interval Is a safe interval, T wire_delay In addition, the disappearance reduces the calculation amount of the processor for transmission delay and improves the real-time performance.
In step S3 of the embodiment of the invention, the period of the master station is adjusted to stabilize the deviation at half the interpolation period T s And/2.
In FIG. 12, the servo driver is at t sm The command position is received for a period of time, i.e. t sync0 -t sm Then at t sync0 Entering its periodic task if the servo drive is at t sync0 When the command position is received, the CNC system does not send, and the packet loss phenomenon can occur. If the moment when the CNC system issues the command position is early or late, the moment t of receiving the command position sm Small or large. t is t sync0 -t sm The result of (2) is variable if t sync0 -t sm As a result of less than zero, packet loss occurs. If t sync0 -t sm As a result of (a) is a normal number, packet loss is unlikely to occur, if t sync0 -t sm Is a constant and not a variable, the computational burden on the processor will be reduced. Thus, a reference safe area concept is introduced and named T refs_zone
For a suitable length of ASA reference safety zone, in a numerically controlled machine, the clock of the CNC is faster. Thus, t in the formula sm Will be smaller and therefore the safety interval T safety_interval =t sync0 -t sm +T Wire_delay Will be longer. However, for CNC clocks in another numerically controlled machine tool, this results in a safe interval T for the other machine tool safety_interval Will be smaller. Therefore, in order to improve the versatility of ASA to both machine tools, a reasonable reference zone value T needs to be set refs_zone
As shown in fig. 13, assume T refs_zone =T s /2. If in a machine tool, the numerical control system clock is faster than the reference servo clock, then t sm Smaller. However, the command position in the frame must be at t 1,sync0 Then sent by CNC, t 1,sync0 Is the last interpolation period T s Reference is made to the moment at which the servo enters the periodic task. Otherwise, last interpolation period T s The unprocessed command position will be covered, and the data packet loss phenomenon will occur. Therefore, in the last interpolation period, the maximum length of the safety region is T s /2. Even if in another machine tool the numerical control system clock is slower than the reference servo clock, then t sm Larger. The command position in the frame must be at t 2,sync0 Previously sent by CNC. t is t 2,sync0 Is the current interpolation period T s Reference is made to the moment at which the servo enters the periodic task. Otherwise, in the current interpolation period T s The command position can not be received, and the data packet loss phenomenon can also occur. Thus, the maximum length of the safe zone is still T during the current interpolation period s /2。T s The 2-length reference safety zone is significant in both machine tools, so the reference safety zone T refs_zone Is of length T s /2。
Embodiment 2 of the present invention provides an EtherCAT bus master-slave synchronization method for a numerical control system, including:
step 1, packet loss analysis between a numerical control system and a reference servo:
step 1.1, packet loss analysis; the EtherCAT protocol is a special Ethernet protocol, of which Ethernet type 0x88A4 is known, whereas Ethernet type 0x0800 is known for TCP/IP or UDP. EtherCAT frames, also known as packets, are embedded in Ethernet frames, identical to TCP/IP and UDP. As shown in fig. 3, the EtherCAT data frame structure shows that a complete EtherCAT frame is composed of an ethernet frame header, an EtherCAT frame header, and an EtherCAT PDU.
The analysis of the cause of the packet loss is shown in fig. 4. T (T) CNC Is the interpolation period of the numerical control system, T drive Is the interpolation period of the drive system. t is t wire_delay Is the network line delay. If the clock sources of the numerical control system and the driving system are the same, the numerical control system should be at t 1 Where the command position is sent to the drive system, however the numerical control system is at t 2 Where the command location is sent. The reason is that the crystal oscillator frequency of the numerical control system is lower than that of the driving system, resulting in the actual period of time T of the numerical control system CNC In the same interpolation period T s Internal but is greater than T drive . When the drive system receives a command position, however, the numerical control system has not yet sent the command position. This non-synchronization will cause packet loss.
Step 1.2, asynchronization caused by operating frequency difference and start time: the working clock sources of the numerical control system and the driving system are different, which is the main reason of packet loss. The beats of the numerical control system and the driving system are almost impossible to have the same vibration frequency, as shown in the clock model of the numerical control system and the driving system of fig. 5, even though the crystals of the numerical control system and the driving system come from the same model and series, the deviation still exists. To form 8:00 to 8:15 for 15 minutes, i.e. utc+8, also known as beijing time. The actual time for the numerical control system was 14.9 minutes, while the drive system was 15.1 minutes within the same 15 minutes. Deviations in the numerical control system and the driving system cause that the time of the numerical control system for transmitting the command position is inconsistent with the time of the driving system for receiving the command position, and further the command position transmitted by the numerical control system cannot be received by the driving system. In addition, the start-up times of the numerical control system and the drive system are also inconsistent, which results in an initial discrepancy between the numerical control system and the drive system. This difference also causes the timing of the transmission position of the numerical control system and the reception position of the drive system to be inconsistent. Moreover, this difference always exists.
Step 1.3, temperature induced asynchronization: furthermore, there is a phenomenon that the clock frequency of any crystal shifts with temperature. As shown by the temperature drift of the clock source in fig. 6, the clock frequency of the clock of the numerical control system at different temperatures is the same as that of the driving system. The temperature drift phenomenon also causes timing inconsistencies between the digitally controlled system transmit position and the drive system receive position.
To solve this problem, the conventional method is to select one of two clock sources as a reference clock source and the other uses the reference clock as a reference to slightly modify its own beat, but it is very difficult to correct the beat of the clock in many architectures of processors, such as ARM. The ASA (Adaptive synchroniztion algorithm) method provided by the invention can eliminate the deviation between the numerical control system and the driving system without correcting the frequency of the clock source.
Step 2, self-adaptive synchronization algorithm in the numerical control embedded numerical control system: essentially, a missing data packet is an erroneous statement. In fact, the drive system always receives the command position sent by the numerical control system at regular time. The fundamental problem is that the numerical control system does not send command positions in time, as in fig. 4.
Step 2.1, the safety interval of the data packet is not lost: few papers propose adjusting time or clock to achieve synchronization in a distributed architecture, but it is not possible to adjust the time or frequency of a crystal oscillator in an embedded numerical control system. Therefore, the invention proposes to adjust the interpolation period to realize the synchronization between the numerical control system and the servo. There are 3 kinds of distributed clock synchronization mechanisms in the servo and the synchronization accuracy is analyzed. The mechanism to synchronize to sync0 is chosen because sync0 is very stable, with only 12ns jitter. Based on this, the proposed ASA method exploits the very stable sync0 from the reference secondary station, and sync0 is set as a reference to adjust the numerical control system interpolation period.
As shown in fig. 7, is the communication timing of the data frame transmitted from the numerical control system to the drive system. Timing sequenceFrom T io ,T CNC_calc ,T frame ,T wire_delay ,T adjust_time ,T servos_delay Composition is prepared. T (T) io Is the time for loading the IO data into the communication buffer. T (T) CNC_calc Is the transmission time of the numerical control. T (T) frame The time T of transmitting IO data frames to the Ethernet through the crossed Ethernet cable frame About 5 mus overhead plus 80ns per byte overhead. T (T) wire_delay Is the frame delay time from the digitally controlled system to the drive system, known as wire delay, at a delay of 1 mus for 100BASE-TX and a line delay of about 5 ns/m. T (T) adjust_time The time for dealing with the asynchronous problem by adjusting the period is in the numerical control system. T (T) servos_delay Is the delay time of the servo system. T (T) servos_delay May be set independently by each servo, typically 0.
To solve the problem of packet loss between the numerical control system and the drive system, ASA can dynamically modify the period of the numerical control system and synchronize to the timing of the reference servo. As described above, the numerical control system modifies its communication period according to sync0 of the reference servo. The numerical control system starts time t with servo period task sync0 For reference, and at a distance from the servo period task start time t sync0 Is used for transmitting a data packet t by a numerical control master station transmit Transmitting command positions at the moment; t (T) interupt The time when the period interrupt is generated in ARM; after interruption, the numerical control system loads IO data into a communication buffer zone, and then the numerical control system processes the IO data and at t transmit Transmitting IO data frames to a real-time Ethernet protocol EtherCAT by using a time-oriented cross Ethernet; t (T) IO And t CNC_calc May be obtained by a timer in the embedded numerical control system. T (T) frame About 5 mus overhead plus 80ns time overhead per byte of data. T (T) wire_delay The drive system will then receive IO data, which are command locations. T (T) wire_delay A 1 mus base delay on 100M ethernet plus a 5ns/M wire delay. T represents a time instant and T represents a time interval. If the command position is at t sync0 Previously sent, namely:
T safety_interval =t sync0 -t sm +T wire_delay >0 (1)
wherein t is sync0 Is the moment, t, at which the servo slave generates the sync0 signal sm The servo compliant station receives the time when the data frame is sent by the numerical control system. So long as it is within interval T safety_interval And if the data is sent internally, the data is not lost.
Step 2.2, reference security interval based on sync 0: as shown in fig. 8 with reference to the safe interval, the drive system is at t sm The command position is received after a period of time, namely t sync0 -t sm Then at t sync0 Where it enters its periodic task. If when the drive system is at t sync0 When the command position is acquired, the numerical control system does not send the command position, and the phenomenon of losing the data packet can occur. The time response of receiving the command position becomes smaller or larger when the time of the numerical control system transmitting the command position is earlier or later. Resulting in t sync0 -t sm The result of (1) is a variable if t sync0 -t sm As a result of less than zero, packet loss may occur. If t sync0 -t sm As a result of a normal number, packet loss is not possible. In addition, if the processor calculates a constant instead of a variable, the computational burden will be reduced. Thus t sync0 -t sm =T refs_interval =T s 2 is set to a constant which can be used as a reference safety interval and is named T refs_interval ,T s For interpolation period, T s And/2 is half an interpolation period.
Step 2.3, compensation range in the embedded numerical control system: including compensation between the numerical control system and the reference servo, as shown in FIG. 9, T safety_interval And T refs_interval The larger one decides whether to advance or retard the interpolation period triggering the numerical control system. The reference safety interval is T refs_interval With a value T s /2. The safety interval is:
T safety_interval =t sm -t sync0 +T wire_delay
t sm is that the drive system receives command bitsTime of placement, t sync0 Is the moment t when the command position is acquired and enters its periodic task in the drive system sm And t sync0 Obtained from a register of a reference servo by an FPRD command, with a transfer delay T wire_delay
The specific principle is shown in fig. 9, and the ASA algorithm comprises: if T safety_interval Greater than T refs_zone Then the clock frequency of the CNC system is greater than the clock frequency of the reference servo. Then t sm The CNC system should delay triggering the interpolation period. Otherwise, the interpolation period is triggered in advance. As shown in the drawing,the adaptive adjustment period cannot be used directly for the CNC of the numerical control system, since it is calculated from the clock of the servo driver. Average precompensation in CNC system>The formula is:
in the method, in the process of the invention,is the average precompensated length s CNC Sum s ref_s The sum of n interpolation periods in CNC master station and reference servo, respectively, +.>Is the pre-compensation amount of the servo slave station, +.>Is the sign of the pre-compensation amount of the servo slave.
In one embodiment, the compensation length T of the numerical control system compensation Is the average precompensated lengthAnd the compensatory length T remaining in the interpolation period remain_interval The minimum value between the two is expressed as:
wherein T is compensation Is the compensation length, T CNC Is the communication period of the numerical control system, T ref Is a communication period of a reference servo compliant station, T safety_interval Is a safe interval, T refs_interval Is a reference safety interval, T frame Is 5 mu s overhead plus 80ns time overhead per byte of data, T IO Is IO data processing time, T CNC_calc Is the calculation time of the numerical control master station, N is the period number, T remain_interval Is the compensatory length remaining in the interpolation period.
Embodiment 3 of the present invention provides a data frame synchronization communication system, including:
the master-slave synchronization module is used for realizing master-slave synchronization of the real-time Ethernet protocol EtherCAT by adjusting the interrupt time of the master station;
the master-slave station clock deviation acquisition module is used for acquiring master-slave station clock deviation by using slave station time measurement;
a deviation stabilizing module for adjusting the period of the master station to stabilize the deviation in half the interpolation period T s And/2.
The content of the information interaction and the execution process between the devices/units and the like is based on the same conception as the method embodiment of the present invention, and specific functions and technical effects brought by the content can be referred to in the method embodiment section, and will not be described herein.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, the specific names of the functional units and modules are only for distinguishing from each other, and are not used for limiting the protection scope of the present invention. For specific working processes of the units and modules in the system, reference may be made to corresponding processes in the foregoing method embodiments.
The data frame synchronous communication method provided by the embodiment of the invention is already applied to the Tianda lean S6 series numerical control system, and the high-performance output of the series numerical control system is realized.
Embodiment 4 of the present invention further provides a computer device, including: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, which when executed by the processor performs the steps of any of the various method embodiments described above.
Embodiments of the present invention also provide a computer readable storage medium storing a computer program which, when executed by a processor, performs the steps of the respective method embodiments described above.
The embodiment of the invention also provides an information data processing terminal, which is used for providing a user input interface to implement the steps in the method embodiments when being implemented on an electronic device, and the information data processing terminal is not limited to a mobile phone, a computer and a switch.
The embodiment of the invention also provides a server, which is used for realizing the steps in the method embodiments when being executed on the electronic device and providing a user input interface.
Embodiments of the present invention provide a computer program product which, when run on an electronic device, causes the electronic device to perform the steps of the method embodiments described above.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application implements all or part of the flow of the method of the above embodiments, and may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, where the computer program, when executed by a processor, may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code to a photographing device/terminal apparatus, recording medium, computer Memory, read-Only Memory (ROM), random access Memory (Random Access Memory, RAM), electrical carrier signals, telecommunications signals, and software distribution media. Such as a U-disk, removable hard disk, magnetic or optical disk, etc.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
In order to verify the positive effects of the data frame synchronous communication method provided by the embodiment of the invention, the following experiment is carried out.
The invention verifies the synchronous performance of the proposed method through experiments. As shown in FIG. 10, the experimental platform is a numerical control machine tool consisting of a numerical control system and five servos, wherein the five servos are in a chain structure, the numerical control system is an EtherCAT master station, the master station is Simle Open EtherCATMaster (SOME) and operates in an STM32H765TI embedded numerical control system, and the frequency of the embedded numerical control system is 400MHz. The five servos are slaves, i.e. drive systems. The first slave is the reference servo.
Experiment 1, ASA method and comparative experiment without any synchronization method were performed. As can be seen from the ASA provided by the embodiment of the invention and the synchronization error experiment without the synchronization algorithm, under the condition of non-synchronization, the synchronization error is the actual safety interval T safety_interval With reference to a safe area T refs_zone The deviation of the (d) is always fluctuated, the trend is gradually increased, and finally, a plurality of interpolation periods are deviated between the numerical control system and the reference servo, so that data packets are lost, and contour errors are caused. The experimental time is only 300 cycles, if the interpolation period is 2ms, i.e. 600ms, the synchronization error has reached about 30 mus. With the trend of increasing synchronization errors, a deviation of one interpolation period size occurs at 20000 interpolation periods. That is, when the time is 40s, one packet loss occurs. The numerical control system cannot stably process at all. However, by adopting the ASA method, the synchronization error always fluctuates around 0, and stable processing is ensured. As can be seen from the ASA provided by the embodiment of the invention and the synchronization error experiment without the synchronization algorithm, the ASA can be used for remarkably improving the synchronization performance between CNC and the reference slave station, and the effectiveness of the ASA method in the compensation in the numerical control system is verified. Meanwhile, the algorithm enriches the synchronization method applicable to the embedded platform without an operating system.
Experiment 2, using a 2m long ethernet cable, measured between the numerical control system and the reference servo was 1.01 mus. The synchronization accuracy of the experiment was 1 mus. T (T) io And T CNC_calc May be obtained by a timer in the embedded numerical control system. T (T) frame About 5 mus overhead plus 80ns overhead per byte of data. T (T) CNC Is the interpolation period. Finally, the compensation interval T compensate The length of the self-adaptive numerical control system can be obtained through the formula (2), and the purpose of the self-adaptive numerical control system interpolation period is achieved.
To further evaluate the synchronization performance of ASA, comparative experiment 2 was established. Park proposes a synchronization method between EtherCAT master and slave stations that translates the offset between master and reference slave stations to the offset in all servo slave stations (master and reference servo to servos, MSTS). MSTS achieves master-slave synchronization by adjusting the time of all servo drives instead of the system time of the master. The experiment was performed in an STM32H7x based embedded system at 400MHz. Thus, the maximum frequency of the master station is 400MHz and the maximum frequency of the timer module in the master station is 200MHz. That is, the maximum accuracy of the master timer is 5ns, so the systematic time error between the master and reference servo is also 5ns in accuracy as delivered to the servo driver by MSTS. While STM32H7x is limited by the interrupt module, the precision of the interrupt module is only 50ns, and the interpolation period of CNC is generated by the interrupt module, so that the interpolation period adjusted by ASA is only a multiple of 50 ns.
Table 1 synchronization error for different methods
Table 1 shows the analysis of ASA and MSTS data, and the results of the ASA and MSTS method provided by the invention show that the MSTS synchronization error is slightly smaller than that of ASA. This is due to the limitations of the master interrupt module. If the ASA accuracy can also be adjusted by 5ns, the synchronization error will be less than the MSTS, as will be explained in detail below. ASA can only adjust the interpolation period T in units of 50ns s This is much greater than the MSTS 5ns adjustment unit. Further, the time accuracy of the servo driver is 1ns unit, and the adjustment amount of 1ns unit is from the time control loop of the ETG. Therefore, the MSTS adjustment unit accuracy is 1-5ns. Equation (3) is the relation between the pre-compensation sequence and the jitter, which can be represented by equation e=t safety_interval -T refs_zone Is known. Jitter is referred to as synchronization error in the experimental part. In equation (4), since n is 500, since the last term e n+1 Subtracting the first term e 1 Is much smaller than 500 synchronization errors e i So approximating equation (4) to equation (5), ignoring the first two terms of equation (4) while the scaling factor k is 1.e, e mean Is the synchronization error e i Average value of the sum. It can therefore be concluded that the average value of the precompensation is proportional to the average synchronization error. Thus, if the interpolation period T s The adjustment unit, i.e. the average precompensation, is reduced by a factor of 10, from 50ns to 5ns,the average synchronization error is also reduced by a factor of 10. The average of multiple measurements was used in the experiment. From the average synchronization error, it can be precisely inferred that if ASA accuracy if the adjustment unit becomes 5ns without being limited by the interrupt module, then the ASA synchronization error 42.296 ns/10=4.23 ns will be much smaller than 17.668ns in MSTS, with a 4.182 fold decrease in synchronization error.
It can be seen that the MSTS uses the master clock as a reference to adjust the time of all servo drives. Therefore, the time accuracy and the machining accuracy of the servo driver are completely dependent on the real-time performance of the master station. If the master station is not a real-time system or the real-time performance of the master station is not good, for example, an experimental platform ARM STM32H7x without RTOS, the interpolation precision and the processing precision are greatly reduced although packet loss does not occur. However, ASA based on extremely stable sync0 is not limited by RTOS at all, not only solves the packet loss phenomenon, but also can be processed stably and precisely. In addition, the average time spent using multiple (e.g., 500) measurements in ASA was 1228ns, while MSTS was 2440ns. The computational overhead is reduced by almost half.
Experiment 3 to verify the versatility of the proposed ASA, experiment 3 was performed on different servo drives. The experiment still comprises 1 numerical control system master station and 5 servo slave stations. The 5 servo drives consist of 2 servo drives of CTB and 3 servo drives of the same duration. In one experiment, the servo from the CTB was used as the reference servo, i.e. the first slave. In another experiment, the reference servo was from 3 servo drives of the same duration. Table 2 shows the results of two experiments. As can be seen from table 2, the results of both experiments are very similar, whether they are maximum sync error, minimum sync error or average sync error. This is because the proposed ASA method is independent of the servo brand or manufacturer, and it is only relevant to the EtherCAT slave chip or FPGA core in the servo drive, which are all from the same ETG technical community. Therefore, the ASA algorithm provided by the invention is suitable for different servo brands or factories.
TABLE 2 synchronization errors for different Servo City slaves
Experiment 4 is an experiment in which the EtherCAT master transmits command positions in 500 μs, 1ms, and 2ms interpolation periods, respectively. In the experiment of 500 mu s interpolation period of the numerical control system provided by the invention, the number of samples is 1200. The experimental result shows that the maximum synchronization error is 929ns and the average synchronization error is only 61ns. The invention provides an experiment of a numerical control system (CNC) 1ms interpolation period, which comprises 3400 samples in total. The experimental result shows that the maximum synchronization error is 769ns. The invention provides an experiment of a 2ms interpolation period of a numerical control system, and the total number of the samples is 3400. The experimental result shows that the maximum synchronization error is only 749ns.
To further demonstrate the performance of the proposed method, more than five rounds of ASA process were repeated for each experiment and analyzed using maximum, minimum and average synchronization errors, as shown in Table 3. The maximum synchronization error is positive, indicating that the CNC system sends the commanded position at a time that is later than the servo driver sync0 by a distance greater than T s /2,T s And/2 is the length of the reference security area. The minimum synchronization error is negative, indicating that the timing of sending the commanded position is less than T from sync0 of the servo drive s /2. The average synchronization error represents the time and t of the command position sent by the CNC system sync0 -T s Average value of the deviation between/2. The maximum synchronization error is only 471-611ns. This means that the CNC sends the instruction at a time position at a distance T from sync0 s 2+471-611ns. Minimum ofThe synchronization error is-909 to-609 ns, and the average synchronization error is 32-71ns. That is, the CNC sends the command position at a time instant having an average distance from sync0 of only T s 2+32-71 ns. That is, T is before the servo driver receives the commanded position s At time/2, the CNC can almost stably complete the transmission of the command position. Therefore, the packet loss phenomenon is unlikely to occur. It can be seen that ASA has very good stabilizing effect. The smaller the synchronization error, the more stable the distance to sync0 is at T s /2.CNC may be from T from sync0 s And (2) the command position is stably sent out at the moment, the sync0 is the moment when the servo driver enters the periodic task, and the ASA effectively avoids the packet loss phenomenon. Therefore, the PDJC provided by the invention can effectively solve the problem of packet loss.
TABLE 3 synchronization error for different interpolation periods
The ASA method provided by the invention takes stable sync0 of a reference servo driver as a reference, and adaptively adjusts the interpolation period T s And pre-compensation is carried out, so that the problem of packet loss caused by asynchronous time between the numerical control system and the reference servo driver is effectively solved, and the data transmission delay is eliminated. The concept of a safe interval is presented. The safety interval ensures that the instant at which the CNC issues the commanded position is always about T from sync0 s 2, no matter the CNC clock is faster than the reference servo clock or the CNC clock is slower than the reference servo clock, the method can effectively ensure that at t sync0 The CNC may be advanced by a distance of sync0T when the servo enters the periodic task s And (2) sending the command position completed at the moment, thereby solving the problem of message loss. The comparative experiment of experiment 1 shows that the ASA method can effectively solve the problem of packet loss. Without synchronization, the numerical control system and servo driver may drift in time during each interpolation period, and over time, the cumulative drift may even be several periods. However, with ASA, CNC and servo drives have good synchronization performance. In the comparative experiments of MSTS, if the comparison is not limited by the interrupt module, ASA synchronization error ratio MSTS is reduced by 4.182 times. In addition, the algorithm is not limited by a real-time system, so that the packet loss phenomenon is solved, and the processing is accurate. Moreover, the time spent taking the average of multiple (e.g., 500) measurements is almost half less ASA than MSTS. The results of experiment 3 show that the algorithm is suitable for servo drives of different brands or factories. In experiment 4, under different interpolation periods of 500 mu s, 1ms and 2ms, the ASA method provided by the invention has good synchronization performance, and the average synchronization precision can reach 32-71ns. Importantly, ASA promotes EtherCAT to a brand new level, and completely realizes that the EtherCAT master station does not depend on RTOS any more. It is superior to the previous study of scholars. Moreover, the method is based on a simple arithmetic series summation formula, and accurate pre-compensation delta T is obtained in a way of hardly increasing the calculation amount pre-compensation . Only two or four bytes need to be added to the FPRD command, which hardly increases the communication load. In addition, the CNC master station transmits command position and the servo reception command position have a common reference t sync0 Accumulated errors generated by absolute time of CNC and reference servo relatively independent are eliminated. As the processor frequency increases, the synchronization accuracy can increase to 1ns. Therefore, the ASA method can effectively solve the problem of time (beat) synchronization of an embedded numerical control system without an operating system and a servo driver. The method can also be used for time-synchronized communication of a distributed multi-master system.
While the invention has been described with respect to what is presently considered to be the most practical and preferred embodiments, it is to be understood that the invention is not limited to the disclosed embodiments, but on the contrary, is intended to cover various modifications, equivalents, and alternatives falling within the spirit and scope of the invention.

Claims (10)

1. A data frame synchronization communication method, characterized by a numerical control system and a reference servo for a distributed architecture, comprising the steps of:
s1, realizing master-slave synchronization of a real-time Ethernet protocol EtherCAT by adjusting the interrupt time of a master station;
s2, obtaining clock deviation of a master station and a slave station by using time measurement of the slave station;
s3, adjusting the period of the master station to ensure that the deviation is stabilized at half an interpolation period T s And/2.
2. The method according to claim 1, wherein in step S1, by adjusting the master station interrupt time, implementing real-time ethernet protocol EtherCAT master-slave synchronization includes:
the master station is a numerical control system, and obtains the time t of periodically triggering interruption from a servo driver interrupt IO data processing time T IO Calculation time T of numerical control system CNC_calc The method of (2) eliminating the time t of periodically triggering the interrupt interrupt IO data processing time T IO Calculation time T of numerical control system CNC_calc And time t at which the servo slave periodically triggers sync0 sync0 Deviation between t sm The timing of receiving the command position by the servo driver after the CNC sends the command position is acquired from a servo driver register by the FPRD command; time t when a servo compliant station receives a data frame sm The formula is:
t sm =t interrupt +T IO +T CNC_calc +T Frame +T Wire_delay
T safety_interval the updating is as follows:
T safety_interval =t sync0 -t sm +T Wire_delay
in IO data processing time T IO Calculation time T of numerical control system CNC_calc And the time overhead T of loading data frames by the master station of the numerical control system Frame Vanishing and transfer delay T Wire_delay Is irrelevant to a numerical control system; t (T) safety_interval Is a safe interval, T wire_delay Is the transmission delay.
3. The data frame synchronous communication method according to claim 1, wherein in step S2, acquiring a master-slave station clock bias using a slave station time measurement comprises:
the slave station includes a plurality of servo compliant stations, a first servo compliant station serving as a reference servo;
the numerical control system modifies the communication period according to the sync0 of the reference servo, and the numerical control system starts time t with the task of the servo period sync0 For reference, and at a distance from the servo period task start time t sync0 Is used for transmitting a data packet t by a numerical control master station transmit Transmitting command positions at the moment; t (T) interupt The time when the period interrupt is generated in ARM; after interruption, the numerical control system loads IO data into a communication buffer zone, and then the numerical control system processes the IO data and at t transmit Transmitting IO data frames to a real-time Ethernet protocol EtherCAT by using a time-oriented cross Ethernet; IO data processing time T IO And calculation time T of numerical control system CNC_calc Obtained by a timer in a numerical control system; transmission delay T wire_delay After time delay, the reference servo receives the IO data of the command position, T represents a moment, and T represents a time interval; if the command position is at t sync0 Previously sent, namely:
T safety_interval =t sync0 -t sm +T wire_delay >0
wherein T is safety_interval Is a safe interval, t sync0 Is the moment, t, at which the servo slave generates the sync0 signal transmit Is the time t of the data packet transmitted by the numerical control master station sm Is the moment when the servo slave station receives the data frame sent by the numerical control system, T wire_delay Is a transmission delay as long as it is within the safe interval T safety_interval And if the data is sent internally, the data is not lost.
4. A method of data frame synchronous communication according to claim 3, wherein the reference servo is at t sm The command position is received after a period of time, namely t sync0 -t sm Then at t sync0 The process enters a periodic task; if when the drive system is at t sync0 When the command position is acquired, the numerical control system does not send the command position, and the lost data packet occurs; numerical control system The time response of receiving the command position becomes smaller or larger if t sync0 -t sm If the result of (2) is less than zero, packet loss occurs; if t sync0 -t sm And (2) the data packet is not lost if the result is constant, wherein the constant reference safety interval expression is:
t sync0 -t sm =T refs_interval =T s /2
wherein T is refs_interval For reference to safe interval, T s For interpolation period, T s And/2 is half an interpolation period.
5. The data frame synchronous communication method according to claim 1, wherein in step S3, the master station period is adjusted so that the deviation is stabilized at half the interpolation period T s Included in/2 are: compensating between the numerical control system and the reference servo, and ensuring a safety interval T safety_interval And a reference safety interval T refs_interval The larger one decides whether to trigger the interpolation period of the numerical control system in advance or in delay; the safety interval is:
T safety_interval =t sm -t sync0 +T wire_delay
wherein T is safety_interval Is a safe interval, t sm The time when the servo slave station receives the data frame sent by the numerical control system; t is t sync0 Is the moment the servo slave generates the sync0 signal; t is t sm And t sync0 Obtained from the register of the reference servo by the FPRD command; t (T) wire_delay Is the transmission delay.
6. The method according to claim 5, wherein the compensating between the numerical control system and the reference servo specifically comprises:
If the safety interval T safety_interval Greater than the reference safety interval T refs_zone The clock frequency of the numerical control system is greater than that of the reference servo, then t sm The numerical control system delays triggering the interpolation period, otherwise, the numerical control system touches in advanceAnd (5) generating an interpolation period.
7. The data frame synchronization communication method according to claim 5, wherein the average precompensation in the numerical control systemThe formula is:
in the method, in the process of the invention,is the average precompensated length s CNC Sum s ref_s The sum of n interpolation periods in CNC master station and reference servo, respectively, +.>Is the pre-compensation amount of the servo slave station, +.>Is the sign of the pre-compensation amount of the servo slave.
8. The data frame synchronization communication method according to claim 6, wherein the compensation length T of the numerical control system compensation Is the average precompensated lengthAnd the compensatory length T remaining in the interpolation period remain_interval The minimum value between the two is expressed as:
wherein T is compensation Is of compensation lengthDegree, T CNC Is the communication period of the numerical control system, T ref Is a communication period of a reference servo compliant station, T safety_interval Is a safe interval, T refs_interval Is a reference safety interval, T frame Is 5 mu s overhead plus 80ns time overhead per byte of data, T IO Is IO data processing time, T CNC_calc Is the calculation time of the numerical control master station, N is the period number, T remain_interval Is the compensatory length remaining in the interpolation period.
9. A data frame synchronization communication system realized by a data frame synchronization communication method according to any one of claims 1 to 8, characterized in that the system comprises:
the master-slave synchronization module is used for realizing master-slave synchronization of the real-time Ethernet protocol EtherCAT by adjusting the interrupt time of the master station;
the master-slave station clock deviation acquisition module is used for acquiring master-slave station clock deviation by using slave station time measurement;
a deviation stabilizing module for adjusting the period of the master station to stabilize the deviation in half the interpolation period T s And/2.
10. A numerically controlled machine tool for implementing a data frame synchronous communication method according to any one of claims 1 to 8, characterized in that it comprises a master station and five slave stations consisting of servos, the servos communicating with the master station in a chain-like structure, the master station operating in the numerically controlled system with the first slave station being a reference servo.
CN202310398383.1A 2023-04-14 2023-04-14 Data frame synchronous communication method, system and numerical control machine tool Pending CN116455501A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310398383.1A CN116455501A (en) 2023-04-14 2023-04-14 Data frame synchronous communication method, system and numerical control machine tool

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310398383.1A CN116455501A (en) 2023-04-14 2023-04-14 Data frame synchronous communication method, system and numerical control machine tool

Publications (1)

Publication Number Publication Date
CN116455501A true CN116455501A (en) 2023-07-18

Family

ID=87121534

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310398383.1A Pending CN116455501A (en) 2023-04-14 2023-04-14 Data frame synchronous communication method, system and numerical control machine tool

Country Status (1)

Country Link
CN (1) CN116455501A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116866112A (en) * 2023-08-31 2023-10-10 南京德克威尔自动化有限公司 Communication method and system based on bus coupler
CN117707100A (en) * 2024-02-06 2024-03-15 深圳市杰美康机电有限公司 EtherCAT bus driving controller and synchronous control method thereof

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116866112A (en) * 2023-08-31 2023-10-10 南京德克威尔自动化有限公司 Communication method and system based on bus coupler
CN116866112B (en) * 2023-08-31 2023-12-01 南京德克威尔自动化有限公司 Communication method and system based on bus coupler
CN117707100A (en) * 2024-02-06 2024-03-15 深圳市杰美康机电有限公司 EtherCAT bus driving controller and synchronous control method thereof
CN117707100B (en) * 2024-02-06 2024-04-19 深圳市杰美康机电有限公司 EtherCAT bus driving controller and synchronous control method thereof

Similar Documents

Publication Publication Date Title
CN116455501A (en) Data frame synchronous communication method, system and numerical control machine tool
US7904184B2 (en) Motion control timing models
US7983769B2 (en) Time stamped motion control network protocol that enables balanced single cycle timing and utilization of dynamic data structures
KR102652569B1 (en) Implementation of PHY-level hardware timestamping and time synchronization in cost-optimized environments
JP3748204B2 (en) Periodic control synchronization system
Jasperneite et al. Enhancements to the time synchronization standard IEEE-1588 for a system of cascaded bridges
US7379480B2 (en) Fast frequency adjustment method for synchronizing network clocks
KR101126091B1 (en) Method and system for the clock synchronization of network terminals
JP4767178B2 (en) System and method for maintaining a common sense of time on a network segment
CN110492965B (en) Method and device for synchronizing time of serial messages in master-slave system
US20080031283A1 (en) Time synchronization for network aware devices
US9323286B2 (en) Ad-hoc synchronization of industrial control networks
CN109683567B (en) RS485 network-based system clock synchronization method
Müller et al. Fault tolerant TTCAN networks
Dong et al. The design and implementation of ieee 1588v2 clock synchronization system by generating hardware timestamps in mac layer
Yin et al. The implementation of IEEE 1588 clock synchronization protocol based on FPGA
CN114629586B (en) Network port PTP time service function expansion device and expansion method
US11853116B2 (en) Clock error-bound tracker
Akpinar et al. Improved clock synchronization algorithms for the controller area network (CAN)
Meier et al. IEEE 1588 syntonization and synchronization functions completely realized in hardware
CN115333660A (en) Precision timestamp correction
WO2013163793A1 (en) Automatic time and frequency synchronization over an asynchronous network
Kohler A practical implementation of an IEEE1588 supporting Ethernet switch
Diarra et al. Improved clock synchronization start-up time for Ethernet AVB-based in-vehicle networks
CN106130711B (en) IEEE1588 time synchronization method and device based on PAC controller

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination