Data calling method and device of computer numerical control system and related equipment

By introducing a server to manage real handles in the computer numerical control system and using the mapping relationship between logical handles and work units, the problem of low data retrieval efficiency caused by the limited number of real handles is solved, and concurrent data retrieval by multiple clients is realized.

CN122633253APending Publication Date: 2026-08-25BEIJING FANUC MECHATRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611057359.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-16
Publication Date
2026-08-25

AI Technical Summary

Technical Problem

In computer numerical control (CNC) systems, due to the limited number of real handles, prolonged client occupancy prevents other clients from accessing CNC system data, resulting in low data retrieval efficiency.

Method used

By introducing server-side management of real handles, and through the mapping relationship between logical handles and work units, the client interacts with the server, and the server interacts with the CNC system to manage the real handles and prevent the client from directly occupying them.

Benefits of technology

This improves the data retrieval efficiency of the CNC system, allowing a single real handle to serve multiple client retrieval requests simultaneously, thus avoiding data retrieval blocking caused by clients occupying the real handle for extended periods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122633253A_ABST
    Figure CN122633253A_ABST
Patent Text Reader

Abstract

The application provides a data calling method and device of a computer numerical control system and related equipment, and the method comprises the following steps: receiving a calling request sent by a client, wherein the calling request comprises a first logical handle of the client and an identifier of first data required to be called by the client; determining a first work unit corresponding to the first logical handle, wherein a first mapping relationship is a mapping relationship between the first work unit and at least one logical handle, the at least one logical handle comprises the first logical handle, the first work unit is one work unit in a plurality of work units configured by a server, and the first work unit is configured with a first real handle of a CNC system; determining a first calling type corresponding to the first data; calling the first data stored in the CNC system based on the first calling type, the first real handle and the identifier of the first data through the first work unit; and sending the first data to the client. The application can improve the data calling efficiency of the CNC system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and specifically to a data retrieval method, apparatus, and related equipment for a computer numerical control system. Background Technology

[0002] A Computer Numerical Control (CNC) system connects to a client. When a client needs to access data from the CNC system, it requests a physical handle from the interface library and then uses that handle to access the CNC system's data. However, in related technologies, the number of clients that a CNC system can connect to is limited, and the number of physical handles in the interface library is also limited. In actual production, some clients may continue to use physical handles after accessing CNC system data, preventing other clients from accessing CNC system data through the physical handles, resulting in low data retrieval efficiency for the CNC system.

[0003] It is evident that the data retrieval efficiency of CNC systems is low in related technologies. Summary of the Invention

[0004] This invention provides a data retrieval method, apparatus, and related equipment for a computer numerical control (CNC) system to solve the problem of low data retrieval efficiency in CNC systems in related technologies.

[0005] To solve the above problems, the present invention is implemented as follows: In a first aspect, embodiments of the present invention provide a data retrieval method for a computer numerical control system, applied to a server, the method comprising: Receive a call request sent by a client, the call request including a first logical handle of the client and an identifier of the first data that the client needs to call; The first working unit corresponding to the first logical handle is determined based on the first mapping relationship. The first mapping relationship is the mapping relationship between the first working unit and at least one logical handle. The at least one logical handle includes the first logical handle. The first working unit is one of the multiple working units configured by the server. The first working unit is configured with a first real handle of the computer numerical control (CNC) system. The first real handle is used to call data from the CNC system. Determine the first call type corresponding to the first data; The first working unit invokes the first data stored in the CNC system based on the first call type, the first real handle, and the identifier of the first data; The first data is sent to the client.

[0006] Secondly, embodiments of the present invention provide a data retrieval method for a computer numerical control system, applied to a client, the method comprising: Send a call request to the server, the call request including the identifier of the first data to be called and the first logical handle; Receive the first data sent by the server.

[0007] Thirdly, embodiments of the present invention provide a data retrieval device for a computer numerical control system, applied to a server, the device comprising: The first receiving module is used to receive a call request sent by the client. The call request includes a first logical handle of the client and an identifier of the first data that the client needs to call. The first determining module is used to determine the first working unit corresponding to the first logical handle based on the first mapping relationship. The first mapping relationship is the mapping relationship between the first working unit and at least one logical handle. The at least one logical handle includes the first logical handle. The first working unit is one of the multiple working units configured by the server. The first working unit is configured with a first real handle of the computer numerical control (CNC) system. The first real handle is used to call data from the CNC system. The second determining module is used to determine the first call type corresponding to the first data; The calling module is used to call the first data stored in the CNC system through the first working unit based on the first calling type, the first real handle and the identifier of the first data; The first sending module is used to send the first data to the client.

[0008] Fourthly, embodiments of the present invention provide a data retrieval device for a computer numerical control system, applied to a client, the device comprising: The first sending module is used to send a call request to the server. The call request includes an identifier of the first data to be called and a first logical handle. The first receiving module is used to receive the first data sent by the server.

