Browse Source

Added MAC traces and sinks for UL and DL.

Modified lena-rlc-calculator to extract MAC traces and RLC traces
ndnSIM-v1
jnin 14 years ago
parent
commit
1a9c95db31
  1. 9
      src/lte/examples/lena-rlc-calculator.cc
  2. 41
      src/lte/helper/lena-helper.cc
  3. 19
      src/lte/helper/lena-helper.h
  4. 52
      src/lte/model/lte-enb-mac.cc
  5. 16
      src/lte/model/lte-enb-mac.h
  6. 2
      src/lte/wscript

9
src/lte/examples/lena-rlc-calculator.cc

@ -23,12 +23,16 @@
#include "ns3/network-module.h"
#include "ns3/mobility-module.h"
#include "ns3/lte-module.h"
#include "ns3/mac-stats-calculator.h"
#include "ns3/rlc-stats-calculator.h"
#include "ns3/config-store.h"
//#include "ns3/gtk-config-store.h"
using namespace ns3;
void UlTxPduCallback(Ptr<RlcStatsCalculator> rlcStats, std::string path,
uint16_t rnti, uint8_t lcid, uint32_t packetSize)
{
@ -53,6 +57,7 @@ void DlRxPduCallback(Ptr<RlcStatsCalculator> rlcStats, std::string path,
rlcStats->DlRxPdu(rnti, lcid, packetSize, delay);
}
int main (int argc, char *argv[])
{
// Command line arguments
@ -68,7 +73,7 @@ int main (int argc, char *argv[])
Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
// Enable LTE log components
//lena->EnableLogComponents ();
lena->EnableLogComponents ();
// Create Nodes: eNodeB and UE
NodeContainer enbNodes;
@ -111,6 +116,8 @@ int main (int argc, char *argv[])
Config::Connect ("/NodeList/0/DeviceList/0/LteEnbRrc/UeMap/*/RadioBearerMap/*/LteRlc/RxPDU",
MakeBoundCallback(&UlRxPduCallback, rlcStats));
lena->EnableMacTraces ();
Simulator::Run ();
// Uncomment to show available paths

41
src/lte/helper/lena-helper.cc

@ -50,7 +50,7 @@ NS_OBJECT_ENSURE_REGISTERED (LenaHelper);
LenaHelper::LenaHelper (void)
{
NS_LOG_FUNCTION (this);
NS_LOG_FUNCTION (this);
}
void
@ -62,7 +62,8 @@ LenaHelper::DoStart (void)
Ptr<SpectrumPropagationLossModel> dlPropagationModel = m_propagationModelFactory.Create<SpectrumPropagationLossModel> ();
Ptr<SpectrumPropagationLossModel> ulPropagationModel = m_propagationModelFactory.Create<SpectrumPropagationLossModel> ();
m_downlinkChannel->AddSpectrumPropagationLossModel (dlPropagationModel);
m_uplinkChannel->AddSpectrumPropagationLossModel (ulPropagationModel);
m_uplinkChannel->AddSpectrumPropagationLossModel (ulPropagationModel);
macStats = CreateObject<MacStatsCalculator> ();
Object::DoStart ();
}
@ -364,6 +365,42 @@ LenaHelper::EnableLogComponents (void)
LogComponentEnable ("RlcStatsCalculator", LOG_LEVEL_ALL);
}
void
LenaHelper::EnableMacTraces (void)
{
EnableDlMacTraces ();
EnableUlMacTraces ();
}
void
DlSchedulingCallback (Ptr<MacStatsCalculator> mac, std::string path,
uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
{
mac->DlScheduling(frameNo, subframeNo, rnti, mcsTb1, sizeTb1, mcsTb2, sizeTb2);
}
void
LenaHelper::EnableDlMacTraces (void)
{
Config::Connect("/NodeList/0/DeviceList/0/LteEnbMac/DlScheduling",
MakeBoundCallback(&DlSchedulingCallback, macStats));
}
void
UlSchedulingCallback (Ptr<MacStatsCalculator> mac, std::string path,
uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
uint8_t mcs, uint16_t size)
{
mac->UlScheduling(frameNo, subframeNo, rnti, mcs, size);
}
void
LenaHelper::EnableUlMacTraces (void)
{
Config::Connect("/NodeList/0/DeviceList/0/LteEnbMac/UlScheduling",
MakeBoundCallback(&UlSchedulingCallback, macStats));
}
} // namespace ns3

19
src/lte/helper/lena-helper.h

@ -30,6 +30,7 @@
#include <ns3/node.h>
#include <ns3/node-container.h>
#include <ns3/eps-bearer.h>
#include <ns3/mac-stats-calculator.h>
namespace ns3 {
@ -150,6 +151,21 @@ public:
*/
void EnableLogComponents (void);
/**
* Enable trace sinks for MAC layer
*/
void EnableMacTraces (void);
/**
* Enable trace sinks for DL MAC layer
*/
void EnableDlMacTraces (void);
/**
* Enable trace sinks for UL MAC layer
*/
void EnableUlMacTraces (void);
protected:
@ -166,6 +182,9 @@ private:
ObjectFactory m_schedulerFactory;
ObjectFactory m_propagationModelFactory;
Ptr<MacStatsCalculator> macStats;
};

