An Agent-based Industrial Cyber-Physical System Deployed in an Automobile Multi-Stage Production System

Industrial Cyber-Physical Systems (CPS) are promoting the development of smart machines and products, leading to the next generation of intelligent production systems. In this context, Artificial Intelligence (AI) is posed as a key enabler for the realization of CPS requirements, supporting the data analysis and the system dynamic adaptation. However, the centralized Cloud-based AI approaches are not suitable to handle many industrial scenarios, constrained by responsiveness and data sensitive. Edge Computing can address the new challenges, enabling the decentralization of data analysis along the cyber-physical components. In this context, distributed AI approaches, such those based on Multi-agent Systems (MAS), are essential to handle the distribution and interaction of the components. Based on that, this work uses a MAS approach to design cyber-physical agents that can embed different data analysis capabilities, supporting the decentralization of intelligence. These concepts were applied to an industrial automobile multi-stage production system, where different kinds of data analysis were performed in autonomous and cooperative agents disposed along Edge, Fog and Cloud computing layers. Jonas Queiroz, Paulo Leitão and José Barbosa Research Center in Digitalization and Intelligent Robotics (CeDRI), Instituto Politécnico de Bragança, Campus de Santa Apolónia, 5300-253 Bragança, Portugal, e-mail: {jpqueiroz, pleitao, jbarbosa}@ipb.pt Eugénio Oliveira University of Porto, Faculty of Engineering LIACC, 4200-465 Porto, Portugal, e-mail: eco@fe.up.pt Gisela Garcia Volkswagen AutoEuropa, Quinta do Anjo, 2954-024 Palmela, Portugal, e-mail: gisela.garcia@volkswagen.pt


Introduction
garding how and where data analysis should be deployed. This decentralization of data analysis can be realized through the use of AI distributed problem solving approaches, such those based on Multi-Agent System (MAS). The MAS approach fits suitably the CPS requirements, supporting the design and development of systems based on societies of intelligent, autonomous and cooperative entities [10].
In this sense, this paper describes a modular agent-based architecture to design cyber-physical components with embedded data analysis capabilities. The proposed approach is based on a set of data processing modules that can be combined to build cyber-physical agents to be deployed at different computing layers. The envisioned decentralized data analysis approach is illustrated in a multi-stage automobile factory plant, developed under the EU H2020 GO0D MAN (aGent Oriented Zero Defect Multi-stage mANufacturing) project (go0dman-project.eu). The preliminary experiments illustrate how different kinds of data analysis can be used to deploy an industrial CPS to support the Zero Defects Manufacturing (ZDM) philosophy.
The remaining of this paper is organized as follows. Section 2 discusses the decentralization of data analysis, presenting an agent-based approach to design and develop industrial CPS. Section 3 describes an instance of the proposed approach for ZDM problems in multi-stage production systems, and Section 4 describes its deployment for the industrial automobile use case and analyses the experimental results. Finally, Section 5 rounds up the paper with the conclusions and future work.

Agent-based Approach for Decentralized Data Analysis
AI is a key enabler for the realization of industrial CPS, playing two main roles: providing data driven approaches to endow cyber and physical components with data analysis capabilities, and providing distributed knowledge management approaches to endow such components with autonomy, reasoning and collaborative capabilities.

Intelligence in Industrial CPS
In industrial environments, AI has been widely applied for both, business and operational tasks [20,17,7]. Examples of AI used at business levels include several kinds of online and offline batch, exploratory and descriptive data analysis tasks from reporting and forecasting to product design, supply chain and customer relationship management. In this context, Cloud is a good option when considering Big Data and ML tasks, like predictive and prescriptive analytics, that may need considerable computational resources to manage large amounts of data. In the same sense, operational tasks, like planning, optimization and process fault diagnosis are also suitable to be performed at Cloud. Given the broad scope and resource availability of the Cloud, the kinds of ML algorithms are diverse, from simple linear regression to robust classification and complex Deep Neural Networks [7].
On the other hand, operational tasks like system real-time condition monitoring and abnormality detection are more suitable to be performed at the Edge and Fog [19,1]. Given the constrained characteristics of Edge/Fog platforms, at these layers the tasks are mainly based on the execution of rule-based and simple data analysis models that can be created and dynamically updated by Cloud systems.
Besides having different algorithms executing in different layers, complementing each other, another approach considers algorithms that can be distributed vertically across these layers. For instance, some works propose the distributed execution of Deep Learning models, where the neural network layers are distributed along Cloud to Edge, which besides offloading the computation in central servers can also provide a local fast and partial response [16,11].
In this sense, the use of intelligence and data analysis at the Fog/Edge levels allows to: i) take real-time decisions and mitigate communication failures, ii) perform data preprocessing and aggregation to reduce the data size, optimizing the bandwidth, reducing the storage and analysis costs, and iii) increase the autonomy, modularity and flexibility of the system. On the other hand, it may face some issues and drawbacks, namely: i) costs and investment to modernize legacy and/or adopt modern equipment, ii) increased system complexity and unpredictable behavior coming from the components' distribution and autonomy, and iii) handle the uncertainty of AI approaches.
This leads directly to three main criteria that should be considered to determine and guide such distribution: 1) Edge/Fog devices computational power and availability, combined with the adoption of modern devices or instrumentation of legacy ones; 2) effort to handle the complexity derived from distribution, combined with the benefits brought by the solution; and, 3) desired level of autonomy, combined with the acceptable levels of uncertainty.

