Human machine interface (HMI) based on a multi-agent system in a water purification plant

The applications of multi-agent systems (MAS) are growing increasingly in the industrial field due to the advantages inherent to their characteristics and properties, the use of distributed automation architectures, which have satisfactorily solved control problems that its complexity and dynamic behavior have not been properly resolved with other approaches under these conditions, intelligent agents must meet the requirements of current automation systems, such as autonomy, flexibility, reconfiguration, in concurrent and collaborative systems, which traditionally do not have been designed to satisfy these characteristics. In the present work, a distributed architecture is proposed for the design of an intelligent agent in a Human-Machine Interface (HMI) for the supervision of the filtering stage of a water purification plant, characterized by the ability to collaborate with the other agents that make up the entire plant. For the projection and design of the system, the Unified Modeling Language (UML) and Petri nets (PN) are used for the simulation and validation of the system, and the implementation of the agent from macros in C language, starting from a methodology of multi-agent design that is applied in this document. The implementation of the intelligent agent in an HMI associated with multi-agent architecture, which allowed to evaluate its behavior through the analysis of the properties of the PN and experimental tests, demonstrating the correct operation of the device, response times and its dynamic behavior based on of the functional requirements of the water purification plant and comparisons with similar works.


Introducción
With the advancement of technology and new production requirements, the processes for improving the quality of products or services needs to be optimized [1]. Water purification plants are no exception, where the implementation of smart sensors and other autonomous devices are part of the continuous improvement of these plants, reducing failures and stops generated by damage or unplanned maintenance, which alter the operation of the system. [2,3,4]. For this reason, it is necessary to know each of the phases of the processes that are executed, their synchronization and collaborations. The modeling of the system is essential to define details of implementation, sequence of operations and their interactions, which guarantee compliance with the functional requirements, even more so when

Automation System Analysis
In this section the analysis of the proposed system is carried out, starting from a general architecture of the water treatment plant, to contextualize the functions, roles and collaborations of the Intelligent Agent housed in a Human Machine Interface (A-HMI) within the system. After this phase, the A-HMI analysis is developed, from its description, functional requirements, and the architecture of the agent.

General System Architecture
The general automation architecture of the proposed water purification plant is shown in figure 1, within which the A-HMI is included. The architecture shows the level where the A-HMIs are located within the system, which are designed to be integrated into the intelligent distributed control system, where it is necessary to define a modular design with communication networks from the field level to the level of supervision, to ensure distributed intelligence [19,20]. The communication of the different devices at the control level is based on the Profinet protocol and to satisfy the requirement for intelligent instrumentation at the field level, a MODBUS RTU communication network has been arranged [5]. Figure 1 shows the arrangement of the different devices of the system and their interconnections, made up of programmable automatons (PLC) that execute the intelligent algorithms in the distributed control system and at the lower level are the intelligent sensors. Regarding the supervisory system, two Kinco HMI panels have been arranged, each one of them houses an A-HMI, and they are used to visualize and monitor the dynamic behavior of the filters, the backwash tank, and the wash tank. For the development of advanced automation features, the intelligent supervisory system uses SCADA CODESYS, which is executed from a computer with wireless connectivity.

HMI-based System Analysis.
The analysis of the proposed system considers the different functional requirements, the control architecture of the system, as well as the different actors involved in the control system. These system actors can be a person, group of people or a machine that interacts with the system externally or internally [9]. Next, all the system actors shown in figure 1 are listed, which can be real or virtual: Operator (Op), Plant Manager (JP), Automation Specialist (EA), Decision-making algorithm in the AS-I sensors (ATD-S), Decision-making algorithm in AS-I communications processor (ATD-AS-i), Decision-making algorithm in the programmable logic controller (ATD-PLC) and Decision-making algorithm in the HMI (ATD-HMI). In this last actor, (ATD-HMI), its projection, design and evaluation are analyzed, to establish cooperation with the other actors of the system shown in figure 1, and that they are part of a multi-agent system.