[0009] Fifthly, embodiments of the present invention provide an electronic device, including: a processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, it implements the steps of the data retrieval method of the computer numerical control system described in the first or second aspect.

[0010] In a sixth aspect, embodiments of the present invention provide a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements the steps of the data retrieval method of the computer numerical control system described in the first or second aspect.

[0011] In a seventh aspect, the present invention also provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps of the data retrieval method of the computer numerical control system described in the first or second aspect.

[0012] In this embodiment of the invention, a call request sent by a client is received. The call request includes a first logical handle of the client and an identifier of first data that the client needs to call. A first working unit corresponding to the first logical handle is determined based on a first mapping relationship. The first mapping relationship is a mapping relationship between the first working unit and at least one logical handle. The at least one logical handle includes the first logical handle. The first working unit is one of multiple working units configured by the server. The first working unit is configured with a first real handle of a computer numerical control (CNC) system. The first real handle is used to call data from the CNC system. A first call type corresponding to the first data is determined. The first data stored in the CNC system is called by the first working unit based on the first call type, the first real handle, and the identifier of the first data. The first data is then sent to the client. In this way, the client and server interact through logical handles, while the server interacts with the CNC system through real handles. This prevents the client from directly occupying the real handle, thus avoiding situations where a client's prolonged occupation of the real handle leads to other clients accessing CNC system data through the real handle. Furthermore, the first mapping relationship allows at least one logical handle from at least one client to be mapped to the first working unit. This enables the first working unit to simultaneously receive and process call requests from at least one client and retrieve data from the CNC system through the real handle configured in the first working unit. This achieves the effect of one real handle corresponding to at least one client, thereby improving the data retrieval efficiency of the CNC system. Attached Figure Description

[0013] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0014] Figure 1This is a flowchart of a data retrieval method for a computer numerical control system applied to a server, provided by an embodiment of the present invention; Figure 2 This is a schematic diagram illustrating the interaction between the client, server, and CNC system provided in an embodiment of the present invention; Figure 3 This is a flowchart of a client obtaining a logical handle provided in an embodiment of the present invention; Figure 4 This is a flowchart of the call type for a normal call provided in an embodiment of the present invention; Figure 5 This is a flowchart of the exclusive call type provided in an embodiment of the present invention; Figure 6 This is a flowchart of the work unit reconstruction provided in an embodiment of the present invention; Figure 7 This is a flowchart illustrating a data retrieval method for a computer numerical control system applied to a client, provided by an embodiment of the present invention. Figure 8 This is a structural diagram of a data retrieval device for a computer numerical control system applied to a server, provided by an embodiment of the present invention; Figure 9 This is a structural diagram of a data retrieval device for a computer numerical control system applied to a client, provided in an embodiment of the present invention; Figure 10 This is a structural diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0015] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0016] It's important to note that in related technologies, a CNC system can directly communicate with multiple clients, allowing these clients to access CNC system data. When a client needs to access CNC system data, it first requests a real handle from the CNC system's database (such as the native FANUC FOCAS library in production environments), and then uses this real handle to retrieve the data. However, in real-world applications, the number of real handles configured in the CNC system database is limited, preventing the allocation of a real handle to each client. Clients can only request a real handle when they need to access data. In some cases, clients fail to release real handles promptly after acquiring them, preventing other clients from obtaining real handles when they need to access CNC system data, resulting in low data retrieval efficiency for the CNC system.

[0017] Therefore, this invention proposes a data retrieval method for a computer numerical control (CNC) system. By setting up a server between the client and the CNC system, the server manages the real handles, thereby improving the data retrieval efficiency of the CNC system. For details, please refer to... Figure 1 , Figure 1 This is a flowchart illustrating a data retrieval method for a server-side computer numerical control system, as provided in an embodiment of the present invention. Figure 1 As shown, it includes the following steps: Step 101: Receive a call request sent by the client. The call request includes the client's first logical handle and the identifier of the first data that the client needs to call.

[0018] The above-mentioned call request is a request sent by the client when it needs to call data from the CNC system. The call request includes a first logical handle and an identifier for the first data. The first logical handle is used for verification between the client and the server, and the identifier for the first data is used to indicate that the first data stored in the CNC system needs to be called.

[0019] It should be noted that the first logical handle is the handle used for interaction between the client and the server. The first logical handle is a virtual handle and not the real handle of the CNC system database. The client and the server interact through the logical handle, thereby avoiding the client's occupation of the real handle.

[0020] The communication between the client, server, and CNC system is as follows: Figure 2 As shown, the client and server interact through logical handles, while the server and the CNC system interact through real handles. The server manages the real handles.

[0021] for Figure 2The client in this context retains the same data retrieval method as in related technologies, only replacing the real handle used during the call with a logical handle, thereby reducing the impact of modifications on the client. As for... Figure 2 The server in the system is used to receive remote call requests from clients and map the call requests to real handles on the server's local machine to enable data access.

