{'fraction_non_alphanumeric': 0.02509188577890868, 'fraction_numerical': 0.005248091603053435, 'mean_word_length': 5.380989965046792, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
ASPIE: A Framework for Active Sensing and Processing of Complex Events in the Internet of Manufacturing Things

: Rapid perception and processing of critical monitoring events are essential to ensure healthy operation of Internet of Manufacturing Things (IoMT)-based manufacturing processes. In this paper, we proposed a framework (active sensing and processing architecture (ASPIE)) for active sensing and processing of critical events in IoMT-based manufacturing based on the characteristics of IoMT architecture as well as its perception model. A relation model of complex events in manufacturing processes, together with related operators and uniﬁed XML-based semantic deﬁnitions, are developed to effectively process the complex event big data. A template based processing method for complex events is further introduced to conduct complex event matching using the Apriori frequent item mining algorithm. To evaluate the proposed models and methods, we developed a software platform based on ASPIE for a local chili sauce manufacturing company, which demonstrated the feasibility and effectiveness of the proposed methods for active perception and processing of complex events in IoMT-based manufacturing.


Introduction
With the interpenetration of information technology and manufacturing, the integration of manufacturing physical systems and information systems has been increasingly enhanced [1]. The IoMT technology with embedded systems, RFID, and wireless sensor networks at its core, has come into shape as a ubiquitously-perceptual, heterogeneously-integrated, self-adaptive, interoperable, and intelligent manufacturing and information service model. The application of Internet of Things (IoT) technology in the manufacturing industry provides the technical basis for interconnection, real-time position tracking, intelligent control, and so on in the manufacturing process [2]. It also promotes the fusion of manufacturing physical systems and information systems, and can achieve dynamic perception and optimized processing of resources and information production. IoT has been utilized in decision-making in manufacturing to contribute to knowledge-based intelligent manufacturing [3,4].
With the development of more intelligent manufacturing processes, an increasing number of studies have been conducted to explore techniques for manufacturing information perception. Since 2003, the emergence of RFID and other IoT technologies have brought an intelligent revolution in manufacturing [5], which has helped to achieve automated data collection [6], assurance of data Hu et al. [16] showed that event construction, state prediction, and disturbance detection suitable for big-data environments of modern complex manufacturing systems are critical for RFID-enabled intelligent manufacturing. It is also noted that the greatest challenge is to design efficient and intelligent schemes for manufacturing event processing. Allen et al. [27] proposed an anomaly detection approach for event-based systems that consist of processes that interact through shared resources. A resource-based Petri net formalism is introduced to model these types of systems. Their model generation uses an algorithm based on workflow mining to generate resource-based models. Dias [28] studied how to use timed event graphs to simulate synchronizing operations on productive systems. Complex event processing in IoMTs can also exploit the emerging big data technologies and platforms, such as Apache Spark [29], real-time stream processing platforms [30,31], etc., [32][33][34].
The complex events in IoT-based manufacturing processes can be regarded as flows of information from multiple sources, for which Cugola and Margara [35] conducted a comprehensive review considering issues from data streams to complex event processing. Fang et al. [36] introduced an information processing mechanism based on a critical event model to organize real-time field data in various abstract levels for enterprise decisions. Their case study at an air conditioner manufacturing company showed its effectiveness. Fault diagnosis of discrete event systems has also been analyzed by Zaytoon et al. [37]. Event-based models have also been used for modeling distributed sensor networks in battery manufacturing [38]. Due to the ubiquity of RFID-based manufacturing plants, new computing methods are needed for rapid processing of the big event data from hundreds or thousands of sensors. Dagkaris et al. [39] proposed and shared ManPy, an open-source software tool for building discrete event simulation models of manufacturing systems. Nie et al. [40] adopted an event handling engine (PUCEP) to improve uncertain complex event matching efficiency by combining the data stream processing engine (SASE) with data generation management and the probability flow theory. The purpose is to link the Internet of Things to data collection and improve the accuracy and reliability of complex events matching. Li et al. [41] suggested a spatiotemporal event model for the complex event processing of farmland IOT, and used the complex event relation operator to judge the spatial-temporal relationship between sub-event and complex event. They also designed and implemented a real-time complex event processing engine, to determine complex events through real-time matching of atomic events and complex event patterns. However, current complex event processing for manufacturing processes lacks a standard model and mechanisms for semantic expression of complex association relations among events. It becomes an urgent need to improve complex event matching processing with strong association rules.
To achieve active sensing and processing of key events in manufacturing processes, this paper proposes an active sensing and processing architecture (ASPIE) for processing manufacturing process events. First, an active sensing method is developed for obtaining key events in manufacturing processes. To address the issue of event expression and processing, an XML-based extensible and easy-to-parse event description language with related event operators is designed to realize the unified description of complex semantic relations. We also proposed a sophisticated event matching scheme to conduct complex event processing based on correlation templates. To evaluate our active sensing and processing architecture and methods, we implemented an ASPIE module embedded in the manufacturing resources management system at a large factory famous for chili sauce production, aiming to support intelligent decisions and optimization of their manufacturing system. The framework and methods for handling the perception and processing of key events in manufacturing processes may provide theoretical and practical guidance for developing enterprise production management decision-making systems.
The remaining paper is organized as follows: In Section 2, an architecture for active sensing and processing of key events in IoMT is introduced. In Section 3, we proposed the methodology for active sensing of key events in manufacturing processes including system design, data processing and packaging, complex events association mining and matching, and transmission and access of the data obtained via active sensing. Section 4 describes how to describe and process the manufacturing Sustainability 2018, 10, 692 4 of 21 events in a standardized way using an improved XML language and template matching. In Section 5, we described our implementation and evaluation of the proposed architecture, models and methods for active sensing and processing of key events at a chili oil sauce manufacturing company. In Section 6, the concluding remarks are presented, and the contributions of this paper and directions for future research are discussed.

Architecture of the Internet of Manufacturing Things
The Internet of Manufacturing Things is an open network system that integrates advanced manufacturing, Internet of Things, information, and modern management. It serves all stages of the product manufacturing and service process and the whole manufacturing cycle. Based on the characteristics of manufacturing technology and the expectation of the objectives, we proposed a framework of hierarchical manufacturing object networking with frame supporting function ( Figure 1). the concluding remarks are presented, and the contributions of this paper and directions for future research are discussed.

Architecture of the Internet of Manufacturing Things
The Internet of Manufacturing Things is an open network system that integrates advanced manufacturing, Internet of Things, information, and modern management. It serves all stages of the product manufacturing and service process and the whole manufacturing cycle. Based on the characteristics of manufacturing technology and the expectation of the objectives, we proposed a framework of hierarchical manufacturing object networking with frame supporting function ( Figure 1).  The whole architecture includes the perception execution layer, the transport layer, and the application layer according to the application pattern and development trend of the Internet of Things in manufacturing. The sensing layer executes the perception of the manufacturing process resources, environmental information, and decisions after receiving feedback. The transport layer mainly implements data access and network transmission, provides a real-time transmission service for the production scene examination data, and issues the management level monitoring instructions. The data transmission layer defines the network identification and communication protocol so that The whole architecture includes the perception execution layer, the transport layer, and the application layer according to the application pattern and development trend of the Internet of Things in manufacturing. The sensing layer executes the perception of the manufacturing process resources, environmental information, and decisions after receiving feedback. The transport layer mainly implements data access and network transmission, provides a real-time transmission service for the production scene examination data, and issues the management level monitoring instructions. The data transmission layer defines the network identification and communication protocol so that Sustainability 2018, 10, 692 5 of 21 the heterogeneous network data can be recognized and merged with each other to gain access to the heterogeneous network. The application layer provides support for decision-making application services with the information processing tools.

Active Process Perception Model for Manufacturing Processes
Active sensing of IoMT events in the manufacturing processes involves five stages: (1) multi-source heterogeneous manufacturing data acquisition and transmission; (2) data isomorphism, standardized processing, a unified description of the production process events; (3) multi-level event association modeling, and multi-level event relationship analysis; (4) multi-level event correlation and operation of the match operations, obtaining the perceived results of key events; and (5) push and access of perceived results [42].
An active sensing model of the manufacturing process event is designed as shown in Figure 2, for the active sensing stage of the manufacturing event.
Sustainability 2018, 10, x FOR PEER REVIEW 5 of 21 the heterogeneous network data can be recognized and merged with each other to gain access to the heterogeneous network. The application layer provides support for decision-making application services with the information processing tools.

Active Process Perception Model for Manufacturing Processes
Active sensing of IoMT events in the manufacturing processes involves five stages: (1) multisource heterogeneous manufacturing data acquisition and transmission; (2) data isomorphism, standardized processing, a unified description of the production process events; (3) multi-level event association modeling, and multi-level event relationship analysis; (4) multi-level event correlation and operation of the match operations, obtaining the perceived results of key events; and (5) push and access of perceived results [42].
An active sensing model of the manufacturing process event is designed as shown in Figure 2, for the active sensing stage of the manufacturing event.  Figure 2. The active sensing model of IoMT events. It is composed of data collection, data transmission, and data processing units.

Architecture of Active Sensing for Complex Events in IoMT
In this paper, we propose the following active sensing architecture for manufacturing events (Figure 3), which includes data acquisition, data transmission, data characterization, data integration, data application, and data service [43].
The sensing layer ( Figure 3) is a highly-reliable manufacturing data-aware environment. The main task i : (1) to build a sensing environment for data acquisition and transmission, to establish a sensor network configuration model for measuring different parameters, and to determine the target of the sensor network function and constraints; (2) to establish sensor information registration/information processing library and data description, to describe and define manufacturing resource information with various sensors; and (3) the perception and transmission of real-time data of manufacturing resources, which is manifested when the manufacturing resources reach the sensing area. At that time, the data is automatically collected or identified by the equipments that are aware of manufacturing resource information. Then, the event is perceived by the sensor in real-time. Through the network communication protocol, the sensor device will be able to collect data of the manufacturing resources. The data acquisition layer is used to collect the multisource manufacturing data and manage the heterogeneous sensor. The data transmission layer is employed to integrate the heterogeneous networks and provide the interoperability to meet the very large volume of real-time sensing data transmission needs. As the heterogeneous network in the manufacturing of things uses different protocols, the data transmission layer ensures that transmission of heterogeneous network data to be real-time and transparent. The data characterization layer is for sensor equipment registration, data definition, and its standardization.

Architecture of Active Sensing for Complex Events in IoMT
In this paper, we propose the following active sensing architecture for manufacturing events (Figure 3), which includes data acquisition, data transmission, data characterization, data integration, data application, and data service [43].
The sensing layer ( Figure 3) is a highly-reliable manufacturing data-aware environment. The main task i : (1) to build a sensing environment for data acquisition and transmission, to establish a sensor network configuration model for measuring different parameters, and to determine the target of the sensor network function and constraints; (2) to establish sensor information registration/information processing library and data description, to describe and define manufacturing resource information with various sensors; and (3) the perception and transmission of real-time data of manufacturing resources, which is manifested when the manufacturing resources reach the sensing area. At that time, the data is automatically collected or identified by the equipments that are aware of manufacturing resource information. Then, the event is perceived by the sensor in real-time. Through the network communication protocol, the sensor device will be able to collect data of the manufacturing resources. The data acquisition layer is used to collect the multi-source manufacturing data and manage the heterogeneous sensor. The data transmission layer is employed to integrate the heterogeneous networks and provide the interoperability to meet the very large volume of real-time sensing data transmission needs. As the heterogeneous network in the manufacturing of things uses different protocols, the data transmission layer ensures that transmission of heterogeneous network data to be real-time and transparent. The data characterization layer is for sensor equipment registration, data definition, and its standardization.  The information processing layer ( Figure 3) is employed to receive the data sent by the object perception layer. According to the established data integration rules, the perception data is processed in real time. It establishes data mapping and event handling mechanism (such as standard output data model formulation, event correlation operation and value-added processing rules). It also implements data processing and information integration, and obtains key events information of monitoring and decision-making in the production process. The data integration layer is used for relationship definition, correlation operation, and value-added processing in the production process of multi-source information. The data integration layer performs the collection of production-aware events and the classification of storage to support efficient data transfer.
In order to meet the requirements of real-time monitoring in the manufacturing process, production plan execution, equipment condition detection, material optimization and distribution, and product quality inspection, the application service layer calls or accesses the perceptual information stored in different systems of manufacturing enterprises, and is used to optimize production decisions. The data center provides the service information needed for the manufacturing process management system, such as sensor network optimization configuration rules, multi-source information aggregation rules, sensor information registration database, manufacturing information processing and extraction rules, and enterprise manufacturing resource knowledge bases.

Active Sensing Method for Key Events of Manufacturing Processes Based on IoMT
In order to realize active sensing and standard output of the shop manufacturing process, the multi-hop heterogeneous sensor network can be adopted in the manufacturing workshop to manage The information processing layer ( Figure 3) is employed to receive the data sent by the object perception layer. According to the established data integration rules, the perception data is processed in real time. It establishes data mapping and event handling mechanism (such as standard output data model formulation, event correlation operation and value-added processing rules). It also implements data processing and information integration, and obtains key events information of monitoring and decision-making in the production process. The data integration layer is used for relationship definition, correlation operation, and value-added processing in the production process of multi-source information. The data integration layer performs the collection of production-aware events and the classification of storage to support efficient data transfer.
In order to meet the requirements of real-time monitoring in the manufacturing process, production plan execution, equipment condition detection, material optimization and distribution, and product quality inspection, the application service layer calls or accesses the perceptual information stored in different systems of manufacturing enterprises, and is used to optimize production decisions. The data center provides the service information needed for the manufacturing process management system, such as sensor network optimization configuration rules, multi-source information aggregation rules, sensor information registration database, manufacturing information processing and extraction rules, and enterprise manufacturing resource knowledge bases.

Active Sensing Method for Key Events of Manufacturing Processes Based on IoMT
In order to realize active sensing and standard output of the shop manufacturing process, the multi-hop heterogeneous sensor network can be adopted in the manufacturing workshop to Sustainability 2018, 10, 692 7 of 21 manage the heterogeneous sensors and to collect the dynamic data. In data processing, firstly, the sensor information is defined according to the sensor type and data description template, and the heterogeneous data is normalized by the ISA95 standard encapsulation data [44]. Secondly, based on the event business logic and rule based algorithms, key events are obtained by matching the perceptual data based on the XML templates. Finally, the perceived key events are transmitted through Web service technology.
The implementation steps of active sensing of manufacturing process events based on the IoT technology are as follows: (1) The design of the perception system; (2) Data processing and standardized packaging; (3) Complex event correlation matching; and (4) Transmission and access of perception results.
The process of active sensing and processing manufacturing complex events is shown in Figure 4. The details of the processes are explained as below in subsections.
Sustainability 2018, 10, x FOR PEER REVIEW 7 of 21 the heterogeneous sensors and to collect the dynamic data. In data processing, firstly, the sensor information is defined according to the sensor type and data description template, and the heterogeneous data is normalized by the ISA95 standard encapsulation data [44]. Secondly, based on the event business logic and rule based algorithms, key events are obtained by matching the perceptual data based on the XML templates. Finally, the perceived key events are transmitted through Web service technology. The implementation steps of active sensing of manufacturing process events based on the IoT technology are as follows: (1) The design of the perception system; (2) Data processing and standardized packaging; (3) Complex event correlation matching; and (4) Transmission and access of perception results.
The process of active sensing and processing manufacturing complex events is shown in Figure 4. The details of the processes are explained as below in subsections.

Perception System Design
Due to the sensor heterogeneity, an embedded manufacturing information sensing device is designed to conduct multi-source heterogeneous data acquisition, network I/O control, rule based algorithm processing, and data storage and transmission. It also realizes heterogeneous sensor concentration management and heterogeneous information-aware processing. In the perception system, real-time manufacturing information can be acquired with the underlying components of the sensing node module. The intermediate component integrates the data collected by the bottom node, real-time transmission, and decision briefing, and generates events through the logical operation of data information. A unified user interface facilitates the development of the system and the efficient transfer of information. A unified description of the sensor information achieves the standardization of information processing and expression. For the sake of generality, real-time sensing data per sensor is encapsulated as a standard Web service so that real-time data can be transmitted over the network.
Perception system integration of functional modules mainly includes plug-and-play of heterogeneous sensors, condition monitoring equipment, multi-source heterogeneous information processing and standardization, multi-level event matching operations and packaging, and event push and access.

Processing and Standardized Package of Perception Data
According to the data structure of storage, the real-time manufacturing information is divided into dynamic data and static data. Dynamic data is stored as XML documents, of which the data structure is semi-structured and unstructured. Static data (basic data) is the property data of manufacturing resources, also referred to as the basic information of the object, which is stored in a relational database. In order to achieve the unified expression and efficient call of heterogeneous data, the relational data and XML data can be exchanged, and the perception data is encapsulated and stored as XML documents.

Correlation Matching of Complex Events
First of all, we need to integrate the manufacturing information that's processed and packaged in a standard package (including multi-source manufacturing information related to definition of association, template matching of multi-level events, regular operation, and increment processing of events). The event association matching process consists of three steps: (1) to establish an event association model using XML language to describe the association of multi-source manufacturing information, and to establish an XML file describing the event structure; (2) to mine association rules of events based on association data mining algorithms and to establish the correlation matching templates of complex events; and (3) to improve the performance of the algorithm in the event stream processing engine and perform the calculation of the complicated events in the production process based on template matching.

The Transmission and Access of Perception Results
Perceived complex events are mainly based on Web service technology for active push and remote access, as shown in Figures 5 and 6.

The Transmission and Access of Perception Results
Perceived complex events are mainly based on Web service technology for active push and remote access, as shown in Figures 5 and 6 Figure 5. Active push service of key events. Figure 5. Active push service of key events.  Figure 6. Remote access service of key events.

Standardized Descriptions and Processing Of Manufacturing Process Events
With the improved XML language, the standardized processing of manufacturing events is achieved in order to realize the unified semantic expression of the complex relations of multi-level events in the manufacturing process. At the same time, we developed a complicated event association matching scheme to process complex events based on templates.

Correlation Model of Manufacturing Association Events
In general, the relationship between the manufacturing process events are: (1) temporal relationships or time-sequence relationships, which can be described using time models; (2) logical hierarchies, which can be described using hierarchical models; and (3) causal relationships, described using semantic operators for expression. Assuming CE represents a key event or complex event. PE represents an original event. The expression for the key event can be written as: CE = f(PE1, PE2, ···, CE1, CE2, ···). The logical operator f defines the logical relationship between events and can be nested in multiple layers.
Based on the production process event type and correlation analysis, a complex event structure model oriented to the production process is established (see Figure 7). Relational operators are used to describe the relationship between the multi-level events, such as timing and logic hierarchy, to reveal the information of sub-events and their implications in multi-level complex events, and to explain the selection and matching of sub-event instances of complex events. The temporal and semantic relations between multi-level events can also be identified.

Standardized Descriptions and Processing Of Manufacturing Process Events
With the improved XML language, the standardized processing of manufacturing events is achieved in order to realize the unified semantic expression of the complex relations of multi-level events in the manufacturing process. At the same time, we developed a complicated event association matching scheme to process complex events based on templates.

Correlation Model of Manufacturing Association Events
In general, the relationship between the manufacturing process events are: (1) temporal relationships or time-sequence relationships, which can be described using time models; (2) logical hierarchies, which can be described using hierarchical models; and (3) causal relationships, described using semantic operators for expression. Assuming CE represents a key event or complex event. PE represents an original event. The expression for the key event can be written as: CE = f(PE1, PE2, ···, CE1, CE2, ···). The logical operator f defines the logical relationship between events and can be nested in multiple layers.
Based on the production process event type and correlation analysis, a complex event structure model oriented to the production process is established (see Figure 7). Relational operators are used to describe the relationship between the multi-level events, such as timing and logic hierarchy, to reveal the information of sub-events and their implications in multi-level complex events, and to explain the selection and matching of sub-event instances of complex events. The temporal and semantic relations between multi-level events can also be identified.
Based on the production process event type and correlation analysis, a complex event structure model oriented to the production process is established (see Figure 7). Relational operators are used to describe the relationship between the multi-level events, such as timing and logic hierarchy, to reveal the information of sub-events and their implications in multi-level complex events, and to explain the selection and matching of sub-event instances of complex events. The temporal and semantic relations between multi-level events can also be identified.   There exists an association of similar event type aggregations between event CE1 and event CEn. For event PE, the CE1n upper level event is CE1, and there is a generalized relationship between event CE1, events CE1n and PE. The aggregation process for the critical event CE11 [45] is: (1) if the original event PEn occurs, the event value is TRUE; (2) if the original event PEm does not occur, the event value is FALSE, and the non-operator aggregation event value becomes TRUE; (3) after the two original events are processed, the event value becomes TRUE by the sequence operator; and (4) after the time constraint operator is aggregated, the event value becomes TRUE, i.e., the event CE11 occurred. The XEDL syntax consists of a collection of raw event registries and key event sachems. The syntax is described as follows:

(2) Description Syntax of Original Events
The primitive event triggered by the sensor node is represented by a unique identifier ID and it represents a change in the same class or similar state. The original event body contains the source sensing device, the time, the location of occurrence, and other attributes.

(3) Description Syntax of Key Events
A key event is described as a complex event pattern, which includes three aspects: the cause event set, the instance strategy, and the logic operation function. The key event expression consists of the event operator and the operand, denoted as CE expression (operator, operand). The operands represent the event type, and the operators combine the event types. The definition of event operator [46,47] consists of three parts: (1) the number of instances of the operands; (2) the usage strategy and consumption strategy of the event instance; (3) the usage strategy of event instances consists of four operators: primitive, recent, continuous, and cumulative; and the consumption strategy of the event instance consists of four operators: reserve, remove-early, remove-current, remove-all. Qualified events are reserved following the usage strategy or consumption strategy of the operand processing or after deleting the ineligible instances when the number of event instances of the operand is exceeded. The usage strategy of an event instance specifies how an event instance can be used for event aggregation. The consumption policy of the event instance determines whether the complex event is saved or deleted after it is involved in complex event calculations.

(1) The Policy Description of the Causal Event Instance
The use of the event instance, the consumption policy, and the cause event are described in XEDL syntax as follows:

Manufacturing Process Event Processing Based on Complex Event Processing (CEP) and Associated Templates
The manufacturing process event is processed by matching relation scheme based on template sequences. Firstly, the Apriori algorithm is used to mine the event data set and generate the matching template, which is stored in the memory database in XML format. Then, the template-based complex event processing operation is performed, and the key events of the manufacturing process are obtained [17].

(1) Manufacturing Process Event Matching Association Scheme
The Apriori algorithm is used to mine association rules and generates matching templates. The algorithm rules are: (1) if there is a causal relationship between active-perceived events and sub-events, the confidence level of the association rules is 1; (2) there are one-to-one, many-to-one association rules between perceived complex events and the causal events. There is no need to consider one-to-many or many-to-many cases; and (3) for the one-to-one association rules of events, there is a sufficient non-essential conditional relation between the source event and the target event.
The algorithm of matching template [48] is generated as follows: To achieve the complex processing and analysis of multiple atomic events in real-time, we chose template matching as the complex event processing data stream processing scheme. The template is stored in the knowledge base of "in-memory database", and the production process events are handled by template matching and complex event processing. The main flow is shown in Figure 8. In complex event processing, the NFA is used to describe the push decision of an atomic event. Depending on the business needs, the application of nondeterministic finite automata in complex event processing is extended and innovated as follows: (1) When the life cycle of the automatic validation machine is overdue, the automatic machine that does not complete dies, and the event request was cancelled. (2) During the concurrent event processing, the automaton calculates and matches the matching system separately, and provides the suspending function for event handling. (3) For those automaton that "from suspend to die", atomic events will be deposited into a temporary library for subsequent repair.
The complex event processing algorithm of the finite machine is described as follows: 1  In complex event processing, the NFA is used to describe the push decision of an atomic event. Depending on the business needs, the application of nondeterministic finite automata in complex event processing is extended and innovated as follows: (1) When the life cycle of the automatic validation machine is overdue, the automatic machine that does not complete dies, and the event request was cancelled. (2) During the concurrent event processing, the automaton calculates and matches the matching system separately, and provides the suspending function for event handling. (3) For those automaton that "from suspend to die", atomic events will be deposited into a temporary library for subsequent repair.
The complex event processing algorithm of the finite machine is described as follows: To realize real-time active sensing of complex events by the CEP engine, we have developed a set of algorithms based on association templates to improve the speed of event detection and correlation matching. One of the major contributions of this paper is to develop methods to achieve real-time processing of multi-level event instances by performing complicated event pattern matching according to the set task priorities, thus reducing the processing time and facilitating real-time active sensing of key events.
Due to the relatively fixed mechanism of automata and Petri nets in the CEP intermediate structure, it is difficult to adjust the priority of tasks. We, thus, proposed a complex event structure model according to event expression and the type of the manufacturing process. A directed graphic [49] is chosen to show the mapping model of complex event processing. Specifically, complex event patterns in the library are mapped to a directed graph and stored in the memory database, where there are directed graph nodes, intermediate nodes, and root nodes, which correspond to atomic events, intermediate modes, and complex event modes. Identical nodes are merged, as shown in Figure 9. There exist necessary relationships between event PE (process event) and CE (complex event). Due to the relatively fixed mechanism of automata and Petri nets in the CEP intermediate structure, it is difficult to adjust the priority of tasks. We, thus, proposed a complex event structure model according to event expression and the type of the manufacturing process. A directed graphic [49] is chosen to show the mapping model of complex event processing. Specifically, complex event patterns in the library are mapped to a directed graph and stored in the memory database, where there are directed graph nodes, intermediate nodes, and root nodes, which correspond to atomic events, intermediate modes, and complex event modes. Identical nodes are merged, as shown in Figure 9. There exist necessary relationships between event PE (process event) and CE (complex event).
The mid-point node performs complex event correlation matching according to the CEP patterns and transmits the result to the parent node when the atomic event is generated by the complex event processing procedure of the directed graph. When the corresponding parent node detects the input of the sub-node event, the CEP matching pattern in the corresponding node is searched and the association process is performed. If the match is successful, the intermediate node outputs the processed complex event to the parent node for subsequent association, and the root node outputs the final event-aware event. Otherwise, the corresponding event is stored or discarded depending on the semantic judgment. (2) Event Matching Based on the Heuristic CEP Algorithm The essence of our heuristic is to find the shortest path function that defines the path from the sub-node to the parent node in a complex event pattern tree, which is used to search and evaluate the optimal complex event processing scheme. The heuristic function considers two factors: I) when some or all of the sub-events of the node occur, the pattern matching is carried out; II) the shorter the path between event processing nodes, the fewer the event composition layers, and the easier it is for complex event pattern matching. Heuristic functions are defined as follows: where ( ) is the heuristic function of node n. ( ) denotes all sets of paths from the node n to each exit node, representing that node is a node on the path r from node n to a particular exit node. ( ) is a waiting function of node n, used to ensure the efficiency of synchronous threads and programs. The value of W(n) is determined according to the value range of ( ), [ , ], P( ), and ( ). P( ) represents the number of sub-events that have occurred for the complex event pattern. ( ) represents the minimum number of sub-events required to trigger the pattern matching.
Our heuristic based complex event pattern matching algorithm is shown as follows: The mid-point node performs complex event correlation matching according to the CEP patterns and transmits the result to the parent node when the atomic event is generated by the complex event processing procedure of the directed graph. When the corresponding parent node detects the input of the sub-node event, the CEP matching pattern in the corresponding node is searched and the association process is performed. If the match is successful, the intermediate node outputs the processed complex event to the parent node for subsequent association, and the root node outputs the final event-aware event. Otherwise, the corresponding event is stored or discarded depending on the semantic judgment.
(2) Event Matching Based on the Heuristic CEP Algorithm The essence of our heuristic is to find the shortest path function that defines the path from the sub-node to the parent node in a complex event pattern tree, which is used to search and evaluate the optimal complex event processing scheme. The heuristic function considers two factors: (I) when some or all of the sub-events of the node occur, the pattern matching is carried out; (II) the shorter the path between event processing nodes, the fewer the event composition layers, and the easier it is for complex event pattern matching. Heuristic functions are defined as follows: where H(n) is the heuristic function of node n. W(n) denotes all sets of paths from the node n to each exit node, representing that node n i is a node on the path r from node n to a particular exit node. W(n) is a waiting function of node n, used to ensure the efficiency of synchronous threads and programs. The value of W(n) is determined according to the value range of W(n), [k max , k min ], P(n), and Q(n). P(n) represents the number of sub-events that have occurred for the complex event pattern. Q(n) represents the minimum number of sub-events required to trigger the pattern matching.
Our heuristic based complex event pattern matching algorithm is shown as follows: For the parent node f of n{ 8: append e into the end of the cache queue at f 9: Put f into hb}} 10: While hb is not null { 11: n←The smallest node existed in hb 12: ce← the first event instance in the Buffer queue at node n / / event instance with priority to handle 13: ins ←new event instance or null generated by the ce pattern matching at node n 14: remove ce from the the cache queue n 15: Recalculate H(n) and all its children node H(n i ) 16 Our real-time CEP engine was developed under the Eclipse environment using the Java language. The overall framework is shown in Figure 10. Atomic events are formed after the sensed data is cleaned and encapsulated. The atomic events are extracted by atomic event extractor and the atomic events stream is generated. At the same time, atomic events are standardized and encapsulated, and entered into the real-time CEP engine in XML format. The CEP engine receives the atomic event stream and simultaneously detects the complex event pattern and completes the event correlation matching. The complex event stream is exported at last. The domain expert can add or delete the matching template generated by association rules mining online.  The working principles of the real-time CEP engine associates atomic events with complex event patterns generated by association rules and outputs complex events. The CEP engine first buffers and distributes the atomic events. Then, the fast heuristic CEP algorithm based on the directed graph is implemented by the detection/execution module, and the complex events resulting from the correlation matching are placed in the complex event cache in XML format. Finally, complex events are exported to the information application system to provide decision support for the manufacturing process. The real-time CEP service evaluates the latest response time of the complex event pattern during the detection process and ensures the real-time performance of the event sensing. The realtime CEP engine communicates via two types of interfaces: I) XML documents are transmitted through the XML Socket; and II) data are transmitted through Java RMI that invokes the event processing methods in the engine remotely.
In order to deal with complex event pattern processing in the CEP engine, domain experts generate event-matching templates through complex event association rule mining and improving related algorithms, and transform them into XML-based complex event correlation matching description templates, which are saved in the knowledge base. The complex event correlation matching template is mapped by a parser into a complex event pattern, which is identified by a pattern-matching structure based on a directed graph to facilitate the transmission of complex event processing.
According to the framework of the real-time CEP engine, the real-time CEP engine operating mode f is defined as follows: I). The atomic event stream is entered into the atomic event cache of the CEP engine via the XML Socket interface. II) According to the event type and the control of the event processing, the atomic event dispatcher is used to load the atomic event into the corresponding node processing unit and cache the queue according to the heuristic function value. The heuristic function calculator is used to recalculate the heuristic function of the node when the node instance cache changes, and, thus, rearrange the node queue. III) The priority node is extracted in the queue through the detection/execution module and the corresponding node in the node is deleted. Meanwhile, the node processing unit script is calculated. IV) The heuristic function calculator together with the detection/execution module process the event instances until there are no event in the pending node queue. A, and the priority event in the atomic event cache continues to load the node processing queue through the atomic event dispatcher. V) Complex events generated by the detection module and the CEP node are appended to the complex event cache and will be exported through the XML Socket interface The working principles of the real-time CEP engine associates atomic events with complex event patterns generated by association rules and outputs complex events. The CEP engine first buffers and distributes the atomic events. Then, the fast heuristic CEP algorithm based on the directed graph is implemented by the detection/execution module, and the complex events resulting from the correlation matching are placed in the complex event cache in XML format. Finally, complex events are exported to the information application system to provide decision support for the manufacturing process. The real-time CEP service evaluates the latest response time of the complex event pattern during the detection process and ensures the real-time performance of the event sensing. The real-time CEP engine communicates via two types of interfaces: (I) XML documents are transmitted through the XML Socket; and (II) data are transmitted through Java RMI that invokes the event processing methods in the engine remotely.

