CNC (Computer Numerical Control) motion control method and control system based on PLC (Programmable Logic Controller)

By adopting the two-way interactive module and preprocessing mode in the CNC motion control method of PLC, the problem of pause and low efficiency of the Cartesian coordinate manipulator in point-to-point motion is solved, and more efficient processing and accuracy improvement are achieved.

CN118760048APending Publication Date: 2024-10-11CHANGYUAN MEDICAL PRECISION (ZHUHAI) CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411000143.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-24
Publication Date
2024-10-11

AI Technical Summary

Technical Problem

Existing Cartesian coordinate manipulators have problems such as pause waiting and low calculation efficiency in point-to-point motion control, resulting in insufficient processing efficiency and accuracy, and the scan cycle of PLC control is slow.

Method used

The PLC-based CNC motion control method is used to visualize and preprocess the trajectory path through a two-way interactive module. Select the full trajectory or key trajectory preprocessing mode for smoothing and speed optimization to reduce unnecessary calculations and improve motion control efficiency. .

Benefits of technology

It achieves continuity and improved accuracy of point-to-point motion, shortens processing time, improves overall processing efficiency and production quality, and reduces programmer maintenance difficulty.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118760048A_ABST
    Figure CN118760048A_ABST
Patent Text Reader

Abstract

The invention discloses a CNC motion control method based on a PLC, and the method improves the interaction between a user and a CNC system through the setting of S1, on one hand, an operator can visually see a CNC track path through a visual graph, can check the correctness of the path, and can optimize the path; and on the other hand, the user is allowed to directly edit the graph through the block, such as addition, subtraction or dragging operation, and the G-code is automatically updated, so that the user can intuitively understand and modify the processing path. The full-track preprocessing mode and the key-track preprocessing mode are selectively selected in the step S3, the preprocessing mode can be selected according to the processing requirement, unnecessary full-track processing is avoided, the calculated amount is greatly reduced, the processing time is shortened, and the overall motion control processing efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of numerical control machining, and in particular to a CNC motion control method and control system based on PLC. Background Art

[0002] CNC is the abbreviation of Computer Numerical Control Machine Tools, which is an automated machine tool equipped with a program control system. The control system can logically process programs specified by control codes or other symbolic instructions, decode them, express them in coded numbers, and input them into the numerical control device through information carriers. After calculation and processing, the numerical control device sends various control signals to control the movement of the machine tool and automatically process the parts according to the shape and size required by the drawing.

[0003] The existing rectangular coordinate manipulator can realize automatic control, reprogrammable, and only includes orthogonal translation in three-dimensional space. Each motion axis usually corresponds to the X-axis, Y-axis and Z-axis in the rectangular coordinate robot. The X-axis and Y-axis are the motion axes of the horizontal plane, and the Z-axis is the axis of up and down movement. In some applications, the Z-axis has a rotation function, while in most cases, the angles between the linear motion axes of the rectangular coordinate robot are right angles. Its components include linear motion axes, motion axis drive systems, control systems and terminal devices.

[0004] However, the common control methods of existing rectangular coordinate manipulators have the following disadvantages:

[0005] 1. After each distance traveled, you have to stop and wait for the response of the next distance, waiting for the signal command when the movement direction changes, and the movement cycle time is long

[0006] 2. In some point-to-point motion control applications, high positioning accuracy is required for the starting point and the end point, and the motion is expected to be completed in a short time, but the accuracy of the trajectory is not required to be high. The existing methods generally smooth the entire trajectory, resulting in slower CNC motion control efficiency. Moreover, if the entire trajectory is smoothed, especially when the trajectory is very complex, the amount of calculation and processing time will increase.

[0007] 3. In addition, due to the need for complex calculations, the amount of code will increase, and the complexity of the code will also increase. The increase in complexity will increase the difficulty for programmers to consult for subsequent maintenance, and will also cause the scanning cycle of the PLC (Programmable Logic Controller) control to slow down.

[0008] In view of the above shortcomings, the present invention optimizes the control method so that the manipulator does not stop during the point-to-point movement while effectively improving the efficiency and stability. Summary of the invention

[0009] The invention discloses a CNC motion control method and control system based on PLC, which can simplify program codes and improve the grinding accuracy of CNC machine tools, thereby improving the production quality of processed workpieces, and improving ease of use and processing efficiency.

[0010] A first aspect of an embodiment of the present invention discloses a CNC motion control method based on PLC, the method comprising the following steps:

[0011] A CNC motion control method based on PLC, comprising the following steps:

