Multi-agent System for Monitoring Temperature in Sensing Surfaces including Hard and Soft Sensors

In the digital transformation era, the collection of data assumes a crucial relevance. In some applications, the use of real sensors to measure the target parameters is constrained by technical or economical limitations. In such situations, it is required to use alternative techniques based on soft sensors that acquire data by estimating the measurement of a variable through the correlation of the data acquired by the neighbouring sensors. However, the co-existence of real and soft sensors requires a computational infra-structure that integrates these heterogeneous data sources and supports the synchronisation of the monitoring system based on the inputs of different measurement nodes. Multi-agent systems provide this distributed infra-structure for the data collection, ensuring modularity, scalability and reconfigurability capabilities. This paper introduces a multi-agent system approach to create a modular and scalable sensing system, based on a diversity of real and soft sensors, to support the monitoring of temperature in thin-film sensing surfaces. The proposed approach was experimentally tested in a plastic injection process, presenting promising results in terms of accuracy and response time, and allowing to obtain more sampling points through the use of computational techniques to complement the real data.


I. INTRODUCTION
The value of data assumes a crucial role in the 4th industrial revolution, also known as Industry 4.0 [1], allowing to implement monitoring, diagnosis, prediction, planning and optimisation tasks. In this context, the use of smart sensors and Internet of Things (IoT) technologies play an important role to collect the huge amount of available data, which later can be analysed to extract value and knowledge by using artificial intelligence (AI) algorithms. Recently, the use of thin-film sensing surfaces are being explored in different industrial applications, e.g., metal stamping and plastic injection processes, to expand the sensing capabilities aiming a more efficient monitoring and optimisation of the process [2].
In some situations, the use of real sensors, also known as hard sensors, can be expensive or technically difficult, being impossible to adopt direct measurement strategies, e.g., due to the harshness of the environment. In this context, it is necessary to consider an alternative approach to collect all the required information to better perform the decisionmaking process. The use of virtual sensors, also known as soft sensors [3], constitutes a suitable alternative to acquire data by estimating the measurement of a variable through the correlation of the data acquired by the neighbouring sensors. The determination of these soft sensor correlation models is usually complex and requires a computational platform that enables to estimate the parameters with a proper accuracy and in a time response manner.
In this context, an important challenge is to have a platform that supports the modular, scalable and distributed network that comprises hard and soft sensors, as well as to easily integrate different other heterogeneous and legacy data. Multi-agent systems (MAS) [4], based on their inherent characteristics, provide a suitable approach to realise this distributed infrastructure for the data collection and analysis. In fact, their capabilities to design distributed systems based on a society of autonomous and cooperative entities, called as agents, each one contributing with its individual knowledge and skills to the emergence of the entire system, fits well the demands of such distributed network of sensors.
Having this in mind, this paper introduces a MAS approach to create a modular and scalable sensing system, based on a diversity of hard and soft sensors, to support the monitoring of the surface temperature in moulds used in metal stamping or plastic injection industries. The hard and soft sensors are embodied in thin-film sensing surfaces of different geometries, which will be combined in a MAS platform in an easier, more dynamic and scalable manner. This approach allows to obtain more sampling points through the use of computational techniques that complement the acquired real data with predictive models, and is used to monitor and predict the industry process condition health. The proposed approach was developed using the JADE framework [5] and experimentally tested in a plastic injection process, presenting promising results in terms of accuracy and response time.
The rest of the paper is organised as follows: Section II describes the related work on the use of soft sensors to expand the sensing capabilities. Section III presents the agentbased architecture for distributed sensing systems comprising a diversity of hard and soft sensors. Section IV describes the development of the soft sensor models, and particularly the correlation of parameters from neighbouring sensors to estimate the measurement of the temperature parameter. Section V presents the experimental implementation of the developed approach for monitoring the temperature in a mould used in a plastic injection process. Finally, Section VI rounds up the paper with the conclusions and points out the future work.

