37#include "ns3/antenna-module.h"
38#include "ns3/applications-module.h"
39#include "ns3/config-store-module.h"
40#include "ns3/config-store.h"
41#include "ns3/core-module.h"
42#include "ns3/flow-monitor-module.h"
43#include "ns3/internet-apps-module.h"
44#include "ns3/internet-module.h"
46#include "ns3/mobility-module.h"
47#include "ns3/network-module.h"
48#include "ns3/nr-module.h"
49#include "ns3/nr-radio-environment-map-helper.h"
50#include "ns3/ping-helper.h"
51#include "ns3/point-to-point-module.h"
52#include "ns3/rng-seed-manager.h"
53#include "ns3/three-gpp-ftp-m1-helper.h"
54#include "ns3/three-gpp-http-client.h"
55#include "ns3/three-gpp-http-helper.h"
56#include "ns3/three-gpp-http-server.h"
57#include "ns3/three-gpp-http-variables.h"
58#include "ns3/traffic-generator-ngmn-ftp-multi.h"
59#include "ns3/traffic-generator-ngmn-gaming.h"
60#include "ns3/traffic-generator-ngmn-video.h"
61#include "ns3/traffic-generator-ngmn-voip.h"
74NS_LOG_COMPONENT_DEFINE(
"CttcNrTrafficNgmnMixed");
76class RadioNetworkParametersHelper
83 void SetNetworkParams(
const std::string scenario,
84 const std::string operationMode,
90 double GetTxPower()
const;
96 double GetBandwidth()
const;
102 double GetCentralFrequency()
const;
105 double m_txPower{-1.0};
106 double m_bandwidth{0.0};
107 double m_centralFrequency{-1.0};
111RadioNetworkParametersHelper::SetNetworkParams(
const std::string scenario,
112 const std::string operationMode,
115 NS_ABORT_MSG_IF(scenario !=
"UMa" && scenario !=
"UMi",
"Unsupported scenario");
117 m_centralFrequency = 2e9;
118 m_bandwidth = 20e6 * numCcs;
119 if (operationMode ==
"FDD")
121 m_bandwidth += m_bandwidth;
123 if (scenario ==
"UMa")
134RadioNetworkParametersHelper::GetTxPower()
const
140RadioNetworkParametersHelper::GetBandwidth()
const
146RadioNetworkParametersHelper::GetCentralFrequency()
const
148 return m_centralFrequency;
153 std::string scenario,
154 std::string radioNetwork,
155 std::string operationMode,
156 std::string direction,
157 NodeContainer gnbSector1Container,
158 NodeContainer gnbSector2Container,
159 NodeContainer gnbSector3Container,
160 NodeContainer ueSector1Container,
161 NodeContainer ueSector2Container,
162 NodeContainer ueSector3Container,
163 Ptr<NrPointToPointEpcHelper>& baseNrEpcHelper,
164 Ptr<NrHelper>& nrHelper,
165 NetDeviceContainer& gnbSector1NetDev,
166 NetDeviceContainer& gnbSector2NetDev,
167 NetDeviceContainer& gnbSector3NetDev,
168 NetDeviceContainer& ueSector1NetDev,
169 NetDeviceContainer& ueSector2NetDev,
170 NetDeviceContainer& ueSector3NetDev,
176 RadioNetworkParametersHelper ranHelper;
177 ranHelper.SetNetworkParams(scenario, operationMode, 1);
188 Ptr<IdealBeamformingHelper> idealBeamformingHelper = CreateObject<IdealBeamformingHelper>();
189 nrHelper = CreateObject<NrHelper>();
192 nrHelper->SetBeamformingHelper(idealBeamformingHelper);
194 Ptr<NrPointToPointEpcHelper> nrEpcHelper =
195 DynamicCast<NrPointToPointEpcHelper>(baseNrEpcHelper);
196 nrHelper->SetEpcHelper(nrEpcHelper);
212 double centralFrequencyBand = ranHelper.GetCentralFrequency();
213 double bandwidthBand = ranHelper.GetBandwidth();
214 const uint8_t numCcPerBand = 1;
215 NS_ABORT_MSG_UNLESS(scenario ==
"UMa" || scenario ==
"UMi",
"Unsupported scenario");
217 std::string errorModel =
"";
219 if (radioNetwork ==
"LTE")
221 errorModel =
"ns3::LenaErrorModel";
223 else if (radioNetwork ==
"NR")
225 errorModel =
"ns3::NrEesmIrT2";
229 nrHelper->SetUlErrorModel(errorModel);
230 nrHelper->SetDlErrorModel(errorModel);
233 nrHelper->SetGnbDlAmcAttribute(
236 nrHelper->SetGnbUlAmcAttribute(
257 double centralFrequencyBand1 = centralFrequencyBand - bandwidthBand;
258 double centralFrequencyBand2 = centralFrequencyBand;
259 double centralFrequencyBand3 = centralFrequencyBand + bandwidthBand;
260 double bandwidthBand1 = bandwidthBand;
261 double bandwidthBand2 = bandwidthBand;
262 double bandwidthBand3 = bandwidthBand;
264 uint8_t numBwpPerCc = 1;
265 if (operationMode ==
"FDD")
268 Config::SetDefault(
"ns3::NrUeNetDevice::PrimaryUlIndex", UintegerValue(1));
289 Ptr<NrChannelHelper> channelHelper = CreateObject<NrChannelHelper>();
293 channelHelper->ConfigureFactories(scenario,
"Default",
"ThreeGpp");
295 Config::SetDefault(
"ns3::ThreeGppChannelModel::UpdatePeriod", TimeValue(MilliSeconds(0)));
296 channelHelper->SetChannelConditionModelAttribute(
"UpdatePeriod", TimeValue(MilliSeconds(0)));
297 channelHelper->SetPathlossAttribute(
"ShadowingEnabled", BooleanValue(
false));
299 channelHelper->AssignChannelsToBands({band1, band2, band3});
306 double txPower = ranHelper.GetTxPower();
326 Packet::EnableChecking();
327 Packet::EnablePrinting();
333 if (radioNetwork ==
"LTE")
335 idealBeamformingHelper->SetAttribute(
341 idealBeamformingHelper->SetAttribute(
"BeamformingMethod",
346 if (radioNetwork ==
"LTE")
348 nrHelper->SetSchedulerTypeId(TypeId::LookupByName(
"ns3::NrMacSchedulerOfdmaPF"));
349 nrHelper->SetSchedulerAttribute(
"DlCtrlSymbols", UintegerValue(1));
352 nrEpcHelper->SetAttribute(
"S1uLinkDelay", TimeValue(MilliSeconds(0)));
355 nrHelper->SetUeAntennaAttribute(
"NumRows", UintegerValue(1));
356 nrHelper->SetUeAntennaAttribute(
"NumColumns", UintegerValue(1));
357 nrHelper->SetUeAntennaAttribute(
"AntennaElement",
358 PointerValue(CreateObject<IsotropicAntennaModel>()));
361 nrHelper->SetGnbAntennaAttribute(
"NumRows", UintegerValue(8));
362 nrHelper->SetGnbAntennaAttribute(
"NumColumns", UintegerValue(8));
363 nrHelper->SetGnbAntennaAttribute(
"AntennaElement",
364 PointerValue(CreateObject<ThreeGppAntennaModel>()));
367 nrHelper->SetGnbPhyAttribute(
"Numerology", UintegerValue(1));
369 nrHelper->SetGnbPhyAttribute(
"TxPower", DoubleValue(txPower));
371 nrHelper->SetUePhyAttribute(
"TxPower", DoubleValue(20.0));
374 if (radioNetwork ==
"LTE")
376 nrHelper->SetGnbMacAttribute(
"NumRbPerRbg", UintegerValue(4));
380 uint32_t bwpIdForLowLat = 0;
381 if (operationMode ==
"FDD" && direction ==
"UL")
388 nrHelper->SetGnbBwpManagerAlgorithmAttribute(
"NGBR_VIDEO_TCP_DEFAULT",
389 UintegerValue(bwpIdForLowLat));
392 nrHelper->SetUeBwpManagerAlgorithmAttribute(
"NGBR_VIDEO_TCP_DEFAULT",
393 UintegerValue(bwpIdForLowLat));
402 gnbSector1NetDev = nrHelper->InstallGnbDevice(gnbSector1Container, bwps1);
403 gnbSector2NetDev = nrHelper->InstallGnbDevice(gnbSector2Container, bwps2);
404 gnbSector3NetDev = nrHelper->InstallGnbDevice(gnbSector3Container, bwps3);
405 ueSector1NetDev = nrHelper->InstallUeDevice(ueSector1Container, bwps1);
406 ueSector2NetDev = nrHelper->InstallUeDevice(ueSector2Container, bwps2);
407 ueSector3NetDev = nrHelper->InstallUeDevice(ueSector3Container, bwps3);
409 int64_t randomStream = 1;
410 randomStream += nrHelper->AssignStreams(gnbSector1NetDev, randomStream);
411 randomStream += nrHelper->AssignStreams(gnbSector2NetDev, randomStream);
412 randomStream += nrHelper->AssignStreams(gnbSector3NetDev, randomStream);
413 randomStream += nrHelper->AssignStreams(ueSector1NetDev, randomStream);
414 randomStream += nrHelper->AssignStreams(ueSector2NetDev, randomStream);
415 randomStream += nrHelper->AssignStreams(ueSector3NetDev, randomStream);
424 for (uint32_t numCell = 0; numCell < gnbSector1NetDev.GetN(); ++numCell)
426 Ptr<NetDevice> gnb = gnbSector1NetDev.Get(numCell);
427 uint32_t numBwps = nrHelper->GetNumberBwp(gnb);
431 Ptr<NrGnbPhy> phy = nrHelper->GetGnbPhy(gnb, 0);
432 Ptr<UniformPlanarArray> antenna =
433 DynamicCast<UniformPlanarArray>(phy->GetSpectrumPhy()->GetAntenna());
434 antenna->SetAttribute(
"BearingAngle", DoubleValue(orientationRads));
436 nrHelper->GetGnbPhy(gnb, 0)->SetAttribute(
"Pattern",
437 StringValue(
"F|F|F|F|F|F|F|F|F|F|"));
440 else if (numBwps == 2)
443 Ptr<NrGnbPhy> phy0 = nrHelper->GetGnbPhy(gnb, 0);
444 Ptr<UniformPlanarArray> antenna0 =
445 DynamicCast<UniformPlanarArray>(phy0->GetSpectrumPhy()->GetAntenna());
446 antenna0->SetAttribute(
"BearingAngle", DoubleValue(orientationRads));
447 Ptr<NrGnbPhy> phy1 = nrHelper->GetGnbPhy(gnb, 1);
448 Ptr<UniformPlanarArray> antenna1 =
449 DynamicCast<UniformPlanarArray>(phy1->GetSpectrumPhy()->GetAntenna());
450 antenna1->SetAttribute(
"BearingAngle", DoubleValue(orientationRads));
452 nrHelper->GetGnbPhy(gnb, 0)->SetAttribute(
454 StringValue(
"DL|DL|DL|DL|DL|DL|DL|DL|DL|DL|"));
455 nrHelper->GetGnbPhy(gnb, 1)->SetAttribute(
457 StringValue(
"UL|UL|UL|UL|UL|UL|UL|UL|UL|UL|"));
460 nrHelper->GetBwpManagerGnb(gnb)->SetOutputLink(1, 0);
465 NS_ABORT_MSG(
"Incorrect number of BWPs per CC");
470 for (uint32_t numCell = 0; numCell < gnbSector2NetDev.GetN(); ++numCell)
472 Ptr<NetDevice> gnb = gnbSector2NetDev.Get(numCell);
473 uint32_t numBwps = nrHelper->GetNumberBwp(gnb);
477 Ptr<NrGnbPhy> phy = nrHelper->GetGnbPhy(gnb, 0);
478 Ptr<UniformPlanarArray> antenna =
479 DynamicCast<UniformPlanarArray>(phy->GetSpectrumPhy()->GetAntenna());
480 antenna->SetAttribute(
"BearingAngle", DoubleValue(orientationRads));
482 nrHelper->GetGnbPhy(gnb, 0)->SetAttribute(
"Pattern",
483 StringValue(
"F|F|F|F|F|F|F|F|F|F|"));
486 else if (numBwps == 2)
489 Ptr<NrGnbPhy> phy0 = nrHelper->GetGnbPhy(gnb, 0);
490 Ptr<UniformPlanarArray> antenna0 =
491 DynamicCast<UniformPlanarArray>(phy0->GetSpectrumPhy()->GetAntenna());
492 antenna0->SetAttribute(
"BearingAngle", DoubleValue(orientationRads));
493 Ptr<NrGnbPhy> phy1 = nrHelper->GetGnbPhy(gnb, 1);
494 Ptr<UniformPlanarArray> antenna1 =
495 DynamicCast<UniformPlanarArray>(phy1->GetSpectrumPhy()->GetAntenna());
496 antenna1->SetAttribute(
"BearingAngle", DoubleValue(orientationRads));
498 nrHelper->GetGnbPhy(gnb, 0)->SetAttribute(
500 StringValue(
"DL|DL|DL|DL|DL|DL|DL|DL|DL|DL|"));
501 nrHelper->GetGnbPhy(gnb, 1)->SetAttribute(
503 StringValue(
"UL|UL|UL|UL|UL|UL|UL|UL|UL|UL|"));
505 nrHelper->GetBwpManagerGnb(gnb)->SetOutputLink(1, 0);
510 NS_ABORT_MSG(
"Incorrect number of BWPs per CC");
515 for (uint32_t numCell = 0; numCell < gnbSector3NetDev.GetN(); ++numCell)
517 Ptr<NetDevice> gnb = gnbSector3NetDev.Get(numCell);
518 uint32_t numBwps = nrHelper->GetNumberBwp(gnb);
522 Ptr<NrGnbPhy> phy = nrHelper->GetGnbPhy(gnb, 0);
523 Ptr<UniformPlanarArray> antenna =
524 DynamicCast<UniformPlanarArray>(phy->GetSpectrumPhy()->GetAntenna());
525 antenna->SetAttribute(
"BearingAngle", DoubleValue(orientationRads));
527 nrHelper->GetGnbPhy(gnb, 0)->SetAttribute(
"Pattern",
528 StringValue(
"F|F|F|F|F|F|F|F|F|F|"));
531 else if (numBwps == 2)
534 Ptr<NrGnbPhy> phy0 = nrHelper->GetGnbPhy(gnb, 0);
535 Ptr<UniformPlanarArray> antenna0 =
536 DynamicCast<UniformPlanarArray>(phy0->GetSpectrumPhy()->GetAntenna());
537 antenna0->SetAttribute(
"BearingAngle", DoubleValue(orientationRads));
538 Ptr<NrGnbPhy> phy1 = nrHelper->GetGnbPhy(gnb, 1);
539 Ptr<UniformPlanarArray> antenna1 =
540 DynamicCast<UniformPlanarArray>(phy1->GetSpectrumPhy()->GetAntenna());
541 antenna1->SetAttribute(
"BearingAngle", DoubleValue(orientationRads));
543 nrHelper->GetGnbPhy(gnb, 0)->SetAttribute(
545 StringValue(
"DL|DL|DL|DL|DL|DL|DL|DL|DL|DL|"));
546 nrHelper->GetGnbPhy(gnb, 1)->SetAttribute(
548 StringValue(
"UL|UL|UL|UL|UL|UL|UL|UL|UL|UL|"));
550 nrHelper->GetBwpManagerGnb(gnb)->SetOutputLink(1, 0);
555 NS_ABORT_MSG(
"Incorrect number of BWPs per CC");
561 if (operationMode ==
"FDD")
563 for (uint32_t i = 0; i < ueSector1NetDev.GetN(); i++)
565 nrHelper->GetBwpManagerUe(ueSector1NetDev.Get(i))->SetOutputLink(0, 1);
568 for (uint32_t i = 0; i < ueSector2NetDev.GetN(); i++)
570 nrHelper->GetBwpManagerUe(ueSector2NetDev.Get(i))->SetOutputLink(0, 1);
573 for (uint32_t i = 0; i < ueSector3NetDev.GetN(); i++)
575 nrHelper->GetBwpManagerUe(ueSector3NetDev.Get(i))->SetOutputLink(0, 1);
598static inline std::ostream&
599operator<<(std::ostream& os,
const TrafficTypeConf& item)
628 NS_ABORT_MSG(
"Unknown traffic type");
633static inline std::istream&
634operator>>(std::istream& is, TrafficTypeConf& item)
638 item = (TrafficTypeConf)inputValue;
643main(
int argc,
char* argv[])
650 TrafficTypeConf trafficTypeConf = FTP_3GPP_M1;
652 uint32_t udpPacketSize = 600;
658 uint32_t udpLambda = 2000;
659 double ftpM1Lambda = 5;
660 uint32_t ftpM1FileSize = 512000;
661 Time clientAppStartTime = MilliSeconds(400);
662 Time serverAppStartTime = MilliSeconds(400);
665 uint32_t simTimeMs = 1400;
666 Time appStartTime = MilliSeconds(400);
667 std::string direction =
"DL";
668 bool uniformLambda =
true;
671 uint16_t numOuterRings = 0;
672 uint16_t uesPerGnb = 10;
673 std::string scenario =
"UMi";
674 std::string radioNetwork =
"NR";
675 std::string operationMode =
"TDD";
678 std::string simTag =
"default";
679 std::string outputDir =
"./";
680 bool logging =
false;
684 uint8_t ngmnMixedFtpPercentage = 10;
685 uint8_t ngmnMixedHttpPercentage = 20;
686 uint8_t ngmnMixedVideoPercentage = 20;
687 uint8_t ngmnMixedVoipPercentage = 30;
688 uint8_t ngmnMixedGamingPercentage = 20;
695 CommandLine cmd(__FILE__);
697 cmd.AddValue(
"trafficTypeConf",
698 "The traffic type to be configured. Currently the following options are "
699 "available: 0 - UDP CBR, 1 - FTP Model 1, 2 - NGMN FTP, 3 - NGMN VIDEO, 4 - HTTP, "
700 "5-NGMN GAMING, 6 - NGMN VOIP, 7 - NGMN MIXED (e.g., "
701 "10% FTP, 20% HTTP, 20% VIDEO STREAMING, 30% VoIP, 20% GAMING)",
704 "ngmnMixedFtpPercentage",
705 "If trafficTypeConf selected is NGMN MIXED this value can be configured to determine the "
706 "percentage of the FTP traffic. Percentage should be multiply of 10.",
707 ngmnMixedFtpPercentage);
709 "ngmnMixedHttpPercentage",
710 "If trafficTypeConf selected is NGMN MIXED this value can be configured to determine the "
711 "percentage of the HTTP traffic. Percentage should be multiply of 10.",
712 ngmnMixedHttpPercentage);
714 "ngmnMixedVideoPercentage",
715 "If trafficTypeConf selected is NGMN MIXED this value can be configured to determine the "
716 "percentage of the VIDEO traffic. Percentage should be multiply of 10.",
717 ngmnMixedVideoPercentage);
719 "ngmnMixedVoipPercentage",
720 "If trafficTypeConf selected is NGMN MIXED this value can be configured to determine the "
721 "percentage of the VoIP traffic. Percentage should be multiply of 10.",
722 ngmnMixedVoipPercentage);
724 "ngmnMixedGamingPercentage",
725 "If trafficTypeConf selected is NGMN MIXED this value can be configured to determine the "
726 "percentage of the GAMING traffic. Percentage should be multiply of 10.",
727 ngmnMixedGamingPercentage);
728 cmd.AddValue(
"useUdp",
729 "if true, the NGMN applications will run over UDP connection, otherwise a TCP "
730 "connection will be used. "
731 "Notice that HTTP application as it is present in ns-3 simulator is implemented "
732 "as typical HTTP application, i.e., "
733 "based on the TCP protocol and as such cannot be reconfigured to use UDP.",
735 cmd.AddValue(
"ftpM1Lambda",
736 "The lambda to be used for FTP M1 traffic model (Typical values are 2.5, 5). ",
738 cmd.AddValue(
"udpLambda",
"Number of UDP packets generated in one second per UE", udpLambda);
739 cmd.AddValue(
"uniformLambda",
740 "1: Use same lambda (packets/s) for all UEs and cells (equal to 'lambda' input), "
741 "0: use different packet arrival rates (lambdas) among cells",
743 cmd.AddValue(
"scenario",
"The urban scenario string (UMa or UMi)", scenario);
744 cmd.AddValue(
"numRings",
"The number of rings around the central site", numOuterRings);
745 cmd.AddValue(
"uesPerGnb",
746 "The number of UE per gNB, should be multiply of 10 so that the mixed traffic "
749 cmd.AddValue(
"logging",
"Enable logging", logging);
750 cmd.AddValue(
"traces",
"Enable output traces", traces);
751 cmd.AddValue(
"packetSize",
"packet size in bytes to be used by UE traffic", udpPacketSize);
752 cmd.AddValue(
"simTimeMs",
"Simulation time", simTimeMs);
753 cmd.AddValue(
"direction",
"The flow direction (DL or UL)", direction);
754 cmd.AddValue(
"technology",
"The radio access network technology", radioNetwork);
755 cmd.AddValue(
"operationMode",
"The network operation mode can be TDD or FDD", operationMode);
756 cmd.AddValue(
"simTag",
757 "tag to be appended to output filenames to distinguish simulation campaigns",
759 cmd.AddValue(
"outputDir",
"directory where to store simulation results", outputDir);
762 cmd.Parse(argc, argv);
770 "Currently only supported values for traffic type are 0, 1, 2. Meaning: 0 -UDP CBR, 1 - "
771 "FTP Model 1, 2 - NGMN FTP, 3 - NGMN VIDEO, 4- HTTP, 5- NGMN GAMING, 6 - VOIP, 7 - NGMN "
772 "MIXED (e.g., 10% FTP, 20% HTTP, 20% VIDEO STREAMING, 30% VoIP, 20% GAMING");
773 NS_ABORT_MSG_IF(direction !=
"DL" && direction !=
"UL",
"Flow direction can only be DL or UL");
774 NS_ABORT_MSG_IF(operationMode !=
"TDD" && operationMode !=
"FDD",
775 "Operation mode can only be TDD or FDD");
776 NS_ABORT_MSG_IF(radioNetwork !=
"LTE" && radioNetwork !=
"NR",
777 "Unrecognized radio network technology");
780 trafficTypeConf == 7 &&
781 (ngmnMixedFtpPercentage + ngmnMixedHttpPercentage + ngmnMixedVideoPercentage +
782 ngmnMixedVoipPercentage + ngmnMixedGamingPercentage) != 100,
783 "If trafficTypeConf selected is the NGMN mixed, then the sum of the percentages of FTP, "
784 "VOIP, HTTP, VIDEO STREAMING and GAMING traffic should give 100.");
797 LogComponentEnable(
"UdpClient", LOG_LEVEL_INFO);
798 LogComponentEnable(
"UdpServer", LOG_LEVEL_INFO);
803 std::string transportProtocol;
806 transportProtocol =
"ns3::UdpSocketFactory";
810 transportProtocol =
"ns3::TcpSocketFactory";
813 Time simTime = MilliSeconds(simTimeMs);
815 std::cout <<
"\n Traffic configuration selected is: " << trafficTypeConf << std::endl;
827 std::cout <<
" GNB num: " << gNbNum << std::endl;
828 uint32_t ueNum = uesPerGnb * gNbNum;
829 std::cout <<
" UE num: " << ueNum << std::endl;
839 NodeContainer gnbSector1Container;
840 NodeContainer gnbSector2Container;
841 NodeContainer gnbSector3Container;
848 gnbSector1Container.Add(gnb);
851 gnbSector2Container.Add(gnb);
854 gnbSector3Container.Add(gnb);
857 NS_ABORT_MSG(
"ffr param cannot be larger than 3");
865 NodeContainer ueSector1Container;
866 NodeContainer ueSector2Container;
867 NodeContainer ueSector3Container;
875 ueSector1Container.Add(ue);
878 ueSector2Container.Add(ue);
881 ueSector3Container.Add(ue);
884 NS_ABORT_MSG(
"ffr param cannot be larger than 3");
892 Ptr<NrPointToPointEpcHelper> nrEpcHelper;
894 NetDeviceContainer gnbSector1NetDev;
895 NetDeviceContainer gnbSector2NetDev;
896 NetDeviceContainer gnbSector3NetDev;
897 NetDeviceContainer ueSector1NetDev;
898 NetDeviceContainer ueSector2NetDev;
899 NetDeviceContainer ueSector3NetDev;
901 Ptr<NrHelper> nrHelper =
nullptr;
903 nrEpcHelper = CreateObject<NrPointToPointEpcHelper>();
927 auto [remoteHost, remoteHostIpv4Address] =
928 nrEpcHelper->SetupRemoteHost(
"100Gb/s", 2500, Seconds(0.000));
929 auto remoteHostContainer = NodeContainer(remoteHost);
931 InternetStackHelper internet;
937 std::set<uint16_t> ngmnFtpIds;
938 std::set<uint16_t> ngmnVideoIds;
939 std::set<uint16_t> ngmnVoipIds;
940 std::set<uint16_t> ngmnHttpIds;
941 std::set<uint16_t> ngmnGamingIds;
945 if (trafficTypeConf == NGMN_MIXED)
948 NS_ABORT_MSG_UNLESS((ueSector1NetDev.GetN() % 10) == 0,
949 "The number of UEs per sector must be mupliply of 10 when NGMN MIXED "
950 "traffic configured");
952 std::cout <<
"\n ueSector1NetDev:" << ueSector1NetDev.GetN() / 10 << std::endl;
953 NS_ABORT_MSG_UNLESS((ueSector1NetDev.GetN() / 10) >= 1,
954 "The number of UEs per sector must be at least 10 when NGMN MIXED "
955 "traffic is configured");
957 uint16_t ftp = (ueSector1NetDev.GetN() / 10) * ngmnMixedFtpPercentage / 10;
958 uint16_t http = (ueSector1NetDev.GetN() / 10) * ngmnMixedHttpPercentage / 10;
959 uint16_t video = (ueSector1NetDev.GetN() / 10) * ngmnMixedVideoPercentage / 10;
960 uint16_t voip = (ueSector1NetDev.GetN() / 10) * ngmnMixedVoipPercentage / 10;
961 uint16_t gaming = (ueSector1NetDev.GetN() / 10) * ngmnMixedGamingPercentage / 10;
964 std::cout <<
"\n Each sector has:" << std::endl;
965 std::cout << ftp <<
" UEs with NGMN FTP traffic" << std::endl;
966 std::cout << http <<
" UEs with NGMN HTTP traffic" << std::endl;
967 std::cout << video <<
" UEs with NGMN VIDEO traffic" << std::endl;
968 std::cout << voip <<
" UEs with NGMN VOIP traffic" << std::endl;
969 std::cout << gaming <<
" UEs with NGMN GAMING traffic" << std::endl;
971 for (uint16_t i = 0; i < ftp; i++)
973 ngmnFtpIds.insert(index++);
976 for (uint16_t i = 0; i < http; i++)
978 ngmnHttpIds.insert(index++);
981 for (uint16_t i = 0; i < video; i++)
983 ngmnVideoIds.insert(index++);
986 for (uint16_t i = 0; i < voip; i++)
988 ngmnVoipIds.insert(index++);
991 for (uint16_t i = 0; i < gaming; i++)
993 ngmnGamingIds.insert(index++);
997 Ipv4InterfaceContainer ueSector1IpIface =
998 nrEpcHelper->AssignUeIpv4Address(NetDeviceContainer(ueSector1NetDev));
999 Ipv4InterfaceContainer ueSector2IpIface =
1000 nrEpcHelper->AssignUeIpv4Address(NetDeviceContainer(ueSector2NetDev));
1001 Ipv4InterfaceContainer ueSector3IpIface =
1002 nrEpcHelper->AssignUeIpv4Address(NetDeviceContainer(ueSector3NetDev));
1005 for (uint32_t u = 0; u < ueNum; ++u)
1007 uint32_t sector = u % ffr;
1008 uint32_t i = u / ffr;
1011 Ptr<NetDevice> gnbNetDev = gnbSector1NetDev.Get(i % gridScenario.
GetNumSites());
1012 Ptr<NetDevice> ueNetDev = ueSector1NetDev.Get(i);
1014 nrHelper->AttachToGnb(ueNetDev, gnbNetDev);
1018 Vector gnbpos = gnbNetDev->GetNode()->GetObject<MobilityModel>()->GetPosition();
1019 Vector uepos = ueNetDev->GetNode()->GetObject<MobilityModel>()->GetPosition();
1020 double distance = CalculateDistance(gnbpos, uepos);
1021 std::cout <<
"Distance = " << distance <<
" meters" << std::endl;
1024 else if (sector == 1)
1026 Ptr<NetDevice> gnbNetDev = gnbSector2NetDev.Get(i % gridScenario.
GetNumSites());
1027 Ptr<NetDevice> ueNetDev = ueSector2NetDev.Get(i);
1028 nrHelper->AttachToGnb(ueNetDev, gnbNetDev);
1031 Vector gnbpos = gnbNetDev->GetNode()->GetObject<MobilityModel>()->GetPosition();
1032 Vector uepos = ueNetDev->GetNode()->GetObject<MobilityModel>()->GetPosition();
1033 double distance = CalculateDistance(gnbpos, uepos);
1034 std::cout <<
"Distance = " << distance <<
" meters" << std::endl;
1037 else if (sector == 2)
1039 Ptr<NetDevice> gnbNetDev = gnbSector3NetDev.Get(i % gridScenario.
GetNumSites());
1040 Ptr<NetDevice> ueNetDev = ueSector3NetDev.Get(i);
1041 nrHelper->AttachToGnb(ueNetDev, gnbNetDev);
1044 Vector gnbpos = gnbNetDev->GetNode()->GetObject<MobilityModel>()->GetPosition();
1045 Vector uepos = ueNetDev->GetNode()->GetObject<MobilityModel>()->GetPosition();
1046 double distance = CalculateDistance(gnbpos, uepos);
1047 std::cout <<
"Distance = " << distance <<
" meters" << std::endl;
1052 NS_ABORT_MSG(
"Number of sector cannot be larger than 3");
1060 uint16_t dlPortLowLat = 1234;
1062 ApplicationContainer serverApps;
1065 UdpServerHelper dlPacketSinkLowLat(dlPortLowLat);
1068 if (direction ==
"DL")
1070 serverApps.Add(dlPacketSinkLowLat.Install(
1071 {ueSector1Container, ueSector2Container, ueSector3Container}));
1075 serverApps.Add(dlPacketSinkLowLat.Install(remoteHost));
1084 UdpClientHelper dlClientLowLat;
1085 dlClientLowLat.SetAttribute(
"MaxPackets", UintegerValue(0xFFFFFFFF));
1086 dlClientLowLat.SetAttribute(
"PacketSize", UintegerValue(udpPacketSize));
1093 Ptr<NrEpcTft> lowLatTft = Create<NrEpcTft>();
1095 if (direction ==
"DL")
1099 dlpfLowLat.
direction = NrEpcTft::DOWNLINK;
1105 dlpfLowLat.
direction = NrEpcTft::UPLINK;
1107 lowLatTft->Add(dlpfLowLat);
1109 std::vector<uint32_t> lambdaPerCell(gridScenario.
GetNumCells());
1111 if (trafficTypeConf == UDP_CBR)
1115 for (uint32_t bs = 0; bs < gridScenario.
GetNumCells(); ++bs)
1117 lambdaPerCell[bs] = udpLambda;
1118 std::cout <<
"Cell: " << bs <<
" lambda (same lambda): " << lambdaPerCell[bs]
1124 for (uint32_t bs = 0; bs < gridScenario.
GetNumCells(); ++bs)
1126 lambdaPerCell[bs] = 1000 + bs * 2000;
1127 std::cout <<
"Cell: " << bs <<
" lambda (diff lambda): " << lambdaPerCell[bs]
1134 Config::SetDefault(
"ns3::NrRlcUm::MaxTxBufferSize", UintegerValue(999999999));
1139 ApplicationContainer clientApps;
1140 ApplicationContainer ftpClientAppsSector1;
1141 ApplicationContainer ftpServerAppsSector1;
1142 ApplicationContainer ftpClientAppsSector2;
1143 ApplicationContainer ftpServerAppsSector2;
1144 ApplicationContainer ftpClientAppsSector3;
1145 ApplicationContainer ftpServerAppsSector3;
1146 Ptr<ThreeGppFtpM1Helper> ftpHelperSector1;
1147 Ptr<ThreeGppFtpM1Helper> ftpHelperSector2;
1148 Ptr<ThreeGppFtpM1Helper> ftpHelperSector3;
1149 uint32_t port1 = 2001;
1150 uint32_t port2 = 2002;
1151 uint32_t port3 = 2003;
1154 ApplicationContainer pingApps;
1156 if (trafficTypeConf == FTP_3GPP_M1)
1159 ftpHelperSector1 = CreateObject<ThreeGppFtpM1Helper>(&ftpServerAppsSector1,
1160 &ftpClientAppsSector1,
1161 &ueSector1Container,
1162 &remoteHostContainer,
1164 ftpHelperSector1->Configure(port1,
1170 ftpHelperSector1->Start();
1173 ftpHelperSector2 = CreateObject<ThreeGppFtpM1Helper>(&ftpServerAppsSector2,
1174 &ftpClientAppsSector2,
1175 &ueSector2Container,
1176 &remoteHostContainer,
1178 ftpHelperSector2->Configure(port2,
1184 ftpHelperSector2->Start();
1187 ftpHelperSector3 = CreateObject<ThreeGppFtpM1Helper>(&ftpServerAppsSector3,
1188 &ftpClientAppsSector3,
1189 &ueSector3Container,
1190 &remoteHostContainer,
1192 ftpHelperSector3->Configure(port3,
1198 ftpHelperSector3->Start();
1200 clientApps.Add(ftpClientAppsSector1);
1201 clientApps.Add(ftpClientAppsSector2);
1202 clientApps.Add(ftpClientAppsSector3);
1204 serverApps.Add(ftpServerAppsSector1);
1205 serverApps.Add(ftpServerAppsSector2);
1206 serverApps.Add(ftpServerAppsSector3);
1209 if (trafficTypeConf == NGMN_FTP || (trafficTypeConf == NGMN_MIXED && !ngmnFtpIds.empty()))
1211 uint32_t portFtpNgmn = 2000;
1213 if (direction ==
"DL")
1220 ftpHelper.SetAttribute(
"PacketSize", UintegerValue(1448));
1221 ftpHelper.SetAttribute(
"MaxFileSize", UintegerValue(5e6));
1224 for (uint32_t i = 0; i < ueSector1IpIface.GetN(); i++)
1228 if ((trafficTypeConf == NGMN_MIXED) and (ngmnFtpIds.find(i) == ngmnFtpIds.end()))
1233 Ipv4Address ipAddress = ueSector1IpIface.GetAddress(i, 0);
1234 AddressValue ueAddress(InetSocketAddress(ipAddress, portFtpNgmn));
1235 ftpHelper.SetAttribute(
"Remote", ueAddress);
1236 clientApps.Add(ftpHelper.Install(remoteHost));
1239 PingHelper ping(ipAddress);
1240 pingApps.Add(ping.Install(remoteHost));
1243 for (uint32_t i = 0; i < ueSector2IpIface.GetN(); i++)
1247 if ((trafficTypeConf == NGMN_MIXED) and (ngmnFtpIds.find(i) == ngmnFtpIds.end()))
1251 Ipv4Address ipAddress = ueSector2IpIface.GetAddress(i, 0);
1252 AddressValue ueAddress(InetSocketAddress(ipAddress, portFtpNgmn));
1253 ftpHelper.SetAttribute(
"Remote", ueAddress);
1254 clientApps.Add(ftpHelper.Install(remoteHost));
1257 PingHelper ping(ipAddress);
1258 pingApps.Add(ping.Install(remoteHost));
1261 for (uint32_t i = 0; i < ueSector3IpIface.GetN(); i++)
1265 if ((trafficTypeConf == NGMN_MIXED) and (ngmnFtpIds.find(i) == ngmnFtpIds.end()))
1270 Ipv4Address ipAddress = ueSector3IpIface.GetAddress(i, 0);
1271 AddressValue ueAddress(InetSocketAddress(ipAddress, portFtpNgmn));
1272 ftpHelper.SetAttribute(
"Remote", ueAddress);
1273 clientApps.Add(ftpHelper.Install(remoteHost));
1276 PingHelper ping(ipAddress);
1277 pingApps.Add(ping.Install(remoteHost));
1281 InetSocketAddress localAddress(Ipv4Address::GetAny(), portFtpNgmn);
1282 PacketSinkHelper packetSinkHelper(transportProtocol, localAddress);
1284 for (uint32_t index = 0; index < ueSector1IpIface.GetN(); index++)
1287 if ((trafficTypeConf == NGMN_MIXED) and
1288 (ngmnFtpIds.find(index) == ngmnFtpIds.end()))
1292 serverApps.Add(packetSinkHelper.Install(ueSector1Container.Get(index)));
1293 serverApps.Add(packetSinkHelper.Install(ueSector2Container.Get(index)));
1294 serverApps.Add(packetSinkHelper.Install(ueSector3Container.Get(index)));
1299 NS_ABORT_MSG(
"Not yet supported option of FTP NGMN traffic with the UL traffic in this "
1300 "example. If you need it implement this else block");
1304 if (trafficTypeConf == NGMN_VIDEO || (trafficTypeConf == NGMN_MIXED && !ngmnVideoIds.empty()))
1306 uint32_t portNgmnVideo = 4000;
1308 if (direction ==
"DL")
1315 trafficGeneratorHelper.SetAttribute(
"NumberOfPacketsInFrame", UintegerValue(8));
1316 trafficGeneratorHelper.SetAttribute(
"InterframeIntervalTime",
1317 TimeValue(Seconds(0.100)));
1320 for (uint32_t i = 0; i < ueSector1IpIface.GetN(); i++)
1324 if ((trafficTypeConf == NGMN_MIXED) and
1325 (ngmnVideoIds.find(i) == ngmnVideoIds.end()))
1330 Ipv4Address ipAddress = ueSector1IpIface.GetAddress(i, 0);
1331 AddressValue remoteAddress(InetSocketAddress(ipAddress, portNgmnVideo));
1332 trafficGeneratorHelper.SetAttribute(
"Remote", remoteAddress);
1333 clientApps.Add(trafficGeneratorHelper.Install(remoteHost));
1336 PingHelper ping(ipAddress);
1337 pingApps.Add(ping.Install(remoteHost));
1340 for (uint32_t i = 0; i < ueSector2IpIface.GetN(); i++)
1344 if ((trafficTypeConf == NGMN_MIXED) and
1345 (ngmnVideoIds.find(i) == ngmnVideoIds.end()))
1350 Ipv4Address ipAddress = ueSector2IpIface.GetAddress(i, 0);
1351 AddressValue remoteAddress(InetSocketAddress(ipAddress, portNgmnVideo));
1352 trafficGeneratorHelper.SetAttribute(
"Remote", remoteAddress);
1353 clientApps.Add(trafficGeneratorHelper.Install(remoteHost));
1356 PingHelper ping(ipAddress);
1357 pingApps.Add(ping.Install(remoteHost));
1360 for (uint32_t i = 0; i < ueSector3IpIface.GetN(); i++)
1364 if ((trafficTypeConf == NGMN_MIXED) and
1365 (ngmnVideoIds.find(i) == ngmnVideoIds.end()))
1370 Ipv4Address ipAddress = ueSector3IpIface.GetAddress(i, 0);
1371 AddressValue remoteAddress(InetSocketAddress(ipAddress, portNgmnVideo));
1372 trafficGeneratorHelper.SetAttribute(
"Remote", remoteAddress);
1373 clientApps.Add(trafficGeneratorHelper.Install(remoteHost));
1376 PingHelper ping(ipAddress);
1377 pingApps.Add(ping.Install(remoteHost));
1381 InetSocketAddress localAddress(Ipv4Address::GetAny(), portNgmnVideo);
1382 PacketSinkHelper packetSinkHelper(transportProtocol, localAddress);
1384 for (uint32_t index = 0; index < ueSector1IpIface.GetN(); index++)
1387 if ((trafficTypeConf == NGMN_MIXED) and
1388 (ngmnVideoIds.find(index) == ngmnVideoIds.end()))
1393 Ptr<PacketSink> ps1 = packetSinkHelper.Install(ueSector1Container.Get(index))
1395 ->GetObject<PacketSink>();
1396 Ptr<PacketSink> ps2 = packetSinkHelper.Install(ueSector2Container.Get(index))
1398 ->GetObject<PacketSink>();
1399 Ptr<PacketSink> ps3 = packetSinkHelper.Install(ueSector3Container.Get(index))
1401 ->GetObject<PacketSink>();
1402 serverApps.Add(ps1);
1403 serverApps.Add(ps2);
1404 serverApps.Add(ps3);
1409 NS_ABORT_MSG(
"Not yet supported option of FTP NGMN traffic with the UL traffic in this "
1410 "example. If you need it implement this else block");
1414 if (trafficTypeConf == NGMN_GAMING || (trafficTypeConf == NGMN_MIXED && !ngmnGamingIds.empty()))
1416 uint32_t portNgmnGaming = 5000;
1417 if (direction ==
"DL")
1424 trafficGeneratorHelper.SetAttribute(
"IsDownlink", BooleanValue(
true));
1425 trafficGeneratorHelper.SetAttribute(
"aParamPacketSizeDl", UintegerValue(120));
1426 trafficGeneratorHelper.SetAttribute(
"bParamPacketSizeDl", DoubleValue(36));
1427 trafficGeneratorHelper.SetAttribute(
"aParamPacketArrivalDl", DoubleValue(45));
1428 trafficGeneratorHelper.SetAttribute(
"bParamPacketArrivalDl", DoubleValue(5.7));
1429 trafficGeneratorHelper.SetAttribute(
"InitialPacketArrivalMin", UintegerValue(0));
1430 trafficGeneratorHelper.SetAttribute(
"InitialPacketArrivalMax", UintegerValue(40));
1433 for (uint32_t i = 0; i < ueSector1IpIface.GetN(); i++)
1437 if ((trafficTypeConf == NGMN_MIXED) and
1438 (ngmnGamingIds.find(i) == ngmnGamingIds.end()))
1443 Ipv4Address ipAddress = ueSector1IpIface.GetAddress(i, 0);
1444 AddressValue remoteAddress(InetSocketAddress(ipAddress, portNgmnGaming));
1445 trafficGeneratorHelper.SetAttribute(
"Remote", remoteAddress);
1446 clientApps.Add(trafficGeneratorHelper.Install(remoteHost));
1449 PingHelper ping(ipAddress);
1450 pingApps.Add(ping.Install(remoteHost));
1453 for (uint32_t i = 0; i < ueSector2IpIface.GetN(); i++)
1457 if ((trafficTypeConf == NGMN_MIXED) and
1458 (ngmnGamingIds.find(i) == ngmnGamingIds.end()))
1463 Ipv4Address ipAddress = ueSector2IpIface.GetAddress(i, 0);
1464 AddressValue remoteAddress(InetSocketAddress(ipAddress, portNgmnGaming));
1465 trafficGeneratorHelper.SetAttribute(
"Remote", remoteAddress);
1466 clientApps.Add(trafficGeneratorHelper.Install(remoteHost));
1469 PingHelper ping(ipAddress);
1470 pingApps.Add(ping.Install(remoteHost));
1473 for (uint32_t i = 0; i < ueSector3IpIface.GetN(); i++)
1477 if ((trafficTypeConf == NGMN_MIXED) and
1478 (ngmnGamingIds.find(i) == ngmnGamingIds.end()))
1483 Ipv4Address ipAddress = ueSector3IpIface.GetAddress(i, 0);
1484 AddressValue remoteAddress(InetSocketAddress(ipAddress, portNgmnGaming));
1485 trafficGeneratorHelper.SetAttribute(
"Remote", remoteAddress);
1486 clientApps.Add(trafficGeneratorHelper.Install(remoteHost));
1489 PingHelper ping(ipAddress);
1490 pingApps.Add(ping.Install(remoteHost));
1494 InetSocketAddress localAddress(Ipv4Address::GetAny(), portNgmnGaming);
1495 PacketSinkHelper packetSinkHelper(transportProtocol, localAddress);
1497 for (uint32_t index = 0; index < ueSector1IpIface.GetN(); index++)
1500 if ((trafficTypeConf == NGMN_MIXED) and
1501 (ngmnGamingIds.find(index) == ngmnGamingIds.end()))
1505 serverApps.Add(packetSinkHelper.Install(ueSector1Container.Get(index)));
1506 serverApps.Add(packetSinkHelper.Install(ueSector2Container.Get(index)));
1507 serverApps.Add(packetSinkHelper.Install(ueSector3Container.Get(index)));
1512 NS_ABORT_MSG(
"Not yet supported option of FTP NGMN traffic with the UL traffic in this "
1513 "example. If you need it implement this else block");
1529 if (trafficTypeConf == NGMN_VOIP || (trafficTypeConf == NGMN_MIXED && !ngmnVoipIds.empty()))
1531 uint32_t portNgmnVoip = 5000;
1532 if (direction ==
"DL")
1540 trafficGeneratorHelper.SetAttribute(
"EncoderFrameLength", UintegerValue(20));
1541 trafficGeneratorHelper.SetAttribute(
"MeanTalkSpurtDuration", UintegerValue(2000));
1542 trafficGeneratorHelper.SetAttribute(
"VoiceActivityFactor", DoubleValue(0.5));
1543 trafficGeneratorHelper.SetAttribute(
"VoicePayload", UintegerValue(40));
1544 trafficGeneratorHelper.SetAttribute(
"SIDPeriodicity", UintegerValue(160));
1545 trafficGeneratorHelper.SetAttribute(
"SIDPayload", UintegerValue(15));
1548 for (uint32_t i = 0; i < ueSector1IpIface.GetN(); i++)
1552 if ((trafficTypeConf == NGMN_MIXED) and (ngmnVoipIds.find(i) == ngmnVoipIds.end()))
1557 Ipv4Address ipAddress = ueSector1IpIface.GetAddress(i, 0);
1558 AddressValue remoteAddress(InetSocketAddress(ipAddress, portNgmnVoip));
1559 trafficGeneratorHelper.SetAttribute(
"Remote", remoteAddress);
1560 clientApps.Add(trafficGeneratorHelper.Install(remoteHost));
1563 PingHelper ping(ipAddress);
1564 pingApps.Add(ping.Install(remoteHost));
1567 for (uint32_t i = 0; i < ueSector2IpIface.GetN(); i++)
1571 if ((trafficTypeConf == NGMN_MIXED) and (ngmnVoipIds.find(i) == ngmnVoipIds.end()))
1576 Ipv4Address ipAddress = ueSector2IpIface.GetAddress(i, 0);
1577 AddressValue remoteAddress(InetSocketAddress(ipAddress, portNgmnVoip));
1578 trafficGeneratorHelper.SetAttribute(
"Remote", remoteAddress);
1579 clientApps.Add(trafficGeneratorHelper.Install(remoteHost));
1582 PingHelper ping(ipAddress);
1583 pingApps.Add(ping.Install(remoteHost));
1586 for (uint32_t i = 0; i < ueSector3IpIface.GetN(); i++)
1590 if ((trafficTypeConf == NGMN_MIXED) and (ngmnVoipIds.find(i) == ngmnVoipIds.end()))
1595 Ipv4Address ipAddress = ueSector3IpIface.GetAddress(i, 0);
1596 AddressValue remoteAddress(InetSocketAddress(ipAddress, portNgmnVoip));
1597 trafficGeneratorHelper.SetAttribute(
"Remote", remoteAddress);
1598 clientApps.Add(trafficGeneratorHelper.Install(remoteHost));
1601 PingHelper ping(ipAddress);
1602 pingApps.Add(ping.Install(remoteHost));
1606 InetSocketAddress localAddress(Ipv4Address::GetAny(), portNgmnVoip);
1607 PacketSinkHelper packetSinkHelper(transportProtocol, localAddress);
1609 for (uint32_t index = 0; index < ueSector1IpIface.GetN(); index++)
1612 if ((trafficTypeConf == NGMN_MIXED) and
1613 (ngmnVoipIds.find(index) == ngmnVoipIds.end()))
1617 serverApps.Add(packetSinkHelper.Install(ueSector1Container.Get(index)));
1618 serverApps.Add(packetSinkHelper.Install(ueSector2Container.Get(index)));
1619 serverApps.Add(packetSinkHelper.Install(ueSector3Container.Get(index)));
1624 NS_ABORT_MSG(
"Not yet supported option of NGMN VOIP traffic with the UL traffic in "
1625 "this example. If you need it implement this else block");
1641 if (trafficTypeConf == NGMN_HTTP || (trafficTypeConf == NGMN_MIXED && !ngmnHttpIds.empty()))
1647 NodeContainer httpUeContainer;
1649 for (uint32_t i = 0; i < ueSector1Container.GetN(); i++)
1653 if ((trafficTypeConf == NGMN_MIXED) and (ngmnHttpIds.find(i) == ngmnHttpIds.end()))
1657 httpUeContainer.Add(ueSector1Container.Get(i));
1658 httpUeContainer.Add(ueSector2Container.Get(i));
1659 httpUeContainer.Add(ueSector3Container.Get(i));
1663 ThreeGppHttpClientHelper clientHelper(remoteHostIpv4Address);
1665 ApplicationContainer clientApps = clientHelper.Install(httpUeContainer);
1668 ThreeGppHttpServerHelper serverHelper(remoteHostIpv4Address);
1670 ApplicationContainer serverApps = serverHelper.Install(remoteHost);
1671 Ptr<ThreeGppHttpServer> httpServer = serverApps.Get(0)->GetObject<ThreeGppHttpServer>();
1674 PointerValue ptrVal;
1675 httpServer->GetAttribute(
"Variables", ptrVal);
1676 Ptr<ThreeGppHttpVariables> httpParameters = ptrVal.Get<ThreeGppHttpVariables>();
1677 httpParameters->SetMainObjectSizeMean(10710);
1678 httpParameters->SetMainObjectSizeStdDev(25032);
1679 httpParameters->SetEmbeddedObjectSizeMean(7758);
1680 httpParameters->SetEmbeddedObjectSizeStdDev(126168);
1681 httpParameters->SetNumOfEmbeddedObjectsMax(55);
1682 httpParameters->SetNumOfEmbeddedObjectsScale(2);
1683 httpParameters->SetNumOfEmbeddedObjectsShape(1.1);
1684 httpParameters->SetReadingTimeMean(Seconds(30));
1685 httpParameters->SetParsingTimeMean(Seconds(0.13));
1687 for (uint32_t i = 0; i < ueSector1IpIface.GetN(); i++)
1691 if ((trafficTypeConf == NGMN_MIXED) and (ngmnHttpIds.find(i) == ngmnHttpIds.end()))
1696 Ipv4Address ipAddress = ueSector1IpIface.GetAddress(i, 0);
1697 PingHelper ping(ipAddress);
1698 pingApps.Add(ping.Install(remoteHost));
1701 for (uint32_t i = 0; i < ueSector2IpIface.GetN(); i++)
1705 if ((trafficTypeConf == NGMN_MIXED) and (ngmnHttpIds.find(i) == ngmnHttpIds.end()))
1710 Ipv4Address ipAddress = ueSector2IpIface.GetAddress(i, 0);
1711 PingHelper ping(ipAddress);
1712 pingApps.Add(ping.Install(remoteHost));
1715 for (uint32_t i = 0; i < ueSector3IpIface.GetN(); i++)
1719 if ((trafficTypeConf == NGMN_MIXED) and (ngmnHttpIds.find(i) == ngmnHttpIds.end()))
1724 Ipv4Address ipAddress = ueSector3IpIface.GetAddress(i, 0);
1725 PingHelper ping(ipAddress);
1726 pingApps.Add(ping.Install(remoteHost));
1730 if (trafficTypeConf == UDP_CBR)
1732 for (uint32_t i = 0; i < ueSector1Container.GetN(); ++i)
1734 dlClientLowLat.SetAttribute(
1736 TimeValue(Seconds(1.0 / lambdaPerCell[(i % gridScenario.
GetNumSites()) *
1738 std::cout <<
"ue (sector1): " << i <<
" index: "
1741 << lambdaPerCell[(i % gridScenario.
GetNumSites()) *
1744 Ptr<Node> ue = ueSector1Container.Get(i);
1745 Ptr<NetDevice> ueDevice = ueSector1NetDev.Get(i);
1746 Address ueAddress = ueSector1IpIface.GetAddress(i);
1750 if (direction ==
"DL")
1752 dlClientLowLat.SetAttribute(
1754 AddressValue(addressUtils::ConvertToSocketAddress(ueAddress, dlPortLowLat)));
1755 clientApps.Add(dlClientLowLat.Install(remoteHost));
1759 dlClientLowLat.SetAttribute(
1762 addressUtils::ConvertToSocketAddress(remoteHostIpv4Address, dlPortLowLat)));
1763 clientApps.Add(dlClientLowLat.Install(ue));
1766 nrHelper->ActivateDedicatedEpsBearer(ueDevice, lowLatBearer, lowLatTft);
1769 for (uint32_t i = 0; i < ueSector2Container.GetN(); ++i)
1771 dlClientLowLat.SetAttribute(
1773 TimeValue(Seconds(1.0 / lambdaPerCell[(i % gridScenario.
GetNumSites()) *
1776 std::cout <<
"ue (sector2): " << i <<
" index: "
1779 << lambdaPerCell[(i % gridScenario.
GetNumSites()) *
1783 Ptr<Node> ue = ueSector2Container.Get(i);
1784 Ptr<NetDevice> ueDevice = ueSector2NetDev.Get(i);
1785 Address ueAddress = ueSector2IpIface.GetAddress(i);
1789 if (direction ==
"DL")
1791 dlClientLowLat.SetAttribute(
1793 AddressValue(addressUtils::ConvertToSocketAddress(ueAddress, dlPortLowLat)));
1794 clientApps.Add(dlClientLowLat.Install(remoteHost));
1798 dlClientLowLat.SetAttribute(
1801 addressUtils::ConvertToSocketAddress(remoteHostIpv4Address, dlPortLowLat)));
1802 clientApps.Add(dlClientLowLat.Install(ue));
1805 nrHelper->ActivateDedicatedEpsBearer(ueDevice, lowLatBearer, lowLatTft);
1808 for (uint32_t i = 0; i < ueSector3Container.GetN(); ++i)
1810 dlClientLowLat.SetAttribute(
1812 TimeValue(Seconds(1.0 / lambdaPerCell[(i % gridScenario.
GetNumSites()) *
1815 std::cout <<
"ue (sector3): " << i <<
" index: "
1818 << lambdaPerCell[(i % gridScenario.
GetNumSites()) *
1822 Ptr<Node> ue = ueSector3Container.Get(i);
1823 Ptr<NetDevice> ueDevice = ueSector3NetDev.Get(i);
1824 Address ueAddress = ueSector3IpIface.GetAddress(i);
1828 if (direction ==
"DL")
1830 dlClientLowLat.SetAttribute(
1832 AddressValue(addressUtils::ConvertToSocketAddress(ueAddress, dlPortLowLat)));
1833 clientApps.Add(dlClientLowLat.Install(remoteHost));
1837 dlClientLowLat.SetAttribute(
1840 addressUtils::ConvertToSocketAddress(remoteHostIpv4Address, dlPortLowLat)));
1841 clientApps.Add(dlClientLowLat.Install(ue));
1844 nrHelper->ActivateDedicatedEpsBearer(ueDevice, lowLatBearer, lowLatTft);
1849 pingApps.Start(Seconds(0.300));
1850 pingApps.Stop(Seconds(0.500));
1851 serverApps.Start(serverAppStartTime);
1852 serverApps.Stop(simTime - MilliSeconds(400));
1853 clientApps.Start(clientAppStartTime);
1854 clientApps.Stop(simTime - MilliSeconds(400));
1859 nrHelper->EnableTraces();
1862 FlowMonitorHelper flowmonHelper;
1863 NodeContainer endpointNodes;
1864 endpointNodes.Add(remoteHost);
1867 Ptr<ns3::FlowMonitor> monitor = flowmonHelper.Install(endpointNodes);
1868 monitor->SetAttribute(
"DelayBinWidth", DoubleValue(0.001));
1869 monitor->SetAttribute(
"JitterBinWidth", DoubleValue(0.001));
1870 monitor->SetAttribute(
"PacketSizeBinWidth", DoubleValue(20));
1872 Simulator::Stop(simTime);
1876 monitor->CheckForLostPackets();
1877 Ptr<Ipv4FlowClassifier> classifier =
1878 DynamicCast<Ipv4FlowClassifier>(flowmonHelper.GetClassifier());
1879 FlowMonitor::FlowStatsContainer stats = monitor->GetFlowStats();
1881 double averageFlowThroughput = 0.0;
1882 double averageFlowDelay = 0.0;
1884 std::ofstream outFile;
1885 std::string filename = outputDir +
"/" + simTag;
1886 std::vector<double> delayValues(stats.size());
1889 outFile.open(filename.c_str(), std::ofstream::out | std::ofstream::trunc);
1890 if (!outFile.is_open())
1892 std::cerr <<
"Can't open file " << filename << std::endl;
1896 outFile.setf(std::ios_base::fixed);
1898 for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator i = stats.begin();
1902 Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow(i->first);
1903 std::stringstream protoStream;
1904 protoStream << (uint16_t)t.protocol;
1905 if (t.protocol == 6)
1907 protoStream.str(
"TCP");
1909 if (t.protocol == 17)
1911 protoStream.str(
"UDP");
1913 std::cout <<
"Flow " << i->first <<
" (" << t.sourceAddress <<
":" << t.sourcePort <<
" -> "
1914 << t.destinationAddress <<
":" << t.destinationPort <<
") proto "
1915 << protoStream.str() <<
"\n";
1916 std::cout <<
" Tx Packets: " << i->second.txPackets <<
"\n";
1917 std::cout <<
" Tx Bytes: " << i->second.txBytes <<
"\n";
1918 std::cout <<
" TxOffered: "
1919 << i->second.txBytes * 8.0 / (simTime - appStartTime).GetSeconds() / 1000.0 /
1922 std::cout <<
" Rx Packets: " << i->second.rxPackets <<
"\n";
1923 std::cout <<
" Rx Bytes: " << i->second.rxBytes <<
"\n";
1924 if (i->second.rxPackets > 0)
1930 (i->second.timeLastRxPacket - i->second.timeFirstRxPacket).GetSeconds();
1932 averageFlowThroughput += i->second.rxBytes * 8.0 / rxDuration / 1000 / 1000;
1933 averageFlowDelay += 1000 * i->second.delaySum.GetSeconds() / i->second.rxPackets;
1934 delayValues[cont] = 1000 * i->second.delaySum.GetSeconds() / i->second.rxPackets;
1937 std::cout <<
" Throughput: " << i->second.rxBytes * 8.0 / rxDuration / 1000 / 1000
1939 std::cout <<
" Mean delay: "
1940 << double(1000 * i->second.delaySum.GetSeconds()) / (i->second.rxPackets)
1942 std::cout <<
" Last packet delay: " << i->second.lastDelay.As(Time::MS) <<
"\n";
1945 std::cout <<
" Mean jitter: "
1946 << 1000 * i->second.jitterSum.GetSeconds() / i->second.rxPackets <<
" ms\n";
1956 std::stable_sort(delayValues.begin(), delayValues.end());
1962 double FiftyTileFlowDelay = delayValues[stats.size() / 2];
1964 outFile <<
"\n\n Mean flow throughput: " << averageFlowThroughput / stats.size() <<
"\n";
1965 outFile <<
" Mean flow delay: " << averageFlowDelay / stats.size() <<
"\n";
1966 outFile <<
" Median flow delay: " << FiftyTileFlowDelay <<
"\n";
1970 std::ifstream f(filename.c_str());
1974 std::cout << f.rdbuf();
1977 Simulator::Destroy();
Manages the correct creation of operation bands, component carriers and bandwidth parts.
OperationBandInfo CreateOperationBandContiguousCc(const SimpleOperationBandConf &conf)
Create an operation band with the CC specified.
static BandwidthPartInfoPtrVector GetAllBwps(const std::vector< std::reference_wrapper< OperationBandInfo > > &operationBands)
Get all the BWP pointers from the specified vector of operation bands.
The HexagonalGridScenarioHelper class.
int64_t AssignStreams(int64_t stream)
void CreateScenario() override
Create the scenario, with the configured parameter.
void SetNumRings(uint8_t numRings)
Sets the number of outer rings of sites around the central site.
const NodeContainer & GetUserTerminals() const
Get the list of user nodes.
std::size_t GetNumSites() const
Gets the number of sites with cell base stations.
void SetUtNumber(std::size_t n)
Set the number of UT/UE.
std::size_t GetNumCells() const
Gets the total number of cells deployed.
const NodeContainer & GetBaseStations() const
Get the list of gnb/base station nodes.
double GetAntennaOrientationRadians(std::size_t cellId) const
Returns the orientation in radians of the antenna array for the given cellId.
@ ErrorModel
Error Model version (can use different error models, see NrErrorModel)
This class contains the specification of EPS Bearers.
@ NGBR_VIDEO_TCP_DEFAULT
Non-GBR TCP-based Video (Buffered Streaming, e.g., www, e-mail...)
uint32_t GetNumSectorsPerSite() const
Gets the number of sectors per site.
void SetSectorization(SiteSectorizationType numSectors)
Sets the number of sectors of every site.
void SetScenarioParameters(const std::string &scenario)
Sets parameters to the specified scenario.
A helper to make it easier to instantiate an ns3::TrafficGenerator types of applications on a set of ...
static TypeId GetTypeId()
Get the type ID.
static TypeId GetTypeId()
Get the type ID.
static TypeId GetTypeId()
Get the type ID.
static TypeId GetTypeId()
Get the type ID.
static std::ostream & operator<<(std::ostream &os, const TrafficTypeConf &item)
operator << for TrafficTypeConf
void Set5gLenaSimulatorParameters(HexagonalGridScenarioHelper gridScenario, std::string scenario, std::string radioNetwork, std::string operationMode, std::string direction, NodeContainer gnbSector1Container, NodeContainer gnbSector2Container, NodeContainer gnbSector3Container, NodeContainer ueSector1Container, NodeContainer ueSector2Container, NodeContainer ueSector3Container, Ptr< NrPointToPointEpcHelper > &baseNrEpcHelper, Ptr< NrHelper > &nrHelper, NetDeviceContainer &gnbSector1NetDev, NetDeviceContainer &gnbSector2NetDev, NetDeviceContainer &gnbSector3NetDev, NetDeviceContainer &ueSector1NetDev, NetDeviceContainer &ueSector2NetDev, NetDeviceContainer &ueSector3NetDev, bool uniformLambda)
std::vector< std::reference_wrapper< BandwidthPartInfoPtr > > BandwidthPartInfoPtrVector
vector of unique_ptr of BandwidthPartInfo
Minimum configuration requirements for a OperationBand.
uint8_t m_numBwp
Number of BWP per CC.
Direction direction
Whether the filter needs to be applied to uplink / downlink only, or in both cases.
uint16_t remotePortEnd
end of the port number range of the remote host
uint16_t localPortStart
start of the port number range of the UE
uint16_t remotePortStart
start of the port number range of the remote host
uint16_t localPortEnd
end of the port number range of the UE
Operation band information structure.