Functional Requirements
Functional requirements are invariable conditions that must be met by different systems or equipment. For example, the functional requirements in the management, supervision and control from the A-HMI are given by: • Manage Users.
• Manage Process Monitoring.
• Manage working modes and desired values of Process parameters.
• Manage historical data In addition to the functional requirements, it is necessary to define the non-functional requirements, which are properties or qualities necessary to guarantee the correct operation of the system to meet its functional requirements [21]. The non-functional requirements of the A-HMI are: • Screen size: Minimum 7 inches of color graphic screen.
• 128 MB of ROM memory and 512 KB of RAM memory.
• Communication via Profinet (Ethernet 10/100 Mbps) Considering the functional and non-functional requirements, and the security requirements, the modular structure of the integrated automation system is proposed, which is shown in figure 2, where the arrangement of the two HMIs of the system and its components can be seen.

Security Requirements
The security requirements were considered in the modular structure of the Integrated Automation System that is illustrated in figure 1 and contribute to guaranteeing the security of the information of the system [22].
• Confidentially, allows only authorized users to access the system.
• Integrity, protects the data against the alteration or corruption of the information.
• Availability, that the design guarantees robustness and enables fault tolerance.

System modeling with UML and Petri Nets
For A-HMI modeling, a design based on a multi-agent system has been considered. This paradigm of agents is being widely used as an approach to modeling control systems and industrial developments, due to the decentralized nature of the problems in these areas [23], and the problems generated by business and manufacturing environments [24,25]. Therefore, for the proposed case study, the use of UML has been considered for the design of the A-HMI. Through this graphic language it is possible to visualize, specify and document each of the parts of the A-HMI design [26,27]. Table 1 presents a description of the monitoring and control use case from the A-HMI and figure 3 shows the use case diagram.

Activity Diagram
UML activity diagrams basically model the flow of activities and can be adapted to object-oriented programming [21]. The use of UML as a tool for system modeling is an important aid in the description of the functional requirements of the system [27,28], although it does not allow describing the dynamics of the process. Next, in figure 4, the activity diagram corresponding to the use case described in section 3.2 is shown.

Sequence Diagram
Sequence diagrams show the interaction of the set of objects or actors involved in the process. This sequence diagram contains the implementation details, including the objects and classes that are used to implement the scenario and the channels of the messages exchanged between the objects [29,30]. Figure  5 shows the sequence diagram of the A-HMI.

Modeling with Petri Nets
Once the A-HMI modeling for the control and supervision of the filtering process subsystems has been developed, the Petri net of the activity diagram is constructed. Petri nets make it possible to determine if the elaborated models are well conceived, for which it is necessary to ensure that they comply with the main functional properties of Petri nets; This will allow to obtain the verified and validated models through simulation. The models in Petri nets (PN) have many properties, of which the properties of Vivacity, Reachability, Limitation and Reversibility have been considered, which guarantee the functionality of the system [18,31]. Figure 6 shows the Petri net of the activity diagram in figure 4, where the Visual Object Net ++ software has been used [20].