II. RELATED WORK
In industrial injection processes, an important step towards controlling the thermoplastic injection process is the measurement of some parameters in the mould cavity where the plastic part is formed. Currently, mould sensing methods are gaining ground thanks to new technologies that are emerging with the Industry 4.0 advent. The in-mould sensors technique consists in measuring the parameters inside the mould chamber [6], using thin-film temperature sensors.
A temperature thin-film sensor presents an excellent ability to measure the steady-state as well as the transient response, causes less thermal obstruction and physical flow, and presents a good sensitivity. These thin-film sensors allow to measure temperature but also other parameters, e.g., pressure and heat flow. The development of thin-film sensors is not easy since they are minimally invasive, with a thickness around 5 to 8 µm, and perform well in hostile environments with high temperatures. As example, NASA used thin-film thermocouples and strain gauges to measure metals, ceramics and advanced ceramic-based composites [7], and tested in various materials for jet aircraft and space-based engine applications with temperatures ranging from 1000 to 1500 • C.
These thin-film sensing surfaces are constrained by the number of physical sensors that can be implemented, that are limited by economical and/or technical aspects. In fact, in a large number of applications, physical sensors are sufficient to extract the parameters of the system, but there are situations in which the direct measurements are not viable, either due to the cost, the environment harshness, the sampling rate involved, the non-online measurement option, or the desired magnitude. One way to solve a large part of these problems is to complement the use of hard sensors with soft sensors [8].
Soft sensors are software-based devices that internally implement a prediction model that based on direct or indirect variables as inputs, can estimate the desired variable as output [9]. The prediction model of a soft sensor can be obtained by using different techniques, classified as white box, gray box and black box [9].
The white-box, or model-driving modelling, uses a mathematical description of the process, which requires that all involved physical phenomena are known, clearly understood and taken into account, which may constitute a limitation for a complex system, where the complete understanding of their fundamental mechanisms is very difficult to obtain [8]. The black-box modelling, also called data-driven, uses regression techniques or neural networks, without any internal knowledge of the process. However, many processes vary over time, and therefore, the performance of a soft sensor based on these techniques can be degraded, which can be overcome through the use of adaptive methods [9]. Finally, the gray box modelling is generally used when the system is highly complex, and considers the historical operational data from the model that is processed with AI techniques [8].
Besides the soft sensor model, another challenge in a monitoring system that comprises a network of hard and soft sensors is related to the way they are integrated, supporting the proper feed of inputs for each soft sensor model from the measurements performed by hard sensors. Such sensing systems are also complex since the measurements performed by hard sensors and the estimation measurements by soft sensors must be synchronised and performed in real-time. IoT technologies contribute for the collection of data from hard sensors but a modular platform is required to support the easy and scalable estimation of the soft sensors' parameters.
The previous analysis clearly indicates the need to have a modular computational platform that supports the scaling and the on-the-fly reconfiguration of the sensing system, based on hard and soft sensors, i.e. without the need to stop, reprogram and re-start the system.

III. MULTI-AGENT SENSING SYSTEM ARCHITECTURE
The proposed system architecture, illustrated in Figure 1, is based on a set of autonomous and cooperative agents that contribute with their individual behaviour and knowledge for the distributed sensing system. The agent-based system considers two types of agents, namely hard sensor and soft sensor agents, each one designed according to the system requirements. These agents are responsible, respectively, to directly or indirectly acquire the data from the process to be monitored, implementing internally different measurement models, being the measurements of soft sensor agents performed through the cooperation with the hard sensor agents. The designed architecture ensures modularity and scalability through the easy addition of new sensors, the modification of some sensors (e.g., their position on the surface) and the remotion of existing sensors. In spite of embodying locally monitoring capabilities, the data collected and generated by this distributed sensing system is available to external computational applications responsible for the further monitoring and data analysis capabilities.
The behaviour model of the hard and soft sensor agents was designed using the Petri nets formalism [10], [11], which is a suitable approach to formally and graphically model, analyse, and validate the systems' specifications exhibiting concurrency, parallelism, synchronisation, resource sharing, monitoring and supervising, as these systems are. As illustrated in Figure 2.a), the hard sensor agent is responsible to gather the data acquired by the physical sensor, to broadcast them to the soft sensor agents that have subscribed this notification and to monitor their evolution along time. This monitoring system can use simple statistical methods or more complex algorithms, e.g., based on Machine Learning techniques.
An important issue in this type of agent is the integration with the physical asset, i.e. the physical sensor, that should follow industrial standards, e.g., the recently established IEEE 2660.1 [12], allowing to create a cyber-physical component. Based on this standard, the most appropriate interface to interconnect industrial agents and the physical controller is selected according to the application constraints, e.g., considering the place to run the agent, the interaction schema and the technology, e.g., OPC-UA and Modbus.
The soft sensor agent is responsible to estimate the measurement of the variable in the sensor position by applying a proper soft sensor model (see the Petri nets behavioural model illustrated in Figure 2.b). For this purpose, a prediction model, derived by using a white-box, black-box or gray-box approach, should be embedded at the design phase or updated in presence of condition changes, e.g., addition of new hard sensors or the modification of the sensor position in the surface. The agent-based distributed sensing system emerges from the interaction among the hard sensor and soft sensor agents, following the iteration pattern illustrated in Figure 3 that follows a kind of publish-subscribe schema. Initially, each agent registers its skills in the yellow pages service. Soft sensor agents search in the yellow pages services of the existing hard sensor agents that are registered in the system, and subscribes the topic related to the parameter they want to be notified in each one of the retrieved list of hard sensor agents.  Figure 3. Interaction protocol between soft and hard sensor agents.
When a new measurement is performed, the hard sensor agent notifies all soft sensor agents that have subscribed its topic, sending the acquired temperature parameter. The soft sensor agent, after receiving the incoming measurements from the neighbouring hard sensor agents, applies the estimation method to calculate the parameter value in its position.
An important issue in such systems is related to ensure the synchronisation between the acquisition of measurements parameters and the estimation of the soft sensor parameters. This is ensured by defining a proper cycle time during the interaction among agents using a timestamp mechanism, that guarantees that the acquisition measurements are not lost and address the real-time constraints.

