Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about MCS using mmwave-epc-tdma #257

Open
amao2021 opened this issue Jan 5, 2023 · 3 comments
Open

Question about MCS using mmwave-epc-tdma #257

amao2021 opened this issue Jan 5, 2023 · 3 comments

Comments

@amao2021
Copy link

amao2021 commented Jan 5, 2023

Hi,
Thank you for providing wonderful simulator.
I'm doing my own project with ns3-mmwave.
I want to reproduce your multi-user scheduling experiment in paper End-to-End Simulation of 5G mmWave Networks. So I started from mmWave-epc-tdma.cc.
I use the file RxPacketTrace.txt to get the DL PHY Throughput. Here are some questions.

  1. After I changed the scheduler to MR or PF, the mcs values are always 0. And when I changed it to MaxWeight, error No way to create such TB size, something went wrong! appeared. I am confused and want to know the configurations of schedulers.
  2. In paper End-to-End Simulation of 5G mmWave Networks, you said _ UEs have similar distances from the eNB but are assigned the constant speed of 25 m/s_. I really want to know the distance between UEs and eNB.

Looking forward to hearing from you.

@pagmatt
Copy link
Contributor

pagmatt commented Jan 9, 2023

Hi,

First of all, please be aware that the paper "End-to-End Simulation of 5G mmWave Networks" refers to an older version of the mmWave module. A lot of changes have been introduced since then, and this will already make very hard to reproduce results 1:1.
Regarding question 1, I can take at the scheduler error. Did you modify only the mmwave-epc-tdma.cc file ? If that is the case, can you upload here or link your version ?
Related to question 2, I can not find the specific distances either. They seem to be in the [20, 100] range by looking at the figures, but that is all I can say unfortunately.

BR,
Matteo

@amao2021
Copy link
Author

amao2021 commented Jan 10, 2023

Hi, pagmatt,
Thank you very much for your advice!

  1. I was using the latest version of new-handover. I changed the scheduler, the frame structure, the number of UEs and the speed of UEs. By the way, mcs was also 0 when I changed only the scheduler. I will put the code at the end.
  2. After seeing your suggestion, I tried the bbr and master version. the bbr version failed in the build step, but the master version succeeded. And the code and frame structure of the master version seems to be closer to the paper, so I am now trying to reproduce your experimental results with it.
  3. Also for the 7 UE scenario, is their respective distance to the eNB actually a series of random numbers between [20, 100]? (as written in the code) Or they have a similar distance from enb?

Best,
Mao

================================================================================================

mmwave-epc-tdma.txt

#include "ns3/epc-helper.h"
#include "ns3/internet-module.h"
#include "ns3/mobility-module.h"
#include "ns3/applications-module.h"
#include "ns3/point-to-point-helper.h"
#include "ns3/config-store-module.h"
#include "ns3/command-line.h"
#include "ns3/mmwave-helper.h"
#include "ns3/mmwave-point-to-point-epc-helper.h"
#include
#include

#include <ns3/nstime.h>

using namespace ns3;
using namespace mmwave;

