**Effect of Decentralized Clustering Algorithm and Hamming Coding on WSN Lifetime and Throughput**

Nora Ali1, Hany ElSayed1, Magdy El-Soudani1, Hassanein Amer2 and Ramez Daoud3 *1Cairo University, 2American University in Cairo, 3KAMA Trading, Egypt* 

#### **1. Introduction**

Wireless Sensor Networks (WSN) has become an interesting field of research because of its wide range of applications such as environmental monitoring, electromagnetic pollution monitoring, medical applications and industrial applications (Teo et al., 2007; Margi et al., 2009; Castelluccia et al., 2005; AbouElSeoud et al., 2010; Tavares et al., 2008). WSN consists of multi-functioning sensor nodes with limited power capacity, so prolonging the lifetime is essential and is one of the main concerns (Castelluccia et al., 2005; Schmidt et al., 2009; Karlsson et al., 2005).

For this reason different routing protocols are obtained to increase network lifetime. The clustering routing protocol is one of the most commonly routing protocols because it is energy efficient (Heinzelman et al., 2000, 2002). In any clustering protocol, the network is divided into clusters where some nodes are responsible for others. These nodes are called cluster heads (CHs) or network masters (NMs). There are different algorithms and different methods of choosing the CHs. For example, LEACH (Heinzelman et al., 2000) used the randomized rotation to choose CH nodes. This randomized rotation allows some nodes to act as CHs and the others cannot. Therefore LEACH was improved to be LEACH-C (Heinzelman et al., 2002) that uses central algorithm to choose the CHs and allows only the nodes in the center of each cluster to act as CHs.

Also two different algorithms of choosing the NMs are considered in (Botros et al., 2009). The network is considered as one cluster; therefore the CH node that is responsible for collecting data from other nodes is called NM. In the first algorithm, the sensor could become NM more than once for a fixed number of cycles. It was proven that this algorithm provided a lifetime longer than the lifetime obtained by LEACH and LEACH-C algorithms (Heinzelman et al., 2000, 2002). However, this algorithm has some residual energy after the network failure and this energy cannot be used anymore. Therefore, the second algorithm is obtained to improve the first one by allowing each sensor to become NM once with a different number of cycles and acts as an active node or ordinary node (that senses the

Effect of Decentralized Clustering Algorithm

and computing their number of cycles.

and variables shown in Table 1:

Table 1. Network parameters and variables

assuming that the network is divided into *K* clusters.

2. Processing energy for ID comparison (EID):

according to the following equation:

1. Broadcast energy (Ebc):

node.

and Hamming Coding on WSN Lifetime and Throughput 261

of cycles of the CHs in the first rotation. After this first rotation, the role of the sink is over and the responsibility of choosing the next CHs is transferred to the current CHs. This means that the CHs in any rotation are responsible for choosing the CHs of the next rotation

In order to permit the CH to undertake the new responsibilities, some information about the nodes in its cluster (such as the IDs and the remaining energy of each node) must be known. Therefore it will send a broadcast message to all nodes in its cluster. Since the distances between nodes and CHs within a cluster are less than the distances between nodes and the sink, the nodes that are out of the sink range will be within the CH range. All nodes in each cluster will send their information such as IDs and energy levels to the CH. Also, the sink will send the IDs of all nodes that can work as CHs at the end of the first rotation. By using this algorithm, the nodes that were out of the sink range will be active nodes, sense the surroundings and communicate with the CHs which makes the network fully covered. On the other hand, some overhead energy will be consumed by the CHs due the additional responsibility. This overhead energy is explained next according to the network parameters

Parameter Value Number of Sensors (*N*) 100 Initial Energy 2J Transmitter/Receiver Electronics (*Eelec*) 50nJ/bit Transmitter Amplifier for multi path model (*Emp*) 0.0013 pJ/bit/ m4 Transmitter Amplifier for free space model (*Efs*) 10 pJ/bit/ m2 Aggregation Energy (*EDA*) 5 nJ/bit/signal Transmitted Frame Length (*L*) 4000 bits CRC Generator Polynomial Length (*h*) 12 bits

According to the above network paramters and variables, the overhead energy is as follows:

The energy dissipated by the CH in order to inform all the nodes in its cluster about the next CH and to activate the nodes that are out of the sink's range. It is calculated as follows,

where *l* is the number of bits that is transmitted by the CH to declare the next CH and is considered to be equal to 8 bits and *dCH\_N* is the distance from the CH node to any sensor

The processing energy that is dissipated by the CH to compare between the transmitted nodes IDs and the IDs stored in its data base to choose the next CH. It is calculated

2 fs

*<sup>N</sup> E lE d bs <sup>K</sup> CH\_N* (1)

*E NE ID op oper* (2)

surroundings and sends the sensed data to the NM node) till network failure. Using this algorithm increased the lifetime by approximately 5% compared to the first algorithm.

In this chapter, the network is divided into clusters and all the nodes inside each cluster will act as CHs once with a different number of cycles. The optimum number of clusters is obtained taking into account that the algorithm is decentralized, i.e., some nodes cannot reach the sink because their initial energy is too low. Also, the effect of clustering on networks covering large areas and on the applications that do not need data aggregation is examined.

On the other hand, in some important applications such as industrial applications and critical applications such as medical applications (Tavares et al., 2008), lifetime is not the only important factor; receiving all sensor data correctly at the sink might be more important to prevent taking wrong decisions (Margi et al., 2009). But, this is very difficult in noisy environments. Hence Error Correcting Codes (ECC) must be used to improve data integrity (Schmidt et al., 2009). ECC can have an adverse effect on network lifetime due to the processing energy consumed for encoding and decoding.

Therefore, in this work, the Hamming code will be introduced as an example of ECC due to its wide use in sensor networks (Karyonen & Pomalaza-Ráez, 2004; Sadeghi et al., 2006). It will be compared to the Cyclic Redundancy Check (CRC) as an example of a very widely used error detecting technique (Nguyen, 2005). In CRC, the error is only detected and the correction is done by retransmitting data. In contrast, in the Hamming code, the error can be detected and corrected without retransmission. The processing energy for coding will be investigated based on hardware implementations of encoding/decoding circuits. Moreover, a metric that represents a compromise between the lifetime and the amount of correct received data (throughput) will be introduced. The effect of using NM as a repeater is examined to improve network performance. Finally, the effect of using coding in case of fixed data length is investigated. In this research, network lifetime is defined as the time to the first node failure due to battery outage (Botros et al., 2009; Sadeghi et al., 2006).

This chapter is organized as follows. Section 2 describes the decentralized algorithm, the optimum number of clusters using this algorithm and the effect of clustering on networks covering large areas and on the applications that do not need data aggregation. Section 3, describes coding in sensor networks and the processing energy for coding for both Hamming code and CRC. Section 4 describes the simulation results. Section 5 describes the fixed data length scheme and its simulation results. Finally, section 6 concludes the chapter.

#### **2. Decentralized algorithm**

In many WSN applications that cover large areas, some nodes may be out of the sink's range and cannot reach it because the required energy is higher than their initial energy, i.e., a more powerful battery would be needed to reach the sink. According to the technology or the cost, there may be some constrains which prevent increasing the power of the node battery. In such cases, some nodes cannot reach the sink and the sink does not have any information about these nodes. Consequently, these nodes are considered dead and out of range throughout network lifetime and hence the area in question is not fully covered.

Therefore, a new algorithm which is called the *decentralized algorithm* is developed. When applying this algorithm, the nodes that are out of the sink's range, will be in range and operate as active nodes. In the set up phase, the nodes that are in range send their information to the sink that will divide the network into clusters and compute the number

surroundings and sends the sensed data to the NM node) till network failure. Using this algorithm increased the lifetime by approximately 5% compared to the first algorithm. In this chapter, the network is divided into clusters and all the nodes inside each cluster will act as CHs once with a different number of cycles. The optimum number of clusters is obtained taking into account that the algorithm is decentralized, i.e., some nodes cannot reach the sink because their initial energy is too low. Also, the effect of clustering on networks covering large areas and on the applications that do not need data aggregation is examined. On the other hand, in some important applications such as industrial applications and critical applications such as medical applications (Tavares et al., 2008), lifetime is not the only important factor; receiving all sensor data correctly at the sink might be more important to prevent taking wrong decisions (Margi et al., 2009). But, this is very difficult in noisy environments. Hence Error Correcting Codes (ECC) must be used to improve data integrity (Schmidt et al., 2009). ECC can have an adverse effect on network lifetime due to

