6. Simulation and analysis

In this section, we have validated our model by drawing a comparison between mathematical results, Monte Carlo simulations, and experimental tests in terms of delay, reliability, and throughput. All experiments are conducted with self-designed motes, each of which features an AT86RF233 amplified ZigBit wireless module and a SAM3S2B microcontroller, both by Atmel. In IEEE802.15.4 standard, aUnitBackoffPeriod is defined as 10 bytes, each of which equals 2 symbols, corresponding to 320 μs in 250 kbps. Ten nodes are positioned in a star topology with beacon-enabled mode. Each node is at the distance of around 20 m from the coordinator, and all nodes are distributed in an area of 1000 m2 .

The impact of the packet generation rate, MAC parameters, and the number of nodes on delay are then evaluated. So as to enhance the reliability of the system, ACK mechanism is activated. The MAC parameters are set according to the standard document [10].

Figure 6 compares the service time, given in the Eq. (52), as a function of various MAC parameters m0, m, and n, obtained from the tagged node (i.e., a node which we perform our evaluations on). The DTM results and Monte Carlo simulations perfectly coincide, and they both predict well the experimental results. As expected, the service time is more sensitive to m0 than m and n. The network becomes unstable, and the buffers are filled if, for a long time, service time is more than 20 ms (horizontal dotted line). Curve fittings are also performed in order to set the optimum parameters in Eqs. (54)–(56):

#### Figure 6.

The average service time as a function of MAC parameters a) m0 = 1, …, 8, mb = 8, b) m = 1, …, 5, n = 0, …, 5, obtained from DTM, Monte Carlo simulations and experimental tests. The curve fitting of the Monte Carlo simulation for optimization is also added. The length of the packet is L = 2, and the number of nodes is N = 10. Experimental tests are acquired out of 10 runs, each 106 aUnitBackoffPeriod.

A Reliable Communication Model Based on IEEE802.15.4 for WSANs in Smart Grids DOI: http://dx.doi.org/10.5772/intechopen.84288

$$\begin{aligned} \text{Service\\_time}(m\_0) &= -0.00402m\_0^7 + 0.12525m\_0^6 - 1.5786m\_0^5 + 10.367m\_0^4\\ &- 37.914m\_0^3 + 77.214m\_0^2 - 78.778m\_0^1 + 34.446 \end{aligned} \tag{54}$$

$$\begin{aligned} \text{Service\\_time}(m) &= -0.018055m^4 + 0.19116m^3\\ &- 0.65661m^2 + 2.5481m^1 + 2.459 \end{aligned} \tag{55}$$

$$\begin{aligned} \text{Service\\_time}(n) &= 0.005356n^5 - 0.092715n^4 \\ &+ 0.65581n^3 - 2.4454n^2 + 4.9795n^1 + 7.7724 \end{aligned} \tag{56}$$

Figure 7 shows the service time's composition as a function of the MAC parameter m and the time period (TP). When TP and m are reduced and increased, respectively, the contribution of failure events in the service time will be highlighted. This leads to the reduction of reliability. In TP = 100 ms, the majority of failure events is due to lack of the ACK packet, but if TP declines to 10 ms, the channel access failure also appears. In Figure 7(c), raising m up to 4 and 5 makes the network unstable (green dashed line).

Figure 8 illustrates reliability which is obtained by Eq. (43) as a function of m0, m, and n. Like service time, DTM and Monte Carlo simulations perfectly coincide, and both of them predict well the experimental results.

#### Figure 7.

The end-to-end delay consists of the service time and the waiting time:

the packet in service (if any).

Research Trends and Challenges in Smart Grids

6. Simulation and analysis

dard document [10].

Figure 6.

90

nodes are distributed in an area of 1000 m2

the optimum parameters in Eqs. (54)–(56):

In which TService is the average service time for the tagged packet and W is the waiting time in the queue. The waiting time is made up of the service times for all of packets in the queue ahead of the tagged packet plus the remaining service time of

In this section, we have validated our model by drawing a comparison between mathematical results, Monte Carlo simulations, and experimental tests in terms of delay, reliability, and throughput. All experiments are conducted with self-designed motes, each of which features an AT86RF233 amplified ZigBit wireless module and a SAM3S2B microcontroller, both by Atmel. In IEEE802.15.4 standard, aUnitBackoffPeriod is defined as 10 bytes, each of which equals 2 symbols, corresponding to 320 μs in 250 kbps. Ten nodes are positioned in a star topology with beacon-enabled mode. Each node is at the distance of around 20 m from the coordinator, and all

