Skip to main content

Table 2 Pseudo-code for the proposed algorithm for calculating the reliability of a WSN S

From: A comprehensive wireless sensor network reliability metric for critical Internet of Things applications

Step

Algorithm for computing WSN reliability R(S)

1.a.

Set all parameters (S = {s i }, T = {t j }, types of SNs, sink location, \( {\lambda}_s^i \), \( {\lambda}_t^i \), \( {\lambda}_p^i \) and \( {\lambda}_b^i \) for i = 1 , … , n and j = 1 , … , m)

1.b.

Initialize R =Prob(Ï€ |s i  ∈ S is in on mode ∀i = 1 , … , n)

1.c.

Initialize Π 1 = {(Ï€ |s i  ∈ S is in on mode ∀i = 1 , … , n)}

2.a.

Let k be the number of SNs in relay mode. Initialize k = 1.

2.b.

Let \( {\mathcal{F}}_r^k \) be a k−combination of SNs in relay mode. Let \( {\boldsymbol{F}}_r^k \) be the set of k−combinations of SNs in relay mode that S can tolerate. Initialize\( \kern0.5em {\mathcal{F}}_r^k={\boldsymbol{F}}_r^k=\left\{\phi \right\} \).

2.c.

For i = 1 , … , n

 

- Let s i be in relay mode, i.e. \( {\mathcal{F}}_r^k=\left\{{s}_i\right\} \)

 

- Evaluate\( f\left(\boldsymbol{\pi} |\ {\mathcal{F}}_r^k\right) \) using (10)

- If \( f\left(\boldsymbol{\pi} |\ {\mathcal{F}}_r^k\right)=1\to {\boldsymbol{F}}_r^k={\boldsymbol{F}}_r^k\cup {\mathcal{F}}_r^k \)

 

End For loop

2.d.

While \( {\boldsymbol{F}}_r^k\ne \left\{\phi \right\}\kern1em \to \kern0.75em k=k+1 \), Let \( {F}_{rl}^{k-1}\in {\boldsymbol{F}}_r^{k-1}, \)

\( \kern0.5em {\mathcal{F}}_r^k={\boldsymbol{F}}_r^k=\left\{\phi \right\} \)

2.e.

For \( l=1,\dots, \left|\ {\boldsymbol{F}}_r^{k-1}\right| \) and i = 1 , … , n

 

- Let \( {\mathcal{F}}_{\mathrm{r}}^{\mathrm{k}}=\left\{\ {F}_{rl}^{k-1},{s}_i\kern0.5em \right\} \)

- Evaluate\( \mathrm{f}\left(\uppi |\ {\mathcal{F}}_{\mathrm{r}}^{\mathrm{k}}\right) \) using (10)

 

- If \( f\left(\pi |\ {\mathcal{F}}_r^k\right)=1\to {\boldsymbol{F}}_r^k={\boldsymbol{F}}_r^k\cup {\mathcal{F}}_r^k \)

2.f.

End For loops, End While loop

3.a.

Let k be the number of SNs in off mode. Initialize k = 1.

3.b.

Let \( {\mathcal{F}}_o^k \) be a k−combination of SNs in off mode. Let \( {\boldsymbol{F}}_o^k \) be the set of k−combinations of SNs in off mode that S can tolerate. Initialize\( \kern0.50em {\mathcal{F}}_o^k={\boldsymbol{F}}_o^k=\left\{\phi \right\} \).

3.c.

Repeat step 2.c. for off mode, i.e. \( {\mathcal{F}}_o^k=\left\{{s}_i\right\} \)

3.d.

While \( {\boldsymbol{F}}_o^k\ne \left\{\phi \right\}\kern1em \to \kern0.75em k=k+1 \), Let \( {F}_{ol}^{k-1}\in {\boldsymbol{F}}_o^{k-1}, \)

\( \kern0.5em {\mathcal{F}}_o^k={\boldsymbol{F}}_o^k=\left\{\phi \right\} \)

3.e.

Repeat 2.e. using \( {F}_{ol}^{k-1} \) and\( {\mathcal{F}}_o^k \) to get \( {\boldsymbol{F}}_o^k \)

3.f.

End For loops, End While loop

4.a.

Letʉ㱠r andʉ㱠o be a combination of SNs in relay and off modes respectively.

Let F r and F o be the sets of all combinations of SNs of in relay and off mode that that S can tolerate respectively.

Let \( {F}_{rl_r}\in {\boldsymbol{F}}_r \) and \( {F}_{ol_o}\in {\boldsymbol{F}}_o \)

4.b.

For l r  = 1 , … , |F r | and l o  = 1 , … , |F o |

 

- Let \( {\mathcal{F}}_r={F}_{rl_r} \) and \( {\mathcal{F}}_o={F}_{ol_o} \)

- Evaluate f(πℱ r , ℱ o  ) using (10)

 

- If f(Ï€| â„± r, ℱ o ) = 1→ Π 1 = Π 1 ∪ π

 

End For loops

5.a.

Let π l  ∈ Π 1

5.b.

For l = 1 , … , |Π 1|

 

- R(S) = R(S) + Prob(π l )

 

End For loop

6.

Output:  R(S)