Interaction method of layers of NC-Link protocol and electronic equipment
By recording the states of each layer in the NC-Link protocol system and controlling the state transition based on the event processing function, the problem of inefficient interaction of the NC-Link protocol system is solved, and more efficient data sharing and query are achieved.
Patent Information
- Application Number
- CN202411180542.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-11-12
AI Technical Summary
The interaction states between application systems, agents and adapters in the NC-Link protocol system vary, resulting in low efficiency in the interaction process.
By recording the states of each layer in the NC-Link protocol system, and controlling the actions and states of each layer based on the processing functions corresponding to the event, a finite state transition mechanism is used to standardize the state transition of each layer, and the standardization and efficiency of the interaction process are improved.
It improves the standardization and interaction efficiency of interaction processes at each layer in the NC-Link protocol, and improves the data sharing and query efficiency of CNC devices.
Smart Images

Figure CN118945148A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of numerical control technology, and in particular to an interaction method for each layer of an NC-Link protocol and an electronic device. Background Art
[0002] Manufacturing is the foundation of my country's real economy and the key to my country's economic transformation. As the key in the manufacturing industry, CNC equipment (such as CNC machine tools) is widely used in mechanical processing, automobile manufacturing, aerospace and other industries. In order to achieve the interconnection of CNC equipment, the CNC equipment industrial interconnection communication protocol (referred to as NC-Link protocol) came into being. However, the efficiency of the interaction process of CNC equipment using the NC-Link protocol is relatively low. Summary of the invention
[0003] The embodiments of the present application provide a method for interaction between layers of an NC-Link protocol and an electronic device.
[0004] In a first aspect, an embodiment of the present application provides a method for interacting with each layer of an NC-Link protocol, wherein the NC-Link protocol is applied to a numerical control device, and the method includes:
[0005] Record the status of each layer in the NC-Link protocol system. The status of each layer is based on the event migration in the NC-Link protocol system.
[0006] Control the actions and states of each layer based on the processing functions corresponding to the events;
[0007] Each layer includes an application system, an agent, and an adapter. The corresponding relationship between the state, event, action, and processing function of each layer can be determined based on the first state transfer mechanism.
[0008] Optionally, based on the first state transfer mechanism, the state of the application system includes an initial state, a normal state, a request state and a connection interruption state.
[0009] Optionally, based on the first state transfer mechanism:
[0010] In the initial state of the application system:
[0011] If the event is an initialization event, the corresponding processing function controls the application system to register with the agent and migrate to the normal state;
[0012] In the normal state of the application system:
[0013] If the event is a request to obtain data event, the corresponding processing function controls the application system to trigger a request data transmission unit DTU message and migrate to the request state;
[0014] If the event is that the application system receives a response DTU message from the agent, the corresponding processing function controls the application system to discard the response DTU message and maintain the normal state;
[0015] If the event is the disconnection between the application system and the agent, the corresponding processing function controls the application system to migrate to the disconnected state;
[0016] If the event is the restoration of the connection between the application system and the agent, the corresponding processing function controls the application system to maintain a normal state;
[0017] If the event is that the application system receives a sampled DTU message from a subscribed adapter, the corresponding processing function controls the application system to process the sampled data and maintain a normal state;
[0018] In the application system's request state:
[0019] If the event is a request to obtain data event, the corresponding processing function controls the application system to remain in the request state and triggers a request DTU message;
[0020] If the event is that the application system receives a response DTU message from the agent, the corresponding processing function controls the application system to migrate to a normal state;
[0021] If the event is the disconnection between the application system and the agent, the corresponding processing function controls the application system to migrate to the disconnected state;
[0022] If the event is the restoration of the connection between the application system and the agent, the corresponding processing function controls the application system to maintain the request state;
[0023] If the event is that the application system receives a sampled DTU message from a subscribed adapter, the corresponding processing function controls the application system to process the sampled data and maintain the request state;
[0024] When the application system is disconnected:
[0025] If the event is a request to obtain data event, the corresponding processing function controls the application system to cache the request and keep the connection disconnected;
[0026] If the event is that the application system receives a response DTU message from the agent, the corresponding processing function controls the application system to process the response DTU message and maintain the connection interruption state;
[0027] If the event is that the connection between the application system and the agent is disconnected, the corresponding processing function controls the application system to maintain the disconnected state;
[0028] If the event is that the connection between the application system and the proxy is restored, the corresponding processing function controls the application system to determine whether there is a request in the cache. If there is a request in the cache, the application system sends the request and migrates to the request state. If there is no request in the cache, the application system migrates to the normal state.
[0029] If the event is that the application system receives a sampling DTU message from the adapter, the corresponding processing function controls the application system to process the sampling data and maintain the connection interruption state.
[0030] Optionally, based on the first state transfer mechanism, the states of the agent include an initial state, a normal state, an application system interruption state, an adapter interruption state, and a complete interruption state.
[0031] Optionally, based on the first state transfer mechanism:
[0032] In the initial state of the agent:
[0033] If the event is an initialization event, the corresponding processing function controls the agent to check the registration status of the application system and migrate to the normal state;
[0034] In the normal state of the agent:
[0035] If the event is that the agent receives a request DTU message, the corresponding processing function controls the agent to store and forward the request DTU message and maintain a normal state;
[0036] If the event is that the agent receives a response DTU message, the corresponding processing function controls the agent to store and forward the response DTU message and maintain a normal state;
[0037] If the event is the disconnection between the application system and the agent, the corresponding processing function controls the agent to migrate to the application system interruption state;
[0038] If the event is the restoration of the connection between the application system and the agent, the corresponding processing function controls the agent to maintain a normal state;
[0039] If the event is the disconnection between the adapter and the agent, the corresponding processing function controls the agent to migrate to the adapter interruption state;
[0040] If the event is the connection restoration between the adapter and the agent, the corresponding processing function controls the agent to maintain a normal state;
[0041] If the event is an event that the agent receives a sampling DTU message from the adapter, the corresponding processing function controls the agent to forward the sampling data according to the sampling DTU message and maintain a normal state;
[0042] When the agent's application system is interrupted:
[0043] If the event is that the agent receives a request DTU message, the corresponding processing function controls the agent to cache the request information and keep the application system in an interrupt state;
[0044] If the event is that the agent receives a response DTU message, the corresponding processing function controls the agent to cache the response information and keep the application system in interrupt status;
[0045] If the event is the disconnection between the application system and the agent, the corresponding processing function controls the agent to keep the application system in the interrupted state;
[0046] If the event is the restoration of the connection between the application system and the agent, the corresponding processing function controls the agent to migrate to the normal state;
[0047] If the event is the disconnection between the adapter and the agent, the corresponding processing function controls the agent to migrate to the completely disconnected state;
[0048] If the event is the connection restoration between the adapter and the agent, the corresponding processing function controls the agent to keep the application system interrupted;
[0049] If the event is that the agent receives a sampling DTU message from the adapter, the corresponding processing function controls the agent to cache the sampling data and keep the application system in an interrupt state;
[0050] In the agent's adapter down state:
[0051] If the event is that the agent receives a request DTU message, the corresponding processing function controls the agent to cache the request information and keep the adapter interrupted;
[0052] If the event is that the agent receives a response DTU message, the corresponding processing function controls the agent to cache the response information and keep the adapter interrupted;
[0053] If the event is the interruption of the connection between the application system and the agent, the corresponding processing function controls the agent to migrate to the complete interruption state;
[0054] If the event is the restoration of the connection between the application system and the agent, the corresponding processing function controls the agent to keep the adapter interrupted;
[0055] If the event is the disconnection between the adapter and the agent, the corresponding processing function controls the agent to migrate to the completely disconnected state;
[0056] If the event is the restoration of the connection between the adapter and the agent, the corresponding processing function controls the agent to migrate to the normal state;
[0057] If the event is that the agent receives a sampling DTU message from the adapter, the corresponding processing function controls the agent to forward the sampling data according to the subscription message and keeps the adapter in interrupt status;
[0058] In the fully disconnected state of the agent:
[0059] If the event is that the agent receives a request DTU message, the corresponding processing function controls the agent to cache the request information and maintain a completely interrupted state;
[0060] If the event is that the agent receives a response DTU message, the corresponding processing function controls the agent to cache the response information and maintain a completely interrupted state;
[0061] If the event is the disconnection between the application system and the agent, the corresponding processing function controls the agent to remain in a completely disconnected state;
[0062] If the event is the restoration of the connection between the application system and the agent, the corresponding processing function controls the agent to migrate to the adapter interruption state;
[0063] If the event is the disconnection between the adapter and the agent, the corresponding processing function controls the agent to remain in a completely disconnected state;
[0064] If the event is the connection recovery between the adapter and the agent, the corresponding processing function controls the agent to migrate to the application system interruption state;
[0065] If the event is that the agent receives a sampling DTU message from the adapter, the corresponding processing function controls the agent to forward the sampling data according to the subscription message and maintain a completely interrupted state.
[0066] Optionally, based on the first state transfer mechanism, the state of the adapter includes an initial state, a normal state, a request state, and a connection interruption state.
[0067] Optionally, based on the first state transfer mechanism:
[0068] In the initial state of the adapter:
[0069] If the event is an initialization event, the corresponding processing function controls the adapter to initialize the model and register with the agent, and the adapter migrates to the normal state;
[0070] In the normal state of the adapter:
[0071] If the event is that the adapter receives a request DTU message, the corresponding processing function controls the adapter to process the request message and forward the response DTU message. If the forwarding of the response DTU message succeeds, the adapter remains in the normal state. If the forwarding of the request DTU message fails, the adapter migrates to the request state.
[0072] If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function controls the adapter to enter the disconnected state;
[0073] If the event is the connection restoration between the adapter and the agent, the corresponding processing function controls the adapter to maintain a normal state;
[0074] If the event is that the sampling condition is met, the corresponding processing function controls the adapter to send the sampling DTU message and maintain the normal state;
[0075] In the adapter's request state:
[0076] If the event is that the adapter receives a request DTU message, the corresponding processing function controls the adapter to process the request message and forward the response DTU message. If the forwarding of the response DTU message succeeds, the adapter maintains the request state. If the forwarding of the response DTU message fails, the adapter maintains the request state.
[0077] If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function controls the adapter to enter the disconnected state and caches the response DTU message;
[0078] If the event is the connection recovery between the adapter and the agent, the corresponding processing function controls the adapter to send the cached response DTU message and migrate to the normal state;
[0079] If the event is that the sampling condition is met, the corresponding processing function controls the adapter to send the sampling DTU message and maintain the request state;
[0080] When the adapter is disconnected:
[0081] If the event is that the adapter receives a request DTU message, the corresponding processing function controls the adapter to process the request message and cache the response DTU message, and maintain the connection interrupted state;
[0082] If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function controls the adapter to maintain the disconnected state;
[0083] If the event is the connection recovery between the adapter and the agent, the corresponding processing function controls the adapter to send the cached response DTU message and migrate to the normal state;
[0084] If the event is that the sampling condition is met, the corresponding processing function controls the adapter to send a sampling DTU message and maintain the connection interrupted state.
[0085] Optionally, the method further includes:
[0086] Construct a data model of CNC equipment based on the structure tree of CNC equipment. The data types in the data model include original data and statistical data.
[0087] The original data comes from different components of the CNC equipment. The original data is stored in the time series database TSDB of the NC-Link protocol system. The original data includes one or more of the following data of the components:
[0088] Attribute data, configuration parameter data, control data, and operating status data;
[0089] Statistical data is obtained based on the analysis and processing of original data and historical data, and historical data is formed based on the accumulated original data.
[0090] In a second aspect, an embodiment of the present application provides an electronic device, including:
[0091] The recording module is used to record the status of each layer in the NC-Link protocol system. The status of each layer is based on the event migration in the NC-Link protocol system.
[0092] The control module is used to control the actions and states of each layer based on the processing functions corresponding to the events;
[0093] Each layer includes an application system, an agent, and an adapter. The corresponding relationship between the state, event, action, and processing function of each layer can be determined based on the first state transfer mechanism.
[0094] Optionally, based on the first state transfer mechanism, the state of the application system includes an initial state, a normal state, a request state and a connection interruption state.
[0095] Optionally, based on the first state transfer mechanism:
[0096] In the initial state of the application system:
[0097] If the event is an initialization event, the corresponding processing function controls the application system to register with the agent and migrate to the normal state;
[0098] In the normal state of the application system:
[0099] If the event is a request to obtain data event, the corresponding processing function controls the application system to trigger a request data transmission unit DTU message and migrate to the request state;
[0100] If the event is that the application system receives a response DTU message from the agent, the corresponding processing function controls the application system to discard the response DTU message and maintain the normal state;
[0101] If the event is the disconnection between the application system and the agent, the corresponding processing function controls the application system to migrate to the disconnected state;
[0102] If the event is the restoration of the connection between the application system and the agent, the corresponding processing function controls the application system to maintain a normal state;
[0103] If the event is that the application system receives a sampled DTU message from a subscribed adapter, the corresponding processing function controls the application system to process the sampled data and maintain a normal state;
[0104] In the application system's request state:
[0105] If the event is a request to obtain data event, the corresponding processing function controls the application system to remain in the request state and triggers a request DTU message;
[0106] If the event is that the application system receives a response DTU message from the agent, the corresponding processing function controls the application system to migrate to a normal state;
[0107] If the event is the disconnection between the application system and the agent, the corresponding processing function controls the application system to migrate to the disconnected state;
[0108] If the event is the restoration of the connection between the application system and the agent, the corresponding processing function controls the application system to maintain the request state;
[0109] If the event is that the application system receives a sampled DTU message from a subscribed adapter, the corresponding processing function controls the application system to process the sampled data and maintain the request state;
[0110] When the application system is disconnected:
[0111] If the event is a request to obtain data event, the corresponding processing function controls the application system to cache the request and keep the connection disconnected;
[0112] If the event is that the application system receives a response DTU message from the agent, the corresponding processing function controls the application system to process the response DTU message and maintain the connection interruption state;
[0113] If the event is that the connection between the application system and the agent is disconnected, the corresponding processing function controls the application system to maintain the disconnected state;
[0114] If the event is that the connection between the application system and the proxy is restored, the corresponding processing function controls the application system to determine whether there is a request in the cache. If there is a request in the cache, the application system sends the request and migrates to the request state. If there is no request in the cache, the application system migrates to the normal state.
[0115] If the event is that the application system receives a sampling DTU message from the adapter, the corresponding processing function controls the application system to process the sampling data and maintain the connection interruption state.
[0116] Optionally, based on the first state transfer mechanism, the states of the agent include an initial state, a normal state, an application system interruption state, an adapter interruption state, and a complete interruption state.
[0117] Optionally, based on the first state transfer mechanism:
[0118] In the initial state of the agent:
[0119] If the event is an initialization event, the corresponding processing function controls the agent to check the registration status of the application system and migrate to the normal state;
[0120] In the normal state of the agent:
[0121] If the event is that the agent receives a request DTU message, the corresponding processing function controls the agent to store and forward the request DTU message and maintain a normal state;
[0122] If the event is that the agent receives a response DTU message, the corresponding processing function controls the agent to store and forward the response DTU message and maintain a normal state;
[0123] If the event is the disconnection between the application system and the agent, the corresponding processing function controls the agent to migrate to the application system interruption state;
[0124] If the event is the restoration of the connection between the application system and the agent, the corresponding processing function controls the agent to maintain a normal state;
[0125] If the event is the disconnection between the adapter and the agent, the corresponding processing function controls the agent to migrate to the adapter interruption state;
[0126] If the event is the connection restoration between the adapter and the agent, the corresponding processing function controls the agent to maintain a normal state;
[0127] If the event is an event that the agent receives a sampling DTU message from the adapter, the corresponding processing function controls the agent to forward the sampling data according to the sampling DTU message and maintain a normal state;
[0128] When the agent's application system is interrupted:
[0129] If the event is that the agent receives a request DTU message, the corresponding processing function controls the agent to cache the request information and keep the application system in an interrupt state;
[0130] If the event is that the agent receives a response DTU message, the corresponding processing function controls the agent to cache the response information and keep the application system in interrupt status;
[0131] If the event is the disconnection between the application system and the agent, the corresponding processing function controls the agent to keep the application system in the interrupted state;
[0132] If the event is the restoration of the connection between the application system and the agent, the corresponding processing function controls the agent to migrate to the normal state;
[0133] If the event is the disconnection between the adapter and the agent, the corresponding processing function controls the agent to migrate to the completely disconnected state;
[0134] If the event is the connection restoration between the adapter and the agent, the corresponding processing function controls the agent to keep the application system interrupted;
[0135] If the event is that the agent receives a sampling DTU message from the adapter, the corresponding processing function controls the agent to cache the sampling data and keep the application system in an interrupt state;
[0136] In the agent's adapter down state:
[0137] If the event is that the agent receives a request DTU message, the corresponding processing function controls the agent to cache the request information and keep the adapter interrupted;
[0138] If the event is that the agent receives a response DTU message, the corresponding processing function controls the agent to cache the response information and keep the adapter interrupted;
[0139] If the event is the interruption of the connection between the application system and the agent, the corresponding processing function controls the agent to migrate to the complete interruption state;
[0140] If the event is the restoration of the connection between the application system and the agent, the corresponding processing function controls the agent to keep the adapter interrupted;
[0141] If the event is the disconnection between the adapter and the agent, the corresponding processing function controls the agent to migrate to the completely disconnected state;
[0142] If the event is the restoration of the connection between the adapter and the agent, the corresponding processing function controls the agent to migrate to the normal state;
[0143] If the event is that the agent receives a sampling DTU message from the adapter, the corresponding processing function controls the agent to forward the sampling data according to the subscription message and keeps the adapter in interrupt status;
[0144] In the fully disconnected state of the agent:
[0145] If the event is that the agent receives a request DTU message, the corresponding processing function controls the agent to cache the request information and maintain a completely interrupted state;
[0146] If the event is that the agent receives a response DTU message, the corresponding processing function controls the agent to cache the response information and maintain a completely interrupted state;
[0147] If the event is the disconnection between the application system and the agent, the corresponding processing function controls the agent to remain in a completely disconnected state;
[0148] If the event is the restoration of the connection between the application system and the agent, the corresponding processing function controls the agent to migrate to the adapter interruption state;
[0149] If the event is the disconnection between the adapter and the agent, the corresponding processing function controls the agent to remain in a completely disconnected state;
[0150] If the event is the connection recovery between the adapter and the agent, the corresponding processing function controls the agent to migrate to the application system interruption state;
[0151] If the event is that the agent receives a sampling DTU message from the adapter, the corresponding processing function controls the agent to forward the sampling data according to the subscription message and maintain a completely interrupted state.
[0152] Optionally, based on the first state transfer mechanism, the state of the adapter includes an initial state, a normal state, a request state, and a connection interruption state.
[0153] Optionally, based on the first state transfer mechanism:
[0154] In the initial state of the adapter:
[0155] If the event is an initialization event, the corresponding processing function controls the adapter to initialize the model and register with the agent, and the adapter migrates to the normal state;
[0156] In the normal state of the adapter:
[0157] If the event is that the adapter receives a request DTU message, the corresponding processing function controls the adapter to process the request message and forward the response DTU message. If the forwarding of the response DTU message succeeds, the adapter remains in the normal state. If the forwarding of the request DTU message fails, the adapter migrates to the request state.
[0158] If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function controls the adapter to enter the disconnected state;
[0159] If the event is the connection restoration between the adapter and the agent, the corresponding processing function controls the adapter to maintain a normal state;
[0160] If the event is that the sampling condition is met, the corresponding processing function controls the adapter to send the sampling DTU message and maintain the normal state;
[0161] In the adapter's request state:
[0162] If the event is that the adapter receives a request DTU message, the corresponding processing function controls the adapter to process the request message and forward the response DTU message. If the forwarding of the response DTU message succeeds, the adapter maintains the request state. If the forwarding of the response DTU message fails, the adapter maintains the request state.
[0163] If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function controls the adapter to enter the disconnected state and caches the response DTU message;
[0164] If the event is the connection recovery between the adapter and the agent, the corresponding processing function controls the adapter to send the cached response DTU message and migrate to the normal state;
[0165] If the event is that the sampling condition is met, the corresponding processing function controls the adapter to send the sampling DTU message and maintain the request state;
[0166] When the adapter is disconnected:
[0167] If the event is that the adapter receives a request DTU message, the corresponding processing function controls the adapter to process the request message and cache the response DTU message, and maintain the connection interrupted state;
[0168] If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function controls the adapter to maintain the disconnected state;
[0169] If the event is the connection recovery between the adapter and the agent, the corresponding processing function controls the adapter to send the cached response DTU message and migrate to the normal state;
[0170] If the event is that the sampling condition is met, the corresponding processing function controls the adapter to send a sampling DTU message and maintain the connection interrupted state.
[0171] Optionally, the electronic device further includes:
[0172] A construction module, used for constructing a data model of the numerical control device based on the structure tree of the numerical control device, wherein the data types in the data model include original data and statistical data;
[0173] The original data comes from different components of the CNC equipment. The original data is stored in the time series database TSDB of the NC-Link protocol system. The original data includes one or more of the following data of the components:
[0174] Attribute data, configuration parameter data, control data, and operating status data;
[0175] Statistical data is obtained based on the analysis and processing of original data and historical data, and historical data is formed based on the accumulated original data.
[0176] In a third aspect, an embodiment of the present application provides an electronic device comprising a memory, at least one processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, a method as described in any one of the above-mentioned first aspects is implemented.
[0177] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method as described in any one of the above-mentioned first aspects is implemented.
[0178] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes any one of the methods described in the first aspect.
[0179] Based on this application, by recording the status of each layer in the NC-Link protocol and controlling the status and action of each layer based on the events that occur, it helps to improve the standardization and interaction efficiency of the interaction processes of each layer in the NC-Link protocol. BRIEF DESCRIPTION OF THE DRAWINGS
[0180] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for describing the embodiments.
[0181] Figure 1 It is a schematic diagram of the structure of the NC-Link protocol system;
[0182] Figure 2 It is the data interaction process between various layers in the NC-Link protocol system;
[0183] Figure 3 It is a flowchart of the interaction method of each layer of the NC-Link protocol provided in the embodiment of the present application;
[0184] Figure 4 It is a schematic diagram of the state transfer process of the application system provided in the embodiment of the present application;
[0185] Figure 5 It is a flow chart of the state transfer of the agent provided in the embodiment of the present application;
[0186] Figure 6 It is a flowchart of the state transfer of the adapter provided in the embodiment of the present application;
[0187] Figure 7 It is a structural schematic diagram of a data model of a CNC machine tool device provided in an embodiment of the present application;
[0188] Figure 8 is a structural schematic diagram of an electronic device provided by an embodiment of the present application;
[0189] Fig. 9 It is a structural schematic diagram of an electronic device provided in another embodiment of the present application. DETAILED DESCRIPTION
[0190] The technical solution of the embodiment of the present invention will be described below in conjunction with the accompanying drawings in the embodiment of the present invention.
[0191] Manufacturing is the foundation for the development of my country's real economy and the key to my country's economic transformation. With the continuous integration of new-generation information technology and manufacturing, my country's traditional manufacturing industry is facing unprecedented reforms, realizing a fundamental change from traditional manufacturing to intelligent manufacturing. Among them, CNC equipment is the key to the manufacturing industry. For example, CNC machine tools, as the industrial "mother machines" in the manufacturing industry, are widely used in mechanical processing, automobile manufacturing, aerospace and other industries. At present, most CNC machine tools are controlled by dedicated computer systems, but they cannot be interconnected with other computer systems. In order to achieve the interconnection and interoperability of CNC equipment, foreign countries have introduced the mainstream open platform communications unified architecture (OPC UA) communication protocol and machine tool (MT) connection (connect) communication protocol. China has launched a new NC-Link protocol, which uses a lightweight JS object notation (JSON) data transmission format to meet high-frequency data communication needs.
[0192] Let's take the machine tool as an example. Figure 1 , and introduces the NC-Link protocol architecture with examples. Figure 1As shown in the figure, the NC-Link protocol architecture involves the application system layer, the device structure tree, the NC-Link agent, and the adapter. The machine tool provides machine status data, control data, attribute data, etc., and receives upper-level control instructions at the same time. The adapter parses and converts the collected machine tool data, and sends the data format to the agent after standardization. The agent sends the control information to the adapter in the data format required by the machine tool, and stores the data collected from the adapter in the form of a device structure tree. The device structure tree includes a time series database (TSDB) and a distributed database. The time series database is used to store the operation data of the machine tool in real time, and the distributed database stores the collected data in a ledger-style according to the machine tool equipment template. The device structure tree is a unified access interface for the upper-level application system, which is used to store and process the collected machine tool equipment data, which can improve the reuse rate of machine tool equipment data and improve the data query efficiency. The application system layer is a participant involved in the NC-Link protocol interaction. It mainly performs upper-layer applications or issues control instructions. It can be one or more application systems, such as enterprise resource planning (ERP), manufacturing execution system (MES), product lifecycle management (PLM), etc.
[0193] In the NC-Link protocol system, the data interaction process between the application system layer, the agent and the adapter can be as follows: Figure 2 As shown. When the application system layer needs data, the application system layer can send a request (request) data transfer unit (data transfer unit, DTU) message to the agent. After the agent receives the request DTU message from the application system layer, it can forward the request DTU message to the adapter. After the adapter receives the request DTU message forwarded by the agent, it can send a response (response) DTU message to the agent. After receiving the response DTU message from the adapter, the agent forwards it to the application system layer.
[0194] However, the interaction states among the application system, agent, and adapter in the NC-link protocol system vary, and the efficiency of the interaction process at each layer is relatively low.
[0195] Based on this, Figure 3The embodiment of the present application provides a method for interaction of each layer of the NC-Link protocol, which includes steps S310-S320. The method is applicable to numerical control equipment using the NC-Link protocol, such as numerical control machine tools, intelligent warehousing, mobile robots, industrial robots, etc.
[0196] In step S310, the state of each layer in the NC-Link protocol system is recorded, and the state of each layer is based on the event migration in the NC-Link protocol system. That is, when different events occur in the NC-Link protocol system, each layer may have corresponding different states. The events in the NC-Link protocol system may include the initialization of each layer or the data interaction of each layer. As an example, the state of each layer in the NC-Link protocol system may be recorded based on the state machine.
[0197] In step S320, the actions and states of each layer are controlled based on the processing function corresponding to the event, that is, different events may correspond to different processing functions to control the actions and states of each layer.
[0198] Each layer may include an application system, an agent, and an adapter, and the corresponding relationship between the state, event, action, and processing function of each layer may be determined based on the first state transfer mechanism.
[0199] The first state transfer mechanism can be a finite state transfer mechanism, which specifies different behaviors and transfer conditions of each layer of the NC-Link protocol system based on different events in different states. As an example, the finite state transfer mechanism can be represented by the formula: state (S), event (E) -> actions (A), state (S'), that is, when in state S, event E is received, causing the state to transfer to S', accompanied by the execution of action A.
[0200] Based on this application, by recording the status of each layer in the NC-Link protocol and controlling the status and action of each layer based on the events that occur, it helps to improve the standardization and interaction efficiency of the interaction processes of each layer in the NC-Link protocol.
[0201] The first state transfer mechanism is described in detail below.
[0202] Application System
[0203] Optionally, based on the first state transfer mechanism, the state of the application system may include an initial state, a normal state, a request state, and a connection interruption state, wherein the connection interruption state of the application system may refer to the connection interruption between the application system and the proxy.
[0204] Furthermore, based on the first state transfer mechanism, the migration of the application system between various states can be described as follows.
[0205] In the initial state of the application system
[0206] If the event is an initialization event, the corresponding processing function can control the application system to register with the agent and migrate to the normal state. That is, when initialization occurs in the NC-Link protocol system, the application system registers with the agent and migrates to the normal state.
[0207] In the normal state of the application system
[0208] If the event is a request to obtain data event, the corresponding processing function can control the application system to trigger a request data transmission unit DTU message and migrate to the request state. That is, when a request to obtain data event occurs, the application system can trigger a request DTU message and migrate to the request state. Among them, the request to obtain data event can be initiated by the application system itself, and the request DTU triggered by the application system can be sent to the agent.
[0209] If the event is that the application system receives a response DTU message from the agent, the corresponding processing function can control the application system to discard the response DTU message and maintain a normal state. That is, when the application system receives a response DTU message from the agent, the application system can discard the response DTU message and maintain a normal state.
[0210] If the event is that the connection between the application system and the agent is disconnected, the corresponding processing function can control the application system to migrate to the disconnected state. That is, when the connection between the application system and the agent is disconnected, the application system can migrate to the disconnected state.
[0211] If the event is that the connection between the application system and the proxy is restored, the corresponding processing function can control the application system to maintain a normal state. That is, when the connection between the application system and the proxy is restored, the application system can maintain a normal state.
[0212] If the event is that the application system receives a sample DTU message from a subscribed adapter, the corresponding processing function can control the application system to process the sample data and maintain a normal state. That is, when the application system receives a sample DTU message from a subscribed adapter, the application system can process the sample data and maintain a normal state.
[0213] In the application system's request state
[0214] If the event is a request to obtain data event, the corresponding processing function can control the application system to remain in the request state and trigger the request DTU message. That is, when the request to obtain data event occurs, the application system can trigger the requestDTU request and maintain the request state.
[0215] If the event is that the application system receives a response DTU message from the agent, the corresponding processing function can control the application system to migrate to a normal state. That is, when the application system receives a response DTU message from the agent, the application system can migrate to a normal state.
[0216] If the event is that the connection between the application system and the agent is disconnected, the corresponding processing function can control the application system to migrate to the disconnected state. That is, when the connection between the application system and the agent is disconnected, the application system can migrate to the disconnected state.
[0217] If the event is the restoration of the connection between the application system and the proxy, the corresponding processing function can control the application system to maintain the request state. That is, when the connection between the application system and the proxy is restored, the application system can maintain the request state.
[0218] If the event is that the application system receives the sample DTU message of the subscribed adapter, the corresponding processing function can control the application system to process the sampled data and maintain the request state. That is, when the application system receives the sample DTU message of the subscribed adapter, the application system can process the sampled data and maintain the request state. Among them, the processing of the sampled data by the application system can be adjusted according to the needs of different CNC devices.
[0219] When the connection to the application system is interrupted
[0220] If the event is a request to obtain data event, the corresponding processing function can control the application system to cache the request and keep the connection interrupted. That is, when the request to obtain data event occurs, the application system can cache the request and keep the connection interrupted.
[0221] If the event is that the application system receives a response DTU message from the agent, the corresponding processing function can control the application system to process the response DTU message and keep the connection disconnected. That is, when the application system receives a response DTU message from the agent, the application system can process the response DTU message and keep the connection disconnected.
[0222] If the event is that the connection between the application system and the proxy is disconnected, the corresponding processing function can control the application system to maintain the disconnected state. That is, when the connection between the application system and the proxy is disconnected, the application system can maintain the disconnected state.
[0223] If the event is that the connection between the application system and the proxy is restored, the corresponding processing function can control the application system to determine whether there is a request in the cache. If there is a request in the cache, the application system sends the request and migrates to the request state. If there is no request in the cache, the application system migrates to the normal state. That is, when the connection between the application system and the proxy is restored, the application system can determine whether there is a request in the cache. If there is a request in the cache, the application system can send the request and migrate to the request state. If there is no request in the cache, the application system can migrate to the normal state.
[0224] If the event is that the application system receives the sample DTU message from the adapter, the corresponding processing function can control the application system to process the sample data and keep the connection interrupted. That is, when the application system receives the sample DTU message from the adapter, the application system can process the sample data and keep the connection interrupted.
[0225] As an example, the state transition of the application system can be as shown in Table 1 and Figure 4 shown.
[0226] Table 1 Application system state transition table
[0227]
[0228]
[0229] Agent
[0230] Optionally, based on the first state transition mechanism, the state of the agent may include an initial state, a normal state, an application system interruption state, an adapter interruption state, and a complete interruption state. The application system interruption state may refer to the interruption of the connection between the agent and the application system, the adapter interruption state may refer to the interruption of the connection between the agent and the adapter, and the complete interruption state may refer to the interruption of the connection between the agent and both the application system and the adapter.
[0231] Furthermore, based on the first state transfer mechanism, the migration of the agent between various states can be described as follows.
[0232] In the initial state of the agent
[0233] If the event is an initialization event, the corresponding processing function can control the agent to check the registration status of the application system and migrate to the normal state. That is, when the initialization event occurs, the agent can check the registration status of the application system and migrate to the normal state.
[0234] In the normal state of the agent
[0235] If the event is that the agent receives a request DTU message, the corresponding processing function can control the agent to store and forward the request DTU message and maintain a normal state. That is, when the agent receives a request DTU message, the agent can store and forward the request DTU message and maintain a normal state. For example, the request DTU message here can refer to the request DTU message of the application system.
[0236] If the event is that the agent receives a response DTU message, the corresponding processing function can control the agent to store and forward the response DTU message and maintain a normal state. That is, when the agent receives a response DTU message, the agent stores and forwards the response DTU message and maintains a normal state. For example, the response DTU message here can refer to the response DTU message of the adapter, and the agent can forward the response DTU message to the application system.
[0237] If the event is that the connection between the application system and the agent is disconnected, the corresponding processing function can control the agent to migrate to the application system interruption state. That is, when the connection between the application system and the agent is disconnected, the agent can migrate to the application system interruption state.
[0238] If the event is that the connection between the application system and the agent is restored, the corresponding processing function can control the agent to maintain a normal state. That is, when the connection between the application system and the agent is restored, the agent can maintain a normal state.
[0239] If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function can control the agent to migrate to the adapter interrupted state. That is, when the connection between the adapter and the agent is disconnected, the agent can migrate to the adapter interrupted state.
[0240] If the event is that the connection between the adapter and the agent is restored, the corresponding processing function can control the agent to maintain a normal state. That is, when the connection between the adapter and the agent is restored, the agent can maintain a normal state.
[0241] If the event is that the agent receives a sample DTU message event from the adapter, the corresponding processing function can control the agent to forward the sample data according to the sample DTU message and maintain a normal state. That is, when the agent receives a sample DTU message event from the adapter, the agent can forward the sample data according to the sample DTU message and maintain a normal state.
[0242] In the agent's application system interruption state
[0243] If the event is that the agent receives a request DTU message, the corresponding processing function can control the agent to cache the request information and keep the application system interrupted. That is, when the agent receives a request DTU message, the agent can cache the request information and keep the application system interrupted. For example, the request DTU message here can refer to the request DTU message of the application system.
[0244] If the event is that the agent receives a response DTU message, the corresponding processing function can control the agent to cache the response information and keep the application system interrupted. That is, when the agent receives a response DTU message, the agent here can cache the response information and keep the application system interrupted. For example, the response DTU message here can refer to the response DTU message of the adapter.
[0245] If the event is that the connection between the application system and the agent is disconnected, the corresponding processing function can control the agent to keep the application system disconnected. That is, when the connection between the application system and the agent is disconnected, the agent can keep the application system disconnected.
[0246] If the event is that the connection between the application system and the agent is restored, the corresponding processing function can control the agent to migrate to a normal state. That is, when the connection between the application system and the agent is restored, the agent can migrate to a normal state.
[0247] If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function can control the agent to migrate to a completely disconnected state. That is, when the connection between the adapter and the agent is disconnected, the agent can migrate to a completely disconnected state.
[0248] If the event is the connection between the adapter and the agent is restored, the corresponding processing function can control the agent to keep the application system interrupted. That is, when the connection between the adapter and the agent is restored, the agent can keep the application system interrupted.
[0249] If the event is that the agent receives the sample DTU message from the adapter, the corresponding processing function can control the agent to cache the sample data and keep the application system interrupted. That is, when the agent receives the sample DTU message from the adapter, the agent can cache the sample data and keep the application system interrupted.
[0250] In the agent's adapter down state
[0251] If the event is that the agent receives a request DTU message, the corresponding processing function can control the agent to cache the request information and keep the adapter interrupted. That is, when the agent receives the request DTU message, the agent can cache the request information and keep the adapter interrupted. For example, the request DTU message here can refer to the request DTU message of the application system.
[0252] If the event is that the agent receives a response DTU message, the corresponding processing function can control the agent to cache the response information and keep the adapter interrupted. That is, when the agent receives a response DTU message, the agent can cache the response information and keep the adapter interrupted. For example, the response DTU message here can refer to the response DTU message of the adapter.
[0253] If the event is that the connection between the application system and the agent is disconnected, the corresponding processing function can control the agent to migrate to a completely disconnected state. That is, when the connection between the application system and the agent is disconnected, the agent can migrate to a completely disconnected state.
[0254] If the event is that the connection between the application system and the agent is restored, the corresponding processing function can control the agent to keep the adapter interrupted state. That is, when the connection between the application system and the agent is restored, the agent can keep the adapter interrupted state.
[0255] If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function can control the agent to migrate to a completely disconnected state. That is, when the connection between the adapter and the agent is disconnected, the agent can migrate to a completely disconnected state.
[0256] If the event is that the connection between the adapter and the agent is restored, the corresponding processing function can control the agent to migrate to a normal state. That is, when the connection between the adapter and the agent is restored, the agent can migrate to a normal state.
[0257] If the event is that the agent receives the sample DTU message from the adapter, the corresponding processing function can control the agent to forward the sample data according to the subscription message and keep the adapter interrupted. That is, when the agent receives the sample DTU message from the adapter, the agent forwards the sample data according to the subscription message and keeps the adapter interrupted.
[0258] In a completely disconnected state of the agent
[0259] If the event is that the agent receives a request DTU message, the corresponding processing function can control the agent to cache the request information and maintain a completely interrupted state. That is, when the agent receives a request DTU message, the agent caches the request information and maintains a completely interrupted state. For example, the request DTU message here can refer to the request DTU message of the application system.
[0260] If the event is that the agent receives a response DTU message, the corresponding processing function can control the agent to cache the response information and maintain a completely interrupted state. That is, when the agent receives a response DTU message, the agent can cache the response information and maintain a completely interrupted state. For example, the response DTU message here can refer to the response DTU message of the adapter.
[0261] If the event is that the connection between the application system and the agent is disconnected, the corresponding processing function can control the agent to remain in a completely disconnected state. That is, when the connection between the application system and the agent is disconnected, the agent can remain in a completely disconnected state.
[0262] If the event is that the connection between the application system and the agent is restored, the corresponding processing function can control the agent to migrate to the adapter interruption state. That is, when the connection between the application system and the agent is restored, the agent can migrate to the adapter interruption state.
[0263] If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function can control the agent to remain in a completely disconnected state. That is, when the connection between the adapter and the agent is disconnected, the agent can remain in a completely disconnected state.
[0264] If the event is that the connection between the adapter and the agent is restored, the corresponding processing function can control the agent to migrate to the application system interruption state. That is, when the connection between the adapter and the agent is restored, the agent can migrate to the application system interruption state.
[0265] If the event is that the agent receives the sample DTU message from the adapter, the corresponding processing function can control the agent to forward the sample data according to the subscription message and maintain a completely interrupted state. That is, when the agent receives the sample DTU message from the adapter, the agent can forward the sample data according to the subscription message and maintain a completely interrupted state.
[0266] As an example, the state transition of the agent can be as shown in Table 2 and Figure 5 shown.
[0267] Table 2 Agent state transition table
[0268]
[0269]
[0270] adapter
[0271] Optionally, based on the first state transfer mechanism, the state of the adapter may include an initial state, a normal state, a request state, and a connection interruption state, wherein the connection interruption state may refer to the connection interruption between the adapter and the agent.
[0272] Further, based on the first state transfer mechanism, the migration of the adapter between various states can be described as follows.
[0273] In the initial state of the adapter
[0274] If the event is an initialization event, the corresponding processing function can control the adapter to initialize the model and register with the agent, and the adapter migrates to the normal state. That is, when the initialization event occurs, the adapter can initialize the model and register with the agent, and the adapter migrates to the normal state. Among them, model initialization can refer to the initialization performed by the adapter to adapt to different CNC devices.
[0275] In the normal state of the adapter
[0276] If the event is that the adapter receives a request DTU message, the corresponding processing function can control the adapter to process the request message and forward the response DTU message. If the forwarding of the response DTU message is successful, the adapter remains in a normal state. If the forwarding of the response DTU message fails, the adapter migrates to a request state. That is, when the adapter receives a requestDTU message, the adapter can process the request message and forward the response DTU message. If the forwarding of the response DTU message is successful, the adapter can remain in a normal state. If the forwarding of the response DTU message fails, the adapter can migrate to a request state. Exemplarily, the request DTU message here can refer to the requestDTU message of the agent, and the adapter forwarding the response DTU message can refer to forwarding it to the agent.
[0277] If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function can control the adapter to enter the disconnected state. That is, when the connection between the adapter and the agent is disconnected, the adapter can enter the disconnected state.
[0278] If the event is that the connection between the adapter and the agent is restored, the corresponding processing function can control the adapter to maintain a normal state. That is, when the connection between the adapter and the agent is restored, the adapter can maintain a normal state.
[0279] If the event is that the sampling condition is met, the corresponding processing function can control the adapter to send a sample DTU message and maintain a normal state. That is, when the sampling condition is met, the adapter can send a sample DTU message and maintain a normal state. The sampling condition can refer to the trigger condition or state of the sampling being met.
[0280] In the adapter's request state
[0281] If the event is that the adapter receives a request DTU message, the corresponding processing function can control the adapter to process the request message and forward the response DTU message. If the forwarding of the response DTU message is successful, the adapter maintains the request state. If the forwarding of the response DTU message fails, the adapter maintains the request state. That is, when the adapter receives a request DTU message, the adapter can process the request message and forward the response DTU message. If the forwarding of the response DTU message is successful, the adapter can maintain the request state. If the forwarding of the response DTU message fails, the adapter can maintain the request state. Exemplarily, the request DTU message here can refer to the request DTU message of the agent, and the adapter forwarding the response DTU message can refer to forwarding it to the agent.
[0282] If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function can control the adapter to enter the disconnected state and cache the response DTU message. That is, when the connection between the adapter and the agent is disconnected, the adapter can enter the disconnected state and cache the response DTU message.
[0283] If the event is that the connection between the adapter and the proxy is restored, the corresponding processing function can control the adapter to send the cached response DTU message and migrate to the normal state. That is, when the connection between the adapter and the proxy is restored, the adapter can send the cached response DTU message and migrate to the normal state.
[0284] If the event is that the sampling condition is met, the corresponding processing function can control the adapter to send a sample DTU message and maintain the request state. That is, when the sampling condition is met, the adapter can send a sample DTU message and maintain the request state. For example, the adapter can send the sample DTU message to the agent or application system.
[0285] When the adapter is disconnected
[0286] If the event is that the adapter receives a request DTU message, the corresponding processing function can control the adapter to process the request message and cache the response DTU message, and keep the connection interrupted. That is, when the adapter receives the request DTU message, the adapter processes the request message and caches the response DTU message and keeps the connection interrupted. Exemplarily, the request DTU message here can refer to the request DTU message of the agent, and the response DTU message cached by the adapter can refer to the response DTU message to be forwarded to the agent.
[0287] If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function can control the adapter to maintain the disconnected state. That is, when the connection between the adapter and the agent is disconnected, the adapter can maintain the disconnected state.
[0288] If the event is that the connection between the adapter and the agent is restored, the corresponding processing function can control the adapter to send the cached response DTU message and migrate to the normal state. That is, when the connection between the adapter and the agent is restored, the adapter sends the cached response DTU message and migrates to the normal state. Exemplarily, the response DTU message cached by the adapter can refer to the response DTU message to be forwarded to the agent.
[0289] If the event is that the sampling condition is met, the corresponding processing function can control the adapter to send a sample DTU message and keep the connection disconnected. That is, when the sampling condition is met, the adapter can send a sample DTU message and keep the connection disconnected. For example, the adapter can send the sample DTU message to the agent or application system.
[0290] As an example, the state transition of the adapter can be as shown in Table 3 and Figure 6 shown.
[0291] Table 3 Adapter state transition table
[0292]
[0293] As mentioned above, the data in the NC-Link protocol system is stored in the form of a device structure tree. However, in actual application, different application systems may have collection requirements for the same data at different times, resulting in repeated collection and poor data sharing.
[0294] Based on this, optional, Figure 3 The method shown also includes: constructing a data model of the numerical control device based on the structure tree of the numerical control device, and the data types in the data model include original data and statistical data.
[0295] The original data comes from different components of the CNC equipment. The original data is stored in the time series database TSDB of the NC-Link protocol system. The original data includes one or more of the following data of the components: attribute data, configuration parameter data, control data, and operation status data.
[0296] Statistical data is obtained through the analysis and processing of raw data and historical data. Historical data is formed based on the accumulated raw data. Due to the time series characteristics of raw data and its wide variety, the amount of historical data is large.
[0297] Based on this, unified access to CNC equipment data can be achieved, data sharing and data expansion capabilities can be improved, and the rapid promotion and application of the NC-Link standard protocol can be facilitated.
[0298] As an example, the data model of a CNC machine tool device can be as follows Figure 7 The original data mainly comes from the spindle, controller, driver, motor, lead screw, etc. of the CNC machine tool.
[0299] The raw data may include attribute data describing component features, parameter data for configuring machine tool parameters, control data, and equipment operating status data. Historical data is formed by the accumulated raw data records. Due to the time series characteristics of raw data and the wide variety of types, the amount of historical data is large. Based on historical data and real-time raw data, machine tool equipment data can be analyzed and processed to obtain statistical data, such as equipment operating time, total number of processed parts, current average, and maximum spindle speed.
[0300] Establishing a machine tool equipment data model with machine tool key components as the main structure can provide a unified description method for different types of data, improve data access efficiency, provide data expansion capabilities, meet the needs of cross-application data use, and avoid the waste of network and computing resources at the edge of the equipment machine tool.
[0301] The method provided in the embodiment of the present application is described in detail above. The device provided in the embodiment of the present application is described in detail below with reference to the accompanying drawings.
[0302] See also Figure 8 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 8The electronic device 800 shown may include: a recording module 810, used to record the status of each layer in the NC-Link protocol system, and the status of each layer is based on the event migration in the NC-Link protocol system; a control module 820, used to control the action and status of each layer based on the processing function corresponding to the event; wherein, each layer includes an application system, an agent, and an adapter, and the correspondence between the status, event, action and processing function of each layer can be determined based on the first state transfer mechanism.
[0303] Optionally, based on the first state transfer mechanism, the state of the application system includes an initial state, a normal state, a request state and a connection interruption state.
[0304] Optional:
[0305] In the initial state of the application system:
[0306] If the event is an initialization event, the corresponding processing function controls the application system to register with the agent and migrate to the normal state;
[0307] In the normal state of the application system:
[0308] If the event is a request to obtain data event, the corresponding processing function controls the application system to trigger a request data transmission unit DTU message and migrate to the request state;
[0309] If the event is that the application system receives a response DTU message from the agent, the corresponding processing function controls the application system to discard the response DTU message and maintain the normal state;
[0310] If the event is the disconnection between the application system and the agent, the corresponding processing function controls the application system to migrate to the disconnected state;
[0311] If the event is the restoration of the connection between the application system and the agent, the corresponding processing function controls the application system to maintain a normal state;
[0312] If the event is that the application system receives a sampled DTU message from a subscribed adapter, the corresponding processing function controls the application system to process the sampled data and maintain a normal state;
[0313] In the application system's request state:
[0314] If the event is a request to obtain data event, the corresponding processing function controls the application system to remain in the request state and triggers a request DTU message;
[0315] If the event is that the application system receives a response DTU message from the agent, the corresponding processing function controls the application system to migrate to a normal state;
[0316] If the event is the disconnection between the application system and the agent, the corresponding processing function controls the application system to migrate to the disconnected state;
[0317] If the event is the restoration of the connection between the application system and the agent, the corresponding processing function controls the application system to maintain the request state;
[0318] If the event is that the application system receives a sampled DTU message from a subscribed adapter, the corresponding processing function controls the application system to process the sampled data and maintain the request state;
[0319] When the application system is disconnected:
[0320] If the event is a request to obtain data event, the corresponding processing function controls the application system to cache the request and keep the connection disconnected;
[0321] If the event is that the application system receives a response DTU message from the agent, the corresponding processing function controls the application system to process the response DTU message and maintain the connection interruption state;
[0322] If the event is that the connection between the application system and the agent is disconnected, the corresponding processing function controls the application system to maintain the disconnected state;
[0323] If the event is that the connection between the application system and the proxy is restored, the corresponding processing function controls the application system to determine whether there is a request in the cache. If there is a request in the cache, the application system sends the request and migrates to the request state. If there is no request in the cache, the application system migrates to the normal state.
[0324] If the event is that the application system receives a sampling DTU message from the adapter, the corresponding processing function controls the application system to process the sampling data and maintain the connection interruption state.
[0325] Optionally, based on the first state transfer mechanism, the states of the agent include an initial state, a normal state, an application system interruption state, an adapter interruption state, and a complete interruption state.
[0326] Optional:
[0327] In the initial state of the agent:
[0328] If the event is an initialization event, the corresponding processing function controls the agent to check the registration status of the application system and migrate to the normal state;
[0329] In the normal state of the agent:
[0330] If the event is that the agent receives a request DTU message, the corresponding processing function controls the agent to store and forward the request DTU message and maintain a normal state;
[0331] If the event is that the agent receives a response DTU message, the corresponding processing function controls the agent to store and forward the response DTU message and maintain a normal state;
[0332] If the event is the disconnection between the application system and the agent, the corresponding processing function controls the agent to migrate to the application system interruption state;
[0333] If the event is the restoration of the connection between the application system and the agent, the corresponding processing function controls the agent to maintain a normal state;
[0334] If the event is the disconnection between the adapter and the agent, the corresponding processing function controls the agent to migrate to the adapter interruption state;
[0335] If the event is the connection restoration between the adapter and the agent, the corresponding processing function controls the agent to maintain a normal state;
[0336] If the event is an event that the agent receives a sampling DTU message from the adapter, the corresponding processing function controls the agent to forward the sampling data according to the sampling DTU message and maintain a normal state;
[0337] When the agent's application system is interrupted:
[0338] If the event is that the agent receives a request DTU message, the corresponding processing function controls the agent to cache the request information and keep the application system in an interrupt state;
[0339] If the event is that the agent receives a response DTU message, the corresponding processing function controls the agent to cache the response information and keep the application system in interrupt status;
[0340] If the event is the disconnection between the application system and the agent, the corresponding processing function controls the agent to keep the application system in the interrupted state;
[0341] If the event is the restoration of the connection between the application system and the agent, the corresponding processing function controls the agent to migrate to the normal state;
[0342] If the event is the disconnection between the adapter and the agent, the corresponding processing function controls the agent to migrate to the completely disconnected state;
[0343] If the event is the connection restoration between the adapter and the agent, the corresponding processing function controls the agent to keep the application system interrupted;
[0344] If the event is that the agent receives a sampling DTU message from the adapter, the corresponding processing function controls the agent to cache the sampling data and keep the application system in an interrupt state;
[0345] In the agent's adapter down state:
[0346] If the event is that the agent receives a request DTU message, the corresponding processing function controls the agent to cache the request information and keep the adapter interrupted;
[0347] If the event is that the agent receives a response DTU message, the corresponding processing function controls the agent to cache the response information and keep the adapter interrupted;
[0348] If the event is the interruption of the connection between the application system and the agent, the corresponding processing function controls the agent to migrate to the complete interruption state;
[0349] If the event is the restoration of the connection between the application system and the agent, the corresponding processing function controls the agent to keep the adapter interrupted;
[0350] If the event is the disconnection between the adapter and the agent, the corresponding processing function controls the agent to migrate to the completely disconnected state;
[0351] If the event is the restoration of the connection between the adapter and the agent, the corresponding processing function controls the agent to migrate to the normal state;
[0352] If the event is that the agent receives a sampling DTU message from the adapter, the corresponding processing function controls the agent to forward the sampling data according to the subscription message and keeps the adapter in interrupt status;
[0353] In the fully disconnected state of the agent:
[0354] If the event is that the agent receives a request DTU message, the corresponding processing function controls the agent to cache the request information and maintain a completely interrupted state;
[0355] If the event is that the agent receives a response DTU message, the corresponding processing function controls the agent to cache the response information and maintain a completely interrupted state;
[0356] If the event is the disconnection between the application system and the agent, the corresponding processing function controls the agent to remain in a completely disconnected state;
[0357] If the event is the restoration of the connection between the application system and the agent, the corresponding processing function controls the agent to migrate to the adapter interruption state;
[0358] If the event is the disconnection between the adapter and the agent, the corresponding processing function controls the agent to remain in a completely disconnected state;
[0359] If the event is the connection recovery between the adapter and the agent, the corresponding processing function controls the agent to migrate to the application system interruption state;
[0360] If the event is that the agent receives a sampling DTU message from the adapter, the corresponding processing function controls the agent to forward the sampling data according to the subscription message and maintain a completely interrupted state.
[0361] Optionally, based on the first state transfer mechanism, the state of the adapter includes an initial state, a normal state, a request state, and a connection interruption state.
[0362] Optional:
[0363] In the initial state of the adapter:
[0364] If the event is an initialization event, the corresponding processing function controls the adapter to initialize the model and register with the agent, and the adapter migrates to the normal state;
[0365] In the normal state of the adapter:
[0366] If the event is that the adapter receives a request DTU message, the corresponding processing function controls the adapter to process the request message and forward the response DTU message. If the forwarding of the response DTU message succeeds, the adapter remains in the normal state. If the forwarding of the request DTU message fails, the adapter migrates to the request state.
[0367] If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function controls the adapter to enter the disconnected state;
[0368] If the event is the connection restoration between the adapter and the agent, the corresponding processing function controls the adapter to maintain a normal state;
[0369] If the event is that the sampling condition is met, the corresponding processing function controls the adapter to send the sampling DTU message and maintain the normal state;
[0370] In the adapter's request state:
[0371] If the event is that the adapter receives a request DTU message, the corresponding processing function controls the adapter to process the request message and forward the response DTU message. If the forwarding of the response DTU message succeeds, the adapter maintains the request state. If the forwarding of the response DTU message fails, the adapter maintains the request state.
[0372] If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function controls the adapter to enter the disconnected state and caches the response DTU message;
[0373] If the event is the connection recovery between the adapter and the agent, the corresponding processing function controls the adapter to send the cached response DTU message and migrate to the normal state;
[0374] If the event is that the sampling condition is met, the corresponding processing function controls the adapter to send the sampling DTU message and maintain the request state;
[0375] When the adapter is disconnected:
[0376] If the event is that the adapter receives a request DTU message, the corresponding processing function controls the adapter to process the request message and cache the response DTU message, and maintain the connection interrupted state;
[0377] If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function controls the adapter to maintain the disconnected state;
[0378] If the event is the connection recovery between the adapter and the agent, the corresponding processing function controls the adapter to send the cached response DTU message and migrate to the normal state;
[0379] If the event is that the sampling condition is met, the corresponding processing function controls the adapter to send a sampling DTU message and maintain the connection interrupted state.
[0380] Optionally, the electronic device 800 further includes:
[0381] A construction module 830 is used to construct a data model of the numerical control device based on the structure tree of the numerical control device, and the data types in the data model include original data and statistical data;
[0382] The original data comes from different components of the CNC equipment. The original data is stored in the time series database TSDB of the NC-Link protocol system. The original data includes one or more of the following data of the components:
[0383] Attribute data, configuration parameter data, control data, and operating status data;
[0384] Statistical data is obtained based on the analysis and processing of original data and historical data, and historical data is formed based on the accumulated original data.
[0385] The present application also provides an electronic device. Fig. 9 As shown, the electronic device 900 includes: at least one processor 901, a memory 902, and a computer program 903 stored in the memory 902 and executable on the at least one processor 901. When the processor 901 executes the computer program 903, the method provided in the present application is implemented.
[0386] Exemplarily, the computer program 903 may be divided into one or more modules / units, one or more modules / units are stored in the memory 902, and are executed by the processor 901 to complete the present application. One or more modules / units may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the electronic device 900.
[0387] Those skilled in the art will understand that Fig. 9It is only an example of the electronic device 900 and does not constitute a limitation of the electronic device. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device 900 may also include input and output devices, network access devices, buses, etc.
[0388] The processor 901 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0389] The memory 902 may be an internal storage unit of the electronic device 900, such as a hard disk or memory of the electronic device 900. The memory 902 may also be an external storage device of the electronic device 900, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 900. Further, the memory 902 may also include both an internal storage unit of the electronic device 900 and an external storage device. The memory 902 is used to store computer programs and other programs and data required by the electronic device 900. The memory 902 may also be used to temporarily store data that has been output or is to be output.
[0390] The electronic device 900 provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0391] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0392] An embodiment of the present application provides a computer program product. When the computer program product runs on an electronic device, the electronic device can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0393] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above method embodiments, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above method embodiments can be implemented. Among them, the computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / electronic device, recording medium, computer memory, ROM (read-only memory), RAM (random access memory), CD-ROM (compact disc read-only memory), magnetic tape, floppy disk and optical data storage device. The computer-readable storage medium mentioned in the present application can be a non-volatile storage medium, in other words, a non-transient storage medium.
[0394] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0395] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0396] In the embodiments provided in the present application, it should be understood that the disclosed devices / equipment and methods can be implemented in other ways. For example, the device / equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0397] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0398] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0399] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0400] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0401] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for interaction between layers of the NC-Link protocol, characterized in that: The NC-Link protocol is applied to numerical control equipment, and the method includes: Recording the status of each layer in the NC-Link protocol system, wherein the status of each layer is based on event migration in the NC-Link protocol system; Control the actions and states of each layer based on the processing function corresponding to the event; The layers include an application system, an agent, and an adapter, and the corresponding relationship between the states, events, actions, and processing functions of the layers is determined based on a first state transfer mechanism.
2. The method according to claim 1, characterized in that Based on the first state transfer mechanism, the state of the application system includes an initial state, a normal state, a request state and a connection interruption state.
3. The method according to claim 2, characterized in that Based on the first state transfer mechanism: In the initial state of the application system: If the event is an initialization event, the corresponding processing function controls the application system to register with the agent and migrate to a normal state; In the normal state of the application system: If the event is a request to obtain data event, the corresponding processing function controls the application system to trigger a request data transmission unit DTU message and migrate to the request state; If the event is that the application system receives a response DTU message from the agent, the corresponding processing function controls the application system to discard the response DTU message and maintain the normal state; If the event is a disconnection between the application system and the agent, the corresponding processing function controls the application system to migrate to the disconnected state; If the event is that the connection between the application system and the agent is restored, the corresponding processing function controls the application system to maintain the normal state; If the event is that the application system receives a sampled DTU message of the adapter to which it is subscribed, the corresponding processing function controls the application system to process the sampled data and maintain the normal state; In the request state of the application system: If the event is a request to obtain data event, the corresponding processing function controls the application system to remain in the request state and triggers a request DTU message; If the event is that the application system receives a response DTU message from the agent, the corresponding processing function controls the application system to migrate to the normal state; If the event is a disconnection between the application system and the agent, the corresponding processing function controls the application system to migrate to the disconnected state; If the event is the restoration of the connection between the application system and the agent, the corresponding processing function controls the application system to maintain the request state; If the event is that the application system receives a sampled DTU message of the adapter to which it is subscribed, the corresponding processing function controls the application system to process the sampled data and maintain the request state; In the connection interruption state of the application system: If the event is a request to obtain data event, the corresponding processing function controls the application system to cache the request and maintain the connection interruption state; If the event is that the application system receives a response DTU message from the agent, the corresponding processing function controls the application system to process the response DTU message and maintain the connection interruption state; If the event is that the connection between the application system and the agent is disconnected, the corresponding processing function controls the application system to maintain the disconnected state; If the event is that the connection between the application system and the proxy is restored, the corresponding processing function controls the application system to determine whether there is a request in the cache, if there is a request in the cache, the application system sends the request and migrates to the request state, if there is no request in the cache, the application system migrates to the normal state; If the event is that the application system receives a sampling DTU message from the adapter, the corresponding processing function controls the application system to process the sampling data and maintain the connection in the interrupt state.
4. The method according to claim 3, characterized in that Based on the first state transfer mechanism, the states of the agent include an initial state, a normal state, an application system interruption state, an adapter interruption state, and a complete interruption state.
5. The method according to claim 4, characterized in that Based on the first state transfer mechanism: In the initial state of the agent: If the event is an initialization event, the corresponding processing function controls the agent to check the registration status of the application system and migrate to the normal state; In the normal state of the agent: If the event is that the agent receives a request DTU message, the corresponding processing function controls the agent to store and forward the request DTU message and maintain the normal state; If the event is that the agent receives a response DTU message, the corresponding processing function controls the agent to store and forward the response DTU message and maintain the normal state; If the event is that the connection between the application system and the agent is interrupted, the corresponding processing function controls the agent to migrate to the application system interruption state; If the event is that the connection between the application system and the agent is restored, the corresponding processing function controls the agent to maintain the normal state; If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function controls the agent to migrate to the adapter interruption state; If the event is that the connection between the adapter and the agent is restored, the corresponding processing function controls the agent to maintain the normal state; If the event is an event that the agent receives a sampled DTU message from the adapter, the corresponding processing function controls the agent to forward sampled data according to the sampled DTU message and maintain the normal state; In the application system interruption state of the agent: If the event is that the agent receives a request DTU message, the corresponding processing function controls the agent to cache the request information and maintain the interrupt state of the application system; If the event is that the agent receives a response DTU message, the corresponding processing function controls the agent to cache the response information and maintain the interrupt state of the application system; If the event is that the connection between the application system and the agent is disconnected, the corresponding processing function controls the agent to keep the application system in an interrupted state; If the event is that the connection between the application system and the agent is restored, the corresponding processing function controls the agent to migrate to the normal state; If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function controls the agent to migrate to the completely disconnected state; If the event is that the connection between the adapter and the agent is restored, the corresponding processing function controls the agent to keep the application system in an interrupted state; If the event is that the agent receives a sampling DTU message from the adapter, the corresponding processing function controls the agent to cache the sampling data and maintain the interrupt state of the application system; In the adapter interrupt state of the agent: If the event is that the agent receives a request DTU message, the corresponding processing function controls the agent to cache the request information and maintain the adapter interrupt state; If the event is that the agent receives a response DTU message, the corresponding processing function controls the agent to cache the response information and maintain the adapter interrupt state; If the event is that the connection between the application system and the agent is disconnected, the corresponding processing function controls the agent to migrate to the complete interruption state; If the event is that the connection between the application system and the agent is restored, the corresponding processing function controls the agent to keep the adapter in an interrupted state; If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function controls the agent to migrate to the completely disconnected state; If the event is that the connection between the adapter and the agent is restored, the corresponding processing function controls the agent to migrate to the normal state; If the event is that the agent receives a sampling DTU message from the adapter, the corresponding processing function controls the agent to forward the sampling data according to the subscription message and keeps the adapter in an interrupt state; In the fully interrupted state of the agent: If the event is that the agent receives a request DTU message, the corresponding processing function controls the agent to cache the request information and maintain the complete interruption state; If the event is that the agent receives a response DTU message, the corresponding processing function controls the agent to cache the response information and maintain the complete interruption state; If the event is that the connection between the application system and the agent is disconnected, the corresponding processing function controls the agent to maintain the complete interruption state; If the event is that the connection between the application system and the agent is restored, the corresponding processing function controls the agent to migrate to the adapter interrupt state; If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function controls the agent to maintain the complete interruption state; If the event is that the connection between the adapter and the agent is restored, the corresponding processing function controls the agent to migrate to the application system interruption state; If the event is that the agent receives a sampled DTU message from the adapter, the corresponding processing function controls the agent to forward the sampled data according to the subscription message and maintain the complete interruption state.
6. The method according to claim 5, characterized in that Based on the first state transfer mechanism, the state of the adapter includes an initial state, a normal state, a request state, and a connection interruption state.
7. The method according to claim 6, characterized in that Based on the first state transfer mechanism: In the initial state of the adapter: If the event is an initialization event, the corresponding processing function controls the adapter to perform model initialization and registration in the agent, and the adapter migrates to the normal state; In the normal state of the adapter: If the event is that the adapter receives a request DTU message, the corresponding processing function controls the adapter to process the request message and forward the response DTU message, if the forwarding of the response DTU message succeeds, the adapter maintains the normal state, if the forwarding of the response DTU message fails, the adapter migrates to the request state; If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function controls the adapter to enter the connection interruption state; If the event is that the connection between the adapter and the agent is restored, the corresponding processing function controls the adapter to maintain the normal state; If the event is that the sampling condition is met, the corresponding processing function controls the adapter to send a sampling DTU message and maintain the normal state; In the request state of the adapter: If the event is that the adapter receives a request DTU message, the corresponding processing function controls the adapter to process the request message and forward the response DTU message, if the forwarding of the response DTU message succeeds, the adapter maintains the request state, if the forwarding of the response DTU message fails, the adapter maintains the request state; If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function controls the adapter to enter the connection interruption state and caches the response DTU message; If the event is that the connection between the adapter and the agent is restored, the corresponding processing function controls the adapter to send the cached response DTU message and migrate to the normal state; If the event is that the sampling condition is met, the corresponding processing function controls the adapter to send a sampling DTU message and maintain the request state; In the disconnected state of the adapter: If the event is that the adapter receives a request DTU message, the corresponding processing function controls the adapter to process the request message and cache the response DTU message, and maintain the connection interruption state; If the event is that the connection between the adapter and the agent is disconnected, the corresponding processing function controls the adapter to maintain the disconnected state; If the event is that the connection between the adapter and the agent is restored, the corresponding processing function controls the adapter to send the cached response DTU message and migrate to the normal state; If the event is that a sampling condition is met, the corresponding processing function controls the adapter to send a sampling DTU message and maintain the connection interruption state.
8. The method according to any one of claims 1 to 7, characterized in that The method further comprises: Building a data model of the numerical control device based on the structure tree of the numerical control device, wherein the data types in the data model include original data and statistical data; The original data is derived from different components of the numerical control device, and the original data is stored in the time series database TSDB of the NC-Link protocol system. The original data includes one or more of the following data of the components: Attribute data, configuration parameter data, control data, and operating status data; The statistical data is obtained based on analyzing and processing the original data and historical data, and the historical data is formed based on the accumulated original data.
9. An electronic device, characterized in that: include: A recording module, used for recording the status of each layer in the NC-Link protocol system, wherein the status of each layer is based on the event migration in the NC-Link protocol system; A control module, used to control the actions and states of each layer based on the processing function corresponding to the event; The layers include an application system, an agent, and an adapter, and the corresponding relationship between the states, events, actions, and processing functions of the layers is determined based on a first state transfer mechanism.
10. An electronic device comprising a memory, at least one processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 8 is implemented.