Deployment of Active Perception and Processing Technology for Manufacturing
In order to deal with complex event pattern processing in the CEP engine, domain experts generate event-matching templates through complex event association rule mining and improving related algorithms, and transform them into XML-based complex event correlation matching description templates, which are saved in the knowledge base. The complex event correlation matching template is mapped by a parser into a complex event pattern, which is identified by a pattern-matching structure based on a directed graph to facilitate the transmission of complex event processing.
According to the framework of the real-time CEP engine, the real-time CEP engine operating mode f is defined as follows: (I). The atomic event stream is entered into the atomic event cache of the CEP engine via the XML Socket interface. (II) According to the event type and the control of the event processing, the atomic event dispatcher is used to load the atomic event into the corresponding node processing unit and cache the queue according to the heuristic function value. The heuristic function calculator is used to recalculate the heuristic function of the node when the node instance cache changes, and, thus, rearrange the node queue. (III) The priority node is extracted in the queue through the detection/execution module and the corresponding node in the node is deleted. Meanwhile, the node processing unit script is calculated. (IV) The heuristic function calculator together with the detection/execution module process the event instances until there are no event in the pending node queue. A, and the priority event in the atomic event cache continues to load the node processing queue through the atomic event dispatcher. (V) Complex events generated by the detection module and the CEP node are appended to the complex event cache and will be exported through the XML Socket interface