/**

  • Sample simulation script for LTE+EPC. It instantiates several eNodeB,
  • attaches one UE per eNodeB starts a flow for each UE to and from a remote host.
  • It also starts yet another flow between each UE pair.
    */
    NS_LOG_COMPONENT_DEFINE ("MmWaveEpcTdma");
    int
    main (int argc, char *argv[])
    {

//LogComponentEnable ("MmWaveFlexTtiMacScheduler", LOG_LEVEL_DEBUG);
//LogComponentEnable ("MmWaveFlexTtiMaxWeightMacScheduler", LOG_LEVEL_DEBUG);
//LogComponentEnable ("MmWaveFlexTtiPfMacScheduler", LOG_LEVEL_DEBUG);
//LogComponentEnable ("MmWaveFlexTtiMaxRateMacScheduler", LOG_LEVEL_DEBUG);

uint16_t numEnb = 1;
uint16_t numUe = 7;
double simTime = 1.0;
double interPacketInterval = 100;
double minDistance = 10.0; // eNB-UE distance in meters
double maxDistance = 200; // eNB-UE distance in meters
bool harqEnabled = true;
bool rlcAmEnabled = false;
bool fixedTti = false; //variable TTI
//
bool DlSchedOnly = true;
bool UlSchedOnly = false;
//

Time m_subframePeriod = Time (NanoSeconds (1e5));//!< time duration of a single subframe
Time m_symbolPeriod = Time (NanoSeconds (4160)); //!< time duration of a single OFDM symbol
// Command line arguments

CommandLine cmd;
cmd.AddValue ("numEnb", "Number of eNBs", numEnb);
cmd.AddValue ("numUe", "Number of UEs per eNB", numUe);
cmd.AddValue ("simTime", "Total duration of the simulation [s])", simTime);
cmd.AddValue ("interPacketInterval", "Inter-packet interval [us])", interPacketInterval);
cmd.AddValue ("harq", "Enable Hybrid ARQ", harqEnabled);
cmd.AddValue ("rlcAm", "Enable RLC-AM", rlcAmEnabled);
cmd.AddValue ("fixedTti", "Fixed TTI scheduler", fixedTti);//variable TTI

cmd.Parse (argc, argv);

Config::SetDefault ("ns3::MmWaveHelper::RlcAmEnabled", BooleanValue (rlcAmEnabled));
Config::SetDefault ("ns3::MmWaveHelper::HarqEnabled", BooleanValue (harqEnabled));

Config::SetDefault ("ns3::MmWaveFlexTtiMacScheduler::HarqEnabled", BooleanValue (harqEnabled));
Config::SetDefault ("ns3::MmWaveFlexTtiMacScheduler::DlSchedOnly", BooleanValue (DlSchedOnly));
Config::SetDefault ("ns3::MmWaveFlexTtiMacScheduler::UlSchedOnly", BooleanValue (UlSchedOnly));
Config::SetDefault ("ns3::MmWaveFlexTtiMacScheduler::FixedTti", BooleanValue(fixedTti));

Config::SetDefault ("ns3::MmWaveFlexTtiPfMacScheduler::HarqEnabled", BooleanValue (harqEnabled));
Config::SetDefault ("ns3::MmWaveFlexTtiPfMacScheduler::DlSchedOnly", BooleanValue (DlSchedOnly));
Config::SetDefault ("ns3::MmWaveFlexTtiPfMacScheduler::UlSchedOnly", BooleanValue (UlSchedOnly));
Config::SetDefault ("ns3::MmWaveFlexTtiPfMacScheduler::FixedTti", BooleanValue(fixedTti));

Config::SetDefault ("ns3::MmWaveFlexTtiMaxWeightMacScheduler::HarqEnabled", BooleanValue (harqEnabled));
Config::SetDefault ("ns3::MmWaveFlexTtiMaxWeightMacScheduler::FixedTti", BooleanValue(fixedTti));
Config::SetDefault ("ns3::MmWaveFlexTtiMaxWeightMacScheduler::DlSchedOnly", BooleanValue (DlSchedOnly));
Config::SetDefault ("ns3::MmWaveFlexTtiMaxWeightMacScheduler::UlSchedOnly", BooleanValue (UlSchedOnly));
Config::SetDefault ("ns3::MmWaveFlexTtiMaxWeightMacScheduler::SymPerSlot", UintegerValue(6));

Config::SetDefault ("ns3::MmWaveFlexTtiMaxRateMacScheduler::HarqEnabled", BooleanValue (harqEnabled));
Config::SetDefault ("ns3::MmWaveFlexTtiMaxRateMacScheduler::DlSchedOnly", BooleanValue (DlSchedOnly));
Config::SetDefault ("ns3::MmWaveFlexTtiMaxRateMacScheduler::UlSchedOnly", BooleanValue (UlSchedOnly));
Config::SetDefault ("ns3::MmWaveFlexTtiMaxRateMacScheduler::FixedTti", BooleanValue(fixedTti));

Config::SetDefault ("ns3::MmWavePhyMacCommon::TbDecodeLatency", UintegerValue (200.0));
Config::SetDefault ("ns3::ThreeGppChannelModel::UpdatePeriod", TimeValue (MilliSeconds (100000.0)));
Config::SetDefault ("ns3::LteEnbRrc::SystemInformationPeriodicity", TimeValue (MilliSeconds (5.0)));
Config::SetDefault ("ns3::LteRlcAm::ReportBufferStatusTimer", TimeValue (MicroSeconds (100.0)));
Config::SetDefault ("ns3::LteRlcUmLowLat::ReportBufferStatusTimer", TimeValue (MicroSeconds (100.0)));
Config::SetDefault ("ns3::LteEnbRrc::SrsPeriodicity", UintegerValue (320));
Config::SetDefault ("ns3::LteEnbRrc::FirstSibTime", UintegerValue (2));

// the applications on this example start very early.
// Use the IDEAL mode in RRC (no radio messages are exchanged for RRC control ops)
// and set to the minimum the latency on the S1-AP link to speed up the link and bearers setup
Config::SetDefault ("ns3::MmWaveHelper::UseIdealRrc", BooleanValue (true));
Config::SetDefault ("ns3::MmWavePointToPointEpcHelper::S1apLinkDelay", TimeValue (Seconds (0)));

Ptr mmwaveHelper = CreateObject ();
Ptr epcHelper = CreateObject ();
mmwaveHelper->SetEpcHelper (epcHelper);
mmwaveHelper->SetHarqEnabled (harqEnabled);
//
mmwaveHelper->SetSchedulerType ("ns3::MmWaveFlexTtiMacScheduler");
//mmwaveHelper->SetSchedulerType ("ns3::MmWaveFlexTtiPfMacScheduler");
//mmwaveHelper->SetSchedulerType ("ns3::MmWaveFlexTtiMaxWeightMacScheduler");
//mmwaveHelper->SetSchedulerType ("ns3::MmWaveFlexTtiMaxRateMacScheduler");
std::cout <<"\n"<< "GetSchedulerType:" << mmwaveHelper->GetSchedulerType ()<<"\n";

ConfigStore inputConfig;
inputConfig.ConfigureDefaults ();

// parse again so you can override default values from the command line
cmd.Parse (argc, argv);

// create MmWavePhyMacCommon object
Ptr phyMacConfig0 = CreateObject ();
phyMacConfig0->SetSubframePerFrame(10);
std::cout << "GetSubframesPerFrame:" <GetSubframesPerFrame() <<"\n";
phyMacConfig0->SetSubframePeriod(m_subframePeriod);
phyMacConfig0->GetSubframePeriod();
std::cout << "GetSubframePeriod:" <GetSubframePeriod() <<"\n";
phyMacConfig0->SetSymbolsPerSubframe(24);
std::cout <<"SymbolsPerSubframe:"<< phyMacConfig0->GetSymbolsPerSubframe() <<"\n";
phyMacConfig0-> SetSymbolPeriod(m_symbolPeriod);
phyMacConfig0->GetSymbolPeriod();
std::cout << "SymbolPeriod:" <GetSymbolPeriod() <<"\n";
phyMacConfig0->SetBandwidth (1.0e9);
std::cout << "GetBandwidth:" <GetBandwidth() <<"\n";
phyMacConfig0->GetCenterFrequency();
std::cout << "CenterFrequency:" <GetCenterFrequency() <<"\n";
phyMacConfig0->SetNumRefScPerSym(864);
phyMacConfig0->GetNumRefScPerSym();
std::cout << "NumRefScPerSym:" <GetNumRefScPerSym() <<"\n";
phyMacConfig0->GetDlCtrlSymbols();
std::cout << "GetDlCtrlSymbols:" <GetDlCtrlSymbols() <<"\n";
phyMacConfig0->GetUlCtrlSymbols();
std::cout << "GetUlCtrlSymbols:" <GetUlCtrlSymbols() <<"\n";
std::cout << "GetL1L2Latency:" <GetL1L2Latency()<<"\n";
std::cout << "GetTbDecodeLatency:" <GetTbDecodeLatency()<<"\n";
std::cout << "GetNumHarqProcess:" <GetNumHarqProcess()<<"\n";
std::cout << "GetRbWidth:" <GetRbWidth()<<"\n";
std::cout << "GetNumRb:" <GetNumRb()<<"\n";
// phyMacConfig0->SetNrNumerology (2);
// phyMacConfig0->

Ptr pgw = epcHelper->GetPgwNode ();

// Create a single RemoteHost
NodeContainer remoteHostContainer;
remoteHostContainer.Create (1);
Ptr remoteHost = remoteHostContainer.Get (0);
InternetStackHelper internet;
internet.Install (remoteHostContainer);

// Create the Internet
PointToPointHelper p2ph;
p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("100Gb/s")));//带宽?
p2ph.SetDeviceAttribute ("Mtu", UintegerValue (1500));
p2ph.SetChannelAttribute ("Delay", TimeValue (MicroSeconds (100.0)));//delay 100ms
NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost);
Ipv4AddressHelper ipv4h;
ipv4h.SetBase ("1.0.0.0", "255.0.0.0");
Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices);

