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>;
$ref->[$i] = 0;
}
for

本文介绍了在NS-2网络模拟器中创建拓扑的几种方法,包括Inet、GT-ITM、Tiers和其他拓扑生成器。详细讲解了如何将这些生成器的输出转换为ns-2可读的格式,以及手动创建简单拓扑的步骤。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