[0012] S1. Before CNC machining, the G-code of the CNC trajectory path is input into the two-way interactive module according to the machining requirements, and a visual CNC trajectory path graphic is converted;

[0013] S2, reading the G-code data in S1 and storing it as a first buffer data group, decoding the first buffer data group using a decoding function block, and storing the decoded data as a second buffer data group;

[0014] S3. Select a preprocessing mode according to the processing requirements; the preprocessing mode is divided into: full-track preprocessing mode and key-track preprocessing mode; according to the different preprocessing modes selected, different data groups are obtained from the second buffer data group and smoothing, speed checking and speed continuity optimization adjustment are performed using the preprocessing function module;

[0015] S4, storing the data after being pre-processed by any mode in step S3, smoothed, speed checked and optimized for speed continuity as a third buffer data group;

[0016] S5, using the trajectory interpolation function block, performing interpolation operation on the parsed third buffer data group to generate the next spatial coordinates to be reached;

[0017] S6. Using the coordinate transformation function block, according to the system structure and the coordinate definition origin, the target point is offset corrected to obtain the coordinate position of the XYZ drive axis;

[0018] S7. Perform corresponding motion control through the axis position control function block according to the obtained coordinate position of the XYZ drive axis.

[0019] Preferably, in step S3, "selecting a preprocessing mode according to processing requirements; the preprocessing mode is divided into: a full-track preprocessing mode and a key-track preprocessing mode; and obtaining different data groups from the second buffer data group for smoothing, speed checking, and speed continuity optimization adjustment according to different selected preprocessing modes" includes:

[0020] S31, acquiring data of the entire CNC trajectory path from the second buffer data set and storing it as a full trajectory buffer data set;

[0021] S32, determining the coordinate data of the starting point, the end point and one or more corner points in the CNC trajectory path graph from the second buffer data group, and storing the coordinate data as a key trajectory buffer data group;

[0022] S33, according to the processing requirements, select a preprocessing mode; the preprocessing mode is divided into: a full-track preprocessing mode and a key-track preprocessing mode;

[0023] If the full-track preprocessing mode is selected, the preprocessing function module is used to smooth the data of the full-track buffer data group, check the speed, and optimize the speed continuity;

[0024] If the key trajectory preprocessing mode is selected, the preprocessing function module is used to smooth the data of the key trajectory buffer data group, check the speed, and optimize the speed continuity.

[0025] Preferably, step S1 further comprises:

[0026] When the user adds, subtracts or drags the existing CNC trajectory path graphics in the two-way interactive module, the two-way interactive module automatically updates the G-code according to the operation to reflect the changes in the graphics; wherein the two-way interactive module is obtained through machine learning training using multiple sets of data, and each set of training data of the multiple sets of data includes: the G-code of the CNC trajectory path graphics and the CNC trajectory path graphics corresponding to the G-code.

[0027] Preferably, the full trajectory buffer data set and the key trajectory buffer data set both include: data identifying, from the second buffer data set, a corner path segment between a start point and an end point in a CNC trajectory path graph that causes the speed to drop to zero.

[0028] Preferably, the trajectory preprocessing module includes: a first preprocessing function block for smoothing the entire trajectory buffer data group or the key trajectory buffer data group, a second preprocessing function block for checking whether the track speed of a specific path segment exceeds the limit and optimizing the speed continuity, a third preprocessing function block for invalid loop elimination, and a fourth preprocessing function block for tool compensation.

[0029] Preferably, the method further includes the following steps: storing the tool compensation data after passing through the fourth pre-processing function block as a fourth buffer data group.

[0030] Preferably, the step S7 of "performing corresponding motion control through an axis position control function block according to the obtained coordinate position of the XYZ drive axis" includes:

[0031] Step S71: send the calculated axis target position command to the drive axis X for motion control through the X-axis position control function block, and read the state information of the drive axis X in real time;

[0032] Step S72: through the Y-axis position control function block, the calculated axis target position instruction is sent to the drive axis Y for motion control, and the state information of the drive axis Y is read in real time;

[0033] Step S73: Through the Z-axis position control function block, the calculated axis target position instruction is sent to the drive axis Z for motion control, and the state information of the drive axis Z is read in real time.

[0034] Preferably, the method further comprises the following steps: if it is detected that any interpolation axis among XYZ is in an abnormal state or overloaded, an abnormal logic signal is generated, and the abnormal logic signal is fed back to the second preprocessing function block for deceleration processing;

[0035] If the abnormal logic signal disappears immediately, the normal trajectory running speed will be restored; if the abnormal logic signal persists, the speed will be gradually reduced until it stops to ensure the safety and stability of the system.

