Modeling of Energy Consumption of Zigbee Devices in Matlab Tool

VOL. 2, NO. 3, SEPTEMBER 2011 Modeling of Energy Consumption of Zigbee Devices in Matlab Tool Milan Simek, Patrik Moravek (xi , yi and zi respective...
2 downloads 3 Views 477KB Size
VOL. 2, NO. 3, SEPTEMBER 2011

Modeling of Energy Consumption of Zigbee Devices in Matlab Tool Milan Simek, Patrik Moravek

(xi , yi and zi respective). An euclidean length di,j between two vertices i, j ∈ V is referred to as E. The network topology is then interpreted by a three/four row matrix, where the 2D/3D position of nodes are stored in individual columns, see 1. Furthermore for a simplicity, only the 2D plane is considered for the simulation.

Abstract—The goal of this paper is to describe processes how to simulate energy consumption of wireless sensor network (WSN) consisting of Zigbee devices during a process of data gathering. We describe tasks such as topology generation and visualization, data routing and communication cost calculation. To estimate lifetime of network, we have proposed the Matlab energy model that goes from the analysis of the real Zigbee network. This paper can also serve as a guide for the researchers that aim to validate proposed algorithms for the WSN in Matlab environment. In this paper, we describe step by step all necessary tasks that must be accomplished for the full operation of the Matlab WSN simulation model. Keywords—wireless sensor networks, simulation, lifetime, Matlab, energy model.

Fig. 1.

Topology Matrix.

I. I NTRODUCTION For the simulations, the networks are considered to be fully connected, meaning that all nodes are reachable due to the multihop communication. The connectivity depends on the radio range, thus the radio range of the nodes should be configured optimally. One can estimate the optimal radio range empirically or to use an Eq. 1 that estimates the minimum radio range ensuring the full connectivity.

This paper introduces a step-by-step implementation of the wireless sensor networking in Matlab environment(particularly Matlab 2007b). It aims to bring detailed directions for under/postgraduate students and researches dealing with the wireless sensor simulation under the Matlab environment. Hence a longterm data gathering is the fundamental task of the wireless sensor networks, we show how to implement all necessary tasks related with the data gathering processes. In the considered simulation, each battery equipped node unicasts in the regular intervals (referred to as rounds of data gathering) a one packet with the defined size. The packets are multihoped through the network to the base station that is power supplied. Simulation ends when there is no path to the base station, meaning that all neighbors of base station are out of energy. The results of the simulation are presented by the colored topology showing the residual energy on each node and a plot of number of alive nodes in the network during increasing number of gathering rounds. The rest of paper is structured as follows: Section I brings the steps of network topology definition. In Section II, we show how to find the shortest path between two nodes in ad-hoc network. An evaluation of communication cost is introduced in Section III, while Section IV describes the proposed energy model. The result of the entire simulation are presented in Section V. The section VI brings the conclusion and future work.

 R=φ

log N N

(1)

The φ parameter stands for a 2D plane diameter directly proportional to the number of nodes N. Calculating the R for the 100 nodes randomly placed in the 2D plane with the 300 meters x 500 meters dimension, the minimal R should be 82 meters. According to the experiences with the Crossbow IRIS 2.4 GHz node [7], the radio range of 82 meters corresponds to the transmitting power of 3.2 dBm. Once the network matrix is created and radio range calculated, the network topology can be printed. The layout of the network consists of the vertices and edges between vertices. The edge or link between two nodes can be printed only in case that the euclidean distance di,j between two nodes i, j is smaller than R of the considered nodes. Since the wireless links are considered to be bidirectional and symmetric then di,j = dj,i . The pseudocode of the layout printing is introduced in more details in the following section. In the real wireless network, a distance between two nodes can be derived from RSSI parameter (Receive Signal Strength Indication) or estimated by methods such as ToA (Time of Arrival) or AoA (Angle of Arrival) [11]. These techniques suffer from the certain distance estimation error and thus this error should be also implemented into the simulation model.

II. N ETWORK T OPOLOGY A network with N nodes can be modeled as a N -vertex undirected graph G = (V = {1, . . . N }), where 2D/3D position p of each vertice i is identified by the set of coordinates pi = M. Simek and Patrik Moravek are with the Department of Telecommunication of Brno University of Technology, Czech Republic, email:[email protected], ).

41

VOL. 2, NO. 3, SEPTEMBER 2011

100 Probability of connectivity [%] →

