High-precision fixed-point output method for numerical control machine tool

文档序号:152643 发布日期:2021-10-26 浏览:35次 中文

阅读说明:本技术 一种用于数控机床的高精度定点输出方法 (High-precision fixed-point output method for numerical control machine tool ) 是由 唐廷江 党岱 陈龙 于强 董志亮 秦连庆 于 2021-07-08 设计创作,主要内容包括:本发明公开了一种用于数控机床的高精度定点输出方法,以数控机床上的伺服电机中心轴原点为机械坐标系原点0,在原点放一物体P,物体P在传送带上向前运动,当物品P到达机械坐标系中目标点M的时候,伺服控制器会通过IO端口K输出时间长度为T-(s)的高电平。本申请增加了定点输出IO输出高电平时间宽度,且分两种大于、小于伺服控制器处理离散最小周期的情况分别处理,同时考虑到了CAN总线通信延迟时间的问题,有效解决了数控机床伺服控制器精度低,实时性低的问题,相比现有机床大大地提高了准确度,减小了误差。(The invention discloses a high-precision fixed-point output method for a numerical control machine tool, which is characterized in that the origin of a central shaft of a servo motor on the numerical control machine tool is taken as the origin 0 of a mechanical coordinate system, an object P is placed at the origin, the object P moves forwards on a conveyor belt, and when the object P reaches a target point M in the mechanical coordinate system, a servo controller outputs the time length of T through an IO port K s High level of (c). According to the method and the device, the fixed-point output IO output high-level time width is increased, two conditions which are larger than or smaller than the minimum discrete period of the servo controller are respectively processed, the problem of CAN bus communication delay time is considered, the problems of low precision and low real-time performance of the servo controller of the numerical control machine are effectively solved, the accuracy is greatly improved compared with the existing machine tool, and the error is reduced.)

1. A high-precision fixed-point output method for a numerical control machine tool comprises a computer host, a servo motor, a servo controller and a conveyor belt, wherein the computer host is connected with the servo controller and used for sending instructions to the servo controller and receiving feedback states of the servo controller; the high-precision fixed-point output method is realized under a mechanical coordinate system of a numerical control machine tool, the origin of a central shaft of a servo motor is set to be the origin O of the mechanical coordinate system, an object P moves forwards on a conveyor belt from the origin O, and the hardware interrupt service period of a servo controller is set to be TpThe CAN bus communication delay time is TmAnd setting any point M on the mechanical coordinate system as a target position, wherein the high-precision fixed-point output method comprises the following steps:

setting the object P at the current position B, wherein the distance from the position B to the origin on the coordinate system is less than the distance from the target position M to the origin, and according to the running distance S of the object P in the previous period1Divided by the period time TpObtain the current average speed V = S1/TpAccording to the average speed V multiplied by the period time TpObtaining the next period energy running distance S2=V*TpThereby predicting the arrival place of the next periodic article as S3=B+S2At this time, the target position M and the predicted place S are compared3Distance to origin, if S3If the value is more than M, the object P is predicted to pass through the target position M in the next period, and the object P passes through the position BThe time required to reach position M is T1= (M-B)/V, the IO port of the servo controller outputs high level when the object P passes through the target position M, and the duration is Ts

If TsLess than or greater than TpThen, starting the 16BIT timer module, and setting the trigger Count value of the 16BIT timer module as (2^ 16/T) according to the time required by the object P from the position B to the target position Mp)*(T1-Tm) When the timer overflows and generates interruption, the PWM module of 16BIT processes the interruption, the negative polarity of the PWM channel of the PWM module is set, and the PWM channel has a period TaIs 2 x TsThe PWM channel duty ratio is (2^ 16/T)a)*(T1-Tm)。

2. The high precision fixed point output method for numerical control machine tool according to claim 1, characterized in that the servo controller IO port outputs high level duration TsThe value is preset in the servo controller through the computer host.

3. The high-precision fixed-point output method for the numerical control machine tool according to claim 1, wherein the CAN bus communication delay time is specifically: the moment when the servo motor detects that the object reaches a certain point is t1The time when the servo controller receives the position information sent by the servo motor is t2Delay time Tm=t2-t1

Technical Field

The invention belongs to the technical field of numerical control machine tools, and particularly relates to a high-precision fixed-point output method for a numerical control machine tool.

Background

With the progress of science and technology, a lot of new forces for vehicle construction emerge in China, wherein the vehicles have representatives of Yulai, Xiaopeng and ideal, the vehicle just like a pyramid, a pyramid base can be finished only by a lot of basic equipment, and the base can be finished on the pyramid tip just like an aerial pavilion if not finished. The basic material machine tool is one of the key items, and has the advantages that a human has chips only after precision machine tools and equipment are provided, and then an electric automobile is invented, so that the basic material machine tool is one of pyramid bases. The U.S. base material has led the world, and Tesla and apple cell phones were invented in the U.S. The precision machine tool needs basic materials and high-performance software algorithms, the important indexes of the machine tool are accuracy and real-time performance, and many machine tools in China cannot reach the indexes at present.