[0036] Preferably, the step S2 of "reading the G-code data in S1 and storing it as the first buffer data set" includes:

[0037] Read the G-code data in S1 and input the G-code data in text line mode according to the G-code format requirements, and save it as an executable NC text file;

[0038] The SMC_ReadNCFile function block is used to read the NC text file into the memory and store it as the first buffer data group.

[0039] Preferably, steps S1 to S4 are periodically executed at a fixed time interval T1 and in a normal task; steps S5 to S7 are cyclically executed at a fixed time interval T2 and in an EtherCAT real-time task; wherein T1 is greater than or equal to 20ms, and T2 is 1 to 4ms.

[0040] Compared with the prior art, the present invention has the following beneficial effects:

[0041] 1. The CNC motion control method based on PLC in this case improves the interactivity between the user and the CNC system through the setting of S1. On the one hand, through the visual graphics, the operator can intuitively see the CNC trajectory path, check the correctness of the path and optimize the path; on the other hand, through the block, the user is allowed to directly edit the graphics, such as adding, subtracting or dragging operations, and automatically update the G-code, so that the user can intuitively understand and modify the processing path, thereby improving the programming efficiency. Through the settings of steps S2 to S7, especially through the optional selection of the full trajectory preprocessing mode and the key trajectory preprocessing mode in step S3, the preprocessing mode can be flexibly selected according to the actual processing requirements, and the system can avoid unnecessary full trajectory processing, especially when the trajectory accuracy is not required; this greatly reduces the amount of calculation, shortens the processing time, and thus improves the overall motion control processing efficiency. In the key trajectory preprocessing mode, the system only performs fine processing on the key parts that affect the positioning accuracy and completion time, and ignores the parts that have little effect on the overall trajectory accuracy, so that the targeted processing method effectively avoids the waste of resources and makes the system resources more reasonably allocated and utilized.

[0042] 2. Through the settings of step S31 and step S32, the data of the entire CNC trajectory path and the data of the key trajectory are stored separately, so that the subsequent pre-processing operations can directly process the required data, thereby improving the pertinence and efficiency of data processing. The key trajectory buffer data group is the coordinate data of the starting point and the end point in the CNC trajectory path graph and the coordinate data of one or more corner points between the starting point and the end point and the storage settings. The coordinates of the key points in the trajectory are stored separately (starting point, end point, corner point), which provides basic data for subsequent trajectory processing and motion control, and supports point-to-point handling control. Moreover, the control method of this case can only perform smoothing processing on these key points, realize point-to-point smoothing processing, and there is no need to process the remaining areas with low precision requirements, and there is no need to smooth the entire trajectory, which significantly reduces the amount of calculation and processing time, thereby shortening the time of controlling the movement. Moreover, it is also possible to ensure the positioning accuracy of the key points while keeping the speed of the non-critical area from being affected too much, thereby improving the processing efficiency. In step S33, the preprocessing function module is used to check the speed and optimize the speed continuity, which can ensure that the movement of the machine tool during the processing is more stable and continuous, reduce the non-processing time caused by sudden speed changes (such as emergency stop, emergency start, etc.), and thus improve the overall processing efficiency.

[0043] 3. Through trajectory smoothing, the corners where the trajectory speed may drop to zero are rounded, which can solve the problem of the speed dropping to zero at the corners causing pauses in the processing process, and ensure that the machine tool maintains a continuous and stable motion state throughout the entire processing process, thereby significantly improving the processing efficiency and effectively improving the efficiency of product handling using the motion control method of this case. Including these corner path segments in the key trajectory buffer data group and optimizing them is actually an intelligent adjustment and optimization of the overall processing path, which helps to further improve efficiency. In addition, since the key trajectory buffer data group already has corner point coordinate data, there is no need to perform complex graphic recognition or coordinate calculations when extracting and processing corner path segment data, and the data preparation process is more convenient and efficient. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 It is a schematic diagram of the steps of the first embodiment of a CNC motion control method based on PLC disclosed in the present invention;

[0045] Figure 2 It is a flow chart of the first embodiment of a PLC-based CNC motion control method disclosed in the present invention;

[0046] Figure 3 It is a structural diagram of a control system according to the second embodiment of the present invention; DETAILED DESCRIPTION

[0047] The features of the present invention and other related features are further described in detail below through embodiments to facilitate understanding by those skilled in the art:

[0048] Embodiment 1

[0049] like Figure 1 and Figure 2 As shown, a CNC motion control method based on PLC includes the following steps:

[0050] S1. Before CNC machining, the G-code of the CNC trajectory path is input into the two-way interactive module according to the machining requirements, and a visual CNC trajectory path graphic is converted from the two-way interactive module to facilitate intuitive understanding and modification by the user;

[0051] When the user adds, subtracts or drags the existing CNC trajectory path graphics in the two-way interactive module, the two-way interactive module automatically updates the G-code according to the operation to reflect the changes in the graphics; wherein the two-way interactive module is obtained through machine learning training using multiple sets of data, and each set of training data of the multiple sets of data includes: the G-code of the CNC trajectory path graphics and the CNC trajectory path graphics corresponding to the G-code. In this way, the real-time update function of the two-way interactive module improves the flexibility and convenience of user operations, and at the same time, machine learning training improves the conversion accuracy between G-code and graphics.

[0052] S2, read the G-code in S1 and store it as the first buffer data group, use the decoding function block SMC_NCDECODER to decode the first buffer data group, and store the decoded data as the second buffer data group; in this way, through the setting of the decoding function block, the G-code instructions can be quickly and accurately parsed, so as to reduce the time required by the CPU to process complex G-code, thereby improving the overall data processing efficiency, and storing the parsed data in the second buffer data group, providing a unified data format for subsequent steps, making subsequent data access more efficient. Specifically, the second buffer data group contains complete trajectory path data.

[0053] The parsed data is an unambiguous format trajectory data structure, and step S2 stores the data of the unambiguous format trajectory data structure as a second buffer data group. Specifically, since the original G-code may contain some vague or easily misunderstood instructions, these instructions are converted into an unambiguous format trajectory data structure through the processing of the decoding function block, thereby eliminating errors that may occur when interpreting and executing instructions. At the same time, the parsed unambiguous format trajectory data structure is stored in the second buffer data group, which not only makes subsequent data access more efficient; but also because the data structure has been optimized, it reduces errors and unnecessary calculations that may occur during data processing, further improving data processing efficiency and accuracy.

[0054] S3. Select a preprocessing mode according to the processing requirements; the preprocessing mode is divided into: full track preprocessing mode and key track preprocessing mode; according to the different preprocessing modes selected, different data groups are obtained from the second buffer data group for smoothing, speed checking and optimization adjustment of speed continuity. In specific implementation, if the processing requires high precision and the entire motion trajectory in motion control needs to be accurately controlled, the full track preprocessing mode is automatically selected to preprocess the entire motion trajectory. If the processing requirements are: only the positioning accuracy of the starting point and the end point is required to be high, and the time for the motion to be completed is short, but the accuracy of the trajectory is not required to be high, for such application requirements, the key track preprocessing mode is automatically selected. In this way, different application requirements can be met by selecting different modes, and when there is no need to preprocess the full trajectory, only full trajectory processing can be performed, avoiding the increase in calculation amount and unnecessary waste of resources, thereby improving the processing efficiency of motion control.

[0055] S4, storing the data after smoothing, speed checking and speed continuity optimization adjustment after preprocessing in any mode in step S3 as a third buffer data group; in this way, ready data is provided for subsequent trajectory interpolation and coordinate transformation.

[0056] S5. Use the trajectory interpolation function block SMC_Interpolator to perform interpolation operation on the parsed third buffer data group to generate the next spatial coordinates that need to be reached, so as to ensure the continuity and accuracy of motion control and the accuracy of CNC processing.

[0057] S6. Using the coordinate transformation function block SMC_TRAFO_Gantry3, according to the system structure and the coordinate definition of the origin, the target point is offset corrected to obtain the coordinate position of the XYZ drive axis;

[0058] In this way, the deviation caused by the different system structures and coordinate definition origins is corrected. In addition, the coordinate transformation function block adapts to different machine tool structures and coordinate systems, enhancing the versatility and flexibility of the system.

[0059] S7. According to the obtained coordinate position of the XYZ drive axis, the corresponding motion control is performed through the axis position control function block. In this way, the real-time control of the drive axis is realized through the axis position control function block, ensuring the smooth progress of the processing process. In addition, the precise axis position control realizes high-precision position control, meeting the needs of high-precision processing.