Agents Interconnecting Data Analysis layers
In spite of the benefits of decentralizing the data analysis from the Cloud to Fog and Edge layers, it presents several concerns encompassing not only the constrained computational resources, but also considering the data analysis outputs. For instance, while Cloud applications centralize the data from different sources, enabling the analysis of patterns over large number of samples and sets of attributes, Edge devices manage few samples of data with small sets of attributes, providing a very simple and highly uncertain notion of the environment conditions.
To cope with these constraints, besides data-driven, AI provides approaches like MAS, where distributed, autonomous and cooperative processing nodes, i.e. agents, work as a vessel for different kinds of algorithms. This approach uses negotiation and collaboration protocols and strategies that besides enabling the decentralization of data analysis, also support the management of vertical and horizontal interaction and collaboration of the components from each layer [3,14,18,10]. In this sense, the proposed modular agent-based architecture, to design and embed cyber-physical components with data analysis capabilities, comprises a set of data processing modules that can be combined to build cyber-physical agents to be deployed at different computational layers, as illustrated in Figure 1 (left). Each module has a specific role that in the MAS approach can be seen as an agent behavior. They are grouped in 4 clusters, namely Edge Agent Modules, Cloud Agent Modules, Common Modules and Local Modules.
Edge Agent Modules define common tasks to be performed by Edge equipment, like the physical communication with the world through sensors and actuators (Physical Comm.), data preprocessing (Preprocessing) and condition monitoring (Monitoring). While these modules aim continuous and simple data processing to attend fast response requirements, the Cloud Agent Modules focus on advanced and batch data analysis, aiming to support decision making and optimization. They define tasks that are computational demanding or require a broad view of the system, thus being more suitable to be performed at Fog or Cloud layers. Such tasks encompass the system supervision (Supervisor), data analysis and ML (Data Analysis), decision-support and other human agent interaction systems (Human-Agent Inter.), as well as knowledge management tasks (Knowledge Base). The Collab. Manager and Intel. Controller modules represent common modules that can be present in any kind of agent, being responsible for the agents' interaction and their internal decision-making mechanisms, respectively. The Local modules should be part of all agents, handling their communication interfaces (IoT Comm. API), managing the internal events (Agent Manager) and storing local data (Local Data Store).
In spite of the modules division in Edge and Cloud, they are not restricted to that, and should be combined according to the application constraints and requirements.

