simulationns2

NS2: How to set queue-limit for a node


I'm trying to simulate this network with NS2: enter image description here

and I have built the network like this

#Create six nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
set n5 [$ns node]

set recvr_delay1 [new RandomVariable/Uniform];
$recvr_delay1 set min_ 5ms
$recvr_delay1 set max_ 25ms

set recvr_delay2 [new RandomVariable/Uniform];
$recvr_delay2 set min_ 5ms
$recvr_delay2 set max_ 25ms

# TODO: make these delays random
#Create links between the nodes
$ns duplex-link $n0 $n2 100Mb 5ms DropTail
$ns duplex-link $n1 $n2 100Mb $recvr_delay1 DropTail

$ns duplex-link $n2 $n3 100Kb 1ms DropTail

$ns duplex-link $n3 $n4 100Mb 5ms DropTail
$ns duplex-link $n3 $n5 100Mb $recvr_delay2 DropTail

and I know that we can set queue-limit for links in NS2:

$ns queue-limit $n0 $n1 10

But the problem is I don't want to set queue-limit for links, I want to set queue limit for those two routers, is there a way to set queue-limit for a node instead of a link?


Solution

  • Based on NS Simulator for Beginners book

    "In NS-2, an output queue of a node is implemented as a part of each link whose input is that node. The definition of the link then includes the way to handle overflow at that queue."

    enter image description here

    I hope it helps.