List of Symbols
CNC
API
RESTAPI
HMI
OPC UA
XML
HTTP
URI
JSON
AbstractAs the manufacturing industry adopts smart technologies, the demand for industrial applications that can interact with various manufacturing equipment has increased. CNCs are the core units that control machine tools, which make up the majority of manufacturing sites. Therefore, communication with CNCs is essential for collecting machine tool status information. However, since each CNC manufacturer uses a different communication interface, implementing mutually exclusive CNC communication methods is necessary when developing industrial applications. To allow application developers to focus on functionality without having to consider heterogeneous CNC communications, a unified CNC interface platform called TORUS was developed and publicly released. However, because TORUS operates only on Windows OS, there are limitations to its integration with existing systems at manufacturing sites. To address this issue, a TORUS-based gateway application has been proposed. This paper explains the necessity and role of the gateway application and demonstrates how it can effectively lower entry barriers to research and development related to smart factories. It also presents an example of how TORUS can be utilized through the REST API, which is widely used in modern manufacturing environments. Additionally, it provides guidelines for developing TORUS gateway applications that support interfaces or protocols beyond the REST API.
List of SymbolsCNC Computerized Numerical Control API Application Programming Interface RESTAPI Representational State Transfer Application Programming Interface HMI Human Machine Interface OPC UA Open Platform Communications Unified Architecture XML eXtensible Markup Language HTTP Hypertext Transfer Protocol URI Uniform Resource Identifier JSON JavaScript Object Notation 1 IntroductionAs manufacturing sites become smarter, the demand for various industrial applications, such as monitoring systems and HMI, has been increasing. At the same time, research focused on the intelligence and efficiency of manufacturing equipment is also actively progressing. The information required for these industrial applications or research efforts is generated based on data from manufacturing sites. This data is either collected from external devices such as sensors attached to the equipment or directly acquired from the equipment itself. Among these, machine tools are highly complex equipment with a large amount of data to monitor, and their long lifespan often leads to a mixed environment of heterogeneous equipment. Developing industrial applications or conducting research in such heterogeneous environments is challenging. Generally, machine tools are controlled by CNCs, and communication with the CNC is essential to understand the machine’s status. Most CNC manufacturers provide APIs tailored to user requirements, allowing data acquisition and utilization through these APIs [1,2]. However, these APIs are often compatible only with the specific manufacturer’s products, requiring additional development to apply them to other CNCs. To address this issue, some CNC manufacturers have begun to additionally provide industrial standard protocols, such as OPC-UA or MTConnect, and research has been conducted to integrate multiple pieces of equipment at a manufacturing site under a single industrial standard protocol [3]. However, due to the differences in industrial standard protocols used by each manufacturer, integration across heterogeneous machines remains challenging, and unifying each manufacturing site under a single protocol requires separate integration efforts for each site. Consequently, application developers and researchers still need to develop separate communication functions for each CNC machine. To address this issue, a CNC interface platform was developed to unify communications across heterogeneous CNCs [4] and the platform was released under the name TORUS [5]. Based on an abstract Machine Data Model (state model) that represents the state of the machine tool, TORUS is a platform for the development and operation of applications that exchange data between CNCs and applications.
TORUS provides a unified interface for heterogeneous equipment, reducing the development costs of such applications. By using the integrated interface API of TORUS, developers can save time and money without needing to study the API of each CNC vendor. However, TORUS has limitations in its development and operational environments. Since it was developed for the Windows OS environment, which is commonly used by CNC vendors’ APIs, TORUS operates only on Windows OS, as shown in Fig. 1, and applications using the TORUS API, such as the Api.getData( ) function, must run on the same computer as TORUS. Furthermore, the TORUS API only supports C++ and C#.
To solve these limitations, a gateway application was proposed, as shown in Fig. 2, which allows applications that do not use the TORUS API directly to use TORUS indirectly. One example is an OPC UA Server using the TORUS API, and the server provides access TORUS through the OPC UA interface [6]. OPC UA is a widely used industrial standard protocol with high compatibility with industrial equipment. However, it requires a specific client, and the application development process can be complex [7].
We have also developed a gateway application based on MTConnect. MTConnect is an open industrial communication protocol for connecting manufacturing equipment [8]. MTConnect consists of an agent and an adapter, where the agent collects data from equipment and the adapter provides the data in a standardized XML format, allowing users to access it. MTConnect provides all data in XML at once, allowing users to filter the necessary data within XML, but the structure or content of the XML data items cannot be modified in real time. The MTConnect gateway application we developed also operates by allowing users to obtain predefined data in XML format via the HTTP protocol. This method is suitable for building a monitoring system that uses specific data. However, this approach has limitations in flexibility when the type or range of requested data changes frequently. An example of this is ‘macro’ data in machine tools. Macros can number in the hundreds for each model and are distinguished by macro numbers. Using OPC UA, desired macros can be specified through OPC UA node addresses. However, to provide macro data via MTConnect, it would be necessary to provide data for the entire macro list, or to change the configuration of the agent and adapter each time the required macro list is updated. Therefore, a gateway application through MTConnect is suitable for simple monitoring purposes but may not be appropriate if data items need to change flexibly according to user purposes.
REST API, on the other hand, allows specific data items or functions to be targeted through URIs, just like OPC UA. Additionally, it is a simple and generic interface that operates over HTTP and is commonly used in web services and mobile applications. REST API can be easily tested and accessed through simple tools like web browsers or cURL, lowering the entry barrier for developers. It is also easily usable in almost any environment that provides an HTTP client. Due to these advantages, its usage in manufacturing sites is increasing. This paper explains how to use TORUS with a REST API by describing the development of a web server using the TORUS API. The developed web server receives REST API requests from clients, translates them into TORUS API requests, communicates with the CNC through TORUS, and returns the results to the client.
This paper has two main objectives. The first is to demonstrate that even non-expert developers can easily communicate with CNCs at manufacturing sites through TORUS-based gateway applications. The second is to enable anyone to develop a gateway application using not only OPC UA or REST API, but also other interfaces by referencing this paper.
2 Related Work2.1 TORUSA unified CNC interface platform was developed to provide an environment where applications with various functionalities related to machine tools can be effectively executed [4]. TORUS is the product name of this unified CNC interface platform. It can be downloaded and from the TORUS website (https://torus.co.kr) and provides a unified interface for CNCs, which are the key components of machine tools widely used in manufacturing sites. TORUS features a unified interface that can support heterogeneous CNCs through a detailed common data model for machine tools. When developing applications using the exclusive interfaces provided by CNC vendors, each vendor’s interface must be applied separately. However, by using TORUS, only the TORUS API needs to be applied, thus reducing development costs. Additionally, when a new machine tool is added to the manufacturing site, if it is supported by TORUS, there is no need to redevelop the application, leading to reduced maintenance costs [9]. However, as the operating environment is limited, the TORUS gateway application was developed to address these issues by adding additional interfaces to TORUS.
2.2 TORUS OPC UA Server Gateway ApplicationTORUS provides a unified interface for machine tools, but understanding the TORUS API and having experience with C++ or C# development is required. Moreover, it is not an easy task to make existing systems at manufacturing sites communicate with machine tools using the TORUS API. Various industrial standard protocols, including OPC UA, are already being used in manufacturing sites. If TORUS could be utilized with these existing protocols and interfaces, system development or modification costs could be reduced. Yoon et al. [6] used OPC UA in a monitoring system to collect the status data simultaneously from a manufacturing cell which consists of an industrial robot and a machine tool. TORUS OPC UA server gateway was developed to provide the monitoring system with the status data of a machine tool. OPC UA exchanges data by having the client request objects called Nodes from the server. The OPC UA server in this case uses the URI of the Machine Data Model provided by TORUS as the Node address. When a client requests a Node, the server uses the requested Node address to call the TORUS API. The response from TORUS becomes the value of the Node. Since the Machine Data Model of TORUS is used, system users can explore the Nodes containing the desired data by referring to the TORUS manual.
2.3 REST APIThe Representational State Transfer (REST) is a set of rules or an architectural style for designing distributed hypermedia systems such as the web [10]. REST defines how to efficiently request and handle resources in systems like the web, and by following these principles, data transfer between systems becomes standardized and simplified.
A REST API refers to the programming interface of a service or program that follows the REST architectural style. It allows a client to request resources from a server and receive responses, using the HTTP protocol with methods such as GET, POST, PUT, and DELETE to handle resources.
Although OPC UA is a widely used industrial standard protocol in manufacturing sites, REST API has a broader scope and is easier to develop. For example, when developing an HMI for mobile devices, using an HTTP protocol with a REST API architecture requires less development effort than OPC UA. While OPC UA can also be accessed via HTTP, additional configurations are required on the server side to support this [11]. Furthermore, the JSON data format commonly used with REST API facilitates interaction with various clients. In this study, we developed the TORUS REST API gateway application. The TORUS OPC UA server gateway application was designed solely for monitoring purposes, so it only implemented the function to obtain data defined in TORUS’s Machine Data Model. However, the TORUS REST API gateway application allows access to other TORUS functions, such as file access, in addition to the Machine Data Model.
3 MethodTORUS has a Machine Data Model that defines the state of machine tools. The reason various machine tools can be managed through a unified interface is that the state information of each machine tool is mapped to a common model called the Machine Data Model. The items, descriptions, and usage of the Machine Data Model can be found in the TORUS manual. Fig. 3 shows how to retrieve the value of the machine position from the Machine Data Model by referencing the manual. The process of acquiring data from the machine tools through TORUS using the TORUS API is described in detail in the TORUS manual, so it will not be covered in this paper. When an application retrieves data from TORUS using the Api.getData( ) function of the TORUS API, the Machine Data Model is used to distinguish the data. The Machine Data Model represents the state information of a machine tool, uniquely identified by a URI. This is how TORUS consistently represents the states of heterogeneous CNCs that have different representation methods. Since TORUS is not dependent on any specific machine tool, this common data representation is essential. If the gateway application does not use the Machine Data Model, a new method would need to be created to consistently represent the states of different machines. Utilizing the existing Machine Data Model is more efficient. Therefore, even when adding new interfaces through the TORUS gateway application, the Machine Data Model must still be usable as it is.
In the previously developed OPC UA gateway application, the URI of the Machine Data Model was used as the address of the Node. Since each Node in OPC UA has a unique address, it was possible to use the Machine Data Model as the address.
The TORUS REST API gateway application developed in this study opens a web server and performs requests by receiving the Machine Data Model as a URI. The URI is a core element of the REST API, which identifies web resources. The URI of the Machine Data Model can be directly used to interface with CNCs through the gateway application. As shown in Fig. 4, we use the HTTP methods GET, PUT, and DELETE for this purpose.
Fig. 5 shows the methodology of the TORUS REST API gateway application. The gateway application runs a server, and users input the address and filter of the Machine Data Model by converting them into the required format. The scheme of the Machine Data Model is “data.” In the gateway application, this is converted to “http” for use. Users then input the host and port of the server and the address of the Machine Data Model as the path, with the filter used as a query. Because the REST API is used, these requests can be made through a browser or various HTTP libraries. Upon receiving the request, the gateway application converts the request into the address and filter of the Machine Data Model and receives the result from TORUS, which is then returned as the response. Since the result from TORUS can be converted into JSON format, it can be returned in a web environment without any issues.
In TORUS, the Machine Data Model is used to read or modify data. To read data, the Api.getData( ) function is used, which functions similarly to the GET method in HTTP. To modify data, the Api.updateData( ) function is used, similar to the PUT method in HTTP.
TORUS also provides special functions that do not belong to the Machine Data Model. These are cases where the representation methods for each CNC are too different to create a unified data model or when the function does not belong to the machine tools’ state information. A representative example is the function for accessing part programs. Uploading, downloading, or deleting part programs from the CNC is not part of the machine tools’ status, so it is not included in the Machine Data Model. Therefore, functions like Api.getData( ) and Api.updateData( ), which use the Machine Data Model as a parameter, cannot be used for file access. To access files, TORUS API functions such as Api.UploadFile( ), Api.DownloadFile( ), and Api.CNCFileDelete( ) must be used. These functions are provided specifically for file handling, and their detailed usage can be found in the TORUS manual. The key point is that these functions do not use the Machine Data Model. Therefore, they do not have a URI, and new URIs must be created to use these functions in the gateway application.
As shown in Fig. 6, we defined a new URI that does not conflict with the existing Machine Data Model. This URI can be used to specify files, allowing users to download files with the GET method, upload files with the PUT method, and delete files with the DELETE method. When the gateway application receives a request to download a file using the GET method, it uses the file path and MachineID to call the Api.DownloadFile( ) function. The Api.DownloadFile( ) function downloads the part program from the CNC to the PC where the TORUS App is running. The downloaded file’s path is specified in the LocalPath variable shown in Fig. 6. Therefore, the gateway application first downloads the part program via TORUS and then provides the file as a response through the web server, enabling users to download the part program through a browser, just like downloading any file from the web. In the case of the PUT method, the uploaded file is uploaded to the PC where the gateway application is running through the web server, and the gateway application then uploads the file to the CNC via TORUS using the Api.UploadFile( ) function. The DELETE method does not exchange any files; instead, it issues a delete command to TORUS by calling the Api.CNCFileDelete( ) function. While there are additional file-related functions, this study focuses on demonstrating the most representative functions for creating a gateway application.
4 Implementation and ResultsAs outlined in the method section, we developed the TORUS REST API gateway application. The usage of the TORUS API was referenced from the TORUS manual. Fig. 7 shows the testing environment. A CNC simulator was used for the tests. TORUS is launched, and the connection with the CNC is confirmed. Next, the TORUS REST API gateway application is executed, and a connection to TORUS is established. Once the connection is completed, the web server is opened. Both TORUS and the gateway application run on a PC using the Windows OS, while access to the server is performed from another PC in a Linux environment. This demonstrates that communication with CNCs can occur in a cross-platform environment via the TORUS REST API gateway application.
Fig. 8 shows the use of a browser and cURL to retrieve CNC data using the REST API GET method. Fig. 9 demonstrates the transmission of a target value via the REST API PUT method using cURL and confirms that the change is successfully applied. The paths and queries used in the GET and PUT tests are part of the Machine Data Model described in the TORUS manual. TORUS provides over 200 Machine Data Models. Client developers can select the desired Machine Data Model from the TORUS manual. They can then send requests to the TORUS REST API gateway application using GET and PUT methods. If the developer has experience with REST API, they can easily obtain or modify various data by simply changing the Machine Data Model.
Fig. 10 shows the process of uploading a file to CNC memory using cURL, downloading the file, and finally deleting it. As explained in the method section, handling files does not use the Machine Data Model. Therefore, we need to provide client developers with an explanation of the new URI we created for handling files. The fact that the URI points to the file path, with GET for downloading, PUT for uploading, and DELETE for removing the file, is very intuitive and easy to understand.
Fig. 11 shows an application communicating with a CNC via TORUS without using the gateway application. Application 1 collects and displays data from a Fanuc CNC, while Application 2 collects and displays data from two heterogeneous CNCs: Fanuc and Siemens. Application developers can gather data from different CNCs using common code with the TORUS API, without needing separate code for each CNC manufacturer. Both applications were developed in C#. Applications using the TORUS API must run on the same PC as TORUS, meaning each PC where the application is installed must have TORUS installed.
Fig. 12 shows a REST API application communicating with CNCs through the REST API gateway application and TORUS. TORUS only needs to be installed on the PC where the gateway application is located. REST API Application 1 in Fig. 12 is a monitoring server developed with Next.js. By using REST API, TORUS can be indirectly utilized across various development environments.
5 ConclusionMachine tools contain a variety of complex state information, and the representation and classification of this information can vary depending on the vendor. The exclusive APIs that provide access to this state information are difficult to learn and use, especially for non-expert developers. TORUS provides unified access to heterogeneous multi-vendor machines through a unified interface, the TORUS API. However, TORUS has limitations in its operational environment. While the unified interface reduces the learning curve, it still requires specialized development knowledge and an understanding of the TORUS API. To overcome these challenges, we developed the TORUS REST API gateway application. Using the REST API allows even non-expert developers to utilize TORUS’s communication functionality with machine tools via a web browser or HTTP-related libraries. Moreover, by referencing our methodology, it is possible to develop other TORUS gateway applications that utilize different protocols or interfaces to interact with TORUS.
When using the gateway application, each vendor’s exclusive interface is first converted into the TORUS interface through TORUS, and then further converted into the gateway application’s own interface, such as a REST API. Communicating with machine tools through the TORUS gateway application adds an additional conversion step compared to directly using the TORUS API. Therefore, adding a gateway application to TORUS, rather than directly adding interfaces to TORUS itself, is not necessarily efficient in terms of speed or system resource management. For this reason, it is challenging to use for tasks requiring high-frequency time-series data collection, but it is suitable for simpler tasks where speed is not critical, such as basic monitoring of machine or work status, or modifying part programs. Additionally, using universal interfaces such as OPC UA or REST API helps reduce the development and maintenance costs of industrial software and makes it easier for researchers and developers to implement and validate their ideas in a manufacturing environment.
AcknowledgementsThis study has been conducted with the support of the Korea Institute of Industrial Technology as “Autonomous Manufacturing Technology based on DNA Platform (KITECH EH-24-0002)”.
References1. Jokanović, S., (2016). Communication with CNC machine through DNC interface. Proceedings of the 2016 International Symposium on Small-scale Intelligent Manufacturing Systems (SIMS) (pp. 19–24.
2. Kim, E., Yun, H., Araujo, O. C. & Jun, M. B. (2023). Sound recognition based on convolutional neural network for real-time cutting state monitoring of tube cutting machine. International Journal of Precision Engineering and Manufacturing-Smart Technology, 1(1), 1–18.
3. Martins, A., Lucas, J., Costelha, H. & Neves, C. (2023). CNC machines integration in smart factories using OPC UA. Journal of Industrial Information Integration, 34, 100482.
4. Park, I.-H., Yoon, J. S., Sohn, J. H. & Lee, D. Y. (2024). Platform supporting intelligent human–machine interface (HMI) applications for smart machine tools. International Journal of Precision Engineering and Manufacturing, 25(5), 1073–1086.
6. Yoon, J.-S., Kim, Y.-D., Lee, J. & Lee, D. Y. (2023). OPC UA-based machining cell monitoring system for multi-vendors’ machine tools and industrial robots. International Journal of Precision Engineering and Manufacturing-Smart Technology, 1(1), 63–69.
7. Ala-Laurinaho, R., Mattila, J., Autiosalo, J., Hietala, J., Laaki, H. & Tammi, K. (2022). Comparison of REST and GraphQL interfaces for OPC UA. Computers, 11(5), 65.
8. Edrington, B., Zhao, B., Hansel, A., Mori, M. & Fujishima, M. (2014). Machine monitoring system based on MTConnect technology. Procedia Cirp, 22, 92–97.
9. Kim, Y.-D., Moon, J.-H., Park, J.-S., Kim, E.-Y., Kim, S.-S. & Um, J. (2023). Low-cost construction of digital twins using administration asset shell in augmented reality guide service for machine tool operators. Low-Cost Digital Solutions for Industrial Automation (LoDiSA 2023) (pp. 12–18.
10. Rodríguez, C., Baez, M., Daniel, F., Casati, F., Trabucco, J. C., Canali, L. & Percannella, G. (2016). REST APIs: A large-scale analysis of compliance with principles and best practices. Proceedings of the Web Engineering (pp. 21–39.
Biography
Yeong-Deuk Kim worked as a Researcher in the Autonomous Manufacturing R&D Department, Korea Institute of Industrial Technology. He is currently the owner of a small company, deetem, which develops manufacturing-related software. His main focus is on developing software for machine tool monitoring.
Biography
Dong Yoon Lee received the Ph.D. degree in Mechanical Engineering from KAIST. He worked at Samsung Corning Precision Glass, until June 2006. He is currently a Principal Researcher with the Autonomous Manufacturing R&D Department, Korea Institute of Industrial Technology. His current research topics are in-process monitoring/control via CNC communication and sensors, virtual machining, and process optimization.
|