Application Development Platform
To evaluate the effectiveness of the proposed ASPIE framework for active sensing and processing of IoMT events, we developed a software platform for a local chili oil sauce manufacturing company using the technology framework as shown in Figure 11. The object-oriented management platform was implemented using C# and Java with Microsoft SQL Server 2008 R2 database, Windows 7 operating system, and the .NET 4.0 architecture.

Application Development Platform
To evaluate the effectiveness of the proposed ASPIE framework for active sensing and processing of IoMT events, we developed a software platform for a local chili oil sauce manufacturing company using the technology framework as shown in Figure 11. The object-oriented management platform was implemented using C# and Java with Microsoft SQL Server 2008 R2 database, Windows 7 operating system, and the .NET 4.0 architecture.  Figure 11. Technology framework for ASPIE implementation.

System Implementation
The ASPIE framework has to be embedded into the current ERP system at the LGM chili oil manufacturing company to evaluate how they can help to improve the management of the manufacturing processes. LGM has implemented the ERP system aiming to achieve manufacturing resource data perception by the heterogeneous sensing equipment. It can use data resource management and knowledge data mining and analysis of manufacturing data to provide data assets for business needs inside and outside the enterprise. Furthermore, data need to be shared in the cloud to support ubiquitous collaborative manufacturing through the manufacturing resource visualization and manufacturing resources service-on-demand. The whole dataflow and related modules of LGM ERP is shown in Figure 12 with the ASPIE modules included. In this framework, the production process sensing data and their processing is used to provide decision support for dynamic monitoring of discrete manufacturing processes for effective improvement of manufacturing execution and management.