Analysis of Results.
Once the modeling in UML and Petri nets has been carried out, the analysis of the obtained models and their influence on the obtained results is carried out. The models elaborated in UML contribute to the design of the A-HMI the characteristics from the approach of each diagram, however, the UML diagrams represent the behavior of the system in a static way, therefore, the translation of the model to Petri nets is necessary to determine the dynamic behavior of the system.
The sequence diagrams have allowed to obtain a general vision of the system, identifying all the functionalities present in the A-HMI [32,33] and the interactions with the actors of the general process and of the A-HMI, considering a time base. The sequence diagrams are generated to determine the objects that are required in the implementation of the A-HMI over time, which clearly defines the roles of the objects in the process flow of the filters of the water purification plant. The activity diagrams represent the dynamic part of the UML, showing the flow of the processes carried out by the A-HMI. In addition, they allow activities to be carried out in parallel or other alternate flows that occur within the activity, thus achieving to define the behavior of the process to be carried out. The graph shown in figure  4 shows is the flow of information between the different screens of the A-HMI and from which the corresponding Petri net was obtained. For reasons of space, the diagrams of each screen and of the sub- processes have not been included, but the general activity diagram establishes the flow that is generated in the A-HMI.
Finally, with the Petri net of figure 6, the behavior of the system is analyzed through validation (compliance with the functional requirements of the system) and verification (compliance with the structural and behavioral properties of the network). The Petri net has been developed in Visual Object Net ++ and PIPE program [34,35,36]. The latter has mathematical analysis tools to evaluate the properties of the Petri net. In the Petri net analysis of the figure 7 the two properties mentioned at the beginning of this section have been considered. The Vivacity property is verified through simulations and allows determining that the networks are kept in continuous movement through the different loops and states of the processes. Additionally, the subroutines have been disactivated and activated so that the system automatically starts executing the selected variant. Through the PIPE software, the invariant equations T (transition) and P (place) are obtained. The solutions of the place invariants have all their elements between zero and one, which means that all the elements of the network belong to sets where the number of tokens is conserved, which is very important from the control point of view automatic since it guarantees, among other aspects, the property of limitation. The transition invariants T also their elements between zero and one, indicating that the number of shots of each transition is finite and different from zero, that it will not remain in an infinite cycle (free of locks) and that they all participate in the entry / exit paths (there are no sources or sinks), which implies the fulfillment of the liveliness of the network. In this way, it is demonstrated that the model complies with the Vivacity property, because the network does not have locks that limit the operation of the network. The reachability property has also been analyzed through simulations in the network, since it is possible to determine that all the states of the network are reached at a certain moment. As in the Vivacity property, subroutines have been disactivated and activated in the process to determine if all the states are reached during the execution of the system. Figure 8 shows the matrices obtained with the PIPE software, where through the matrices for marking and enabling transitions, it is observed that the network is binary and that its states will always be finite or zero in the initial matrix. Using the state space analysis tool, the PIPE software demonstrates that the Petri net is unconstrained, secure, and free of locks, which corroborates the analysis performed in the Visual Object Net ++ software. The implementation of the supervisory system in the A-HMI is carried out using the Kinco HMIware program in its version 2.5, which has an interface to be able to carry out the programming, and depending on the operation of the Petri nets, the necessary windows of the proposed models. In figure 9 you can see the HMI Kinco MT443TE screen, with its development interface the HMIware software, connected through a USB connection, and powered at a voltage of 24 V. Figure 10 corresponds to the user session, the which can access the five options available to the system. Similarly, in the lower right part of the screen, there is the START button, which allows you to return to the initial screen in the system, closing all types of access to prevent other unauthorized actors from entering.

Conclusions
The general modeling of the system using UML for the A-HMI, allows to corroborate the usefulness of the UML modeling to specify, design and document the water filtration system in a precise way, describing its context and defining the functional requirements. In addition, it has made it possible to specify the actors or components, describe the services or use cases and define the relationships between the actors. The use of modeling based on UML-PN for the A-HMI has been used successfully in the projection, design, and modeling of the system, allowing to verify the properties and validate the functional requirements defined for each one of the implemented components, which guarantees the correct simulation of the models, generating stable, functional and robust systems. The architecture proposed for the intelligent supervisory system is a hierarchical modular distributed architecture, which allows the control of the different levels of automation, as well as the command and monitoring of the water filtration process. The implementation of the A-HMI in a Kinco HMI demonstrates the physical operation of the supervisory system, demonstrating its flexibility and modularity, which has been projected from the UML modeling and has been validated and verified through the analysis of the properties of the control networks Petri, concluding that, based on the methodology used, an optimal functioning system can be achieved from the UML-PN modeling.