[0022] Step 102: Determine the first working unit corresponding to the first logical handle based on the first mapping relationship. The first mapping relationship is the mapping relationship between the first working unit and at least one logical handle. The at least one logical handle includes the first logical handle. The first working unit is one of the multiple working units configured by the server. The first working unit is configured with a first real handle of the computer numerical control (CNC) system. The first real handle is used to call data from the CNC system.

[0023] The aforementioned first mapping relationship is a mapping between at least one logical handle and a first working unit. The first working unit is configured with a first real handle, enabling the server to access data from the CNC system through the first working unit. Since the first mapping relationship involves at least one logical handle and the first working unit, the first working unit can simultaneously establish mappings with multiple logical handles. This allows the first working unit to correspond to multiple clients, enabling it to support more client access without increasing the number of connections in the CNC system. These multiple clients correspond to different services, such as service A, service B, and service C.

[0024] Understandably, for each of the multiple work units configured on the server, a mapping relationship will be configured so that each work unit can interact with different clients through the configured mapping relationship.

[0025] In some implementations, such as Figure 2 As shown, the server is configured with a work unit pool, which contains multiple work units such as work unit 1, work unit 2, and work unit 3. Each work unit is assigned a real handle, enabling each work unit to establish a real connection with the CNC system and call data from the CNC system through the real connection.

[0026] In order to map work units to different logical handles, the server can also maintain a logical handle management module, which allocates logical handles and maintains the mapping relationship between logical handles and work units.

[0027] In some implementations, a program transmission exclusive control module and / or an exception recovery module can also be configured on the server side. The program transmission exclusive control module is used to manage the exclusive execution of sequence-sensitive call requests such as upload, download, and verification, while the exception recovery module is used to automatically release and rebuild the real connection when the underlying connection fails.

[0028] In some implementations, multiple work units can be created or initialized after the server starts or when the server first receives a handle request. Specifically, the server can read pre-configured parameters (including the CNC endpoint and the number of fixed connections N), and the server can create N work units for the CNC endpoint, with each work unit configured with a real handle to exclusively hold one real connection.

[0029] Each work unit includes at least the following: work unit identifier, real handle, task queue, serial execution thread or equivalent execution carrier, current timeout parameter, status flag, and error information. In this way, the server establishes a real connection for each work unit using the real handle; if a work unit fails to establish a real connection during the initialization phase, the successfully established work units are rolled back to prevent a partially initialized state.

[0030] Step 103: Determine the first call type corresponding to the first data.

[0031] The first call type mentioned above is the data call type when calling the first data. For the CNC system, different call types require different call methods to call the data. Therefore, in this embodiment, the first call type is determined so that the server and the CNC system can call the data through the call method corresponding to the first call type.

[0032] Step 104: The first working unit calls the first data stored in the CNC system based on the first call type, the first real handle, and the identifier of the first data.

[0033] The aforementioned first working unit is configured with a first real handle, enabling the first working unit to access data stored in the CNC system based on the first frame number handle. Specifically, when it is necessary to access the first data, the first working unit retrieves the first data stored in the CNC system based on the first access type, the first real handle, and the identifier of the first data.

[0034] In some implementations, the first work unit's invocation of the first data stored in the CNC system based on the first call type, the first real handle, and the identifier of the first data can be achieved using a Remote Procedure Call (gRPC) forwarding model. Specifically, for a real connection of a work unit, an independent gRPC forwarding model is configured, and the server then executes the corresponding native call according to the specific gRPC forwarding model and parameters.

[0035] Step 105: Send the first data to the client.

[0036] In this embodiment of the invention, a call request sent by a client is received. The call request includes a first logical handle of the client and an identifier of first data that the client needs to call. A first working unit corresponding to the first logical handle is determined based on a first mapping relationship. The first mapping relationship is a mapping relationship between the first working unit and at least one logical handle. The at least one logical handle includes the first logical handle. The first working unit is one of multiple working units configured by the server. The first working unit is configured with a first real handle of a computer numerical control (CNC) system. The first real handle is used to call data from the CNC system. A first call type corresponding to the first data is determined. The first data stored in the CNC system is called by the first working unit based on the first call type, the first real handle, and the identifier of the first data. The first data is then sent to the client. In this way, the client and server interact through logical handles, while the server interacts with the CNC system through real handles. This prevents the client from directly occupying the real handle, thus avoiding situations where a client's prolonged occupation of the real handle leads to other clients accessing CNC system data through the real handle. Furthermore, the first mapping relationship allows at least one logical handle from at least one client to be mapped to the first working unit. This enables the first working unit to simultaneously receive and process call requests from at least one client and retrieve data from the CNC system through the real handle configured in the first working unit. This achieves the effect of one real handle corresponding to at least one client, thereby improving the data retrieval efficiency of the CNC system.

[0037] In one embodiment, prior to receiving the invocation request sent by the client, the method further includes: Receive a handle request sent by the client, the handle request including the client's first identification information; The first working unit is determined from the plurality of working units based on the first identification information, and the first working unit is configured with the first identification information; Generate the first logical handle and establish the first mapping relationship; Send the first logical handle to the client.

