Abstract: This paper proposes a CAN bus-based remote diagnostic and monitoring system for DNC, combining CAN bus network with Ethernet (workshop Ethernet) and the Internet. The system architecture, functions of each part and their interrelationships are studied, and some key technologies in the implementation process of the system are discussed.
Keywords: remote diagnostics; CAN bus; ASP; Socket
0 Introduction
Distributed Numerical Control (DNC) is a method of integrating CNC machine tools in a workshop with a host computer to achieve centralized control and management of processing equipment. While this method fully utilizes the potential of the equipment and improves enterprise production efficiency, it places higher demands on equipment maintenance. Prolonged downtime of critical equipment on the production line can lead to significant production losses. To minimize these losses, it is essential to improve equipment reliability and monitor the status of processing equipment to promptly address faults and shorten diagnosis and repair times when they appear. However, given the staffing patterns of most Chinese enterprises, there are relatively few dedicated technical personnel for equipment maintenance, making it impossible to establish after-sales service centers nationwide. When equipment malfunctions, geographical limitations prevent experts from reaching the site promptly, hindering their understanding of the equipment's actual operating conditions and basic parameters. This not only complicates diagnosis but also results in substantial economic losses for users. Therefore, this paper proposes a DNC remote diagnostic and monitoring system based on the CAN bus and introduces its architecture and key technology implementation.
1. Overall System Structure
The DNC remote diagnostic and monitoring system based on CAN bus (The Controller Area Network Fieldbus) mainly consists of six parts: DSP data acquisition unit, host monitoring unit, database server, enterprise web server, enterprise fault diagnosis center and remote fault diagnosis center, as shown in Figure 1.
Figure 1 System Structure Diagram
The DSP data acquisition unit collects signals from the CNC machine tool (such as vibration signals from tool cutting, machine tool spindle bearings, and hydraulic system temperature) from the sensor array. After a series of signal processing steps (such as voltage regulation and filtering, A/D conversion), the signals are sent to the host computer (with a backup redundant host computer) via the CAN bus. The real-time online monitoring system on the host computer not only displays and stores real-time data but also communicates with the database via WinSocket control. Furthermore, the host computer can send machining programs to different CNC machine tools via the CAN bus and RS232/CAN conversion module to complete part machining, based on the equipment's machining capabilities. Microsoft SQL Server 2000 is installed on the database server. The main task of the database server application is to receive and process data from the host computer, write the received data to the raw data buffer, and then write the analyzed data to the SQL Server database. When a machine tool on the production line malfunctions, the time of the malfunction is recorded in the equipment malfunction status table. The Web server is a service site set up on the Internet. The enterprise fault diagnosis center and remote fault diagnosis center use a B/S (browser/server) model with the Web server. All monitoring, analysis and diagnostic software are placed on the Web server and managed through the Web homepage.
2. Implementation of Remote Diagnosis and Monitoring System
2.1 Real-time data acquisition
This remote diagnostic and monitoring system incorporates low-level functions in its field device-level communication program for use by the host computer, enabling communication between the DSP data acquisition unit and the host computer. The real-time data acquisition process is as follows: sensor signals undergo necessary voltage regulation and filtering before being fed into the ADC (Analog-to-Digital Converter). Depending on the system's data requirements, reference or informational signals are stored and transmitted to the host computer at appropriate times; urgent and real-time control feedback data, such as machine tool alarm signals, are promptly transmitted to the host computer for processing or control purposes. Within the system, each DSP chip independently completes its corresponding data acquisition. The calibration coefficients of the sensors can be flexibly changed by downloading data tables from the host computer, making it particularly suitable for systems with less than ideal sensor linearity. The operating status and mode of each DSP are flexibly selected by the host computer, enhancing the system's adaptability.
The data acquisition unit is based on the DSP chip TMS320LF2407A. The TMS320LF2407A's ADC module has a built-in 10-bit ADC with sample-and-hold circuitry, providing a total of 16 analog input channels for A/D conversion of the acquired signals. Frequency acquisition is performed using the capture unit of the DSP chip's event manager. Since the 2407A chip has six capture units, they are triggered when a transition occurs on the corresponding capture pin, generating a capture interrupt. The TMS320LF2407A chip's built-in data storage space is only 64K, which is insufficient for data storage capacity; therefore, memory expansion is required. Considering the data volume and preventing data loss due to power failure, a 256K×16-bit FLASH chip SST39VF400A is selected as the external extended data memory.
2.2 Communication between the host computer and the CNC machine tool
To reduce the network burden on the field equipment management layer, this system adopts a dual-layer CAN network structure between the monitoring computer and the CNC machine tool. One layer is used for monitoring the machining process and machine tool status, mainly for transmitting real-time data from the DSP acquisition unit; the other layer is used for DNC operation. The main tasks of the DNC operation sub-layer are to upload and download NC programs, edit NC programs, and read machining process information. It sends the data to different CNC machine tools through the CAN bus and RS232/CAN conversion module to complete the machining of parts.
(1) Transmission of real-time data in the data acquisition unit
The TMS320LF2407A comes with a standard CAN controller, making it easy to form a field-level device network. The CAN controller on the TMS320LF2407A fully supports the CAN 2.0B protocol, with two different data frame formats: standard frame (11-bit identifier) and extended frame (29-bit identifier). Since the DSP controller only uploads 32-bit data (including controller identifiers, etc.) in actual control, this system uses the standard frame format. During actual debugging, it was found that the amount of data transmitted from the lower-level controller to the host computer was much greater than the amount of data transmitted from the host computer to the lower-level controller. Therefore, control information, sampling data number information, control quantities, and acquisition quantities are all loaded into the data bytes during data encoding. Thus, the CAN bus communication protocol is in the form of "ID number + data + checksum," where the ID number is the number of each DSP acquisition unit, using the first 4 bits of the 11-bit identifier. To ensure communication reliability, a return frame is sent after data reception to indicate confirmation, and its checksum (occupying one byte) is a fixed code from the sending end.
In the CAN communication system software design, interrupt-driven reception is used, requiring the system to process received data immediately to improve its real-time response characteristics. The program flowchart is shown in Figure 2. The DSP uploads real-time acquired data using a timed polling method. After checking whether the ADC sampling has finished and performed the corresponding data processing, the data is immediately loaded through the CAN controller and sent to the CAN bus.
Figure 2 Flowchart of CAN Interrupt Receive Procedure
(2) CAN bus and RS232/CAN conversion module
In DNC operation, since the program transmission interface provided by the CNC machine tool is a standard RS232 serial port, there is a conversion problem between the CAN protocol and RS232. Because the CAN232B converter fully supports the CAN 2.0B protocol, and the CAN control network formed using it has advantages such as flexible networking, high data transmission reliability, high communication speed, and high bus utilization, this system uses the CAN232B converter. For the host computer (RS232 master control device), it needs to have the ability to address each CNC machine tool (multiple RS232 devices). At this time, according to the configuration protocol of the CAN232B converter, the RS232 program of the host computer is supplemented and modified, enabling the host computer to send command frames to the connected CAN232B converter to set the CAN frame format and dynamically configure the CAN frame information sent by the CAN232B. In this way, the host computer can send CAN message frames with different IDs through CAN232B to address CNC machine tools at different addresses, thereby realizing DNC operation.
2.3 Building a Web-based Database Service
To achieve remote fault diagnosis of CNC machine tools, experts at the enterprise fault diagnosis center or remote fault diagnosis center must obtain the system's fault and status information through the Internet (or Intranet), while also being able to query data in the database through the Internet (or Intranet).
ASP (Active Server Pages) is included in versions of IIS 3.0 and later. ASP itself is not a scripting language, but rather a server-side scripting environment developed by Microsoft. It simply provides an environment for scripts embedded in HTML pages to run. It is easy to use and has powerful backend support. This system operates on Windows 2000 Server, and the development system is VC++. Microsoft's ASP was chosen because it is simple to use, powerful, and has strong technical support. ASP can be combined with HTML pages, VBScript, and JavaScript. ASP directives and ActiveX components can be used to create dynamic, interactive, and efficient web server applications. Furthermore, ASP combined with ADO (ActiveX Data Objects) easily enables database access, as shown in Figure 3. When a browser sends an HTTP request, the web server responds by calling the ASP engine to interpret the requested ASP file. If an ActiveX control is encountered, the corresponding ActiveX control is launched. Using ADO and SQL, the database is accessed, and the results are used to generate corresponding HTML syntax components. These, along with the original text and HTML tags in the file, form a standard HTML page and are returned to the client browser.
Figure 3. Schematic diagram of database access based on ASP
2.4 Communication between the monitoring machine and the enterprise database server
Real-time data communication between the database and the monitoring machine of the enterprise monitoring and diagnostic center (or remote diagnostic center) adopts the Windows Sockets communication mechanism. Socket communication is a special type of I/O. A socket is essentially a communication port provided on a TCP/IP network, allowing user-developed applications to communicate with other applications over the network. Sockets provide a complete set of primitives for users to programmatically call and access system resources, and can be used to develop network-related applications with real-time requirements. Two main types of sockets are used in application software development:
1. Stream sockets. They define a reliable, connection-oriented service that enables error-free, non-duplicated sequential data transmission. Suitable for handling large amounts of data, stream sockets use the TCP protocol, which is connection-based; a connection must be established before communication can occur. Protocols such as HTTP, FTP, and Telnet all use stream sockets.
2. Datagram sockets. This defines a connectionless service where data is transmitted via independent, out-of-order packets, and reliability and error-free transmission are not guaranteed. While datagram sockets also use IP, they do not use TCP; instead, they use UDP (User Datagram Protocol).
Unlike stream sockets, which maintain an open connection, UDP allows users to simply package data into a packet, append the remote IP address, and then send the packet. For example, TFTP (Trivial File Transfer Protocol) uses UDP.
To ensure reliable data transmission, the system employs stream sockets based on reliable connections, using the TCP/IP protocol. Since Windows Server 2000 is a multitasking operating system, different tasks correspond to different processes. For normal data transmission, the port number must be used to clearly identify which process the monitoring machine is connected to in the database. The available port numbers for each monitoring machine are in the range of 1024 to 4999; this system uses port 3000. Furthermore, since more than one monitoring machine can be connected to the database simultaneously, to prevent conflicts in data communication between processes, the database application should first create a listening socket to receive connection requests from the monitoring machines. Once the database accepts a connection request, it returns a descriptor for a new socket, which will be used to handle new connections. The original socket will continue to listen for new connection requests. The flowchart of the entire data communication process is shown in Figure 4.
Figure 4. Flowchart of real-time data communication between the database server and the monitoring machine
3. Conclusion
Remote fault diagnosis technology based on real-time data acquisition, CAN bus, database services, and the Internet solves the problem of real-time monitoring and fault diagnosis of key components of DNC CNC machine tools. The four-level system architecture proposed in this paper—field device level, workshop monitoring level, enterprise monitoring level, and remote monitoring level—will help improve the feasibility and accuracy of remote fault diagnosis, ultimately achieving the goal of improving enterprise efficiency. With the deepening of network communication technology and the application of field device automation, and the gradual emergence of mature and usable expert systems, remote fault diagnosis will inevitably become a major diagnostic service method for enterprises in the future.
The innovative points of this paper are: proposing a DNC remote diagnostic and monitoring system based on CAN bus; proposing a real-time data acquisition system composed of DSP and multiple sensors; combining CAN bus network with Ethernet and Internet to realize a four-level system structure of field equipment level, workshop monitoring level, enterprise monitoring level and remote monitoring level; and exploring Web-based database service technology.
References:
[1] Zhou Lin. Application of DSP Control Engineering Technology. National Defense Industry Press.
[2] Wang Jin'e, Sun Qinghong. Remote diagnostic and service system for CNC machine tools based on CAN bus [J]. Manufacturing Automation, 2003 (3).
[3] Song Baohua, Xu Xiaoli, Sun Zhiyong. Implementation of a prototype system for remote monitoring of electromechanical equipment based on network environment [J]. Manufacturing Automation, 2005(12).
[4] Zhao Yongsheng, Wang Guofeng, Dong Xiaoyong. Distributed monitoring and management system for bearing testing center [J]. Microcomputer Information, 2003(5), pp10-11.