[0060] In summary, the CNC motion control method based on PLC in this case improves the interactivity between the user and the CNC system through the setting of S1. On the one hand, through the visual graphics, the operator can intuitively see the CNC trajectory path, check the correctness of the path and optimize the path; on the other hand, through the block, the user is allowed to directly edit the graphics, such as adding, subtracting or dragging operations, and automatically update the G-code, so that the user can intuitively understand and modify the processing path, thereby improving the programming efficiency. Through the settings of steps S2 to S7, especially through the optional selection of the full trajectory preprocessing mode and the key trajectory preprocessing mode in step S3, the preprocessing mode can be flexibly selected according to the actual processing requirements, and the system can avoid unnecessary full trajectory processing, especially when the trajectory accuracy is not required; this greatly reduces the amount of calculation, shortens the processing time, and thus improves the overall motion control processing efficiency. In the key trajectory preprocessing mode, the system only performs fine processing on the key parts that affect the positioning accuracy and completion time, and ignores the parts that have little effect on the overall trajectory accuracy, so that the targeted processing method effectively avoids the waste of resources and makes the system resources more reasonably allocated and utilized.

[0061] Specifically, as an optional implementation, in step S3, "selecting a preprocessing mode according to processing requirements; the preprocessing mode is divided into: a full-track preprocessing mode and a key-track preprocessing mode; and obtaining different data groups from the second buffer data group for smoothing, speed checking, and speed continuity optimization adjustment according to different preprocessing modes selected" includes:

[0062] S31, acquiring data of the entire CNC trajectory path from the second buffer data set and storing it as a full trajectory buffer data set;

[0063] S32, determining the coordinate data of the starting point, the end point and one or more corner points in the CNC trajectory path graph from the second buffer data group, and storing the coordinate data as a key trajectory buffer data group;

[0064] S33, according to the processing requirements, select a preprocessing mode; the preprocessing mode is divided into: a full-track preprocessing mode and a key-track preprocessing mode;

[0065] If the full-track preprocessing mode is selected, the preprocessing function module is used to smooth the data of the full-track buffer data group, check the speed, and optimize the speed continuity;

[0066] If the key trajectory preprocessing mode is selected, the preprocessing function module is used to smooth the data of the key trajectory buffer data group, check the speed, and optimize the speed continuity.

[0067] As described above, through the settings of step S31 and step S32, the data of the entire CNC trajectory path and the data of the key trajectory are stored separately, so that the subsequent pre-processing operation can directly process the required data, thereby improving the pertinence and efficiency of data processing. The key trajectory buffer data group is the coordinate data of the starting point and the end point in the CNC trajectory path graph and the coordinate data of one or more corner points between the starting point and the end point and the storage settings. The coordinates of the key points in the trajectory are stored separately (starting point, end point, corner point), which provides basic data for subsequent trajectory processing and motion control, and supports point-to-point handling control. Moreover, the control method of this case can only perform smoothing processing on these key points, realize point-to-point smoothing processing, and there is no need to process the remaining areas with low precision requirements, and there is no need to smooth the entire trajectory, which significantly reduces the amount of calculation and processing time, thereby shortening the time of controlling the movement. Moreover, it is also possible to ensure the positioning accuracy of the key points while keeping the speed of the non-critical area from being affected too much, thereby improving the processing efficiency. In step S33, the preprocessing function module is used to check the speed and optimize the speed continuity, which can ensure that the movement of the machine tool during the processing is more stable and continuous, reduce the non-processing time caused by sudden speed changes (such as emergency stop, emergency start, etc.), and thus improve the overall processing efficiency.

[0068] As an optional implementation, step S1 also includes:

[0069] When the user adds, subtracts or drags the existing CNC trajectory path graphics in the two-way interactive module, the two-way interactive module automatically updates the G-code according to the operation to reflect the changes in the graphics; wherein, the two-way interactive module is obtained by machine learning training using multiple sets of data, and each set of training data of the multiple sets of data includes: the G-code of the CNC trajectory path graphics and the CNC trajectory path graphics corresponding to the G-code. In specific implementation, when the G-code is input into the two-way interactive module, the two-way interactive module will output the corresponding CNC trajectory path graphics; and when the user needs to adjust the CNC trajectory path graphics according to the actual production situation, it can be modified by moving individual points of the CNC trajectory path graphics, and the corresponding G-code will also be updated in real time; and the user can also directly drag the entire CNC trajectory path graphics to the two-way interactive module, and the two-way interactive module will also obtain the corresponding G-code data.