[0038] It should be understood that since the client and server interact through logical handles, and logical handles are virtual handles rather than real handles, the client should request a logical handle from the server before sending a call request to the server. The client and server will then interact through this logical handle.

[0039] Specifically, the process for a client to request a logical handle is as follows: Figure 3 As shown, the client sends a handle request to the server. After receiving the handle request, the server determines the first working unit, generates the first logical handle and establishes the first mapping relationship. Then, the server sends the first logical handle to the client, so that the client can interact with the server through the first logical handle. The server can determine the first working unit according to the established first mapping relationship, so as to execute the call request sent by the client through the first working unit.

[0040] In this embodiment of the invention, a handle request sent by the client is received, the handle request including the client's first identification information; a first working unit is determined from the plurality of working units based on the first identification information, the first working unit being configured with the first identification information; a first logical handle is generated, and a first mapping relationship is established; the first logical handle is sent to the client. Thus, by sending the first logical handle to the client, the client can interact with the server through the first logical handle, avoiding the client directly occupying the real handle.

[0041] In some implementations, after the server receives a handle request, it can first parse the client source address identifier and perform a stable hash operation based on the source address to determine the target working unit (i.e., the first working unit) to which the client session should belong from N working units.

[0042] Subsequently, the server generates an unused logical handle (i.e., the first logical handle) and establishes a first mapping relationship between this logical handle and the first working unit. Specifically, the first mapping relationship can be a mapping relationship between the first logical handle and the following information: CNC endpoint, client source address identifier, first working unit identifier, timeout parameters (which can be a set duration threshold as described later), last access time, and program transmission status. In this way, the client only obtains the logical handle, and all subsequent calls determine the first working unit through the first logical handle and the first mapping relationship, so as to execute the call request using the real handle through the first working unit.

[0043] In one embodiment, determining the first working unit from the plurality of working units based on the first identification information includes at least one of the following: If there is a work unit configured with the first identification information among the work units configured on the server, the work unit configured with the first identification information shall be set as the first work unit. If no work unit with the first identification information is configured in the work unit configured on the server, the work unit with the first number is determined as the first work unit, and the first identification information is configured for the first work unit. The first number is matched with the modulo value, and the modulo value is the modulo value of the first hash value, which is obtained by hashing the first identification information.

[0044] It should be noted that the first working unit needs to be configured with first identification information so that the first working unit can handle the call requests of the client corresponding to the first identification information. Therefore, in the process of determining the first working unit, it is first determined whether there is a working unit configured with first identification information among the working units configured on the server side, and then the first working unit is determined.

[0045] In cases where a work unit is configured with the first identification information, that work unit is directly identified as the first work unit.

[0046] In the absence of a work unit configured with first identification information, it is impossible to directly determine the first work unit among multiple units using the identification information configured for the work unit. Therefore, in this application, a first hash value corresponding to the first identification information is calculated, and then the first hash value is moduloed to obtain a modulo value. Since different work units have different numbers, the first number matching the modulo value is determined from the numbers of multiple work units, thereby identifying the first work unit. In this way, by calculating the hash value and taking the modulo to determine the number, the first work unit is determined, ensuring that the call request can always be mapped to the first work unit when the first identification information of the call request remains unchanged.

[0047] The first identification information can be the client's port address or Internet Protocol (IP) address.

[0048] In one embodiment, determining the first call type corresponding to the first data includes at least one of the following: If the call request is a Production Materials Control (PMC) access request, a status read request, or a parameter read / write request, the first call type corresponding to the first data is determined to be a normal call type. If the call request is a program upload request, a program download request, or a program verification request, the first call type corresponding to the first data is determined to be an exclusive call type.

[0049] It should be understood that different calling methods are required for different first data. In this embodiment, the calling type is divided into normal calling type and exclusive calling type to enable calling different data.

[0050] For data of the normal call type, only one or more data transmissions are required during the call, which takes less time and consumes less transmission resources; while for data of the exclusive call type, data needs to be continuously transmitted during the call, which takes longer and cannot transmit other data during the process, so an exclusive transmission channel is required.

[0051] In this embodiment, the data call type corresponding to the request that only needs to transmit data once or multiple times is set as a normal call type, such as a PMC access request, a status read request, or a parameter read / write request. At the same time, the data call type corresponding to the request that continuously transmits data is set as an exclusive call type, such as a program upload request, a program download request, or a program verification request. This enables the server and the CNC system to call different data.

[0052] Specifically, when the first call type is a normal call type, the call process for the first data is as follows: Figure 4 As shown, data retrieval is achieved through a task queue. Specifically, in one embodiment, the step of retrieving the first data stored in the CNC system by the first working unit based on the first call type, the first real handle, and the identifier of the first data includes: If the first call type is a normal call type, the first logical handle is verified; If the first logical handle verification passes, the call request is added to the task queue of the first working unit; The first working unit retrieves the first data stored in the CNC system based on the first real handle and the identifier of the first data.

