MES (Manufacturing Execution System) plays a middle-layer role in integrated factory automation systems. Guided by long-term plans generated by MRP II and ERP systems, MES optimizes short-term production operations, including planning, scheduling, monitoring, resource allocation, and production processes, based on real-time production-related data collected from the underlying control systems. So, what technologies and modules does MES rely on to achieve this goal? In particular, how does it collaborate with ERP and control systems? As a computer-aided production management system, a key mission of MES is to realize continuous information flow within the enterprise. It comprises many functional modules. Through practice, MESA (Mechanical Engineering and Automation Society) has summarized eleven main MES functional modules, including detailed process scheduling, resource allocation and status management, production unit allocation, process management, human resource management, maintenance management, quality management, document control, product tracking and inventory management, performance analysis, and data acquisition. There is still some debate within the industry regarding this summary. In its report "NIST Response to MES Request for Information" submitted to the OMG (Object Management Group), NIST (National Institute of Standards and Technology) argued that in the MESA (Manufacturing Execution System) framework, process management should not be a standalone functional module, but rather a materials management module should be added. We also believe that MES should have materials management capabilities. Working Together to Optimize Data Flow Through the effective collaboration of these modules, MES plays a middle-layer role in the integrated factory automation system. Below MES are the underlying production control systems, including DCS, PLC, NC/CNC, and SCADA, or combinations thereof; above MES are the high-level management planning systems, including ERP and MRP II. From a time factor perspective, the planning system above MES considers medium- to long-term production planning (time factor = 100), the execution layer MES handles the coordination and arrangement of short-term production tasks (time factor = 10), and the control layer system must receive production instructions in real time to ensure the normal operation of equipment (time factor = 1). They are interconnected and complementary, enabling continuous information flow within the enterprise. From a hierarchical perspective, the control structure of a manufacturing enterprise can be divided into the factory level (or company level), workshop level, unit level, and equipment level. The unit level corresponds to a work section or team in a typical enterprise. Typically, the ERP system resides at the factory and workshop levels, sometimes extending to the unit level. The equipment control system resides at the equipment level, sometimes extending to the unit level. MES, however, always resides at the workshop and unit levels. Therefore, MES and ERP have some functional overlap at the workshop level (and sometimes the unit level), and MES and the equipment control system sometimes have some functional overlap at the unit level, as shown in Figure 1. [align=center] Figure 1: Planning, Control, and Information Feedback Flow and the Relationship between MES, ERP, and Equipment Control Systems[/align] Guided by the long-term plans generated by MRP II and ERP systems, MES performs short-term production scheduling, monitoring, resource allocation, and production process optimization based on real-time production-related data collected from the underlying control system. Figure 2 illustrates the data flow diagram of MES within the enterprise. [align=center]Figure 2 Data Flow Diagram of MES in an Enterprise[/align] This diagram illustrates the control and information feedback process, as well as the relationship between MES, ERP, and equipment control systems. In Figure 1, planning and control instructions become increasingly detailed and specific from top to bottom, while real-time data collected by data acquisition systems distributed throughout the production site is aggregated layer by layer from bottom to top, resulting in increasingly comprehensive data. Regarding the specific content of information interaction, MES submits data related to production operations to the upper layers, such as the number of periodic inventory checks, production capacity, material consumption, labor force and production line operating performance, the location and status of work-in-process (WIP), and actual order execution; it also issues production control instructions and various parameters related to production line operation to the lower-level control systems. Figure 3 illustrates the information interaction relationship between MES and the planning and control layers. [align=center]Figure 3 Information Interaction between MES and the Planning and Control Layers[/align] Complementary Advantages of ERP ERP's Shortcomings While ERP can effectively solve production planning problems, its control at the shop floor level is often inadequate. For example, the planning function of the shop floor control module in ERP is generally weak, mainly focusing on executing MRP plans. It transforms MRP plans into workshop work orders and scheduling orders, executes them according to these orders, provides feedback on plan execution, and controls input and output. In ERP systems, workshop work orders and scheduling orders often have long time spans (or planning periods), typically weeks. Equipment resources in these orders are defined by work centers, but the definition of a work center is often not strictly defined and depends entirely on the system's implementation requirements and control granularity. Typically, a work center in ERP is defined as a group of equipment resources, and all information feedback and cost accounting are performed at the work center level. ERP typically relies on manual entry when collecting information from key work processes, which is inefficient, error-prone, and the input data is often from the previous shift or day, resulting in information lag. The advantages of MES: MES's planning and scheduling functions are somewhat similar to those of ERP's workshop level, but MES's planning and scheduling functions are more powerful, and the plans are more detailed. MES generally develops work plans at the workshop and unit levels, assigning tasks to each piece of equipment or operator in the workshop. Similar to ERP, the workshop work order in MES is a further breakdown of the workshop work order within time and space, typically detailed to the daily (or shift) production tasks for each unit and each piece of equipment within the planning period. Simultaneously, production tasks for the next day or shift are assigned to each operator (or piece of equipment) in the form of work orders. The data fed back by the MES system includes not only data for each piece of equipment, each process, and each operator, but also status data during the processing. Furthermore, due to the use of automated data acquisition technology, status data can be collected in real time. The collected data is aggregated layer by layer to obtain the overall production site data for the entire factory. Integrating MES with ERP not only fully leverages their respective advantages but also makes the MES system's production planning more rational, and the ERP system's data more timely and effective, resulting in higher work efficiency. The integration data between MES and ERP is related to the interface division between them. Generally, either MES can handle all workshop and unit level functions, or ERP can handle the workshop level functions, and MES can handle the unit level functions. However, from a system integration perspective, it is easier for MES to undertake all the functions of the workshop and unit levels. MES's unique technologies : Many of the technical fields involved in MES are similar to those used in MRP II and ERP. Here, we will only explain the more distinctive technologies in MES. Real-time operation status acquisition technology: This technology collects the machine tool's start/stop and processing operation status in real time, providing timely and accurate information support for planning control and dynamic scheduling, enabling true real-time workshop management and control. The technical solution for real-time acquisition of machine tool start/stop and processing operation status will be determined based on the specific machine tool equipment. For machine tools that can directly access the internet and support OPC, an OPC-based status information acquisition scheme is adopted. Various status information of the machine tool can be directly read through a standard OPC interface and necessary software configuration. For CNC equipment that does not support OPC, the acquisition of start/stop and operation status information requires measuring the analog signals and their changes at relevant points in the control panel and machine tool electrical control circuit of the CNC equipment, performing appropriate conversions, and then utilizing the I/O interface on the DNC interface. The workshop controller can display the distribution and operating status of CNC equipment in each unit within the workshop based on the configuration of each unit and the recorded status information. It can also statistically analyze equipment operating time, downtime, and equipment utilization. NC Program Transmission Technology Bidirectional transmission of NC programs to different CNC machine tools is of great significance to MES systems in the machinery manufacturing industry. In MES systems, bidirectional NC program transmission primarily addresses the transmission problem of NC programs from CNC systems with different transmission protocols. Typically, bidirectional NC program transmission uses point-to-point communication based on RS-232C. This connection method is simple in structure, reliable in transmission, has a star topology, a simple communication protocol, and a communication rate generally between 110-9600 bit/s. It is technically mature, and the system composition is relatively simple and easy to implement, making it a widely used and economical solution. However, although the RS-232C standard has a large transmission level swing and improved anti-interference capability, its transmission distance is limited due to the allowance for capacitive loads. When the communication distance between the host computer and the CNC machine tool exceeds 30 meters (baud rate 4800bps), direct communication using RS-232C is not possible. There are various methods to extend the communication distance, such as using a modem, serial server, RS-485/RS-422 converter, or long-distance transceiver. Different CNC systems use different handshake signals with PCs, typically in hardware or software forms. For example, FANUC CNC systems usually use software handshake, while Siemens CNC systems use hardware handshake. Hardware handshake signals include DTR, DSR, RTS, and CTS. CNC system communication protocols generally fall into two main categories: XON/XOFF protocols and ARQ protocols with automatic repeat request. Different communication control methods are required for different handshake signals and communication protocols. The establishment of a maintenance knowledge base and maintenance guidance technology are also key technologies in MES (Manufacturing Execution System). These technologies can assist in fault diagnosis, with the fault diagnosis module focusing more on the analysis and judgment of structured problems. Based on the statistical and categorized analysis of faults, the relationship between fault phenomena and causes is established, and fault diagnosis is supported through a decision tree approach. Considering that the establishment and improvement of a maintenance knowledge base is a gradual process, a CNC machine tool maintenance management information system with self-learning capabilities is considered. Successful maintenance cases are recorded in the system, which can extract relevant information to expand the decision tree and achieve knowledge accumulation. The system organizes the replacement process of machine tool spare parts around the theme of parts, and saves complex operations with high requirements for disassembly/assembly as image data for future machine tool maintenance or maintenance operation training reference. Glossary: ARQ: Automatic Repeat reQuest; CNC: Computer Numerical Control; CTS: Clear To Send; DCS: Distributed Control System; DSR: Data Set Ready; DTR: Data Terminal Ready; MESA: MES Association; MRP: Material Requirement Planning; MRP II: Manufacturing Resources Planning; NC: Numerical Control; NIST: National Institute of Standards & Technology; OLE: Object Link and Embed; OMG: Object Management Group; OPC: OLE for Process Control; PLC: Programmable Logic Controllers; RS-232C: EIA RS-232C, a serial interface standard issued by the Electronic Industries Association (EIA) in 1969. RS is an abbreviation for Recommended Standard; 232 is the identification number; and C indicates the number of times the standard has been modified. RTS: Request To Send; SCADA: Supervisory Control and Data Acquisition; WIP: Work in Process; Xon/Xoff: one of two flow control methods, where X represents Transmission, Xoff means stop sending, and Xon means continue sending. Introduction to Some MES Modules Resource Allocation and Status Management: This module manages machine tools, tools, personnel, materials, other equipment, and other production entities (such as process documents and CNC machining programs required for processing) to ensure normal production. It also provides historical records of resource usage, ensuring correct equipment installation and operation, and providing real-time resource status information. The management of these resources also includes the reservation and scheduling to meet production plan requirements. Detailed Operations Scheduling: In production planning, this module provides the ability to sequence tasks based on priorities, attributes, characteristics, and recipes (optional) associated with specified production units. Its goal is to minimize setup time through efficient task ordering. This scheduling is based on limited capacity and accurately calculates equipment loading/unloading and settling times by considering staggered, overlapping, and parallel operations in production. Dispatching Production Units: This module manages workflows between production units in the form of jobs, orders, batches, lot sizes, and work orders. When events occur on the shop floor, it provides sequential scheduling information and performs relevant real-time actions accordingly. The production unit dispatching module can adjust the established production schedule on the shop floor, handle rework and scrap, and control the quantity of work-in-process at any location using buffer management methods. Document Control: This module controls, manages, and transmits information documents related to the production unit, including work instructions, recipes, engineering drawings, standard process specifications, CNC machining programs for parts, batch processing records, engineering change notices, and communication records between various conversion operations. It also provides information editing functions. The document control module issues various instructions to the operational level, including providing operational data to operators or production recipes to the equipment control level. Furthermore, it includes the control and integrity maintenance of other important data (such as data related to environmental, health, and safety regulations, and ISO information). Historical data storage is also included. Data Collection/Acquisition: This function acquires and updates various data and parameters related to production management functions through a data acquisition interface, including product tracking, maintaining product history records, and other parameters. This field data can be entered manually on the shop floor or acquired automatically. The data acquisition time interval varies greatly, sometimes reaching minute-level accuracy. Process Management: This module monitors the production process, automatically corrects errors in production, and provides decision support to users to improve production efficiency. These activities likely target lower-level operations, primarily focusing on monitored and controlled machines, requiring continuous tracking of the production process. The process management module should also include alarm functions to enable shop floor personnel to promptly detect processing steps exceeding permissible tolerances. Through a data acquisition interface, process management facilitates data exchange between intelligent devices and the Manufacturing Execution System (MES).