. The impact of the packet generation rate, MAC parameters, and the number of nodes on delay are then evaluated. So as to enhance the reliability of the system, ACK mechanism is activated. The MAC parameters are set according to the stan-

Figure 6 compares the service time, given in the Eq. (52), as a function of various MAC parameters m0, m, and n, obtained from the tagged node (i.e., a node which we perform our evaluations on). The DTM results and Monte Carlo simulations perfectly coincide, and they both predict well the experimental results. As expected, the service time is more sensitive to m0 than m and n. The network becomes unstable, and the buffers are filled if, for a long time, service time is more than 20 ms (horizontal dotted line). Curve fittings are also performed in order to set

The average service time as a function of MAC parameters a) m0 = 1, …, 8, mb = 8, b) m = 1, …, 5, n = 0, …, 5, obtained from DTM, Monte Carlo simulations and experimental tests. The curve fitting of the Monte Carlo simulation for optimization is also added. The length of the packet is L = 2, and the number of nodes is N = 10.

Experimental tests are acquired out of 10 runs, each 106 aUnitBackoffPeriod.

D ¼ TService þ W (53)

The service time expected value as a function of MAC parameters m0 = 3, mb = 8, m = 1, …, 5, n = 0. a) Tp = 100ms b) Tp = 20ms c) Tp = 10ms.

#### Figure 8.

Reliability as a function of MAC parameters a) m0 = 0, …, 8, mb = 8, b) m = 1, …, 5, c) n = 0, … 5, obtained by DTM, Monte Carlo simulations, and experimental tests.

Figure 9 depicts the packet transmission service time against the number of nodes for different data generation time periods (note that the waiting time in the queue is ignored in this figure, and it will be evaluated in the following). Changing the input data rate causes large differences in average delay in Park's model [32] (Poisson distribution is considered in Park's model), whereas in DTM model, the average delay does not fluctuate by changing data rate, so it shows a stable behavior which is necessary for Smart Grid. In fact, DTM model is independent of the traffic

A Reliable Communication Model Based on IEEE802.15.4 for WSANs in Smart Grids

DOI: http://dx.doi.org/10.5772/intechopen.84288

Now, the analysis of DTM using probability density function (PDF) of the service time is taken into account. As mentioned in previous sections, whether a node enters the queue or idle states, and also how many states the idle mode has, depends on the PDF's shape. Figure 10 shows changes in PDF against m0. A rise in

Service time's PDF against TP, while m0 = 2, mb = 8, m = 3, n = 2, and N = 4. The length of the packet is L=2. Decline in TP contributes to rise in variance, queue length and peak, average delay, and drop in reliability.

rate.

Figure 11.

93

Average service time against the number of nodes and the data generation period compared to Park's model [32] and RSM model [33]. The length of the packets is L = 2.

Figure 10.

Average service time against the number of nodes and the data generation period compared to Park's model [32] and RSM model [33]. The length of the packets is L = 2.

A Reliable Communication Model Based on IEEE802.15.4 for WSANs in Smart Grids DOI: http://dx.doi.org/10.5772/intechopen.84288

Figure 9 depicts the packet transmission service time against the number of nodes for different data generation time periods (note that the waiting time in the queue is ignored in this figure, and it will be evaluated in the following). Changing the input data rate causes large differences in average delay in Park's model [32] (Poisson distribution is considered in Park's model), whereas in DTM model, the average delay does not fluctuate by changing data rate, so it shows a stable behavior which is necessary for Smart Grid. In fact, DTM model is independent of the traffic rate.

Now, the analysis of DTM using probability density function (PDF) of the service time is taken into account. As mentioned in previous sections, whether a node enters the queue or idle states, and also how many states the idle mode has, depends on the PDF's shape. Figure 10 shows changes in PDF against m0. A rise in

Figure 11.

Service time's PDF against TP, while m0 = 2, mb = 8, m = 3, n = 2, and N = 4. The length of the packet is L=2. Decline in TP contributes to rise in variance, queue length and peak, average delay, and drop in reliability.

Figure 9.

Figure 10.

92

and RSM model [33]. The length of the packets is L = 2.

Research Trends and Challenges in Smart Grids

and RSM model [33]. The length of the packets is L = 2.

Average service time against the number of nodes and the data generation period compared to Park's model [32]

Average service time against the number of nodes and the data generation period compared to Park's model [32]

m0 contributes to an increase in average service time, reliability, and maximum

A Reliable Communication Model Based on IEEE802.15.4 for WSANs in Smart Grids

The maximum value of the service time, which is a critical factor for the average and peak of the queue length, is specified by PDF's variance. The head area in PDF (the range of values where the PDF is relatively high) has a direct relationship with m0. It is also notable that the number of probabilities in the head of PDF equals 2<sup>m</sup><sup>0</sup> . Owing to the uniform distribution of choosing backoff numbers, the slope of the

