3.1 Deterministic traffic model

In this section, we present a novel model inspired by the Park's model in [16]. There are several deficiencies in Park's model where the author has not considered any buffers; consequently, it was not an accurate and appropriate model for saturated networks. Another problem is that a node remained in idle states for a definite period of L0, even if a new packet is ready for transmission. Despite of a solution proposed in [33], it is not thorough enough to solve the problem precisely. By modifying the queue as well as idle states and obviating the aforementioned downsides, we have accomplished a perfect model, namely, deterministic traffic model (DTM), illustrated in Figure 2.

3.1.1 Waiting block

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

time.

Figure 3.

81

and the (key) random variable u is shown.

(Tp) and the y-intercept = 1).

consider Wn as waiting time:

un is a (key) random variable, defined as

In the proposed waiting block, idle states consist of variable number of states. The number of the states is determined by the service time, data generation period, and the previous status of buffer. The details of this model come under scrutiny in the following. The queue system is modeled on the D/G/1 FIFO queue. In Kendall notation, D/G/1 FIFO denotes that data packets are generated through a determin-

Monte Carlo algorithm and experimental results demonstrate that the service time distribution consists in the MAC parameters such as MacMinBE, MacMaxCS-MABackoffs, and MacMaxFrameRetries, Lp and TP. Changing these parameters effects a change in the shape of service time distribution, in a way that the resulting distribution is similar to none of common probability distributions. Therefore, to be more precise and albeit complicated, general distribution is considered for service

In order to derivate waiting block equations such as the idle mode probabilities

un ¼ Tservice,n � Tp (1)

(2)

