Development of Client-Server Application by Using UDP Socket Programming for Remotely Monitoring CNC Machine Environment in Fixture Process

The use of computer technology in manufacturing industries can improve manufacturing flexibility significantly, especially in manufacturing processes; many software applications have been utilized to improve machining performance. However, none of them has discussed the abilities to perform direct machining. In this paper, an integrated system for remote operation and monitoring of Computer Numerical Control (CNC) machines is put into consideration. The integrated system includes computerization, network technology, and improved holding mechanism. The work proposed by this research is mainly on the software development for such integrated system. It uses Java three-dimensional (3D) programming and Virtual Reality Modeling Language (VRML) at the client side for visualization of machining environment. This research is aimed at developing a control system to remotely operate and monitor a self-reconfiguration fixture mechanism of a CNC milling machine through internet connection and integration of Personal Computer (PC)-based CNC controller, a server side, a client side and CNC milling. The performance of the developed system was evaluated by testing with one type of common protocols particularly User Datagram Protocol (UDP). Using UDP, the developed system requires 3.9 seconds to complete the close clamping, less than 1 second to release the clamping and it can deliver 463 KiloByte.


I. IntroductIon
The current trend in manufacturing tends to produce a large variety of products with small batch sizes.This condition requires an effective usage of manufacturing facilities.Sharing and distributing manufacturing tools through a remote operation is a way to optimize the usage of manufacturing facilities [1].Remote operation that performs an automatic setup for a variety of work-pieces is an alternative solution.Remote operation of manufacturing facilities can reduce the timeprocess and minimize human operator involvement in machining processes.The shop floor does not need to be attended continuously; beside, human operators can operate and monitor the facilities from proximity place.Therefore, applying remote operation in modern manufacturing processes can possibly decrease machining cost.
Remote operation for many new Computer Numerical

II. computer technology In manufacturIng SyStem
Combining computer and networking technologies in manufacturing system allows the share and distribution of manufacturing information to be accessed by clients anywhere in the world.These technologies have also been widely employed in manufacturing systems to associate various product development activities, such as marketing, design, process planning, production, customer services, etc., which are distributed across distinct locations into an integrated environment.The integration and cooperation among different producers through internet technologies can improve the product quality and reduce cost and leadtime of production processes [2].
Computer technology is attended through multimedia, computer network, distributed computing or cloud computing.Computer language programming includes Java, C++ and C#, script language, such as Perl and VBScript, Web mark-up language, such as Hypertext Markup Language (HTML), Dynamic HTML (DHTML) and Extensible Markup Language (XML).Web-based client-server programming tools include Active Server Pages (ASP) and Java Servlet, distributed object modeling methods such as Distributed Component Object Model (DCOM), Remote Method Invocation (RMI) and Common Object Request Broker Architecture (CORBA) have been used to develop internet-based manufacturing systems [2].

III. clIent-Server applIcatIon
Most of the presently-developed internet-based manufacturing systems are still prototype stage.They are used merely for studying the feasibility and potential of internet technologies in advanced manufacturing.Therefore, the next-generation of internet-based applications shall be developed to solve many problems in manufacturing systems, such as delay in communication [2].
In general, the architectures for most of the internetbased manufacturing system are frequently developed by using client-server communication method [3].The server and the client side distribute and share modules and databases.The client programs are usually downloaded automatically from the server sideto the local computers through internet-based applications.There are two classifications of client-server applications; they are the major computation which is conducted at the client side and those with computation in the server side.The client-server communication method that is used in an internet-based manufacturing system allows different users at different locations to have their designs manufactured at remote locations by making use of manufacturing equipment, such as CNC centers, robots, and rapid prototyping machines.Remote operation system is referred to a system that has an appropriate methodology with open architecture for real-time monitoring and remote control of networked machines.Within the context, the system presents a new enabling technology that can bring traditional machine tools on-line by combining monitoring and control capability [4].