On the other hand, most of PDF's area is in its head, and due to high reliability, it can be deduced that most of successful transmissions are located in the head area:

The dotted vertical lines, which correspond to average service time, show the expected value of the corresponding PDF. As this line approaches the head of PDF,

Throughput as a function of TP and N, while m0 = 3, mb = 8, m = 3, and n = 1. A comparison is drawn

TsuccessfulP successful ð Þþ TfailureP failure ð Þ P successful ð Þþ P failure ð Þ

(57)

value of service time.

head area is linear.

lim reliability!1

the reliability goes up.

Figure 14.

95

between IEEE802.15.4 and DTM.

E Tð Þ¼ ServiceTime

DOI: http://dx.doi.org/10.5772/intechopen.84288

E Tð Þ¼ ServiceTime Tsuccessful

Figure 12.

Average queue length as a function of TP and the number of nodes, MAC parameters m0 = 3, mb = 8, m = 3, and n = 1. Decreasing TP causes an increase in the average queue length, and intensity growth of it depends on the number of nodes in the network.

Figure 13.

Service time, waiting time, and total delay against TP and N, while m0 = 3, mb = 8, m = 3, and n = 1. The straight black line determines stability boundary. The delay sensitivity to the time period rests greatly upon N.

A Reliable Communication Model Based on IEEE802.15.4 for WSANs in Smart Grids DOI: http://dx.doi.org/10.5772/intechopen.84288

m0 contributes to an increase in average service time, reliability, and maximum value of service time.

The maximum value of the service time, which is a critical factor for the average and peak of the queue length, is specified by PDF's variance. The head area in PDF (the range of values where the PDF is relatively high) has a direct relationship with m0. It is also notable that the number of probabilities in the head of PDF equals 2<sup>m</sup><sup>0</sup> . Owing to the uniform distribution of choosing backoff numbers, the slope of the head area is linear.

On the other hand, most of PDF's area is in its head, and due to high reliability, it can be deduced that most of successful transmissions are located in the head area:

$$E(T\_{ScricTime}) = \frac{\overline{T}\_{successful}P(successful) + \overline{T}\_{failure}P(failure)}{P(successful) + P(failure)}\tag{57}$$
  $\lim\_{reliability \to 1} E(T\_{ScricTime}) = \overline{T}\_{successful}$ 

The dotted vertical lines, which correspond to average service time, show the expected value of the corresponding PDF. As this line approaches the head of PDF, the reliability goes up.

#### Figure 14.

Throughput as a function of TP and N, while m0 = 3, mb = 8, m = 3, and n = 1. A comparison is drawn between IEEE802.15.4 and DTM.

Figure 12.

Figure 13.

94

the number of nodes in the network.

Research Trends and Challenges in Smart Grids

Average queue length as a function of TP and the number of nodes, MAC parameters m0 = 3, mb = 8, m = 3, and n = 1. Decreasing TP causes an increase in the average queue length, and intensity growth of it depends on

Service time, waiting time, and total delay against TP and N, while m0 = 3, mb = 8, m = 3, and n = 1. The straight black line determines stability boundary. The delay sensitivity to the time period rests greatly upon N.

On the other hand, average service time increases, while the line moves to the right of the diagram.

The more distance between the average service time line and PDF's head we have, the less reliability would occur. As long as the average service time approaches TP (the dotted red line approaches the dashed black line), the average queue length and peak will exponentially increase. So as to fulfill a stable condition, the dashed line must be on the right side of the dotted line. The less area on the right side of TP will cause the less queue length average. Hence,TP must be more than the maxi-

A Reliable Communication Model Based on IEEE802.15.4 for WSANs in Smart Grids

Figure 12 illustrates that the velocity of the increase in the average queue length

Up to this point, the waiting and transmission blocks were evaluated separately. It is also essential to appraise the effects of both blocks simultaneously. Figure 13

A drop in TP does not affect greatly the total delay in a sparse network (i.e., N = 5) but in a dense network does. The straight black line in Figure 14 determines the stability boundary, so that all network quiescent points upper this line leads the

The diagram of throughput against TP and N is shown in Figure 14. To specify

Two factors prove contributing to design a buffer, the average length and peak of the queue. Figure 15 illustrates the corresponding queue average length and peak of Figure 14. Deducing from Figure 15, so as to reach the maximum throughput (N = 15,TP = 19.2), a 10 packet length buffer is required in order not to lose any