Therefore, in this work, the Hamming code will be introduced as an example of ECC due to its wide use in sensor networks (Karyonen & Pomalaza-Ráez, 2004; Sadeghi et al., 2006). It will be compared to the Cyclic Redundancy Check (CRC) as an example of a very widely used error detecting technique (Nguyen, 2005). In CRC, the error is only detected and the correction is done by retransmitting data. In contrast, in the Hamming code, the error can be detected and corrected without retransmission. The processing energy for coding will be investigated based on hardware implementations of encoding/decoding circuits. Moreover, a metric that represents a compromise between the lifetime and the amount of correct received data (throughput) will be introduced. The effect of using NM as a repeater is examined to improve network performance. Finally, the effect of using coding in case of fixed data length is investigated. In this research, network lifetime is defined as the time to

the first node failure due to battery outage (Botros et al., 2009; Sadeghi et al., 2006).

This chapter is organized as follows. Section 2 describes the decentralized algorithm, the optimum number of clusters using this algorithm and the effect of clustering on networks covering large areas and on the applications that do not need data aggregation. Section 3, describes coding in sensor networks and the processing energy for coding for both Hamming code and CRC. Section 4 describes the simulation results. Section 5 describes the fixed data length scheme and its simulation results. Finally, section 6 concludes the

In many WSN applications that cover large areas, some nodes may be out of the sink's range and cannot reach it because the required energy is higher than their initial energy, i.e., a more powerful battery would be needed to reach the sink. According to the technology or the cost, there may be some constrains which prevent increasing the power of the node battery. In such cases, some nodes cannot reach the sink and the sink does not have any information about these nodes. Consequently, these nodes are considered dead and out of range throughout network lifetime and hence the area in question is not fully covered. Therefore, a new algorithm which is called the *decentralized algorithm* is developed. When applying this algorithm, the nodes that are out of the sink's range, will be in range and operate as active nodes. In the set up phase, the nodes that are in range send their information to the sink that will divide the network into clusters and compute the number

the processing energy consumed for encoding and decoding.

chapter.

**2. Decentralized algorithm** 

of cycles of the CHs in the first rotation. After this first rotation, the role of the sink is over and the responsibility of choosing the next CHs is transferred to the current CHs. This means that the CHs in any rotation are responsible for choosing the CHs of the next rotation and computing their number of cycles.

In order to permit the CH to undertake the new responsibilities, some information about the nodes in its cluster (such as the IDs and the remaining energy of each node) must be known. Therefore it will send a broadcast message to all nodes in its cluster. Since the distances between nodes and CHs within a cluster are less than the distances between nodes and the sink, the nodes that are out of the sink range will be within the CH range. All nodes in each cluster will send their information such as IDs and energy levels to the CH. Also, the sink will send the IDs of all nodes that can work as CHs at the end of the first rotation. By using this algorithm, the nodes that were out of the sink range will be active nodes, sense the surroundings and communicate with the CHs which makes the network fully covered. On the other hand, some overhead energy will be consumed by the CHs due the additional responsibility. This overhead energy is explained next according to the network parameters and variables shown in Table 1:


Table 1. Network parameters and variables

According to the above network paramters and variables, the overhead energy is as follows: 1. Broadcast energy (Ebc):

The energy dissipated by the CH in order to inform all the nodes in its cluster about the next CH and to activate the nodes that are out of the sink's range. It is calculated as follows, assuming that the network is divided into *K* clusters.

$$E\_{\rm bs} = \frac{N}{K} l E\_{\rm fs} d\_{\rm CH\\_N}^2 \tag{1}$$

where *l* is the number of bits that is transmitted by the CH to declare the next CH and is considered to be equal to 8 bits and *dCH\_N* is the distance from the CH node to any sensor node.

2. Processing energy for ID comparison (EID):

The processing energy that is dissipated by the CH to compare between the transmitted nodes IDs and the IDs stored in its data base to choose the next CH. It is calculated according to the following equation:

$$E\_{\rm ID} = N\_{op} \times E\_{oper} \tag{2}$$

Effect of Decentralized Clustering Algorithm

and Hamming Coding on WSN Lifetime and Throughput 263

*Cycle elec DA ID Cy fs*

*NN M E K LE LE E E lE*

*fs mp Sink elec elec fs*

*N M NN M LE LE d LE l E LE K K K K K*

The optimum number of clusters *Kopt* is obtained by setting the derivative of *ECycle* with

*fs*

4

et al., 2011)), the optimum number of clusters will be simplified as follows:

*opt*

**2.2 Effect of decentralized algorithm on networks covering large areas** 

is (0, -250) and the number of sensor nodes equals 400 nodes and so on)

**Lifetime without clustering** 

Table 2. Lifetime of different network areas using the decentralized algorithm

200m×200m (0, -250) 2600 3 2900 11.5% 300m×300m (0, -375) 1800 3 2200 22.2% 400m×400m (0, -500) 1000 4 1290 29%

**Optimum number of clusters** 

*K*