GO0D MAN MAS Cyber-Physical System Architecture
The described approach was used, under the GO0D MAN project, to design a modular CPS that supports the ZDM philosophy in multi-stage manufacturing systems [9]. The goal is to achieve an adaptive system for the real-time monitoring and the early identification of deviations and defects along the different process and quality control stages, towards the proactive and dynamic adaptation of process and inspection parameters. For this purpose, the GO0D MAN architecture defines four types of agents, namely Product Type Agent (PTA), Product Agent (PA), Resource Agent (RA) and Independent Meta Agent (IMA) [9], which are responsible for managing, collecting and analyzing data from different manufacturing entities. Based on the required responsiveness, data visibility and data analysis tasks, they are placed at different computing layers, as illustrated in Fig. 2. Each inspection station has an associated RA that resides locally in an Edge computing platform and presents capabilities of data stream analysis, early problem detection and self-monitoring. It plays an essential role to enhance the real-time monitoring and the quality (granularity) of the data sent to upper layers, as well as the overall data management and distribution along the computing layers. These agents are related to Edge agents, implementing the respective data analysis modules, as well as the Common and Local Modules, as described in Sect. 2.
Each product, i.e. a vehicle being produced, has associated a PA, hosted at the Fog layer, responsible for managing the product's inspection along the stages, early detecting deviations and determining quality indicators. Both RAs and PAs perform the continuous monitoring and dynamic adaptation of process parameters, executing simple but fast data analysis, attending the fast response and data sensitive require-ments, respecting the constrained resources of their platforms. Based on that, the data analysis models used by them could be built and dynamically updated through the interaction with the agents placed at the Cloud level. The PAs may combine Edge and Cloud modules, excluding the Physical Comm., since they don't need to access any physical device, and usually having a Supervisor module. The intelligence and data analysis algorithms embedded in these agents may support, e.g., the: • Customization of functional tests: PAs can adjust the testing plan according to different product types, features or events recorded along the production process. • Collaborative detection of malfunctioning: RAs can be self-aware of their conditions, thus given any anomaly in their operation, they can interact with other RAs to diagnose if it is a local or global malfunction. In the same manner, each PA can correlate data or interact with others PAs to detect and diagnose problems involving more than one resource. • Selective raw data exchange: RAs monitor the collected raw data continuously, sending preprocessed data and alerts to upper level components. Their limited data storage can be used to keep track of a window of raw data samples and selectively send it to upper level components. • Early identification of products that never reach the desired quality: PAs analyze the evolution of the quality indexes of each product during its production to early detect when the desired quality is not possible to be achieved anymore and consequently decide to stop the production of the non-quality product.
On the other hand, PTAs (one for each product model) and IMAs (to provide global optimization) are hosted at the Cloud layer taking advantage of the available computational resources to store and process the huge amount of data (historical and real-time streams) integrated from PAs and RAs. Both PTAs and IMAs comprise Cloud-based agents, implementing the related data analysis modules. However, PTAs can also implement Monitoring modules, while Human-Agent Inter. and Knowledge Base modules are more common for IMAs. In general, they run advanced ML algorithms for classification and prediction tasks, as well as to plan and optimize the processes and their parameters. For instance, classification or clustering techniques can be used to classify the products according to their testing results, while prediction algorithms can be used to determine in advance if the product will fail in the next stages based on the results of the previous ones. The intelligence and data analysis algorithms embedded in these agents may support, e.g., the: • Dynamic adaptation of the process plan: PTAs can optimize the process plan for each product, based on the analysis of the integrated PA's data, also providing up-to-date data models and other settings to PAs. • Optimization of process parameters: IMAs use advanced batch data analysis to handle the large amount of data, collected from PAs and RAs, to adjust monitoring rules, train data models and optimize operational parameters. As example, this includes the early detection of performance or quality degradation.
This illustrates some of the AI capabilities, regarding the collaboration between physical and cyber components to implement ZDM in multi-stage systems. More details can be found in [9].

Deployment in an Industrial Automobile Multi-Stage Production System
The envisioned MAS approach for decentralizing the data analysis was applied to an automobile assembly line at the Volkswagen Autoeuropa situated in Portugal. Following the principles of the zero defect multi-stage manufacturing, the idea is to collect data from the several stages of the assembly line and analyze them to extract knowledge related to the continuous monitoring and the early detection of defects, allowing to perform adjustments or rework as soon as possible.
For this purpose, the case study considers 2 inspection stations disposed along the assembly line. The first station, called Framing, inspects the deviations in the rear part of the vehicle's frame, regarding the product design specified measurements. It provides a total of 21 variables (15 raw measurements and 6 extracted from them). The second station, called Finish Line, inspects the alignment and gaps deviations (gap and flush) between the vehicle's frame and the tailgate. This station provides 22 variables (16 raw measurements and 6 extracted from them). Moreover, the preliminary experiments considered the data from only one type of vehicle, which after a cleaning process produced a data set containing about 38.500 product samples.

Development of the Agent-based CPS Solution
The agent-based solution was developed using the JADE framework, with the agents using the GO0D MAN data model [13], based on the AutomationML, to support the information sharing among the agents. The agent-based model considers: • 2 RAs, one for each station, that collect and analyze the inspection measurements to determine if the vehicle needs any adjust/rework before continue the assembly. • As many PAs as the number of vehicles being produced in the assembly line, each one being responsible for integrating and processing the data from the RAs. • 1 PTA representing the model of vehicle that is produced, being responsible for integrating and analyzing the data provided by the PAs. • 1 IMA to provide dynamic optimization by retraining the data models and monitoring rules to be used by the other agents.
The data analysis capabilities have been developed in Python and integrated in the RAs, PAs and PTA agents. In this context, before the creation of the data analysis models to be deployed in the system agents, data mining tasks were performed, where besides data preprocessing and cleaning, an exploratory data analysis was conducted aiming to determine what kind of data analysis approaches and algorithms could be used. Moreover, regarding the lack of labeled samples, the data analysis was based on unsupervised learning approaches. In the preliminary experiments, they mainly comprise outlier and novelty detection techniques. Given this case study characteristics and requirements, they were used to continuously monitor the quality of the products along the assembling process. Their outputs were used to determine the quality indicators and detect outliers and deviations, aiming to trigger alerts for early adjustments and mitigation tasks, in order to reduce the need for rework and the production of low quality products or even scraps.

