NS and Network Simulation

Source: Internet
Author: User
I learned the book "ns and network simulation" compiled by Mr. Xu leiming. Now I just read it again, but I still don't know much about it, after all, it is not that two weeks that the NS2. however, the examples in the examples have been completed and can be run, although they are not quite understandable. Here is a summary:

The source code of the wireless simulation example in section 2.5 in the book is incorrect, change $ ns Node-config-addresstype flat in row 29th to $ ns Node-config-addressingtype flat/or $ ns Node-config-addresstype DEF /. In the case study in chapter 7, a flood protocol is added for the wireless self-networking part in the NS2. The source code on the printed book can only be used for reference and cannot be run, even if the source code of the optical disc is available, due to version inconsistency, this example still fails to be called. The mflood example can only be run in ns2.26, but cannot be executed in versions 2.27 or later. On the Internet, a teacher ke solved the problem of the new version of mflood ns. He has a related introduction on his webpage, only on mflood. CC and mflood. H and so on. Here is a brief introduction to the process. 1. Modify ~ NS/Tcl/ns-lib.tcl file, add the following code to the create-Wireless-node member function of the simulator class: Switch-exact $ routingagent _ {; # original code, call Based on the specified route protocol name; # mflood function for different protocols. {set ragent [$ self create-mflood-agent $ node]} 2. in ~ The create-mflood-Agent member function is defined in NS/Tcl/ns-lib.tcl with the following code: simulator instproc create-mflood-agent {node} {set ragent [new agent/mflood [$ node id] $ node set ragent _ $ ragent return $ ragent} 3. in ~ NS/Tcl/lib/ns-packet.tcl to add the header name mflood: foreach prot {mflood put ........} 4. Modify ~ NS/common/packet. h to add the definition of the package type. First, add an item in Enum packet_t to indicate the new package type, which is defined as pt_mflood. Then, add a line in the p_info () constructor of the class p_info class to give the name of the new package type: Name _ [pt_mflood] = "mflood"; 5. In ~ Ns-allinone-2.30/ns2.30/new folder mflood, copy the source code in. Add the code to the CD code as prompted on instructor Ke's webpage, which is the perfect source code. If you copy all the Code provided by instructor ke directly, make will have errors and cannot be compiled. 6. In ~ In the NS directory, modify the MAKEFILE file and add the following line to the obj_cc variable definition: mflood/mflood. O mflood/mflood-seqtable.o/7. compile. Enter the directory where makefile is located # cd/home/NS2/ns-allinone-2.30/ns2.30/# Make clean # Make depend # Make // time to a little longer, compile the end of OK 8. you can run an example, the disc source code has a mflood-3nodes.tcl example can be, other seems to have errors. Write this article first, continue learning tomorrow, and continue to talk about future progress. Thanks to the selfless dedication of Some netizens, we have provided a lot of valuable information and help for beginners of NS2. Reference from:

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.