[0053] In this way, by adding the call request to the task queue of the first working unit, the first working unit can retrieve the call request from the task queue and execute it, and can call the first data stored in the CNC system based on the first real handle and the identifier of the first data.

[0054] Furthermore, before adding to the task queue, the first logical handle needs to be validated to determine its usability. If the first logical handle passes validation, the first unit of work can be determined through it, and the call request can then be added to the task queue of the first unit of work. However, if the first logical handle fails validation, it cannot be used directly, nor can the first unit of work be determined through it. In this case, the server returns a session error indication to the client, and the client needs to request a new logical handle.

[0055] For example, when a client receives a session error indication, it sends a handle request to the server. The handle request includes the client's first identification information. After receiving the handle request from the client, the server determines the first working unit, generates a second logical handle, and updates the first mapping relationship based on the second logical handle. The server then sends the second logical handle to the client, so that when the client sends a subsequent call request, the call request includes the second logical handle. The server can determine the first working unit through the second logical handle and call the first data through the first working unit.

[0056] In some implementations, if the task queue is full during the process of adding the call request to the task queue of the first work unit, a busy error indication message is returned to the client to instruct the client to initiate the call request again after a set time period to avoid long waiting times.

[0057] In some implementations, the first working unit retrieves tasks one by one from the task queue. Before actual execution, if the communication timeout parameters required by the current task differ from the existing timeout parameters of the working unit, the timeout setting interface is first called to update the timeout parameters, and then the corresponding call is executed using the real handle held by the working unit. After execution, the server encapsulates the return code, output parameters, and necessary server error codes and returns them to the client. The first working unit retrieving tasks one by one from the task queue can be done through a serial execution thread, or by using an event loop, coroutine executor, or other serial scheduling structure to avoid a single working unit not concurrently executing multiple call requests.

[0058] Furthermore, when the first call type is an exclusive call type, the specific call process for the first data is as follows: Figure 5 As shown, data retrieval is achieved by acquiring exclusive control. Specifically, in one embodiment, the step of retrieving the first data stored in the CNC system through the first working unit based on the first call type, the first real handle, and the identifier of the first data includes: When the first call type is an exclusive call type and the first logical handle is not in an active transmission state, determine the transmission information of the multiple work units in a preset time period; When the transmission information indicates that the multiple working units have not transmitted data during the preset time period, the first logical handle is marked as the active transmission state, and the first working unit calls the first data stored in the CNC system based on the first real handle and the identifier of the first data during the preset time period. The method further includes: After the first data is invoked through the first working unit, the first logical handle is marked as not in an active transmission state.

[0059] In this embodiment of the invention, when multiple work units do not transmit data within a preset time period, the first logical handle is marked as an active transmission state to obtain exclusive control. At this time, only the call request corresponding to the first logical handle can be executed, while the data transmission of other call requests is stopped. The first data stored in the CNC system is called based on the identifier of the first real handle and the first data within the preset time period to achieve exclusive data call.

[0060] It should be noted that for exclusive call types, a call request can be divided into three calls: a transmission start call, a transmission body call, and a transmission end call. First, a transmission start call is initiated. At this point, the server checks whether the first logical handle is already in an active transmission state. If it is, the first data call can begin; if it is not in an active transmission state, it attempts to acquire exclusive control within a preset time period. After successfully acquiring exclusive control, the server sequentially executes the transmission body call on the first working unit corresponding to the first logical handle. When the first working unit returns a successful execution of the transmission start call, the first logical handle is marked as being in an active transmission state.

[0061] It should be understood that when a transport body call is initiated with the first logical handle, the server only allows execution if the first logical handle has been marked as an active transport session; otherwise, it returns a busy error directly. When a transport end call is initiated with the first logical handle, the server executes the transport end call on the same unit of work, then clears the active transport state of the logical handle and releases exclusive control, allowing other units of work to execute call requests to retrieve data.

[0062] In one embodiment, the method further includes: If the duration of the first data accessed by the first working unit exceeds a set duration threshold, or if a release instruction is received from the client, the first logical handle is marked as not in an active transmission state.

[0063] It should be noted that when the first logical handle is marked as being in an active transmission state, the first logical handle acquires exclusive control. At this time, the call requests corresponding to other logical handles cannot be executed, and only the call requests corresponding to the first logical handle can be executed. Therefore, marking the first logical handle as not being in an active transmission state can achieve the active release of exclusive control, so that other work units can execute the call requests corresponding to other logical handles.

[0064] In actual invocation processes, there may be situations where a work unit exclusively uses a logical handle to access data for an extended period. This could be due to slow data transmission or data transmission errors. Data transmission errors can cause prolonged occupation of the CNC system's communication channel, preventing other work units from accessing CNC system data. Therefore, this embodiment also includes a method to actively release exclusive control rights to prevent work units from exclusively accessing data for extended periods.

[0065] Specifically, the embodiment adds two ways to actively release exclusive control rights: one is to set a set time threshold, and the other is for the client to actively send a release instruction. These two active methods are used to confirm whether it is necessary to release the exclusive control rights of the current logical handle.

