M code-based nc machine tool broken tool detection intermediary device, method and equipment

By using an M-code-based intermediary device to decode and control instructions, a seamless tool breakage detection system was implemented on old CNC machine tools, solving the problems of difficult installation and poor compatibility on old machine tools, and improving detection efficiency and applicability.

CN120871736BActive Publication Date: 2025-12-16CHINA UNIV OF MINING & TECH (BEIJING)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511403349.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-29
Publication Date
2025-12-16
Estimated Expiration
2045-09-29

AI Technical Summary

Technical Problem

In the existing technology, it is difficult to seamlessly install a broken tool detection system on old CNC machine tools, and it relies on the manufacturer's PLC modification, resulting in poor compatibility and a lack of universal solutions.

Method used

This invention provides an intermediate device for detecting broken tools in CNC machine tools based on M-code without PLC modification. It receives NC system signals through the machine tool's M-code interface, decodes the tool number and operation type, generates control instructions, uses an external broken tool detection unit for detection, and feeds back the results, thus avoiding modification of the original PLC logic.

Benefits of technology

It enables seamless installation of a broken tool detection system on old machine tools, improves the utilization rate of M-code signals, supports the detection of multiple tools, and features low cost, high reliability, and wide compatibility, making it suitable for various CNC systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120871736B_ABST
    Figure CN120871736B_ABST
Patent Text Reader

Abstract

The application provides a kind of based on M code exempt PLC reforming numerical control machine tool broken tool detection intermediary device and method, equipment, belongs to digital control system tool detection technical field.The intermediary device includes: machine tool M code interface, connects the NC system of numerical control machine tool, receives the M code signal output by NC system;Control processing unit is connected with machine tool M code interface, according to the activation state of multiple M code signals, the number and operation type of the tool to be detected are decoded, and control instruction is generated according to the decoding result;Tool detection unit interface is connected with control processing unit, for sending control instruction to external broken tool detection unit, and receiving detection result from broken tool detection unit;Control processing unit is also used to control the output state of feedback signal according to detection result, to feedback whether detection is normal to NC system.The scheme passes through M code signal to transfer tool number and operation type to outside, does not modify original PLC code to realize general external broken tool detection access.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of tool detection of digital control system, and particularly relates to a tool break detection mediation device and method based on M code PLC-free modification of a numerical control machine tool. BACKGROUND

[0002] In modern numerical control machining, tool break detection is an important link to ensure machining quality and production efficiency. The existing widely used tool break detection system (such as optical and mechanical probe type) is usually realized by integrating the machine tool PLC logic in new machine tools. However, for old machine tools that have been shipped, the machine tool manufacturers often do not open the PLC logic to third parties, resulting in great difficulty in adding a tool break detection system later, and high cost and great risk of modification.

[0003] Although some machine tools currently have a number of user-defined M codes reserved at the time of shipment, there is still a lack of a universal solution for realizing tool break detection directly using the reserved M codes without modifying the original PLC logic in the prior art. SUMMARY

[0004] The present application aims to solve the problems of difficulty in adding a tool break detection system to old machine tools, dependence on manufacturer PLC modification, and poor compatibility, and provides a tool break detection mediation device and method based on M code PLC-free modification of a numerical control machine tool to realize a universal solution for realizing tool break detection directly using the reserved M codes without modifying the original PLC logic.

[0005] To achieve the above-mentioned purpose, the present application provides the following technical solutions:

[0006] In a first aspect, the present embodiment provides a tool break detection mediation device based on M code PLC-free modification of a numerical control machine tool, comprising:

[0007] A machine tool M code interface connected to an NC system of a numerical control machine tool, receiving an M code signal output by the NC system;

[0008] A control processing unit connected to the machine tool M code interface, decoding the number and operation type of a tool to be detected according to the activation state of a plurality of M code signals, and generating a control instruction according to the decoding result;

[0009] A tool detection unit interface connected to the control processing unit, for sending the control instruction to an external tool break detection unit, and receiving a detection result from the tool break detection unit;

[0010] The control processing unit is further configured to control the output state of a feedback signal according to the detection result, to feed back to the NC system whether the detection is normal.

[0011] In the above scheme, the intermediate device based on the M code PLC-free modification of the numerical control machine tool broken tool detection device is used as an intermediate device, which is deployed between the NC system and the external broken tool detection unit. The device receives a plurality of M code information (physical signals) output by the NC system through the machine tool M code interface to realize function triggering and response, without intervention or modification of the original PLC logic of the machine tool, avoiding the dependence on the original PLC programming of the machine tool, so that the old machine tool that has completed the factory shipment can also be seamlessly added with a broken tool detection system. The scheme can identify the tool number and operation type by analyzing the M code signal, can support multiple tools under the premise of using only a small amount of M code, and can improve the utilization rate of the M code signal. In addition, the intermediate device has strong universality: as long as the machine tool supports output of the M code and allows users to customize the use of the M code (such as FANUC, Siemens, and Huazhong numerical control, which all support reserved M code), the intermediate device can provide a low-cost, high-reliability, and easy-to-promote technical path for intelligent upgrading of old numerical control machine tools.

[0012] In combination with the first aspect, in some possible implementations, the operation type includes a calibration operation and a detection operation, the M code signal includes a first M code and a second M code, and the first M code and the second M code correspond to different M code signal output terminals, wherein:

[0013] The first M code is output by a first subprogram and is used to instruct the control processing unit to generate a calibration instruction.

[0014] The second M code is output by a second subprogram and is used to instruct the control processing unit to generate a detection instruction.

[0015] The M code signal further includes a plurality of third M codes for representing a tool number, and the control processing unit decodes the number of the tool to be detected by recognizing the activation state of the plurality of third M codes.