We consider that range-error of the distance measurement methods has a Gaussian distribution. The range error εr is modeled by the Gaussian distribution with a mean μ = 0 and a standard deviation σ. In contrast to the many current researchers dealing with the range errors modeling, it is considered that σ is spread on the both sides from the μ value. Thus, the distance ri,j measured under the εr can be calculated as shown in Eq. (2). The employed approach expresses situations where the measured signal strength is either strengthened by the interferences or suppressed by walls and obstacles. A decision about adding or subtracting the error portion to the distance should be made randomly.   di,j × εr (2) ri,j = di,j ± 100

80

60

40

20

0

0

2

4

6

8

10 12 14 16 18 20 22 Average node degree [−] →

24

26

28

30

Fig. 1. Probability of connected network for 802.15.4 radio range (redrawn from [4]).

Algorithm: E=createNbrTable 1: row=1; 2: for all node pairs

If some WSN algorithms are to be investigated and theirs performance compared, they should be tested under the identical conditions. Hence, it is recommended to use the identical set of the networks graphs that should have different topologies (grid, random, L-shape, T-shape), scales (ten nodes up to thousands nodes) and node degrees (8 up to 26 neighbors per node). For the storing of all prepared networks, the struct function can be used. %STORE someName=struct(); someName.network(:,:,1)=network_1; save(’file.mat’,’someName’); %LOAD load file.mat; network_1=someName.network(:,:,1);

3:

x=abs(xi -xj );

4:

y=abs(yi -yj );

5:

dist=sqrt(x2 + y 2 );

6:

if disti,j (see Fig. 1). Thus, this node degree range was implemented into the network models so that for each network size N = 50, 100, 400 nodes, ten degrees models were implemented, creating the set of 30 networks with different network size and degrees. This network database together with the demonstration Matlab files can be found in [10].

IDi

IDj

disti,j

1

2

15.65

1

3

9.21

1

8

21.54

2

1

15.65

2 .. .

8 .. .

11.12 .. .

Fig. 2. Pseudocode of layout visualization and E matrix definition. E matrix is illustrated bellow code.

route between two nodes in the graph data structure, a Matlab implementation of Dijkstra’s algorithm can be used. The Dijkstra’s algorithm is implemented within a grShortPath function that is included in grTheory Matlab toolbox [8]. [dSP,spi,j ]=grShortPath(E,IDi ,IDj );

III. ROUTING IN A D H OC N ETWORK

The grShortPath function takes a E matrix of neighbors, source i and destination j node as an input arguments. It returns a dSP matrix with the shortest path between all node pairs in the network. Furthermore, it returns an sp vectors with the nodes constituting the shortest path between nodes i, j. The E matrix must have an exact form for the

The data routing in wireless sensor network is realized on the links comparison base. The considered links between a sender and a receiver can be compared in terms of the length, link quality or residual energy of the node pairs. Nevertheless, the path with the smallest investigated value is selected as the route for the data delivery. For the discovering of the optimal

42

VOL. 2, NO. 3, SEPTEMBER 2011

correct grShortPath algorithm processing. It contains three columns, where the first two columns contains the all nodes in the network that are neighbors of each other and third column contains the euclidean distance in meters between them. The E matrix can be created during the network layout printing, see Fig. 2. As was mentioned before, the link lengths between all node pairs are compared with the uniform radio range R and if the condition di,j < R is accomplished the link is displayed. The E matrix is created within this condition since all required parameters such as IDs of two neighbors and their distance d is known and condition of lengths is accomplished. The context of the E matrix is visualised also in Fig 2. If the link quality or residual energy are to be used instead of the distance between nodes for the route establishment, the information in the third column of E matrix can be substituted by the required information. Then the path between two nodes is selected as the path with the highest quality or path with the maximum energy. Fig. 3 shows results of the described functions. Source file oneRound.m for the WSN routing can be found in [10]. 1

300 50

80 75

y [m] →

46

68

26

39

71

33 29 23

43

3 48 79

11

64

37 70

74

72

65 35

41

54 57 18

30 10

51 69

0

52 5928 15 0

50

100

150

n3

Rxi

Rxi

Rxi Rxi

... induces reception process Rx at all neighbors

Rxi Rxi

Tx3 Rx4

n4

Transmission of one broadcast message induces a multiple receptions of its copy on same node: Ei=ETxi+mi ERxi+1

One transmission process Tx ...

To express the broadcast cost, the WMA (Wireless Multicast Advantage) introduced by Wieselthier et al. [13] was employed. The WMA describes rebroadcasting process as follows: All nodes lying within the communication range of the broadcasting node can receive its transmission. Considering the broadcast transmission where all nodes represent destinations of the demanded message, the communication cost of node ni (see Fig.4 b) ) that rebroadcasts message is affected by the presence of its own neighbors. Meaning that as node ni receives and rebroadcasts the message while consumes ERx + ETx , it also subsequently overhears the communication of all neighbors. This broadcast overhearing process is refereed to as a passive acknowledgment. The energy consumed by the broadcasting nodes can be expressed as:

