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.

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

   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

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

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.

10a

Performance_output:

10b

Overall performance table:

Time intervalgen.packetrec.packet delay throughput energy_consumption
10 120 811.11929.800.8867(in joules)
15102 66 1.36824.280.8640(in joules)
20 82451.22816.560.9412(in joules)

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()

 

10c

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()

10d
Leave Comment

Your email address will not be published. Required fields are marked *

clear formSubmit