??ns3的官方手冊很全,相關書籍也是有的,官網先貼在這里:
ns-3 | a discrete-event network simulator for internet systemsa discrete-event network simulator for internet systemshttps://www.nsnam.org/相關的腳本介紹也都有一些:
ns-3.35_wifi-he-network.cc_ns-3網絡仿真工具wifi腳本解析_wifi腳本網絡拓撲_ns-3wifi6吞吐腳本關鍵注釋_吞吐部分_基礎ns-3_ns3.35-CSDN博客
ns-3-model-library wifi 淺析_ns-3wifi部分解析_ns-3網絡模擬器wifi部分文檔分析_Part1_ns3 wifiphy物理層沖突-CSDN博客
ns-3-model-library wifi 淺析_ns-3wifi部分解析_ns-3網絡模擬器wifi部分文檔分析_Part2_yansphy-CSDN博客
在進行wifi飽和流測試的時候我們需要指定UDP 包間隔,如下interval?
const auto maxLoad = nLinks *EhtPhy::GetDataRate(mcs,MHz_u{static_cast<double>(width)},NanoSeconds(gi),1) /nStations;std::cout << " nLinks= " << nLinks << " nStations=" << nStations << " maxLoad=" << maxLoad << " bps" <<std::endl;if (udp){// UDP flowuint16_t port = 9;UdpServerHelper server(port);serverApp = server.Install(serverNodes.get());streamNumber += server.AssignStreams(serverNodes.get(), streamNumber);serverApp.Start(Seconds(0));serverApp.Stop(simulationTime + Seconds(1));const auto packetInterval = payloadSize * 8.0 / maxLoad;for (std::size_t i = 0; i < nStations; i++){UdpClientHelper client(serverInterfaces.GetAddress(i), port);client.SetAttribute("MaxPackets", UintegerValue(4294967295U));client.SetAttribute("Interval", TimeValue(Seconds(packetInterval)));client.SetAttribute("PacketSize", UintegerValue(payloadSize));ApplicationContainer clientApp = client.Install(clientNodes.Get(i));streamNumber += client.AssignStreams(clientNodes.Get(i), streamNumber);clientApp.Start(Seconds(1));clientApp.Stop(simulationTime + Seconds(1));}}
那么最合理的包間隔就是剛好滿足上限,這樣仿真更快還保證飽和,上面代碼就是很好的例子,運行打印如下:
nLinks= 1?nStations=1 maxLoad=8602942 bps
根據mcs0 單流 gi 800ns,20M 帶寬,我們可以作如下計算:
理論協商最大速率 = (1 * 1/2?* 1 * 234)/ (12.8 + 0.8) = 8.60294117
BPSK 1符號1bit
碼率1/2
單流
子載波234個
數據時間12.8us
guard interval 0.8us
計算與函數輸出一致
包長乘8就是就是一包bit數,除以最大速率就是一包用多少秒,也就是interval。