52
src/lte/model/lte-enb-mac.cc

@ -34,6 +34,7 @@
#include <ns3/lte-ue-phy.h>
NS_LOG_COMPONENT_DEFINE ("LteEnbMac");
namespace ns3 {
@ -297,7 +298,15 @@ LteEnbMac::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::LteEnbMac")
.SetParent<Object> ()
.AddConstructor<LteEnbMac> ();
.AddConstructor<LteEnbMac> ()
.AddTraceSource ("DlScheduling",
"Information regarding DL scheduling.",
MakeTraceSourceAccessor (&LteEnbMac::m_dlScheduling))
.AddTraceSource ("UlScheduling",
"Information regarding UL scheduling.",
MakeTraceSourceAccessor (&LteEnbMac::m_ulScheduling))
;
return tid;
}
@ -400,6 +409,10 @@ LteEnbMac::DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo)
{
NS_LOG_FUNCTION (this);
// Store current frame / subframe number
m_frameNo = frameNo;
m_subframeNo = subframeNo;
// --- DOWNLINK ---
// Send Dl-CQI info to the scheduler
@ -722,6 +735,34 @@ LteEnbMac::DoSchedDlConfigInd (FfMacSchedSapUser::SchedDlConfigIndParameters ind
}
}
// Fire the trace with the DL information
for ( uint32_t i = 0; i < ind.m_buildDataList.size (); i++ )
{
// Only one TB used
if (ind.m_buildDataList.at (i).m_dci.m_tbsSize.size () == 1)
{
m_dlScheduling (m_frameNo, m_subframeNo, ind.m_buildDataList.at (i).m_dci.m_rnti,
ind.m_buildDataList.at (i).m_dci.m_mcs.at (0),
ind.m_buildDataList.at (i).m_dci.m_tbsSize.at (0),
0, 0
);
}
// Two TBs used
else if (ind.m_buildDataList.at (i).m_dci.m_tbsSize.size () == 2)
{
m_dlScheduling (m_frameNo, m_subframeNo, ind.m_buildDataList.at (i).m_dci.m_rnti,
ind.m_buildDataList.at (i).m_dci.m_mcs.at (0),
ind.m_buildDataList.at (i).m_dci.m_tbsSize.at (0),
ind.m_buildDataList.at (i).m_dci.m_mcs.at (1),
ind.m_buildDataList.at (i).m_dci.m_tbsSize.at (1)
);
}
else
{
NS_FATAL_ERROR ("Found element with more than two transport blocks");
}
}
}
@ -739,6 +780,15 @@ LteEnbMac::DoSchedUlConfigInd (FfMacSchedSapUser::SchedUlConfigIndParameters ind
m_enbPhySapProvider->SendIdealControlMessage (msg);
}
// Fire the trace with the UL information
for ( uint32_t i = 0; i < ind.m_dciList.size (); i++ )
{
m_ulScheduling (m_frameNo, m_subframeNo, ind.m_dciList.at (i).m_rnti,
ind.m_dciList.at (i).m_mcs, ind.m_dciList.at (i).m_tbSize);
}
}

16
src/lte/model/lte-enb-mac.h

@ -31,6 +31,8 @@
#include <ns3/ff-mac-csched-sap.h>
#include <ns3/ff-mac-sched-sap.h>
#include <ns3/lte-enb-phy-sap.h>
#include "ns3/traced-value.h"
#include "ns3/trace-source-accessor.h"
namespace ns3 {
@ -210,6 +212,20 @@ private:
LteEnbPhySapProvider* m_enbPhySapProvider;
LteEnbPhySapUser* m_enbPhySapUser;
uint32_t m_frameNo;
uint32_t m_subframeNo;
/**
* Trace information regarding DL scheduling
* Simulation time, Frame number, Subframe number, RNTI, MCS of TB1, size of TB1,
* MCS of TB2 (0 if not present), size of TB2 (0 if not present)
*/
TracedCallback<uint32_t, uint32_t, uint16_t, uint8_t, uint16_t, uint8_t, uint16_t> m_dlScheduling;
/**
* Trace information regarding UL scheduling
* Simulation time, Frame number, Subframe number, RNTI, MCS of TB, size of TB
*/
TracedCallback<uint32_t, uint32_t, uint16_t, uint8_t, uint16_t> m_ulScheduling;
};
} // end namespace ns3

2
src/lte/wscript

@ -29,6 +29,7 @@ def build(bld):
'model/ideal-control-messages.cc',
'helper/lena-helper.cc',
'helper/rlc-stats-calculator.cc',
'helper/mac-stats-calculator.cc',
'model/ff-mac-csched-sap.cc',
'model/ff-mac-sched-sap.cc',
'model/lte-mac-sap.cc',
@ -77,6 +78,7 @@ def build(bld):
'model/lte-ue-net-device.h',
'model/ideal-control-messages.h',
'helper/lena-helper.h',
'helper/mac-stats-calculator.h',
'helper/rlc-stats-calculator.h',
'model/ff-mac-common.h',
'model/ff-mac-csched-sap.h',

Loading…
Cancel
Save