System Implementation
The ASPIE framework has to be embedded into the current ERP system at the LGM chili oil manufacturing company to evaluate how they can help to improve the management of the manufacturing processes. LGM has implemented the ERP system aiming to achieve manufacturing resource data perception by the heterogeneous sensing equipment. It can use data resource management and knowledge data mining and analysis of manufacturing data to provide data assets for business needs inside and outside the enterprise. Furthermore, data need to be shared in the cloud to support ubiquitous collaborative manufacturing through the manufacturing resource visualization and manufacturing resources service-on-demand. The whole dataflow and related modules of LGM ERP is shown in Figure 12 with the ASPIE modules included. In this framework, the production process sensing data and their processing is used to provide decision support for dynamic monitoring of discrete manufacturing processes for effective improvement of manufacturing execution and management.
Big data storage, analysis and processing  Figure 12. Production data flow and ASPIE module at LGM, a Chili oil manufacturer.
According to the function modules of the manufacturing system platform and processing of data sensing, the applications of comprehensive data are analyzed in Table 1. Table 1. Event and data flow of LGM manufacturing processes.

Display content
Real-time video monitoring of production processes, real-time manufacturing environment, product quality inspection data, raw material quality data analysis, equipment working conditions, key business point checks.

Basic event flow
(1) Real-time production video monitoring via video camera: to obtain the real-time status of production line.
(2) Real-time monitoring of environmental data (via real-time sensors): to obtain environmental monitoring information, including air temperature, humidity and combustible gas concentration.
(3) Product quality data monitoring: to observe the trend graph of qualified product ratios. (4) Raw material quality data analysis: to observe the quality of raw materials and its changes at different time periods. (5) Equipment work status checking: to observe the work status changes of forklifts (we used the forklift status information as example). (6) Key business point check: to check key information at the critical business sites, including raw materials shelf life reminding, equipment status reminding, to-do task reminding, information of the staff on site.
In our LGM chili sauce manufacturing company example, we analyzed the sensing data of personnel, forklifts, an manufacturing environment to provide the production managers real-time environment information, equipment information, and working conditions of forklifts, which According to the function modules of the manufacturing system platform and processing of data sensing, the applications of comprehensive data are analyzed in Table 1. Table 1. Event and data flow of LGM manufacturing processes.