[0016] It should be noted that the activation state of the M code includes two aspects. If the M code signal state is ON, the M code is activated. If the M code signal state is OFF, the M code is not activated. In the above scheme, the calibration and the broken tool detection operation are respectively bound to different M codes (including the first M code and the second M code), so that the M code is changed from a pure trigger signal to a control command with different functional meanings, realizing function decoupling and process controllability. At the same time, the state of the plurality of M codes (i.e., the third M code) is used to implicitly transmit the tool number information, without reading the internal register of the NC system or the variable of the original PLC of the machine tool, so that the tool number can be accurately obtained even if the NC system does not open the data interface, realizing the broken tool detection operation without dependence on the original PLC, and laying a foundation for subsequent tool broken tool detection operation.

[0017] In some possible implementation manners of the first aspect, the number of the third M codes is six, corresponding to six bits of binary code, and supporting unique identification of 1 to 64 tools; if the number of the third M codes provided by the machine tool is less than six, partial tools to be monitored are selected for identification, and the number of the monitored tools is less than or equal to the maximum number of the third M codes combined according to binary codes.

[0018] In the above scheme, only 6 digital input points (M code signal lines) are needed to transmit 64 tool information, and the utilization rate of signal resources is improved. If the number of the third M codes provided by the machine tool is insufficient, partial tools to be monitored, such as drill bits and taps, can be selected for identification, and the identification can be inconsistent with the tool number of the machine tool, and the identification is unique in the mediation device.

[0019] In some possible implementation manners of the first aspect, the first subprogram and the second subprogram both include a tool coding module, and the tool coding module is configured to:

[0020] According to a preset coding rule, the number of the tool to be detected in the decimal form is converted into a binary code, and the binary code is mapped to an activation state of a plurality of third M codes.

[0021] In some possible implementation manners of the first aspect, the control processing unit further includes a data storage module and an exception determination module, the data storage module is configured to store reference state data and historical detection data of each tool, and the exception determination module is configured to determine tool fracture based on the historical detection data by using a dynamic threshold algorithm.

[0022] In the above scheme, the control processing unit integrates the data storage module, which is configured to store reference state data (such as length value, vibration feature, inductance signal, etc.) of each tool; in the tool breakage detection, the dynamic threshold algorithm is used to determine the fracture based on the historical detection data, and the judgment standard is adaptively adjusted (such as taking 2 times of variance as the judgment range) according to the statistical characteristics (such as mean value and variance) of the historical normal state of the tool, so as to improve the detection robustness.

[0023] In some possible implementation manners of the first aspect, the tool detection unit interface supports at least one field bus communication protocol in Profinet, Profibus or DeviceNet, and is configured to perform bidirectional data interaction with an external tool breakage detection unit.

[0024] The above scheme supports multiple mainstream fieldbus protocols, adapts different brands and types of detection equipment, and combines the functions of M code signal decoding, calibration / cutter detection operation type calling provided by the intermediary device, so that it not only plays a signal forwarding role, but also becomes a protocol conversion gateway between the NC system (through M code) and the modern industrial network (i.e. fieldbus).

[0025] In combination with the first aspect, in some possible implementation manners, the feedback signal is an M code completion signal defined by the machine tool side, and the control processing unit controls activation of the feedback signal through a digital output terminal;

[0026] When the detection result is normal, the control processing unit activates an M code completion signal loop to allow the NC program to continue execution;

[0027] When the detection result is abnormal, the control processing unit keeps the M code completion signal disconnected, causing the NC system to generate an M code timeout alarm.

[0028] In the above scheme, the M code timeout protection mechanism of the NC system is used, the M code completion signal is not sent, the NC system is automatically triggered to alarm and stop, and automatic stop control without intervention of the original PLC is realized. On the other hand, since the M code completion signal is a general control logic supported by most existing numerical control systems, the M code timeout protection mechanism is used as a passive response channel, which improves cross-brand compatibility. By physically disconnecting the signal loop, it is ensured that the NC system cannot skip the detection step, and the risk of cutter cutting is avoided.

[0029] In combination with the first aspect, in some possible implementation manners, the intermediary device further includes a power module, and the machine tool M code interface further includes a dynamic threshold value learning selection terminal for learning and completing threshold value adjustment in calibration; and the power module is used to convert external alternating current into direct current working voltage to supply power to the control processing unit.

[0030] In the above scheme, the intermediary device has a built-in power module, supports standard AC input, and can directly take power from the machine tool control cabinet to realize self-power supply of the device. The dynamic threshold value learning selection terminal is used to learn and complete threshold value adjustment in calibration.

[0031] The second aspect provides a numerical control machine tool cutter detection method based on M code PLC-free modification, including:

[0032] In the NC system of the numerical control machine tool, a preset subroutine is called to trigger a combined output of a plurality of M code signals, wherein the plurality of M code signals include a first M code, a second M code and a plurality of third M codes, the first M code and the second M code correspond to two operation types of calibration operation and fracture detection operation respectively, and the activation state of the plurality of third M codes is used to represent the number of the tool to be detected.

[0033] The external broken tool detection intermediary device collects the M code signals, decodes the number of the tool to be detected and the operation type according to the activation state of the plurality of M code signals.

[0034] The external broken tool detection intermediary device controls the external broken tool detection unit to perform the corresponding operation according to the decoding result, and feeds back the detection result to the numerical control system.

[0035] The external broken tool detection intermediary device is the broken tool detection intermediary device of the numerical control machine tool based on M code PLC-free reconstruction provided in any of the above embodiments.

[0036] In the above scheme, the programmer inserts a subroutine call in the machining program of the NC system, and outputs a plurality of M codes from the subroutine, so that the detection can be triggered only by using the existing programming means without modifying the PLC logic. After the M code information is decoded, the number of the tool to be detected and the operation type can be obtained, which plays a dual role of control instruction and data carrier, so as to drive intelligent broken tool detection by standardized input (M code).

[0037] In a third aspect, the embodiment provides a computer device including a memory, a processor and a computer program stored in the memory, and the processor executes the computer program to implement the steps of the method in any of the above embodiments.

[0038] The technical effects of the second aspect and the third aspect provided in the present application can be referred to the description of the first aspect, which will not be repeated here. BRIEF DESCRIPTION OF DRAWINGS