CPSs, developing rapidly and covering eclectic domains, constitute thriving solutions for Smart Grid, the next-generation power grid systems. In this paper, we proposed a novel analytical model based on Markov chain for the MAC sublayer of IEEE802.15.4 standard. This model can provide a precise QoS to applications in which data generation proves periodic, such as AMI in Smart Grid. This is achieved by supplying the model with a MAC-level buffer and the reconsideration of idle mode. The model can provide QoS by reducing the impact of traffic rate fluctuation and the variation of the number of nodes. We incorporated variable idle state lengths so as to makes our study more pragmatic, and then the overall performance in terms of the end-to-end delay and reliability was evaluated. In this paper, the end-to-end delay refers to the interval between when a packet is generated and when a packet service is accomplished, including the time when in the queue as well as transmission time. We observed that the delay distribution of IEEE802.15.4

depends mainly on the MAC parameters and the collision probability.

Furthermore, using the probability density function of transmission time, we designed an optimum network meeting our QoS requirements. We analyzed the impact of MAC parameters and packet generation rate on the shape of the PDFs. In

the contribution of the queue in throughput, this figure draws a comparison between DTM and IEEE802.15.4 (without buffer). The maximum throughput in DTM (442 packet/s) has considerably increased compared to IEEE802.15.4 (353 packet/s). Furthermore, the way in which throughput rises has changed in DTM. In this simulation, the lower value of throughput corresponds to a network with N = 5 and TP = 27.2 ms for IEEE 802.15.4. An increase in N and TP is responsible for a rise in throughput until a maximum value, in N = 15 and TP = 27.2. The reduction in throughput starts following this point. Nevertheless, the throughput in DTM changes in a dissimilar way, so that the maximum throughput is acquired in N = 15

mum service time to design a system with zero queue length.

shows service time, waiting time, and total delay against TP and N.

depends heavily on the number of nodes.

DOI: http://dx.doi.org/10.5772/intechopen.84288

network to an unstable state.

and TP = 19.2.

7. Conclusion

packets.

97

As Figure 11 shows, a reduction in TP translates into a slight rise in average service time, making the average service time line (dotted red line) far away from PDF's head. As mentioned before, this causes a drop in the reliability. On the other hand, a fall in TP leads to a slight growth of variance. Change in variance causes fluctuation in the queue average and peak.

As inferred from Figure 11, the transition variance from 2.326 to 6.999 makes the queue length and queue peak change from 6.35 <sup>10</sup><sup>8</sup> and 1 to 2.2451 and 23, respectively.

Figure 15. Queue average and peak against TP and N, while m0 = 3, mb = 8, m = 3, and n = 1.

## A Reliable Communication Model Based on IEEE802.15.4 for WSANs in Smart Grids DOI: http://dx.doi.org/10.5772/intechopen.84288

The more distance between the average service time line and PDF's head we have, the less reliability would occur. As long as the average service time approaches TP (the dotted red line approaches the dashed black line), the average queue length and peak will exponentially increase. So as to fulfill a stable condition, the dashed line must be on the right side of the dotted line. The less area on the right side of TP will cause the less queue length average. Hence,TP must be more than the maximum service time to design a system with zero queue length.

Figure 12 illustrates that the velocity of the increase in the average queue length depends heavily on the number of nodes.

Up to this point, the waiting and transmission blocks were evaluated separately. It is also essential to appraise the effects of both blocks simultaneously. Figure 13 shows service time, waiting time, and total delay against TP and N.

A drop in TP does not affect greatly the total delay in a sparse network (i.e., N = 5) but in a dense network does. The straight black line in Figure 14 determines the stability boundary, so that all network quiescent points upper this line leads the network to an unstable state.

The diagram of throughput against TP and N is shown in Figure 14. To specify the contribution of the queue in throughput, this figure draws a comparison between DTM and IEEE802.15.4 (without buffer). The maximum throughput in DTM (442 packet/s) has considerably increased compared to IEEE802.15.4 (353 packet/s). Furthermore, the way in which throughput rises has changed in DTM. In this simulation, the lower value of throughput corresponds to a network with N = 5 and TP = 27.2 ms for IEEE 802.15.4. An increase in N and TP is responsible for a rise in throughput until a maximum value, in N = 15 and TP = 27.2. The reduction in throughput starts following this point. Nevertheless, the throughput in DTM changes in a dissimilar way, so that the maximum throughput is acquired in N = 15 and TP = 19.2.

Two factors prove contributing to design a buffer, the average length and peak of the queue. Figure 15 illustrates the corresponding queue average length and peak of Figure 14. Deducing from Figure 15, so as to reach the maximum throughput (N = 15,TP = 19.2), a 10 packet length buffer is required in order not to lose any packets.