Disclosure of Invention

The invention provides a high-precision fixed-point output method for a numerical control machine tool, which effectively solves the problems that the existing machine tool cannot achieve high accuracy and small error.

In order to achieve the purpose, the invention adopts the following technical scheme:

a high-precision fixed-point output method for a numerical control machine tool comprises a computer host, a servo motor, a servo controller and a conveyor belt, wherein the computer host is connected with the servo controller and used for sending instructions to the servo controller and receiving feedback states of the servo controller; the high-precision fixed-point output method is realized under a mechanical coordinate system of a numerical control machine tool, the origin of a central shaft of a servo motor is set to be the origin O of the mechanical coordinate system, an object P moves forwards on a conveyor belt from the origin O, and the hardware interrupt service period of a servo controller is set to be TpThe CAN bus communication delay time is TmAnd setting any point M on the mechanical coordinate system as a target position, wherein the high-precision fixed-point output method comprises the following steps:

setting the object P at the current position B, wherein the distance from the position B to the origin on the coordinate system is less than the distance from the target position M to the origin, and according to the running distance S of the object P in the previous period1Divided by the period time TpObtain the current average speed V = S1/TpAccording to the average speed V multiplied by the period time TpObtaining the next period energy running distance S2=V*TpThereby predicting the arrival place of the next periodic article as S3=B+S2At this time, the target position M and the predicted place S are compared3Distance to origin, if S3If the time is more than M, the object P is predicted to pass through the target position M in the next period, and the time required by the object P from the position B to the position M is T1= (M-B)/V, the IO port of the servo controller outputs high level when the object P passes through the target position M, and the duration is Ts

If TsLess than or greater than TpThen, starting the 16BIT timer module, and setting the trigger Count value of the 16BIT timer module as (2^ 16/T) according to the time required by the object P from the position B to the target position Mp)*(T1-Tm) When the timer overflows and generates interruption, the PWM module of 16BIT processes the interruption, the negative polarity of the PWM channel of the PWM module is set, and the PWM channel has a period TaIs 2 x TsThe PWM channel duty ratio is (2^ 16/T)a)*(T1-Tm)。

Preferably, the running speed V of the object P is a preset value or is obtained by calculation, and the calculation process is as follows: object is in a hardware interrupt service period TpDistance of travel S inpDivided by cycle time, i.e. V = Sp/Tp

Preferably, the servo controller IO port outputs the high level duration TsThe value is preset in the servo controller through the computer host.

Preferably, the CAN bus communication delay time deviceThe body is as follows: the moment when the servo motor detects that the object reaches a certain point is t1The time when the servo controller receives the position information sent by the servo motor is t2Delay time Tm=t2-t1

Due to the structure, the invention has the advantages that:

according to the method and the device, the fixed-point output IO output high-level time width is increased, the two conditions which are greater than or less than the minimum discrete period processed by the servo controller are respectively processed, the problem of CAN bus communication delay time is considered, the problem that the servo controller of the numerical control machine cannot timely process the target position point within the minimum discrete period is effectively solved, the accuracy is greatly improved compared with the existing machine tool, and the error is reduced.

Drawings

In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below.

FIG. 1 is a flow chart of the present invention;

FIG. 2 is a diagram illustrating a service cycle of a servo controller hardware interrupt;

fig. 3 is a schematic view of a mechanical coordinate system.

Detailed Description

The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

The numerical control machine tool generally comprises a computer host, a servo motor, a servo controller and a conveyor belt, wherein the computer host is connected with the servo controller and used for sending instructions to the servo controller and receiving feedback states of the servo controller, the servo controller is connected with the servo motor and used for controlling the speed and the moment of the servo motor, the servo motor is connected with the conveyor belt and used for driving the conveyor belt to work, and an object to be conveyed is placed on the conveyor belt.

The origin of the central shaft of the servo motor is set as the origin O of a mechanical coordinate system, and the object P starts from the origin O and moves forwards on the conveyor belt at a constant speed. Setting a target position M on the mechanical coordinate system and setting the processing discrete minimum period of the servo controller as TpMilliseconds. At the moment when the object P passes through the target position M, the servo controller IO port K starts fixed-point output from low level to high level. Since the target position M is an arbitrary point, the servo controller processes the discrete minimum period TpAs shown in FIG. 2, only target positions of integer multiples of T can be processed, and images cannot be processed in timeThe target position of the position, the width of the fixed-point output high level may be less than one cycle time TpOr greater than one cycle time TpThe high-precision fixed-point output method provided in this embodiment is used to solve the above problem, and as shown in fig. 1, specifically includes:

