Amazing technological breakthrough possible @S-Logix pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to vary the traffic to observe the CoAP performance in Cooja simulator?

Description

CoAP Performances observed, when vary the data transmission interval .It is changes the performance like throughput,delay, energy consumption are how effectively performing will be checked.

Step-1

Open er-example-client.c
file location;

Home/ contiki/examples/
er-rest-examples/

Do modify the following codes into
the file and set interval 10,15,20.

And take performance in cooja
network simulator.

Code:

#define TOGGLE_INTERVAL 10

etimer_set(&et, TOGGLE_
INTERVAL * CLOCK_SECOND);
// call

Step-2

   Open a Contiki cooja network
simulator

Cmd: cd contiki/ tools/ cooja
--> press enter

ant run --> enter

In cooja:

   Open contiki cooja network
simulator and create new
simulation(ctrl+n).

border-router.c, er-example-
server.c, er-example-client.c create
motes for

Server ,client location:

home/contiki/examples/er-rest-example.

Border router location:
home/contiki/examples/ipv6/
rpl-border-router

   Open motes menu >> add motes
>> create new motes type

create new simulation according
to network topology for different
traffic scenario.

   Connect the router to server.
In terminal at above location.

make-connect-router-cooja

Step-3

Edit script file,

After complete the simulation, save it
desired location (.csc) file will be created.

Add the following script code into
that file to calculate metrics

Step-4

Start the cooja

Run simulation after every
time interval modification.

For example Screen shots,

Interval 10:

After simulation save the metrics
calculation file in desired location
to evaluate graph.

Performance_output:

Step-5

Overall performance table:

Time interval gen.packet rec.packet delay throughput energy_consumption
10 120 81 1.119 29.80 0.8867(in joules)
15 102 66 1.368 24.28 0.8640(in joules)
20 82 45 1.228 16.56 0.9412(in joules)
Step-6

Open terminal >>ipython >> enter codes >> enter.

Code: throughput

import numpy as np

import matplotlib

import matplotlib.pyplot as plt

x = [10, 15, 20]

y1 = [29.80, 24.28, 16.56]

plt.plot(x,y1,linewidth=2.5, marker=’p’, markersize=9, fillstyle=’top’,

markerfacecoloralt =’tan’, linestyle=’-‘, color=’maroon’,label = ‘COAP’)

plt.xlabel(‘Data Transmission Interval’)

plt.ylabel(‘Throughput’)

plt.rc(‘font’,family=’Times New Roman’)

plt.rcParams.update ({‘font.size’:14})

plt.legend(loc=’center ‘, prop={‘size’:14})

plt.grid()

plt.show()

 

Code: Delay

import numpy as np

import matplotlib

import matplotlib.pyplot as plt

x = [10, 15, 20]

y1 = [1.119, 1.36, 1.32]

plt.plot(x,y1,linewidth=2.5,

marker=’p’, markersize=9, fillstyle=’top’,

markerfacecoloralt =’tan’,

linestyle=’-‘, color=’maroon’,label = ‘COAP’)

plt.xlabel(‘Data Transmission Interval’)

plt.ylabel(‘Delay’)

plt.rc(‘font’,family=’Times New Roman’)

plt.rcParams.update ({‘font.size’:14})

plt.legend(loc=’center ‘, prop={‘size’:14})

plt.grid()

plt.show()