Refactoring to align trace sinks for RLC and MAC implementations and to make them more user friendly.

All sinks are managed in LenaHelper and enabled in simulation programs through the helper.
This commit is contained in:
jnin
2011-04-29 17:19:15 +02:00
parent 1a9c95db31
commit 8dbfcbfddd
3 changed files with 72 additions and 35 deletions

View File

@@ -23,8 +23,6 @@
#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"
@@ -33,29 +31,8 @@
using namespace ns3;
void UlTxPduCallback(Ptr<RlcStatsCalculator> rlcStats, std::string path,
uint16_t rnti, uint8_t lcid, uint32_t packetSize)
{
rlcStats->UlTxPdu(rnti, lcid, packetSize);
}
void UlRxPduCallback(Ptr<RlcStatsCalculator> rlcStats, std::string path,
uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay)
{
rlcStats->UlRxPdu(rnti, lcid, packetSize, delay);
}
void DlTxPduCallback(Ptr<RlcStatsCalculator> rlcStats, std::string path,
uint16_t rnti, uint8_t lcid, uint32_t packetSize)
{
rlcStats->DlTxPdu(rnti, lcid, packetSize);
}
void DlRxPduCallback(Ptr<RlcStatsCalculator> rlcStats, std::string path,
uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay)
{
rlcStats->DlRxPdu(rnti, lcid, packetSize, delay);
}
int main (int argc, char *argv[])
@@ -104,19 +81,8 @@ int main (int argc, char *argv[])
Simulator::Stop (Seconds (4));
// Insert RLC Performance Calculator
Ptr<RlcStatsCalculator> rlcStats = CreateObject<RlcStatsCalculator> ();
Config::Connect("/NodeList/0/DeviceList/0/LteEnbRrc/UeMap/*/RadioBearerMap/*/LteRlc/TxPDU",
MakeBoundCallback(&DlTxPduCallback, rlcStats));
Config::Connect("/NodeList/*/DeviceList/0/LteUeRrc/RlcMap/*/RxPDU",
MakeBoundCallback(&DlRxPduCallback, rlcStats));
Config::Connect("/NodeList/*/DeviceList/0/LteUeRrc/RlcMap/*/TxPDU",
MakeBoundCallback(&UlTxPduCallback, rlcStats));
Config::Connect ("/NodeList/0/DeviceList/0/LteEnbRrc/UeMap/*/RadioBearerMap/*/LteRlc/RxPDU",
MakeBoundCallback(&UlRxPduCallback, rlcStats));
lena->EnableMacTraces ();
lena->EnableRlcTraces ();
Simulator::Run ();

View File

@@ -64,6 +64,7 @@ LenaHelper::DoStart (void)
m_downlinkChannel->AddSpectrumPropagationLossModel (dlPropagationModel);
m_uplinkChannel->AddSpectrumPropagationLossModel (ulPropagationModel);
macStats = CreateObject<MacStatsCalculator> ();
rlcStats = CreateObject<RlcStatsCalculator> ();
Object::DoStart ();
}
@@ -402,5 +403,59 @@ LenaHelper::EnableUlMacTraces (void)
MakeBoundCallback(&UlSchedulingCallback, macStats));
}
void
LenaHelper::EnableRlcTraces (void)
{
EnableDlRlcTraces ();
EnableUlRlcTraces ();
}
void
DlTxPduCallback(Ptr<RlcStatsCalculator> rlcStats, std::string path,
uint16_t rnti, uint8_t lcid, uint32_t packetSize)
{
rlcStats->DlTxPdu(rnti, lcid, packetSize);
}
void
DlRxPduCallback(Ptr<RlcStatsCalculator> rlcStats, std::string path,
uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay)
{
rlcStats->DlRxPdu(rnti, lcid, packetSize, delay);
}
void
LenaHelper::EnableDlRlcTraces (void)
{
Config::Connect("/NodeList/0/DeviceList/0/LteEnbRrc/UeMap/*/RadioBearerMap/*/LteRlc/TxPDU",
MakeBoundCallback(&DlTxPduCallback, rlcStats));
Config::Connect("/NodeList/*/DeviceList/0/LteUeRrc/RlcMap/*/RxPDU",
MakeBoundCallback(&DlRxPduCallback, rlcStats));
}
void
UlTxPduCallback(Ptr<RlcStatsCalculator> rlcStats, std::string path,
uint16_t rnti, uint8_t lcid, uint32_t packetSize)
{
rlcStats->UlTxPdu(rnti, lcid, packetSize);
}
void
UlRxPduCallback(Ptr<RlcStatsCalculator> rlcStats, std::string path,
uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay)
{
rlcStats->UlRxPdu(rnti, lcid, packetSize, delay);
}
void
LenaHelper::EnableUlRlcTraces (void)
{
Config::Connect("/NodeList/*/DeviceList/0/LteUeRrc/RlcMap/*/TxPDU",
MakeBoundCallback(&UlTxPduCallback, rlcStats));
Config::Connect ("/NodeList/0/DeviceList/0/LteEnbRrc/UeMap/*/RadioBearerMap/*/LteRlc/RxPDU",
MakeBoundCallback(&UlRxPduCallback, rlcStats));
}
} // namespace ns3

View File

@@ -31,6 +31,7 @@
#include <ns3/node-container.h>
#include <ns3/eps-bearer.h>
#include <ns3/mac-stats-calculator.h>
#include <ns3/rlc-stats-calculator.h>
namespace ns3 {
@@ -166,6 +167,20 @@ public:
*/
void EnableUlMacTraces (void);
/**
* Enable trace sinks for RLC layer
*/
void EnableRlcTraces (void);
/**
* Enable trace sinks for DL RLC layer
*/
void EnableDlRlcTraces (void);
/**
* Enable trace sinks for UL MAC layer
*/
void EnableUlRlcTraces (void);
protected:
@@ -184,6 +199,7 @@ private:
ObjectFactory m_propagationModelFactory;
Ptr<MacStatsCalculator> macStats;
Ptr<RlcStatsCalculator> rlcStats;
};