IV. SOFT SENSOR MODEL
The development of soft sensors requires the determination of the model to indirectly estimate the measurement. The correlation model, which is elaborated for each soft sensor, and deployed in the soft sensor agent to be executed during its operation, is dependent of several parameters. In case of sensing the temperature parameter, the model is dependent of: • Geometry of the target surface. • Model of the heat transfer along the surface. • Position of the soft sensor in the target surface, as well as the positioning of the neighbouring hard sensors. Considering the analysis of temperature in thin-film sensing surfaces applied to plastic injection moulds, the behaviour of the temperature is of transient origin, since the heat involved in the process is always varying over time, through a heating and cooling cycle. Additionally, the analysis is also spatial, since it is desired to measure the temperature in any part of the mould geometry. In this way, the problem can be characterised as dependent on time and position.
In situations where the historical data on the use of the equipment is not available, the use of a black-box or a gray-box model can not be considered since they require a significant data set. This means that in these cases, the best approach is to use the model-driving modelling, being the phenomenon associated to the soft sensor represented by a mathematical equation. In such situations, the determination of the mathematical equations for each soft sensor comprises three stages, as illustrated in Figure 4.  The first stage is related to use a CAE (Computer Aided Engineering) software system, e.g., ANSYS, to obtain the thermal behaviour model in the desired geometry positions (related to the desired soft sensor and neighbour hard sensors). This process considers the 3D model of the target surface developed in a CAD (Computer Aided Design) software package and the positions of the sensors in the surface. Although the thermal behaviour is dynamic, the boundary conditions of the model do not change, which means that the simulation step using the CAE software needs to be performed only once. To use the CAD geometry in the simulation, some simplifications need to be performed, namely only considering the essential parts that describe the region where the sensors are placed. After including the boundary conditions and running the simulation, the data of the curves at the selected points are obtained.
The second stage is related to organise the data extracted from the thermal model for the desired positions of soft and hard sensors in the surface geometry. This step is optional and is only required if some treatment of the data format is necessary, e.g., the adjustment of the decimal and thousands separators to fit the expected input for the third stage.
Finally, the third stage is related to fitting the curves coming from the thermal model data for the desired geometry positions with proper mathematical equations. Adjusting the curves and obtaining the respective equations can be performed using a mathematical software package, e.g., Matlab. The obtained equations are polynomial expressions representing the phenomena behaviour of all hard and soft sensors. It is important to notice that as higher is the polynomial degree as better fit will be achieved, but as more complex and computational demanding will be reached.
At the end, the determined equations are deployed in the soft sensor agents and ready to estimate the measurements' points. Note that the determination of the soft sensor model is performed in off-line mode, usually during the design phase, which means that the response time to determine the correlation equations is not a problem. In opposition, the execution of these equations by the soft sensor agents is dependent of the application requirements, but usually it is real-time constrained.

V. EXPERIMENTAL IMPLEMENTATION
The proposed agent-based system for sensing the surface temperature using a network of hard and soft sensors was experimentally deployed in an industrial case study.