[0039] Figure 1 A schematic diagram of the broken tool detection intermediary device of the numerical control machine tool based on M code PLC-free reconstruction provided in some embodiments.

[0040] Figure 2 An input wiring schematic diagram of the machine tool and the intermediary device provided in some embodiments.

[0041] Figure 3 An output wiring schematic diagram of the intermediary device and the external broken tool detection unit provided in some embodiments.

[0042] Figure 4 A source code example of the O9006 subroutine. DETAILED DESCRIPTION

[0043] For the convenience of understanding the technical solutions of the present application, the related terms are explained below.

[0044] M code: M code is the instruction code used to control the non-geometric motion function of the machine tool in the numerical control system (NC system 5) of the machine tool, including but not limited to machine tool spindle start-stop (M03, M04, M05), coolant switch (M08, M09), program end (M02, M30), tool change instruction (M06), subroutine call and return (M98, M99) and the like. Generally, the numerical control system of the machine tool is configured with an M code decoding module, which is used to identify M code during the processing program analysis stage and convert it into corresponding control signals to drive the corresponding actuator or built-in PLC (Programmable Logic Controller) to complete the specified action.

[0045] User-defined M code (also known as reserved M code): Some machine tools have a number of M codes not occupied by standard functions reserved in their numerical control systems when they are shipped, which are used as user-defined instruction intervals (for example, M80~M99, M100 and above, the specific range is defined by the numerical control system manufacturer). When these reserved M codes are decoded, they do not correspond to any default machine tool action, allowing users to bind them to specific auxiliary control functions through original PLC programming.

[0046] The embodiments of the present application are described below in conjunction with the accompanying drawings.

[0047] The present embodiment provides a kind of based on M code PLC reform-free numerical control machine tool broken tool detection intermediary device (referred to as device, intermediary device 100), the device includes:

[0048] Machine tool M code interface 1, for connecting the NC system 5 of numerical control machine tool, receives the M code signal output by NC system 5;

[0049] Control processing unit 2 is connected with machine tool M code interface 1, according to the activation state of multiple M code signals, the number and operation type of tool to be detected are decoded, and control instruction is generated according to decoding result;

[0050] Tool detection unit interface 3 is connected with control processing unit 2, for sending control instruction to external broken tool detection unit 4, and receiving detection result from broken tool detection unit 4;

[0051] Control processing unit 2 is also used to control the output state of feedback signal according to detection result, to feedback to NC system 5 whether detection is normal.

[0052] Figure 1 The schematic diagram of the broken tool detection intermediary device 100 of the numerical control machine tool based on M code PLC reform-free. As Figure 1As shown, the device provided by the embodiment includes three parts: a machine tool M code interface 1, a tool detection unit interface 3, and a control processing unit 2. The machine tool M code interface 1 is connected to the machine tool NC system 5 and receives the M code signals output by the NC system 5, such as Mx1-Mx8, where x is any integer from 0 to 9.

[0053] In the embodiment, the machine tool M code interface 1 is in the form of an industrial digital input / output (DI / DO) terminal block, which is used to connect the M code signal input / output points (terminals) of the NC system 5 of the numerical control machine tool.

[0054] The NC system 5 of the numerical control machine tool runs a main program (i.e., a cutting machining program), which can call multiple preset subprograms. In the embodiment, when the NC system 5 encounters a preset subprogram being called during the execution of the machining program, it will form the M code signal in the form of a switching value signal and send it from the M code output terminal. The machine tool M code interface 1 inputs the above-mentioned M code signal into the digital input port (such as I0.0-I0.7) of the control processing unit 2 inside the intermediary device 100, which is used as the input basis for subsequent decoding and control logic.

[0055] In one example, the M code signal is derived from the user-defined M code (such as Mx1-Mx8) reserved by the NC system 5. Unlike other M codes with corresponding PLC logic and functions (such as M05, M06, M30, etc.), these user-defined M codes in the traditional technology implementation do not have complex PLC logic in the machine tool, but only have basic output (M code activation) and input (M code completion) interfaces. The embodiment uses the M code signal through the machine tool M code interface 1 to pass the operation type and tool number to the intermediary device 100.

[0056] In the embodiment, the control processing unit 2 is built into the intermediary device 100, and its core is a programmable logic controller (PLC) that has built-in broken tool detection process logic, including tool number decoding, detection command generation, and exception determination steps.

[0057] Specifically, the control processing unit 2 is connected to the machine tool M code interface 1 and has built-in execution logic such as tool number decoding, detection command generation, detection data analysis, dynamic threshold adjustment, and trend early warning. The tool number decoding module can decode the number and operation type of the tool to be detected according to the activation state of the M code signal received by the machine tool M code interface 1, and the detection command generation module generates control instructions according to the decoding result.

[0058] In this embodiment, the intermediate device 100 can be electrically connected with the external tool break detection unit 4 (i.e. a tool break detection system such as optical, contact probe, etc.) through IO points in the tool detection unit interface 3, field bus, etc., that is, the tool detection unit interface 3 is a bridge for communication between the control processing unit 2 and the external tool break detection unit 4, the control processing unit 2 can send control instructions to the external tool break detection unit 4 via the tool detection unit interface 3, and receive detection results from the tool break detection unit 4, realizing bidirectional data communication. Among them, the communication protocol of the field bus is Fieldbus protocol, such as Profinet / Profibus / DeviceNet.

[0059] In this embodiment, the external tool break detection unit 4 (also known as tool break detection unit) is an external independent device responsible for performing specific detection tasks. In this embodiment, the tool break detection unit 4 can realize tool break detection by using optical sensors, contact probes or current monitoring, obtain detection results, and return the detection results to the intermediate device 100 through the Fieldbus protocol. Finally, the control processing unit 2 in the intermediate device 100 outputs feedback to the NC system 5 according to the detection results.