[0066] Among them, the method of setting a time limit can be a default fixed threshold pre-configured by the server. For example, if the server sets the default fixed threshold to 2 minutes, then the time limit is 2 minutes. Then, by monitoring whether the duration of the current exclusive data call exceeds 2 minutes, if it does, the exclusive control of the current logical handle needs to be actively released.

[0067] Regarding the client-initiated release instruction, the client can send the release instruction at the user's request, or set a timer on the client to measure the time elapsed after sending the call request. If the elapsed time exceeds a set waiting threshold, the client sends the release instruction. Upon receiving the release instruction, the server marks the first logical handle as not in an active transmission state to actively release exclusive control.

[0068] In some implementations, such as Figure 6As shown, if a work unit returns a preset exception return code during execution, the server switches the work unit to a rebuild state to re-establish the real connection between the work unit and the CNC system, ensuring that the work unit can access data from the CNC system. The exception return codes include, but are not limited to, connection reset, invalid handle, underlying dynamic library failure, or socket exception. Specifically, the connection is rebuilt in the case of connection reset, invalid handle, underlying dynamic library failure, or socket exception; otherwise, the server directly returns an error code upstream.

[0069] During the rebuild process, the server first releases the real handle currently held by the work unit, then re-invokes the interface and the real handle to establish a new real connection, and restores the corresponding timeout parameters. Upon successful rebuild, the work unit returns to the running state; if rebuild fails, the work unit is marked as unavailable, and a server error code is returned upstream.

[0070] In some implementations, for proactive message-based call requests that rely on active notifications, operating system message mechanisms, or message pumps, the server, upon identification, does not forward the execution path through the fixed connection pool but directly returns an unsupported error code. This avoids unsuitable message mechanisms from affecting the current server operation.

[0071] Please see Figure 7 , Figure 7 This is a flowchart illustrating a data retrieval method for a computer numerical control system applied to a client, as provided in an embodiment of the present invention. Figure 7 As shown, it includes the following steps: Step 701: Send a call request to the server. The call request includes the identifier of the first data to be called and the first logical handle. Step 702: Receive the first data sent by the server.

[0072] In one embodiment, before sending the call request to the server, the method further includes: Send a handle request to the server, the handle request including the client's first identification information; The system receives the first logical handle sent by the server. The first logical handle has a mapping relationship with the first working unit, and the first working unit is configured with the first identification information.

[0073] In this embodiment of the invention, the client and the server interact through logical handles, while the server interacts with the CNC system through real handles. This prevents the client from directly occupying the real handle, thus avoiding situations where a client's prolonged occupation of the real handle leads to other clients accessing CNC system data through the real handle. Furthermore, the first mapping relationship allows at least one logical handle from at least one client to be mapped to the first working unit. This enables the first working unit to simultaneously receive and process call requests from at least one client and retrieve data from the CNC system through the real handle configured in the first working unit. This achieves the effect of one real handle corresponding to at least one client, thereby improving the data retrieval efficiency of the CNC system.

[0074] Please see Figure 8 , Figure 8 This is a structural diagram of a data retrieval device for a computer numerical control system provided in an embodiment of the present invention, as shown below. Figure 8 As shown, the data retrieval device 800 of the computer numerical control system includes: The first receiving module 801 is used to receive a call request sent by the client. The call request includes a first logical handle of the client and an identifier of the first data that the client needs to call. The first determining module 802 is used to determine the first working unit corresponding to the first logical handle based on the first mapping relationship. The first mapping relationship is the mapping relationship between the first working unit and at least one logical handle. The at least one logical handle includes the first logical handle. The first working unit is one of the multiple working units configured by the server. The first working unit is configured with a first real handle of the computer numerical control (CNC) system. The first real handle is used to call data from the CNC system. The second determining module 803 is used to determine the first call type corresponding to the first data; The calling module 804 is used to call the first data stored in the CNC system through the first working unit based on the first calling type, the first real handle and the identifier of the first data; The first sending module 805 is used to send the first data to the client.

[0075] In one embodiment, the data retrieval device 800 of the computer numerical control system further includes: The second receiving module is used to receive a handle request sent by the client, the handle request including the client's first identification information; The third determining module is used to determine the first working unit from the plurality of working units based on the first identification information, wherein the first working unit is configured with the first identification information; The processing module is used to generate the first logical handle and establish the first mapping relationship; The second sending module is used to send the first logical handle to the client.

[0076] In one embodiment, the third determining module includes at least one of the following: The first determining unit is configured to, when there is a working unit configured with the first identification information among the working units configured on the server, set the working unit configured with the first identification information as the first working unit. The second determining unit is configured to, when there is no working unit configured with the first identification information among the working units configured on the server, determine the working unit with the first number as the first working unit, and configure the first identification information for the first working unit, wherein the first number is matched with the modulo value, the modulo value is the modulo value of the first hash value, and the first hash value is obtained by hashing the first identification information.