Preliminary Data Analysis Experiments
This section describes the results from the implementation of unsupervised data analysis, mainly based on anomaly and novelty detection algorithms.

Monitoring and Characterization of the Vehicle Assembly Quality
As discussed in the Sect. 3, the RAs are in charge to perform the continuous monitoring of the measured variables at the associated station. Regarding that, some important data analysis tasks include the monitoring and characterization of the quality of the vehicle assembly at the current stage. In this context, considering the lack of labeled data, instead of use classification algorithms, an unsupervised approach for outlier/anomaly detection was applied.
The main idea behind the outlier detection algorithms is to keep track of the local distribution of data points, considering an outlier any sample that substantially deviates from such distribution. Such algorithms should be previously trained with only regular data samples in order to fit the model with the data distribution.
In this context, the Fig. 3 illustrates the results of the application of the Local Outlier Factor (LOF) algorithm [6] in the data from both inspection stations. The LOF algorithm is an unsupervised anomaly detection method that considers outliers the data points that present a substantial deviation from the density distribution of its neighbors. Instead of simply determining whether a new observation is an outlier, this algorithm also provides a score, indicating the degree of outlier, i.e., how far it is from the local distribution. In this context, this value is used to characterize the quality of the vehicle assembly process.
In the experiments, a LOF data model was build and previously trained by considering the first 8000 data samples. In the Fig. 3, each point indicates the outlier score of an inspected product that in this case can be interpreted as the product quality after the given assembly process. The red 'X' indicates products that did not achieve the highest desired quality values, thus triggering an alert for adjustments or rework to be performed before to continue the assembly process.
The analysis illustrated in Fig. 3 is computed separately by each RA, with problems associated to individual stations being detected by these agents. However, in multi-stage systems, the occurrence of critical problems or defects can only be detected by correlating the outputs of multiple stages, which increases the data analysis complexity. For this purpose, the quality values acquired by the RAs are also analyzed by the PAs that can correlate them across the stations and check the quality Fig. 3 Anomaly detection in inspection stations evolution along the assembly process. In this context, the Fig. 3 illustrates 2 products that did not achieved the desired quality indicators at the first station, and even after the execution of the adjustments still presented undesired quality values. This can be used to raise alerts for a special attention in the next adjustments that should be performed. This correlation can be performed based on rule-based algorithms that should compare the values of the different stages, or even using clustering or classification methods that may consider the combination of multiple indicators to determine if the product does not comply with the specified quality values.

Detection of Changes in the Process
Since at the operational levels, the processes are subject to constant changes, for instance, that may be caused by products changeover or mechanical issues, another important aspect that should be monitored is related to changes in the distribution of the measurements. These kinds of changes in the data distribution, also known by Concept Drift, are different from the degradation that present a smooth change (trend) in the measurements. Thus, it is important to monitor and detect them, in order to alert higher level systems that some significant change occurred in the processes, indicating the need to update the current data models or monitoring rules in order to keep the monitoring tasks operating properly.
While the outlier detection algorithms analyze whether a new observation is inside the current data distribution, the Concept Drift algorithms follow a similar approach, checking if a sequence of consecutive data samples left the data distribution and start a new one. In this context, Fig. 4 illustrates the application of the Page-Hinkley method [5] for the detection of a concept drift in one of the features of the Framing station. In this case, the concept drift was correctly detected, but only 16 products after the occurrence of the change, which means that the current model could be fine-tuned. In alternative, other well-known algorithms for concept drift detection can be used, like ADWIN (ADaptive WINdowing) and DDM (Drift Detection Method) [5].

Conclusions
In the industrial domain, CPS emerged as a paradigm that combines technologies like IoT, Cloud, Edge and AI, aiming to create distributed and autonomous production system capable of coping with the required levels of mass customization of products and the dynamic reconfiguration of processes. This paper discusses the use of a MAS approach to support the design and development of industrial CPS, based on cyber-physical components that can embed different data analysis capabilities. Such components should support the decentralization of data analysis from Cloud to Edge layers, aiming to attend industrial constrained applications requirements, like fast response and data sensitive.
An industrial case study, regarding an automobile assembly line aiming to implement the ZDM philosophy, was used to validate the proposed approach. The preliminary experiments illustrated how data analysis embedded by agents can be performed at different computational layers. Moreover, they considered important data analysis aspects of industrial operational levels, namely, the analysis of unlabeled data, and novelty detection that are essential to support dynamic environments. The expected benefits are related to a reduction in the costs associated to scraps, an increase in the process efficiency, as well as in the quality of the products.
Future work will be devoted to the further development of the industrial case study, exploring other ML algorithms to be embedded in the agents, as well as to integrate agent collaboration mechanisms to support the dynamic system adaptation.