Add multiple interface support in NS-2.33

Introduction:

Codes in this archive add multiple interface support in NS-2.33. I accomplished this work, thanks to Ramon's notes (http://personales.unican.es/aguerocr/). There are many places need to be modified, and there is one line need to be deleted form the legacy tcl code not be pointed out in Ramon's notes, I spent a lot of time to get it worked successfully. Therefor, I decided to share these codes with others who have the same requirement for NS

How to use:

Copy dirs in ns-2.33 to your own ns-2.33, then "make clean", "make"
Use "ns multi/single-interface.tcl" in example dir to run the simulation

Notice:

1. Single-interface scenario could be demonstrated correctly by nam, while multi-interface's nam file has some errors. However, the trace file of the multi-interface scenario shows that the multi-interface module works correctly. From the trace file we could find out that node 1 received data from mac address 0, and then forwarded to node 2. Node 2 received tcp packets from source MAC address 2, while in single-interface scenario the source MAC address would be 1.
Node 0                        Node 1                     Node 2
channel 0            channel 0    channel 2     channel 2
MAC 0                    MAC 1        MAC 2         MAC 3

2. For the single-interface scenario, code generated by NSG2 or NSBench works well. However, for the multi-interface scenario, there would be some constraints for the variabe names in the scenario script.
    1. set ns_ [new Simulator] ;# The simulator instance's variabe name must be ns_
    2. set tracefd [open multi-interface.tr w] ;# The trace file handle's variabe name must be tracefd

Download: Add multiple interface support in NS-2.33

Tags:
上一篇: 为NS2添加多接口支持的代码,Ramon版本
下一篇: 梁静茹-可惜不是你(付歌词)

相关日志推荐

10 条留言

  1. cgm  | 2009-11-22 19:03:33

    謝謝你的分享 我最近也都在用這個模組 有空可以彼此交流一下囉^^
  2. cgm  | 2009-11-23 00:52:53

    另外 想請教一下 您所發現的文件錯誤之處 是在那裡呢?謝謝
  3. yhustc  | 2009-11-23 11:11:51

    是这样的,一般来说,如果有需要删除的语句,这个文档上不是会注释掉么?这样你自己对比一下,注释掉就知道是要删除了。但是在ns-2.33\tcl\lib\ns-mobilenode.tcl第288行$sndT target [$self set ll_(0)],这一行文档上是删除了的,但是没有用注释的方式表达出来,导致我一开始测试总是不能在多接口之间转发。后来仔细对比,发现这一行被删除了
  4. wt  | 2009-12-13 02:59:00

    wt@wt-desktop:~/program/ns-allinone-2.33/ns-2.33/example$ ns % wt@wt-desktop:~/program/ns-allinone-2.33/ns-2.33/example$ ns multi-interface.tcl num_nodes is set 9 (_o7 cmd line 1) invoked from within "_o7 cmd change-numifs 1" invoked from within "catch "$self cmd $args" ret" invoked from within "if [catch "$self cmd $args" ret] { set cls [$self info class] global errorInfo set savedInfo $errorInfo error "error when calling class $cls: $args" $..." (procedure "_o7" line 2) (SplitObject unknown line 2) invoked from within "$ns_ change-numifs 1" (file "multi-interface.tcl" line 63) wt@wt-desktop:~/program/ns-allinone-2.33/ns-2.33/example$ ns single-interface.tcl num_nodes is set 3 INITIALIZE THE LIST xListHead channel.cc:sendUp - Calc highestAntennaZ_ and distCST_ highestAntennaZ_ = 1.5, distCST_ = 550.0 SORTING LISTS ...DONE! wt@wt-desktop:~/program/ns-allinone-2.33/ns-2.33/example$
  5. dk  | 2010-03-09 17:20:33

    您好,我运行你的代码时也出现像 wt | 2009-12-13 02:59:00所说的情况,什么原因呢?
  6. yhustc  | 2010-03-10 13:44:17

    楼上两位朋友,之前我回复说无法复现这个问题,估计是因为我的代码确实没问题。今天师弟叫我帮忙看看,我发现报的错跟你们两们是一样的。然后我去ns-2.33/tcl/lib/ns-lib.tcl里面调试,发现他的这个文件里面根本没有change-numifs函数,这个函数应该是在2277行。后来师弟发现解压没搞正确,没有覆盖掉原来的ns-lib.tcl,所以没有增加修改后的那部分代码。你们可以打开这个文件确认一下是修改过的版本。
  7. 反应BUG  | 2010-03-11 16:19:11

    当给文章添加一个分类,但是不给他添加任何文章时,当在首页点击 该分类时,会出现 错误:SQL 语法错误, 我调试了下,发现在分类里没有任何文章时,BlogAction.class.php的第171行$postList = $postsDao->where($where)->order("top DESC,post_date DESC")->limit($page->firstRow.','.$page->listRows)->findAll(); 执行后 $postList值为false 。下面一行代码:if(count($postList) > 0) 这里当$postList为false时,count函数返回的是1 ,所以继续往下执行,这样当然就会出错了,我查了下PHP手册,有这么一句:对于count(var)函数如果 如果 var 不是数组类型或者实现了 Countable 接口的对象,将返回 1,有一个例外,如果 var 是 NULL 则结果是 0。 所以在该文件的175行的 if(count($postList) > 0) 应该再加个条件限制 :if(count($postList) > 0 && $postList!==false) 这样就没问题了。
  8. yhustc  | 2010-03-14 13:50:06

    楼上的朋友,非常感谢你的反馈
  9. maniac2413  | 2011-05-29 07:25:49

    請問一下,Ramon在第五章所提及的routingAgent.h和routingAgent.cc這兩個文件,始終找不到。 是否不用去理會他呢?
  10. yhustc  | 2011-05-30 01:57:11

    文檔裏面的文件名,是一個統稱。因為他希望說明一下任意的路由協議應該如何修改,所以沒有特指哪一種。routingAgent就是與路由相關的文件,在我提供的壓縮包裏面,就是aodv.h, aodv.cc。同理,如果你需要修改其他的路由協議以支持多接口,需要修改對應的路由協議文件。

发表评论

  
  
   (点击图片更换验证码)
点击刷新验证码