[0077] In one embodiment, the second determining module 803 includes at least one of the following: The third determining unit is used to determine that the first call type corresponding to the first data is a normal call type when the call request is a Production and Material Control (PMC) access request, a status read request, or a parameter read / write request. The fourth determining unit is used to determine that the first call type corresponding to the first data is an exclusive call type when the call request is a program upload request, a program download request, or a program verification request.

[0078] In one embodiment, the calling module 804 includes: The verification unit is used to verify the first logical handle when the first call type is a normal call type. An adding unit is used to add the call request to the task queue of the first working unit if the first logical handle verification passes. The first calling unit is used to call the first data stored in the CNC system through the first working unit based on the first real handle and the identifier of the first data.

[0079] In one embodiment, the calling module 804 includes: The fifth determining unit is used to determine the transmission information of the plurality of working units within a preset time period when the first call type is an exclusive call type and the first logical handle is not in an active transmission state. The second calling unit is used to mark the first logical handle as the active transmission state when the transmission information indicates that the multiple working units have not transmitted data during the preset time period, and to call the first data stored in the CNC system by the first working unit during the preset time period based on the first real handle and the identifier of the first data. The data retrieval device 800 of the computer numerical control system further includes: The first marking module is used to mark the first logical handle as not in an active transmission state after the first data is invoked through the first working unit.

[0080] In one embodiment, the data retrieval device 800 of the computer numerical control system further includes: The second marking module is used to mark the first logical handle as not in an active transmission state when the duration of the first data call by the first working unit exceeds a set duration threshold, or when a release instruction is received from the client.

[0081] The data retrieval device for a computer numerical control system applied to a server provided in this embodiment of the invention can realize the various processes of the various embodiments of the data retrieval method for a computer numerical control system applied to a server described above. The technical features are one-to-one and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0082] It should be noted that the data retrieval device of the computer numerical control system in the embodiments of the present invention can be a device, or it can be a component, integrated circuit, or chip in an electronic device.

[0083] Please see Figure 9 , Figure 9 This is a structural diagram of a data retrieval device for a computer numerical control system provided in an embodiment of the present invention, as shown below. Figure 9 As shown, the data retrieval device 900 of the computer numerical control system includes: The first sending module 901 is used to send a call request to the server. The call request includes an identifier of the first data to be called and a first logical handle. The first receiving module 902 is used to receive the first data sent by the server.

[0084] In one embodiment, the data retrieval device 900 of the computer numerical control system further includes: The second sending module is used to send a handle request to the server, the handle request including the client's first identification information; The second receiving module is used to receive the first logical handle sent by the server. The first logical handle has a mapping relationship with the first working unit, and the first working unit is configured with the first identification information.

[0085] The data retrieval device for a computer numerical control system applied to a client provided in this embodiment of the invention can realize the various processes of the various embodiments of the data retrieval method for a computer numerical control system applied to a client described above. The technical features are one-to-one and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0086] It should be noted that the data retrieval device of the computer numerical control system in the embodiments of the present invention can be a device, or it can be a component, integrated circuit, or chip in an electronic device.

[0087] This invention also provides an electronic device, see [link to relevant documentation]. Figure 10 , Figure 10 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. The electronic device includes a memory 1001, a processor 1002, and a program or instructions stored in the memory 1001 that run on the memory. When the program or instructions are executed by the processor 1002, they can achieve the following: Figure 1 or Figure 8 The steps in the corresponding data retrieval method embodiment of the computer numerical control system and the achievement of the same beneficial effect will not be repeated here.

[0088] The processor 1002 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or a graphics processing unit (GPU).

[0089] Those skilled in the art will understand that the above-mentioned implementation Figure 1 or Figure 7 All or part of the steps of the data retrieval method embodiment of the corresponding computer numerical control system can be completed by hardware related to program instructions, and the program can be stored in a readable medium.

[0090] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, performs the above-described functions. Figure 1 or Figure 7The various processes of the data retrieval method embodiment corresponding to the computer numerical control system achieve the same technical effect, and will not be described again here to avoid repetition. The computer-readable storage medium mentioned includes, for example, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0091] The present invention also provides a computer program product, including computer instructions that, when executed by a processor, implement the above-described... Figure 1 or Figure 8 The various processes of the corresponding data retrieval method embodiment for the computer numerical control system can achieve the same technical effect, and will not be described again here to avoid repetition.

[0092] In the embodiments of this invention, the terms "first," "second," etc., are used to distinguish similar object parameters and are not necessarily used to describe a specific order or sequence. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or devices. Additionally, the use of "and / or" in this application indicates at least one of the connected object parameters, such as A and / or B and / or C, representing seven possibilities: A alone, B alone, C alone, both A and B present, both B and C present, both A and C present, and A, B, and C present.

[0093] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0094] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, etc.) to execute the methods of the various embodiments of this application.