44

14 17 6249

22

Tx2 m3 x Rx

Txi

Radio Wave symbol explanation

Fig. 4. Estimation of number of messages processed during unicast and broadcast transmissions

8

63 5331 12

47 32

21

13

56

100

ni Rxi

n 03

Relay node forwarding unicast message receives a one copy from the downstream neighbor: Ei=ETxi+2ERxi

55

9 7

50

n2 n 02

5 42

67

19 38

Tx1 m2 x Rx

24

73 6

4

n1

27 76

20

81

150

R

78

58

66 61 36

45

n 01

40 16

2534

200

b) Broadcast cost

a) Unicast cost m1 x Rx

60

77

2 250

studied by Basu and Redi [1]. For the simulation, it is considered to employ a Store-and-Forward mechanism. The nodes receive whole incoming message and after checking the header in the buffer take decision about a further processing. Hence, the energy cost EOx of the overhearing process can equal to the ERx . The n1 spends energy E1 = ETx + ERx . Furthermore, the relaying nodes receive message (1 × ERX ), forward message (1 × ETx ) and overhears the message sent from downstream node (1×EOx ). The energy dissipated by the relaying nodes equals to Erel = ETx + 2ERx . This assumption is implemented into the simulation network model.

200

250 x [m] →

300

350

400

450

500

Fig. 3. Network layout with the highlighted shortest path estimated by the grShortPath function.

Ei = ERx + ETx + (mi − 1)ERx IV. C OMMUNICATION C OST OF DATA G ATHERING

(3)

The (mi − 1) parameter represents a convention that ni overhears the broadcast message from all nodes ∈ Mi , except one which receives message from. The Mi parameter stands for the set of the neighbor nodes of ni . This communication model was used in many recent works such as [12] and [13]. Readers interested in multicast transmissions we reffer to reference [6]. Calculation of the communication cost during a data gathering process can be easily realized by the periodic route establishment from all nodes to the base station and by recording of the message number processed by each node on the each route. The numbers of messages processed can be recorded into the RxTx matrix (see example in Table. II) that can classify the number of messages received, transmitted and overheard. The message processed by node is recorded only in case that given node has a sufficient energy to process it. This

Once the paths from all nodes to the given node representing the base station is known, the number of messages per each node processed during the data gathering can be estimated. Consider line of nodes n1 up to n4 in Fig. 4, where the n1 node initiates the unicast transmission. Given message is propagated to its neighbors due to the omnidirectional nature of the transmission. The desired neighbor n2 receives message, checks the routing information, checks cyclic redundancy (CRC) and forwards this message through the downstream path. As nodes use an omnidirectional antenna, a copy of this message with changed destination address is again received by the initiator node n1 . But at this moment, after the whole message is received, it is discarded since its destination address does not complies with an ID of a demanded node. Node n1 thus overhears the message that was not addressed for it. The overhearing effect in dense sensor networks was detaily

43

VOL. 2, NO. 3, SEPTEMBER 2011

TABLE II R X T X MATRIX ID

1

2

3

...

N

Rx

10

44

6

...

154

Tx

2

56

15

...

89

Ox

15

89

22

...

354

TOTAL

27

189

43

...

597

condition is guaranteed as follows. If node i are to send the message, the shortest route to the base station is established. Subsequently, for each node in the route is launched control mechanism that checks if all nodes has the sufficient energy to perform required task such as transmitting and forwarding (pure receiving process is realized only by the base station that is power supplied). To do so, energy model of message processing is defined and introduced in the following section.

Fig. 5.

Thus, the process time of k size message is equal to tk = (k × 8)/(b × 1000) = 0.38 ms for Data Request message. Then the energy consumed during transmitting ET x equals to: U [V] × I[A] × t[s] = 2.4 V × 17 mA × 0, 32 ms = 15 μJ. Here U parameter stands for a voltage supplement and I parameter stands for the current consumption in Tx(power of 3.2 dBm) mode.