Ipv4StaticRoutingHelper ipv4RoutingHelper;
Ptr remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject ());
remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.0.0.0"), 1);

NodeContainer ueNodes;
NodeContainer enbNodes;
enbNodes.Create (numEnb);
ueNodes.Create (numUe);

// Install Mobility Model
Ptr enbPositionAlloc = CreateObject ();
enbPositionAlloc->Add (Vector (0.0, 0.0, 0.0));
MobilityHelper enbmobility;
enbmobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
enbmobility.SetPositionAllocator (enbPositionAlloc);
enbmobility.Install (enbNodes);

MobilityHelper uemobility;
Ptr uePositionAlloc = CreateObject ();
//Ptr distRv = CreateObject ();

for (unsigned i = 0; i < numUe; i++)
{
// double dist = distRv->GetValue (minDistance, maxDistance);
double dist = (i+1)* (maxDistance-minDistance)/numUe + minDistance;
std::cout << "ue-dist:" << dist << "m"<<"\n";//mao see value
uePositionAlloc->Add (Vector (dist, 0.0, 0.0));
//uePositionAlloc->Add (Vector (dist, -12.5, 0.0));
}

//uemobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
uemobility.SetMobilityModel ("ns3::ConstantVelocityMobilityModel");
uemobility.SetPositionAllocator (uePositionAlloc);
uemobility.Install (ueNodes);