[0095] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A data retrieval method for a computer numerical control system, applied on a server side, characterized in that, include: Receive a call request sent by a client, the call request including a first logical handle of the client and an identifier of the first data that the client needs to call; The first working unit corresponding to the first logical handle is determined based on the first mapping relationship. The first mapping relationship is the mapping relationship between the first working unit and at least one logical handle. The at least one logical handle includes the first logical handle. The first working unit is one of the multiple working units configured by the server. The first working unit is configured with a first real handle of the computer numerical control (CNC) system. The first real handle is used to call data from the CNC system. Determine the first call type corresponding to the first data; The first working unit invokes the first data stored in the CNC system based on the first call type, the first real handle, and the identifier of the first data; The first data is sent to the client.

2. The method as described in claim 1, characterized in that, Before receiving the invocation request sent by the client, the method further includes: Receive a handle request sent by the client, the handle request including the client's first identification information; The first working unit is determined from the plurality of working units based on the first identification information, and the first working unit is configured with the first identification information; Generate the first logical handle and establish the first mapping relationship; Send the first logical handle to the client.

3. The method as described in claim 2, characterized in that, Determining the first working unit from the plurality of working units based on the first identification information includes at least one of the following: If there is a work unit configured with the first identification information among the work units configured on the server, the work unit configured with the first identification information shall be set as the first work unit. If no work unit with the first identification information is configured in the work unit configured on the server, the work unit with the first number is determined as the first work unit, and the first identification information is configured for the first work unit. The first number is matched with the modulo value, and the modulo value is the modulo value of the first hash value, which is obtained by hashing the first identification information.

4. The method according to any one of claims 1 to 3, characterized in that, Determining the first call type corresponding to the first data includes at least one of the following: When the call request is a Production and Material Control (PMC) access request, a status read request, or a parameter read / write request, the first call type corresponding to the first data is determined to be a normal call type. If the call request is a program upload request, a program download request, or a program verification request, the first call type corresponding to the first data is determined to be an exclusive call type.

5. The method as described in claim 4, characterized in that, The step of calling the first data stored in the CNC system through the first working unit based on the first call type, the first real handle, and the identifier of the first data includes: If the first call type is a normal call type, the first logical handle is verified; If the first logical handle verification passes, the call request is added to the task queue of the first working unit; The first working unit retrieves the first data stored in the CNC system based on the first real handle and the identifier of the first data.

6. The method as described in claim 4, characterized in that, The step of calling the first data stored in the CNC system through the first working unit based on the first call type, the first real handle, and the identifier of the first data includes: When the first call type is an exclusive call type and the first logical handle is not in an active transmission state, determine the transmission information of the multiple work units in a preset time period; When the transmission information indicates that the multiple working units have not transmitted data during the preset time period, the first logical handle is marked as the active transmission state, and the first working unit calls the first data stored in the CNC system based on the first real handle and the identifier of the first data during the preset time period. The method further includes: After the first data is invoked through the first working unit, the first logical handle is marked as not in an active transmission state.

7. The method as described in claim 6, characterized in that, The method further includes: If the duration of the first data accessed by the first working unit exceeds a set duration threshold, or if a release instruction is received from the client, the first logical handle is marked as not in an active transmission state.

8. A data retrieval method for a computer numerical control system, applied to a client side, characterized in that, include: Send a call request to the server, the call request including the identifier of the first data to be called and the first logical handle; Receive the first data sent by the server.

9. The method as described in claim 8, characterized in that, Before sending the call request to the server, the method further includes: Send a handle request to the server, the handle request including the client's first identification information; The system receives the first logical handle sent by the server. The first logical handle has a mapping relationship with the first working unit, and the first working unit is configured with the first identification information.

10. A data retrieval device for a computer numerical control system, applied on a server side, characterized in that, include: The first receiving module is used to receive a call request sent by the client. The call request includes a first logical handle of the client and an identifier of the first data that the client needs to call. The first determining module is used to determine the first working unit corresponding to the first logical handle based on the first mapping relationship. The first mapping relationship is the mapping relationship between the first working unit and at least one logical handle. The at least one logical handle includes the first logical handle. The first working unit is one of the multiple working units configured by the server. The first working unit is configured with a first real handle of the computer numerical control (CNC) system. The first real handle is used to call data from the CNC system. The second determining module is used to determine the first call type corresponding to the first data; The calling module is used to call the first data stored in the CNC system through the first working unit based on the first calling type, the first real handle and the identifier of the first data; The first sending module is used to send the first data to the client.

11. A data retrieval device for a computer numerical control system, applied to a client side, characterized in that, include: The first sending module is used to send a call request to the server. The call request includes an identifier of the first data to be called and a first logical handle. The first receiving module is used to receive the first data sent by the server.

12. An electronic device, characterized in that, include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of the data retrieval method of the computer numerical control system as described in any one of claims 1 to 9.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the data retrieval method of the computer numerical control system as described in any one of claims 1 to 9.

14. A computer program product, characterized in that, It includes computer instructions, which, when executed by a processor, implement the steps of the data retrieval method of the computer numerical control system as described in any one of claims 1 to 9.