A. Description of the Case Study
The case study considered in this work is related to monitor the surface temperature in a mould for plastic injection processes, which is a complex device composed of several fixed and moving parts, sensors, and cooling circuits. The focus of this work is restricted to the heat exchange behaviour inside the injection chamber. The simplified mould injection unit and the position of the sensors can be seen in Figure 5. The model takes into account four sensors, three hard sensors (S11, S12, and S13) and one soft sensor (S21). The physical sensors were positioned in the places where they are required to correctly acquire the temperature measurements, and the soft sensor is positioned in a place that is difficult to install a physical sensor.

B. Development of the Soft Sensor Model
The model for the soft sensor was developed by applying the method described in Section IV. For this purpose, the first step uses the ANSYS software package, with the Transient Thermal component being loaded and the geometry of the mould developed in a CAD program being simplified by using the SpaceClaim environment (in this case, only considering the region of the injection chamber and the cooling ducts). The information about the mould metal (i.e. steel 2738) and the used plastic (i.e. polypropylene) was inserted and associated with the respective geometry, as well as the coordinates of the three hard sensors and the soft sensor. As the analysis method uses the Finite Elements Method (FEM) technique, a mesh was generated to represent the geometry. The remaining boundaries parameters were configured in the following manner: for convection. The results obtained from the thermal model are organised in a excel file that is loaded into the Matlab software package. Using the CFTOOL tool, the polynomial expressions from 3thdegree to 5th degree were obtained for the three hard sensors and one soft sensor positions. The best fit was the 4th-degree expression since the 3th-degree does not represent correctly the phenomenon and the 5th-degree expression would be very complex for the software implementation, particularly in terms of computational demands. Note that as the degree of polynomial expression increases, the accuracy of the estimation also increases, as well as the computational demanding. As example, the achieved 4th-degree polynomial expression for the soft sensor position is as follows: (−0.000385) * t 4 +0.0422 * t 3 +(−1.668) * t 2 +17.55 * t+183.1 (1) As the expression of the soft sensor is a time-dependent function and the inputs provided by the three real sensors are the temperatures, it is necessary to convert the temperature inputs into a single time value. This is performed by calculating the inverse functions modelled for each real sensor, each one returning an instant of time, which are very close to each other. The average of these calculated times is used in the expression of the soft sensor to calculate the temperature in that position. Note that if the position of the soft sensor or the positions of the hard sensors change, it is necessary to determine again the soft sensor model using the described method.

C. Development of the Agent-based Solution
The hard sensors to measure the temperature were deployed in the thin-film sensing surface, being implemented the signal acquisition and conditioning system described in [2]. At the first stage, the sensors are connected to the ZSSC4151 sensor signal conditioner that ensures that the acquired signal is amplified, conditioned and compensated. Then, the conditioned signals from the hard sensors are connected to an ESP32 microcontroller that converts the signal from analog to digital using its embodied 12 bits analog-digital-converter (ADC). The converted data from the ESP 32 microcontrollers are sent, through a Power over Ethernet (PoE) based switch via Ethernet UDP communication, to a data concentrator where the agent-based system is running, in this case a Raspberry Pi (RPI) single board computer that offers the required processing capabilities to run the agents.
The agent-based system for monitoring the temperature in the thin-film sensing surfaces was developed using the FIPAcompliant JAVA Agent Development Framework (JADE) [5]. JADE is a suitable platform for facilitating the development of MAS solutions, offering several functionalities, such as mechanisms for the communication between the agents, yellow pages service for registration and discovery services, and graphical and debug tools. The MAS solution was developed using the Eclipse IDE to facilitate its implementation and debugging. After verifying the correct functioning of the agents' behaviour, a JAR file containing the agents' classes was created and deployed in the RPI.
Hard sensor agents collect the temperature measurements from the associated hard sensors and forward the collected temperature data to the soft sensor agent. For this purpose, the TCP/IP protocol encoded for the FIPA-ACL communication language was used, following the interaction pattern illustrated in Figure 3, and particularly using the FIPA Subscribe interaction protocol. As this process is iterative, for each iteration, the soft sensor agent is endowed with a behaviour to expect the data coming from the hard sensor agents. After receiving the data related to all neighbouring hard sensor agents, the soft sensor agent invokes a service that estimates the temperature value based on the mathematical model obtained offline and described in Section V.B (i.e., the 4th-degree polynomial expression that considers as input the temperature values from the three hard sensors). This service was also deployed in the RPI and implemented using the Python language with the support of the SymPy library, which facilitates the solution of polynomial expressions (i.e., the soft sensor model).
In terms of monitoring, a process control method is implemented in each hard and soft sensor agent, namely the Nelson rules that consider the mean value and the standard deviation to determine if a measured variable is out of control or presents a trend that shows that the variable will be out of control [13]. For this purpose, two rules were implemented: the first detects an outlier in the temperature evolution over the time, being triggered when a value is greater than 3σ, with σ being the standard deviation of the temperature, and the second rule identifies a continuous growth trend in the temperature value, i.e. six successive increasing values in a row.
As aforementioned, the synchronisation of received hard sensor agents data is an important issue to be considered. For this purpose, a cycle time was empirically defined that considers the communication time, the time to estimate the soft sensor parameter, and an extra time to prevent this process from occurring without data loss.

