Moved all output filenames to attributes
This commit is contained in:
@@ -39,24 +39,21 @@ main (int argc, char *argv[])
|
||||
uint32_t nUe = 1;
|
||||
uint32_t nFloors = 0;
|
||||
double simTime = 1.0;
|
||||
std::string traceDirectory = "";
|
||||
CommandLine cmd;
|
||||
|
||||
cmd.AddValue("nEnb", "Number of eNodeBs per floor", nEnbPerFloor);
|
||||
cmd.AddValue("nUe", "Number of UEs", nUe);
|
||||
cmd.AddValue("nFloors", "Number of floors, 0 for Friis propagation model",
|
||||
nFloors);
|
||||
cmd.AddValue("simTime", "Total duration of the simulation (in seconds)",
|
||||
simTime);
|
||||
cmd.AddValue("traceDirectory",
|
||||
"Destination folder where the traces will be stored", traceDirectory);
|
||||
cmd.Parse(argc, argv);
|
||||
cmd.AddValue ("nEnb", "Number of eNodeBs per floor", nEnbPerFloor);
|
||||
cmd.AddValue ("nUe", "Number of UEs", nUe);
|
||||
cmd.AddValue ("nFloors", "Number of floors, 0 for Friis propagation model",
|
||||
nFloors);
|
||||
cmd.AddValue ("simTime", "Total duration of the simulation (in seconds)",
|
||||
simTime);
|
||||
cmd.Parse (argc, argv);
|
||||
|
||||
ConfigStore inputConfig;
|
||||
inputConfig.ConfigureDefaults();
|
||||
|
||||
inputConfig.ConfigureDefaults ();
|
||||
|
||||
// parse again so you can override default values from the command line
|
||||
cmd.Parse(argc, argv);
|
||||
cmd.Parse (argc, argv);
|
||||
|
||||
// Geometry of the scenario (in meters)
|
||||
// Assume squared building
|
||||
@@ -71,14 +68,14 @@ main (int argc, char *argv[])
|
||||
//LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL);
|
||||
if (nFloors == 0)
|
||||
{
|
||||
lteHelper->SetAttribute("PathlossModel",
|
||||
StringValue("ns3::FriisPropagationLossModel"));
|
||||
lteHelper->SetAttribute ("PathlossModel",
|
||||
StringValue ("ns3::FriisPropagationLossModel"));
|
||||
nEnb = nEnbPerFloor;
|
||||
}
|
||||
else
|
||||
{
|
||||
lteHelper->SetAttribute("PathlossModel",
|
||||
StringValue("ns3::BuildingsPropagationLossModel"));
|
||||
lteHelper->SetAttribute ("PathlossModel",
|
||||
StringValue ("ns3::BuildingsPropagationLossModel"));
|
||||
nEnb = nFloors * nEnbPerFloor;
|
||||
}
|
||||
|
||||
@@ -86,12 +83,12 @@ main (int argc, char *argv[])
|
||||
NodeContainer enbNodes;
|
||||
vector < NodeContainer > ueNodes;
|
||||
|
||||
enbNodes.Create(nEnb);
|
||||
enbNodes.Create (nEnb);
|
||||
for (uint32_t i = 0; i < nEnb; i++)
|
||||
{
|
||||
NodeContainer ueNode;
|
||||
ueNode.Create(nUe);
|
||||
ueNodes.push_back(ueNode);
|
||||
ueNode.Create (nUe);
|
||||
ueNodes.push_back (ueNode);
|
||||
}
|
||||
|
||||
MobilityHelper mobility;
|
||||
@@ -101,50 +98,50 @@ main (int argc, char *argv[])
|
||||
|
||||
if (nFloors == 0)
|
||||
{
|
||||
mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
|
||||
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
|
||||
// Position of eNBs
|
||||
uint32_t plantedEnb = 0;
|
||||
for (uint32_t row = 0; row < nRooms; row++)
|
||||
{
|
||||
for (uint32_t column = 0; column < nRooms && plantedEnb < nEnbPerFloor; column++, plantedEnb++)
|
||||
{
|
||||
Vector v(roomLength * (column + 0.5), roomLength * (row + 0.5), nodeHeight);
|
||||
positionAlloc->Add(v);
|
||||
enbPosition.push_back(v);
|
||||
mobility.Install(ueNodes[plantedEnb]);
|
||||
Vector v (roomLength * (column + 0.5), roomLength * (row + 0.5), nodeHeight);
|
||||
positionAlloc->Add (v);
|
||||
enbPosition.push_back (v);
|
||||
mobility.Install (ueNodes[plantedEnb]);
|
||||
}
|
||||
}
|
||||
mobility.SetPositionAllocator(positionAlloc);
|
||||
mobility.SetPositionAllocator (positionAlloc);
|
||||
mobility.Install (enbNodes);
|
||||
|
||||
// Position of UEs attached to eNB
|
||||
for (uint32_t i = 0; i < nEnb; i++)
|
||||
{
|
||||
UniformVariable posX(enbPosition[i].x - roomLength * 0.5,
|
||||
enbPosition[i].x + roomLength * 0.5);
|
||||
UniformVariable posY(enbPosition[i].y - roomLength * 0.5,
|
||||
enbPosition[i].y + roomLength * 0.5);
|
||||
positionAlloc = CreateObject<ListPositionAllocator> ();
|
||||
for (uint32_t j = 0; j < nUe; j++)
|
||||
{
|
||||
positionAlloc->Add(Vector(posX.GetValue(), posY.GetValue(), nodeHeight));
|
||||
mobility.SetPositionAllocator(positionAlloc);
|
||||
}
|
||||
mobility.Install(ueNodes[i]);
|
||||
}
|
||||
for (uint32_t i = 0; i < nEnb; i++)
|
||||
{
|
||||
UniformVariable posX (enbPosition[i].x - roomLength * 0.5,
|
||||
enbPosition[i].x + roomLength * 0.5);
|
||||
UniformVariable posY (enbPosition[i].y - roomLength * 0.5,
|
||||
enbPosition[i].y + roomLength * 0.5);
|
||||
positionAlloc = CreateObject<ListPositionAllocator> ();
|
||||
for (uint32_t j = 0; j < nUe; j++)
|
||||
{
|
||||
positionAlloc->Add (Vector (posX.GetValue (), posY.GetValue (), nodeHeight));
|
||||
mobility.SetPositionAllocator (positionAlloc);
|
||||
}
|
||||
mobility.Install (ueNodes[i]);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
building = Create<Building> (0.0, nRooms * roomLength,
|
||||
0.0, nRooms * roomLength,
|
||||
0.0, nFloors* roomHeight);
|
||||
building->SetBuildingType(Building::Residential);
|
||||
building->SetExtWallsType(Building::ConcreteWithWindows);
|
||||
building->SetFloorsNumber(nFloors);
|
||||
building->SetNumberRoomX(nRooms);
|
||||
building->SetNumberRoomY(nRooms);
|
||||
mobility.SetMobilityModel("ns3::BuildingsMobilityModel");
|
||||
0.0, nRooms * roomLength,
|
||||
0.0, nFloors* roomHeight);
|
||||
building->SetBuildingType (Building::Residential);
|
||||
building->SetExtWallsType (Building::ConcreteWithWindows);
|
||||
building->SetFloorsNumber (nFloors);
|
||||
building->SetNumberRoomX (nRooms);
|
||||
building->SetNumberRoomY (nRooms);
|
||||
mobility.SetMobilityModel ("ns3::BuildingsMobilityModel");
|
||||
mobility.Install (enbNodes);
|
||||
uint32_t plantedEnb = 0;
|
||||
for (uint32_t floor = 0; floor < nFloors; floor++)
|
||||
@@ -157,17 +154,17 @@ main (int argc, char *argv[])
|
||||
Vector v (roomLength * (column + 0.5),
|
||||
roomLength * (row + 0.5),
|
||||
nodeHeight + roomHeight * floor);
|
||||
positionAlloc->Add(v);
|
||||
enbPosition.push_back(v);
|
||||
positionAlloc->Add (v);
|
||||
enbPosition.push_back (v);
|
||||
Ptr<BuildingsMobilityModel> mmEnb = enbNodes.Get (plantedEnb)->GetObject<BuildingsMobilityModel> ();
|
||||
mmEnb->SetPosition (v);
|
||||
mmEnb->SetIndoor (building);
|
||||
mmEnb->SetFloorNumber (floor);
|
||||
mmEnb->SetRoomNumberX (row);
|
||||
mmEnb->SetRoomNumberY (column);
|
||||
|
||||
|
||||
// Positioning UEs attached to eNB
|
||||
mobility.Install(ueNodes[plantedEnb]);
|
||||
mobility.Install (ueNodes[plantedEnb]);
|
||||
for (uint32_t ue = 0; ue < nUe; ue++)
|
||||
{
|
||||
Ptr<BuildingsMobilityModel> mmUe = ueNodes[plantedEnb].Get (ue)->GetObject<BuildingsMobilityModel> ();
|
||||
@@ -181,7 +178,7 @@ main (int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -191,27 +188,25 @@ main (int argc, char *argv[])
|
||||
// Create Devices and install them in the Nodes (eNB and UE)
|
||||
NetDeviceContainer enbDevs;
|
||||
vector < NetDeviceContainer > ueDevs;
|
||||
enbDevs = lteHelper->InstallEnbDevice(enbNodes);
|
||||
enbDevs = lteHelper->InstallEnbDevice (enbNodes);
|
||||
for (uint32_t i = 0; i < nEnb; i++)
|
||||
{
|
||||
NetDeviceContainer ueDev = lteHelper->InstallUeDevice(ueNodes[i]);
|
||||
ueDevs.push_back(ueDev);
|
||||
lteHelper->Attach(ueDev, enbDevs.Get(i));
|
||||
NetDeviceContainer ueDev = lteHelper->InstallUeDevice (ueNodes[i]);
|
||||
ueDevs.push_back (ueDev);
|
||||
lteHelper->Attach (ueDev, enbDevs.Get (i));
|
||||
enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
|
||||
EpsBearer bearer(q);
|
||||
lteHelper->ActivateEpsBearer(ueDev, bearer, EpcTft::Default ());
|
||||
EpsBearer bearer (q);
|
||||
lteHelper->ActivateEpsBearer (ueDev, bearer, EpcTft::Default ());
|
||||
}
|
||||
|
||||
Simulator::Stop(Seconds(simTime));
|
||||
lteHelper->SetTraceDirectory(traceDirectory);
|
||||
lteHelper->EnableRlcTraces();
|
||||
lteHelper->EnableMacTraces();
|
||||
Simulator::Stop (Seconds (simTime));
|
||||
lteHelper->EnableTraces ();
|
||||
|
||||
Simulator::Run();
|
||||
Simulator::Run ();
|
||||
|
||||
/*GtkConfigStore config;
|
||||
config.ConfigureAttributes ();*/
|
||||
|
||||
Simulator::Destroy();
|
||||
Simulator::Destroy ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ int main (int argc, char *argv[])
|
||||
cmd.Parse (argc, argv);
|
||||
|
||||
Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
|
||||
lteHelper->EnableTraces ();
|
||||
|
||||
// Uncomment to enable logging
|
||||
//lteHelper->EnableLogComponents ();
|
||||
|
||||
@@ -81,8 +81,8 @@ LteHelper::DoStart (void)
|
||||
else
|
||||
{
|
||||
NS_LOG_LOGIC (this << " using a PropagationLossModel in DL");
|
||||
Ptr<PropagationLossModel> dlPlm = m_downlinkPathlossModel->GetObject<PropagationLossModel> ();
|
||||
NS_ASSERT_MSG (dlPlm != 0, " " << m_downlinkPathlossModel << " is neither PropagationLossModel nor SpectrumPropagationLossModel");
|
||||
Ptr<PropagationLossModel> dlPlm = m_downlinkPathlossModel->GetObject<PropagationLossModel> ();
|
||||
NS_ASSERT_MSG (dlPlm != 0, " " << m_downlinkPathlossModel << " is neither PropagationLossModel nor SpectrumPropagationLossModel");
|
||||
m_downlinkChannel->AddPropagationLossModel (dlPlm);
|
||||
}
|
||||
|
||||
@@ -96,11 +96,11 @@ LteHelper::DoStart (void)
|
||||
else
|
||||
{
|
||||
NS_LOG_LOGIC (this << " using a PropagationLossModel in UL");
|
||||
Ptr<PropagationLossModel> ulPlm = m_uplinkPathlossModel->GetObject<PropagationLossModel> ();
|
||||
NS_ASSERT_MSG (ulPlm != 0, " " << m_uplinkPathlossModel << " is neither PropagationLossModel nor SpectrumPropagationLossModel");
|
||||
Ptr<PropagationLossModel> ulPlm = m_uplinkPathlossModel->GetObject<PropagationLossModel> ();
|
||||
NS_ASSERT_MSG (ulPlm != 0, " " << m_uplinkPathlossModel << " is neither PropagationLossModel nor SpectrumPropagationLossModel");
|
||||
m_uplinkChannel->AddPropagationLossModel (ulPlm);
|
||||
}
|
||||
|
||||
|
||||
//if (m_fadingModelFactory.GetTypeId ().GetName ().compare ( "ns3::TraceFadingLossModel") == 0)
|
||||
if (m_fadingModelType.compare ( "ns3::TraceFadingLossModel") == 0)
|
||||
{
|
||||
@@ -108,18 +108,12 @@ LteHelper::DoStart (void)
|
||||
m_downlinkChannel->AddSpectrumPropagationLossModel (m_fadingModule);
|
||||
m_uplinkChannel->AddSpectrumPropagationLossModel (m_fadingModule);
|
||||
}
|
||||
|
||||
m_macStats = CreateObject<MacStatsCalculator> ();
|
||||
m_macStats->SetDlOutputFilename("DlMacStats.csv");
|
||||
m_macStats->SetUlOutputFilename("UlMacStats.csv");
|
||||
m_rlcStats = CreateObject<RadioBearerStatsCalculator> ();
|
||||
m_rlcStats->SetDlOutputFilename("DlRlcStats.csv");
|
||||
m_rlcStats->SetUlOutputFilename("UlRlcStats.csv");
|
||||
m_pdcpStats = CreateObject<RadioBearerStatsCalculator> ();
|
||||
m_pdcpStats->SetDlOutputFilename("DlPdcpStats.csv");
|
||||
m_pdcpStats->SetUlOutputFilename("UlPdcpStats.csv");
|
||||
m_rlcStats = CreateObject<RadioBearerStatsCalculator> ("RLC");
|
||||
m_pdcpStats = CreateObject<RadioBearerStatsCalculator> ("PDCP");
|
||||
|
||||
Object::DoStart ();
|
||||
|
||||
}
|
||||
|
||||
LteHelper::~LteHelper (void)
|
||||
@@ -130,7 +124,7 @@ LteHelper::~LteHelper (void)
|
||||
TypeId LteHelper::GetTypeId (void)
|
||||
{
|
||||
static TypeId
|
||||
tid =
|
||||
tid =
|
||||
TypeId ("ns3::LteHelper")
|
||||
.SetParent<Object> ()
|
||||
.AddConstructor<LteHelper> ()
|
||||
@@ -144,7 +138,7 @@ TypeId LteHelper::GetTypeId (void)
|
||||
StringValue ("ns3::FriisPropagationLossModel"),
|
||||
MakeStringAccessor (&LteHelper::SetPathlossModelType),
|
||||
MakeStringChecker ())
|
||||
.AddAttribute ("FadingModel",
|
||||
.AddAttribute ("FadingModel",
|
||||
"The type of fading model to be used",
|
||||
StringValue (""), // fake module -> no fading
|
||||
MakeStringAccessor (&LteHelper::SetFadingModel),
|
||||
@@ -182,7 +176,7 @@ LteHelper::SetEpcHelper (Ptr<EpcHelper> h)
|
||||
m_epsBearerToRlcMapping = RLC_UM_ALWAYS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LteHelper::SetSchedulerType (std::string type)
|
||||
{
|
||||
@@ -312,7 +306,7 @@ LteHelper::InstallSingleEnbDevice (Ptr<Node> n)
|
||||
|
||||
Ptr<LteCqiSinrChunkProcessor> p = Create<LteCqiSinrChunkProcessor> (phy->GetObject<LtePhy> ());
|
||||
ulPhy->AddSinrChunkProcessor (p);
|
||||
|
||||
|
||||
Ptr<LtePemSinrChunkProcessor> pPem = Create<LtePemSinrChunkProcessor> (ulPhy);
|
||||
ulPhy->AddSinrChunkProcessor (pPem);
|
||||
|
||||
@@ -355,7 +349,7 @@ LteHelper::InstallSingleEnbDevice (Ptr<Node> n)
|
||||
dev->SetAttribute ("LteEnbMac", PointerValue (mac));
|
||||
dev->SetAttribute ("FfMacScheduler", PointerValue (sched));
|
||||
dev->SetAttribute ("LteEnbRrc", PointerValue (rrc));
|
||||
|
||||
|
||||
phy->SetDevice (dev);
|
||||
dlPhy->SetDevice (dev);
|
||||
ulPhy->SetDevice (dev);
|
||||
@@ -363,7 +357,7 @@ LteHelper::InstallSingleEnbDevice (Ptr<Node> n)
|
||||
n->AddDevice (dev);
|
||||
ulPhy->SetGenericPhyRxEndOkCallback (MakeCallback (&LteEnbPhy::PhyPduReceived, phy));
|
||||
rrc->SetForwardUpCallback (MakeCallback (&LteEnbNetDevice::Receive, dev));
|
||||
|
||||
|
||||
NS_LOG_LOGIC ("set the propagation model frequencies");
|
||||
if (m_downlinkPathlossModel->GetObject<BuildingsPropagationLossModel> () != 0)
|
||||
{
|
||||
@@ -381,12 +375,12 @@ LteHelper::InstallSingleEnbDevice (Ptr<Node> n)
|
||||
NS_LOG_LOGIC ("UL freq: " << ulFreq);
|
||||
m_uplinkPathlossModel->SetAttribute ("Frequency", DoubleValue (ulFreq));
|
||||
}
|
||||
|
||||
|
||||
dev->Start ();
|
||||
|
||||
if (m_epcHelper != 0)
|
||||
{
|
||||
NS_LOG_INFO ("adding this eNB to the EPC");
|
||||
NS_LOG_INFO ("adding this eNB to the EPC");
|
||||
m_epcHelper->AddEnb (n, dev);
|
||||
}
|
||||
|
||||
@@ -404,7 +398,7 @@ LteHelper::InstallSingleUeDevice (Ptr<Node> n)
|
||||
|
||||
Ptr<LteCqiSinrChunkProcessor> p = Create<LteCqiSinrChunkProcessor> (phy->GetObject<LtePhy> ());
|
||||
dlPhy->AddSinrChunkProcessor (p);
|
||||
|
||||
|
||||
Ptr<LtePemSinrChunkProcessor> pPem = Create<LtePemSinrChunkProcessor> (dlPhy);
|
||||
dlPhy->AddSinrChunkProcessor (pPem);
|
||||
|
||||
@@ -473,18 +467,18 @@ LteHelper::Attach (Ptr<NetDevice> ueDevice, Ptr<NetDevice> enbDevice)
|
||||
Ptr<LteEnbPhy> enbPhy = enbDevice->GetObject<LteEnbNetDevice> ()->GetPhy ();
|
||||
Ptr<LteUePhy> uePhy = ueDevice->GetObject<LteUeNetDevice> ()->GetPhy ();
|
||||
enbPhy->AddUePhy (rnti, uePhy);
|
||||
|
||||
|
||||
//if (m_fadingModelFactory.GetTypeId ().GetName ().compare ( "ns3::TraceFadingLossModel") == 0)
|
||||
if (m_fadingModelType.compare ( "ns3::TraceFadingLossModel") == 0)
|
||||
{
|
||||
Ptr<MobilityModel> mm_enb_dl = enbPhy->GetDownlinkSpectrumPhy ()->GetMobility ()->GetObject<MobilityModel> ();
|
||||
Ptr<MobilityModel> mm_ue_ul = uePhy->GetUplinkSpectrumPhy ()->GetMobility ()->GetObject<MobilityModel> ();
|
||||
Ptr<MobilityModel> mm_enb_ul = enbPhy->GetUplinkSpectrumPhy ()->GetMobility ()->GetObject<MobilityModel> ();
|
||||
Ptr<MobilityModel> mm_ue_dl = uePhy->GetDownlinkSpectrumPhy ()->GetMobility ()->GetObject<MobilityModel> ();
|
||||
Ptr<MobilityModel> mm_enb_dl = enbPhy->GetDownlinkSpectrumPhy ()->GetMobility ()->GetObject<MobilityModel> ();
|
||||
Ptr<MobilityModel> mm_ue_ul = uePhy->GetUplinkSpectrumPhy ()->GetMobility ()->GetObject<MobilityModel> ();
|
||||
Ptr<MobilityModel> mm_enb_ul = enbPhy->GetUplinkSpectrumPhy ()->GetMobility ()->GetObject<MobilityModel> ();
|
||||
Ptr<MobilityModel> mm_ue_dl = uePhy->GetDownlinkSpectrumPhy ()->GetMobility ()->GetObject<MobilityModel> ();
|
||||
|
||||
m_fadingModule->CreateFadingChannelRealization (mm_enb_dl, mm_ue_dl); //downlink eNB -> UE
|
||||
m_fadingModule->CreateFadingChannelRealization (mm_ue_ul, mm_enb_ul); //uplink UE -> eNB
|
||||
|
||||
m_fadingModule->CreateFadingChannelRealization (mm_enb_dl, mm_ue_dl); //downlink eNB -> UE
|
||||
m_fadingModule->CreateFadingChannelRealization (mm_ue_ul, mm_enb_ul); //uplink UE -> eNB
|
||||
|
||||
}
|
||||
|
||||
// WILD HACK - should be done through PHY SAP, probably passing by RRC
|
||||
@@ -523,9 +517,9 @@ LteHelper::ActivateEpsBearer (Ptr<NetDevice> ueDevice, EpsBearer bearer, Ptr<Epc
|
||||
|
||||
if (m_epcHelper != 0)
|
||||
{
|
||||
NS_LOG_INFO (" setting up S1 Bearer");
|
||||
NS_LOG_INFO (" setting up S1 Bearer");
|
||||
m_epcHelper->ActivateEpsBearer (ueDevice, enbDevice, tft, rnti, lcid);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -604,7 +598,7 @@ LteHelper::EnableLogComponents (void)
|
||||
{
|
||||
LogComponentEnable (propModel, LOG_LEVEL_ALL);
|
||||
}
|
||||
|
||||
|
||||
if (m_fadingModelType.compare ("ns3::TraceFadingLossModel") == 0)
|
||||
{
|
||||
const char* fadingModel = m_fadingModelType.erase (0,5).c_str ();
|
||||
@@ -740,7 +734,7 @@ DlTxPduCallback (Ptr<RadioBearerStatsCalculator> rlcStats, std::string path,
|
||||
{
|
||||
NS_LOG_FUNCTION (rlcStats << path << rnti << (uint16_t)lcid << packetSize);
|
||||
uint64_t imsi = 0;
|
||||
if (rlcStats->ExistsImsiPath(path) == true)
|
||||
if (rlcStats->ExistsImsiPath (path) == true)
|
||||
{
|
||||
imsi = rlcStats->GetImsiPath (path);
|
||||
}
|
||||
@@ -750,7 +744,7 @@ DlTxPduCallback (Ptr<RadioBearerStatsCalculator> rlcStats, std::string path,
|
||||
rlcStats->SetImsiPath (path, imsi);
|
||||
}
|
||||
uint16_t cellId = 0;
|
||||
if (rlcStats->ExistsCellIdPath(path) == true)
|
||||
if (rlcStats->ExistsCellIdPath (path) == true)
|
||||
{
|
||||
cellId = rlcStats->GetCellIdPath (path);
|
||||
}
|
||||
@@ -768,7 +762,7 @@ DlRxPduCallback (Ptr<RadioBearerStatsCalculator> rlcStats, std::string path,
|
||||
{
|
||||
NS_LOG_FUNCTION (rlcStats << path << rnti << (uint16_t)lcid << packetSize << delay);
|
||||
uint64_t imsi = 0;
|
||||
if (rlcStats->ExistsImsiPath(path) == true)
|
||||
if (rlcStats->ExistsImsiPath (path) == true)
|
||||
{
|
||||
imsi = rlcStats->GetImsiPath (path);
|
||||
}
|
||||
@@ -796,15 +790,15 @@ UlTxPduCallback (Ptr<RadioBearerStatsCalculator> rlcStats, std::string path,
|
||||
{
|
||||
NS_LOG_FUNCTION (rlcStats << path << rnti << (uint16_t)lcid << packetSize);
|
||||
uint64_t imsi = 0;
|
||||
if (rlcStats->ExistsImsiPath(path) == true)
|
||||
{
|
||||
imsi = rlcStats->GetImsiPath (path);
|
||||
}
|
||||
else
|
||||
{
|
||||
imsi = FindImsiFromUeRlcPath (path);
|
||||
rlcStats->SetImsiPath (path, imsi);
|
||||
}
|
||||
if (rlcStats->ExistsImsiPath (path) == true)
|
||||
{
|
||||
imsi = rlcStats->GetImsiPath (path);
|
||||
}
|
||||
else
|
||||
{
|
||||
imsi = FindImsiFromUeRlcPath (path);
|
||||
rlcStats->SetImsiPath (path, imsi);
|
||||
}
|
||||
rlcStats->UlTxPdu (imsi, rnti, lcid, packetSize);
|
||||
}
|
||||
|
||||
@@ -814,17 +808,17 @@ UlRxPduCallback (Ptr<RadioBearerStatsCalculator> rlcStats, std::string path,
|
||||
{
|
||||
NS_LOG_FUNCTION (rlcStats << path << rnti << (uint16_t)lcid << packetSize << delay);
|
||||
uint64_t imsi = 0;
|
||||
if (rlcStats->ExistsImsiPath(path) == true)
|
||||
if (rlcStats->ExistsImsiPath (path) == true)
|
||||
{
|
||||
imsi = rlcStats->GetImsiPath (path);
|
||||
}
|
||||
else
|
||||
{
|
||||
imsi = FindImsiFromEnbRlcPath(path);
|
||||
imsi = FindImsiFromEnbRlcPath (path);
|
||||
rlcStats->SetImsiPath (path, imsi);
|
||||
}
|
||||
uint16_t cellId = 0;
|
||||
if (rlcStats->ExistsCellIdPath(path) == true)
|
||||
if (rlcStats->ExistsCellIdPath (path) == true)
|
||||
{
|
||||
cellId = rlcStats->GetCellIdPath (path);
|
||||
}
|
||||
@@ -847,7 +841,7 @@ DlSchedulingCallback (Ptr<MacStatsCalculator> macStats,
|
||||
uint64_t imsi = 0;
|
||||
std::ostringstream pathAndRnti;
|
||||
pathAndRnti << path << "/" << rnti;
|
||||
if (macStats->ExistsImsiPath(pathAndRnti.str ()) == true)
|
||||
if (macStats->ExistsImsiPath (pathAndRnti.str ()) == true)
|
||||
{
|
||||
imsi = macStats->GetImsiPath (pathAndRnti.str ());
|
||||
}
|
||||
@@ -858,7 +852,7 @@ DlSchedulingCallback (Ptr<MacStatsCalculator> macStats,
|
||||
}
|
||||
|
||||
uint16_t cellId = 0;
|
||||
if (macStats->ExistsCellIdPath(pathAndRnti.str ()) == true)
|
||||
if (macStats->ExistsCellIdPath (pathAndRnti.str ()) == true)
|
||||
{
|
||||
cellId = macStats->GetCellIdPath (pathAndRnti.str ());
|
||||
}
|
||||
@@ -905,7 +899,7 @@ UlSchedulingCallback (Ptr<MacStatsCalculator> macStats, std::string path,
|
||||
uint64_t imsi = 0;
|
||||
std::ostringstream pathAndRnti;
|
||||
pathAndRnti << path << "/" << rnti;
|
||||
if (macStats->ExistsImsiPath(pathAndRnti.str ()) == true)
|
||||
if (macStats->ExistsImsiPath (pathAndRnti.str ()) == true)
|
||||
{
|
||||
imsi = macStats->GetImsiPath (pathAndRnti.str ());
|
||||
}
|
||||
@@ -915,7 +909,7 @@ UlSchedulingCallback (Ptr<MacStatsCalculator> macStats, std::string path,
|
||||
macStats->SetImsiPath (pathAndRnti.str (), imsi);
|
||||
}
|
||||
uint16_t cellId = 0;
|
||||
if (macStats->ExistsCellIdPath(pathAndRnti.str ()) == true)
|
||||
if (macStats->ExistsCellIdPath (pathAndRnti.str ()) == true)
|
||||
{
|
||||
cellId = macStats->GetCellIdPath (pathAndRnti.str ());
|
||||
}
|
||||
@@ -935,15 +929,6 @@ LteHelper::EnableUlMacTraces (void)
|
||||
MakeBoundCallback (&UlSchedulingCallback, m_macStats));
|
||||
}
|
||||
|
||||
void
|
||||
LteHelper::SetTraceDirectory (std::string path)
|
||||
{
|
||||
m_macStats->SetDlOutputFilename(path + m_macStats->GetDlOutputFilename());
|
||||
m_macStats->SetUlOutputFilename(path + m_macStats->GetUlOutputFilename());
|
||||
m_rlcStats->SetDlOutputFilename(path + m_rlcStats->GetDlOutputFilename());
|
||||
m_rlcStats->SetUlOutputFilename(path + m_rlcStats->GetUlOutputFilename());
|
||||
}
|
||||
|
||||
Ptr<RadioBearerStatsCalculator>
|
||||
LteHelper::GetRlcStats (void)
|
||||
{
|
||||
|
||||
@@ -251,11 +251,6 @@ public:
|
||||
*/
|
||||
void EnableUlRlcTraces (void);
|
||||
|
||||
/**
|
||||
* Set the output directory for the MAC/RLC trace
|
||||
*/
|
||||
void SetTraceDirectory (std::string path);
|
||||
|
||||
/**
|
||||
*
|
||||
* \return the RLC stats calculator object
|
||||
@@ -293,7 +288,7 @@ private:
|
||||
|
||||
Ptr<SpectrumChannel> m_downlinkChannel;
|
||||
Ptr<SpectrumChannel> m_uplinkChannel;
|
||||
|
||||
|
||||
Ptr<Object> m_downlinkPathlossModel;
|
||||
Ptr<Object> m_uplinkPathlossModel;
|
||||
|
||||
@@ -308,9 +303,9 @@ private:
|
||||
|
||||
std::string m_fadingModelType;
|
||||
ObjectFactory m_fadingModelFactory;
|
||||
|
||||
|
||||
Ptr<TraceFadingLossModel> m_fadingModule;
|
||||
|
||||
|
||||
Ptr<MacStatsCalculator> m_macStats;
|
||||
Ptr<RadioBearerStatsCalculator> m_rlcStats;
|
||||
Ptr<RadioBearerStatsCalculator> m_pdcpStats;
|
||||
@@ -321,7 +316,7 @@ private:
|
||||
PER_BASED = 4} m_epsBearerToRlcMapping;
|
||||
|
||||
Ptr<EpcHelper> m_epcHelper;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ LteStatsCalculator::LteStatsCalculator ()
|
||||
|
||||
LteStatsCalculator::~LteStatsCalculator ()
|
||||
{
|
||||
// TODO Auto-generated destructor stub
|
||||
// Nothing to do here
|
||||
}
|
||||
|
||||
|
||||
@@ -32,16 +32,6 @@ LteStatsCalculator::GetTypeId (void)
|
||||
static TypeId tid = TypeId ("ns3::LteStatsCalculator")
|
||||
.SetParent<Object> ()
|
||||
.AddConstructor<LteStatsCalculator> ()
|
||||
.AddAttribute ("DlOutputFilename",
|
||||
"Name of the file where the downlink results will be saved.",
|
||||
StringValue ("DlStats.csv"),
|
||||
MakeStringAccessor (&LteStatsCalculator::SetDlOutputFilename),
|
||||
MakeStringChecker ())
|
||||
.AddAttribute ("UlOutputFilename",
|
||||
"Name of the file where the uplink results will be saved.",
|
||||
StringValue ("UlStats.csv"),
|
||||
MakeStringAccessor (&LteStatsCalculator::SetUlOutputFilename),
|
||||
MakeStringChecker ())
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
@@ -75,7 +65,7 @@ LteStatsCalculator::GetDlOutputFilename (void)
|
||||
bool
|
||||
LteStatsCalculator::ExistsImsiPath (std::string path)
|
||||
{
|
||||
if (m_pathImsiMap.find(path) == m_pathImsiMap.end () )
|
||||
if (m_pathImsiMap.find (path) == m_pathImsiMap.end () )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -88,20 +78,20 @@ LteStatsCalculator::ExistsImsiPath (std::string path)
|
||||
void
|
||||
LteStatsCalculator::SetImsiPath (std::string path, uint64_t imsi)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << path << imsi);
|
||||
NS_LOG_FUNCTION (this << path << imsi);
|
||||
m_pathImsiMap[path] = imsi;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
LteStatsCalculator::GetImsiPath (std::string path)
|
||||
{
|
||||
return m_pathImsiMap.find(path)->second;
|
||||
return m_pathImsiMap.find (path)->second;
|
||||
}
|
||||
|
||||
bool
|
||||
LteStatsCalculator::ExistsCellIdPath (std::string path)
|
||||
{
|
||||
if (m_pathCellIdMap.find(path) == m_pathCellIdMap.end () )
|
||||
if (m_pathCellIdMap.find (path) == m_pathCellIdMap.end () )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -114,14 +104,14 @@ LteStatsCalculator::ExistsCellIdPath (std::string path)
|
||||
void
|
||||
LteStatsCalculator::SetCellIdPath (std::string path, uint16_t cellId)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << path << cellId);
|
||||
NS_LOG_FUNCTION (this << path << cellId);
|
||||
m_pathCellIdMap[path] = cellId;
|
||||
}
|
||||
|
||||
uint16_t
|
||||
LteStatsCalculator::GetCellIdPath (std::string path)
|
||||
{
|
||||
return m_pathCellIdMap.find(path)->second;
|
||||
return m_pathCellIdMap.find (path)->second;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
void SetDlOutputFilename (std::string outputFilename);
|
||||
|
||||
/**
|
||||
* Get the name of the file where the uplink statistics will be stored.
|
||||
* Get the name of the file where the downlink statistics will be stored.
|
||||
*/
|
||||
std::string GetDlOutputFilename (void);
|
||||
|
||||
@@ -95,6 +95,7 @@ private:
|
||||
|
||||
std::map<std::string, uint64_t> m_pathImsiMap;
|
||||
std::map<std::string, uint16_t> m_pathCellIdMap;
|
||||
|
||||
std::string m_dlOutputFilename;
|
||||
std::string m_ulOutputFilename;
|
||||
};
|
||||
|
||||
@@ -48,6 +48,16 @@ MacStatsCalculator::GetTypeId (void)
|
||||
static TypeId tid = TypeId ("ns3::MacStatsCalculator")
|
||||
.SetParent<LteStatsCalculator> ()
|
||||
.AddConstructor<MacStatsCalculator> ()
|
||||
.AddAttribute ("DlOutputFilename",
|
||||
"Name of the file where the downlink results will be saved.",
|
||||
StringValue ("DlMacStats.txt"),
|
||||
MakeStringAccessor (&LteStatsCalculator::SetDlOutputFilename),
|
||||
MakeStringChecker ())
|
||||
.AddAttribute ("UlOutputFilename",
|
||||
"Name of the file where the uplink results will be saved.",
|
||||
StringValue ("UlMacStats.txt"),
|
||||
MakeStringAccessor (&LteStatsCalculator::SetUlOutputFilename),
|
||||
MakeStringChecker ())
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,6 @@ public:
|
||||
void UlScheduling (uint16_t cellId, uint64_t imsi,uint32_t frameNo, uint32_t subframeNo,
|
||||
uint16_t rnti, uint8_t mcs, uint16_t sizeTb);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
bool m_dlFirstWrite;
|
||||
|
||||
@@ -33,10 +33,16 @@ NS_LOG_COMPONENT_DEFINE ("RadioBearerStatsCalculator");
|
||||
NS_OBJECT_ENSURE_REGISTERED ( RadioBearerStatsCalculator);
|
||||
|
||||
RadioBearerStatsCalculator::RadioBearerStatsCalculator () :
|
||||
m_firstWrite (true), m_bearerType ("RLC")
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
RadioBearerStatsCalculator::RadioBearerStatsCalculator (std::string bearerType) :
|
||||
m_firstWrite (true)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
|
||||
m_bearerType = bearerType;
|
||||
}
|
||||
|
||||
RadioBearerStatsCalculator::~RadioBearerStatsCalculator ()
|
||||
@@ -49,11 +55,31 @@ TypeId
|
||||
RadioBearerStatsCalculator::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid =
|
||||
TypeId ("ns3::RadioBearerStatsCalculator").SetParent<Object> ().AddConstructor<RadioBearerStatsCalculator> ().AddAttribute (
|
||||
"StartTime", "Start time of the on going epoch.", TimeValue (Seconds (0.)),
|
||||
MakeTimeAccessor (&RadioBearerStatsCalculator::m_startTime), MakeTimeChecker ()).AddAttribute ("EpochDuration",
|
||||
"Epoch duration.", TimeValue (Seconds (0.25)), MakeTimeAccessor (&RadioBearerStatsCalculator::m_epochDuration),
|
||||
MakeTimeChecker ());
|
||||
TypeId ("ns3::RadioBearerStatsCalculator")
|
||||
.SetParent<LteStatsCalculator> ().AddConstructor<RadioBearerStatsCalculator> ()
|
||||
.AddAttribute ("StartTime", "Start time of the on going epoch.", TimeValue (Seconds (0.)),MakeTimeAccessor (&RadioBearerStatsCalculator::m_startTime), MakeTimeChecker ())
|
||||
.AddAttribute ("EpochDuration", "Epoch duration.", TimeValue (Seconds (0.25)), MakeTimeAccessor (&RadioBearerStatsCalculator::m_epochDuration), MakeTimeChecker ())
|
||||
.AddAttribute ("DlRlcOutputFilename",
|
||||
"Name of the file where the downlink results will be saved.",
|
||||
StringValue ("DlRlcStats.txt"),
|
||||
MakeStringAccessor (&LteStatsCalculator::SetDlOutputFilename),
|
||||
MakeStringChecker ())
|
||||
.AddAttribute ("UlRlcOutputFilename",
|
||||
"Name of the file where the uplink results will be saved.",
|
||||
StringValue ("UlRlcStats.txt"),
|
||||
MakeStringAccessor (&LteStatsCalculator::SetUlOutputFilename),
|
||||
MakeStringChecker ())
|
||||
.AddAttribute ("DlPdcpOutputFilename",
|
||||
"Name of the file where the downlink results will be saved.",
|
||||
StringValue ("DlPdcpStats.txt"),
|
||||
MakeStringAccessor (&RadioBearerStatsCalculator::SetDlPdcpOutputFilename),
|
||||
MakeStringChecker ())
|
||||
.AddAttribute ("UlPdcpOutputFilename",
|
||||
"Name of the file where the uplink results will be saved.",
|
||||
StringValue ("UlPdcpStats.txt"),
|
||||
MakeStringAccessor (&RadioBearerStatsCalculator::SetUlPdcpOutputFilename),
|
||||
MakeStringChecker ())
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
@@ -517,4 +543,53 @@ RadioBearerStatsCalculator::GetDlPduSizeStats (uint64_t imsi, uint8_t lcid)
|
||||
return stats;
|
||||
}
|
||||
|
||||
std::string
|
||||
RadioBearerStatsCalculator::GetUlOutputFilename (void)
|
||||
{
|
||||
if (m_bearerType == "RLC")
|
||||
{
|
||||
return LteStatsCalculator::GetUlOutputFilename ();
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetUlPdcpOutputFilename ();
|
||||
}
|
||||
}
|
||||
|
||||
std::string
|
||||
RadioBearerStatsCalculator::GetDlOutputFilename (void)
|
||||
{
|
||||
if (m_bearerType == "RLC")
|
||||
{
|
||||
return LteStatsCalculator::GetDlOutputFilename ();
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetDlPdcpOutputFilename ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RadioBearerStatsCalculator::SetUlPdcpOutputFilename (std::string outputFilename)
|
||||
{
|
||||
m_ulPdcpOutputFilename = outputFilename;
|
||||
}
|
||||
|
||||
std::string
|
||||
RadioBearerStatsCalculator::GetUlPdcpOutputFilename (void)
|
||||
{
|
||||
return m_ulPdcpOutputFilename;
|
||||
}
|
||||
void
|
||||
RadioBearerStatsCalculator::SetDlPdcpOutputFilename (std::string outputFilename)
|
||||
{
|
||||
m_dlPdcpOutputFilename = outputFilename;
|
||||
}
|
||||
|
||||
std::string
|
||||
RadioBearerStatsCalculator::GetDlPdcpOutputFilename (void)
|
||||
{
|
||||
return m_dlPdcpOutputFilename;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -60,6 +60,11 @@ public:
|
||||
*/
|
||||
RadioBearerStatsCalculator ();
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*/
|
||||
RadioBearerStatsCalculator (std::string bearerType);
|
||||
|
||||
/**
|
||||
* Class destructor
|
||||
*/
|
||||
@@ -72,6 +77,40 @@ public:
|
||||
static TypeId
|
||||
GetTypeId (void);
|
||||
|
||||
/**
|
||||
* Get the name of the file where the uplink statistics will be stored.
|
||||
*/
|
||||
std::string GetUlOutputFilename (void);
|
||||
|
||||
/**
|
||||
* Get the name of the file where the downlink statistics will be stored.
|
||||
*/
|
||||
std::string GetDlOutputFilename (void);
|
||||
|
||||
/**
|
||||
* Set the name of the file where the uplink PDCP statistics will be stored.
|
||||
*
|
||||
* \param outputFilename string with the name of the file
|
||||
*/
|
||||
void SetUlPdcpOutputFilename (std::string outputFilename);
|
||||
|
||||
/**
|
||||
* Get the name of the file where the uplink PDCP statistics will be stored.
|
||||
*/
|
||||
std::string GetUlPdcpOutputFilename (void);
|
||||
|
||||
/**
|
||||
* Set the name of the file where the downlink PDCP statistics will be stored.
|
||||
*
|
||||
* @param outputFilename string with the name of the file
|
||||
*/
|
||||
void SetDlPdcpOutputFilename (std::string outputFilename);
|
||||
|
||||
/**
|
||||
* Get the name of the file where the downlink PDCP statistics will be stored.
|
||||
*/
|
||||
std::string GetDlPdcpOutputFilename (void);
|
||||
|
||||
/**
|
||||
* Notifies the stats calculator that an uplink transmission has occurred.
|
||||
* @param imsi IMSI of the UE who transmitted the PDU
|
||||
@@ -304,6 +343,10 @@ private:
|
||||
Time m_epochDuration;
|
||||
|
||||
bool m_firstWrite;
|
||||
std::string m_bearerType;
|
||||
|
||||
std::string m_dlPdcpOutputFilename;
|
||||
std::string m_ulPdcpOutputFilename;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user