V. E NERGY M ODEL OF M ESSAGE P ROCESSING To define the energy model we have studied a Zigbee specification [9] and supported it with the Zigbee protocol analysis with Daintree Sensor Network Analyzer [3]. The PHY and MAC of Zigbee nodes layers are defined by IEEE 802.15.4 while upper communication layers (NWK and APS layers) are defined by a Zigbee specification. The energy consumption of the certain communication mode such as sleep, idle, receive, transmit is directly proportional to time that given device spent in this mode. Energy consumption of the communication modes can be found in the device datasheets. For the simulation we use the information from Memsic IRIS datasheets [7]. A ATRF230 radio chip implemented in IRIS consumes 8μA in sleep mode, 8 mA in idle mode, 16 mA during Rx and 17 mA in Tx mode. If a node wants to send a message, it turns on the radio chip into the the active mode and before accessing to the medium it waits a random time in units of backoff period and subsequently performs CCA (Clear Channel Assessment). The random number is integer from a range < 0; 2BE − 1 >, whereas the BE value is incremented with each unsuccessful attempt [9]. Then the access time to the wireless medium can be calculated according to Eg. 4 [5]. The CCA detection time is defined as a period of a 8 symbols (16 μs/symbol).

Zigbee NWK (8 B) IEEE 802.15.4 (9 B) Zigbee APS (8 B)

Fig. 6.

InitiallBackof f P eriod + CCA = = (2BE=3 − 1) × U nitBackof f P eriod + CCA = 7 × 320 μs + 128 μs

Estimation of Data Request message size.

Payload (3 B)

FCS (2 B)

Analysis of Zigbee data packet.

When the Data Request message is received by the receiver device, it transits from Rx to Tx mode (192 μs) and sends back ACK message (size of ACK = 5 bytes). Once the ACK is received by the origin node it starts with transmitting of required data. Size of DATA message equals to the size of DATA PAYLOAD (data field) plus necessary OVERHEAD (headers of the APS, NWK, MAC, PHY layers). It was studied by means of the Daintree analyzer that APS and NWK layer add 8 bytes plus 8 bytes and MAC and PHY layer extend the message for 9+2(FCS) bytes, see Fig. 6. Thus the overall size of DATA message with the 3 bytes payload equals to

(4)

= 2.368 ms If the node successfully accesses to the medium, it first sends a Data Request message including ID of the demanded neighbor. The time that device spends in Rx/Tx mode during message processing is derived from the message size and the bitrate [kbps] of the radio chip (b =250 kbps for ATRF230). It was found by the analysis that size of the Data Request message is k =12 bytes, see Fig. 5.

44

VOL. 2, NO. 3, SEPTEMBER 2011

30 bytes. The energy consumption during transmission of 30 bytes message equals to 3.9 mJ. The received data are again acknowledged by the ACK message. It is worthwhile no notice that Zigbee does not specify CCA and CSMA/CA method to applied for ACK messages. For illustration of the entire energy calculation, we assume only active mode to be included in the calculation together with the condition that IRx = IT x . Then the entire energy E consumed by the transmitting device can be derived from the time that it spends in the active mode:

100-81%

81-60%

61-40%

41-20%

< 20%

110

100

90

80

70

y [m] →

60

50

40

ttotal

= (CCA)+(Tx data request)+(Rx/Tx receiver)+

30

+ (Rx ack)+(Rx/Tx sender)+(Tx data)+

20

+ (Rx/Tx receiver)+(Rx ack)=

10 R

= 2.368 + 0.32 + 0.192 + 0.16 + 0.192+

0 0

+ 0.96 + 0.192 + 0.16 = 4.54 ms (5) The entire energy dissipated by the sender radio chip equals to: Esender = 2.4 [V] × 17 [mA] × 4.54 [ms] = 185 μJ. Detailed description of the IEEE 802.15.4 time processing can be found in [5]. In same way, the energy consumption for all nodes in the unicast route can be estimated. However, the energy model should be optimized with the exact current consumption of the Rx and Tx processes, we have showed only simplified calculation.

Fig. 7.

10

20

30 Base station

40

50

60

70

80

90

100

110

x [m] →

Energy map after simulation. 100

percentage of alive nodes [−] →

99

VI. S IMULATION OF DESCRIBED MODEL The introduced model was implemented in the Matlab environment to validate its performance. We have configured a scenario with N = 100 randomly deployed node, where each node had energy storage of 1 J. The data from all nodes is unicasted in rounds meaning that during one round, all nodes unicast data toward the base station (randomly selected node). The residual energy of the nodes should be visualized by the color of nodes. The result of simulation is the energy colored topology and graph of the live nodes number in dependency on the number of rounds. As was mentioned in the Introduction section, the simulation ends when there is no way how to route data to the base station. It means that all one-hop nodes around base station depleted own energy. Results of the simulation are shown in Fig.7 and Fig. 8. One can notice from Fig. 7 that nodes placed close to the base station (placed on the x-axis) are loaded with the enormous network traffic since their residual energy is half in comparison to the far-away nodes. The simulation statistics showed that nodes with one Joule transmitted 2243 messages. We can see from Fig. 8 that network operated more than 160 rounds while the first nodes depleted energy before the 80th round (2243 messages transmitted). From the mentioned implies that with the 1 Joule origin energy, the entire wireless sensor network can transmit maximally 160 measurements.

