Attach traffic source to the traffic generator

Optimizing a Centralized Control Topology of an IoT Network Based on Hilbert Space

set source0 [attach-expoo-traffic \$n0 \$sink0 200 2s 1s 100k] set source1 [attach-expoo-traffic \$n1 \$sink1 200 2s 1s 200k] set source2 [attach-expoo-traffic \$n2 \$sink2 200 2s 1s 300k]

First, the procedure creates a traffic source and attaches it to the node. Then, it creates a Traffic/Expo object, sets its configuration parameters, and attaches it to the traffic source. Before, the source and sink have been connected. Now, the traffic sources (with different peak rates) are attached to n0, n1, and n2, and then they are connected to the three traffic sinks in node n4, which has been previously created:

In this example, Agent/Loss Monitor objects are used as traffic sinks, since they store the amount of data received, which can be used to calculate the bandwidth. In the same way, we construct all the nodes and interconnections for the simulation

Once NS is defined, we estimate the performance of this chapter by the simulation of the effectiveness of the project node and the quality of service. Moreover, the duration of the OFA was evaluated by the end of the delay (E2ED) and the packet delivery ratio (PDR). So we compared the performance of OFA to newer

1. Reliable and energy-efficient routing (REER) proposed by Li et al. in [8]

3. Reliable routing with distributed learning automaton (RRDLA) proposed by

We use the network parameters recommended by Zorzi and Rao in [11] and

In this way, it is important to define E2ED as the time it takes a packet to reach its destination after it is generated by its source, it is important to set the time for the packet to be reached because its next delay and delivery delays will be targeted at PDR probability of a total of [13] knot; the life span may be reset to original packages before the expiration of [14]. According to this definition, the correlation

2. Delay-energy trade-off in wireless sensor networks with reliable

between the maximal and minimal end-to-delinquency values of the η is

communication (DETR) proposed by Liu et al. in [9]

Figure 3. Example of network topology.

called a compiled hierarchy, and another hierarchy of classes similar to the previous one but within the interpreter that is presented to the programmer in OTcl, and which is also known as an interpreted hierarchy. These two hierarchies are closely related to each other, so that, from the user's perspective, there is a one-toone correspondence between one class in the interpreted hierarchy and one in the compiled hierarchy. The root of this hierarchy is a class called TclObject. When the user creates a simulator object from the interpreter, which usually starts a script, this object is created within the interpreter, and a close relationship is created with another identical object but within the compiled hierarchy. The interpreted class hierarchy is established automatically through methods defined within the class called TclClass. In addition, we can create other hierarchies to our liking in the scripts, written in OTcl, that are not split in the compiled hierarchy.

To create the topology, we just show a simple example for purposes of understanding the use of this simulator. For this example we use the connection depicted by Figure 3.

Then the nodes are created in the same way as in Figure 3, as follows:

```
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
```
\$ns duplex-link \$n0 \$n3 1Mb 100ms DropTail \$ns duplex-link \$n1 \$n3 1Mb 100ms DropTail \$ns duplex-link \$n2 \$n3 1Mb 100ms DropTail \$ns duplex-link \$n3 \$n4 1Mb 100ms DropTail

Then, traffic sources are attached to nodes n0, n1, and n2:

```
proc attach-expoo-traffic { node sink size burst idle rate } {
  #Get an instance of the simulator
  set ns [Simulator instance]
```
#Create a UDP agent and attach it to the node set source [new Agent/UDP] \$ns attach-agent \$node \$source

#Create an Expoo traffic agent and set its configuration parameters set traffic [new Application/Traffic/Exponential] \$traffic set packet-size \$size \$traffic set burst-time \$burst

Optimizing a Centralized Control Topology of an IoT Network Based on Hilbert Space DOI: http://dx.doi.org/10.5772/intechopen.87206

\$traffic set idle-time \$idle \$traffic set rate \$rate # Attach traffic source to the traffic generator \$traffic attach-agent \$source #Connect the source and the sink \$ns connect \$source \$sink return \$traffic

First, the procedure creates a traffic source and attaches it to the node. Then, it creates a Traffic/Expo object, sets its configuration parameters, and attaches it to the traffic source. Before, the source and sink have been connected. Now, the traffic sources (with different peak rates) are attached to n0, n1, and n2, and then they are connected to the three traffic sinks in node n4, which has been previously created:

set sink0 [new Agent/LossMonitor] set sink1 [new Agent/LossMonitor] set sink2 [new Agent/LossMonitor] \$ns attach-agent \$n4 \$sink0 \$ns attach-agent \$n4 \$sink1 \$ns attach-agent \$n4 \$sink2

called a compiled hierarchy, and another hierarchy of classes similar to the previous one but within the interpreter that is presented to the programmer in OTcl, and which is also known as an interpreted hierarchy. These two hierarchies are

closely related to each other, so that, from the user's perspective, there is a one-toone correspondence between one class in the interpreted hierarchy and one in the compiled hierarchy. The root of this hierarchy is a class called TclObject. When the user creates a simulator object from the interpreter, which usually starts a script, this object is created within the interpreter, and a close relationship is created with another identical object but within the compiled hierarchy. The interpreted class hierarchy is established automatically through methods defined within the class called TclClass. In addition, we can create other hierarchies to our liking in the