for (unsigned i = 0; i < numUe; i++)
{
double speed = 0;
std::cout << "ue-speed:" << speed << "m/s"<<"\n";//mao see value
ueNodes.Get(i)->GetObject()->SetVelocity(Vector(0,speed,0));
}

// Install mmWave Devices to the nodes
NetDeviceContainer enbmmWaveDevs = mmwaveHelper->InstallEnbDevice (enbNodes);
NetDeviceContainer uemmWaveDevs = mmwaveHelper->InstallUeDevice (ueNodes);

// Install the IP stack on the UEs
internet.Install (ueNodes);
Ipv4InterfaceContainer ueIpIface;
ueIpIface = epcHelper->AssignUeIpv4Address (NetDeviceContainer (uemmWaveDevs));
// Assign IP address to UEs, and install applications
for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
{
Ptr ueNode = ueNodes.Get (u);
// Set the default gateway for the UE
Ptr ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ueNode->GetObject ());
ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
}

mmwaveHelper->AttachToClosestEnb (uemmWaveDevs, enbmmWaveDevs);

// Install and start applications on UEs and remote host
uint16_t dlPort = 1234;
uint16_t ulPort = 2000;
uint16_t otherPort = 3000;
ApplicationContainer clientApps;
ApplicationContainer serverApps;
uint32_t packetSize = 1400;

