ns-3 GridPositionAllocator 属性解释

ns3::GridPositionAllocator 属性解释:
Allocate positions on a rectangular 2d grid. 即把节点分配在一个矩形网格中。
网址:http://www.nsnam.org/doxygen/classns3_1_1_grid_position_allocator.htm

矩形的长度 = GridWidth * DeltaX
矩形的宽度 = GridWidth * DeltaY

GridWidth: The number of objects layed out on a line.  每一行,每一列上的网格数量。
MinX: The x coordinate where the grid starts.  起点x坐标
MinY: The y coordinate where the grid starts.  起点y坐标
DeltaX: The x space between objects.    x增量
DeltaY: The y space between objects.    y增量
LayoutType: The type of layout.         布局类型,是先分配行,还是先分配列
LayoutType值类型:ROW_FIRST,COLUMN_FIRST      

ROW_FIRST: In row-first mode, positions are allocated on the first row until N positions have been allocated. Then, the second row located a yMin + yDelta is used to allocate positions.

COLUMN_FIRST: In column-first mode, positions are allocated on the first column until N positions have been allocated. Then, the second column located a xMin + xDelta is used to allocate positions. 

例:

  NodeContainer c;
  c.Create (25);

 MobilityHelper mobility;
  mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
                                 "MinX", DoubleValue (0.0),
                                 "MinY", DoubleValue (0.0),
                                 "DeltaX", DoubleValue (500),
                                 "DeltaY", DoubleValue (500),
                                 "GridWidth", UintegerValue (5),
                                 "LayoutType", StringValue ("RowFirst"));
  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
  mobility.Install (c);

结果,节点分配位置:



n20  n21  n22  n23  n24

n15  n16  n17  n18  n19

n10  n11  n12  n13  n14

n5   n6   n7   n8   n9

n0   n1   n2   n3   n4





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值