NS2 NAM medium node and data stream color settings

Source: Internet
Author: User

NS2 node color settings in the http://hi.baidu.com/jrwen0/item/d105c642f4c3ce36fb89601b description of the comparison detailed, you can see.

I want to say here is the data flow color settings, I believe you have tried many times, no effect. Wired I see this here http://www.cs.virginia.edu/~cs757/slidespdf/cs757-ns2-tutorial-exercise.pdf, run the inside of the EXAMPLE2.TCL, the program is as follows


#Create a Simulator object

Set NS [new Simulator] #Define different colors for data flows <span style= "color: #ff0000;" > $ns color 1 Blue $ns color 2 red</span> #Open The NAM trace file set NF [Open Out.nam W] $ns namtrace-all $nf #D Efine a ' Finish ' procedure proc finish {} {global ns NF $ns flush-trace #Close The trace file Close $nf #Execute nam on t
He trace file exec nam–a Out.nam & exit 0} #Create four nodes set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] Set N3 [$ns node] #Create links between the nodes $ns duplex-link $n 0 $n 2 1Mb 10ms droptail $ns duplex-link $n 1 $n 2 1Mb 10 Ms Droptail $ns Duplex-link $n 3 $n 2 1Mb 10ms SFQ $ns duplex-link-op $n 0 $n 2 Orient right-down $ns duplex-link-op $n 1 $n 2 O Rient right-up $ns duplex-link-op $n 2 $n 3 Orient right #Monitor the queue for the link between Node 2 and Node 3 $ns duple X-link-op $n 2 $n 3 Queuepos 0.5 #Create a UDP agent and attach it to node n0 <span style= "color: #ff0000;" >set udp0 [New AGENT/UDP] $UDP 0 Set Class_ 1</span> $ns atTach-agent $n 0 $udp 0 # Create a CBR traffic source and attach it to udp0 set cbr0 [new APPLICATION/TRAFFIC/CBR] $CBR 0 Set Packetsize_ $CBR 0 Set Interval_ 0.005 $cbr 0 attach-agent $udp 0 #Create a UDP agent and attach it to node N1 <span s Tyle= "Background-color:rgb (255, 255, 255); ><span style= "color: #ff0000;" >set UDP1 [New agent/udp]</span></span> <span style= "color: #ff0000;" > $UDP 1 set class_ 2</span> $ns attach-agent $n 1 $udp 1 # Create a CBR traffic source and attach it to UDP1 set CBR 1 [New APPLICATION/TRAFFIC/CBR] $CBR 1 set packetsize_ $CBR 1 set interval_ 0.005 $cbr 1 attach-agent $udp 1 #Create a Nul L Agent (a traffic sink) and attach it to node N3 set null0 [New Agent/null] $ns attach-agent $n 3 $null 0 #Connect the Traf FIC sources with the traffic sink $ns connect $udp 0 $null 0 $ns connect $udp 1 $null 0 #Schedule events for the CBR agents $ NS at 0.5 ' $cbr 0 start ' $ns at 1.0 ' $CBR 1 start ' $ns at 4.0 ' $CBR 1 Stop ' $ns at 4.5 ' $CBR 0 Stop ' #CallThe finish procedure after 5 seconds of simulation time $ns at 5.0 "Finish" #Run the simulation $ns Run 

Red will be the data flow color settings, I believe that the first link, we also see the mobile node settings need to be in the case of 802.15.4 color, but we use 802.11 in the mobile environment, temporary link to the method given in the temporary can not solve the problem. I hope that we will actively discuss the solution to the problem.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.