[0070] As mentioned above, users can perform intuitive operations directly on the graphical interface, such as adding, deleting or dragging elements of the CNC trajectory path graphics, which significantly improves the convenience and efficiency of user operations and enhances the user experience. Moreover, since the two-way interactive module can automatically update the G-code to reflect the changes in the graphics, it reduces the errors that may occur when manually editing the G-code, helps to ensure the accuracy and reliability of the CNC program, and reduces the risk of processing failure due to programming errors. The two-way interactive module trained by machine learning can learn the complex relationship between the CNC trajectory path graphics and G-code based on a large amount of training data. In addition, by quickly adjusting the CNC trajectory path and automatically generating G-code, users can prepare processing tasks faster and reduce programming and debugging time. This helps to shorten the production cycle and improve production efficiency. Moreover, the trajectory modification is convenient, and the G-code can also automatically update the data, which not only reduces the workload of programmers, is simple and easy to understand, but also makes control modification more convenient.

[0071] As an optional implementation, the full trajectory buffer data set and the key trajectory buffer data set both include: data identifying the corner path segment between the starting point and the end point in the CNC trajectory path graph that causes the speed to drop to zero from the second buffer data set. When performing speed checks, it is necessary not only to check whether the speed exceeds the limit, but also to pay special attention to the speed change at the corners. By adjusting parameters such as acceleration and deceleration, it is ensured that a smooth transition of speed can be achieved at the corners to avoid sudden deceleration to zero and then acceleration.

[0072] As mentioned above, by using trajectory smoothing, the corners where the trajectory running speed may drop to zero are rounded, which can solve the problem of the speed dropping to zero at the corners causing a pause in the processing process, and ensure that the machine tool maintains a continuous and stable motion state throughout the entire processing process, thereby significantly improving the processing efficiency and effectively improving the efficiency of product handling using the motion control method of this case. Including these corner path segments in the key trajectory buffer data group and optimizing them is actually an intelligent adjustment and optimization of the overall processing path, which helps to further improve efficiency. In addition, since the key trajectory buffer data group already has corner point coordinate data, there is no need to perform complex graphic recognition or coordinate calculation when extracting and processing the corner path segment data, and the data preparation process is more convenient and efficient.

[0073] As an optional implementation, the trajectory preprocessing module (2) includes: a first preprocessing function block (21) for smoothing the entire trajectory buffer data group or the key trajectory buffer data group, a second preprocessing function block (22) for checking whether the track speed of a specific path segment exceeds the limit and optimizing the speed continuity, a third preprocessing function block (23) for invalid loop elimination, and a fourth preprocessing function block (24) for tool compensation.

[0074] The motion control method of the present invention further comprises the following steps: storing the tool compensation data after passing through the fourth pre-processing function block (24) as a fourth buffer data group.

[0075] As described above, the setting of the first preprocessing function block (21) in this case can eliminate discontinuous points and mutation points in the trajectory by smoothing the entire trajectory or key trajectory, reduce the vibration and impact of the machine tool during the processing, and thus improve the finish and dimensional accuracy of the processed surface. The setting of the second preprocessing function block (22) can ensure that the speed does not exceed the limit and maintains continuity by checking and optimizing the track speed of a specific path segment, so as to reduce the acceleration and deceleration process of the machine tool and improve the processing efficiency. The setting of the third preprocessing function block (23) can eliminate invalid loops in the trajectory (such as repeated, unnecessary path segments) to further reduce the calculation amount of subsequent processing and improve the processing speed; and by removing invalid loops, the processing path is further optimized to make the processing process more efficient and reasonable. Through the setting of the fourth preprocessing function block (24), it can be ensured that during the processing of the machine tool, the tool center can move accurately according to the preset trajectory, thereby improving the processing accuracy. In addition, the tool compensation data is stored as the settings of the fourth buffer data group, which is convenient for subsequent processing and management, so that these data can be called during the processing to ensure the accuracy and timeliness of tool compensation; moreover, if during the processing, if the tool compensation needs to be dynamically adjusted, it can be modified directly in the fourth buffer data group without modifying the entire processing program. The modification is more convenient and the control efficiency is further improved.

[0076] As an optional implementation, the step S7 of "performing corresponding motion control through an axis position control function block according to the obtained coordinate position of the XYZ drive axis" includes:

[0077] Step S71: send the calculated axis target position command to the drive axis X for motion control through the X-axis position control function block, and read the state information of the drive axis X in real time;

[0078] Step S72: through the Y-axis position control function block, the calculated axis target position instruction is sent to the drive axis Y for motion control, and the state information of the drive axis Y is read in real time;

[0079] Step S73: Through the Z-axis position control function block, the calculated axis target position instruction is sent to the drive axis Z for motion control, and the state information of the drive axis Z is read in real time.

[0080] In this way, through the control function blocks of the three axes XYZ, the calculated precise axis target position instructions can be sent to each drive axis, ensuring that the machine tool performs high-precision movement according to the preset trajectory.

