Hi ns2 users

0                 4
 \                /
  2------->3
 /                \
1                 5

I send audio data from Node 0 to Node 4. The Link between Node 2 and Node 3 
should be scientific overloaded. Therefor there is further UDP Traffic from 
Node 1 to Node 5.
The Audio Signals are realised with a RTP Agent and a RealAudio Application

And here is my question:
Why does my Priority control not work? (It's in the Funktion 
"attach-expoo-traffic")
I guess I forgot something but I don't know what.

Further my next problem?
How can I change the RTP package size of my audio signals?

Following my code:

proc record {} {
    global ns sink4 sink5 f0 f1 f3 lf monFile ;#qmon samples
    #Get an instance of the simulator
    #Set the time after which the procedure should be called again
    set time 0.025
    #How many bytes have been received by the traffic sinks?
    set bw0 [$sink4 set bytes_]
    set bw1 [$sink5 set bytes_]
    #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 $f3 "$now [expr ($bw0+$bw1)/$time*8/1000000]"
    #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 record1 {qmon samples} {
    global ns monFile 
    set throughput [expr [$qmon set bdepartures_]*3.2/10000.9]
    set byteint [$qmon get-bytes-integrator]
    if {[$samples cnt] != 0} {
        set mean [$samples mean]
    } else {
        set mean 0
    }
    puts $monFile "[$ns now] $throughput [$qmon set bdrops_] [$byteint set 
sum_] $mean"
    $qmon reset
    $samples reset
    $ns at [expr [$ns now]+0.025] "record1 $qmon $samples"
}

proc attach-expoo-traffic { node sink class size burst idle rate agent traffica 
} {
    global ns f2 monFile
    #Erzeugen neuer Agents und konfig. parameter setzen
    set source [new Agent/$agent]
    $source set fid_ $class
    $source set prio_ $class
    $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
    puts $f2 "$traffic $node $sink $size $burst $idle $rate $agent $traffica 
$source $monFile"
    return $traffic
}

#Finishprozedur hinzufügen
proc finish {} {
    global ns nf f0 f1 f2 f3 lf monFile
    $ns flush-trace    
    close $f0
    close $f1
    close $f2
    close $f3
    close $nf
    close $lf
    close $monFile
    exec xgraph sink4.tr sink5.tr link2-3.tr -geometry 800x400+90+600 &
    exec xgraph queueStats.mon -geometry 800x400+90+80 &
    exec nam out1.nam &
    exit 0
}

# new simulator / Neuer Simulator
set ns [new Simulator]
#Open the output files / öffnen neuer outputfiles
set f0 [open sink4.tr w]
set f1 [open sink5.tr w]
set f2 [open out2.tr w]
set f3 [open link2-3.tr w]
set lf [open link.tr w]
set monFile [open queueStats.mon 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 10Mb 10ms DropTail
$ns duplex-link $n1 $n2 10Mb 10ms DropTail
$ns duplex-link $n3 $n2 10Mb 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
#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

set qmon [$ns monitor-queue $n2 $n3 monFile]
set samples [new Samples]
$qmon set-delay-samples $samples
$ns at 0.025 "record1 $qmon $samples"

#create the two sources / zwei Sources erzeugen
set rtp [attach-expoo-traffic $n0 $sink4 0 1500kb 0.02s 0.05s 0 RTP RealAudio]
set udp [attach-expoo-traffic $n1 $sink5 2 5000kb 0.02s 0.05s 2500k UDP CBR]
#distinguish the streams / Unterscheiden der Verkehrsströme
$ns color 0 Blue
$ns color 2 Green
#watch the queue / überwachen der Warteschlange
$ns duplex-link-op $n2 $n3 queuePos 0.5
$ns duplex-link-op $n3 $n2 queuePos 0.5
#$ns trace-queue $n2 $n3 $lf 
#start record / Aufnahme beginnen
$ns at 0.0 "record"
#define start stop / Sendebeginn und -ende definieren
$ns at 0.2 "$udp start"
$ns at 4.1 "$udp stop"
$ns at 0.1 "$rtp start"
$ns at 4.5 "$rtp stop"
#fix simulation time / Simulationsdauer festlegen
$ns at 6.0 "finish"
#start simulation / starten der Simulation
$ns run


I hope someone could help me.

kind regards
Tom



      

Reply via email to