# Improved Performance on Wireless Sensors Network Using Multi-Channel Clustering Hierarchy
## 2 Multi-Channel Clustering Hierarchy (MCCH)
### The Process of Forming a WSN Channel
\begin{table}
\begin{tabular}{l} \hline \hline for k = 1:N  for i = 1:size(clustering_channel(k).node,2) \(p\) = clustering_channel(k).node(i); \(\text{hac(k).ch(i).id = node(p).id;}\) for j = 1:size(clustering_channel(k).node,2) \(\text{hac(k).ch(i).d(j).id = clustering_channel(k).node(j);}\) end end [\(\sim\),index] = sortrows ([hac(k).ch(i).d.dis].’); \(\text{hac(k).ch(i).d= hac(k).ch(i).d(index);}\) clear index end iter = 0; \(\text{x = zeros()}\); for i = 1: size(node,2) if node(i).cent end end y = pdist(x); \(\text{Y = squareform(y)}\); \(\text{z = linkage(y)}\); figure() dendrogram(z) title(strcat(Channel-’, num2 str(k))) D = 0; for i = 1:size(z,1) D = D + z(i,3); end HAC(k).distance = D; sc = size(clustering_channel(k).node,2); F = 0; for i = 1:size(z,1) n1 = z(i,1); n2 = z(i,2); if n1 \(<\) sc & n2 \(<\)= sc \\ F = F + 1;  end end I = inconsistent(z); loss = 0; for i = 1:size(I,1) loss = loss + I(i,4); end end ```
**Algorithm 4**Calculation of the distance between each node and cluster head  
\begin{table}
\begin{tabular}{l} \hline \hline for k = 1:N  for i = 1:size(clustering_channel(k).node,2) \(p\) = clustering_channel(k).node(i); hac(k).ch(i).id = node(p).id; for j = 1:size(clustering_channel(k).node,2) \(\text{hac(k).ch(i).d(j).id = clustering_channel(k).node(j);}\) end end end [\(\sim\),index] = sortrows ([hac(k).ch(i).d.dis].’); hac(k).ch(i).d = hac(k).ch(i).d(index); clear index end iter = 0; x = zeros(); for i = 1:size(node,2) if node(i).cent end end y = pdist(x); Y = squareform(y); z = linkage(y); figure()) dendrogram(z) title(strcat(Channel-’, num2 str(k))) D = 0; for i = 1:size(z,1) D = D + z(i,3); end HAC(k).distance = D; sc = size(clustering_channel(k).node,2); F = 0; for i = 1:size(z,1) n1 = z(i,1); n2 = z(i,2); if n1 \(<\) sc & n2 \(<\)= sc \\ F = F + 1;  end end I = inconsistent(z); loss = 0; for i = 1:size(I,1) loss = loss + I(i,4); end end
```

**Algorithm 5**Calculation of the distance between each node and cluster head

Figure 5 describes the process of grouping member nodes and cluster heads using a single linkage approach by looking for proximity to the cluster head [36]. Table 5 is the final algorithm which is the grouping process between the four cluster heads and cluster members. Figure 6 is a single channel that exists in the current WSN technology. Each node will send data directly to the server/sink which results in a lot of data queues and data density, therefore a WSN protocol with the MCCH method has been developed which can divide the protocol channel so that it can reduce traffic congestion in WSN. Figure 5: Multi-channel grouping process. Figure 6: Single channel WSN. \begin{table}
\begin{tabular}{l} \hline \hline for k = 1:N \\ for i = 1:size(clustering\_channel(k).node,2) \\ end \\ end \\ xx = 1:1:N; \\ for i = 1:N\(-\)1 \\ end \\ title(’Delay’) \\ for i = 1:N\(-\)1 \\ plot (\(\{\)xx(i) xx(i + 1)\(\}\), [HAC(i).throughput HAC(i + 1).throughput) \\ hold on \\ end \\ for i = 1:N\(-\)1 \\ end \\ \hline \hline \end{tabular}
\end{table} 
Table 5: The proces of forming a WSN channel. Table 9 is a node that enters the channel group 4. ## 3 Measurement of WSN Performance Using QoS Parameters

1. Throughput

Throughput is the average speed of data received by a node in a certain observation time interval. Throughput describes the condition of the data rate in a network. The higher the throughput value. \[\text{Troughput}=\frac{\text{number of packet sent}}{\text{package delivery time}}\]

2. Packet Loss

Packet Loss is measured as the percentage of packets lost with respect to packets sent between source to destination nodes. Packet loss occurs when one or more data packets passing through a network fail to reach their destination. \[\text{Packet loss}=\frac{\text{packet experiencing loss}}{\text{package sent}}.\]

3. Delay

Delay is the time it takes to send data. The factor affecting delay is the time it takes the protocol to find a route. \[\text{Delay = delivery time}-\text{acceptance time}.\]

Figure 11: Channel 4 Grouping.