我在用ns3模拟一个无线数据中心。我使用“GridPositionAllocator”从2D拓扑开始。
MobilityHelper mobility;
mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
"MinX", DoubleValue (0.0),
"MinY", DoubleValue (0.0),
"DeltaX", DoubleValue (1.0),
"DeltaY", DoubleValue (1.0),
"GridWidth", UintegerValue (8),
"LayoutType", StringValue ("ColumnFirst"));
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (wifiNodes);
如何将其改为3D,以便在机架中放置多个服务器?
原则上,ns-3确实支持3D移动性,因为移动性向量是3D(X,Y,Z),然而没有为此实现'PositionAllocator'。欢迎提供捐助。
一个简单的解决方案是扩展这个假定z=0的GridPositionAllocator,并用相应的MinZ,deltaz添加第三维。
是的,但是添加具有网格位置分配器的3D拓扑是不可能的。您可以使用ListPostionAllocator手动指定所有节点的位置。
您可以使用以下方法:
Ptr<ListPostionAllocator> lp =CreateObject<ListPostionAllocator>();
//Adding locations of 2 nodes
lp->ADD(Vector (10.0,10.0,10.0);
lp->ADD(Vector (20.0,20.0,20.0); //Add locations of all the nodes
mobHelper.SetpostionAllocator(lp);