== Evaluating ContikiMAC and XMAC protocols ==
 
== Evaluating ContikiMAC and XMAC protocols ==
   −
We are going to evaluate the performance of the two most famous RDC protocols in ContikiOS, the ContikiMAC and X-MAC. We want to evaluate the Packet Reception Rate (PRR), which is the percentage of received packets in an interval; and also the average duty-cycle of sensor nodes. The PRR is related to the maximum throughput the network is able to handle; with lower PRR more packets are dropped and the total amount of data that can be transfered to the sink node is small. Also, the duty-cycle impacts the average power consumption and the lifetime of nodes, since the biggest energy savings are achieved when nodes are sleeping; the lower the duty-cycle the longest will be the node's lifetime.
+
We are going to evaluate the performance of the two most famous RDC protocols in ContikiOS, the ''ContikiMAC'' and ''X-MAC''. We want to evaluate the Packet Reception Rate (PRR), which is the percentage of received packets in an interval; and also the average duty-cycle of sensor nodes. The PRR is related to the maximum throughput the network is able to handle; with lower PRR more packets are dropped and the total amount of data that can be transfered to the sink node is small. Also, the duty-cycle impacts the average power consumption and the lifetime of nodes, since the largest energy savings are achieved when nodes are sleeping; the lower the duty-cycle the longest will be the node's lifetime.
   −
We considered the firmware in the folder ''examples/ipv6/rpl-udp/'', which is a firmware based on IPv6 and RPL for UDP packet transmission. In the same folder there is one simulation file called ''rpl-udp-powertrace.csc'' that is composed of 1 sink node and 30 sensor nodes and traces the energy consumption of all nodes, and also keeps track of PRR values throughout the simulation time. We considered the firmwares ''udp-server.c'' and ''udp-client.c'' and reduced the data transmission interval in ''udl-client.c'' to 1 second. The line below shows where the code of ''udp-client.c'' was changed:
+
We considered the firmware in the folder ''examples/ipv6/rpl-udp/'', which is a firmware based on IPv6 and RPL for UDP packet transmission. In the same folder there is one simulation file called ''rpl-udp-powertrace.csc'' that is composed of 1 sink node and 30 sensor nodes and traces the energy consumption of all nodes, and also keeps track of PRR values throughout the simulation. We considered the firmwares ''udp-server.c'' and ''udp-client.c'' and reduced the data transmission interval in ''udl-client.c'' to 1 second. The line below shows where the code of ''udp-client.c'' was changed:
    
<source lang="c">
 
<source lang="c">
 
</source>
 
</source>
   −
By default the simulation is executed with ContikiMAC. We let the simulation run for 5 minutes before extracting the desired statistics. After simulation for ContikiMAC, we changed the RDC protocols, as described before, to X-MAC. And the same statistics were obtained. The figures below show the average duty-cycle of each node for both protocols. The figure on the left shows results of ContikiMAC and the one on the right shows results of X-MAC.
+
By default the simulation is executed with ContikiMAC. We let the simulation run for 5 minutes before extracting the desired statistics. After simulation for ContikiMAC, we changed the RDC protocol, as described before, to X-MAC. And the same statistics were obtained. The figures below show the average duty-cycle of each node for both protocols. The figure on the left shows results of ContikiMAC and the one on the right shows results of X-MAC.
    
[[File:power_contikimac.png|300px]] [[File:power_xmac.png|300px]]
 
[[File:power_contikimac.png|300px]] [[File:power_xmac.png|300px]]
   Exception encountered, of type "Error"