and waiting time in the queue, we consider a scenario illustrated in Figure 3. Assume a periodic sequence of arriving packets with Cn notation. Its probability density function (pdf) is simple impulsive (with the x-intercept = the time period

In a stable network, the expectation value of un needs to be negative. Also

wnþ<sup>1</sup> <sup>¼</sup> wn <sup>þ</sup> un if wn <sup>þ</sup> un <sup>≥</sup> <sup>0</sup>

The term wn + un is the sum of unfinished work (wn) found by Cn plus the service time (Tservice,n) less than Tp. The negative value of this term represents that

Time diagram for a scenario, in which a periodic sequence of packets arrives, and queue status, waiting time

0 if wn þ un ≤ 0

istic distribution, while the service time distribution is general [39, 40].

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

DTM provides two main blocks: transmission and waiting blocks. Packets can experience success or failure in the transmission block. Failure of packets occurs on the account of channel access failure or lack of receiving acknowledgment. The possibility of every event depends on various parameters, such as the number of nodes in the network, packet length, data generation time period, and MAC parameters.

In our proposed model, waiting block, including idle and queue states, has been added to resolve the weak points of the previous models.

As mentioned before, a wide range of models has been designed based on Poisson traffic distribution. While in monitoring applications like Smart Grid, data are generated in a deterministic manner, persuading us to develop DTM.

Figure 2. Proposed deterministic traffic model (DTM).

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

#### 3.1.1 Waiting block

3.1 Deterministic traffic model

Research Trends and Challenges in Smart Grids

(DTM), illustrated in Figure 2.

parameters.

Figure 2.

80

Proposed deterministic traffic model (DTM).

In this section, we present a novel model inspired by the Park's model in [16]. There are several deficiencies in Park's model where the author has not considered any buffers; consequently, it was not an accurate and appropriate model for saturated networks. Another problem is that a node remained in idle states for a definite period of L0, even if a new packet is ready for transmission. Despite of a solution proposed in [33], it is not thorough enough to solve the problem precisely. By modifying the queue as well as idle states and obviating the aforementioned downsides, we have accomplished a perfect model, namely, deterministic traffic model

DTM provides two main blocks: transmission and waiting blocks. Packets can experience success or failure in the transmission block. Failure of packets occurs on the account of channel access failure or lack of receiving acknowledgment. The possibility of every event depends on various parameters, such as the number of nodes in the network, packet length, data generation time period, and MAC

In our proposed model, waiting block, including idle and queue states, has been

As mentioned before, a wide range of models has been designed based on Poisson traffic distribution. While in monitoring applications like Smart Grid, data

are generated in a deterministic manner, persuading us to develop DTM.

added to resolve the weak points of the previous models.

In the proposed waiting block, idle states consist of variable number of states. The number of the states is determined by the service time, data generation period, and the previous status of buffer. The details of this model come under scrutiny in the following. The queue system is modeled on the D/G/1 FIFO queue. In Kendall notation, D/G/1 FIFO denotes that data packets are generated through a deterministic distribution, while the service time distribution is general [39, 40].

Monte Carlo algorithm and experimental results demonstrate that the service time distribution consists in the MAC parameters such as MacMinBE, MacMaxCS-MABackoffs, and MacMaxFrameRetries, Lp and TP. Changing these parameters effects a change in the shape of service time distribution, in a way that the resulting distribution is similar to none of common probability distributions. Therefore, to be more precise and albeit complicated, general distribution is considered for service time.

In order to derivate waiting block equations such as the idle mode probabilities and waiting time in the queue, we consider a scenario illustrated in Figure 3. Assume a periodic sequence of arriving packets with Cn notation. Its probability density function (pdf) is simple impulsive (with the x-intercept = the time period (Tp) and the y-intercept = 1).

un is a (key) random variable, defined as

$$
\mu\_n = T\_{\text{service},n} - T\_p \tag{1}
$$

In a stable network, the expectation value of un needs to be negative. Also consider Wn as waiting time:

$$w\_{n+1} = \begin{cases} w\_n + u\_n & \text{if } \quad w\_n + u\_n \ge 0 \\ 0 & \text{if } \quad w\_n + u\_n \le 0 \end{cases} \tag{2}$$

The term wn + un is the sum of unfinished work (wn) found by Cn plus the service time (Tservice,n) less than Tp. The negative value of this term represents that

#### Figure 3.

Time diagram for a scenario, in which a periodic sequence of packets arrives, and queue status, waiting time and the (key) random variable u is shown.

Tp has elapsed since the arrival of Cn and the node must enter idle mode by the time Cn+1 arrives.

We may write Eq. (2) as

$$w\_{n+1} = \max[0, w\_n + u\_n] \tag{3a}$$

And the mean number of packets in the buffer K

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

<sup>ρ</sup> <sup>¼</sup> TService Tp

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

As regards the next packet's arrival time is specified, the time that nodes spend on idle mode is conspicuous. As a result, idle mode constitutes several states in DTM. The number of idle states (i), which represents maximum idle mode's waiting

PMinServiceTime <sup>¼</sup> <sup>α</sup><sup>m</sup>þ<sup>1</sup>

cnð Þ¼ u

generation period can take continuous values which may not be divisible by aUnitBackoffPeriod; consequently ~c uð Þis the normalized value of cn(u):

2 m mð Þ þ1 <sup>2</sup> W<sup>0</sup>

Waiting time in idle mode for the next packet will decline if the service time for the current packet rises, until service time and time period become equal. Thus, it is

The smallest time unit in the DTM is equal to aUnitBackoffPeriod, but the packet

There is always minor inaccuracy imposed to calculation, with a maximum value of approximately aUnitBackoffPeriod. ξ represents the error in Figure 3. Accord-

The maximum time that a node remains in idle mode occurs when the packet does not enter the queue and it is transmitted in minimum possible time (minimum

dCnð Þ u

aUnitBackoffPeriod � aUnitBackoffPeriod (16)

a<sup>1</sup> ¼ P½~c uð Þ¼�aUnitBackoffPeriod� (18)

a<sup>0</sup> ¼ P½~c uð Þ¼ 0� (17)

ai ¼ P½~c uð Þ¼�i� (19)

� aUnitBackoffPeriod (20)

time, is obtained from minimum service time in transmission block:

The minimum service time and its probability are

required to derivate PDF of un which is obtained by Eq. (5):

<sup>~</sup>c uð Þ¼ c uð Þ

ingly, the probability of entering idle mode is as follows:

aUnitBackoffPeriod � ð Þ <sup>m</sup> <sup>þ</sup> <sup>1</sup> 

service time) as well:

83

<sup>i</sup> <sup>¼</sup> TP

In which

K ¼ ρ þ Q (10)

umin≜Tservice,min � Tp (12)

<sup>m</sup>þ<sup>1</sup> (14)

du (15)

Minð Þ¼ ServiceTime ð Þ� m þ 1 aUnitBackoffPeriod (13)

(11)

So as to clarify the subject matter, the time diagram for the scenario is illustrated in Figure 3. Six packets are generated in determined intervals, and each one takes a different service time to be transmitted. The first packet's service time is less than the time period. But it is more for the second. So, before the second packet departs from its node, the third packet is generated and enters the queue directly. Though the third packet's service time is smaller than Tp, the fourth packet's waiting time is not zero because of the high second packet's unfinished work (w2) or

$$\sum\_{i=2}^{3} \left( T\_{\text{Service},i} \right) \ge 2T\_p. \tag{3b}$$

This may affect several subsequent packets when w = 0 for a packet. We define W(y) as cumulative distribution function (CDF) for wn:

$$W(\mathcal{y}) = \lim\_{n \to \infty} P[w\_n \le \mathcal{y}] \tag{4}$$

Before proceeding with the theory, to calculate W(y), Cn (u) is defined as the CDF for random variable un:

$$C(u) = P[u\_n \le u] = \int\_{t=0}^{\infty} B(u+t)d\gamma(t - T\_p) \tag{5}$$

In which B(x) and δ(t-Tp) are the distributions of service time and time period, respectively.

Combining Eqs. (2), (4), and (5), we have Lindley's integral Equation [41] which is seen to be a Wiener-Hopf-type integral Equation [42]:

$$\mathcal{W}(\mathbf{y}) = \begin{cases} \stackrel{\infty}{\int} \mathbf{C}(\mathbf{y} - w) dW(w) & \mathbf{y} \ge \mathbf{0} \\ \stackrel{\text{\(}}{\mathbf{0}} \\ \mathbf{0} & \mathbf{y} < \mathbf{0} \end{cases} \tag{6}$$

The node must go to idle mode if waiting time equals zero, as illustrated in Figure 2:

$$P\_{\text{idle}} = P[\omega\_n = \mathbf{0}] \tag{7}$$

And the probability of existing at least one packet in the queue is

$$P\_{quue} = \mathbf{1} - P\_{idle} = P[\boldsymbol{w}\_n > \mathbf{0}] \tag{8}$$

The mean queue length Q can be calculated using Little's theorem:

$$
\overline{Q} = \frac{\overline{W}}{T\_p} \tag{9}
$$

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

And the mean number of packets in the buffer K

$$
\overline{K} = \rho + \overline{Q} \tag{10}
$$

In which

Tp has elapsed since the arrival of Cn and the node must enter idle mode by the time

So as to clarify the subject matter, the time diagram for the scenario is illustrated in Figure 3. Six packets are generated in determined intervals, and each one takes a different service time to be transmitted. The first packet's service time is less than the time period. But it is more for the second. So, before the second packet departs from its node, the third packet is generated and enters the queue directly. Though the third packet's service time is smaller than Tp, the fourth packet's waiting time is

This may affect several subsequent packets when w = 0 for a packet. We define

Before proceeding with the theory, to calculate W(y), Cn (u) is defined as the

∞ð

t¼0

Combining Eqs. (2), (4), and (5), we have Lindley's integral Equation [41]

The node must go to idle mode if waiting time equals zero, as illustrated in

In which B(x) and δ(t-Tp) are the distributions of service time and time period,

C yð Þ � w dW wð Þ y≥0

0 y<0

Pidle ¼ P w½ � <sup>n</sup> ¼ 0 (7)

Pqueue ¼ 1 � Pidle ¼ P w½ � <sup>n</sup>>0 (8)

not zero because of the high second packet's unfinished work (w2) or

∑ 3 i¼2

W(y) as cumulative distribution function (CDF) for wn:

C uð Þ¼ P u½ �¼ <sup>n</sup> ≤u

which is seen to be a Wiener-Hopf-type integral Equation [42]:

8 >><

>>:

∞ð

0�

And the probability of existing at least one packet in the queue is

The mean queue length Q can be calculated using Little's theorem:

<sup>Q</sup> <sup>¼</sup> <sup>W</sup> Tp

W yð Þ¼

wnþ<sup>1</sup> ¼ max 0½ � ; wn þ un (3a)

ð Þ TService,i ≥2Tp: (3b)

W y ð Þ¼ lim<sup>n</sup>!<sup>∞</sup> P w½ � <sup>n</sup> <sup>≤</sup> <sup>y</sup> (4)

� � (5)

(6)

(9)

B uð Þ þ t dγ t � Tp

Cn+1 arrives.

We may write Eq. (2) as

Research Trends and Challenges in Smart Grids

CDF for random variable un:

respectively.

Figure 2:

82

$$\rho = \frac{\overline{T\_{Service}}}{T\_p} \tag{11}$$

As regards the next packet's arrival time is specified, the time that nodes spend on idle mode is conspicuous. As a result, idle mode constitutes several states in DTM. The number of idle states (i), which represents maximum idle mode's waiting time, is obtained from minimum service time in transmission block:

$$
\mu\_{\text{min}} \triangleq T\_{\text{service, min}} - T\_p \tag{12}
$$

The minimum service time and its probability are

$$\text{Min}(\text{ServiceTime}) = (m+1) \times a \,\text{UnitBackoffPeriod} \tag{13}$$

$$P\_{MinServiceTime} = \frac{a^{m+1}}{2^{\frac{m(m+1)}{2}}W\_0^{m+1}} \tag{14}$$

Waiting time in idle mode for the next packet will decline if the service time for the current packet rises, until service time and time period become equal. Thus, it is required to derivate PDF of un which is obtained by Eq. (5):

$$\mathcal{L}\_n(u) = \frac{d\mathcal{C}\_n(u)}{du} \tag{15}$$

The smallest time unit in the DTM is equal to aUnitBackoffPeriod, but the packet generation period can take continuous values which may not be divisible by aUnitBackoffPeriod; consequently ~c uð Þis the normalized value of cn(u):

$$\tilde{c}(u) = \left[\frac{c(u)}{a \,\mathrm{UnitBackoffPPeriod}}\right] \times a \,\mathrm{UnitBackoffPPeriod} \tag{16}$$

There is always minor inaccuracy imposed to calculation, with a maximum value of approximately aUnitBackoffPeriod. ξ represents the error in Figure 3. Accordingly, the probability of entering idle mode is as follows:

$$\mathfrak{a}\_0 = P[\tilde{\mathfrak{e}}(\mathfrak{u}) = \mathbf{0}] \tag{17}$$

$$a\_1 = P[\tilde{c}(\mu) = -a \,\text{UnitBackoffPeriod}] \tag{18}$$

$$a\_i = P[\tilde{c}(u) = -i] \tag{19}$$

The maximum time that a node remains in idle mode occurs when the packet does not enter the queue and it is transmitted in minimum possible time (minimum service time) as well:

$$i = \left( \left[ \frac{T\_P}{aUnitBackoffPeriod} \right] - (m+1) \right) \times a UnitBackoffPeriod} \tag{20}$$

The expected number of idle states is

$$E[a] = \left[ \frac{-\int\_{-i}^{0} u c(u) du}{\int\_{-i}^{0} c(u) du \times a UnitBackoffPeriod} \right] \tag{21}$$

According to Eq. (23) and (25), the total probability of waiting block is

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

D0�1 v¼0

The waiting block's probabilities were described in the previous section, and we depict the transmission block details in the following. In this section, some modifications to Park's model [16] are provided. The transmission block accounts for a three-dimensional Markov chain using three stochastic processes, including S(t),

retransmission counter. These states are linked to BE, NB, and RT in MAC param-

In which iϵ(�2,m), kϵ(�1,max{Wi-1,Ls-1,Lc-1}), and jϵ(0,n). Figure 5 presents Markov chain model for the transmission block. As shown in the figure, the number of retransmissions is considered to have finite values, giving rise to the packet drop.

Bv þ ∑ i j¼1

bi,k,j <sup>¼</sup> lim<sup>t</sup>!<sup>∞</sup> PSt ð Þ ðÞ¼ <sup>i</sup>;C tðÞ¼ <sup>k</sup>;r tðÞ¼ <sup>j</sup> (27)

Ij (26)

∑P WaitingBlock ð Þ ¼ ∑

backoff stage; C(t), the state of backoff counter; and r(t), the state of

The stationary probability of the Markov chain can be written as

eter in IEEE802.15.4 standard, respectively.

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

Packets are discarded due to two events:

Figure 5.

85

Markov chain model for MAC-level buffer.

3.1.2 Transmission block

And idle states probabilities are

: :

$$I\_i = \left[ P\left( \text{Failure}^{\text{CCA}} \right) + P\left( \text{Failure}^{\text{NO}, \text{ACK}} \right) + P\left( \text{Success} \right) \right] \times P[w\_u = \mathbf{0}] \times a\_i$$

$$I\_{i-1} = \left[ P\left( \text{Failure}^{\text{CCA}} \right) + P\left( \text{Failure}^{\text{NO}, \text{ACK}} \right) + P\left( \text{Success} \right) \right] \times P[w\_u = \mathbf{0}] \times a\_{i-1} + I\_i$$

$$I\_{i-2} = \left[ P\left( \text{Failure}^{\text{CCA}} \right) + P\left( \text{Failure}^{\text{NO}, \text{ACK}} \right) + P\left( \text{Success} \right) \right] \times P[w\_u = \mathbf{0}] \times a\_{i-2} + I\_{i-1} \tag{22}$$

$$\dots$$

$$I\_1 = \left[ P\left( Failure^{CCA} \right) + P\left( Failure^{NO\\_ACK} \right) + P\left( \text{Success} \right) \right] \times P[w\_{\text{l}} = \mathbf{0}] \times a\_1 + I\_2$$

And sum of idle states probabilities is

$$\begin{aligned} \sum\_{j=1}^{i} I\_j &= \left[ P \left( Failure^{CCA} \right) + P \left( Failure^{NO\\_ACK} \right) + P (\text{Success}) \right] \\\\ \times P[w\_n = \mathbf{0}] &\times \sum\_{k=1}^{i} ka\_k \end{aligned} \tag{23}$$

Furthermore, there is a MAC-level buffer in waiting block that has not been considered in [16], which is completely separated from the idle mode. If a node generates a packet and also has a packet in transmission block, the new packet is directed toward the buffer until its turn. In other words, when service time becomes far more than the time period, the queue starts to fill. The Markov chain model for a FIFO queue buffer is illustrated in Figure 4.

According to Figure 4

$$B\_0 = P[\boldsymbol{\omega}\_n > 0] \times \left[ P\left( \text{Failure}^{\text{CCA}} \right) + P\left( \text{Failure}^{\text{NO}\_-\text{ACK}} \right) + P(\text{Success}) \right] \tag{24}$$

The total probability of queue states is

$$\sum\_{v=0}^{D\_0-1} B\_v = D\_0 B\_0 \tag{25}$$

Figure 4. Markov chain model for MAC-level buffer.

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

According to Eq. (23) and (25), the total probability of waiting block is

$$\sum P(WaitingBlock) = \sum\_{v=0}^{D\_0 - 1} B\_v + \sum\_{j=1}^i I\_j \tag{26}$$