[0060] In the scheme of this embodiment, the tool break detection intermediate device of the NC machine tool based on M code PLC-free transformation serves as an intermediary device, which is deployed between the NC system 5 and the external tool break detection unit 4, and realizes function triggering and response by receiving a plurality of M code information output by the NC system 5 through the machine tool M code interface 1, without intervening or modifying the original PLC logic of the machine tool, avoiding the dependence on the original PLC programming of the machine tool, so that even the old machine tool that has completed the factory can be seamlessly installed with a tool break detection system. This scheme can identify tool numbers and operation types by analyzing M code signals, can support multiple tools under the premise of using only a small amount of M code, and can improve resource utilization. In addition, the intermediate device 100 has strong versatility: as long as the machine tool supports outputting M code and allows users to customize its use (such as FANUC, Siemens, Huazhong Numerical Control, etc. Common systems support reserved M code), it can be adapted through parameter configuration, providing a low-cost, high-reliability and easy-to-promote technical path for intelligent upgrading of old numerical control machine tools.

[0061] In some possible implementations, the operation type includes a calibration operation and a detection operation, the M code signal includes a first M code and a second M code, the first M code corresponds to a different M code signal output terminal than the second M code, wherein: the first M code is output by a first subprogram, and is used to instruct the control processing unit 2 to generate a calibration instruction; the second M code is output by a second subprogram, and is used to instruct the control processing unit 2 to generate a detection instruction; the M code signal further includes a plurality of third M codes for representing tool numbers, and the control processing unit 2 decodes the number of the tool to be detected by recognizing the activation state of the plurality of third M codes.

[0062] The calibration operation (also referred to as teaching) refers to a process of establishing normal state reference data of the tool before the tool breakage detection, for example, for an optical detection system: collecting profile images, length pixel values, edge sharpness, etc. of the tool; for a contact detection system: obtaining a reference distance value of the tool tip position. The reference data will be stored in the data storage module of the control processing unit 2 as a standard for subsequent detection comparison.

[0063] The detection operation refers to calling the stored reference data (obtained by the calibration operation) to compare and analyze the actual state of the current tool before actual machining or after tool replacement, to determine whether the tool is broken, missing, or severely worn.

[0064] The activation state of the M code includes two states: activated (ON state) and not activated (OFF state).

[0065] In this embodiment, the M code signal is not only used to trigger the tool breakage detection action, but also distinguishes different operation types through functional semantic definition. Specifically, the operation type includes two types: calibration operation and breakage detection operation, and correspondingly, the control instruction is also divided into two types: calibration instruction and detection instruction. When the output terminal corresponding to the first M code is activated, the control instruction generated by the control processing unit 2 is a calibration instruction; when the output terminal corresponding to the second M code is activated, the control instruction generated by the control processing unit 2 is a detection instruction.

[0066] Specifically, referring to Figure 1 , the first M code is, for example, set to Mx1; the second M code is another reserved M code different from Mx1, for example, Mx2. The user can flexibly call the two M codes in the machining program to control the tool breakage detection system to perform different operations (calibration / detection).

[0067] The first M code is output by a first subprogram, also known as a tool calibration subprogram (such as a subprogram coded as: O900X), for instructing the control processing unit 2 to generate a calibration instruction, and the second M code is output by a second subprogram, also known as a tool detection subprogram (such as a subprogram coded as: O900Y), for instructing the control processing unit 2 to generate a detection instruction.

[0068] Further, the M code signal further comprises a plurality of third M codes for representing tool numbers.

[0069] It should be noted that in the conventional numerical control system, the original PLC can obtain the number of the tool to be detected through system variables or shared registers, but since the intermediary device 100 is an external device, it cannot read the system variables / shared registers in the numerical control system. Therefore, the embodiment achieves the transmission of the tool number through M codes. In addition, considering that the numerical control system usually reserves only a limited number of user-defined M codes (such as Mx1-Mx8), if a one-to-one encoding mode in which one M code corresponds to one tool is adopted, it will be difficult to support a multi-tool machine tool (the number of tool magazines in a vertical machining center is usually less than 60 tools). Therefore, the embodiment transmits the tool number through the activation state of a plurality of third M codes, thereby expanding the support for multiple tools under the premise of using only a small number of M codes and improving the utilization rate of M code signal resources.

[0070] In some possible implementations, the number of third M codes is six, which correspond to six bits of binary encoding, supporting the unique identification of tools numbered 1 to 64, and the number of monitored tools is less than or equal to the maximum number of third M codes encoded by binary combination.

[0071] For example, it is assumed that 6 third M codes: Mx3-Mx8 are used, corresponding to binary bits 0-5 (low bits first): the activation state of Mx3 is ON, and bit 0 is assigned a value of 1; the activation state of Mx4 is OFF, and bit 1 is assigned a value of 0; the activation state of Mx5 is ON, and bit 2 is assigned a value of 1; the activation state of Mx6 is OFF, and bit 3 is assigned a value of 0; the activation state of Mx7 is OFF, and bit 4 is assigned a value of 0; and the activation state of Mx8 is OFF, and bit 5 is assigned a value of 0. Combining these assignment results, the binary number "101000" is obtained, which is converted to decimal as 40 (tool number), that is, T40 tool.

[0072] In the embodiment, the number of third M codes is six (such as Mx3-Mx8), and only 6 digital input points (i.e., M code signal lines) are required to transmit 2 6 =64 kinds of tool information, thereby achieving the broken tool detection support of a multi-tool machine tool.

[0073] In practice, the number of M codes reserved by the machine tool can be occupied by other auxiliary functions, resulting in less than 6 available M codes. In this case, if the number of third M codes provided by the machine tool is less than six, a part of the tools to be monitored can be selected according to factors such as tool type, and identified, such as drill, tap, etc., so that the remaining available M codes can uniquely identify the selected tools. It should be noted that when a part of the tools is selected for identification, the identification number represented by the plurality of third M codes can be inconsistent with the actual tool number of the machine tool, as long as it is unique in the intermediate device.