To create the topology, we just show a simple example for purposes of understanding the use of this simulator. For this example we use the connection depicted by Figure 3. Then the nodes are created in the same way as in Figure 3, as follows:

scripts, written in OTcl, that are not split in the compiled hierarchy.

Internet of Things (IoT) for Automated and Smart Applications

Then, traffic sources are attached to nodes n0, n1, and n2:

proc attach-expoo-traffic { node sink size burst idle rate } {

#Create an Expoo traffic agent and set its configuration parameters

#Create a UDP agent and attach it to the node

set traffic [new Application/Traffic/Exponential]

\$ns duplex-link \$n0 \$n3 1Mb 100ms DropTail \$ns duplex-link \$n1 \$n3 1Mb 100ms DropTail \$ns duplex-link \$n2 \$n3 1Mb 100ms DropTail \$ns duplex-link \$n3 \$n4 1Mb 100ms DropTail

#Get an instance of the simulator set ns [Simulator instance]

set source [new Agent/UDP] \$ns attach-agent \$node \$source

\$traffic set packet-size \$size \$traffic set burst-time \$burst

118

set n0 [\$ns node] set n1 [\$ns node] set n2 [\$ns node] set n3 [\$ns node] set n4 [\$ns node]

Figure 3.

Example of network topology.

set source0 [attach-expoo-traffic \$n0 \$sink0 200 2s 1s 100k] set source1 [attach-expoo-traffic \$n1 \$sink1 200 2s 1s 200k] set source2 [attach-expoo-traffic \$n2 \$sink2 200 2s 1s 300k]

In this example, Agent/Loss Monitor objects are used as traffic sinks, since they store the amount of data received, which can be used to calculate the bandwidth. In the same way, we construct all the nodes and interconnections for the simulation of the next section.

#### 5.2 Comparing SDN performance

Once NS is defined, we estimate the performance of this chapter by the simulation of the effectiveness of the project node and the quality of service. Moreover, the duration of the OFA was evaluated by the end of the delay (E2ED) and the packet delivery ratio (PDR). So we compared the performance of OFA to newer algorithms similar to the latest technology:


We use the network parameters recommended by Zorzi and Rao in [11] and Karp and Kung in our experiments [12].

In this way, it is important to define E2ED as the time it takes a packet to reach its destination after it is generated by its source, it is important to set the time for the packet to be reached because its next delay and delivery delays will be targeted at PDR probability of a total of [13] knot; the life span may be reset to original packages before the expiration of [14]. According to this definition, the correlation between the maximal and minimal end-to-delinquency values of the η is

determined by the change between maximal and minimal packet delivery ratios. If the delay ends are stable, η will be equal to 0, and if the packet delivery rate is constant η ¼ ∞, a delay will appear:

$$\eta(\rho) = \frac{E2ED(\rho)\_{\text{max}} - E2ED(\rho)\_{\text{min}}}{PDR(\rho)\_{\text{max}} - PDR(\rho)\_{\text{min}}} \tag{2}$$

Table 1 shows η φð Þ for node intensity and service quality, both in the OFA or

Algorithm η (node density) η (quality of service) RRDLA 0.0833 0.0909 DETR 1.1667 0.2143 REER 3.000 0.4000 OFA 0.0386 0.0705

Optimizing a Centralized Control Topology of an IoT Network Based on Hilbert Space

If Table 1 is analyzed, we can realize that OFA obtains the better result when node density and quality of service are compared. It is important to mention that using the regression techniques of a variable of E2ED on a PDR variable, we look for

algorithm reduces in an important way the time of processing. The simple linear

where α is the ordinate at the origin (the value that E2ED takes when PDR is 0), β is the slope of the line (and indicates how E2ED changes when increasing PDR in a unit), and ε is a variable that includes a large set of factors, each of which influences the response only in small magnitude, which we will call error. PDR and E2ED are random variables, so you cannot establish an exact linear relationship between

As a result, a package sent by OFA will spend less time to achieve its target, because the target node will increase the chance of recovering the original packet

Smart home technology, as part of IoT, is the future of residential-related technology which is designed to deliver and distribute services inside/outside the house via networked smart devices sharing information by means of a broadband Internet connection. In this chapter we developed an OFA for optimizing a central IoTN topology, increasing the range transmission of a given Wi-Fi network in an adaptive and dynamic way when sharing parameters, in order to achieve an energy-efficient

With the IoTN topology proposed in this chapter, based on the L-system for the Hilbert space-filling fractal and focused on the efficient connection of the smart home devices or MCUs, the energy consumption of the connected devices is reduced. Most of this energy consumed by MCUs can be saved through inclusion of new nodes or devices connected in the same IoTN, since most of the information detected throughout the network is redundant due to geographically placed sensors. Thus, our proposal optimizes the links among MCUs or smart home devices, since in a dense network we have 2016 possible links but with only 64 links we can share parameters of sensor, namely with only the 3.05% or we are reducing the 96.95% the number of links in the presented IoTN. In addition, we can manage scarce IoTNs in order to obtain more dense networks, since by means of a

; this regression

E2ED ¼ α þ βPDR þ ε (3)

best results (bold) to 0 and RDDLA will have the second (emphasized).

a function that is a good approximation of a point cloud xi; yi

regression model has the following expression:

η φð Þ for the impact of node density and quality of service.

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

them.

121

Table 1.

before its expiration.

6. Conclusions

IoT-based smart home.

where φ is the effect of node density or the requirements for reliability of QoS. According to the models proposed by Niu et al. [15], it is based on the experience described for Mostafaei in [10] and Zeng et al. in [16].

In this way, Figure 4a and b show the comparison between PDR and E2ED, respectively, in terms of node intensity and reliability. We can say that better algorithms are reached with the higher E2ED and the lower PDR. Thus, both algorithms get the best results and try to minimize delays when sending target data which can restore original packages. OFA is slightly better in both cases, but the differences are not higher than 1.97%. Additionally, the delay in RRDLA and OFA is noticeably changed by increasing the intensity of the network or QoS node. DETR and REER also have worst results than the two best algorithms.

#### Figure 4.

The simulation of the impact of the node density and quality of service, case end-to-end delay vs. packet delivery ratio. (a) Node Density, and (b) Reliability Requirements.

Optimizing a Centralized Control Topology of an IoT Network Based on Hilbert Space DOI: http://dx.doi.org/10.5772/intechopen.87206


#### Table 1.

determined by the change between maximal and minimal packet delivery ratios. If the delay ends are stable, η will be equal to 0, and if the packet delivery rate is

> η φð Þ¼ <sup>E</sup>2EDð Þ <sup>φ</sup> max � <sup>E</sup>2EDð Þ <sup>φ</sup> min PDRð Þ φ max � PDRð Þ φ min

where φ is the effect of node density or the requirements for reliability of QoS. According to the models proposed by Niu et al. [15], it is based on the experience

In this way, Figure 4a and b show the comparison between PDR and E2ED, respectively, in terms of node intensity and reliability. We can say that better algorithms are reached with the higher E2ED and the lower PDR. Thus, both algorithms get the best results and try to minimize delays when sending target data which can restore original packages. OFA is slightly better in both cases, but the differences are not higher than 1.97%. Additionally, the delay in RRDLA and OFA is noticeably changed by increasing the intensity of the network or QoS node. DETR

The simulation of the impact of the node density and quality of service, case end-to-end delay vs. packet delivery

(2)

constant η ¼ ∞, a delay will appear:

Figure 4.

120

ratio. (a) Node Density, and (b) Reliability Requirements.

described for Mostafaei in [10] and Zeng et al. in [16].

Internet of Things (IoT) for Automated and Smart Applications

and REER also have worst results than the two best algorithms.

η φð Þ for the impact of node density and quality of service.

Table 1 shows η φð Þ for node intensity and service quality, both in the OFA or best results (bold) to 0 and RDDLA will have the second (emphasized).

If Table 1 is analyzed, we can realize that OFA obtains the better result when node density and quality of service are compared. It is important to mention that using the regression techniques of a variable of E2ED on a PDR variable, we look for a function that is a good approximation of a point cloud xi; yi ; this regression algorithm reduces in an important way the time of processing. The simple linear regression model has the following expression:

$$E2ED = a + \beta PDR + \varepsilon \tag{3}$$

where α is the ordinate at the origin (the value that E2ED takes when PDR is 0), β is the slope of the line (and indicates how E2ED changes when increasing PDR in a unit), and ε is a variable that includes a large set of factors, each of which influences the response only in small magnitude, which we will call error. PDR and E2ED are random variables, so you cannot establish an exact linear relationship between them.

As a result, a package sent by OFA will spend less time to achieve its target, because the target node will increase the chance of recovering the original packet before its expiration.

### 6. Conclusions

Smart home technology, as part of IoT, is the future of residential-related technology which is designed to deliver and distribute services inside/outside the house via networked smart devices sharing information by means of a broadband Internet connection. In this chapter we developed an OFA for optimizing a central IoTN topology, increasing the range transmission of a given Wi-Fi network in an adaptive and dynamic way when sharing parameters, in order to achieve an energy-efficient IoT-based smart home.

With the IoTN topology proposed in this chapter, based on the L-system for the Hilbert space-filling fractal and focused on the efficient connection of the smart home devices or MCUs, the energy consumption of the connected devices is reduced. Most of this energy consumed by MCUs can be saved through inclusion of new nodes or devices connected in the same IoTN, since most of the information detected throughout the network is redundant due to geographically placed sensors.

Thus, our proposal optimizes the links among MCUs or smart home devices, since in a dense network we have 2016 possible links but with only 64 links we can share parameters of sensor, namely with only the 3.05% or we are reducing the 96.95% the number of links in the presented IoTN. In addition, we can manage scarce IoTNs in order to obtain more dense networks, since by means of a