Display content
Real-time video monitoring of production processes, real-time manufacturing environment, product quality inspection data, raw material quality data analysis, equipment working conditions, key business point checks.

Basic event flow
(1) Real-time production video monitoring via video camera: to obtain the real-time status of production line. (2) Real-time monitoring of environmental data (via real-time sensors): to obtain environmental monitoring information, including air temperature, humidity and combustible gas concentration. (3) Product quality data monitoring: to observe the trend graph of qualified product ratios. (4) Raw material quality data analysis: to observe the quality of raw materials and its changes at different time periods. (5) Equipment work status checking: to observe the work status changes of forklifts (we used the forklift status information as example). (6) Key business point check: to check key information at the critical business sites, including raw materials shelf life reminding, equipment status reminding, to-do task reminding, information of the staff on site.
In our LGM chili sauce manufacturing company example, we analyzed the sensing data of personnel, forklifts, an manufacturing environment to provide the production managers real-time environment information, equipment information, and working conditions of forklifts, which provided decision support for effective control of the manufacturing environment of the workshop and resource scheduling.

Conclusions
This paper proposed an active sensing and processing architecture (ASPIE) of IoMT complex events based on data-driven manufacturing processes, characteristics of IoMT, and complex event processing technology. ASPIE will be able to support production control and intelligent decision-making of manufacturing enterprises, which is composed of an active sensing method of the complex events in IoMT processes, a unified descriptive language of event models, and a template-oriented processing method for complex events. The proposed ASPIE framework has already been implemented and evaluated at a food manufacturer, which showed its feasibility and effectiveness.
Considering the application requirements of intelligent manufacturing, the research in this paper can be extended in the following aspects: (1) To establish a highly-efficient interactive manufacturing data management system; (2) to study the parallel and efficient data mining algorithm for complex manufacturing events; (3) due to the complex relationship among the events of the IoMT processes, the event instance strategy and logic operation function needs to be further studied in the XEDL event model description language for a more unified and accurate description of the complex relationships between the objects, between the activities, or between the objects and activities contained in the manufacturing data; and (4) to construct big data application planning based on an intelligent manufacturing model