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





發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章