The Network Simulator ns-2: Topology Generation

The Network Simulator ns-2: Topology Generation

Topology generation is required for network simulations. In NS-2 you may create a topology for simulation using one of the following methods:

  • by using the Inet topology generator.
  • by using the GT-ITM topology generator.
  • by using the Tiers topology generator.
  • by using the other topology generators.
  • by hand

 

Inet Topology Generator

  • Generating graphs from Inet topology generator

     

  • Conversion of Inet output to ns-2 format
    Use inet2ns to convert the inet topology to ns.
#!/usr/bin/perl
# Program to convert a inet topology to ns format
# Usage: inet2ns < inet.topo > ns.topo 
# Usage in ns : source ns.topo  in your tcl script and then
# call the procedure to create the topology using 
# create-topology linkbw [scaling factor for delay]  
# Assumptions: Eucliedian distance between the nodes is in miles.
# Hence propogation delay = distance / speed of light (186 x 10^3 miles/sec) 


#Read first line for number of nodes and links
chomp($line = <STDIN>);
($nodes, $links) = split(' ',$line);

print "proc create-topology { linkBW {sf 1} } {/n";
print "/tglobal ns/n";
print "/n/t#Create $nodes nodes in the topology/n";
print "/tfor {set i 0} {/$i < $nodes} {incr i} {/n";
print "/t/tset n(/$i) [/$ns node]/n";
print "/t}/n/n/n";
print "/t#Create $links edges in the topology/n";


#Skip all the location information
for ($i=0; $i<$nodes;$i++){
        $line = <STDIN>;
   
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值