Iv. development of vIrtual machIne envIronment at the clIent SIde
Virtual machine environment as shown in Fig. 1 is a system environment at a client side that allows a user to operate and monitor a machining process.In the environment, the operation of CNC milling connected to a PC-based CNC controller is performed by using the client side with Remote Desktop Protocol.The client side run with a Java program is also connected to a server side which is utilized by a Data Acquisition System, which is based on LABVIEW.LABVIEW is programmed to transmit and receive formatted string data from machine tool before the data are sent to the client side by using Transmission Control Protocol (TCP) or User Datagram Protocol (UDP) connection.The formatted string data consist of information of cutting tool, state of clamping and the type of cutting tool used.During the process, the server also handles and evaluates every request from the client for running the machining process, while the client side allows users to control and monitor the machine environment through 3D virtual simulation developed by using Java 3D program.

v. conStructIon of Java program by uSIng UDP programmIng
The Java language supports UDP network programming in two main classes: Java.net.Datagrampacket and Java.net.DatagramSocket.Unlike the stream of (TCP) sockets, no differentiation exists between the server and client datagram (UDP) sockets.Every datagram socket can be used both for sending and receiving datagrams.The reason for the difference is that the stream sockets are associated with a single stream, while the datagram sockets do not support a streaming abstraction and can be used to send and receive to and from multiple destinations.
In place of the Java.iostream classes, Java datagram sockets use the instances of the DatagramPacket class.
The instances are used similarly to the standard mail envelopes containing a destination and source address as well as a message in a certain maximum size (in principle 65508 bytes and in practice 508 bytes).In addition, DatagramPacket instances may only be used by the DatagramSocket instances, with TCP Java.net.socketinstances.
UDP is popular with a simple protocol in sending and receiving data.In constructing the Java program at the client side using UDP programming, the simplest constructor creates a DatagramPacket instance that uses the byte array argument as a buffer, and the integer argument as the maximum buffer length.

DatagramPacket(byte[] buf, int length, inetAddress address, int port) DatagramPacket(byte[] buf, int offset, int length, InetAddress address, int port)
InetAddressgetAddress () and IntgetPort () are the methods which are typically invoked on received datagrams in order to determine where the reply should be sent.Byte[] getData(), Intgetoffset(), and IntgetLength() are the methods provided to access the DatagramPacket payload.
In addition, Figure 2 shows a simple program at the client by using UDP protocol that has been constructed by Java UDP programming to establish communication between the client and the server.In the determined iteration, the UDP Write function will write data to a specific host.A simple procedure of data delivery using UDP will result in an increment in the amount of the data that are delivered in a specific time.On the other hand, there is no control and guarantee that the data will be received by a destination host.For the receiving procedure as shown in Figure 4, the simple server application is created by using UDP Open and UDP Read function [6].The UDP Read function is located in a continue loop to wait for every data that come to the server.
In this research, a complete LABVIEW block diagram that contains the functions for handling clamping process and detecting cutting tool movement has been developed with UDP protocol.

vII. the Internet-baSed SyStem of CNC mIllIng machIne
Client-server system has been developed with the structure as shown in Figure 5.The system composes of a PC base controller, a server and a client.The remote operation of the CNC milling machine at the client side has been constructed by using the Java 3D application to control and monitor a CNC milling via Internet connection.In addition, the virtual model exhibited on the client site is supplied from the server.
The Remote Desktop Protocol (RDP) and the PC-based CNC controller have been utilized for remote operation of the CNC milling machine.The remote desktop system is used to operate the CNC control panel and the actual process has been monitored by the server side.PC based CNC controller has been customized to run some functions which are not available in a conventional CNC machine For example, it can run executable files which inserted in G-codes.
A database server with SQL query codes and the created LABVIEW programming code are provided to handle any request from the client side.The database is used to extract the CAD models, which will be shown while collecting data at machining setup.The server also acts as an interface for driving pin type fixture and detecting the position of the cutting tool.The data for pin configuration and position of cutting tool are transferred to the client for visualization of the shop floor.Table 1 shows sample data transferred from the server to the client.
The user at the client side is allowed to send certain control commands to the server.The commands are for clamping process, invoking position of cutting tool and requested work-piece name and orientation.The more complete description is shown in Table 2.