setting the object P at the current position B, wherein the distance from the position B to the origin on the coordinate system is less than the distance from the target position M to the origin, and according to the running distance S of the object in the previous period1Divided by the period time TpObtain the current average speed V = S1/TpAccording to the average speed V multiplied by the period time TpObtaining the next period energy running distance S2=V*TpThereby predicting the arrival place of the next periodic article as S3=B+S2At this time, the target position M and the predicted place S are compared3Distance to origin, if S3If the time is more than M, the object P is predicted to pass through the target position M in the next period, and the time required by the object P from the position B to the position M is T1= (M-B)/V, the IO port of the servo controller outputs high level when the object P passes through the target position M, and the duration is Ts

If TsLess than or greater than TpThen, starting the 16BIT timer module, and setting the trigger Count value of the 16BIT timer module as (2^ 16/T) according to the time required by the object P from the position B to the target position Mp)*(T1-Tm) When the timer overflows and generates interruption, the PWM module of 16BIT processes, sets the negative polarity of the PWM channel of the PWM module, and sets the period T of one PWM channelaIs 2 x Ts(high level duration TsShould be less than the PWM channel period TaDuration of high level TsEqual to the PWM channel period TaIs optimal), the duty cycle is set to (2^ 16/T)a)*(T1-Tm)。

The following is a detailed description of the calculation with specific numerical substitution:

the method comprises the following steps: the fastest hardware interrupt service in the servo controller MCU is 0.2ms period (T)p) The task is as shown in fig. 2, the task process is that when the object moves to the designated target position M of the mechanical coordinate system, the output changes from low level to high level, the communication delay time of the CAN bus is a fixed value, and the delay time of the CAN communication medium is assumed to be 0.01ms (T)m) (ii) a If the object is currently at 800 units of location B, the target location is at 850 units of location M, if according to the previous cycle (T)p) Distance of travel S1Divided by the cycle time 0.2ms (T)p) Obtain the current average speed V = S1/TpAccording to the average speed V multiplied by the cycle time 0.2ms (T)p) Obtaining the next period (T)p) Distance S of operation2=V*TpSo as to obtain the next periodic article arrival place as S3=B+S2Comparing the target location M with the predicted location S3If S is3If the output voltage is larger than M (850 units), the object P is predicted to pass through the target position M in the next period, the port K outputs high level, and the duration is TsIf is TsLess than one cycle 0.2ms (T)p) Or more than one cycle time of 0.2ms (T)p) Then, the 16BIT timer module is started, and when the timer overflows and generates an interrupt, the PWM period is set and the high level time is output.

Step two: the fixed point output time is, for example, as shown in fig. 3, when the object P moves from the position a to the 800-unit position B in the coordinate system 600 in the previous cycle by 0.2ms, and the velocity V = (B-a)/T is calculatedp= (800 units-600 units)/0.2 ms =1000 units/ms, with such a speed that the time T from B to M position is predicted1= (M-B)/V = (850 units-An object with 800 units/1000 units/ms = 0.05ms will reach a target position T, and since the fastest hardware interrupt service in the MCU is 0.2ms and cannot process 0.05ms tasks, the maximum value range of the 16-bit Timer is 2^16=65536, so the trigger Count value = (2^ 16/T) is setp)*(T1-Tm) = (65536/0.2) ((0.05-0.01) = 13107), once the object P passes through the target point M, the IO output is from low level to high level for 0.04ms (less than one period), a timer is triggered to be interrupted, a PWM module of 16 bits is used for processing, and a channel period T of PWM is seta0.08ms, negative PWM channel polarity, duty ratio = (2^ 16/T)a)*(T1-Tm) If =65536/0.08 × 0.04=32768, in the next cycle, the object P passes through the target point M, IO starts outputting the high level, and after the duration time is 0.04ms, the low level output is continuously maintained. If the object P passes through the target point M, the duration T from the low level to the high level of the IO outputs0.3ms, the PWM-channel period is set to 0.4ms (T)b) Setting the negative polarity of the PWM channel, and setting the duty ratio of the PWM channel = (2^ 16/T)b)*(T1-Tm) =65536/0.4 × 0.04=6554, in the next cycle, the object P passes through the target point M, IO starts outputting the high level, and after the duration time is 0.3ms, the low level output is continuously maintained.

In this embodiment, the servo controller IO port K outputs the high level duration TsThe value is preset in the servo controller through the computer host.

In this embodiment, the CAN bus communication delay time specifically includes: the moment when the servo motor detects that the object reaches a certain point is t1The time when the servo controller receives the position information sent by the servo motor is t2Delay time Tm=t2-t1

According to the embodiment, the fixed-point output IO output high-level time width is increased, the two conditions which are greater than or less than the minimum discrete period processed by the servo controller are respectively processed, the problem of CAN bus communication delay time is considered, the problem that the servo controller of the numerical control machine cannot timely process the target position point within the minimum discrete period is effectively solved, the accuracy is greatly improved compared with the existing machine tool, and the error is reduced.

The above is only a preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes will occur to those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

7页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种隐性数控系统及其实现方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类