*3.1. Integrated System Customization*

The general integrated system has been instantiated for a IoT use case scenario in the wastewater treatment domain. To achieve this, it was necessary to carry out tasks including deployment of devices in WWTP, integration with the IoT platform, implementation of data analysis algorithms, and alarm calculation functions, as well as customization of widgets for the representation of information. This section describes the features of the implemented IoT application that allow to visualize the information of the customized system and, therefore, to demonstrate the appropriateness of this smart water quality monitoring and management solution.

Before starting the presentation of the results, it is necessary to mention that eight devices transmit water quality data to the system cloud where it is decoded, stored, and processed (see Section 2.4.1). Therefore, eight thing-type entities (one per device) have been created in the system (see Section 2.3, step 2 of the system initialization process). In the customized system, a thing has four types of

resource: nitrate, nitrite, alarms, and kpis. These resources and the values of their associated attributes, see Section 2.2, become the information of the developed system.

The IoT application provides customized features for online and near-real-time monitoring and management of water quality data associated with the influent and effluent of each WWTP. These customized features are arranged in two levels of dashboard: application and insight. The application level shows the measurements of all devices (things) deployed and their activity, whereas the insight level displays the measurements and activity of a single device. To begin with, the main implemented features of the application dashboard are explained. From this dashboard, it is available the product map to visualize the geographical location of the devices deployed. Figure 7a illustrates the four clusters of devices related to the WWTPs instrumented. Moreover, if one of these clusters is clicked, that area is automatically zoomed. For instance, if the Los Alcázares WWTP cluster is clicked, the two devices deployed in this facility are displayed. Figure 7b shows the thing detail window, which appears if an device on the product map is clicked. The detail window displays the latest nitrate and nitrite concentration values stored in the system as well as the alarms and kpis computed by the HTTP parser and jobs executed on the Cloud Code Sandbox.

**Figure 7.** Product map.

Another widget implemented in the application dashboard is the general table, see Figure 8. This feature provides information about the WSN deployed. Specifically, for a given IoT device, e.g., PortableSensor1, it shows information about the last transmission of the associated device (3 h ago), the latest values of the attributes related to nitrate and nitrite resources (0.52 mg/L and 0.15 mg/L, respectively), the location of the IoT device (Alcantarilla WWTP), and a higher level of detail regarding its deployment (influent final pretreatment).


**Figure 8.** General table. This feature provides information about the Wireless Sensor Network (WSN) deployed.

Figure 9 depicts the implementation of two widgets that simplify the tasks for monitoring and maintenance of the system. The first widget, Figure 9a, shows the alarms associated with all the things. Note that the data shown has been simulated as no alarms were generated during the system test. The second widget is called an actuator as it allows to modify the location (latitude and longitude) and metadata associated with a thing (thing name, thing description, serial number, and other metadata). Figure 9b shows the use of the actuator to set the location and the name associated with the PortableSensor8 thing.

**Figure 9.** Widgets developed to ease monitoring and maintenance tasks.

The IoT application provides different mechanisms implemented to navigate towards the insight dashboard associated with a thing. For instance, this second level of dashboard can be visualized by clicking on a thing name in the general table (see Figure 8) or through the product map detail window (see Figure 7b). The insight dashboard provides a set of customized widgets that display information associated with the thing: metadata, alarms for high levels of nitrate and nitrite, the latest value of nitrate and nitrite concentrations acquired as well as graphs. By default, each graph shows the latest 14 values of at least one resource between nitrate, nitrite, alarms, and kpis. Among these kpis, information is displayed about the average, maximum, minimum, and standard deviation processed at different frequencies (hourly, daily, weekly, and monthly). In addition, it is possible to zoom in and out of the graphs to display a specific range of data representation or to filter by date to visualize or download a certain range of values. Figure 10 depicts a widget layout to monitor water quality in terms of nitrate concentrations of the Los Alcázares WWTP. The water quality data shown in Figure 10 corresponds to

the week from 13 to 19 of May 2019 by the PortableSensor5 and PortableSensor6 devices deployed in the influent (Figure 10a,b) and the effluent (Figure 10c,d) of the plant, respectively. Note that in the current set-up, devices collect data a maximum of three times a day, but a more frequent sampling can be configured remotely.

**Figure 10.** Water quality monitoring of the Los Alcázares WWTP.

Figure 10a,c shows the measurements of nitrate parameter acquired in the influent and effluent during the mentioned time period. In these customized widgets, it is possible to display accurate information about the values by placing the cursor over each point on the graph. In general, the nitrate values obtained in the influent are lower than those of the effluent. This fact can be appreciated in more detail in Figure 10b,d, which illustrate the daily averages of nitrate concentrations for the two measurement sites. Note that the maximum values obtained for the average kpi in the influent and effluent are 0.76 mg/L and 0.96 mg/L, respectively. In both cases, these are low values. Moreover, the weekly average obtained is 0.56 mg/L (influent) and 0.86 mg/L (effluent). These values are far from the alarm threshold of 50 mg/L specified by European regulations [56]. The deployment of the network has been extended in other facilities located around Europe (Spain, Finland, Ireland, and Portugal) showing its scalability and good performance in the collection and processing of data in near-real-time.
