Hi,
here I am again with a question.

I included the monitor-queue, but in its vatiable it gets only stupid trash 
like 
_o139
_o145
_o151
_o157
_o163
_o169
_o175
_o181
_o187
_o193
I tried the whole day zu fix this bug, but now I'm sad of it and a bit stressed 
:)

I've got also the problem with the colorisation of my strams
I'd tried like described in a Marc Greis tutorial, but I think, my problem is a 
kind different.
So if i set 
"$ns color 0 Red" both streams are red, so long, but I have no class which says 
that 0 is red.Or if I say 
If I define 1 as Red, both streams are black
"$ns color n1 Green", both streams are green... why?
please help me out.

here's my code following
I marked my Sources of stress with a "?"

# new simulator / Neuer Simulator
set ns [new Simulator]
#Open the output files / öffnen neuer outputfiles
set f0 [open out0.tr w]
set f1 [open out1.tr w]
set f2 [open out2.tr w]
#Open file for nam tracing
set nf [open out1.nam w]
$ns namtrace-all $nf
#creating new nodes / Erzeugen von 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]
$n0 color "blue"
$n1 color "green"
$n2 color "black"
$n3 color "black"
$n4 color "blue"
$n5 color "Green"
$n0 label "Audio Source"
$n1 label "PC1"
$n2 label "Switch1"
$n3 label "Switch2"
$n4 label "Audio sink"
$n5 label "PC2"
#connect the nodes / Verbinden der Nodes
$ns duplex-link $n0 $n2 100Mb 10ms DropTail
$ns duplex-link $n1 $n2 100Mb 10ms DropTail
$ns duplex-link $n3 $n2 100Mb 10ms DropTail
$ns duplex-link $n4 $n3 100Mb 10ms DropTail
$ns duplex-link $n5 $n3 100Mb 10ms DropTail
#arrange the nodes / Anordnung der Nodes
$ns duplex-link-op $n0 $n2 orient right-down
$ns duplex-link-op $n1 $n2 orient right-up
$ns duplex-link-op $n2 $n3 orient right
$ns duplex-link-op $n3 $n4 orient right-up
$ns duplex-link-op $n3 $n5 orient right-down
#color the streams / Markierung der Stöme
$ns color 1 Red                ;# <--?
$ns color 2 Green            ;# <--?

proc record {} {
global sink4 sink5 f0 f1 f2 n2 n3
#Get an instance of the simulator
set ns [Simulator instance]
#Set the time after which the procedure should be called again
set time 0.5
#How many bytes have been received by the traffic sinks?
set bw0 [$sink4 set bytes_]
set bw1 [$sink5 set bytes_]
set mon [$ns monitor-queue $n2 $n3 qtrace] ;# sampleinterval qtrace  <--?
#Get the current time
set now [$ns now]
#Calculate the bandwidth (in MBit/s) and write it to the files
puts $f0 "$now [expr $bw0/$time*8/1000000]"
puts $f1 "$now [expr $bw1/$time*8/1000000]"
puts $f2 "$mon" ;# [expr $mon/$time*8/1000]"               ;# <--?
#Reset the bytes_ values on the traffic sinks
$sink4 set bytes_ 0
$sink5 set bytes_ 0
#Re-schedule the procedure
$ns at [expr $now+$time] "record"
}

proc attach-expoo-traffic { node sink size burst idle rate agent traffica  } {
#Get an instance of the simulator
set ns [Simulator instance]
#Erzeugen neuer Agents und konfig. parameter setzen
set source [new Agent/$agent]
$ns attach-agent $node $source
#Create an Expootraffic agent and set its configuration parameters
set traffic [new Application/Traffic/$traffica]
$traffic set packetSize_ $size
$traffic set burst_time_ $burst
$traffic set idle_time_ $idle
$traffic set rate_ $rate
# Attach traffic source to the traffic generator
$traffic attach-agent $source
#Connect the source and the sink
$ns connect $source $sink
return $traffic
}

#Finishprozedur hinzufügen
proc finish {} {
    global ns nf f0 f1 f2
    $ns flush-trace    
    close $f0
    close $f1
    close $f2
    close $nf
    exec xgraph out0.tr out1.tr out2.tr -geometry 800x400 &
    exec nam out1.nam &
    exit 0
}
#create the two sink / zwei Empfänger erzeugen
set sink4 [new Agent/LossMonitor]
set sink5 [new Agent/LossMonitor]
$ns attach-agent $n4 $sink4
$ns attach-agent $n5 $sink5
#create the two sources / zwei Sources erzeugen
set rtp0 [attach-expoo-traffic $n0 $sink4 5000kb 0.02s 0.05s 100k RTP RealAudio]
set udp1 [attach-expoo-traffic $n1 $sink5 1250kb 2s 0.5s 500k UDP CBR]
#distinguish the streams / Unterscheiden der Verkehrsströme
$rtp0 set class_ 1                                ;# <--?
$udp1 set class_ 2                                ;# <--?
#watch the queue / überwachen der Warteschlange
$ns duplex-link-op $n2 $n3 queuePos 0.5
$ns duplex-link-op $n3 $n2 queuePos 0.5
#start record / Aufnahme beginnen
$ns at 0.0 "record"
#define start stop / Sendebeginn und -ende definieren
$ns at 0.2 "$udp1 start"
$ns at 4.1 "$udp1 stop"
$ns at 0.1 "$rtp0 start"
$ns at 4.5 "$rtp0 stop"
#fix simulation time / Simulationsdauer festlegen
$ns at 5.0 "finish"
#start simulation / starten der Simulation
$ns run


      

Reply via email to