D. Analysis of the Achieved Results
The operation of the developed agent-based sensing system in the industrial environment allowed to observe that the MAS is a suitable approach to implement the network of soft and hard sensors, providing scalability, flexibility and on-thefly reconfigurability to the system. In fact, the agent-based approach provides an infra-structure that supports in an easy and transparent manner the use of complex sensing systems in thin-film surfaces that combines different configurations of hard and soft sensors.
As seen in Figure 6, the estimated temperature values for the soft sensor are close to the real temperature measurement for that position, with an average error of 2.13% and a standard deviation of 0.9828 (maximum error of 8,37% for t = 0,7 seconds). This ensures that the use of soft sensors constitutes a clear alternative to obtain more sampling data in situations that the use of physical sensors are not possible due to cost or technical reasons. Note that this accuracy can be improved if the 5th-degree polynomial expression was used, but degrading the response time.
In terms of cycle time, that defines the minimum time to perform the acquisition of the temperature measurements by the hard sensors and the estimation of the temperature by the soft sensor, the achieved average time is around 233 ms. This value is mainly due to the time necessary to estimate the temperature by the soft sensor agent, that since it was implemented in a decoupled manner, i.e. not embedded in the agent but instead encapsulated as a service, which naturally implies a higher response time. The achieved value may not be suitable for some (hard) time-constrained applications, being in these cases necessary to adopt some practices to reduce this cycle time. The first one is to reduce the degree of the polynomial expression, which leads to shorten the calculation time but implying an higher inaccuracy since the soft sensor model will not describe the sensor behaviour adequately. Another possible practice is to embody the mathematical model directly in the soft sensor agent, which requires to codify the model in the Java programming language. Nevertheless, it is not a straightforward task, as it is not the more suitable programming language to codify the mathematical model. Adopting other languages, such as the C programming language, may generate a piece of code with a lower execution time but it requires to be integrated with the JADE framework.

VI. CONCLUSIONS
In industrial processes, the acquisition of significant amounts of real-time data is crucial to ensure their monitoring and optimisation. Due to technical and/or cost limitations, in some situations it is impossible to adopt the direct measurement strategies, which requires the use of soft sensors to estimate the measurement of a variable through the correlation of the data acquired by the neighbour sensors.
MAS is a suitable approach to face the requirements imposed by these distributed sensing systems based on a network of hard and soft sensors, namely in terms of scalability, e.g., using more or less sensors, and reconfigurability, e.g., considering different positions of the sensors. The adaptation to different sensing configurations is easily addressed by using agent-based solutions, where soft sensor models can be independently developed off-line and deployed in the related soft sensor agents.
This paper describes an agent-based solution to distribute the sensing capabilities combining a diversity of hard and soft sensors. The proposed approach, implemented using the JADE framework, was used to monitor the surface temperature in a mould for a plastic injection process, considering three hard sensors and one soft sensor. The achieved experimental results were promising, namely in terms of robustness, reconfigurability, scalability and accuracy, with an error of approximately 2,13% for the estimation of the soft sensor values. In terms of response time, the achieved cycle time was around 233 ms, mainly due to the need to synchronise the measurements and to estimate the temperature in the soft sensor. In some harder time-constrained applications this value may not be enough and will require to be shorten, e.g., by reducing the degree of the polynomial equation. The use of MAS as infrastructure to distribute the sensing system comprising hard and soft sensors is more relevant as more frequent is the reconfiguration of the sensing system, e.g., the addition of sensors or the modification of the sensors' positions.
Future work is devoted to extend the agent-based model to acquire other parameters, to study the effect of using other polynomial degrees in the mathematical model and to optimise the codification of the soft sensor models.