[0074] Further, the tool calibration subroutine and the tool detection subroutine both include a tool coding module for converting the decimal form of the number of the tool to be detected into a binary code according to a preset coding rule, and mapping the binary code into the activation state of a plurality of third M codes.

[0075] Tool coding is the conversion of decimal tool number into binary control signal, which is completed by the first subroutine O900X and the second subroutine O900Y, wherein O900X and O900Y represent the number of different subroutines, X and Y take values in the range of 1-9, and X is not equal to Y. In this embodiment, X=6 and Y=7 are taken as examples for illustration. In the NC system 5, the tool breaking detection subroutine is called by the "M98 P9007" code, and the calibration subroutine is called by the "M98 P9006" code, so as to realize the transmission of tool number and operation type to the intermediate device, and then the intermediate device 100 triggers the external tool breaking detection unit 4 to execute the tool breaking calibration and detection process.

[0076] In a specific example, the O9006 subroutine (first subroutine) is used to execute the following process:

[0077] Step 1, read the decimal tool number (referred to as tool number) stored in the NC system 5 current tool number variable (such as #3);

[0078] Step 2, take the absolute value of the tool number to ensure that it is a positive integer, and then perform a legality check, such as determining whether the tool number is greater than 64. If yes, trigger the tool number too large alarm, otherwise, store #3 to temporary variable #100, and go to step 3;

[0079] Step 3, execute tool coding, that is, use binary decomposition method to convert decimal tool number (1-64) into a combination of M code (M83-M88) signals, including:

[0080] If the tool number is greater than 32, output M code M83 (i.e. activate output relay M83), and at the same time, subtract 32 from the tool number to obtain a new tool number, check whether the new tool number is 0, if yes, jump to the delay code; otherwise, judge whether the new tool number is greater than 16, if yes, output M code M84, and at the same time, subtract 16 from the tool number to obtain a new tool number, check whether the new tool number is 0 again, if yes, jump to the delay code; otherwise, judge whether the new tool number is greater than 8, if yes, output M85, and so on, until the tool number is coded as a combination of M83~M88, that is, the decimal form of the tool number is mapped to the activation state of a group of M code signals, wherein the activated M code signal represents binary 1, and the inactivated M code signal represents binary 0.

[0081] In the delay code segment, the following logic is executed: after the binary signals of M88~M83 are stably output for a specified time (such as 0.4 seconds), M code signal M81 is sent out to trigger the calibration operation.

[0082] For the convenience of understanding, the above process is illustrated by an example. First, read the current tool number variable, assume that '#3=5' (corresponding to binary '000101'), after the legality check, store it in #100, i.e. #100=5. Then perform tool coding, and execute the following process: if #100≥32, set M83, #100 subtract 32 (remove high bits); if the remaining #100≥16, set M84, #100 subtract 16; if the remaining #100≥8, set M85, #100 subtract 8; if the remaining #100≥4, set M86, #100 subtract 4; if the remaining #100≥2, set M87, #100 subtract 2; if the remaining #100≥1, set M88. Since: 5=4+1, after tool coding, M code M86 (4) and M88 (1) are triggered, i.e. M86, M88 correspond to 1 in binary code '000101', and the remaining M codes (M83, M84, M85, M87) correspond to 0 in binary code '000101'. The corresponding source code is shown in Figure 4 .

[0083] The execution process of the tool coding module of the O900Y subroutine (i.e. the second subroutine) is the same as that of the O900X subroutine, except that after the binary signals of M83~M88 are stably output for a specified time (such as 0.4 seconds), M code signal M82 is sent out to trigger the calibration operation.

[0084] After the first subprogram and the second subprogram trigger the output of the plurality of M code signals, the plurality of M code signals are converted into digital input signals required by the control processing unit 2, such as I0.0-I0.7, through the machine tool M code interface 1. According to the digital input signals, the control processing unit 2 decodes the number of the tool to be detected and the operation type, stores the number of the tool to be detected in the data storage area of the intermediary device 100, and generates corresponding control instructions according to the operation type: if the first M code (such as Mx1) is activated, calibration instructions are generated; if the second M code (such as Mx2) is activated, detection instructions for the specified tool are generated. Subsequently, the calibration instructions or the detection instructions are sent to the external broken tool detection unit 4 through the tool detection unit interface 3.

[0085] The external broken tool detection unit 4 performs calibration and obtains calibration results. The control processing unit 2 writes the calibration results into the corresponding storage area according to the tool number, so as to be called in the broken tool detection. When the external broken tool detection unit 4 performs the broken tool detection, the control processing unit 2 reads the corresponding reference data according to the tool number, sends the target data (i.e., the reference data) of the tool to the external broken tool detection unit 4, and receives the detection results (including measurement data and OK / KO state, etc.) returned by the external broken tool detection unit 4, and stores them according to different tools, so as to be determined by the control processing unit 2 whether the tool is broken and whether the main program of the NC system 5 is allowed to continue to execute.

[0086] The decoding process of the number of the tool to be detected is the reverse process of the tool code, which is specifically as follows: according to the digital input signals, the activation states of the plurality of third M codes are judged, which are mapped into binary numbers, and the binary numbers are converted into decimal numbers, so as to obtain the number of the tool to be detected. That is, the control processing unit 2 decodes the number of the tool to be detected by recognizing the activation states of the plurality of third M codes. Specifically, the control processing unit 2 judges the activation states of the plurality of third M codes, and if activated (ON state), assigns 1, otherwise assigns 0 (OFF state). Then, the M codes assigned with 0 or 1 are combined in a predetermined order, encoded into binary numbers, and then the binary numbers are converted into decimal numbers, so as to obtain the number of the tool to be detected and store it in the data storage area.

[0087] It should be noted that the intermediate device 100 provided in the embodiment, the machine tool M code interface 1 receives a plurality of M code signals (such as Mx1~Mx8), these M code signals are divided into two groups, one group is used to indicate the operation type, such as Mx1, Mx2 respectively indicate calibration and detection operation, since the external device cannot simultaneously execute calibration and detection operation, therefore, the two M codes in this group are in mutual exclusion, that is, both cannot be enabled at the same time; another group is used to transmit parameters, that is, the number of the tool to be detected, so it is also called tool number M code, such as Mx3~Mx8 respectively correspond to tool number M code 1~6. Since the tool number needs to be decoded by the combination of the active state, therefore, the plurality of M codes in this group can be in ON state at the same time, and the combination of different signals corresponds to different tool numbers.

[0088] Through the M code signal, a plurality of discrete switch quantities M code (physical signal) is converted into structured data (operation type and number), so that the M code signal is changed into a communication channel carrying composite information, which breaks through the limitation of the closed system of machine tool manufacturers and provides a premise for the implementation of the intermediate device 100. At the same time, the third M code is encoded into a binary number, and then converted into the number of the tool to be detected based on the decimal mapping rule, and the system maintainability is improved by using the standardized encoding rule.

[0089] In a further scheme, the control processing unit 2 further comprises a data storage module and an abnormality determination module, the data storage module is used to store the reference state data and the historical detection data of each tool, and the abnormality determination module is used to determine the fracture based on the historical detection data by using a dynamic threshold algorithm.

[0090] The data storage module is integrated in the control processing unit 2 and can be stored by using a non-volatile memory to persistently save the detection data related to each tool, which specifically includes: reference state data: initial state information of the tool collected in the calibration operation, for example: tool profile image in the optical detection system, edge definition, pixel length; inductive sensor induced voltage peak or waveform characteristics; the tool tip position reference value measured by the contact detection system; response time or pressure value when the probe contacts; real-time detection returned data, that is, the measurement value (such as angle, length, etc.) of the current tool.

[0091] The abnormality determination module is responsible for analyzing the received current detection data, and judging whether the tool is fractured or abnormally worn in combination with the error threshold (also known as tolerance).

[0092] Unlike the traditional fixed threshold judgment method, the embodiment adopts a dynamic threshold algorithm based on historical detection data to realize adaptive and anti-interference intelligent judgment.

[0093] The implementation of the dynamic threshold algorithm is as follows: first, it is judged whether the input signal of the dynamic threshold learning selection terminal is activated, if yes, multiple calibration operations are performed on the current tool, and the results of the calibration operations are obtained as historical detection data and stored in the data storage area. The historical detection data is statistically analyzed to obtain the mean and standard deviation Then, the judgment threshold is set as: , is a sensitivity coefficient, which is an integer greater than 0; finally, the detection result of the current tool (i.e. the current detection data) is compared with the judgment threshold, if it exceeds the value interval, it is determined that the tool is broken, otherwise, the tool is normal. Optionally, a dynamic threshold state indication signal can be set in the mediation device 100 to indicate the correct execution and error state of the dynamic threshold learning. For example, a green signal lamp can be used to indicate that the dynamic threshold learning is normal (OK), and a red signal lamp can be used to indicate that the dynamic threshold learning is in error (NG).

[0094] In this embodiment, the control processing unit 2 integrates a data storage module and an abnormality determination module, the data storage module stores the reference state data (such as length value, vibration characteristic, inductance signal, etc.) of each tool; during tool breakage detection, the abnormality determination module uses the dynamic threshold algorithm to determine the breakage based on the historical detection data, improving the detection robustness.

[0095] In some possible implementations, the tool detection unit interface 3 supports at least one field bus communication protocol in Profinet, Profibus or DeviceNet, for bidirectional data interaction with the external tool breakage detection unit 4, to realize functions such as control instruction sending, detection data acquisition, trend early warning and dynamic threshold adjustment.

[0096] In this embodiment, as shown in Figure 1 , the tool detection unit interface 3 is a digital communication bridge between the mediation device 100 and the external tool breakage detection unit 4. In order to improve the system integration capability, data transmission efficiency and functional expansibility, the interface supports the mainstream field bus communication protocols widely used in the industry, including at least one of Profinet, Profibus and DeviceNet, and preferably supports multiple protocol optional configurations.

[0097] In a preferred embodiment, the tool detection unit interface 3 adopts a modular design, which can switch the protocol type by replacing the communication module or software configuration, and is suitable for different brands of tool breakage detection equipment.

[0098] Through the field bus protocol, the intermediary device 100 of the embodiment realizes bidirectional communication with the external broken tool detection unit 4, and specifically includes the following core functions: (1) control instruction sending, including sending calibration instructions and detection instructions, and carrying the number of the tool to be detected and the like; (2) detection data acquisition, receiving actual measurement values such as length; (3) trend early warning information uploading, the external broken tool detection unit 4 can feed back predictive maintenance information such as tool wear value; (4) dynamic threshold adjustment issuing, the intermediary device 100 transmits the dynamic threshold generated based on historical data to the external broken tool detection unit 4, to realize adaptive detection.

[0099] In some possible implementations, the feedback signal is an M code completion signal defined by the machine tool side, and the control processing unit 2 controls the activation of the feedback signal through a digital output terminal; when the detection result is normal, the control processing unit 2 activates the M code completion signal loop, allowing the NC system 5 to continue execution; when the detection result is abnormal, the control processing unit 2 keeps the M code completion signal disconnected, causing the NC system 5 to generate an M code timeout alarm, and the machine tool is paused.

[0100] The M code completion signal, also known as the M code response signal, is an important basis for the numerical control system to judge whether the external function is executed, and specifically, when executing some auxiliary functions through M code, the NC system 5 will wait for the external device to return the M code response signal to confirm that the action has been correctly executed. In the traditional numerical control system, this mechanism is usually realized by the machine tool PLC through setting a specific output point (such as G address, Q point). If the NC system 5 does not receive the completion signal within the preset time, it will be judged as a timeout fault, and an alarm (M code timeout alarm is a general function of numerical control machine tools) will be triggered, and the program running is paused to prevent accidents caused by misoperation.

[0101] In the embodiment, this general system function is ingeniously utilized to realize feedback control of the external broken tool detection result.

[0102] Specifically, the physical implementation of the feedback signal is as shown in Figure 1 The control processing unit 2 is connected to the M code completion signal loop of the machine tool through its built-in digital output terminal (such as Q0.0 in Figure 1 As shown in Figure 3 , the output Q0.0 signal is connected to the input terminal (such as ) of the machine tool, and the input point is defined by the machine tool manufacturer as the M code completion feedback signal; when the control processing unit 2 controls Q0.0 to be activated, it is equivalent to closing a relay contact, so that the M code completion signal is valid, and when Q0.0 is disconnected, the signal loop is not connected, causing the M code timeout alarm, and the NC system 5 considers it as not completed. It should be noted that the above process does not involve modification of the original PLC program, but only borrows the input terminal state to affect the behavior of the NC system 5.

[0103] The detection result and feedback logic are as follows: according to the result returned by the external tool break detection unit 4, the control processing unit 2 executes the following feedback strategy: if the detection result is normal (OK), control Q0.0 is activated, the M code completion signal loop is activated, the NC system 5 receives the completion signal, and the main program in the NC system 5 continues to execute the subsequent code; if the detection result is abnormal (KO), Q0.0 is kept open, and the M code completion signal is always invalid. At this time, the NC system 5 does not receive the completion signal, triggers the M code timeout alarm after a timeout waiting, and automatically suspends the machine tool. The above logic does not need to read and write PLC internal variables or modify the ladder diagram, only needs to connect the output terminal to the M completion signal input loop, and does not need complex configuration, and feedback can be realized by controlling the activation of the M code completion signal.

[0104] In some possible implementations, the intermediary device 100 further includes a power module, and the machine tool M code interface further includes a dynamic threshold value learning selection terminal; the power module is used to convert external alternating current into direct current working voltage to power the control processing unit 2, and the dynamic threshold value learning selection terminal is used to learn and complete threshold adjustment in calibration.

[0105] The power module is integrated in the intermediary device 100, and is used to convert external input alternating current (such as AC 220V ±10%, 50 / 60Hz) into stable direct current working voltage to provide working power supply for internal electronic components such as the control processing unit 2 and the communication interface. Optionally, the power module outputs multiple direct current voltages, including: +24V DC: used to drive digital output terminals (such as Q0.0), input terminals and the like; +24V DC also provides core power supply for the control processing unit 2 and the communication module.

[0106] The following comprehensively describes Figure 1 、 Figure 2 、 Figure 3 The intermediary device 100 for tool break detection of a machine tool based on M code PLC-free modification provided in the embodiment is comprehensively described.

[0107] As shown in Figures 1 to 3 , the device provided in the embodiment includes three parts: a machine tool M code interface 1, a tool detection unit interface 3 and a control processing unit 2.

[0108] Referring to Figure 2, the machine tool M code interface 1 is used to receive the M code signal of the machine tool NC system 5, and the activation state of the M code signal can indicate the operation type and the tool number, such as code Mx1 indicating teaching, Mx2 indicating detection, and Mx3~Mx8 indicating tool number (tool number) M code 1~6. In the machine tool M code interface 1, the machine tool side M code signal Mx1~Mx8 is connected to the digital input point I0.0~I0.7 of the intermediary device 100 through the X00~X07 line. After the intermediary device 100 receives the M code signal through the above connection relationship, the control processing unit 2 decodes and processes it. In addition, the Mx1~Mx8 code completion feedback signal is defined by the machine tool manufacturer, such as being defined as , the feedback signal terminal is connected with the machine tool M code interface 1, and the intermediary device 100 feeds back the tool breakage detection result to the machine tool NC system 5 (Q0.0→ ) through the machine tool M code interface 1.

[0109] The control processing unit 2 uses a programmable logic controller (PLC) to realize the tool detection related logic, and the specific model can be, for example, a Siemens S7-1200 PLC controller. The control processing unit 2 has built-in tool breakage detection process logic, including tool number decoding, detection command generation, detection data analysis, and abnormality judgment functions, and can also issue early warnings based on the dynamic threshold adjustment algorithm of historical detection data according to the detection data trend.

[0110] The control processing unit 2 has built-in core program blocks (not shown in the figure): organization block (OB), function block (FC), data block (DB), etc., which are used to realize tool detection control, data interaction, timing logic, and measurement data analysis functions.

[0111] Among them, the organization block (OB) is the main loop program block, which realizes the tool breakage detection core logic scheduling of the intermediary device 100 through the basic signal definition and function block call.

[0112] The function block (FC) includes: M code input processing block (M-code Input, FC1), tool detection block (BK_TOOL_CHECK, FC183), and measuring data save and analysis block (Measuring Data save+Analysis, FC2). Among them, FC1 is mainly responsible for the processing, delay control, and completion signal feedback of M code input functions. The tool detection block is used to interact with the external tool breakage detection unit 4, sends calibration or detection instructions and related parameters to it, and receives the return results of the external tool breakage detection unit 4 and stores them in the data block.

[0113] The data block (DB) comprises a core data block (BK_TOOL_DATA, DB206) and a timer data block (Timer_DB, DB2). The core data block is used to store the broken tool detection related data, and the timer data block is used to provide the memory of the timer variable.

[0114] The tool detection unit interface 3 is used to connect the control processing unit 2 and the external broken tool detection unit 4, and transmit the control instructions (demonstration / detection, etc.), the number of each tool, the target value (i.e. the reference value obtained by the calibration operation), and other data to the external broken tool detection unit 4 through the field bus (Filedbus). After the tool detection is completed, or when an error occurs in the detection, the detection result returned by the external broken tool detection unit 4 is received, including the tool number, the detection value, the detection conclusion (OK / KO), etc.

[0115] In summary, the broken tool detection intermediate device based on the M code PLC-free transformation of the numerical control machine tool provided in the embodiment can realize the broken tool detection according to the M code signal output by the NC system 5, which essentially breaks through the limitation of the traditional M code as an auxiliary function instruction.

[0116] Based on the same inventive concept, the embodiment further provides a broken tool detection method based on the M code PLC-free transformation of the numerical control machine tool, comprising:

[0117] A preset subroutine is called in the NC system of the numerical control machine tool to trigger the combined output of a plurality of M code signals, wherein the plurality of M code signals comprise a first M code, a second M code, and a plurality of third M codes, the first M code and the second M code correspond to two operation types of calibration operation and broken detection operation respectively, and the activation state of the plurality of third M codes is used to represent the number of the tool to be detected;

[0118] The external broken tool detection intermediate device collects the M code signals, and decodes the number of the tool to be detected and the operation type according to the activation state of the plurality of M code signals;

[0119] The external broken tool detection intermediate device controls the external broken tool detection unit to perform the corresponding operation according to the decoding result, and feeds back the detection result to the numerical control system;

[0120] The external broken tool detection intermediate device is the broken tool detection intermediate device based on the M code PLC-free transformation of the numerical control machine tool provided in any one of the above embodiments.

[0121] In the embodiment, the programmer inserts a subroutine call in the machining program of the NC system, and a plurality of M codes are output by the subroutine, so that the detection can be triggered by using the existing programming means without modifying the PLC logic. After the M code information is decoded, the number and operation type of the tool to be detected can be obtained, thereby playing a dual role of control instruction and data carrier, and driving the intelligent tool broken tool detection by standardized input (M code).

[0122] The application further provides a computer device, comprising a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method provided in the above embodiment.

[0123] The above merely provides the preferred embodiments of the application, and is not intended to limit the application. For those skilled in the art, the application can have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the application shall be included in the protection scope of the application.

Claims

1. A CNC machine tool broken tool detection intermediate device based on M-code without PLC modification, characterized in that, include: The machine tool M-code interface connects to the NC system of the CNC machine tool and receives M-code signals output by the NC system. The control processing unit is connected to the machine tool's M-code interface. Based on the activation status of multiple M-code signals, it decodes the number and operation type of the tool to be detected and generates control commands based on the decoding results. The tool inspection unit interface is connected to the control processing unit and is used to send the control commands to the external tool breakage detection unit and receive the detection results from the tool breakage detection unit. The control processing unit is also used to control the output state of the feedback signal according to the detection result, so as to provide feedback to the NC system on whether the detection is normal.

2. The apparatus as claimed in claim 1, characterized in that, The operation types include calibration operation and detection operation, and the M-code signal includes a first M-code and a second M-code, wherein the first M-code and the second M-code correspond to different M-code signal output terminals, wherein: The first M code is output by the first subroutine and is used to instruct the control processing unit to generate calibration instructions; The second M code is output by the second subroutine and is used to instruct the control processing unit to generate a detection command; The M-code signal also includes multiple third M-codes for representing tool numbers. The control processing unit decodes the tool number to be detected by identifying the activation state of the multiple third M-codes.

3. The apparatus as described in claim 2, characterized in that, The third M code has six parts, each corresponding to one of the six bits of a binary code, supporting the unique identification of tools numbered 1 to 64; If the number of third M codes provided by the machine tool is less than six, select the tools that need to be monitored for identification, and ensure that the number of monitored tools is less than or equal to the maximum number of third M codes encoded in binary combination.

4. The apparatus according to claim 3, characterized in that, Both the first subroutine and the second subroutine include a tool encoding module, which is used for: According to the preset encoding rules, the decimal form of the tool number to be tested is converted into binary code, and the binary code is mapped to the activation state of multiple third M codes.

5. The apparatus as claimed in claim 1, characterized in that, The control processing unit further includes a data storage module and an anomaly determination module. The data storage module is used to store the baseline state data and historical detection data of each tool. The anomaly determination module is used to determine tool fracture based on the historical detection data using a dynamic threshold algorithm.

6. The apparatus as claimed in claim 1, characterized in that, The tool breakage detection unit interface supports at least one fieldbus communication protocol among Profinet, Profibus, or DeviceNet, for bidirectional data interaction with an external tool breakage detection unit.

7. The apparatus as claimed in claim 1, characterized in that, The feedback signal is an M-code completion signal defined on the machine tool side, and the control processing unit controls the activation of the feedback signal through a digital output terminal; When the detection result is normal, the control processing unit activates the M-code completion signal loop, allowing the NC system to continue execution; When the detection result is abnormal, the control processing unit keeps the M-code completion signal disconnected, causing the NC system to generate an M-code timeout alarm and the machine tool to stop.

8. The apparatus according to claim 1, characterized in that, The intermediate device also includes a power module, and the machine tool M-code interface also includes a dynamic threshold learning selection terminal for learning and completing threshold adjustment during calibration; the power module is used to convert external AC power into DC operating voltage to power the control processing unit.

9. A method for detecting broken tools in CNC machine tools based on M-code without PLC modification, characterized in that, include: In the NC system of a CNC machine tool, a preset subroutine is called to trigger the combined output of multiple M-code signals. The multiple M-code signals include a first M-code, a second M-code, and multiple third M-codes. The first M-code and the second M-code correspond to two operation types: calibration operation and detection operation, respectively. The activation state of the multiple third M-codes is used to indicate the number of the tool to be detected. The tool breakage detection intermediate device collects the M-code signals output by the NC system and decodes the tool number and operation type to be detected based on the activation state of multiple M-code signals. The tool breakage detection intermediary device controls the external tool breakage detection unit to perform corresponding operations based on the decoding results, and feeds back the detection results to the CNC system; The tool breakage detection intermediary device is the CNC machine tool tool breakage detection intermediary device based on M-code without PLC modification as described in any one of claims 1 to 8.

10. A computer device, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the method of claim 9.

Citation Information

Patent Citations

  • Real-time monitoring system, device and method for tool breakage in machining process of numerical control machine tool

    CN112255967A

  • Machine tool cutter safety detection method and system and machine tool

    CN114102261A