simplify onoffhelper syntax

main
EmaMaker 2023-12-30 12:10:49 +00:00
parent c0401936b0
commit c866e09b18
1 changed files with 3 additions and 9 deletions

View File

@ -308,35 +308,29 @@ int main(int argc, char* argv[])
server1_app.Start(Seconds(0));
// Node 11 that sends to server 0
OnOffHelper onOffHelper_11("ns3::TcpSocketFactory", iStations.GetAddress(1));
OnOffHelper onOffHelper_11("ns3::TcpSocketFactory", InetSocketAddress(ipptp02.GetAddress(0), port0));
onOffHelper_11.SetAttribute("OnTime", StringValue("ns3::ExponentialRandomVariable[Mean=1]"));
onOffHelper_11.SetAttribute("OffTime", StringValue("ns3::ExponentialRandomVariable[Mean=1]"));
onOffHelper_11.SetAttribute("PacketSize", UintegerValue(1821));
AddressValue address0_11(InetSocketAddress(ipptp02.GetAddress(0), port0));
onOffHelper_11.SetAttribute("Remote", address0_11);
onOffHelper_11.SetAttribute("StartTime", StringValue("1.15s"));
ApplicationContainer node11_app;
node11_app.Add(onOffHelper_11.Install(wifiStaNodes.Get(1)));
node11_app.Start(Seconds(1.15));
// Node 15 that sends to server 1
OnOffHelper onOffHelper_10("ns3::TcpSocketFactory", iStations.GetAddress(0));
OnOffHelper onOffHelper_10("ns3::TcpSocketFactory", InetSocketAddress(ipptp12.GetAddress(0), port0));
onOffHelper_10.SetAttribute("OnTime", StringValue("ns3::ExponentialRandomVariable[Mean=1]"));
onOffHelper_10.SetAttribute("OffTime", StringValue("ns3::ExponentialRandomVariable[Mean=1]"));
onOffHelper_10.SetAttribute("PacketSize", UintegerValue(1829));
AddressValue address0_10(InetSocketAddress(InetSocketAddress(ipptp12.GetAddress(0), port0)));
onOffHelper_10.SetAttribute("StartTime", StringValue("3.39s"));
onOffHelper_10.SetAttribute("Remote", address0_10);
ApplicationContainer node10_app;
node10_app.Add(onOffHelper_10.Install(wifiStaNodes.Get(0)));
node10_app.Start(Seconds(3.39));
// Node 15 that sends to server 0
OnOffHelper onOffHelper_15("ns3::TcpSocketFactory", iStations.GetAddress(5));
OnOffHelper onOffHelper_15("ns3::TcpSocketFactory", InetSocketAddress(ipptp02.GetAddress(0), port1));
onOffHelper_15.SetAttribute("OnTime", StringValue("ns3::ExponentialRandomVariable[Mean=1]"));
onOffHelper_15.SetAttribute("OffTime", StringValue("ns3::ExponentialRandomVariable[Mean=1]"));
onOffHelper_15.SetAttribute("PacketSize", UintegerValue(1099));
AddressValue address0_15(InetSocketAddress(ipptp02.GetAddress(0), port1));
onOffHelper_15.SetAttribute("StartTime", StringValue("3.71s"));
onOffHelper_15.SetAttribute("Remote", address0_15);
ApplicationContainer node15_app;
node15_app.Add(onOffHelper_15.Install(wifiStaNodes.Get(5)));
node15_app.Start(Seconds(3.71));