double dataRateMB = 100e6; // 100 MBps mao
// double dataRate = 1000e6;
double onTimeSec = 5e-6; //packetSize / dataRateMB;
std::stringstream ss;
ss << "ns3::ConstantRandomVariable[Constant=" << onTimeSec << "]";
std::cout << "OnTime == " << ss.str () << std::endl;
OnOffHelper dlClient ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), dlPort));
OnOffHelper ulClient ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), ulPort));
dlClient.SetAttribute ("PacketSize", UintegerValue (packetSize));
ulClient.SetAttribute ("PacketSize", UintegerValue (packetSize));
dlClient.SetAttribute ("DataRate", DataRateValue (8 * dataRateMB)); //Byte * 8 = bit bps
ulClient.SetAttribute ("DataRate", DataRateValue (8 * dataRateMB));

// dlClient.SetAttribute ("DataRate", DataRateValue (dataRate));
// ulClient.SetAttribute ("DataRate", DataRateValue (dataRate));

dlClient.SetAttribute ("OnTime", StringValue (ss.str ()));
ulClient.SetAttribute ("OnTime", StringValue (ss.str ()));
ss.str ("");
ss << "ns3::ExponentialRandomVariable[Mean=" << interPacketInterval * 1e-6 << "]";
std::cout << "OffTime == " << ss.str () << std::endl;
dlClient.SetAttribute ("OffTime", StringValue (ss.str ()));
ulClient.SetAttribute ("OffTime", StringValue (ss.str ()));

for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
{
++ulPort;
++otherPort;
PacketSinkHelper dlPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), dlPort));
PacketSinkHelper ulPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), ulPort));
serverApps.Add (dlPacketSinkHelper.Install (ueNodes.Get (u)));
serverApps.Add (ulPacketSinkHelper.Install (remoteHost));

// UdpClientHelper dlClient (ueIpIface.GetAddress (u), dlPort);
// dlClient.SetAttribute ("Interval", TimeValue (MicroSeconds(interPacketInterval)));
// dlClient.SetAttribute ("MaxPackets", UintegerValue(1000000));
// dlClient.SetAttribute ("PacketSize", UintegerValue(packetSize));
//
// UdpClientHelper ulClient (remoteHostAddr, ulPort);
// ulClient.SetAttribute ("Interval", TimeValue (MicroSeconds(interPacketInterval)));
// ulClient.SetAttribute ("MaxPackets", UintegerValue(1000000));
// ulClient.SetAttribute ("PacketSize", UintegerValue(packetSize));

// UdpClientHelper client (ueIpIface.GetAddress (u), otherPort);
// client.SetAttribute ("Interval", TimeValue (MicroSeconds(interPacketInterval)));
// client.SetAttribute ("MaxPackets", UintegerValue(1000000));
dlClient.SetAttribute ("Remote", AddressValue (InetSocketAddress (ueIpIface.GetAddress (u), dlPort)));
// ulClient.SetAttribute ("Remote", AddressValue (InetSocketAddress (remoteHostAddr, ulPort)));

  clientApps.Add (dlClient.Install (remoteHost));
  clientApps.Add (ulClient.Install (ueNodes.Get(u)));

// if (u+1 < ueNodes.GetN ())
// {
// clientApps.Add (client.Install (ueNodes.Get(u+1)));
// }
// else
// {
// clientApps.Add (client.Install (ueNodes.Get(0)));
// }
}
serverApps.Start (Seconds (0.003));
clientApps.Start (Seconds (0.003));
mmwaveHelper->EnableTraces ();
// Uncomment to enable PCAP tracing
//p2ph.EnablePcapAll("mmwave-epc-simple");

Simulator::Stop (Seconds (simTime));
Simulator::Run ();

/GtkConfigStore config;
config.ConfigureAttributes();
/

Simulator::Destroy ();
return 0;

}

@amao2021
Copy link
Author

Is there something I missed when I set up the scheduler? In the newest version, after I change the scheduler, mcs is still 0.
Sometimes only DL has mcs value and UL is still 0.

Looking forward to hearing from you.
Mao

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants