Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.77 KB | None | 0 0
  1. #include "ns3/mmwave-helper.h"
  2. #include "ns3/core-module.h"
  3. #include "ns3/network-module.h"
  4. #include "ns3/mobility-module.h"
  5. #include "ns3/config-store.h"
  6. #include "ns3/mmwave-helper.h"
  7. #include "ns3/log.h"
  8. #include "ns3/nr-point-to-point-epc-helper.h"
  9. #include "ns3/network-module.h"
  10. #include "ns3/ipv4-global-routing-helper.h"
  11. #include "ns3/internet-module.h"
  12. #include "ns3/applications-module.h"
  13. #include "ns3/point-to-point-helper.h"
  14. #include "ns3/eps-bearer-tag.h"
  15. #include "ns3/abort.h"
  16. #include "ns3/object.h"
  17. #include "ns3/mmwave-mac-scheduler-ns3.h"
  18. #include "ns3/mmwave-mac-scheduler-ofdma.h"
  19. #include "ns3/mmwave-mac-scheduler-ofdma-rr.h"
  20. #include "ns3/mmwave-phy-mac-common.h"
  21. #include "ns3/basic-data-calculators.h"
  22. #include "ns3/antenna-array-3gpp-model.h"
  23. #include "ns3/netanim-module.h"
  24. #include <iostream>
  25. #include <cmath>
  26.  
  27. using namespace ns3;
  28. using namespace std;
  29.  
  30. enum AntennaModelEnum{
  31. _ISO,
  32. _3GPP,
  33. };
  34.  
  35. NS_LOG_COMPONENT_DEFINE ("Nr3gppIndoorCalibration");
  36.  
  37. static ns3::GlobalValue g_duration ("duration",
  38. "simulation duration in milliseconds, should be greater than 100 ms to allow the collection of traces",
  39. ns3::UintegerValue (150),
  40. ns3::MakeUintegerChecker<uint32_t>());
  41.  
  42. static ns3::GlobalValue g_shadowing ("shadowing",
  43. "if true, shadowing is enabled in 3gpp propagation loss model;"
  44. "if false, shadowing is disabled",
  45. ns3::BooleanValue (true),
  46. ns3::MakeBooleanChecker ());
  47.  
  48. static ns3::GlobalValue g_antennaOrientation ("antennaOrientation",
  49. "the orientation of the antenna on gNB and UE",
  50. ns3::EnumValue (AntennaArray3gppModel::Z0),
  51. ns3::MakeEnumChecker (AntennaArray3gppModel::Z0, "Z0",
  52. AntennaArray3gppModel::X0, "X0"));
  53. static ns3::GlobalValue g_antennaModelgNb ("antennaModelGnb",
  54. "the antenna model of gNb, can be ISO or 3GPP",
  55. ns3::EnumValue (_3GPP),
  56. ns3::MakeEnumChecker (_ISO, "ISO",
  57. _3GPP, "3GPP"));
  58.  
  59. static ns3::GlobalValue g_antennaModelUe ("antennaModelUe",
  60. "the antenna model of Ue, can be ISO or 3GPP",
  61. ns3::EnumValue (_3GPP),
  62. ns3::MakeEnumChecker (_ISO, "ISO",
  63. _3GPP, "3GPP"));
  64.  
  65. static ns3::GlobalValue g_resultsDir ("resultsDir",
  66. "directory where to store the simulation results",
  67. ns3::StringValue ("./"),
  68. ns3::MakeStringChecker ());
  69.  
  70. static ns3::GlobalValue g_simTag ("simTag",
  71. "tag to be appended to the output filenames to distinguish different simulation campaign output files",
  72. ns3::StringValue (""),
  73. ns3::MakeStringChecker ());
  74.  
  75. static ns3::GlobalValue g_indoorScenario ("indoorScenario",
  76. "the indoor scenario to be used can be: InH-OfficeMixed, InH-OfficeOpen or InH-ShoppingMall",
  77. ns3::StringValue ("InH-OfficeOpen"),
  78. ns3::MakeStringChecker ());
  79.  
  80. static ns3::GlobalValue g_speed ("speed",
  81. "UE speed in km/h",
  82. ns3::DoubleValue (3.00),
  83. ns3::MakeDoubleChecker<double> (0.0, 10.0));
  84.  
  85. static ns3::GlobalValue g_isBeamSearchMethod ("isBeamSearchMethod",
  86. "if true, beam search method will be used;"
  87. "if false, long term covariance matrix will be used",
  88. ns3::BooleanValue (true),
  89. ns3::MakeBooleanChecker ());
  90.  
  91. static ns3::GlobalValue g_beamSearchMethodAngle ("beamSearchMethodAngle",
  92. "beam search method angle step",
  93. ns3::DoubleValue (30.00),
  94. ns3::MakeDoubleChecker<double> (0.0, 360.0));
  95.  
  96. static ns3::GlobalValue g_gNbAntennaMount ("gnbAntennaMount",
  97. "gNb antenna mount type. Can be Wall mount or Sector mount. Doc: 38.802-e20. A.2.1-7",
  98. ns3::EnumValue (ns3::AntennaArray3gppModel::GnbWallMount),
  99. ns3::MakeEnumChecker (ns3::AntennaArray3gppModel::GnbWallMount, "WALL",
  100. ns3::AntennaArray3gppModel::GnbSingleSector, "SECT"));
  101.  
  102. //######################################### Beginning of class
  103.  
  104. class Nr3gppIndoorCalibration{
  105.  
  106. public:
  107. void UeRssiPerProcessedChunk (double rssidBm);
  108. void Run (bool shadowing, AntennaArrayModel::AntennaOrientation antOrientation, TypeId gNbAntennaModel,
  109. TypeId ueAntennaModel, std::string scenario, double speed,
  110. std::string resultsDirPath, std::string tag,
  111. bool isBeamSearchMethod, double beamSearchMethodAngle,
  112. AntennaArray3gppModel::GnbAntennaMount gNbAntennaMount, uint32_t duration);
  113. ~Nr3gppIndoorCalibration ();
  114.  
  115.  
  116. private:
  117.  
  118. std::ofstream m_outRssiFile; //!< the output file stream for the RSSI file
  119. std::ofstream m_outUePositionsFile; //!< the output file stream for the UE positions file
  120. std::ofstream m_outGnbPositionsFile; //!< the output file stream for the gNB positions file
  121. std::ofstream m_outDistancesFile; //!< the output file stream for the distances file
  122.  
  123. };
  124.  
  125. std::string BuildFileNameString (std::string directoryName, std::string filePrefix, std::string tag)
  126. {
  127. std::ostringstream oss;
  128. oss << directoryName << filePrefix<<tag;
  129. return oss.str ();
  130. }
  131.  
  132. std::string BuildTag(bool shadowing, AntennaArrayModel::AntennaOrientation antOrientation,
  133. TypeId gNbAntennaModel, TypeId ueAntennaModel, std::string scenario,
  134. double speed, bool isBeamSearchMethod, double beamSearchMethodAngle,
  135. AntennaArray3gppModel::GnbAntennaMount gNbAntennaMount = AntennaArray3gppModel::GnbWallMount)
  136. {
  137.  
  138. std::ostringstream oss;
  139. std::string ao;
  140.  
  141. if (antOrientation == AntennaArrayModel::X0)
  142. {
  143. ao = "X0";
  144. }
  145. else if (antOrientation == AntennaArrayModel::Z0)
  146. {
  147. ao = "Z0";
  148. }
  149. else
  150. {
  151. NS_ABORT_MSG("unknown antenna orientation..");
  152. }
  153.  
  154. std::string gnbAm;
  155. if (gNbAntennaModel == AntennaArrayModel::GetTypeId())
  156. {
  157. gnbAm = "ISO";
  158. }
  159. else if (gNbAntennaModel == AntennaArray3gppModel::GetTypeId())
  160. {
  161. gnbAm = "3GPP";
  162. }
  163.  
  164. std::string ueAm;
  165. if (ueAntennaModel == AntennaArrayModel::GetTypeId())
  166. {
  167. ueAm = "ISO";
  168. }
  169. else if (ueAntennaModel == AntennaArray3gppModel::GetTypeId())
  170. {
  171. ueAm = "3GPP";
  172. }
  173.  
  174. double angl = 0;
  175.  
  176. if (isBeamSearchMethod)
  177. {
  178. angl = beamSearchMethodAngle;
  179. }
  180.  
  181. std::string gm = "";
  182.  
  183. if (gNbAntennaMount == AntennaArray3gppModel::GnbWallMount)
  184. {
  185. gm = "WALL";
  186. }
  187. else if (gNbAntennaMount == AntennaArray3gppModel::GnbSingleSector)
  188. {
  189. gm = "SECT";
  190. }
  191. else
  192. {
  193. NS_ABORT_MSG("unknown antenna orientation..");
  194. }
  195.  
  196. oss <<"-sh"<<shadowing<<"-ao"<<ao<<"-amGnb"<<gnbAm<<"-amUE"<<ueAm<<
  197. "-sc"<<scenario<<"-sp"<<speed<<"-bs"<<isBeamSearchMethod<<"-angl"<<angl<<"-gm"<<gm;
  198.  
  199. return oss.str ();
  200. }
  201.  
  202.  
  203. //######################################################3 class funcs
  204.  
  205.  
  206.  
  207. void UeRssiPerProcessedChunkTrace (Nr3gppIndoorCalibration* scenario, double rssidBm)
  208. {
  209. scenario->UeRssiPerProcessedChunk (rssidBm);
  210. }
  211.  
  212. void
  213. Nr3gppIndoorCalibration::UeRssiPerProcessedChunk (double rssidBm)
  214. {
  215. m_outRssiFile<<rssidBm<<std::endl;
  216.  
  217. }
  218.  
  219. Nr3gppIndoorCalibration::~Nr3gppIndoorCalibration ()
  220. {
  221. m_outRssiFile<<"#################################"<<std::endl;
  222. m_outRssiFile.close();
  223. }
  224.  
  225. //########################################################### RUN
  226. void
  227. Nr3gppIndoorCalibration::Run (bool shadowing, AntennaArrayModel::AntennaOrientation antOrientation,
  228. TypeId gNbAntennaModel, TypeId ueAntennaModel, std::string scenario, double speed,
  229. std::string resultsDirPath, std::string tag,
  230. bool isBeamSearchMethod, double beamSearchMethodAngle,
  231. AntennaArray3gppModel::GnbAntennaMount gNbAntennaMount, uint32_t duration)
  232. {
  233. Time simTime = MilliSeconds (duration);
  234. Time udpAppStartTimeDl = MilliSeconds (100);
  235. Time udpAppStopTimeDl = MilliSeconds (duration);
  236. //uint32_t packetSize = 1000;
  237. DataRate udpRate = DataRate ("0.1kbps");
  238.  
  239. // if simulation tag is not provided create one
  240. if (tag=="")
  241. {
  242. tag = BuildTag(shadowing, antOrientation, gNbAntennaModel, ueAntennaModel, scenario, speed, isBeamSearchMethod, beamSearchMethodAngle, gNbAntennaMount);
  243. }
  244. std::string filenameRssi = BuildFileNameString ( resultsDirPath , "rssi", tag);
  245. std::string filenameUePositions = BuildFileNameString ( resultsDirPath , "ue-positions", tag);
  246. std::string filenameGnbPositions = BuildFileNameString( resultsDirPath , "gnb-positions", tag);
  247. std::string filenameDistances = BuildFileNameString ( resultsDirPath , "distances", tag);
  248.  
  249.  
  250. m_outRssiFile.open (filenameRssi.c_str ());
  251. m_outRssiFile.setf (std::ios_base::fixed);
  252.  
  253. if(!m_outRssiFile.is_open())
  254. {
  255. NS_ABORT_MSG("Can't open file " << filenameRssi);
  256. }
  257.  
  258. m_outUePositionsFile.open (filenameUePositions.c_str ());
  259. m_outUePositionsFile.setf (std::ios_base::fixed);
  260.  
  261. if(!m_outUePositionsFile.is_open())
  262. {
  263. NS_ABORT_MSG("Can't open file " << filenameUePositions);
  264. }
  265.  
  266. m_outGnbPositionsFile.open (filenameGnbPositions.c_str ());
  267. m_outGnbPositionsFile.setf (std::ios_base::fixed);
  268.  
  269. if(!m_outGnbPositionsFile.is_open())
  270. {
  271. NS_ABORT_MSG("Can't open file " << filenameGnbPositions);
  272. }
  273.  
  274. m_outDistancesFile.open (filenameDistances.c_str ());
  275. m_outDistancesFile.setf (std::ios_base::fixed);
  276.  
  277. if(!m_outDistancesFile.is_open())
  278. {
  279. NS_ABORT_MSG("Can't open file " << filenameDistances);
  280. }
  281.  
  282. Config::SetDefault ("ns3::AntennaArray3gppModel::GnbAntennaMountType", EnumValue (gNbAntennaMount));
  283. Config::SetDefault ("ns3::AntennaArrayModel::AntennaOrientation", EnumValue (antOrientation));
  284. // configure antenna gain for the ISO antenna
  285. Config::SetDefault ("ns3::AntennaArrayModel::AntennaGain", DoubleValue (5));
  286. Config::SetDefault ("ns3::MmWave3gppPropagationLossModel::Scenario", StringValue(scenario));
  287. Config::SetDefault ("ns3::MmWave3gppPropagationLossModel::Shadowing", BooleanValue(shadowing));
  288.  
  289. // we tried also with the optional nLos model and both 3gpp antennas, and it is not better calibrated
  290. Config::SetDefault ("ns3::MmWave3gppPropagationLossModel::OptionalNlos", BooleanValue(false));
  291.  
  292. // Default scenario configuration that are summarised in to R1-1703534 3GPP TSG RAN WG1 Meeting #88
  293. Config::SetDefault ("ns3::MmWave3gppChannel::Speed", DoubleValue (speed*1000/3600));
  294. // Disable channel matrix update to speed up the simulation execution
  295. Config::SetDefault ("ns3::MmWave3gppChannel::UpdatePeriod", TimeValue (MilliSeconds(0)));
  296. Config::SetDefault ("ns3::MmWavePhyMacCommon::MacSchedulerType", TypeIdValue (TypeId::LookupByName("ns3::MmWaveMacSchedulerTdmaPF")));
  297. // Config::SetDefault ("ns3::LteRlcUm::MaxTxBufferSize", UintegerValue(999999999));
  298. // Config::SetDefault ("ns3::LteRlcUmLowLat::MaxTxBufferSize", UintegerValue(999999999));
  299. Config::SetDefault ("ns3::MmWave3gppChannel::CellScan", BooleanValue (isBeamSearchMethod));
  300. Config::SetDefault ("ns3::MmWave3gppChannel::BeamSearchAngleStep", DoubleValue (beamSearchMethodAngle));
  301.  
  302. Config::SetDefault ("ns3::LteEnbRrc::SrsPeriodicity", UintegerValue (320));
  303. // Parameters according to R1-1703534 3GPP TSG RAN WG1 Meetging #88, 2017
  304. // Evaluation assumptions for Phase 1 NR MIMO system level calibration,
  305. Config::SetDefault ("ns3::MmWaveEnbPhy::TxPower", DoubleValue(23));
  306. Config::SetDefault ("ns3::MmWavePhyMacCommon::CenterFreq", DoubleValue(160e9));
  307. Config::SetDefault ("ns3::MmWavePhyMacCommon::Numerology", UintegerValue(2));
  308. Config::SetDefault ("ns3::MmWavePhyMacCommon::Bandwidth", DoubleValue(40e6));
  309.  
  310. // Should be 4x8 = 32 antenna elements
  311. Config::SetDefault ("ns3::MmWaveEnbPhy::AntennaArrayType", TypeIdValue(gNbAntennaModel));
  312. Config::SetDefault ("ns3::MmWaveEnbPhy::AntennaNumDim1", UintegerValue(6));
  313. Config::SetDefault ("ns3::MmWaveEnbPhy::AntennaNumDim2", UintegerValue(8));
  314.  
  315. // Should be 2x4 = 8 antenna elements
  316. Config::SetDefault ("ns3::MmWaveUePhy::AntennaArrayType", TypeIdValue(ueAntennaModel));
  317. Config::SetDefault ("ns3::MmWaveUePhy::AntennaNumDim1", UintegerValue(4));
  318. Config::SetDefault ("ns3::MmWaveUePhy::AntennaNumDim2", UintegerValue(8));
  319.  
  320. // UE antenna gain shall be set to 5 dBi
  321. // gNB noise figure shall be set to 7 dB
  322. Config::SetDefault("ns3::MmWaveEnbPhy::NoiseFigure", DoubleValue (7));
  323. // UE noise figure shall be set to 10 dB
  324. Config::SetDefault("ns3::MmWaveUePhy::NoiseFigure", DoubleValue (10));
  325. // set LOS,NLOS condition
  326. Config::SetDefault ("ns3::MmWave3gppPropagationLossModel::ChannelCondition", StringValue("a"));
  327. // setup the mmWave simulation
  328.  
  329.  
  330. Ptr<MmWaveHelper> mmWaveHelper = CreateObject<MmWaveHelper> ();
  331. mmWaveHelper->SetAttribute ("PathlossModel", StringValue ("ns3::MmWave3gppPropagationLossModel"));
  332. mmWaveHelper->SetAttribute ("ChannelModel", StringValue ("ns3::MmWave3gppChannel"));
  333.  
  334. Ptr<NrPointToPointEpcHelper> epcHelper = CreateObject<NrPointToPointEpcHelper> ();
  335. mmWaveHelper->SetEpcHelper (epcHelper);
  336. mmWaveHelper->Initialize();
  337.  
  338. // create base stations and mobile terminals
  339. NodeContainer gNbNodes;
  340. NodeContainer ueNodes;
  341. MobilityHelper gnmobility, uemobility;
  342.  
  343.  
  344. gNbNodes.Create (3);
  345. ueNodes.Create (1);
  346.  
  347. // Creating positions of the gNB according to the 3gpp TR 38.900 Figure 7.2.-1
  348. Ptr<ListPositionAllocator> gNbPositionAlloc = CreateObject<ListPositionAllocator> ();
  349. gNbPositionAlloc->Add(Vector( 76, 40, 3));
  350. gNbPositionAlloc->Add(Vector( 45 , 12 , 3));
  351. gNbPositionAlloc->Add(Vector( 20, 40, 3));
  352. gnmobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
  353. gnmobility.SetPositionAllocator (gNbPositionAlloc);
  354. gnmobility.Install (gNbNodes);
  355.  
  356. Ptr<ListPositionAllocator> uEPositionAlloc = CreateObject<ListPositionAllocator> ();
  357. uEPositionAlloc->Add(Vector( 45, 40, 1.5));
  358. uemobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
  359. uemobility.SetPositionAllocator (uEPositionAlloc);
  360. uemobility.Install(ueNodes);
  361.  
  362.  
  363.  
  364.  
  365. Vector v = gNbNodes.Get(0)->GetObject<MobilityModel>()->GetPosition();
  366. m_outGnbPositionsFile<<0<<"\t"<<v.x<<"\t"<<v.y<<"\t"<<v.z<<" "<<std::endl;
  367. Vector v1 = gNbNodes.Get(1)->GetObject<MobilityModel>()->GetPosition();
  368. m_outGnbPositionsFile<<0<<"\t"<<v1.x<<"\t"<<v1.y<<"\t"<<v1.z<<" "<<std::endl;
  369. Vector v2 = gNbNodes.Get(2)->GetObject<MobilityModel>()->GetPosition();
  370. m_outGnbPositionsFile<<0<<"\t"<<v2.x<<"\t"<<v2.y<<"\t"<<v2.z<<" "<<std::endl;
  371.  
  372. Vector ve = ueNodes.Get(0)->GetObject<MobilityModel>()->GetPosition();
  373. m_outUePositionsFile<<0<<"\t"<<ve.x<<"\t"<<ve.y<<"\t"<<ve.z<<" "<<std::endl;
  374.  
  375. double x = ve.x - v.x;
  376. double y = ve.y - v.y;
  377. double distance = sqrt (x * x + y * y);
  378.  
  379. m_outDistancesFile <<distance<<std::endl;
  380.  
  381.  
  382. double x1 = ve.x - v1.x;
  383. double y1 = ve.y - v1.y;
  384. double distance1 = sqrt (x1 * x1 + y1 * y1);
  385.  
  386. m_outDistancesFile <<distance1<<std::endl;
  387.  
  388.  
  389. double x2 = ve.x - v2.x;
  390. double y2 = ve.y - v2.y;
  391. double distance2 = sqrt (x2 * x2 + y2* y2);
  392.  
  393. m_outDistancesFile <<distance2<<std::endl;
  394.  
  395.  
  396.  
  397. m_outUePositionsFile.close();
  398. m_outGnbPositionsFile.close();
  399. m_outDistancesFile.close();
  400.  
  401.  
  402. //mobility.SetPositionAllocator (ueRandomRectPosAlloc);
  403. //install mmWave net devices
  404. NetDeviceContainer gNbDevs = mmWaveHelper->InstallEnbDevice (gNbNodes);
  405.  
  406. NetDeviceContainer ueNetDevs = mmWaveHelper->InstallUeDevice (ueNodes);
  407.  
  408.  
  409. // create the internet and install the IP stack on the UEs
  410. // get SGW/PGW and create a single RemoteHost
  411. Ptr<Node> pgw = epcHelper->GetPgwNode ();
  412. NodeContainer remoteHostContainer;
  413. remoteHostContainer.Create (1);
  414. Ptr<Node> remoteHost = remoteHostContainer.Get (0);
  415. InternetStackHelper internet;
  416. internet.Install (remoteHostContainer);
  417.  
  418. // connect a remoteHost to pgw. Setup routing too
  419. PointToPointHelper p2ph;
  420. p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("100Gb/s")));
  421. p2ph.SetDeviceAttribute ("Mtu", UintegerValue (2500));
  422. p2ph.SetChannelAttribute ("Delay", TimeValue (Seconds (0.000)));
  423. NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost);
  424. Ipv4AddressHelper ipv4h;
  425. ipv4h.SetBase ("1.0.0.0", "255.0.0.0");
  426. Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices);
  427. // in this container, interface 0 is the pgw, 1 is the remoteHost
  428. //Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress (1);
  429.  
  430. Ipv4StaticRoutingHelper ipv4RoutingHelper;
  431. Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject<Ipv4> ());
  432. remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.0.0.0"), 1);
  433. internet.Install (ueNodes);
  434. Ipv4InterfaceContainer ueIpIface;
  435. ueIpIface = epcHelper->AssignUeIpv4Address (NetDeviceContainer (ueNetDevs));
  436.  
  437. // Set the default gateway for the UEs
  438.  
  439. Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ueNodes.Get(0)->GetObject<Ipv4> ());
  440. ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
  441.  
  442. Ptr<NetDevice> closestEnbDevice;
  443.  
  444. for (NetDeviceContainer::Iterator i = gNbDevs.Begin (); i != gNbDevs.End (); ++i)
  445. {
  446. closestEnbDevice = *i;
  447.  
  448. for (NetDeviceContainer::Iterator ue = ueNetDevs.Begin (); ue != ueNetDevs.End (); ue++)
  449. {
  450.  
  451.  
  452. mmWaveHelper->AttachToEnb (*ue, closestEnbDevice);
  453.  
  454. uint16_t dlPort = 1234;
  455. ApplicationContainer clientAppsDl;
  456. ApplicationContainer serverAppsDl;
  457.  
  458. Time udpInterval = Time::FromDouble((1000*8) / static_cast<double> (udpRate.GetBitRate ()), Time::S);
  459.  
  460. UdpServerHelper dlPacketSinkHelper (dlPort);
  461. serverAppsDl.Add (dlPacketSinkHelper.Install (ueNodes));
  462.  
  463. // configure UDP downlink traffic
  464.  
  465. UdpClientHelper dlClient (ueIpIface.GetAddress (0), dlPort); //CHECK AFTER
  466. dlClient.SetAttribute ("MaxPackets", UintegerValue(0xFFFFFFFF));
  467. dlClient.SetAttribute("PacketSize", UintegerValue(1000));
  468. dlClient.SetAttribute ("Interval", TimeValue (udpInterval)); // we try to saturate, we just need to measure during a short time, how much traffic can handle each BWP
  469. clientAppsDl.Add (dlClient.Install (remoteHost));
  470.  
  471.  
  472. // start UDP server and client apps
  473. serverAppsDl.Start(udpAppStartTimeDl);
  474. clientAppsDl.Start(udpAppStartTimeDl);
  475.  
  476. serverAppsDl.Stop(udpAppStopTimeDl);
  477. clientAppsDl.Stop(udpAppStopTimeDl);
  478.  
  479.  
  480. Ptr<MmWaveSpectrumPhy > ue1SpectrumPhy = DynamicCast<MmWaveUeNetDevice>
  481. (ueNetDevs.Get(0))->GetPhy(0)->GetSpectrumPhy();
  482. Ptr<mmWaveInterference> ue1SpectrumPhyInterference = ue1SpectrumPhy->GetMmWaveInterference();
  483. NS_ABORT_IF(!ue1SpectrumPhyInterference);
  484. ue1SpectrumPhyInterference->TraceConnectWithoutContext("RssiPerProcessedChunk", MakeBoundCallback (&UeRssiPerProcessedChunkTrace, this));
  485.  
  486. }
  487. }
  488. AnimationInterface anim("g.xml");
  489. anim.SetConstantPosition(gNbNodes.Get(0), v.x,v.y,v.z);
  490. anim.SetConstantPosition(gNbNodes.Get(1), v1.x,v1.y,v1.z);
  491. anim.SetConstantPosition(gNbNodes.Get(2), v2.x,v2.y,v2.z);
  492. anim.SetConstantPosition(ueNodes.Get(0), ve.x,ve.y,ve.z);
  493.  
  494. Simulator::Stop (simTime);
  495. Simulator::Run ();
  496. Simulator::Destroy ();
  497.  
  498. }
  499.  
  500.  
  501. //##########################################################################################
  502. int main(int argc, char *argv[])
  503. {
  504.  
  505. CommandLine cmd;
  506. cmd.Parse (argc, argv);
  507. ConfigStore inputConfig;
  508. inputConfig.ConfigureDefaults ();
  509. // parse again so you can override input file default values via command line
  510. cmd.Parse (argc, argv);
  511.  
  512. EnumValue enumValue;
  513. DoubleValue doubleValue;
  514. BooleanValue booleanValue;
  515. StringValue stringValue;
  516. TypeIdValue typeIdValue;
  517. UintegerValue uintValue;
  518.  
  519. GlobalValue::GetValueByName ("duration", uintValue);
  520. uint32_t duration = uintValue.Get ();
  521.  
  522. GlobalValue::GetValueByName ("shadowing", booleanValue);
  523. bool shadowing = booleanValue.Get ();
  524.  
  525. GlobalValue::GetValueByName ("antennaOrientation", enumValue);
  526. enum AntennaArray3gppModel::AntennaOrientation antennaOrientation = (AntennaArray3gppModel::AntennaOrientation) enumValue.Get ();
  527.  
  528. GlobalValue::GetValueByName ("antennaModelGnb", enumValue);
  529. enum AntennaModelEnum antennaGnb = (AntennaModelEnum) enumValue.Get ();
  530. TypeId antennaModelGnb;
  531. if (antennaGnb == _3GPP)
  532. {
  533. antennaModelGnb = AntennaArray3gppModel::GetTypeId();
  534. }
  535. else
  536. {
  537. antennaModelGnb = AntennaArrayModel::GetTypeId();
  538. }
  539.  
  540. GlobalValue::GetValueByName ("antennaModelUe", enumValue);
  541. enum AntennaModelEnum antennaUe = (AntennaModelEnum) enumValue.Get ();
  542. TypeId antennaModelUe;
  543. if (antennaUe == _3GPP)
  544. {
  545. antennaModelUe = AntennaArray3gppModel::GetTypeId();
  546. }
  547. else
  548. {
  549. antennaModelUe = AntennaArrayModel::GetTypeId();
  550. }
  551.  
  552. GlobalValue::GetValueByName ("indoorScenario", stringValue);
  553. std::string indoorScenario = stringValue.Get ();
  554.  
  555. GlobalValue::GetValueByName ("speed", doubleValue);
  556. double speed = doubleValue.Get ();
  557.  
  558. GlobalValue::GetValueByName ("resultsDir", stringValue);
  559. std::string resultsDir = stringValue.Get ();
  560.  
  561. GlobalValue::GetValueByName ("simTag", stringValue);
  562. std::string tag = stringValue.Get ();
  563.  
  564. GlobalValue::GetValueByName ("isBeamSearchMethod", booleanValue);
  565. bool isBeamSearchMethod = booleanValue.Get ();
  566.  
  567. GlobalValue::GetValueByName ("beamSearchMethodAngle", doubleValue);
  568. double beamSearchMethodAngle = doubleValue.Get ();
  569.  
  570. GlobalValue::GetValueByName ("gnbAntennaMount", enumValue);
  571. enum AntennaArray3gppModel::GnbAntennaMount gnbAntennaMount = (AntennaArray3gppModel::GnbAntennaMount) enumValue.Get ();
  572.  
  573.  
  574. Nr3gppIndoorCalibration phase1CalibrationScenario;
  575. phase1CalibrationScenario.Run(shadowing, antennaOrientation, antennaModelGnb, antennaModelUe,
  576. indoorScenario, speed, resultsDir, tag, isBeamSearchMethod, beamSearchMethodAngle, gnbAntennaMount, duration);
  577.  
  578.  
  579. return 0;
  580. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement