# Intelligent Edge-Cloud Framework for Water Quality Monitoring in Water Distribution System
## 5 Results and Discussion
### Experiment Setting  
In order to develop the proposed framework presented in this work, we use data collected from three different zones in the case study as explained in the network topology. For that, edge servers are implemented using a Constrained Application Protocol (CoAP). CoAP is a constrained application protocol designed for IoT applications. Simplistically, CoAP is a machine-to-machine protocol built based on the request/response client-server paradigm and it is quite similar to HTTP [56]. It also supports the CoAP supports built-in discovery of services and resources. The main features of this protocol are: connectionless, lightweight, RESTful, and has a small 4-byte header. This protocol is used to manage the communication and data transfer between the sensors and edge servers on one side and the edge server and cloud servers on the other side. We have used two different communications technologies to establish the connection between the sensors with the edge servers and edge servers with the cloud  
Figure 8: Architecture for scenario 4.  
server. ZigBee was used to offer the communication bridge between the edge and sensors as they are typically located closer to sensors in a \(\leq\)100 m range. LoRaWAN was used to provide the data from the edge to the cloud that were assumed to be apart from the edge servers with 10 km. More details of these techniques and parameters required are listed in Table 1.  
On the other hand, MLP was built using a sequential model with three layers: The input layer takes the seven water qualities: PH, TOC, temperature, conductivity, chlorine, and pressure. The activation function of this layer is linearly corrected. In this model, two hidden layers were used; the first hidden layer had 10 neurons, and the second hidden layer had 8 neurons; in order to activate both hidden layers, the rectified linear function was used. The output layer uses five classes have been used to represent the outcome (level of contamination) and Softmax used as an activation function. We used the \"Adam\" optimizer, as well as losses and accuracy for measurements. Summarised of all these parameters are presented in Table 2.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Parameters** & **Values** \\ \hline Technology & ZigBee, LoRaWAN \\ \hline Radio Medium & Unit Disk Graph Medium \\ \hline \hline \multicolumn{2}{c}{Note Type} & TmoteSky \\ \hline MAC Layer & CSMA/CA \\ \hline Bandwidth (max) & 250 Kbs, 50 Kbs \\ \hline Payload & 20 Kbps, 1.7 Kbps \\ \hline Transmission Range & 100 m \\ \hline \hline \end{tabular}
\end{table}
Table 1: Communication technologies parameters.  
\begin{table}
\begin{tabular}{l l} \hline \hline
**Hyperparameters** & **Values** \\ \hline Number of layers & 3 \\ \hline Input layer & 7 features as input; ReLU activation function \\ \hline Hidden layer & 2 hidden layers with 10 neurons for 1 st and 8 neurons for 2 nd. \\ \hline Output layer & 5 classes; Softmax as activation function \\ \hline Optimizer and losses & Adam, categorical\_crossentropy and accuracy \\ \hline Others & learning rate: 0.01; epochs: 200; batch size = 128 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Hyperparameters of the MLP model.  
Figure 9: Network topology.