( ( 1)

*opt*

*K*

respect to *K* to zero and *Kopt* will be as follows:

on lifetime and network coverage.

**The area Sink** 

**location** 

2 2

2

*E NM L l*

 *E E E Ld* 

By ignoring the processing energies *EID* and *ECy* (because they are in the order of 10-14 J (Ali

*E Ld*

It is obvious from the above equation that the optimum number of clusters depends on the network parameters and the network area. Therefore it is more reasonable to investigate the effect of the decentralized algorithm on the networks that cover large areas to see its effect

Lifetime is expected to decrease with increasing the network area. This is because of the large distances between nodes and the sink that prevents a lot of nodes from reaching the sink (require energy more than its initial energy). Consequently, these nodes will be considered as dead nodes with respect to the sink. Therefore, applying the decentralized algorithm on the applications that cover large areas is more reasonable. A MATLAB (Matlab) simulation model is built to study the effect of the decentralized algorithm on networks covering large areas. The lifetime for different network areas is shown in Table 2. Assuming that the number of sensor nodes and the sink location vary according to the network area (For example, the sink location is (0, -125) and the number of sensor nodes equals 100 nodes for a network of 100m×100m. For a network of 200m×200m, sink location

( )

2 4 ( ) *fs*

*E NM L l*

*mp Sink*

*ID Cy mp Sink*

( )

4

*KK K*

2

(10)

**Lifetime** 

**Percentage of increase** 

2

)

(9)

(8)

where *Nop* is the number of binary operations and *Eoper* is the energy per binary operation and is equal to 10-14J according to the new technology (Ali et al., 2011).

3. Processing energy for computations (ECy):

The processing energy that is dissipated by the CH in order to calculate the number of cycles that will be allocated to the next CH. It is calculated in the same manner as the processing energy for ID comparison (*EID*)*.*

4. Announcement energy (Ean):

The energy dissipated by the CH in order to announce the next CH node about its number of cycles. It is calculated as follows:

$$E\_{an} = lE\_{f\mathbf{\hat{s}}}d\_{\mathbf{\hat{C}}H-N}^2\tag{3}$$

#### **2.1 Optimum number of clusters for the decentralized algorithm**

The optimum number of clusters is obtained by minimizing the total energy consumed per cycle. This is because the total energy consumed by the sensor node is the energy consumed per one cycle multiplied by the total number of cycles; this is considered to be the network lifetime. Note that the total energy consumed by the sensor node is almost equal to its initial energy because the remaining energy is very small (close to zero) using the algorithm of (Botors et al., 2009). Therefore, the lifetime is maximized by minimizing the total energy consumed per cycle. This energy depends on the energy consumed by the node when it acts as a CH and when it acts as an active node. Since the nodes cover the entire area under study, the energy consumed by the node when it acts as an active node and CH will be as follows:

$$E\_{active} = E\_{R\chi} + LE\_{elec} + LE\_{f\hat{s}} \frac{M^2}{\pi K} \tag{4}$$

$$E\_{\rm CH} = LE\_{\rm elec} \left(\frac{N}{K} - 1\right) + LE\_{\rm DA} \frac{N}{K} + E\_{\rm ID} + E\_{\rm Cy} + E\_{\rm bs} + E\_{\rm an} + LE\_{\rm mp} d\_{\rm Simk}^4 \tag{5}$$

where *ERx* is the energy dissipated by the active node in order to receive an announcement from the CH.

It is assumed that the network consists of *N* nodes and is divided into *K* clusters with approximately (*N*/*K*) sensors per cluster; therefore, the energy dissipated inside a single cluster during one complete cycle is as follows:

$$E\_{\text{Clustler}} = E\_{\text{CH}} + (\frac{\text{N}}{\text{K}} - 1)E\_{\text{active}} \tag{6}$$

Consequently, the total energy consumed during a single cycle or during transmitting single frame.

$$E\_{\text{Cycle}} = \mathbf{K} \times E\_{\text{Cluster}} \tag{7}$$

By substituting from equations (4), (5) and (6) into (7), the energy consumed in the entire network during a single cycle is as follows:

where *Nop* is the number of binary operations and *Eoper* is the energy per binary operation

The processing energy that is dissipated by the CH in order to calculate the number of cycles that will be allocated to the next CH. It is calculated in the same manner as the

The energy dissipated by the CH in order to announce the next CH node about its number

The optimum number of clusters is obtained by minimizing the total energy consumed per cycle. This is because the total energy consumed by the sensor node is the energy consumed per one cycle multiplied by the total number of cycles; this is considered to be the network lifetime. Note that the total energy consumed by the sensor node is almost equal to its initial energy because the remaining energy is very small (close to zero) using the algorithm of (Botors et al., 2009). Therefore, the lifetime is maximized by minimizing the total energy consumed per cycle. This energy depends on the energy consumed by the node when it acts as a CH and when it acts as an active node. Since the nodes cover the entire area under study, the energy consumed by the node when it acts as an active node and CH will be as

*E E LE LE active Rx elec fs*

*K K*

cluster during one complete cycle is as follows:

network during a single cycle is as follows:

Sink ( 1) *CH elec DA ID Cy bs an mp N N E LE LE E E E E LE d*

where *ERx* is the energy dissipated by the active node in order to receive an announcement

It is assumed that the network consists of *N* nodes and is divided into *K* clusters with approximately (*N*/*K*) sensors per cluster; therefore, the energy dissipated inside a single

> ( 1) *Cluster CH active <sup>N</sup> EE E*

Consequently, the total energy consumed during a single cycle or during transmitting single

By substituting from equations (4), (5) and (6) into (7), the energy consumed in the entire

*K*

<sup>2</sup> *E lE d an fs CH N* (3)

*<sup>M</sup>*<sup>2</sup>

*K* (4)

(5)

4

(6)

*E KE Cycle Cluster* (7)

and is equal to 10-14J according to the new technology (Ali et al., 2011).

**2.1 Optimum number of clusters for the decentralized algorithm** 

3. Processing energy for computations (ECy):

processing energy for ID comparison (*EID*)*.*

4. Announcement energy (Ean):

of cycles. It is calculated as follows:

follows:

from the CH.

frame.

$$\begin{aligned} \text{iE}\_{\text{Cycle}} &= \text{K}\{\text{LE}\_{\text{elec}}\{\frac{\text{N}}{\text{K}} - 1\} + \text{LE}\_{\text{DA}}\frac{\text{N}}{\text{K}} + \text{E}\_{\text{ID}} + \text{E}\_{\text{Cy}} + \text{IE}\_{\text{fs}}\frac{\text{M}^2}{\pi \text{K}} + \\ \text{i}\,\text{LE}\_{\text{fs}}\frac{\text{N}}{\text{K}} \frac{\text{M}^2}{\pi \text{K}} + \text{LE}\_{\text{mp}}d\_{\text{Sink}}^4 + \frac{\text{N}}{\text{K}}\text{LE}\_{\text{elec}} + \text{I}\frac{\text{N}}{\text{K}}\text{E}\_{\text{elec}} + \text{LE}\_{\text{fs}}\frac{\text{M}^2}{\pi \text{K}^2} \} \end{aligned} \tag{8}$$

The optimum number of clusters *Kopt* is obtained by setting the derivative of *ECycle* with respect to *K* to zero and *Kopt* will be as follows:

$$K\_{opt} = \sqrt{\frac{E\_{\circlearrow}L^2(L+l)}{\pi(E\_{ID} + E\_{\circ y} + E\_{mp}Ld\_{Sink}^4)}}\tag{9}$$

By ignoring the processing energies *EID* and *ECy* (because they are in the order of 10-14 J (Ali et al., 2011)), the optimum number of clusters will be simplified as follows:

$$K\_{opt} = \sqrt{\frac{E\_{fs}NM^2(L+l)}{\pi E\_{mp}Ld\_{Sink}^4}}\tag{10}$$

It is obvious from the above equation that the optimum number of clusters depends on the network parameters and the network area. Therefore it is more reasonable to investigate the effect of the decentralized algorithm on the networks that cover large areas to see its effect on lifetime and network coverage.

#### **2.2 Effect of decentralized algorithm on networks covering large areas**

Lifetime is expected to decrease with increasing the network area. This is because of the large distances between nodes and the sink that prevents a lot of nodes from reaching the sink (require energy more than its initial energy). Consequently, these nodes will be considered as dead nodes with respect to the sink. Therefore, applying the decentralized algorithm on the applications that cover large areas is more reasonable. A MATLAB (Matlab) simulation model is built to study the effect of the decentralized algorithm on networks covering large areas. The lifetime for different network areas is shown in Table 2. Assuming that the number of sensor nodes and the sink location vary according to the network area (For example, the sink location is (0, -125) and the number of sensor nodes equals 100 nodes for a network of 100m×100m. For a network of 200m×200m, sink location is (0, -250) and the number of sensor nodes equals 400 nodes and so on)


Table 2. Lifetime of different network areas using the decentralized algorithm

Effect of Decentralized Clustering Algorithm

aggregation using decentralized algorithm.

**3. Coding in sensor network** 

the data once.

length.

the following equation:

**3.1 Processing energy for coding** 

and Hamming Coding on WSN Lifetime and Throughput 265

This equation has no solution since the denominator will always be negative (because the values of the processing energy are very small compared to the energy consumed in reception and transmission, i.e., *E E ID C <sup>y</sup>* is always less than <sup>4</sup> 2*LE LE d elec m <sup>p</sup> Sink* ). Therefore, using clustering technique is not efficient and only one cluster is preferred in case of no data

In the recent years a significant amount of research has focused on the lifetime prolongation which is the main concern in different WSN applications. But, in important and critical applications such as industrial and medical applications, the throughput may be more important (Margi et al., 2009). Therefore, in this part, it is assumed that the CH collects data from all sensors and sends it to the sink and only one cluster is considered because it was proved in the previous section that the clustering technique was not efficient in case of no data aggregation. Therefore, the CH will be called the network master (NM). But in noisy environments, data received at the sink may be corrupted by noise and wrong decisions may be made. In order to guarantee data integrity at the sink, Error Correcting Codes (ECC) are used. In this work, the use of the Hamming code is considered with different rates. Also, the Hamming code is compared to the CRC which is the most commonly used error detecting technique (Nguyen, 2005). With CRC, correction is attempted by retransmission of

Also, the metric that compromises between the throughput and the lifetime is introduced. The metric is called Information per Joule (*IPJ*). It is defined as the overall throughput during network lifetime (*Tp*) divided by the total energy consumption (*Eall*) as explained in

*all*

*i j*

The throughput represents the amount of information that can correctly reach the sink

(1 )

where *r* is the code rate, *Cj* is the number of cycles allocated to NM and *BER* is the Bit Error Rate and is defined as the amount of error in the received frames divided by the total frame

It is assumed in this work that the coding and decoding processes are part of the sensor hardware architecture. The processing energy is assumed to be the number of binary operations multiplied by the energy per binary operation (Karlsson et al., 2005). The binary operation is defined as the exclusive-or of two bits and the energy per binary operation is

*Tp BER L r C*

during the lifetime. It is calculated according to the following equation:

1 1

*j i i j*

 

*N N*

*Tp IPJ <sup>E</sup>* (15)

(16)

The table shows that the clustering technique improves the lifetime for the different network areas especially in larger network areas. This is because, as the network area increases, the number of sensors that cannot reach the sink increases; this increases the efficiency of the decentralized algorithm. On the other hand, a large increase in the network area will lead to a slight increase in lifetime (for example for 500m×500m area the lifetime increased by approximately 17.5%) because some clusters will have a lot of nodes that cannot act as CHs and the nodes that will act as CHs will operate for a small number of cycles due to the large communication distance from nodes to the sink. The simulation is also run for a small network area (100m×100m) and it is found that the lifetime is increased by only 5%. This means that the clustering with decentralized algorithm is not efficient on small network area because all nodes can reach the sink.

#### **2.3 Effect of decentralized algorithm in case of no data aggregation**

In some applications such as environmental mentoring and industrial applications, data of each and every sensor is important. This means that data cannot be aggregated and the CH collects data from the nodes and sends it as is to the sink without aggregation. Therefore, the decentralized clustering algorithm is investigated in case of no data aggregation and the energy dissipated by the CH and the total energy dissipated inside the network during single cycle will be as follows:

$$E\_{\rm CH} = 2LE\_{elec}(\frac{N}{K} - 1) + E\_{\rm ID} + E\_{\rm Cy} + E\_{\rm bs} + E\_{\rm an} + LE\_{mp}(\frac{N}{K} - 1)d\_{\rm Simk}^4 \tag{11}$$

Keeping the energy of a node when it acts as an active node the same as in the case of data aggregation (because in both cases, it senses the surroundings and sends the data to the CH node), the energy dissipated in one cluster will be as follows:

$$\begin{aligned} E\_{\text{Cluster}} &= 2LE\_{\text{elec}} \left( \frac{N}{K} - 1 \right) + E\_{\text{ID}} + E\_{\text{Cy}} + lE\_{fs} \frac{M^2}{\pi \mathcal{K}} + lE\_{fs} \frac{N}{K} \frac{M^2}{\pi \mathcal{K}} \\ &+ LE\_{\text{mp}} (\frac{N}{K} - 1) d\_{\text{Sink}}^4 + \frac{N}{K} LE\_{\text{elec}} + l \frac{N}{K} E\_{\text{elec}} + LE\_{fs} N \frac{M^2}{\pi \mathcal{K}^2} \end{aligned} \tag{12}$$

And the total energy dissipated inside the network during one complete cycle will be as follows:

$$\begin{aligned} \mathbf{E\_{Cylel}} &= 2L E\_{elec} (\mathbf{N} - \mathbf{K}) + L E\_{mp} (\mathbf{N} - \mathbf{K}) d\_{Sink}^4 + K E\_{ID} + K E\_{\rm Cy} \\ &+ l E\_{\rm f5} \frac{M^2}{\pi} (\mathbf{1} + \frac{\mathbf{N}}{K}) + E\_{elec} N (L + l) + L E\_{\rm f5} N \frac{M^2}{\pi K} \end{aligned} \tag{13}$$

By setting the derivative of *ECycle* with respect to *K* to zero to obtain the optimum number of clusters, *K2* will be as follows:

$$K^2 = \frac{\left(\frac{N}{\pi}E\_{fs}M^2(l+L)\right)}{E\_{ID} + E\_{\text{Cy}} - \left(2LE\_{elec} + LE\_{mp}d\_{Sink}^4\right)}\tag{14}$$

This equation has no solution since the denominator will always be negative (because the values of the processing energy are very small compared to the energy consumed in reception and transmission, i.e., *E E ID C <sup>y</sup>* is always less than <sup>4</sup> 2*LE LE d elec m <sup>p</sup> Sink* ). Therefore, using clustering technique is not efficient and only one cluster is preferred in case of no data aggregation using decentralized algorithm.

#### **3. Coding in sensor network**

264 Cutting Edge Research in New Technologies

The table shows that the clustering technique improves the lifetime for the different network areas especially in larger network areas. This is because, as the network area increases, the number of sensors that cannot reach the sink increases; this increases the efficiency of the decentralized algorithm. On the other hand, a large increase in the network area will lead to a slight increase in lifetime (for example for 500m×500m area the lifetime increased by approximately 17.5%) because some clusters will have a lot of nodes that cannot act as CHs and the nodes that will act as CHs will operate for a small number of cycles due to the large communication distance from nodes to the sink. The simulation is also run for a small network area (100m×100m) and it is found that the lifetime is increased by only 5%. This means that the clustering with decentralized algorithm is not efficient on small network area

In some applications such as environmental mentoring and industrial applications, data of each and every sensor is important. This means that data cannot be aggregated and the CH collects data from the nodes and sends it as is to the sink without aggregation. Therefore, the decentralized clustering algorithm is investigated in case of no data aggregation and the energy dissipated by the CH and the total energy dissipated inside the network during

> <sup>4</sup> 2 ( 1) ( 1) *CH elec ID Cy bs an mp Sink N N E LE E E E E LE d*

Keeping the energy of a node when it acts as an active node the same as in the case of data aggregation (because in both cases, it senses the surroundings and sends the data to the CH

*Cluster elec ID Cy fs fs*

*N NN M LE d LE l E LE N K KK K*

> 2 2 2( ) ( )

*<sup>N</sup> M NM E LE E E lE lE*

And the total energy dissipated inside the network during one complete cycle will be as

*Cycle elec mp Sink ID Cy*

*K K*

By setting the derivative of *ECycle* with respect to *K* to zero to obtain the optimum number of

*fs*

*E E LE LE d*

2

(2 )

( ( ))

*<sup>N</sup> EM l L*

*ID Cy elec mp Sink*

*E LE N K LE N K d KE KE*

*mp Sink elec elec fs*

(1 ) ( )

*fs elec fs*

*M N <sup>M</sup> lE E N L l LE N*

*K K*

(11)

*K K KK*

4

 

4

2 2

2

(12)

(13)

(14)

2

**2.3 Effect of decentralized algorithm in case of no data aggregation** 

node), the energy dissipated in one cluster will be as follows:

( 1)

2

*K*

4

2 ( 1)

because all nodes can reach the sink.

single cycle will be as follows:

clusters, *K2* will be as follows:

follows:

In the recent years a significant amount of research has focused on the lifetime prolongation which is the main concern in different WSN applications. But, in important and critical applications such as industrial and medical applications, the throughput may be more important (Margi et al., 2009). Therefore, in this part, it is assumed that the CH collects data from all sensors and sends it to the sink and only one cluster is considered because it was proved in the previous section that the clustering technique was not efficient in case of no data aggregation. Therefore, the CH will be called the network master (NM). But in noisy environments, data received at the sink may be corrupted by noise and wrong decisions may be made. In order to guarantee data integrity at the sink, Error Correcting Codes (ECC) are used. In this work, the use of the Hamming code is considered with different rates. Also, the Hamming code is compared to the CRC which is the most commonly used error detecting technique (Nguyen, 2005). With CRC, correction is attempted by retransmission of the data once.

Also, the metric that compromises between the throughput and the lifetime is introduced. The metric is called Information per Joule (*IPJ*). It is defined as the overall throughput during network lifetime (*Tp*) divided by the total energy consumption (*Eall*) as explained in the following equation:

$$\text{IPJ} = \frac{\text{Tp}}{\text{E}\_{all}} \tag{15}$$

The throughput represents the amount of information that can correctly reach the sink during the lifetime. It is calculated according to the following equation:

$$Tp = \sum\_{j=1}^{N} \sum\_{i=1 \atop i \neq j}^{N} (1 - BER\_i) \times L \times r \times C\_j \tag{16}$$

where *r* is the code rate, *Cj* is the number of cycles allocated to NM and *BER* is the Bit Error Rate and is defined as the amount of error in the received frames divided by the total frame length.

#### **3.1 Processing energy for coding**

It is assumed in this work that the coding and decoding processes are part of the sensor hardware architecture. The processing energy is assumed to be the number of binary operations multiplied by the energy per binary operation (Karlsson et al., 2005). The binary operation is defined as the exclusive-or of two bits and the energy per binary operation is

Effect of Decentralized Clustering Algorithm

Hamming code and CRC is as follows:

**3.2 Network assumptions** 

only occurs once.

Hamming Code:

for *j N* 1,2, ,

for *j N* 1,2, ,

where

*j i*

CRC:

and Hamming Coding on WSN Lifetime and Throughput 267

At any time instant, the network consists of sensors that sense the surroundings and an NM that collects the sensed data and forwards it to the sink. This means that there are two noisy communication channels: one from sensors to the NM and the other from the NM to the sink. The following assumptions are made regarding applying error correcting or detecting techniques in the sensor network. For the Hamming code, sensors encode the data and send it to the NM that decodes then re-encodes the data again before sending it to the sink. For the CRC, sensors compute the CRC check bits and send the coded data to the NM that decodes it; if an error is detected, the NM will request retransmission. The NM decodes the retransmitted data and if no errors are detected it sends it to the sink. However, if any frame error is detected, the NM will discard the frame because, it is assumed that retransmission

According to these assumptions, the energy consumed by the sensor node for both

1

(22)

(23)

(25)

*EE L rx elec* (27)

*d* is the distance from NM*j* to the sink,

sink *<sup>j</sup> <sup>p</sup> E E LE Ld tx elec amp* (26)

*<sup>p</sup> E E LE Ld tx NM elec amp tx NM* (28)

(24)

1 ( ) *<sup>j</sup> <sup>j</sup> j i N sensor j NM i enc tx NM i E CE C E E* 

11 1 1

11 1 1 *<sup>j</sup> NN N N NM rx enc dec tx ii i i E EE E E* 

1

*N sensor j NM i CRC tx NM i E C E C E mE* 

1 ( ) *<sup>j</sup> <sup>j</sup> j i*

1 11

*NN S NM rx CRC tx j jj E mEmE E* 

1 11

*j i j i*

where *p* is the path loss factor (for example, it equals 2 for the free space model), *S1* is the

*dtx NM* is the distance between a sensor and the NM and *Cj* is the number of Cycles

*j*

number of corrected frames received by the NM, sink *<sup>j</sup>*

allocated to NM*j* and it is calculated according to the following relation:

the energy consumed in processing of a two-input Exclusive-Or (XOR) gate. It is assumed in this work that the design of the XOR gate is based on static CMOS which is commonly used in sensor networks (Teo et al., 2007, Enz et al., 2004). The energy per binary operation (*Eoper*) depends on the fabrication technology (Hempstead et al., 2006, Ragini et al., 2009). The following values: 10-10, 10-12 and 10-14J respectively will be used (from older to newer technology).

#### **3.1.1 Hamming code processing energy**

The number of binary operations in the encoder circuit is equivalent to the number of twoinput XOR gates in the parity tree. The decoder contains two circuits, one for error detection and the other for error correction (Fu & Ampadu, 2010). The processing energy for encoding (*Eenc*) and decoding (*Edec*) will be as follows:

$$E\_{enc} = \left[ (k - 2) \times (n - k) \times N\_c \right] \times E\_{oper} + E\_{cth} \tag{17}$$

$$E\_{dec} = E\_{syndrrome} + E\_{correction} + E\_{oh} \tag{18}$$

$$E\_{symdrome} = \left[ (k-2) \times (n-k) \times N\_c + (n-k) \times N\_c \right] \times E\_{open} \tag{19}$$

$$E\_{correction} = \left[k \times (n - k - 1) \times N\_c + k \times N\_c\right] \times E\_{open} \tag{20}$$

where *k* is the information block length, *n* is the codeword length, *Nc* is the number of codewords in the transmitted frame and *Eoh* is the overhead energy due to the sensor's microprocessor instructions execution.

#### **3.1.2 CRC processing energy**

A 12-bit CRC is used since it is more suitable for the assumed frame length (for simplicity, it is assumed to be 2048 bits instead of 4000 bits) (Nguyen, 2005). The implementation of CRC using XOR operations is obtained. The processing energy for CRC encoding or decoding is the same and consists of the following steps:


These steps are repeated until a remainder of length equal to the length of the used polynomial (12 bits) is reached. This final remainder represents the CRC check bits that are included in the transmitted frame. Consequently, the processing energy for CRC encoding or decoding according to these steps is as follows:

$$E\_{CRC} = \{\sum\_{i=0}^{L-2h} (L - h - i)\} \times E\_{oper} + E\_{oh} \tag{21}$$

where *h* is the generator polynomial length.

#### **3.2 Network assumptions**

266 Cutting Edge Research in New Technologies

the energy consumed in processing of a two-input Exclusive-Or (XOR) gate. It is assumed in this work that the design of the XOR gate is based on static CMOS which is commonly used in sensor networks (Teo et al., 2007, Enz et al., 2004). The energy per binary operation (*Eoper*) depends on the fabrication technology (Hempstead et al., 2006, Ragini et al., 2009). The following values: 10-10, 10-12 and 10-14J respectively will be used (from older to newer

The number of binary operations in the encoder circuit is equivalent to the number of twoinput XOR gates in the parity tree. The decoder contains two circuits, one for error detection and the other for error correction (Fu & Ampadu, 2010). The processing energy for encoding

[ ( 1) ] *E k nk N kN E correction c coper* (20)

where *k* is the information block length, *n* is the codeword length, *Nc* is the number of codewords in the transmitted frame and *Eoh* is the overhead energy due to the sensor's

A 12-bit CRC is used since it is more suitable for the assumed frame length (for simplicity, it is assumed to be 2048 bits instead of 4000 bits) (Nguyen, 2005). The implementation of CRC using XOR operations is obtained. The processing energy for CRC encoding or decoding is

7. Ignoring the most significant zeros in the output vector because they represent the

These steps are repeated until a remainder of length equal to the length of the used polynomial (12 bits) is reached. This final remainder represents the CRC check bits that are included in the transmitted frame. Consequently, the processing energy for CRC encoding

5. Zero padding the polynomial vector to have the same length of data.

2

*L h*

0

*i*

( ( ))

*E Lhi E E*

*CRC oper oh*

6. Exclusive-ORing the output vector and the data vector.

8. Exclusive-ORing the remainder and the polynomial vector.

[( 2) ( ) ] *E k nk N E E enc c oper oh* (17)

[( 2) ( ) ( ) ] *E k nk N nk N E syndrome <sup>c</sup> c oper* (19)

*EE E E dec s yndrome correction oh* (18)

(21)

technology).

**3.1.1 Hamming code processing energy** 

(*Eenc*) and decoding (*Edec*) will be as follows:

microprocessor instructions execution.

the same and consists of the following steps:

or decoding according to these steps is as follows:

where *h* is the generator polynomial length.

**3.1.2 CRC processing energy** 

quotient.

At any time instant, the network consists of sensors that sense the surroundings and an NM that collects the sensed data and forwards it to the sink. This means that there are two noisy communication channels: one from sensors to the NM and the other from the NM to the sink. The following assumptions are made regarding applying error correcting or detecting techniques in the sensor network. For the Hamming code, sensors encode the data and send it to the NM that decodes then re-encodes the data again before sending it to the sink. For the CRC, sensors compute the CRC check bits and send the coded data to the NM that decodes it; if an error is detected, the NM will request retransmission. The NM decodes the retransmitted data and if no errors are detected it sends it to the sink. However, if any frame error is detected, the NM will discard the frame because, it is assumed that retransmission only occurs once.

According to these assumptions, the energy consumed by the sensor node for both Hamming code and CRC is as follows:

Hamming Code:

$$E\_{sensor\_j} = \mathbf{C}\_j \times E\_{NM\_j} + \sum\_{i=1}^{N-1} \mathbf{C}\_i \times \left( E\_{enc} + E\_{tx\_j - NM\_i} \right) \tag{22}$$

$$E\_{\rm NM\_j} = \sum\_{i=1}^{N-1} E\_{\rm rx} + \sum\_{i=1}^{N-1} E\_{\rm enc} + \sum\_{i=1}^{N-1} E\_{\rm dec} + \sum\_{i=1}^{N-1} E\_{\rm tx} \tag{23}$$

for *j N* 1,2, , CRC:

$$E\_{\text{sensor}\_j} = \mathbf{C}\_j \times E\_{\text{NM}\_j} + \sum\_{i=1}^{N-1} \mathbf{C}\_i \times \left( E\_{\text{CRC}} + m E\_{\text{tx}\_j - \text{NM}\_i} \right) \tag{24}$$

$$E\_{\rm NM\_j} = m \sum\_{j=1}^{N-1} E\_{\rm rx} + m \sum\_{j=1}^{N-1} E\_{\rm CRC} + \sum\_{j=1}^{S1} E\_{\rm rx} \tag{25}$$

for *j N* 1,2, , where

$$E\_{\rm tx} = E\_{\rm elec} \times L + E\_{amp} \times L \times d\_{\rm sink\_j}^p \tag{26}$$

$$E\_{rx} = E\_{elec} \times L \tag{27}$$

$$E\_{tx\_j - NM\_i} = E\_{elec} \times L + E\_{amp} \times L \times d\_{tx\_j - NM\_i}^p \tag{28}$$

where *p* is the path loss factor (for example, it equals 2 for the free space model), *S1* is the number of corrected frames received by the NM, sink *<sup>j</sup> d* is the distance from NM*j* to the sink, *j i dtx NM* is the distance between a sensor and the NM and *Cj* is the number of Cycles allocated to NM*j* and it is calculated according to the following relation:

Effect of Decentralized Clustering Algorithm

on network performance.

0

1.4

1.6

1.8

2

**Information per Joule (IPJ)**

2.2

2.4

2.6

2.8 x 106

Fig. 1. IPJ of Hamming code and CRC at different *Eoper*

Fig. 2. IPJ of Hamming code in case of NM as a repeater

0.5

1

1.5

Information per Joule (IPJ)

2

2.5

3 x 106

and Hamming Coding on WSN Lifetime and Throughput 269

The IPJ is obtained at *Eoper* = 10-10 J, because at this value, the processing of coding has a noticeable effect on the lifetime and the IPJ. It is observed from the figure that some degradation of the IPJ in case of Rayleigh fading channel occurs in both lengths of Hamming as a result of the large number of errors added from the fading, which has an adverse effect

0 1 2 3 4 5 6 7 8 9

(7,4) Hamming at Eoper = 10 fJ (63,57) Hamming at Eoper = 100 pJ

CRC at Eoper = 10fJ

SNR (dB)

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> <sup>6</sup> <sup>7</sup> <sup>8</sup> <sup>9</sup> 1.2

**SNR (dB)**

Hamming (7,4), NM decodes and encodes Hamming (63, 57), NM decodes and encodes

Hamming (63, 57), NM repeater Hamming (7, 4), NM repeater

*<sup>i</sup> E E sensor initial* (29)

for *i N* 1,2, ,

where *Einitial* is the sensor node initial energy.

#### **4. Simulation results and analysis**

Simulations are run using MATLAB to study the effect of using error correction/detection techniques on the lifetime and the IPJ in case of additive white Gaussian noise (AWGN) channel. Assuming an area of 100m×100m for simplicity, Table 3 shows the values of the lifetime in cycles for CRC and Hamming code at different values of *Eoper* and SNR. The values prove that the Hamming code has a very low effect on network lifetime. It produces almost the same lifetime of a system without coding (uncoded system) which is equal to 2950 cycles (the lifetime is reduced in case of no data aggregation). In contrast, CRC decreases the lifetime by 37.3% compared to the uncoded system at *Eope*r = *10-10J* due to its high processing energy.

The other important metric is the IPJ. Fig. 1 shows the IPJ for the used Hamming codes and the CRC at different energy per binary operation. It is found that the IPJ of Hamming (63, 57) outperforms the IPJ of both Hamming (7, 4) and CRC. It is also noticed that the IPJ of Hamming (63, 57) at the lowest SNR and highest *Eoper* is higher than the IPJ of CRC and Hamming (7, 4) at highest SNR and lowest *Eop*er. Therefore, it is better to use the long Hamming code.

To improve network performance, another method is investigated in which the NM acts as a repeater or a relay that collects data from sensors and forwards it to the sink without decoding or encoding to reduce the processing energy at the NM. MATLAB simulations indicate that the lifetime for both Hamming lengths will increase and become almost equal to the lifetime of the uncoded system. Also the IPJ is slightly improved as shown in Fig. 2. The figure shows that using the NM as a repeater is more suitable for high rate Hamming codes lengths especially at low SNR.


Table 3. Lifetime at different *Eoper* 

On the other hand, it is more reasonable to consider Rayleigh fading channel in the wireless communications channels (Karyonen & Pomalaza-Ráez, 2004). Slow fading is considered in this work due to the small size of the area under study (100m100m). The same two lengths of Hamming are examined in case of AWGN channel with Rayleigh fading (Rayleigh fading channel). The fading channel adds a large amount of errors to the data which decreases the probability of finding a single error in long codeword lengths such as a codeword of length 63. However, the overall IPJ of Hamming (63, 57) is higher than the IPJ of Hamming (7, 4) as shown in Fig. 3, due to its higher code rate. The figure shows the IPJ over the AWGN channel and the Rayleigh fading channel of the used low rate and high rate Hamming code.

Simulations are run using MATLAB to study the effect of using error correction/detection techniques on the lifetime and the IPJ in case of additive white Gaussian noise (AWGN) channel. Assuming an area of 100m×100m for simplicity, Table 3 shows the values of the lifetime in cycles for CRC and Hamming code at different values of *Eoper* and SNR. The values prove that the Hamming code has a very low effect on network lifetime. It produces almost the same lifetime of a system without coding (uncoded system) which is equal to 2950 cycles (the lifetime is reduced in case of no data aggregation). In contrast, CRC decreases the lifetime by 37.3% compared to the uncoded system at *Eope*r = *10-10J* due to its

The other important metric is the IPJ. Fig. 1 shows the IPJ for the used Hamming codes and the CRC at different energy per binary operation. It is found that the IPJ of Hamming (63, 57) outperforms the IPJ of both Hamming (7, 4) and CRC. It is also noticed that the IPJ of Hamming (63, 57) at the lowest SNR and highest *Eoper* is higher than the IPJ of CRC and Hamming (7, 4) at highest SNR and lowest *Eop*er. Therefore, it is better to use the long

To improve network performance, another method is investigated in which the NM acts as a repeater or a relay that collects data from sensors and forwards it to the sink without decoding or encoding to reduce the processing energy at the NM. MATLAB simulations indicate that the lifetime for both Hamming lengths will increase and become almost equal to the lifetime of the uncoded system. Also the IPJ is slightly improved as shown in Fig. 2. The figure shows that using the NM as a repeater is more suitable for high rate Hamming

CRC (low SNR) 1250 2080 2110 CRC (high SNR) 1850 2900 2930 (7, 4) Hamming 2940 2945 2945 (63, 57) Hamming 2925 2945 2945

On the other hand, it is more reasonable to consider Rayleigh fading channel in the wireless communications channels (Karyonen & Pomalaza-Ráez, 2004). Slow fading is considered in this work due to the small size of the area under study (100m100m). The same two lengths of Hamming are examined in case of AWGN channel with Rayleigh fading (Rayleigh fading channel). The fading channel adds a large amount of errors to the data which decreases the probability of finding a single error in long codeword lengths such as a codeword of length 63. However, the overall IPJ of Hamming (63, 57) is higher than the IPJ of Hamming (7, 4) as shown in Fig. 3, due to its higher code rate. The figure shows the IPJ over the AWGN channel and the Rayleigh fading channel of the used low rate and high rate Hamming code.

**Energy per binary operation (***Eoper***) 1010J 1012J 1014J**

for *i N* 1,2, ,

high processing energy.

codes lengths especially at low SNR.

**Error Detection & Correction Techniques** 

Table 3. Lifetime at different *Eoper* 

Hamming code.

where *Einitial* is the sensor node initial energy.

**4. Simulation results and analysis** 

*<sup>i</sup> E E sensor initial* (29)

The IPJ is obtained at *Eoper* = 10-10 J, because at this value, the processing of coding has a noticeable effect on the lifetime and the IPJ. It is observed from the figure that some degradation of the IPJ in case of Rayleigh fading channel occurs in both lengths of Hamming as a result of the large number of errors added from the fading, which has an adverse effect on network performance.

Fig. 1. IPJ of Hamming code and CRC at different *Eoper*

Fig. 2. IPJ of Hamming code in case of NM as a repeater

Effect of Decentralized Clustering Algorithm

in Fig. 4.

and Hamming Coding on WSN Lifetime and Throughput 271

<sup>1</sup> *tx <sup>K</sup> K n*

The figure shows that the IPJ of Hamming (63, 57) outperforms the IPJ of Hamming (7, 4). The rationale behind this result is investigated and it is found that the low rate code such as the Hamming (7, 4) adds a large amount of parity which increases the transmitted energy and has an adverse effect on the lifetime. In contrast, the high rate code such as the Hamming (63, 57) adds a small amount of parity which does not strongly affect the

Table 4 shows the values of lifetime (in cycles) at different energy per operation. It is found that the lifetime of the Hamming (7, 4) is lower than the lifetime of the Hamming (63, 57) by about 33% at *Eoper* =10-10J. This because of the difference in the amount of energy consumed

Eoper = 100 pJ

0 1 2 3 4 5 6 7 8 9

SNR(dB)

This difference in lifetime causes the IPJ over the lifetime of the Hamming (63, 57) to outperform the IPJ of the Hamming (7, 4). Therefore, the high rate Hamming is more suitable in sensor networks than the low rate Hamming irrespective of the application and the transmitting scheme used by the sensor node (transmitting fixed frame or fixed data). Simulations show that this scheme will not change the result in the case of Rayleigh channel.

transmitted energy. Consequently it does not affect the lifetime.

for transmission for both Hamming lengths.

1.4

Fig. 4. Lifetime at different energy per binary operation (*Eoper*)

1.6

1.8

2

2.2

Information per Joule (IPJ)

2.4

2.6

2.8 x 106

Simulations are run to study the effect of using this scheme on the overall network performance. The IPJ for Hamming (7, 4) and (63, 57) over AWGN at *Eoper* = 1010J are shown

*<sup>k</sup>* (33)

(7,4) Hamming (63,57) Hamming

Fig. 3. IPJ of Hamming code over AWGN and Rayliegh fading channel

#### **5. Fixed data length scheme**

All the previous results were based on transmitting a frame of fixed length by all sensors with an amount of data that varies according the code rate. Consequently, all the sensor nodes consume the same amount of transmitted energy and have approximately the same lifetime. On the other hand, in some applications such as environmental monitoring, the sensor collects a fixed amount of data. The sensor can have a fixed amount of data and sends a frame of variable length according to the coding technique used. This length will depend on the amount of added parity by the coding technique. Therefore, in this section, it is assumed that all sensors have a fixed amount of data of length 2048 bits and transmit a frame of length that varies according to the amount of added parity. Consequently, the amount of energy consumed by any sensor node and an NM will change due to variations in transmitting and receiving energy as follows:

$$E\_{rx} = E\_{elec} \times K\_{tx} \tag{50}$$

$$E\_{\rm tx} = E\_{\rm elec} \times K\_{\rm tx} + E\_{\rm amp} \times K\_{\rm tx} \times d\_{\rm sink\_j}^p \tag{31}$$

$$E\_{\text{tx}\_{j}-\text{NM}\_{i}} = E\_{\text{elec}} \times K\_{1} + E\_{\text{amp}} \times K\_{\text{tx}} \times d\_{\text{tx}\_{j}-\text{NM}\_{i}}^{p} \tag{32}$$

where *K1* is the data length that equals to 2048 bit and *Ktx* is the frame length and is calculated according to the following equation:

2.8 x 106 **Eoper = 100 pJ**

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> <sup>6</sup> <sup>7</sup> <sup>8</sup> <sup>9</sup> 1.2

Hamming (7, 4) over AWGN

Hamming (7, 4) over Rayleigh Fading Hamming (63, 57) over AWGN

Hamming (63, 57) over Rayliegh Fading

*EE K rx elec tx* (30)

sink *<sup>j</sup> <sup>p</sup> EE KE Kd tx elec tx amp tx* (31)

*<sup>p</sup> E E KE K d tx NM elec amp tx tx NM* (32)

**SNR (dB)**

All the previous results were based on transmitting a frame of fixed length by all sensors with an amount of data that varies according the code rate. Consequently, all the sensor nodes consume the same amount of transmitted energy and have approximately the same lifetime. On the other hand, in some applications such as environmental monitoring, the sensor collects a fixed amount of data. The sensor can have a fixed amount of data and sends a frame of variable length according to the coding technique used. This length will depend on the amount of added parity by the coding technique. Therefore, in this section, it is assumed that all sensors have a fixed amount of data of length 2048 bits and transmit a frame of length that varies according to the amount of added parity. Consequently, the amount of energy consumed by any sensor node and an NM will change due to variations

1 *j i j i*

where *K1* is the data length that equals to 2048 bit and *Ktx* is the frame length and is

Fig. 3. IPJ of Hamming code over AWGN and Rayliegh fading channel

1.4

**5. Fixed data length scheme** 

in transmitting and receiving energy as follows:

calculated according to the following equation:

1.6

1.8

2

**Information per Joule (IPJ)**

2.2

2.4

2.6

$$K\_{tx} = \frac{K\_1}{k} \times n \tag{33}$$

Simulations are run to study the effect of using this scheme on the overall network performance. The IPJ for Hamming (7, 4) and (63, 57) over AWGN at *Eoper* = 1010J are shown in Fig. 4.

The figure shows that the IPJ of Hamming (63, 57) outperforms the IPJ of Hamming (7, 4).

The rationale behind this result is investigated and it is found that the low rate code such as the Hamming (7, 4) adds a large amount of parity which increases the transmitted energy and has an adverse effect on the lifetime. In contrast, the high rate code such as the Hamming (63, 57) adds a small amount of parity which does not strongly affect the transmitted energy. Consequently it does not affect the lifetime.

Table 4 shows the values of lifetime (in cycles) at different energy per operation. It is found that the lifetime of the Hamming (7, 4) is lower than the lifetime of the Hamming (63, 57) by about 33% at *Eoper* =10-10J. This because of the difference in the amount of energy consumed for transmission for both Hamming lengths.

Fig. 4. Lifetime at different energy per binary operation (*Eoper*)

This difference in lifetime causes the IPJ over the lifetime of the Hamming (63, 57) to outperform the IPJ of the Hamming (7, 4). Therefore, the high rate Hamming is more suitable in sensor networks than the low rate Hamming irrespective of the application and the transmitting scheme used by the sensor node (transmitting fixed frame or fixed data). Simulations show that this scheme will not change the result in the case of Rayleigh channel.

Effect of Decentralized Clustering Algorithm

September 2009.

*ETFA*, Bilbao-Spain, September 2010.

*Techniques*, vol. 4, no. 3, May 2010.

Stockholm-Sweden, May 2005.

MatLab, Official Site of MatLab: www.mathworks.com

Brazil, April 2009.

2009.

*Wireless Communications*, vol. 1, no.4, October 2002.

*Mechatronics ICM*, Istanbul, Turkey, April 2011.

**7. References** 

and Hamming Coding on WSN Lifetime and Throughput 273

AbouElSeoud, D.; Nouh, S.; Abbas, R.; Ali, N.; Daoud, R.; Amer, H. & ElSayed, H. (2010).

Ali, N.; ElSayed, H.; El-Soudani, M. & Amer, H. (2010). Effect of Hamming Coding on WSN

Botros, S.; ElSayed, H.; Amer, H. & El-Soudani, M. (2009). Lifetime Optimization in

Castelluccia, C.; Mykletun, E. & and Tsudik, G. (2005). Efficient Aggregation of Encrypted

Enz, C.; El-Hoiydi, A.; Decotignie, J. & Peiris, V. (2004). WiseNET: An Ultra-Low-Power

Fu, B. & Ampadu, P. (2010). Error Control Combining Hamming and Product Codes for

Heinzelman, W.; Chandrakasan, A. & Balakrishnan, H. (2000). Energy- Efficient Routing

Hempstead, M.; Wei, G. & Brooks, D. (2006). Architecture and Circuit Techniques for Low

Karlsson, P.; Oberg, L. & Xu, Y. (2005). An Address Coding Scheme for Wireless Sensor

Karyonen, H. & Pomalaza-Ráez, C. (2004). Coding for Energy Efficient Multihop Wireless Networks, *Proceedings of the Nordic Radio Symposium*, Oulu-Finland, August 2004. Margi, B; de Oliveira, B.; de Sousa, G.; Simplicio, M.; Freitasy, F.; Barretoy, P.; Carvalhoy, T.;

Nguyen, G. (2005). Error-Detection Codes: Algorithms and Fast Implementation, *IEEE* 

Ragini, K. & Madhavi, D. (2009). Ultra-Low-Power digital Logic Circuits in Sub-threshold

*Transactions on Computers*, pp. 1-11, vol. 54, no. 1, January 2005.

*Embedded Systems CASES*, pp. 368-378, Seoul-Korea, October 2006.

*Systems Conference MOBIQUITOUS*, San Diego-CA-USA, July 2005.

Monitoring Electromagnetic Pollution using Wireless Sensor Networks, *Proceedings of the 15th International Conference on Emerging Technologies and Factory Automation* 

Lifetime and Throughput, *Proceedings of the IEEE International Conference on* 

Hierarchical Wireless Sensor Networks, *Proceedings of the 14th International Conference on Emerging Technologies and Factory Automation ETFA*, Mallorca-Spain,

Data in Wireless Sensor Networks, *Proccedings of ACM /IEEE Mobile and Ubiquitous* 

Wireless Sensor Network Solution, *IEEE Computer Society Press*, USA, August 2004.

Energy Efficient Nanoscale on-chip Interconnects, *IET Computers & Digital* 

Protocols for Wireless Microsensor Networks, *Proceedings of the 33rd Hawaii International Conference on System Sciences HICSS*, Maui, HI, USA, January 2000. Heinzelman, W.; Chandrakasan, A. & Balakrishnan, H. (2002). An Application Specific

Protocol Architecture for Wireless Micro Sensor Networks, *IEEE Transactions on* 

Throughput, Energy Constrained Systems Across Technology Generations, *Proceedings of the International Conference on Compilers, Architecture, and Synthesis for* 

Networks, *Proceedings of the 5th Scandinavian Workshop on Wireless Ad-hoc Networks*,

Näslundz, M. & Goldz, R. (2009). Demo: Security Mechanisms Impact and Feasibility on Wireless Sensor Networks Applications, *Proceedings of the IEEE International Conference on Computer Communications INFOCOM*, Rio de Janeiro-

for Biomedical Applications, *Journal of Theoretical and Applied Information Technology*,


Table 4. Lifetime at Different *Eoper* for fixed data length scheme

#### **6. Conclusion**

Different clustering algorithms and routing protocols were examined for prolonging the lifetime such as LEACH and LEACH-C. This chapter focuses on increasing network lifetime by dividing the network into clusters and making each node inside the cluster acts as a Cluster Head (CH) only once. The Decentralized algorithm is developed and studied in this chapter and it is found that the optimum number of clusters will depend on the algorithm of choosing the CHs. The effect of the decentralized algorithm on networks covering large areas is investigated. It is found that clustering is more efficient for large networks. Also, the proposed clustering algorithm is examined for applications that do not need data aggregation. Results prove that the clustering will be inefficient in case of no data aggregation and only one cluster is preferred. Also, network throughput is an important factor in case of no data aggregation; therefore error detecting and correcting codes are used to improve data integrity and the whole network is considered as one cluster. The Hamming code with different rates is used to improve network throughput and compared to CRC. It is found that the Hamming code with different lengths provides longer lifetime than CRC due to its lower processing and higher IPJ due to its higher throughput. It is also observed that the Hamming code has a negligible effect on lifetime compared to the uncoded system.

These results are taken a step further by examining different lengths of Hamming codes. It is observed that a Hamming code of length 63 is more suitable in sensor networks than that of length 7. This means that the high rate Hamming can provide a higher IPJ at low SNR than the low rate Hamming. The system is also investigated when the NM acts as a repeater or relay that collects data from sensors and forwards it to the sink without decoding or encoding. It is observed that this technique increases the IPJ for high rate code at low SNR. It also increases the lifetime because of the reduction in processing at the NM.

The effect of Rayleigh fading channel was also investigated. The results showed that the IPJ of the high rate Hamming is still higher than the low rate Hamming; even though the low rate Hamming improves the BER and makes the IPJ of the fading channel close to the IPJ of the AWGN channel.

Finally, a fixed data length scheme is examined to generalize the results for different applications that do not require data aggregation. The results of using this scheme show that the lifetime and the IPJ of the high rate Hamming codes are higher than the lifetime and the IPJ of the low rate Hamming codes. Therefore, the proposed hardware implementation of the high rate Hamming code will be one of the preferred solutions in sensor networks with different transmitting schemes and applications.

#### **7. References**

272 Cutting Edge Research in New Technologies

(7, 4) 1780 1779 1775

(63, 57) 2695 2688 2675

Different clustering algorithms and routing protocols were examined for prolonging the lifetime such as LEACH and LEACH-C. This chapter focuses on increasing network lifetime by dividing the network into clusters and making each node inside the cluster acts as a Cluster Head (CH) only once. The Decentralized algorithm is developed and studied in this chapter and it is found that the optimum number of clusters will depend on the algorithm of choosing the CHs. The effect of the decentralized algorithm on networks covering large areas is investigated. It is found that clustering is more efficient for large networks. Also, the proposed clustering algorithm is examined for applications that do not need data aggregation. Results prove that the clustering will be inefficient in case of no data aggregation and only one cluster is preferred. Also, network throughput is an important factor in case of no data aggregation; therefore error detecting and correcting codes are used to improve data integrity and the whole network is considered as one cluster. The Hamming code with different rates is used to improve network throughput and compared to CRC. It is found that the Hamming code with different lengths provides longer lifetime than CRC due to its lower processing and higher IPJ due to its higher throughput. It is also observed that the Hamming code has a negligible effect

These results are taken a step further by examining different lengths of Hamming codes. It is observed that a Hamming code of length 63 is more suitable in sensor networks than that of length 7. This means that the high rate Hamming can provide a higher IPJ at low SNR than the low rate Hamming. The system is also investigated when the NM acts as a repeater or relay that collects data from sensors and forwards it to the sink without decoding or encoding. It is observed that this technique increases the IPJ for high rate code at low SNR. It

The effect of Rayleigh fading channel was also investigated. The results showed that the IPJ of the high rate Hamming is still higher than the low rate Hamming; even though the low rate Hamming improves the BER and makes the IPJ of the fading channel close to the IPJ of

Finally, a fixed data length scheme is examined to generalize the results for different applications that do not require data aggregation. The results of using this scheme show that the lifetime and the IPJ of the high rate Hamming codes are higher than the lifetime and the IPJ of the low rate Hamming codes. Therefore, the proposed hardware implementation of the high rate Hamming code will be one of the preferred solutions in sensor networks with

also increases the lifetime because of the reduction in processing at the NM.

**Energy per Binary Operation** *Eoper* **1014J 1012J 1010J** 

**Hamming length** 

on lifetime compared to the uncoded system.

different transmitting schemes and applications.

**6. Conclusion** 

the AWGN channel.

Table 4. Lifetime at Different *Eoper* for fixed data length scheme


**Part 5** 

**Neural Networks** 


**Part 5** 

**Neural Networks** 

274 Cutting Edge Research in New Technologies

Sadeghi, N.; Howard, S. & Kasnavi, S. (2006). Analysis of Error Control Code use in Ultra–

Tavares, J.; Velez, F. & Ferro, J. (2008). Application of Wireless Sensor Networks to Automobiles", *Measurement Science Review*, pp. 65-70, vol. 8, no. 3, 2008. Teo, T.; Lim, G.; David, D.; Tan, K.; Gopalakrishnan, P. & Singh, R. (2007). Ultra Low-Power

*Symposium on Circuits and Systems ISCAS*, New Orleans-LA-USA, May 2007.

*Conference DATE*, Nice-France, April 2009.

Low–Power Wireless Sensor Networks, *Proceedings of the International Symposium on Circuits and Systems ISCAS*, pp. 3558-3561, Island of Kos-Greece, September 2006. Schmidt, D.; Berning, M. & When. N. (2009). Error Correction in Single-Hop Wireless Sensor

Networks - A case study, *Proceedings of the Design, Automation and Test in Europe* 

Sensor Node for Wireless Health Monitoring System, *Proceedings of the International* 

**13** 

Domen Verber *University of Maribor* 

*Slovenia* 

**Networks with CUDA** 

**Implementation of Massive Artificial Neural** 

People have always been amazed with the inner-workings of the human brain. The brain is capable of solving variety of problems that are unsolvable by any computers. Is capable of detecting minute changes of light, sound or smell. It is capable of instantly recognizing a face, to accurately read the handwritten text, etc. The brain is the centre of what we call human intelligence and self-awareness. This is not limited only to the human brain. A bee, for example, has a brain that is only a fraction the size compared to the human brain. Nevertheless, the bee able of detecting nectar over long distances; it is capable to orient itself in space and find its way back to the beehive, and it is capable of transferring the

information about nectar locations to other bees though a well-choreographed dance.

recognition, visual and speech processing, in medicine, in business, etc.

The basic unit of the nervous system is the neuron. A group of neurons build a neuronal network. In general, a neural network is a parallel system, capable of resolving problems that linear-computing cannot. Neural nets are used for signal processing, pattern

The techniques of the neural networks are a part of a machine-learning paradigm. Using this, a system should find solutions for certain problems based only on empirical data, using unknown underlying probability distribution. In addition to this, a vast number of research has been done in the field of artificial neural networks, in order to better understand the human brain, itself. For example, in the Blue Brain Project, the goal is to reconstruct the brain piece by piece and build a virtual brain within supercomputer (BBP, 2011). This approach tries to emulate the human brain very accurately, and requires considerable computing power. Each simulated neuron requires the equivalent of a laptop computer. Several programming libraries and tools exists, which allow for building artificial neural networks of moderate sizes. In addition, several experiments have been where the neurons

This exposure presents a study how to use massive parallel programming on general PCs for artificial neural networks (ANN), which utilizes the processing power and highly parallel computer architectures of graphic processor units (GPU). GPUs on mass-market graphical cards may greatly outperform general processors for some type of applications, both in computation power and in memory bandwidth. The graphic processor consists of a large number of processing cores that may perform a large number of tasks, in parallel. The execution of artificial neural networks is an intrinsically parallel problem. Therefore, parallel

**1. Introduction** 

are emulated within hardware.
