Control method, operation control device and medium of numerical control system
By introducing program reading threads and command processing threads into the CNC system, and using the shared cache area for parallel decoding and command processing, the problem of low control command processing efficiency in the prior art is solved, and more efficient CNC system control is achieved.
Patent Information
- Application Number
- CN202211273728.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-18
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2042-10-18
AI Technical Summary
In existing CNC systems, program reading is sequential reading, resulting in low control command processing efficiency, inability to effectively bypass obstacles, and low port control efficiency.
By introducing program reading threads and command processing threads in the CNC system, and using a shared cache area, parallel decoding and command processing of CNC programs are realized, allowing combination asynchronous execution.
It improves the control efficiency of the CNC system, can bypass obstacles more effectively, and improves the efficiency of port control.
Smart Images

Figure CN115657605B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of numerical control technology, and in particular to a control method, an operation control device, and a medium of a numerical control system. Background Art
[0002] In current CNC systems, instructions are obtained by decoding CNC programs, thereby generating control commands for controlling the CNC system. However, program reading in related technologies is sequential reading, which requires waiting for command processing to be completed before continuing to read, and the efficiency of controlling the CNC system according to control commands is low. Summary of the invention
[0003] The purpose of the present application is to solve at least one of the technical problems existing in the prior art, and to provide a control method, an operation control device and a computer-readable storage medium for a numerical control system, which can simultaneously process the same group of instructions through a program reading thread and a command processing thread, thereby improving the efficiency of controlling the numerical control system.
[0004] In a first aspect, an embodiment of the present application provides a control method for a numerical control system, wherein the numerical control system includes a program reading thread, a command processing thread, and a shared cache area, wherein the program reading thread and the command processing thread communicate with the shared cache area respectively; the control method further includes:
[0005] Utilizing the program reading thread to obtain the numerical control program and decode it, and reading the target instruction obtained after decoding;
[0006] When the target instruction is a combination start instruction, the combination state in the shared cache area is set to an open state; the numerical control program is continued to be decoded, and the target instruction obtained after the decoding is read; the control command corresponding to the target instruction is cached in the shared cache area until the read target instruction is a combination end instruction, wherein the command processing thread controls the numerical control system in real time according to the control command and the combination state;
[0007] When a combination end instruction is read, the combination state is set to an end state; and the command processing thread is waited until the control command in the shared buffer area is processed completely;
[0008] Keep decoding the numerical control program until all codes in the numerical control program are decoded.
[0009] The control method of the numerical control system according to the embodiment of the present application has at least the following beneficial effects: using the program reading thread to obtain the numerical control program and decode it, and reading the target instruction obtained after decoding; when the target instruction is a combination start instruction, setting the combination state in the shared cache area to the open state; continuing to decode the numerical control program, reading the target instruction obtained after decoding; caching the control command corresponding to the target instruction to the shared cache area until the read target instruction is a combination end instruction, wherein the command processing thread controls the numerical control system in real time according to the control command and the combination state; when the combination end instruction is read, setting the combination state to the end state; waiting until the command processing thread completes processing the control command in the shared cache area; keeping decoding the numerical control program until all the codes in the numerical control program are decoded. According to the technical solution of the present application, when the combination state is the open state, the program reading thread keeps caching the control command corresponding to the target instruction to the shared cache area so that the command processing thread controls the numerical control system in real time according to the control command in the shared cache area and the combination state in the shared cache area, and uniformly processes the control commands in the same combination to achieve the purpose of improving the control efficiency.
[0010] According to some embodiments of the present application, the control method further includes:
[0011] In the case where the control command exists in the shared cache area, setting the command processing state in the shared cache area to an unfinished state, and using the command processing thread to obtain the control command and the combined state from the shared cache area;
[0012] Control the numerical control system according to the control command and the combined state;
[0013] When the control command is completed, the corresponding control command is removed from the shared buffer area;
[0014] In the case that the control command does not exist in the shared buffer area, the command processing status is set to a completion status.
[0015] According to some embodiments of the present application, the command processing thread controls the numerical control system according to the control command and the combined state, including:
[0016] When the combination state is an on state, caching the control command;
[0017] When the control delay duration corresponding to the control command is less than a preset delay duration threshold, the numerical control system is controlled according to the control command.
[0018] According to some embodiments of the present application, the command processing thread controls the numerical control system according to the control command and the combined state, and further includes:
[0019] When the combined state is a closed state, the numerical control system is controlled according to the control command.
[0020] According to some embodiments of the present application, the control method further includes:
[0021] When the control delay time is greater than or equal to a preset delay time threshold, the control delay time is reduced.
[0022] According to some embodiments of the present application, the control command is a linear motion command, and controlling the numerical control system according to the control command includes:
[0023] Obtaining the target motion axis number corresponding to the linear motion command;
[0024] Determine the single-axis motion position information according to the target motion axis number;
[0025] The movement of the numerical control system is controlled according to the single-axis motion position information.
[0026] According to some embodiments of the present application, the control command is a port control command, and controlling the numerical control system according to the control command includes:
[0027] The state of the digital output port in the numerical control system is controlled according to the port control command.
[0028] According to some embodiments of the present application, controlling the state of the digital output port in the numerical control system according to the port control command includes:
[0029] When the port control command is an open command, controlling the state of the digital output port to be an open state;
[0030] When the port control command is a close command, the state of the digital output port is controlled to be a close state.
[0031] According to some embodiments of the present application, the control command is a port detection command, and controlling the numerical control system according to the control command includes:
[0032] The numerical control system is detected according to the port detection command whether a detection signal is detected.
[0033] According to some embodiments of the present application, detecting whether the numerical control system receives a detection signal according to the port detection command includes:
[0034] Get the current target time and the preset waiting time threshold;
[0035] When the waiting time between the waiting time for acquiring the detection signal and the target time is greater than the waiting time threshold, an error reminder message is output.
[0036] In a second aspect, an embodiment of the present application provides an operation control device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned control method of the numerical control system when executing the computer program.
[0037] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the control method of the numerical control system described above.
[0038] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained through the structures particularly pointed out in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The accompanying drawings are used to provide further understanding of the technical solution of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the technical solution of the present application and do not constitute a limitation on the technical solution of the present application.
[0040] The present application is further described below with reference to the accompanying drawings and embodiments;
[0041] Figure 1 is a schematic diagram of a system architecture platform for executing a control method for a numerical control system provided in an embodiment of the present application;
[0042] Figure 2 is a flow chart of a control method of a numerical control system provided in an embodiment of the present application;
[0043] Figure 3 is a flow chart of a control method of a numerical control system provided by another embodiment of the present application;
[0044] Figure 4 yes Figure 3 A flowchart of an embodiment of a specific method of step S220;
[0045] Figure 5 yes Figure 4 A flowchart of another specific method embodiment of step S320 or step S410;
[0046] Figure 6is a flowchart of the specific method of step S710;
[0047] Figure 7 is a flowchart of the specific method of step S910;
[0048] Figure 8 is an execution comparison diagram of a control method of a numerical control system provided by another embodiment of the present application;
[0049] Fig. 9 It is a flowchart diagram of a program reading thread of a control method of a numerical control system provided by another embodiment of the present application;
[0050] Fig.10 It is a flowchart diagram of a command processing thread of a control method of a numerical control system provided by another embodiment of the present application;
[0051] Fig.11 is a flow chart of a linear motion command of a control method of a numerical control system provided by another embodiment of the present application;
[0052] Fig.12 It is a flow chart of port control commands of a control method of a numerical control system provided by another embodiment of the present application;
[0053] Fig.13 It is a flowchart of a port detection command of a control method of a numerical control system provided in another embodiment of the present application. DETAILED DESCRIPTION
[0054] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. In addition, the characteristics, operations or features described in the specification can be combined in any appropriate manner to form various implementation methods. At the same time, the steps or actions in the method description can also be replaced or adjusted in order in a manner that is obvious to those skilled in the art. Therefore, the various sequences in the specification and the accompanying drawings are only for the purpose of clearly describing a certain embodiment and are not meant to be a necessary sequence, unless otherwise specified that a certain sequence must be followed.
[0055] In the description of this application, the meaning of "above", "below", "exceed", etc. is not inclusive of the number itself, and the meaning of "above", "below", "within", etc. is inclusive of the number itself. If there is a description of "first" or "second", it is only used to distinguish the technical features, and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0056] The serial numbers of the components in this document, such as "first", "second", etc., are only used to distinguish the objects described and do not have any order or technical meaning. The "connection" and "coupling" mentioned in this application, unless otherwise specified, include direct and indirect connections (couplings).
[0057] In the description of this application, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in this application based on the specific content of the technical solution.
[0058] In current CNC systems, instructions are obtained by decoding CNC programs, thereby generating control commands for controlling the CNC system. However, program reading in related technologies is sequential reading, which requires waiting for command processing to be completed before continuing to read, and the efficiency of controlling the CNC system according to control commands is low.
[0059] The numerical control system in the related art also has the following disadvantages:
[0060] (1) In some scenarios where obstacles need to be bypassed, sequential execution of multiple axis linear motion can bypass obstacles, but the efficiency is low; although synchronous execution can improve efficiency, it may make it impossible to bypass obstacles;
[0061] (2) In the scenario of port control to clamp items, since the mechanism action after port control takes time, it is necessary to wait for a period of time before performing port detection to determine whether the clamping has been successful. At this time, the delay instruction and port detection instructions need to be executed sequentially, which is inconvenient to use;
[0062] (3) Due to the sequential execution mechanism of instructions, axis movement can only be executed after the port detection is successful, which is inefficient;
[0063] (4) The prior art also executes the CNC program through multiple channel analysis. However, when there are multiple CNC program files, the control logic is complex, prone to errors, and inconvenient to use.
[0064] The present invention provides a control method for a numerical control system, and the control instructions mainly involved include but are not limited to axis movement, port control, and port detection. When the numerical control program is a G code program, the current G code parsing process is to read and execute line by line in sequence, that is, the next instruction can be executed only after the current instruction is executed, and the operation efficiency is relatively low. Although the current G code supports multi-axis linkage operation, the operation trajectory moves along the direction of the resultant vector of the motion displacement, and the multiple axes reach the terminal position at the same time, the efficiency is improved, but in some scenes of avoiding obstacles, the multi-axis linkage may not be able to avoid obstacles.
[0065] At the same time, during the movement process, it will also involve interaction with external ports, such as port control and port detection. In order to ensure the port timing, delay waiting instructions are often added. These instructions can only be executed in sequence, which greatly reduces efficiency.
[0066] The present invention provides a new control method, which expands the linear motion, port control and port detection instructions, and can set the delayed execution of these instructions separately, and can perform combined asynchronous execution.
[0067] Based on the above situation, the embodiment of the present application provides a control method, an operation control device and a computer-readable storage medium for a numerical control system, including using a program reading thread to obtain a numerical control program and decode it, and reading a target instruction obtained after decoding; when the target instruction is a combination start instruction, setting the combination state in the shared cache area to an open state; continuing to decode the numerical control program, reading the target instruction obtained after decoding; caching the control command corresponding to the target instruction to the shared cache area until the target instruction read is a combination end instruction, wherein the command processing thread controls the numerical control system in real time according to the control command and the combination state; when the combination end instruction is read, setting the combination state to an end state; waiting until the command processing thread completes processing the control command in the shared cache area; keeping decoding the numerical control program until all the codes in the numerical control program are decoded. According to the technical solution of the present application, when the combination state is an open state, the program reading thread keeps caching the control command corresponding to the target instruction to the shared cache area so that the command processing thread controls the numerical control system in real time according to the control command in the shared cache area and the combination state in the shared cache area, and uniformly processes the control commands in the same combination to achieve the purpose of improving the control efficiency.
[0068] The embodiments of the present application are further described below in conjunction with the accompanying drawings.
[0069] like Figure 1 As shown, Figure 1 It is a schematic diagram of a system architecture platform for executing a control method for a numerical control system provided by an embodiment of the present application.
[0070] The system architecture platform 1000 of the embodiment of the present application includes one or more processors 1001 and a memory 1002. Figure 1 In the figure, a processor 1001 and a memory 1002 are taken as an example.
[0071] The processor 1001 and the memory 1002 may be connected via a bus or other means. Figure 1 The example of connecting through bus is taken in the following.
[0072] The memory 1002, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer executable programs. In addition, the memory 1002 may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 1002 may optionally include a memory 1002 remotely arranged relative to the processor 1001, and these remote memories may be connected to the system architecture platform 1000 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0073] Those skilled in the art will understand that Figure 1 The device structure shown in the figure does not constitute a limitation on the system architecture platform 1000, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0074] exist Figure 1 In the system architecture platform 1000 shown, the processor 1001 can be used to call the control program of the numerical control system stored in the memory 1002, so as to implement the control method of the numerical control system.
[0075] Based on the hardware structure of the above-mentioned system architecture platform 1000, various embodiments of the control method of the numerical control system of the present application are proposed.
[0076] like Figure 2 As shown, Figure 2 It is a flow chart of a control method of a numerical control system provided by an embodiment of the present application. The control method of the numerical control system of the embodiment of the present application, the numerical control system includes a program reading thread, a command processing thread and a shared cache area, the program reading thread and the command processing thread communicate with the shared cache area respectively; the control method includes but is not limited to step S100, step S200, step S300, step S400.
[0077] Step S100, using a program reading thread to obtain a numerical control program and decode it, and reading a target instruction obtained after decoding.
[0078] In this step, the NC program refers to any related NC system, such as a NC program in a motion control system, such as a G code program, and the program reading thread refers to any program reading thread in the related art. The program reading thread can be pre-set so that the NC program can be read. Acquiring the NC program and decoding it means that after obtaining the NC program from the input or cache, the NC program is decoded using any decoding method in the related art, so that the target instruction can be obtained. The target instruction obtained after reading and decoding is to facilitate the grouping and processing of the target instruction according to the target instruction in the subsequent steps.
[0079] In another embodiment of the present application, the program reading thread and the command processing thread refer to threads in the numerical control system, the program reading thread is used to read the numerical control program to obtain control commands, and the command processing thread is used to control the numerical control system according to the control commands. The program reading thread and the command processing thread communicate with the shared cache area respectively, thereby facilitating data interaction between the program reading thread and the command processing thread, that is, facilitating the synchronous update of corresponding control commands, combination status and other information.
[0080] In another embodiment of the present application, the target instruction corresponds to a numerical control program. In the numerical control program, the target instruction may include multiple instruction types. The instruction type of the target instruction may be preset. For example, M64 and M65 represent port control instructions, M74 and M75 represent combined state instructions, and G01 represents a linear motion instruction.
[0081] Step S200, when the target instruction is a combination start instruction, set the combination state in the shared cache area to the open state; continue to decode the CNC program, and read the target instruction obtained after decoding; cache the control command corresponding to the target instruction to the shared cache area until the target instruction read is a combination end instruction, wherein the command processing thread controls the CNC system in real time according to the control command and the combination state.
[0082] In this step, when the target instruction is a combination start instruction, it is characterized that the target instructions after the target instruction all belong to the same combination, and the combination state in the shared cache area is set to the on state; the CNC program continues to be decoded, and the target instruction obtained after decoding is read; the control command corresponding to the target instruction is cached in the shared cache area until the read target instruction is the combination end instruction, wherein the command processing thread controls the CNC system according to the control command and the combination state in real time, that is, after the command processing thread reads the control command in the shared cache area, it controls the CNC system according to the control command and the combination state, and when the combination state is the on state, the program reading thread continues to decode the CNC program, thereby achieving the purpose of simultaneously processing the control commands in the same combination, reducing the low efficiency of control command execution caused by the sequential execution of control commands, and improving the command execution efficiency.
[0083] In another embodiment of the present application, the combined status and control commands are cached in a shared cache area, so that when the command processing thread interacts with the shared cache area, the CNC system can be controlled according to the control commands and the combined status. It can be understood that the command processing thread and the program reading thread communicate with the shared cache area respectively, and the command processing thread can also be a real-time thread that is executed periodically.
[0084] In another embodiment of the present application, the combination state can be controlled to be an on state or a off state by setting a Boolean parameter in the shared cache area. When the combination state is an on state, the combination state parameter value in the shared cache area is 1, and when the combination state is an off state, the combination state parameter value in the shared cache area is 0.
[0085] Step S300, when a combination end instruction is read, the combination state is set to the end state; and the command processing thread is waited until the control command in the shared buffer area is processed.
[0086] In this step, when the combined end instruction is read, it indicates that the target instruction of the same combination has been read. The combined state is set to the end state, that is, the combined state in the shared cache is set to the end state. Wait until the command processing thread completes the processing of the control command in the shared cache, that is, the program reading thread suspends the decoding of the CNC program, and the program reading thread waits for the command processing thread to control the CNC system according to the control command and the combined state until all the control commands in the shared cache are processed, so that the target instructions of the same combination can be executed and then decoded, reducing the situation where the target instructions of the same combination are not fully executed, resulting in errors in the subsequent sequential execution of non-combined target instructions, thereby improving the rationality of control.
[0087] In another embodiment of the present application, the command processing thread controls the numerical control system in real time according to the control command and the combination status. Since the program reading thread and the command processing thread communicate through a shared cache area, the program reading thread caches the read control command and the combination status into the shared cache area, so that the command processing thread can obtain the control command and the combination status from the shared cache area. The present application is provided with a shared cache area. When the program reading thread causes the combination status to change, the command processing thread can simultaneously read the updated combination status, thereby achieving the purpose of improving the control accuracy of the numerical control system.
[0088] In another embodiment of the present application, the target instructions are located in the same combination, indicating that the control commands corresponding to the target instructions belong to a whole, and the command processing thread needs to control the CNC system according to the control commands corresponding to the target instructions in the combination and then continue to decode the CNC program.
[0089] Step S400: Keep decoding the NC program until all codes in the NC program are decoded.
[0090] In this step, the program reading thread keeps decoding the numerical control program until all codes in the numerical control program are decoded, thereby realizing the function of reading the numerical control program.
[0091] In the embodiment of steps S100 to S400, the program reading thread is used to obtain the CNC program and decode it, and the target instruction obtained after decoding is read; when the target instruction is a combination start instruction, the combination state in the shared cache area is set to the open state; the CNC program is continued to be decoded, and the target instruction obtained after decoding is read; the control command corresponding to the target instruction is cached in the shared cache area until the read target instruction is a combination end instruction, wherein the command processing thread controls the CNC system in real time according to the control command and the combination state; when the combination end instruction is read, the combination state is set to the end state; wait until the command processing thread completes processing the control command in the shared cache area; keep decoding the CNC program until all the codes in the CNC program are decoded. According to the scheme of the embodiment of the present application, when the combination state is the open state, the program reading thread keeps caching the control command corresponding to the target instruction in the shared cache area so that the command processing thread controls the CNC system in real time according to the control command in the shared cache area and the combination state in the shared cache area, and uniformly processes the control commands in the same combination to achieve the purpose of improving the control efficiency.
[0092] It is worth noting that referring to Fig. 9 , Fig. 9 It is a flowchart of the program reading thread decoding the CNC program. When the G code, that is, the CNC program, is read, the G code is parsed into instructions, that is, decoded and the target instruction is obtained. The target instruction includes control instructions and combination instructions. The combination instruction includes combination start instruction and combination end instruction. For example, M74 is a combination start instruction, and M75 is a combination end instruction. The control instruction includes Fig. 9 Any control instruction shown in S1120 to S1123 has a corresponding control command, and the control command is written into the shared cache area. It can be understood that a command cache area for caching commands can be set in the shared cache area. When the combined state is turned on, the G code continues to be parsed into instructions; when the combined state is turned off, wait for all commands to be processed, that is, wait until the command processing state is completed.
[0093] In one embodiment, referring to Figure 3 The control method also includes but is not limited to the following steps S210, S220, S230 and S240.
[0094] Step S210, when there is a control command in the shared cache, the command processing state in the shared cache is set to an unfinished state, and the control command and the combined state are obtained from the shared cache by using the command processing thread.
[0095] In this step, the command processing status is used to record the processing status of the control command in the shared cache area, so that the program processing thread and the command processing thread can determine the status of the control command in the shared cache area. When there is a control command in the shared cache area, it indicates that the command processing thread executes and processes the control command. Therefore, the command processing thread can be a thread that runs periodically in real time. The command processing thread can also be a thread that is triggered to execute based on whether there is a control command in the shared cache area. The command processing thread obtains the control command and the combined status from the shared cache area to facilitate the control of the CNC system in subsequent steps.
[0096] In another embodiment of the present application, the control commands in the shared cache area and the combined status in the shared cache area are both written by the program reading thread. In an optional implementation, the command processing thread periodically determines whether there is a control command in the shared cache area. If not, the cycle ends. If so, the control command is obtained to control the CNC system in subsequent steps, thereby saving the thread running overhead and achieving the purpose of improving the rationality of control.
[0097] In another embodiment of the present application, when the combination state is in the on state, there may be multiple control commands in the shared cache area, and the command processing thread may sequentially read the control commands in the shared cache area.
[0098] Step S220, controlling the numerical control system according to the control command and the combination state.
[0099] In this step, the CNC system refers to any CNC system in the relevant technology, and is not specifically limited here. The combination state can characterize whether the current control command belongs to the same combination as other control commands. Controlling the CNC system according to the control command and the combination state refers to controlling the CNC system according to specific control commands, such as controlling the movement of the CNC system or controlling the CNC system to grab objects, detecting the ports of the CNC system, etc. The combination state is used to determine whether the timing of the control command needs to be adjusted to improve the effectiveness of controlling the CNC system.
[0100] Step S230: When the control command is completed, the corresponding control command is removed from the shared buffer area.
[0101] In this step, when the control command is completed, it indicates that the command processing thread has controlled the numerical control system according to the control command, and the corresponding control command is removed from the shared cache area, thereby freeing up space in the shared cache area to achieve the purpose of improving the utilization rate of the shared cache area.
[0102] Step S240: When there is no control command in the shared buffer area, the command processing state is set to a completed state.
[0103] In this step, when there is no control command in the shared cache area, it means that all control commands corresponding to the same combination have been executed, or the control commands executed sequentially have been executed, so the command processing status is set to the completed status, so that the program reading thread can continue to decode the CNC program and improve the rationality of the system.
[0104] In the embodiment of step S210 to step S240, a command processing thread is used to obtain a control command and a combination status from a shared cache area; the numerical control system is controlled according to the control command and the combination status; when the control command is completed, the corresponding control command is removed from the shared cache area; when the control command does not exist in the shared cache area, the command processing status is set to a completed status. According to the scheme of the embodiment of the present application, a command processing thread is used to interact with the shared cache area to control the numerical control system, thereby achieving the purpose of improving the effectiveness of control.
[0105] It is worth noting that referring to Fig.10 , Fig.10 It is a workflow diagram of the command processing thread. The command processing thread can be a periodically executed thread. First, the command processing thread determines whether the command buffer is empty, that is, whether there is a control command in the shared buffer. If it is not empty, the control command is read, and the numerical control system is controlled according to the control command according to the command type. When the control execution corresponding to the control command is completed, the corresponding command is removed from the command buffer and the command processing status is set to the completion status, so that the program reading thread can continue to decode the numerical control program. When all the control commands in the command buffer are read, the command processing thread cycle ends; when all the control commands in the command buffer have not been read, the command processing thread continues to read and determine whether there is a control command in the command buffer, and reads the control command.
[0106] In one embodiment, referring to Figure 4 , step S220 includes but is not limited to the following steps S310 and S320.
[0107] Step S310: When the combination state is in the on state, cache control commands.
[0108] In this step, when the combination state is on, it indicates that there are multiple control commands belonging to the same group, and the command processing thread caches the control commands, so as to facilitate the subsequent steps to determine whether to execute the control commands belonging to the same group simultaneously, that is, to control the CNC system according to multiple control commands.
[0109] In another embodiment of the present application, when the combination state is in the on state, the program reading thread continues to decode the CNC program until the target instruction read is the combination end instruction. That is to say, the program reading thread and the command processing thread do not interfere with each other. All control commands belonging to the same group are read first, and then the command processing thread controls the CNC system according to the control command, thereby achieving the purpose of improving control efficiency.
[0110] Step S320: When the control delay time corresponding to the control command is less than a preset delay time threshold, the numerical control system is controlled according to the control command.
[0111] In this step, a control delay duration may be preset, and the preset delay duration threshold refers to the preset delay duration threshold. The control delay duration corresponds to the control command. When the control delay duration corresponding to the control command is less than the preset delay duration threshold, it indicates that the command processing thread needs to control the CNC system according to all control commands of the same group. Since the command processing thread has cached the control commands in advance, it can directly control the CNC system according to all control commands belonging to the same group in the cache.
[0112] In the embodiment of step S310 to step S320, when the combination state is the on state, the control command is cached; when the control delay duration corresponding to the control command is less than the preset delay duration threshold, the CNC system is controlled according to the control command. According to the scheme of the embodiment of the present application, the purpose of simultaneously executing all control commands belonging to the same group is achieved by setting the delay duration, thereby improving the control efficiency and rationality of the control.
[0113] In one embodiment, step S220 includes but is not limited to the following step S410.
[0114] Step S410: When the combination state is the closed state, the numerical control system is controlled according to the control command.
[0115] In this step, when the combination state is closed, it indicates that the command processing thread directly controls the numerical control system according to the control command, and the program reading thread can wait for the command processing thread to complete processing of the corresponding control command before continuing to read the numerical control program.
[0116] In another embodiment of the present application, when the combination state is a closed state, it indicates that there is no grouping between the control commands, and controlling the numerical control system according to the control commands means controlling the numerical control system alone according to the current control commands.
[0117] In the embodiment of step S410, when the combination state is in the closed state, the numerical control system is controlled according to the control command. According to the scheme of the embodiment of the present application, for the control command processed when the combination state is in the closed state, it is only necessary to directly control the numerical control system according to the control command, so as to achieve the purpose of controlling the numerical control system. The control command corresponding to the closed state of the combination state and the control command corresponding to the open state of the combination state do not interfere with each other, thereby achieving the purpose of improving the rationality of control.
[0118] In one embodiment, the control method includes but is not limited to the following steps S510.
[0119] Step S510: when the control delay time is greater than or equal to a preset delay time threshold, reduce the control delay time.
[0120] In this step, when the control delay duration is greater than or equal to the preset delay duration threshold, it indicates that the command processing thread does not need to control the CNC system according to the control commands in the cache, so the control delay duration is reduced to achieve the purpose of controlling the CNC system according to the control commands of the same group.
[0121] In another embodiment of the present application, the control delay duration can be reduced by setting a decreasing duration with a fixed duration value each time, or by setting a target duration that increases according to the number of control commands, thereby setting the duration for each decrease according to the number of control commands in the cache, thereby achieving the purpose of reducing the control delay duration.
[0122] In the embodiment of step S510, when the control delay duration is greater than or equal to the preset delay duration threshold, the control delay duration is reduced. According to the scheme of the embodiment of the present application, the purpose of controlling the CNC system according to the control commands of the same group is achieved by decreasing the control delay duration.
[0123] In one embodiment, referring to Figure 5 , the control command is a linear motion command, step S320 or step S410 includes but is not limited to the following steps S610, S620 and S630.
[0124] Step S610, obtaining the target motion axis number corresponding to the linear motion command.
[0125] In this step, the linear motion command refers to a linear motion command used to control the CNC system to move linearly along the axis corresponding to the target motion axis number. The target motion axis number in the linear motion command is obtained to facilitate the acquisition of single-axis motion position information in subsequent steps.
[0126] In another embodiment of the present application, when the combination state is in the on state, the linear motion command refers to the linear motion command in the cache, there may be multiple linear motion commands in the cache, and obtaining the target motion axis number corresponding to the linear motion command refers to obtaining multiple target motion axis numbers corresponding to the linear motion commands respectively.
[0127] Step S620, determining single-axis motion position information according to the target motion axis number.
[0128] In this step, the single-axis motion position information refers to the motion position information corresponding to the linear motion command. In an optional implementation, the linear motion command is "G01 X100", G01 represents the linear motion command, and the target motion axis number is X, that is, it is necessary to control the CNC system to move 100 distance units in the X-axis direction. Since it is a linear motion, it is necessary to determine all the motion position information of the CNC system from the starting point to the end point.
[0129] Step S630, controlling the movement of the numerical control system according to the single-axis motion position information.
[0130] In this step, the movement of the numerical control system is controlled according to the single-axis motion position information, so that the numerical control system moves according to the single-axis motion position information, thereby achieving the purpose of controlling the movement of the numerical control system.
[0131] In another embodiment of the present application, when the combination state is in the open state, there are multiple single-axis motion position information, and controlling the movement of the numerical control system according to the single-axis motion position information means controlling the movement of the numerical control system according to the multiple single-axis motion position information at the same time, referring to Fig.10 , while controlling the CNC system to avoid obstacles, and controlling the movement of the CNC system according to multiple single-axis motion position information, it can achieve Fig.10 The effect of asynchronous execution can reduce the situation where the CNC system encounters obstacles when moving according to the combined axis motion position information. Compared with sequential execution or synchronous execution, it can also achieve the purpose of improving control efficiency.
[0132] In the embodiment of step S610 to step S630, the target motion axis number corresponding to the linear motion command is obtained; the single-axis motion position information is determined according to the target motion axis number; the movement of the CNC system is controlled according to the single-axis motion position information. According to the scheme of the embodiment of the present application, the movement of the CNC system is simultaneously controlled according to the single-axis motion position information, thereby achieving the purpose of improving the rationality of the control of the CNC system and improving the control efficiency.
[0133] It is worth noting that referring to Fig.11 , Fig.11The figure is a schematic diagram of the linear motion command processing flow. When the control command is a linear motion command, first determine whether the combined state in the shared cache area is in the on state. If so, obtain the target motion axis number corresponding to the linear motion command. Then, refer to steps S1311 to S1319 to cache the linear motion command. Secondly, determine whether the delayed execution is completed, that is, whether the control delay duration is less than the preset delay duration threshold. If so, obtain the motion position information corresponding to the linear motion command through the single-axis trajectory planner of step S1331, so as to control the CNC system according to the linear motion command. When the combined state is in the off state, cache the motion command according to step S1310, without distinguishing the specific axis number, so as to obtain the combined motion position information through the combined axis trajectory planner of step S1330, so as to control the CNC system according to the linear motion command. In an optional embodiment, refer to Figure 8 , when the linear motion command is "G01Y300 X500", when the combined state is turned on, it is necessary to distinguish the axis number and plan the motion trajectory for a single axis. Figure 8 The motion trajectory executed asynchronously in the combination state is closed, and only the combined trajectory needs to be planned, and the following is obtained: Figure 8 The motion trajectory executed synchronously in .
[0134] In one embodiment, step S320 or step S410 further includes but is not limited to the following step S710.
[0135] Step S710, controlling the state of the digital output port in the numerical control system according to the port control command.
[0136] In this step, the port control command refers to a port control command used to control the state of a digital output port in a numerical control system. In the scenario of controlling the numerical control system to grasp an object, the digital output port can be easily detected after it is opened.
[0137] In another embodiment of the present application, when the combination state is in the closed state, the program reading thread caches the port control command to the shared cache area, thereby waiting for the command processing thread to control the CNC system according to the port control command. The command processing thread controls the CNC system according to the port control command, and sets the command processing status in the shared cache area to the completed state. After reading the command processing status as the completed state, the program reading thread continues to decode the CNC program, thereby achieving the purpose of controlling the CNC system according to the control command.
[0138] It is worth noting that referring to Fig.12, if the control command is a port control command, it is determined whether the combination state is on. If yes, step S1410 is executed to cache the port control command and determine whether the delayed execution is completed, that is, whether the control delay time is less than the preset delay time threshold. If it is satisfied, the port control is executed to control the state of the digital output port of the numerical control system; if it is not satisfied, the control delay time is decreased; when the combination state is off, the port control is directly executed. In an optional embodiment, refer to Fig. 9 The port control command is M64 or M65, which respectively means controlling the digital output port to open or close.
[0139] In the embodiment of step S710, when the combination state is in the closed state, the state of the digital output port in the numerical control system is controlled according to the port control command. According to the scheme of the embodiment of the present application, the port control commands are executed sequentially, thereby achieving the purpose of controlling the numerical control system according to the control command.
[0140] In one embodiment, referring to Figure 6 , step S710 also includes but is not limited to the following steps S810 and S820.
[0141] Step S810: When the port control command is an open command, control the state of the digital output port to be an open state.
[0142] In this step, when the port control command is an open command, the state of the digital output port is controlled to be an open state, so that any detection signal in the relevant technology can be emitted through the digital output port to detect the accuracy of the control of the numerical control system, thereby achieving the purpose of improving the rationality of the control.
[0143] Step S820: When the port control command is a close command, control the state of the digital output port to be a close state.
[0144] In this step, when the port control command is a closing command, the state of the digital output port is controlled to be a closing state, so that the digital output port is closed and cannot output a signal.
[0145] In the embodiment of step S810 to step S820, when the port control command is an open command, the state of the digital output port is controlled to be an open state; when the port control command is a close command, the state of the digital output port is controlled to be a closed state. According to the scheme of the embodiment of the present application, the state of the digital port is controlled to be an open state or a closed state, thereby facilitating the detection of the control of the numerical control system and achieving the purpose of improving the rationality of the control.
[0146] It is worth noting that the port control instructions may include "M64" and "M65", which represent opening the port and closing the port respectively, so that it is easy to determine whether the corresponding port control command is an opening command or a closing command, thereby improving the convenience of control.
[0147] In one embodiment, step S320 or step S410 further includes but is not limited to the following step S910.
[0148] Step S910: Detect whether the numerical control system detects a detection signal according to the port detection command.
[0149] In this step, the preset port detection delay time refers to an arbitrary preset time, and the preset port detection time threshold refers to an arbitrary preset time threshold. When the combination state is on and the preset port detection delay time is less than the preset port detection time threshold, it indicates that the port detection command can be executed. Therefore, the port detection command is cached, and the CNC system is detected according to the port detection command to detect whether the detection signal is detected, thereby achieving the purpose of improving the rationality of control.
[0150] In another embodiment of the present application, the port detection command can be cached to any cache area, thereby facilitating the control of the numerical control system. Since the port detection delay time is set, the situation where the detection signal cannot be detected due to the port not being opened and the detection signal being sent can be reduced, thereby improving the effectiveness of the control.
[0151] In an alternative embodiment, referring to Fig.13 The control command is a port detection command. When the combination state is on, the port detection command is cached to determine whether the delayed execution is completed, that is, whether the control delay duration is less than the preset delay duration threshold. If it is satisfied, it detects whether the CNC system detects a detection signal, wherein the detection signal refers to a detection signal issued when the port control command opens the digital port in the CNC system. Specifically, when the CNC system is controlled to clamp an object, detecting a detection signal indicates that the object is clamped and the control of the CNC system is normal. Failure to detect a detection signal indicates that the object is not clamped and an error occurs in the control of the CNC system.
[0152] In the embodiment of step S910, it is detected whether the CNC system detects the detection signal according to the port detection command. According to the scheme of the embodiment of the present application, since a port detection delay time is set, it can reduce the situation where the detection signal cannot be detected due to the port not being opened and sending the detection signal, thereby improving the effectiveness of control.
[0153] In one embodiment, referring to Figure 7 , step S910 also includes but is not limited to the following steps S1010 and S1020.
[0154] Step S1010, obtaining the current target time and a preset waiting time threshold.
[0155] In this step, the target time refers to the current time, and the preset waiting time threshold is an arbitrary time set in advance. The current target time and the preset waiting time threshold are obtained to facilitate the subsequent steps in determining whether the detection signal is detected.
[0156] Step S1020: when the waiting time between the waiting time for obtaining the detection signal and the target time is greater than the waiting time threshold, output an error reminder message.
[0157] In this step, the waiting time threshold refers to any pre-set time, and the detection signal refers to the detection signal that has been sent out after the port is opened. As long as the purpose of judging whether the control of the numerical control system is successful can be achieved, no specific limitation is made here. In the case where the waiting time between the waiting time for obtaining the detection signal and the target time is greater than the waiting time threshold, it indicates that the waiting time is too long, and it is determined that the detection signal cannot be detected, so an error reminder message is output, thereby achieving the purpose of improving the rationality of the control.
[0158] In the embodiment of step S1010 to step S1020, the current target time and the preset waiting time threshold are obtained; when the waiting time between the waiting time of the signal of the digital output port and the target time is greater than the waiting time threshold, an error reminder message is output. According to the scheme of the embodiment of the present application, the rationality of control can be improved.
[0159] Another embodiment of the present application further provides an operation control device, which includes: a processor, a memory, and a computer program stored in the memory and executable on the processor.
[0160] The processor and the memory may be connected via a bus or other means.
[0161] It should be noted that the operation control device in this embodiment may include: Figure 1 The processor 1001 and the memory 1002 in the illustrated embodiment both belong to the same inventive concept, and therefore both have the same implementation principle and beneficial effects, which will not be described in detail here. The non-transient software program and instructions required to implement the control method of the numerical control system of the above embodiment are stored in the memory, and when executed by the processor, the control method of the numerical control system of the above embodiment is executed.
[0162] Yet another embodiment of the present application provides an air conditioner, which includes the above-mentioned operation control device.
[0163] It is worth noting that since the air conditioner of the embodiment of the present invention has the operation control device of the above embodiment, and the operation control device of the above embodiment can execute the control method of the numerical control system of the above embodiment, the specific implementation manner and technical effects of the air conditioner of the embodiment of the present invention can refer to the specific implementation manner and technical effects of the control method of the numerical control system of any of the above embodiments.
[0164] Another embodiment of the present application further provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are used to execute the control method of the numerical control system described above, for example, Figure 1 The execution of one of the processors 1001 in the embodiment may enable the one or more processors to execute the control method of the numerical control system in the above method embodiment, for example, to execute the above described Figure 2 Steps S100 to S400 of the method, Figure 3 Steps S210 to S240 of the method, Figure 4 Method steps S310 to S320, method step S410, method step S510, Figure 5 Method steps S610 to S630, method step S710, Figure 6 Method steps S810 to S820, method step S910, Figure 7 Method steps S1010 to S1020.
[0165] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network nodes. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0166] It will be appreciated by those skilled in the art that all or some of the steps and systems in the disclosed method above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer-readable storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer-readable storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer-readable storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
Claims
1. A control method for a numerical control system, characterized in that: The numerical control system comprises a program reading thread, a command processing thread and a shared cache area, wherein the program reading thread and the command processing thread communicate with the shared cache area respectively; The control method comprises: Utilizing the program reading thread to obtain the numerical control program and decode it, and reading the target instruction obtained after decoding; When the target instruction is a combination start instruction, the combination state in the shared cache area is set to an open state; the numerical control program is continued to be decoded, and the target instruction obtained after the decoding is read; the control command corresponding to the target instruction is cached in the shared cache area until the read target instruction is a combination end instruction, wherein the command processing thread controls the numerical control system in real time according to the control command and the combination state; When a combination end instruction is read, the combination state is set to an end state; and the command processing thread is waited until the control command in the shared buffer area is processed completely; Keep decoding the numerical control program until all codes in the numerical control program are decoded.
2. The control method of the numerical control system according to claim 1, characterized in that: The control method further comprises: In the case where the control command exists in the shared cache area, setting the command processing state in the shared cache area to an unfinished state, and using the command processing thread to obtain the control command and the combined state from the shared cache area; Control the numerical control system according to the control command and the combined state; When the control command is completed, the corresponding control command is removed from the shared buffer area; In the case that the control command does not exist in the shared buffer area, the command processing status is set to a completion status.
3. The control method of the numerical control system according to claim 2, characterized in that: The command processing thread controls the numerical control system according to the control command and the combined state, including: When the combination state is an on state, caching the control command; When the control delay duration corresponding to the control command is less than a preset delay duration threshold, the numerical control system is controlled according to the control command.
4. The control method of the numerical control system according to claim 3, characterized in that: The command processing thread controls the numerical control system according to the control command and the combined state, and further includes: When the combined state is a closed state, the numerical control system is controlled according to the control command.
5. The control method of the numerical control system according to claim 3, characterized in that: The control method further comprises: When the control delay time is greater than or equal to a preset delay time threshold, the control delay time is reduced.
6. The control method of a numerical control system according to claim 3 or 4, characterized in that: The control command is a linear motion command, and controlling the numerical control system according to the control command includes: Obtaining the target motion axis number corresponding to the linear motion command; Determine the single-axis motion position information according to the target motion axis number; The movement of the numerical control system is controlled according to the single-axis motion position information.
7. The control method of a numerical control system according to claim 3 or 4, characterized in that: The control command is a port control command, and the step of controlling the numerical control system according to the control command includes: The state of the digital output port in the numerical control system is controlled according to the port control command.
8. The control method of a numerical control system according to claim 7, characterized in that: The step of controlling the state of the digital output port in the numerical control system according to the port control command comprises: When the port control command is an open command, controlling the state of the digital output port to be an open state; When the port control command is a close command, the state of the digital output port is controlled to be a close state.
9. The control method of a numerical control system according to claim 3 or 4, characterized in that: The control command is a port detection command, and the step of controlling the numerical control system according to the control command includes: The numerical control system is detected according to the port detection command whether a detection signal is detected.
10. The control method of a numerical control system according to claim 9, characterized in that: The step of detecting whether the numerical control system receives a detection signal according to the port detection command comprises: Get the current target time and the preset waiting time threshold; When the waiting time between the waiting time for acquiring the detection signal and the target time is greater than the waiting time threshold, an error reminder message is output.
11. An operation control device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the control method of the numerical control system as claimed in any one of claims 1 to 10 when executing the computer program.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the control method of the numerical control system according to any one of claims 1 to 10.
Citation Information
Patent Citations
Numerical controller and control method
CN115552343A