98 97 96 95 94 93 92 91 90

Fig. 8.

0

20

40

60

80 100 rounds [−] →

120

140

160

180

Percentage of live nodes during simulation.

the guideline for the student and researchers that want to validate in Matlab environment own algorithm proposed for the WSN applications. We have showed how to proposed and visualize WSN topology and how to route data through the multihop paths. We have also proposed energy model that can be used for transformation of the communication cost to the energy consumption. The ideas in proposed energy model were supported by the analysis of the real Zigbee network. We notify, that only simplified energy model was stated here. The nodes spent most of time in the sleep mode and thus the significant attention should be devoted to this factor. ACKNOWLEDGMENT This paper was prepared within the framework of No. FRVS IS18049001 project of the Czech Ministry of Education, Youth and Sports and No. FRTI2/571 grant project of the Ministry of Industry and Trade of the Czech Republic R EFERENCES

VII. C ONCLUSION This paper does not aim to bring the novel results from the wireless sensor networking. Instead it aims to serve as

[1] P. Basu and J. Redi, “Effect of Overhearing Transmissions on Energy Efficiency in Dense Sensor Networks,”

45

VOL. 2, NO. 3, SEPTEMBER 2011

[2]

[3]

[4]

[5] [6]

[7] [8]

[9] [10]

[11]

[12]

[13]

[14]

in IPSN ’04: Proceedings of the 3rd international symposium on Information processing in sensor networks. New York, NY, USA: ACM, 2004, pp. 196–204. C. Bettstetter, “On the Minimum Node Degree and Connectivity of a Wireless Multihop Network,” in MobiHoc ’02: Proceedings of the 3rd ACM international symposium on Mobile ad hoc networking & computing. New York, NY, USA: ACM, 2002, pp. 80–91. Daintree Networks. (2010) Sensor Network Analyzer(SNA)@ONLINE. [Online]. Available: http://www.daintree.net/sna/sna.php J. C. Hou, N. Li, and I. Stojmenovic, “Topology construction and maintanance in wireless sensor networks,” in Handbook of Sensor Networks: Algorithms and Architectures, I. Stojmenovic, Ed. John Wiley and Sons, Sep. 2005, pp. 311–341. Jennic., “Jennic Inc., Calculating 802.15.4 Data Rates,” 2006. M. Koutny, J. Misurec, and P. Mlynek, “The new approaches of a multicasting in the wireless sensor networks,” in 33rd International Conference on TELECOMMUNICATIONS AND SIGNAL PROCESSING TSP 2010. Budapest, Szent Istvn krt. 7.: Asszisztencia Szervezo Kft., 2010, pp. 342–345. Memsic Technology Inc., “IRIS XM2110CA Data Sheet.” [Online]. Available: http://www.memsic.com I. Sergii. (2009) grTheory - Graph Theory Toolbox, MATLAB CENTRAL@ONLINE. [Online]. Available: http://www.mathworks.com/matlabcentral/fileexchange/4266 F. Shanin, Zigbee Wireless Networks and Transceivers. Oxford: Elsevier, 2008. M. Simek. (2010) Low Power Wireless & Sensor Laboratory@ONLINE. [Online]. Available: http://wsnbase.utko.feec.vutbr.cz ——, “Reference Node Selection for Anchor free Localization in Wireless Sensor Networks,” Ph.D. dissertation, Brno University of Technology, Purkynova 118, 612 00, Brno, Czech Republic, September 2010. S. Singh and C. S. Raghavendra, “PAMAS—Power Aware Multi-Access Protocol with Signalling for Ad hoc Networks,” SIGCOMM Comput. Commun. Rev., vol. 28, no. 3, pp. 5–26, 1998. J. E. Wieselthier, G. D. Nguyen, and A. Ephremides, “On the Construction of Energy-Efficient Broadcast and Multicast Trees in Wireless Networks,” in INFOCOM 2000. Nineteenth Annual Joint Conference of the IEEE Computer and Communications Societies. Proceedings. IEEE, vol. 2, 2000, pp. 585–594 vol.2. [Online]. Available: http://dx.doi.org/10.1109/INFCOM.2000.832232 F. Xue and P. R. Kumar, “The Number of Neighbors Needed for Connectivity of Wireless Networks,” Wirel. Netw., vol. 10, no. 2, pp. 169–181, 2004.

46

Suggest Documents