vIII. communIcatIon SyStem
To remotely operate the clamping process, programming codes based on Java programming at the client side and LABVIEW graphical programming at the server side have been created as shown in the text box in Figure 6.The codes also involve TCP and UDP socket to facilitate for the sending and receiving data from the server to client.TCP is a transport layer protocol that builds a reliable end-to-end channel over an unreliable connectionless protocol.Meanwhile, UDP is a command protocol that provides applications with a connectionless, best-effort datagram transport service.The performance of both types is compared in the subsequence sections.

A. Development of Communication System By Using UDP
The software application for remote operation has been developed by using UDP socket programming.Un-controlling and un-checking the error of data that are exchanged between the client and server is one method when establishing communication by using UDP protocol.The characteristic at UDP does not guarantee that data will be received on another side.This characteristic makes the translating process faster.For simulation purpose, losing several data is allowed and it will not effect to visualization.
Performances of this remote system when using UDP protocol is clearly explained at the experiment results Tables 3. In our testing, when the client sends a "-CLOSECLAMP:" command to the server, the system requires 3.9 seconds (in average) to complete a clamping process.Less than a second is needed to complete an "-OPENCLAMP:" command.
By using UDP protocol, the client and the server can increase the amount of data during the monitoring process, as it is indicated in Table 4.The required time for the clamping process is also reduced.The increase of total data transferred while this system is run by using UDP protocol.This is due that there is no mechanism to establish communication between the server and client and to check data errors.The amount of data exchange from the server to the client influences the smoothness of machine tool movement in the scene graph.The smoothness effect only can be shown during a user runs the application.

IX. concluSIon
The development of a software application for remote operation of CNC milling machine has been presented in this paper.The client-server architecture for internetbased operation of a CNC milling machine has been developed to operate the fixture process by remote operation.The UDP protocols have been applied in the client-server architecture for sending and receiving data.On the other hand, for UDP protocol, the average time taken for completely close the clamp is 3.9 seconds and to completely open the clamp is less than one second.The time taken is less because data delivered are not controlled by the protocol and the protocol does not guarantee that the data will be received by the destination.In monitoring of the cutting tool movement, the TCP protocol is managed to send 463 KB of data from the server to the client within 6 minutes.The amount of data that have been sent will affect the smoothness of the tool movement in 3D canvas.acknowledgment This work was supported in part by a grant from faculty of enginerering, Andalas University.

Fig. 1 .
Fig. 1.The virtual machine environment vI. conStructIng labvIew block dIagram by uSIng udp programmIng LABVIEW graphical programming allows a user to create applications by sending datagram packets.Figure 3 shows a simple application to send datagram packets by creating UDP Open and UDP Write functions [6].The destination or remote port, and data will be connected to the UDP Write functions as well as the source or the local port will be connected to the UDP Open function.The procedure of delivering data is started when the UDP Open functions open a connection in a specific port before the remote port and the remote host should be determined.

Fig. 5 .
Fig. 5.The proposed system for remote operation CNC milling machine

Command to clamp and release work-piece 2 -
UPDATE_WORKPIECE: Command to get a new workpiece and orientation 3 -UPDATE_POSITION: Command to get current position of cutting tool Darmawan and Pharmayeni: Development of Client-Server Application by Using UDP Socket Programming for Remotely Monitoring Cnc Machine Environment in Fixture Process

Fig. 6 .
Fig. 6.Clamping Process by remote operation CNC) machines is possible to be constructed by using common information, computer technology and particular equipment.The internet allows a CNC machine to be remotely operated and monitored.This capability may increase productivity and profitability as it can minimize machine idle time, setup and training ISSN. 1412-4785; e-ISSN.2252-620X DOI: 10.17529/jre.v12i2.2925Control (

Table 1 .
Transferred data from the server to the client for a virtual of machine environment

Table 2 .
Transferred data from the client to the server

Table 4 .
Speed meter running on the client side using UDP protocol

Table 3 .
The result of time delay by using UDP protocol The result of