[0081] As an optional implementation, the method further includes the following steps:

[0082] If it is detected that any interpolation axis among XYZ is in abnormal state or overloaded, an abnormal logic signal is generated, and the abnormal logic signal is fed back to the second pre-processing function block for deceleration processing;

[0083] If the abnormal logic signal disappears immediately, the normal trajectory running speed will be restored; if the abnormal logic signal persists, the speed will be gradually reduced until it stops to ensure the safety and stability of the system. In this way, continuous and stable motion control can be guaranteed while improving system safety.

[0084] As an optional implementation, the step S2 of “reading the G-code data in S1 and storing it as the first buffer data group” includes:

[0085] Read the G-code data in S1 and input the G-code data in text line mode according to the G-code format requirements, and save it as an executable NC text file;

[0086] The SMC_ReadNCFile function block is used to read the NC text file into the memory and store it as the first buffer data group. In this way, by saving the G-code data as an NC text file and setting the first buffer data group, the G-code data can be easily pre-processed, parsed and modified, thereby improving the flexibility and efficiency of data processing. Saving the G-code data as an NC text file in the form of text lines can give priority to the program code, so that developers or technicians can easily view and modify the G-code data, thereby making it easier to find and solve problems and making modifications simpler.

[0087] As an optional implementation, steps S1 to S4 are periodically executed at a fixed time interval T1 and in a common task; steps S5 to S7 are periodically executed at a fixed time interval T2 and in an EtherCAT real-time task; wherein T1 is greater than or equal to 20ms, and T2 is 1 to 4ms. In specific implementation, EtherCAT, as a high-performance industrial Ethernet technology, can support high-speed data transmission and precise synchronous control.

[0088] As mentioned above, by placing the steps such as data pre-processing and parsing in steps S1 to S4 in common tasks for execution, and periodically updating with a larger time interval T1, it is convenient to perform the relatively low steps of the real-time requirement according to the common tasks, and the system resources are reasonably allocated, and it can be carried out without affecting the premise of the real-time control task, ensuring that these tasks can be completed in time, and providing accurate data basis for subsequent real-time control. By placing the steps S5 to S7 associated with motion control in the EtherCAT real-time task for execution, and performing cyclical execution with a shorter time interval T2, it is convenient to ensure that the timely issuance and accurate execution of motion control instructions can be ensured, and the real-time and control accuracy of the system are improved. In addition, by arranging different steps to perform in different time intervals, it is possible to avoid conflicts and interferences between tasks, and it is possible to reasonably allocate, optimize the whole motion control method, and further ensure motion control efficiency.

[0089] Embodiment 2

[0090] like Figure 3 As shown, a control system includes:

[0091] A memory 601 storing executable program codes;

[0092] a processor 602 coupled to the memory 601;

[0093] The processor 602 calls the executable program code stored in the memory 601 to execute Figure 1-2 A PLC-based CNC motion control method in.

[0094] The embodiment of the present invention discloses a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute Figure 1 to Figure 3 Any PLC-based CNC motion control method.

[0095] The embodiments of the present invention further disclose a computer program product, wherein when the computer program product is run on a computer, the computer is enabled to execute part or all of the steps of the methods in the above method embodiments.

[0096] Those skilled in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, the storage medium including a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable rewritable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.

[0097] The above is a detailed introduction to a CNC motion control method and control system based on PLC disclosed in an embodiment of the present invention. Specific examples are used in this article to illustrate the principle and implementation mode of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation mode and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A CNC motion control method based on PLC, characterized in that: The following steps are involved: S1. Before CNC machining, the G-code of the CNC trajectory path is input into the two-way interactive module according to the machining requirements, and a visual CNC trajectory path graphic is converted; S2, reading the G-code data in S1 and storing it as a first buffer data group, decoding the first buffer data group using a decoding function block, and storing the decoded data as a second buffer data group; S3. Select a preprocessing mode according to the processing requirements; the preprocessing mode is divided into: full-track preprocessing mode and key-track preprocessing mode; according to the different preprocessing modes selected, different data groups are obtained from the second buffer data group and smoothing, speed checking and speed continuity optimization adjustment are performed using the preprocessing function module; S4, storing the data after being pre-processed by any mode in step S3, smoothed, speed checked and optimized for speed continuity as a third buffer data group; S5, using the trajectory interpolation function block, performing interpolation operation on the parsed third buffer data group to generate the next spatial coordinates to be reached; S6. Using the coordinate transformation function block, according to the system structure and the coordinate definition origin, the target point is offset corrected to obtain the coordinate position of the XYZ drive axis; S7. Perform corresponding motion control through the axis position control function block according to the obtained coordinate position of the XYZ drive axis.

