1

I have created in NS two nodes connected over a 4Mbps connection with a delay of 10ms.

Node1 is a transmitter and Node2 is a receiver.

The transmitter node sends packets at a rate of 10ms (0.01s).

Packet transmission starts at 2s in the simulation.

Considering the above, as long as my packets are < 5000 bytes in size I am below the 4Mbps limit of the connection.

What I am trying to understand is what happens when I increase packet size beyond 5000 bytes.

So, if i increase packet size to 8000 bytes here is what happens, using NAM for the animation

enter image description here

The first packet is sent at 2s and the second is sent at 2.016s. Note that a packet is sent every 0.01s, so the 2nd packet should have been sent at 2.01s. Also notice that we are currently at 2.02+ seconds in the simulation, so the third packet should have already left Node1.

NAM's documentation says that

Queued packets are shown as little squares.[...] Dropped packets are shown as falling rotating squares, and disappear at the end of the screen.

So I am not having any dropped packets?

Using XGRAPH for the simulation we get this graph

enter image description here

Now, I can't quite understand the following:

  • What is the relation between the packet arrows length and the connection?
  • What does the fact that packet transmission does not happen at the set interval of 10ms mean?
  • What does the fact that I am pushing a transmission rate above 4Mbps mean for a connection limited to 4Mbps?
  • Why, in the graph, I see spikes and why do they go beyond 4Mbps?

UPDATE: Added the .tcl script

set ns [new Simulator]

set nf [open lab1.nam w]
$ns namtrace-all $nf

set xf [open lab1.tr w]

proc record {} {
     global sink xf
     set ns [Simulator instance]

     set time 0.12

     set bw [$sink set bytes_]

     set now [$ns now]

     puts $xf "$now [expr ((($bw/$time)*8)/1000000)]"

     $sink set bytes_ 0

     $ns at [expr $now+$time] "record"
}
proc finish {} {
  global ns nf xf
  $ns flush-trace
  close $nf
  close $xf
  exit 0
}
set n0 [$ns node]
set n1 [$ns node]
$ns duplex-link $n0 $n1 4Mb 10ms DropTail

set udp0 [new Agent/UDP]
$udp0 set packetSize_ 1500
$ns attach-agent $n0 $udp0

set traffic0 [new Application/Traffic/CBR]

$traffic0 set packetSize_ 1500
$traffic0 set interval_ 0.01
$traffic0 attach-agent $udp0

set sink [new Agent/LossMonitor]
$ns attach-agent $n1 $sink

$ns connect $udp0 $sink
$ns at 0.0 "record"
$ns at 2.0 "$traffic0 start"
$ns at 10.0 "$traffic0 stop"
$ns at 12.0 "finish"
$ns run

UPDATE2:

Dropped packets begin to show in the simulation animation after some time passes and not immediately, it turns out. So for example I'll have to run the simulation for about 3-4 seconds before dropped packets begin to show.

Dimitris Karagiannis
  • 8,942
  • 8
  • 38
  • 63
  • About your xgraph image : Looks like it's created from an ordinary trace file. Please read "VIII. Creating Output Files for Xgraph" http://www.isi.edu/nsnam/ns/tutorial/nsscript4.html ... Examples : xgraph_ns2-files-tcl_07.2016.tar.gz https://drive.google.com/file/d/0B7S255p3kFXNWEJCa1QxN284bUk/view?usp=sharing – Knud Larsen Mar 26 '17 at 10:27
  • I don't understand what do you mean 'it was created from an ordinary trace file" The trace file was created from my `.tcl` script of the simulation. Updated the question with the code if it helps – Dimitris Karagiannis Mar 26 '17 at 13:23
  • ? Did you read the other threads with the same file.tcl, and the same issues ? 1) https://stackoverflow.com/questions/42998726/ns2-cannot-connect-to-existing-nam-instance 2) http://www.linuxquestions.org/questions/linux-software-2/xgraph-problem-segmentation-fault-core-dumped-4175602399/#3 – Knud Larsen Mar 28 '17 at 12:24
  • @KnudLarsen did you read my question before commenting with "same issues" links? – Dimitris Karagiannis Mar 28 '17 at 12:47
  • I am commenting on the image only. – Knud Larsen Mar 28 '17 at 22:40
  • One information is missing : Your OS → Name and version. I couldn't reproduce your spikes, any Linux OS. Except for a lookalike image : With an LTE patched ns2. – Knud Larsen Mar 30 '17 at 17:12
  • @KnudLarsen OS is WIn10x64 (running in VM). Anyway, do not bother too much with this. – Dimitris Karagiannis Mar 31 '17 at 13:55

0 Answers0