2. The CNC motion control method according to claim 1, characterized in that: In step S3, "selecting a preprocessing mode according to processing requirements; the preprocessing mode is divided into: a full-track preprocessing mode and a key-track preprocessing mode; obtaining different data groups from the second buffer data group for smoothing, speed checking, and speed continuity optimization adjustment according to the different preprocessing modes selected" includes: S31, acquiring data of the entire CNC trajectory path from the second buffer data set and storing it as a full trajectory buffer data set; S32, determining the coordinate data of the starting point, the end point and one or more corner points in the CNC trajectory path graph from the second buffer data group, and storing the coordinate data as the key trajectory buffer data group; S33, according to the processing requirements, select a preprocessing mode; the preprocessing mode is divided into: a full-track preprocessing mode and a key-track preprocessing mode; If the full-track preprocessing mode is selected, the preprocessing function module is used to smooth the data of the full-track buffer data group, check the speed, and optimize the speed continuity; If the key trajectory preprocessing mode is selected, the preprocessing function module is used to smooth the data of the key trajectory buffer data group, check the speed, and optimize the speed continuity.

3. The CNC motion control method according to claim 1 or 2, characterized in that: Step S1 also includes: When the user adds, subtracts or drags the existing CNC trajectory path graphics in the two-way interactive module, the two-way interactive module automatically updates the G-code according to the operation to reflect the changes in the graphics; wherein the two-way interactive module is obtained through machine learning training using multiple sets of data, and each set of training data of the multiple sets of data includes: the G-code of the CNC trajectory path graphics and the CNC trajectory path graphics corresponding to the G-code.

4. The CNC motion control method according to claim 2, characterized in that: The full trajectory buffer data set and the key trajectory buffer data set both include: data identifying, from the second buffer data set, a corner path segment between a start point and an end point in a CNC trajectory path graph that causes the speed to drop to zero.

5. The CNC motion control method according to claim 2 or 4, characterized in that: The trajectory preprocessing module includes: a first preprocessing function block for smoothing the entire trajectory buffer data group or the key trajectory buffer data group, a second preprocessing function block for checking whether the track speed of a specific path segment exceeds the limit and optimizing the speed continuity, a third preprocessing function block for invalid loop elimination, and a fourth preprocessing function block for tool compensation.

6. The CNC motion control method according to claim 5, characterized in that: The following steps are also included: The tool compensation data after passing through the fourth pre-processing function block is stored as a fourth buffer data group.

7. The CNC motion control method according to claim 5, characterized in that: The step S7 of "performing corresponding motion control through the axis position control function block according to the obtained coordinate position of the XYZ drive axis" includes: Step S71: send the calculated axis target position command to the drive axis X for motion control through the X-axis position control function block, and read the state information of the drive axis X in real time; Step S72: through the Y-axis position control function block, the calculated axis target position instruction is sent to the drive axis Y for motion control, and the state information of the drive axis Y is read in real time; Step S73: Through the Z-axis position control function block, the calculated axis target position instruction is sent to the drive axis Z for motion control, and the state information of the drive axis Z is read in real time.

8. The CNC motion control method according to claim 7, characterized in that: The steps are also included: if it is detected that any interpolation axis among XYZ is in an abnormal state or overloaded, an abnormal logic signal is generated, and the abnormal logic signal is fed back to the second pre-processing function block for deceleration processing; If the abnormal logic signal disappears immediately, the normal trajectory running speed will be restored; if the abnormal logic signal persists, the speed will be gradually reduced until it stops to ensure the safety and stability of the system.

9. The CNC motion control method according to claim 1, characterized in that: The step S2 of "reading the G-code data in S1 and storing it as the first buffer data set" includes: Read the G-code data in S1 and input the G-code data in text line mode according to the G-code format requirements, and save it as an executable NC text file; The SMC_ReadNCFile function block is used to read the NC text file into the memory and store it as the first buffer data group.

10. The CNC motion control method according to claim 1, characterized in that: The steps S1 to S4 are periodically executed at a fixed time interval T1 and in a common task; the steps S5 to S7 are cyclically executed at a fixed time interval T2 and in an EtherCAT real-time task; wherein T1 is greater than or equal to 20 ms, and T2 is 1 to 4 ms.

Citation Information

Cited By

  • Machining method and machining control system

    CN121704309A

  • A decision-making and regression method for humanized multi-objective optimization based on the interaction between generative ai and discriminative ai

    TWI911984B