Merge with 325396a9f9bf4c098f4bf79e2d7d7e662d567181

This commit is contained in:
jnin
2011-06-23 11:31:44 +02:00
64 changed files with 1357 additions and 1250 deletions

95
src/lte/RELEASE_NOTES Normal file
View File

@@ -0,0 +1,95 @@
+++++++++++++++++++++++++++++++++++++
RELEASE NOTES of the ns-3 LTE module
+++++++++++++++++++++++++++++++++++++
This file documents the user-visible features that have been added
within each release of the ns-3 LTE module.
Milestone 1 (M1) release of the LENA project (June 17, 2011)
============================================================
Here is a summary of the new features available in the LTE module with
this release:
- uplink PHY and MAC properly implemented including Adaptive
Modulation and Coding (previously only downlink was supported)
- interference modeling was implemented: it is now possible to
simulate multi-cell scenarios with inter-cell interference
- flexible spectrum model: it is now possible to specify the carrier
frequency and bandwidth of each cell independently
- an implementation of the Proportional Fair scheduler based on the
FF LTE MAC Scheduler API is now included
- support for output of RLC and MAC layer Key Performance Indicators
(KPIs) via dedicated trace sinks connected to newly defined trace
sources
- the setting of the most relevant parameters (e.g. tx power, noise,
carrier frequency, bandwidth, type of scheduler, etc.) is now done
via the ns-3 attribute system
- several test suites have been added, including both unit tests that
check the correct functionality of specific objects, and system
tests that validate the output produced by the simulator in several
scenarios of interest.
- the documentation of the lte module has been entirely rewritten, it
now features three separate sections: the design documentation, the
user documentation and the testing documentation.
First Public release of the LENA project (March 10, 2011)
=========================================================
The LENA code is based on the GSoC 2010 project code by Giuseppe Piro,
which was merged into ns-3-dev on December 2010. With respect to the GSoC
code, the main modifications that have been performed are:
- the MAC has been entirely rewritten to support the MAC Scheduler
API defined by the Femto Forum, which is publicly available at this
location: http://www.femtoforum.org/femto/technical.php
- a Round Robin scheduler implementation based on the above API is
also provided
- the RLC API has been redefined RLC in particular, at this stage
only the API definition is in place, together with a simplified RLC
implementation (RLC TM/UM/AM not available yet)
- the RRC has been entirely rewritten; we plan to reuse part of the
GSoC 2010 flow classification code (which we plan to reuse) at a
future stage for the implementation of Traffic Flow Template
classifiers.
- network layer functionality has been temporarily disabled; it will
be re-enabled when either RLC/UM or RLC/AM is available.
GSoC 2010 release (merged into ns-3-dev on December 2010)
=========================================================
Here are
In summary, the most important features provided by the
proposed module are (i) a basic implementation of both the
User Equipment (UE) and the enhanced NodeB (eNB) de-
vices, (ii) RRC entities for both the UE and the eNB, (iii)
a state-of-the-art Adaptive Modulation and Coding (AMC)
scheme for the downlink [9], (iv) the management of the
data radio bearers (with their QoS parameters), the MAC
queues and the RLC instances, (v) Channel Quality Indi-
cator (CQI) management, (vi) support for both uplink and
downlik packet scheduling, (vii) a PHY layer model with
Resource Block level granularity and (viii) a channel model
with the outdoor E-UTRAN propagation loss model.

View File

@@ -38,19 +38,19 @@ int main (int argc, char *argv[])
double radius = 50.0;
uint32_t numUes = 1;
CommandLine cmd;
cmd.AddValue ("enbDist", "distance between the two eNBs", enbDist);
cmd.AddValue ("radius", "the radius of the disc where UEs are placed around an eNB", radius);
cmd.AddValue ("numUes", "how many UEs are attached to each eNB", numUes);
cmd.Parse (argc, argv);
ConfigStore inputConfig;
inputConfig.ConfigureDefaults ();
// parse again so you can override default values from the command line
cmd.Parse (argc, argv);
// determine the string tag that identifies this simulation run
// this tag is then appended to all filenames
@@ -58,13 +58,13 @@ int main (int argc, char *argv[])
GlobalValue::GetValueByName ("RngRun", runValue);
std::ostringstream tag;
tag << "_enbDist" << std::setw(3) << std::setfill ('0') << std::fixed << std::setprecision (0) << enbDist
<< "_radius" << std::setw(3) << std::setfill ('0') << std::fixed << std::setprecision (0) << radius
<< "_numUes" << std::setw(3) << std::setfill('0') << numUes
<< "_rngRun" << std::setw(3) << std::setfill('0') << runValue.Get () ;
tag << "_enbDist" << std::setw (3) << std::setfill ('0') << std::fixed << std::setprecision (0) << enbDist
<< "_radius" << std::setw (3) << std::setfill ('0') << std::fixed << std::setprecision (0) << radius
<< "_numUes" << std::setw (3) << std::setfill ('0') << numUes
<< "_rngRun" << std::setw (3) << std::setfill ('0') << runValue.Get () ;
Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
// Create Nodes: eNodeB and UE
NodeContainer enbNodes;
NodeContainer ueNodes1, ueNodes2;
@@ -72,7 +72,7 @@ int main (int argc, char *argv[])
ueNodes1.Create (numUes);
ueNodes2.Create (numUes);
// Position of eNBs
// Position of eNBs
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
positionAlloc->Add (Vector (0.0, 0.0, 0.0));
positionAlloc->Add (Vector (enbDist, 0.0, 0.0));
@@ -98,8 +98,8 @@ int main (int argc, char *argv[])
"rho", DoubleValue (radius));
ue2mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
ue2mobility.Install (ueNodes2);
// Create Devices and install them in the Nodes (eNB and UE)
NetDeviceContainer enbDevs;
@@ -121,7 +121,7 @@ int main (int argc, char *argv[])
Simulator::Stop (Seconds (10));
// Insert RLC Performance Calculator
// Insert RLC Performance Calculator
std::string dlOutFname = "DlRlcStats";
dlOutFname.append (tag.str ());
std::string ulOutFname = "UlRlcStats";

View File

@@ -40,18 +40,18 @@ int main (int argc, char *argv[])
ConfigStore inputConfig;
inputConfig.ConfigureDefaults ();
// parse again so you can override default values from the command line
cmd.Parse (argc, argv);
Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
//lena->EnableLogComponents ();
// LogComponentEnable ("LtePhy", LOG_LEVEL_ALL);
LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL);
LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL);
// LogComponentEnable ("LteUePhy", LOG_LEVEL_ALL);
LogComponentEnable ("PfFfMacScheduler", LOG_LEVEL_ALL);
LogComponentEnable ("PfFfMacScheduler", LOG_LEVEL_ALL);
// Create Nodes: eNodeB and UE
NodeContainer enbNodes;

View File

@@ -37,7 +37,7 @@ int main (int argc, char *argv[])
ConfigStore inputConfig;
inputConfig.ConfigureDefaults ();
// parse again so you can override default values from the command line
cmd.Parse (argc, argv);
@@ -79,9 +79,9 @@ int main (int argc, char *argv[])
lena->EnableRlcTraces ();
double distance_temp [] = {10000,10000,10000}; //{10000, 10000, 10000};
double distance_temp [] = { 10000,10000,10000}; //{10000, 10000, 10000};
std::vector<double> userDistance;
userDistance.assign(distance_temp, distance_temp+3);
userDistance.assign (distance_temp, distance_temp + 3);
for (int i = 0; i < 3; i++)
{
Ptr<ConstantPositionMobilityModel> mm = ueNodes.Get (i)->GetObject<ConstantPositionMobilityModel> ();

View File

@@ -45,13 +45,13 @@ int main (int argc, char *argv[])
cmd.AddValue ("nUe", "Number of UEs", nUe);
cmd.AddValue ("radius", "the radius of the disc where UEs are placed around an eNB", radius);
cmd.Parse (argc, argv);
ConfigStore inputConfig;
inputConfig.ConfigureDefaults ();
// parse again so you can override default values from the command line
cmd.Parse (argc, argv);
// determine the string tag that identifies this simulation run
// this tag is then appended to all filenames
@@ -66,7 +66,7 @@ int main (int argc, char *argv[])
*/
Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
lena->EnableLogComponents ();
// Create Nodes: eNodeB and UE
NodeContainer enbNodes;
vector<NodeContainer> ueNodes;
@@ -76,15 +76,15 @@ int main (int argc, char *argv[])
{
NodeContainer ueNode;
ueNode.Create (nUe);
ueNodes.push_back(ueNode);
ueNodes.push_back (ueNode);
}
// Position of eNBs
// Position of eNBs
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
for (uint32_t i = 0; i < nEnb; i++)
{
positionAlloc->Add (Vector (enbDist*i, enbDist*i, 0.0));
}
{
positionAlloc->Add (Vector (enbDist * i, enbDist * i, 0.0));
}
MobilityHelper enbMobility;
enbMobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
@@ -97,9 +97,9 @@ int main (int argc, char *argv[])
{
MobilityHelper ueMob;
ueMob.SetPositionAllocator ("ns3::UniformDiscPositionAllocator",
"X", DoubleValue (enbDist*i),
"Y", DoubleValue (enbDist*i),
"rho", DoubleValue (radius));
"X", DoubleValue (enbDist * i),
"Y", DoubleValue (enbDist * i),
"rho", DoubleValue (radius));
ueMob.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
ueMobility.push_back (ueMob);
ueMobility[i].Install (ueNodes[i]);

View File

@@ -63,8 +63,8 @@ LenaHelper::DoStart (void)
Ptr<SpectrumPropagationLossModel> ulPropagationModel = m_propagationModelFactory.Create<SpectrumPropagationLossModel> ();
m_downlinkChannel->AddSpectrumPropagationLossModel (dlPropagationModel);
m_uplinkChannel->AddSpectrumPropagationLossModel (ulPropagationModel);
macStats = CreateObject<MacStatsCalculator> ();
rlcStats = CreateObject<RlcStatsCalculator> ();
m_macStats = CreateObject<MacStatsCalculator> ();
m_rlcStats = CreateObject<RlcStatsCalculator> ();
Object::DoStart ();
}
@@ -91,16 +91,16 @@ TypeId LenaHelper::GetTypeId (void)
.SetParent<Object> ()
.AddConstructor<LenaHelper> ()
.AddAttribute ("Scheduler",
"The type of scheduler to be used for eNBs",
"The type of scheduler to be used for eNBs",
StringValue ("ns3::PfFfMacScheduler"),
MakeStringAccessor (&LenaHelper::SetSchedulerType),
MakeStringAccessor (&LenaHelper::SetSchedulerType),
MakeStringChecker ())
.AddAttribute ("PropagationModel",
"The type of propagation model to be used",
"The type of propagation model to be used",
StringValue ("ns3::FriisSpectrumPropagationLossModel"),
MakeStringAccessor (&LenaHelper::SetPropagationModelType),
MakeStringAccessor (&LenaHelper::SetPropagationModelType),
MakeStringChecker ())
;
;
return tid;
}
@@ -186,7 +186,7 @@ LenaHelper::InstallSingleEnbDevice (Ptr<Node> n)
{
Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
Ptr<LteEnbPhy> phy = CreateObject<LteEnbPhy> (dlPhy, ulPhy);
Ptr<LteCqiSinrChunkProcessor> p = Create<LteCqiSinrChunkProcessor> (phy->GetObject<LtePhy> ());
@@ -203,7 +203,7 @@ LenaHelper::InstallSingleEnbDevice (Ptr<Node> n)
m_uplinkChannel->AddRx (ulPhy);
Ptr<LteEnbMac> mac = CreateObject<LteEnbMac> ();
Ptr<FfMacScheduler> sched = m_schedulerFactory.Create<FfMacScheduler> ();
Ptr<FfMacScheduler> sched = m_schedulerFactory.Create<FfMacScheduler> ();
Ptr<LteEnbRrc> rrc = CreateObject<LteEnbRrc> ();
@@ -253,7 +253,7 @@ LenaHelper::InstallSingleUeDevice (Ptr<Node> n)
ulPhy->SetMobility (mm);
m_downlinkChannel->AddRx (dlPhy);
Ptr<LteUeMac> mac = CreateObject<LteUeMac> ();
Ptr<LteUeRrc> rrc = CreateObject<LteUeRrc> ();
@@ -381,14 +381,14 @@ 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);
mac->DlScheduling (frameNo, subframeNo, rnti, mcsTb1, sizeTb1, mcsTb2, sizeTb2);
}
void
LenaHelper::EnableDlMacTraces (void)
{
Config::Connect("/NodeList/0/DeviceList/0/LteEnbMac/DlScheduling",
MakeBoundCallback(&DlSchedulingCallback, macStats));
Config::Connect ("/NodeList/0/DeviceList/0/LteEnbMac/DlScheduling",
MakeBoundCallback (&DlSchedulingCallback, m_macStats));
}
void
@@ -396,14 +396,14 @@ 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);
mac->UlScheduling (frameNo, subframeNo, rnti, mcs, size);
}
void
LenaHelper::EnableUlMacTraces (void)
{
Config::Connect("/NodeList/0/DeviceList/0/LteEnbMac/UlScheduling",
MakeBoundCallback(&UlSchedulingCallback, macStats));
Config::Connect ("/NodeList/0/DeviceList/0/LteEnbMac/UlScheduling",
MakeBoundCallback (&UlSchedulingCallback, m_macStats));
}
void
@@ -421,13 +421,13 @@ FindImsiFromEnbRlcPath (std::string path)
// /NodeList/#NodeId/DeviceList/#DeviceId/LteEnbRrc/UeMap/#C-RNTI/RadioBearerMap/#LCID/LteRlc/RxPDU
// We retrieve the UeInfo accociated to the C-RNTI and perform the IMSI lookup
std::string ueMapPath = path.substr (0, path.find("/RadioBearerMap"));
std::string ueMapPath = path.substr (0, path.find ("/RadioBearerMap"));
Config::MatchContainer match = Config::LookupMatches (ueMapPath);
if (match.GetN () != 0)
{
Ptr<Object> ueInfo = match.Get(0);
return ueInfo->GetObject<UeInfo> ()->GetImsi ();
Ptr<Object> ueInfo = match.Get (0);
return ueInfo->GetObject<UeInfo> ()->GetImsi ();
}
else
{
@@ -443,13 +443,13 @@ FindImsiFromUeRlc (std::string path)
// /NodeList/#NodeId/DeviceList/#DeviceId/LteUeRrc/RlcMap/#LCID/RxPDU
// We retrieve the LteUeNetDevice path
std::string lteUeNetDevicePath = path.substr (0, path.find("/LteUeRrc"));
std::string lteUeNetDevicePath = path.substr (0, path.find ("/LteUeRrc"));
Config::MatchContainer match = Config::LookupMatches (lteUeNetDevicePath);
if (match.GetN () != 0)
{
Ptr<Object> ueNetDevice = match.Get(0);
return ueNetDevice->GetObject<LteUeNetDevice> ()->GetImsi ();
Ptr<Object> ueNetDevice = match.Get (0);
return ueNetDevice->GetObject<LteUeNetDevice> ()->GetImsi ();
}
else
{
@@ -460,44 +460,44 @@ FindImsiFromUeRlc (std::string path)
void
DlTxPduCallback (Ptr<RlcStatsCalculator> rlcStats, std::string path,
uint16_t rnti, uint8_t lcid, uint32_t packetSize)
DlTxPduCallback (Ptr<RlcStatsCalculator> m_rlcStats, std::string path,
uint16_t rnti, uint8_t lcid, uint32_t packetSize)
{
uint64_t imsi = FindImsiFromEnbRlcPath (path);
rlcStats->DlTxPdu (imsi, rnti, lcid, packetSize);
m_rlcStats->DlTxPdu (imsi, rnti, lcid, packetSize);
}
void
DlRxPduCallback (Ptr<RlcStatsCalculator> rlcStats, std::string path,
uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay)
DlRxPduCallback (Ptr<RlcStatsCalculator> m_rlcStats, std::string path,
uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay)
{
uint64_t imsi = FindImsiFromUeRlc (path);
rlcStats->DlRxPdu (imsi, rnti, lcid, packetSize, delay);
m_rlcStats->DlRxPdu (imsi, rnti, lcid, packetSize, delay);
}
void
LenaHelper::EnableDlRlcTraces (void)
{
Config::Connect ("/NodeList/*/DeviceList/*/LteEnbRrc/UeMap/*/RadioBearerMap/*/LteRlc/TxPDU",
MakeBoundCallback(&DlTxPduCallback, rlcStats));
MakeBoundCallback (&DlTxPduCallback, m_rlcStats));
Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/RlcMap/*/RxPDU",
MakeBoundCallback(&DlRxPduCallback, rlcStats));
MakeBoundCallback (&DlRxPduCallback, m_rlcStats));
}
void
UlTxPduCallback(Ptr<RlcStatsCalculator> rlcStats, std::string path,
uint16_t rnti, uint8_t lcid, uint32_t packetSize)
UlTxPduCallback (Ptr<RlcStatsCalculator> m_rlcStats, std::string path,
uint16_t rnti, uint8_t lcid, uint32_t packetSize)
{
uint64_t imsi = FindImsiFromUeRlc (path);
rlcStats->UlTxPdu (imsi, rnti, lcid, packetSize);
m_rlcStats->UlTxPdu (imsi, rnti, lcid, packetSize);
}
void
UlRxPduCallback(Ptr<RlcStatsCalculator> rlcStats, std::string path,
uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay)
UlRxPduCallback (Ptr<RlcStatsCalculator> m_rlcStats, std::string path,
uint16_t rnti, uint8_t lcid, uint32_t packetSize, uint64_t delay)
{
uint64_t imsi = FindImsiFromEnbRlcPath (path);
rlcStats->UlRxPdu (imsi, rnti, lcid, packetSize, delay);
m_rlcStats->UlRxPdu (imsi, rnti, lcid, packetSize, delay);
}
@@ -505,16 +505,16 @@ UlRxPduCallback(Ptr<RlcStatsCalculator> rlcStats, std::string path,
void
LenaHelper::EnableUlRlcTraces (void)
{
Config::Connect("/NodeList/*/DeviceList/*/LteUeRrc/RlcMap/*/TxPDU",
MakeBoundCallback(&UlTxPduCallback, rlcStats));
Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/RlcMap/*/TxPDU",
MakeBoundCallback (&UlTxPduCallback, m_rlcStats));
Config::Connect ("/NodeList/0/DeviceList/*/LteEnbRrc/UeMap/*/RadioBearerMap/*/LteRlc/RxPDU",
MakeBoundCallback(&UlRxPduCallback, rlcStats));
MakeBoundCallback (&UlRxPduCallback, m_rlcStats));
}
Ptr<RlcStatsCalculator>
LenaHelper::GetRlcStats (void)
{
return rlcStats;
return m_rlcStats;
}
} // namespace ns3

View File

@@ -120,14 +120,14 @@ public:
* \param bearer the characteristics of the bearer to be activated
*/
void ActivateEpsBearer (Ptr<NetDevice> ueDevice, EpsBearer bearer);
/**
*
*
* \param type the type of scheduler to be used for the eNBs
*/
void SetSchedulerType (std::string type);
/**
* set an attribute for the scheduler to be created
*/
@@ -139,7 +139,7 @@ public:
* \param type the type of propagation model to be used for the eNBs
*/
void SetPropagationModelType (std::string type);
/**
* set an attribute for the propagation model to be created
*/
@@ -185,12 +185,10 @@ public:
Ptr<RlcStatsCalculator> GetRlcStats (void);
protected:
// inherited from Object
virtual void DoStart (void);
private:
Ptr<NetDevice> InstallSingleEnbDevice (Ptr<Node> n);
Ptr<NetDevice> InstallSingleUeDevice (Ptr<Node> n);
@@ -198,12 +196,12 @@ private:
Ptr<SpectrumChannel> m_downlinkChannel;
Ptr<SpectrumChannel> m_uplinkChannel;
ObjectFactory m_schedulerFactory;
ObjectFactory m_propagationModelFactory;
Ptr<MacStatsCalculator> macStats;
Ptr<RlcStatsCalculator> rlcStats;
Ptr<MacStatsCalculator> m_macStats;
Ptr<RlcStatsCalculator> m_rlcStats;
};

View File

@@ -29,17 +29,17 @@ NS_LOG_COMPONENT_DEFINE ("MacStatsCalculator");
NS_OBJECT_ENSURE_REGISTERED (MacStatsCalculator);
MacStatsCalculator::MacStatsCalculator() :
m_dlOutputFilename (""),
m_dlFirstWrite(true),
MacStatsCalculator::MacStatsCalculator ()
: m_dlOutputFilename (""),
m_dlFirstWrite (true),
m_ulOutputFilename (""),
m_ulFirstWrite(true)
m_ulFirstWrite (true)
{
NS_LOG_FUNCTION (this);
}
MacStatsCalculator::~MacStatsCalculator()
MacStatsCalculator::~MacStatsCalculator ()
{
NS_LOG_FUNCTION (this);
}
@@ -60,7 +60,7 @@ MacStatsCalculator::GetTypeId (void)
StringValue ("UlMacStats.csv"),
MakeStringAccessor (&MacStatsCalculator::SetUlOutputFilename),
MakeStringChecker ())
;
;
return tid;
}
@@ -87,11 +87,11 @@ MacStatsCalculator::DlScheduling (uint32_t frameNo, uint32_t subframeNo, uint16_
if ( m_dlFirstWrite == true )
{
outFile.open (m_dlOutputFilename.c_str ());
if (! outFile.is_open ())
{
NS_LOG_ERROR ("Can't open file " << m_dlOutputFilename.c_str ());
return;
}
if (!outFile.is_open ())
{
NS_LOG_ERROR ("Can't open file " << m_dlOutputFilename.c_str ());
return;
}
m_dlFirstWrite = false;
outFile << "# time\tframe\tsframe\tRNTI\tmcsTb1\tsizeTb1\tmcsTb2\tsizeTb2";
outFile << std::endl;
@@ -99,22 +99,22 @@ MacStatsCalculator::DlScheduling (uint32_t frameNo, uint32_t subframeNo, uint16_
else
{
outFile.open (m_dlOutputFilename.c_str (), std::ios_base::app);
if (! outFile.is_open ())
{
NS_LOG_ERROR ("Can't open file " << m_dlOutputFilename.c_str ());
return;
}
if (!outFile.is_open ())
{
NS_LOG_ERROR ("Can't open file " << m_dlOutputFilename.c_str ());
return;
}
}
outFile << Simulator::Now ().GetNanoSeconds () / (double) 1e9 << "\t";
outFile << frameNo << "\t";
outFile << subframeNo << "\t";
outFile << rnti<< "\t";
outFile << (uint32_t) mcsTb1 << "\t";
outFile << sizeTb1 << "\t";
outFile << (uint32_t) mcsTb2 << "\t";
outFile << sizeTb2 << std::endl;
outFile.close ();
outFile << Simulator::Now ().GetNanoSeconds () / (double) 1e9 << "\t";
outFile << frameNo << "\t";
outFile << subframeNo << "\t";
outFile << rnti << "\t";
outFile << (uint32_t) mcsTb1 << "\t";
outFile << sizeTb1 << "\t";
outFile << (uint32_t) mcsTb2 << "\t";
outFile << sizeTb2 << std::endl;
outFile.close ();
}
void
@@ -128,11 +128,11 @@ MacStatsCalculator::UlScheduling (uint32_t frameNo, uint32_t subframeNo, uint16_
if ( m_ulFirstWrite == true )
{
outFile.open (m_ulOutputFilename.c_str ());
if (! outFile.is_open ())
{
NS_LOG_ERROR ("Can't open file " << m_ulOutputFilename.c_str ());
return;
}
if (!outFile.is_open ())
{
NS_LOG_ERROR ("Can't open file " << m_ulOutputFilename.c_str ());
return;
}
m_ulFirstWrite = false;
outFile << "# time\tframe\tsframe\tRNTI\tmcs\tsize";
outFile << std::endl;
@@ -140,20 +140,20 @@ MacStatsCalculator::UlScheduling (uint32_t frameNo, uint32_t subframeNo, uint16_
else
{
outFile.open (m_ulOutputFilename.c_str (), std::ios_base::app);
if (! outFile.is_open ())
{
NS_LOG_ERROR ("Can't open file " << m_ulOutputFilename.c_str ());
return;
}
if (!outFile.is_open ())
{
NS_LOG_ERROR ("Can't open file " << m_ulOutputFilename.c_str ());
return;
}
}
outFile << Simulator::Now ().GetNanoSeconds () / (double) 1e9 << "\t";
outFile << frameNo << "\t";
outFile << subframeNo << "\t";
outFile << rnti<< "\t";
outFile << (uint32_t) mcs << "\t";
outFile << size << std::endl;
outFile.close ();
outFile << Simulator::Now ().GetNanoSeconds () / (double) 1e9 << "\t";
outFile << frameNo << "\t";
outFile << subframeNo << "\t";
outFile << rnti << "\t";
outFile << (uint32_t) mcs << "\t";
outFile << size << std::endl;
outFile.close ();
}

View File

@@ -99,7 +99,6 @@ public:
private:
std::string m_dlOutputFilename;
bool m_dlFirstWrite;

View File

@@ -27,13 +27,13 @@
namespace ns3 {
ImsiLcidPair::ImsiLcidPair ()
ImsiLcidPair::ImsiLcidPair ()
{
}
ImsiLcidPair::ImsiLcidPair (const uint64_t a, const uint8_t b)
: m_imsi(a),
m_lcId(b)
ImsiLcidPair::ImsiLcidPair (const uint64_t a, const uint8_t b)
: m_imsi (a),
m_lcId (b)
{
}
@@ -54,16 +54,16 @@ NS_LOG_COMPONENT_DEFINE ("RlcStatsCalculator");
NS_OBJECT_ENSURE_REGISTERED (RlcStatsCalculator);
RlcStatsCalculator::RlcStatsCalculator() :
m_dlOutputFilename (""),
RlcStatsCalculator::RlcStatsCalculator ()
: m_dlOutputFilename (""),
m_ulOutputFilename (""),
m_firstWrite(true)
m_firstWrite (true)
{
NS_LOG_FUNCTION (this);
}
RlcStatsCalculator::~RlcStatsCalculator()
RlcStatsCalculator::~RlcStatsCalculator ()
{
NS_LOG_FUNCTION (this);
ShowResults ();
@@ -87,14 +87,14 @@ RlcStatsCalculator::GetTypeId (void)
MakeStringChecker ())
.AddAttribute ("StartTime",
"Start time of the on going epoch.",
TimeValue ( Seconds(0.) ),
TimeValue ( Seconds (0.) ),
MakeTimeAccessor (&RlcStatsCalculator::m_startTime),
MakeTimeChecker ())
.AddAttribute("EpochDuration",
"Epoch duration.", TimeValue(Seconds(0.25)),
MakeTimeAccessor(&RlcStatsCalculator::m_epochDuration),
MakeTimeChecker())
;
.AddAttribute ("EpochDuration",
"Epoch duration.", TimeValue (Seconds (0.25)),
MakeTimeAccessor (&RlcStatsCalculator::m_epochDuration),
MakeTimeChecker ())
;
return tid;
}
@@ -148,8 +148,8 @@ RlcStatsCalculator::UlRxPdu (uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_
m_ulRxPackets[p]++;
m_ulRxData[p] += packetSize;
Uint64StatsMap::iterator it = m_ulDelay.find(p);
if (it == m_ulDelay.end())
Uint64StatsMap::iterator it = m_ulDelay.find (p);
if (it == m_ulDelay.end ())
{
NS_LOG_DEBUG (this << " Creating UL stats calculators for IMSI " << p.m_imsi << " and LCI " << (uint32_t) p.m_lcId );
m_ulDelay[p] = CreateObject<MinMaxAvgTotalCalculator<uint64_t> > ();
@@ -172,14 +172,14 @@ RlcStatsCalculator::DlRxPdu (uint64_t imsi, uint16_t rnti, uint8_t lcid, uint32_
m_dlRxPackets[p]++;
m_dlRxData[p] += packetSize;
Uint64StatsMap::iterator it = m_dlDelay.find(p);
if (it == m_dlDelay.end())
Uint64StatsMap::iterator it = m_dlDelay.find (p);
if (it == m_dlDelay.end ())
{
NS_LOG_DEBUG (this << " Creating DL stats calculators for IMSI " << p.m_imsi << " and LCI " << (uint32_t) p.m_lcId );
m_dlDelay[p] = CreateObject<MinMaxAvgTotalCalculator<uint64_t> > ();
m_dlPduSize[p] = CreateObject<MinMaxAvgTotalCalculator<uint32_t> > ();
}
m_dlDelay[p]->Update(delay);
m_dlDelay[p]->Update (delay);
m_dlPduSize[p]->Update (packetSize);
}
CheckEpoch ();
@@ -192,25 +192,25 @@ RlcStatsCalculator::ShowResults (void)
NS_LOG_FUNCTION (this << m_ulOutputFilename.c_str () << m_dlOutputFilename.c_str () );
NS_LOG_INFO ("Write Rlc Stats in " << m_ulOutputFilename.c_str () <<
" and in " << m_dlOutputFilename.c_str ());
std::ofstream ulOutFile;
std::ofstream dlOutFile;
if ( m_firstWrite == true )
{
ulOutFile.open (m_ulOutputFilename.c_str ());
if (! ulOutFile.is_open ())
{
NS_LOG_ERROR ("Can't open file " << m_ulOutputFilename.c_str ());
return;
}
if (!ulOutFile.is_open ())
{
NS_LOG_ERROR ("Can't open file " << m_ulOutputFilename.c_str ());
return;
}
dlOutFile.open (m_dlOutputFilename.c_str ());
if (! dlOutFile.is_open ())
{
NS_LOG_ERROR ("Can't open file " << m_dlOutputFilename.c_str ());
return;
}
if (!dlOutFile.is_open ())
{
NS_LOG_ERROR ("Can't open file " << m_dlOutputFilename.c_str ());
return;
}
m_firstWrite = false;
ulOutFile << "% start\tend\tIMSI\tRNTI\tLCID\tnTxPDUs\tTxBytes\tnRxPDUs\tRxBytes\t";
ulOutFile << "delay\tstdDev\tmin\tmax\t";
@@ -224,22 +224,22 @@ RlcStatsCalculator::ShowResults (void)
else
{
ulOutFile.open (m_ulOutputFilename.c_str (), std::ios_base::app);
if (! ulOutFile.is_open ())
{
NS_LOG_ERROR ("Can't open file " << m_ulOutputFilename.c_str ());
return;
}
if (!ulOutFile.is_open ())
{
NS_LOG_ERROR ("Can't open file " << m_ulOutputFilename.c_str ());
return;
}
dlOutFile.open (m_dlOutputFilename.c_str (), std::ios_base::app);
if (! dlOutFile.is_open ())
{
NS_LOG_ERROR ("Can't open file " << m_dlOutputFilename.c_str ());
return;
}
if (!dlOutFile.is_open ())
{
NS_LOG_ERROR ("Can't open file " << m_dlOutputFilename.c_str ());
return;
}
}
WriteUlResults(ulOutFile);
WriteDlResults(dlOutFile);
WriteUlResults (ulOutFile);
WriteDlResults (dlOutFile);
}
@@ -249,7 +249,7 @@ RlcStatsCalculator::WriteUlResults (std::ofstream& outFile)
// Get the unique IMSI / LCID list
std::vector<ImsiLcidPair > pairVector;
for (Uint32Map::iterator it = m_ulTxPackets.begin(); it != m_ulTxPackets.end(); ++it)
for (Uint32Map::iterator it = m_ulTxPackets.begin (); it != m_ulTxPackets.end (); ++it)
{
if (find (pairVector.begin (), pairVector.end (), (*it).first ) == pairVector.end () )
{
@@ -258,11 +258,11 @@ RlcStatsCalculator::WriteUlResults (std::ofstream& outFile)
}
Time endTime = m_startTime + m_epochDuration;
for (std::vector<ImsiLcidPair>::iterator it = pairVector.begin(); it != pairVector.end(); ++it)
for (std::vector<ImsiLcidPair>::iterator it = pairVector.begin (); it != pairVector.end (); ++it)
{
ImsiLcidPair p = *it;
outFile << m_startTime.GetNanoSeconds () / 1.0e9 << "\t";
outFile << endTime.GetNanoSeconds() / 1.0e9 << "\t";
outFile << endTime.GetNanoSeconds () / 1.0e9 << "\t";
outFile << p.m_imsi << "\t";
outFile << m_flowId[p].m_rnti << "\t";
outFile << (uint32_t) m_flowId[p].m_lcId << "\t";
@@ -271,12 +271,12 @@ RlcStatsCalculator::WriteUlResults (std::ofstream& outFile)
outFile << GetUlRxPackets (p.m_imsi, p.m_lcId) << "\t";
outFile << GetUlRxData (p.m_imsi, p.m_lcId) << "\t";
std::vector<double> stats = GetUlDelayStats (p.m_imsi, p.m_lcId);
for( std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it )
for ( std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it )
{
outFile << (*it) * 1e-9 << "\t";
}
stats = GetUlPduSizeStats (p.m_imsi, p.m_lcId);
for( std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it )
for ( std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it )
{
outFile << (*it) << "\t";
}
@@ -291,7 +291,7 @@ RlcStatsCalculator::WriteDlResults (std::ofstream& outFile)
{
// Get the unique IMSI list
std::vector<ImsiLcidPair > pairVector;
for (Uint32Map::iterator it = m_dlTxPackets.begin(); it != m_dlTxPackets.end(); ++it)
for (Uint32Map::iterator it = m_dlTxPackets.begin (); it != m_dlTxPackets.end (); ++it)
{
if (find (pairVector.begin (), pairVector.end (), (*it).first ) == pairVector.end () )
{
@@ -300,11 +300,11 @@ RlcStatsCalculator::WriteDlResults (std::ofstream& outFile)
}
Time endTime = m_startTime + m_epochDuration;
for (std::vector<ImsiLcidPair>::iterator pair = pairVector.begin(); pair != pairVector.end(); ++pair)
for (std::vector<ImsiLcidPair>::iterator pair = pairVector.begin (); pair != pairVector.end (); ++pair)
{
ImsiLcidPair p = *pair;
outFile << m_startTime.GetNanoSeconds () / 1.0e9 << "\t";
outFile << endTime.GetNanoSeconds() / 1.0e9 << "\t";
outFile << endTime.GetNanoSeconds () / 1.0e9 << "\t";
outFile << p.m_imsi << "\t";
outFile << m_flowId[p].m_rnti << "\t";
outFile << (uint32_t) m_flowId[p].m_lcId << "\t";
@@ -313,12 +313,12 @@ RlcStatsCalculator::WriteDlResults (std::ofstream& outFile)
outFile << GetDlRxPackets (p.m_imsi, p.m_lcId) << "\t";
outFile << GetDlRxData (p.m_imsi, p.m_lcId) << "\t";
std::vector<double> stats = GetDlDelayStats (p.m_imsi, p.m_lcId);
for( std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it )
for ( std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it )
{
outFile << (*it) * 1e-9 << "\t";
}
stats = GetDlPduSizeStats (p.m_imsi, p.m_lcId);
for( std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it )
for ( std::vector<double>::iterator it = stats.begin (); it != stats.end (); ++it )
{
outFile << (*it) << "\t";
}
@@ -331,19 +331,19 @@ RlcStatsCalculator::WriteDlResults (std::ofstream& outFile)
void
RlcStatsCalculator::ResetResults (void)
{
m_ulTxPackets.erase (m_ulTxPackets.begin (), m_ulTxPackets.end () );
m_ulRxPackets.erase (m_ulRxPackets.begin (), m_ulRxPackets.end () );
m_ulRxData.erase (m_ulRxData.begin (), m_ulRxData.end () );
m_ulTxData.erase (m_ulTxData.begin (), m_ulTxData.end () );
m_ulDelay.erase (m_ulDelay.begin (), m_ulDelay.end () );
m_ulPduSize.erase (m_ulPduSize.begin (), m_ulPduSize.end () );
m_ulTxPackets.erase (m_ulTxPackets.begin (), m_ulTxPackets.end () );
m_ulRxPackets.erase (m_ulRxPackets.begin (), m_ulRxPackets.end () );
m_ulRxData.erase (m_ulRxData.begin (), m_ulRxData.end () );
m_ulTxData.erase (m_ulTxData.begin (), m_ulTxData.end () );
m_ulDelay.erase (m_ulDelay.begin (), m_ulDelay.end () );
m_ulPduSize.erase (m_ulPduSize.begin (), m_ulPduSize.end () );
m_dlTxPackets.erase (m_dlTxPackets.begin (), m_dlTxPackets.end () );
m_dlRxPackets.erase (m_dlRxPackets.begin (), m_dlRxPackets.end () );
m_dlRxData.erase (m_dlRxData.begin (), m_dlRxData.end () );
m_dlTxData.erase (m_dlTxData.begin (), m_dlTxData.end () );
m_dlDelay.erase (m_dlDelay.begin (), m_dlDelay.end () );
m_dlPduSize.erase (m_dlPduSize.begin (), m_dlPduSize.end () );
m_dlTxPackets.erase (m_dlTxPackets.begin (), m_dlTxPackets.end () );
m_dlRxPackets.erase (m_dlRxPackets.begin (), m_dlRxPackets.end () );
m_dlRxData.erase (m_dlRxData.begin (), m_dlRxData.end () );
m_dlTxData.erase (m_dlTxData.begin (), m_dlTxData.end () );
m_dlDelay.erase (m_dlDelay.begin (), m_dlDelay.end () );
m_dlPduSize.erase (m_dlPduSize.begin (), m_dlPduSize.end () );
}
void
@@ -352,9 +352,9 @@ RlcStatsCalculator::CheckEpoch (void)
if ( Simulator::Now () > m_startTime + m_epochDuration )
{
std::cout << "JNNNNNNNNNG New epoch! startTime " << m_startTime << " epoch duration " << m_epochDuration << std::endl;
ShowResults();
ResetResults();
StartEpoch();
ShowResults ();
ResetResults ();
StartEpoch ();
}
}
@@ -400,7 +400,7 @@ RlcStatsCalculator::GetUlDelay (uint64_t imsi, uint8_t lcid)
Uint64StatsMap::iterator it = m_ulDelay.find (p);
if ( it == m_ulDelay.end () )
{
NS_LOG_ERROR("UL delay for " << imsi << " - " << lcid << " not found");
NS_LOG_ERROR ("UL delay for " << imsi << " - " << lcid << " not found");
return 0;
}
@@ -415,14 +415,14 @@ RlcStatsCalculator::GetUlDelayStats (uint64_t imsi, uint8_t lcid)
Uint64StatsMap::iterator it = m_ulDelay.find (p);
if ( it == m_ulDelay.end () )
{
NS_LOG_ERROR("UL delay for " << imsi << " - " << lcid << " not found");
NS_LOG_ERROR ("UL delay for " << imsi << " - " << lcid << " not found");
return stats;
}
stats.push_back(m_ulDelay[p]->getMean ());
stats.push_back(m_ulDelay[p]->getStddev ());
stats.push_back(m_ulDelay[p]->getMin ());
stats.push_back(m_ulDelay[p]->getMax ());
stats.push_back (m_ulDelay[p]->getMean ());
stats.push_back (m_ulDelay[p]->getStddev ());
stats.push_back (m_ulDelay[p]->getMin ());
stats.push_back (m_ulDelay[p]->getMax ());
return stats;
}
@@ -434,7 +434,7 @@ RlcStatsCalculator::GetUlPduSizeStats (uint64_t imsi, uint8_t lcid)
Uint32StatsMap::iterator it = m_ulPduSize.find (p);
if ( it == m_ulPduSize.end () )
{
NS_LOG_ERROR("UL PDU Size for " << imsi << " - " << lcid << " not found");
NS_LOG_ERROR ("UL PDU Size for " << imsi << " - " << lcid << " not found");
return stats;
}
@@ -480,7 +480,7 @@ RlcStatsCalculator::GetDlDelay (uint64_t imsi, uint8_t lcid)
Uint64StatsMap::iterator it = m_dlDelay.find (p);
if ( it == m_dlDelay.end () )
{
NS_LOG_ERROR("DL delay for " << imsi << " not found");
NS_LOG_ERROR ("DL delay for " << imsi << " not found");
return 0;
}
return m_dlDelay[p]->getMean ();
@@ -495,14 +495,14 @@ RlcStatsCalculator::GetDlDelayStats (uint64_t imsi, uint8_t lcid)
if ( it == m_dlDelay.end () )
{
NS_LOG_ERROR("DL delay for " << imsi << " not found");
NS_LOG_ERROR ("DL delay for " << imsi << " not found");
return stats;
}
stats.push_back(m_dlDelay[p]->getMean ());
stats.push_back(m_dlDelay[p]->getStddev ());
stats.push_back(m_dlDelay[p]->getMin ());
stats.push_back(m_dlDelay[p]->getMax ());
stats.push_back (m_dlDelay[p]->getMean ());
stats.push_back (m_dlDelay[p]->getStddev ());
stats.push_back (m_dlDelay[p]->getMin ());
stats.push_back (m_dlDelay[p]->getMax ());
return stats;
}
@@ -515,14 +515,14 @@ RlcStatsCalculator::GetDlPduSizeStats (uint64_t imsi, uint8_t lcid)
if ( it == m_dlPduSize.end () )
{
NS_LOG_ERROR("DL delay for " << imsi << " not found");
NS_LOG_ERROR ("DL delay for " << imsi << " not found");
return stats;
}
stats.push_back(m_dlPduSize[p]->getMean ());
stats.push_back(m_dlPduSize[p]->getStddev ());
stats.push_back(m_dlPduSize[p]->getMin ());
stats.push_back(m_dlPduSize[p]->getMax ());
stats.push_back (m_dlPduSize[p]->getMean ());
stats.push_back (m_dlPduSize[p]->getStddev ());
stats.push_back (m_dlPduSize[p]->getMin ());
stats.push_back (m_dlPduSize[p]->getMax ());
return stats;
}

View File

@@ -30,7 +30,7 @@
#include <fstream>
namespace ns3 {
struct ImsiLcidPair
{
@@ -66,7 +66,6 @@ typedef std::map<ImsiLcidPair, LteFlowId_t> FlowIdMap;
class RlcStatsCalculator : public Object
{
public:
/**
* Class constructor
*/
@@ -77,9 +76,9 @@ public:
*/
virtual ~RlcStatsCalculator ();
/**
* Inherited from ns3::Object
*/
/**
* Inherited from ns3::Object
*/
static TypeId GetTypeId (void);
/**

View File

@@ -193,14 +193,14 @@ UlDciIdealControlMessage::UlDciIdealControlMessage (void)
UlDciIdealControlMessage::~UlDciIdealControlMessage (void)
{
}
void
UlDciIdealControlMessage::SetDci (UlDciListElement_s dci)
{
m_dci = dci;
}

View File

@@ -41,15 +41,14 @@ class LteNetDevice;
class IdealControlMessage : public SimpleRefCount<IdealControlMessage>
{
public:
/**
* The type of the message
*/
enum MessageType
{
CQI_FEEDBACKS, ALLOCATION_MAP,
DL_DCI, UL_DCI, // Downlink/Uplink Data Control Indicator
DL_CQI, UL_CQI, // Downlink/Uplink Channel Quality Indicator
DL_DCI, UL_DCI, // Downlink/Uplink Data Control Indicator
DL_CQI, UL_CQI, // Downlink/Uplink Channel Quality Indicator
BSR // Buffer Status Report
};
@@ -132,12 +131,11 @@ class LteNetDevice;
class PdcchMapIdealControlMessage : public IdealControlMessage
{
public:
PdcchMapIdealControlMessage (void);
virtual ~PdcchMapIdealControlMessage (void);
/**
* Direction for which the message is created
* Direction for which the message is created
*/
enum Direction
{
@@ -151,7 +149,7 @@ public:
{
/** the direction */
Direction m_direction;
/** the sub channel */
/** the sub channel */
int m_idSubChannel;
/** the ue that receive the mapping */
Ptr<LteNetDevice> m_ue;
@@ -213,7 +211,6 @@ class LteNetDevice;
class CqiIdealControlMessage : public IdealControlMessage
{
public:
CqiIdealControlMessage (void);
virtual ~CqiIdealControlMessage (void);
@@ -223,7 +220,7 @@ public:
struct CqiFeedback
{
/** the sub channel */
int m_idSubChannel;
int m_idSubChannel;
/** the cqi feedback */
double m_cqi;
};
@@ -307,33 +304,33 @@ private:
#include <ns3/ff-mac-common.h>
namespace ns3 {
/**
* The Uplink Data Control Indicator messages defines the RB allocation for the
* users
*/
class UlDciIdealControlMessage : public IdealControlMessage
{
public:
UlDciIdealControlMessage (void);
virtual ~UlDciIdealControlMessage (void);
/**
* The Uplink Data Control Indicator messages defines the RB allocation for the
* users
* \brief add a DCI into the message
* \param dci the dci
*/
class UlDciIdealControlMessage : public IdealControlMessage
{
public:
UlDciIdealControlMessage (void);
virtual ~UlDciIdealControlMessage (void);
/**
* \brief add a DCI into the message
* \param dci the dci
*/
void SetDci (UlDciListElement_s dci);
/**
* \brief Get dic informations
* \return dci messages
*/
UlDciListElement_s GetDci (void);
private:
UlDciListElement_s m_dci;
};
void SetDci (UlDciListElement_s dci);
/**
* \brief Get dic informations
* \return dci messages
*/
UlDciListElement_s GetDci (void);
private:
UlDciListElement_s m_dci;
};
} // namespace ns3
#endif /* UL_DCI_IDEAL_CONTROL_MESSAGES_H */

View File

@@ -79,12 +79,13 @@ int McsToItbs[29] = {
};
// 3GPP TS 36.213 v8.8.0 Table 7.1.7.2.1-1: Transport block size table (dimension 27×110)
// for NPRB = 1 and Itbs = 6 the stadard returns 328, but it not consisent with the
// other values, therefore we used 88 obtained following the sequence of NPRB = 1 values
// 3GPP TS 36.213 v8.8.0 Table 7.1.7.2.1-1: Transport block size table (dimension 27×110)
// for NPRB = 1 and Itbs = 6 the stadard returns 328, but it not consisent with the
// other values, therefore we used 88 obtained following the sequence of NPRB = 1 values
int TransportBlockSizeTable [110][27] = {
/* NPRB 001*/ { 16, 24, 32, 40, 56, 72, 88, 104, 120, 136, 144, 176, 208, 224, 256, 280, 328, 336, 376, 408, 440, 488, 520, 552, 584, 616, 712},
/* NPRB 001*/
{ 16, 24, 32, 40, 56, 72, 88, 104, 120, 136, 144, 176, 208, 224, 256, 280, 328, 336, 376, 408, 440, 488, 520, 552, 584, 616, 712},
/* NPRB 002*/ { 32, 56, 72, 104, 120, 144, 176, 224, 256, 296, 328, 376, 440, 488, 552, 600, 632, 696, 776, 840, 904, 1000, 1064, 1128, 1192, 1256, 1480},
/* NPRB 003*/ { 56, 88, 144, 176, 208, 224, 256, 328, 392, 456, 504, 584, 680, 744, 840, 904, 968, 1064, 1160, 1288, 1384, 1480, 1608, 1736, 1800, 1864, 2216},
/* NPRB 004*/ { 88, 144, 176, 208, 256, 328, 392, 472, 536, 616, 680, 776, 904, 1000, 1128, 1224, 1288, 1416, 1544, 1736, 1864, 1992, 2152, 2280, 2408, 2536, 2984},
@@ -203,7 +204,7 @@ int
LteAmc::GetCqiFromSpectralEfficiency (double s)
{
NS_LOG_FUNCTION (s);
NS_ASSERT_MSG (s >= 0.0, "negative spectral efficiency = "<< s);
NS_ASSERT_MSG (s >= 0.0, "negative spectral efficiency = " << s);
int cqi = 0;
while ((cqi < 15) && (SpectralEfficiencyForCqi[cqi + 1] < s))
{
@@ -280,10 +281,10 @@ LteAmc::CreateCqiFeedbacks (const SpectrumValue& sinr)
int cqi_ = GetCqiFromSpectralEfficiency (s);
NS_LOG_LOGIC (" PRB =" << cqi.size ()
<< ", sinr = " << sinr_
<< " (=" << pow (10.0, sinr_/10.0) << " dB)"
<< ", spectral efficiency =" << s
<< ", CQI = " << cqi_ );
<< ", sinr = " << sinr_
<< " (=" << pow (10.0, sinr_ / 10.0) << " dB)"
<< ", spectral efficiency =" << s
<< ", CQI = " << cqi_ );
cqi.push_back (cqi_);
}

View File

@@ -42,7 +42,6 @@ class LteAmc
{
public:
/**
* \brief Get the Modulation anc Coding Scheme for
* a CQI value

View File

@@ -32,8 +32,8 @@ LteFlowId_t::LteFlowId_t ()
}
LteFlowId_t::LteFlowId_t (const uint16_t a, const uint8_t b)
: m_rnti(a),
m_lcId(b)
: m_rnti (a),
m_lcId (b)
{
}
@@ -51,17 +51,17 @@ operator < (const LteFlowId_t& a, const LteFlowId_t& b)
uint16_t
LteFfConverter::double2fpS11dot3(double val)
LteFfConverter::double2fpS11dot3 (double val)
{
// convert from double to fixed point notation Sxxxxxxxxxxx.xxx
int16_t valFp = (int16_t)(val * pow (2, 3));
return (valFp);
int16_t valFp = (int16_t)(val * pow (2, 3));
return (valFp);
}
double
LteFfConverter::fpS11dot3toDouble(uint16_t val)
LteFfConverter::fpS11dot3toDouble (uint16_t val)
{
// convert from fixed point notation Sxxxxxxxxxxx.xxx to double
// convert from fixed point notation Sxxxxxxxxxxx.xxx to double
double valD = ((int16_t)val) / pow (2, 3);
return (valD);
}
@@ -69,7 +69,7 @@ LteFfConverter::fpS11dot3toDouble(uint16_t val)
double
LteFfConverter::getMinFpS11dot3Value ()
{
return (-4096); // -4096 = 0x8000 = 1000 0000 0000 0000 b
return (-4096); // -4096 = 0x8000 = 1000 0000 0000 0000 b
}
//static double g_lowestFpS11dot3Value = -4096; // 0x8001 (1000 0000 0000 0000)

View File

@@ -47,7 +47,7 @@ public:
static uint16_t double2fpS11dot3 (double val);
static double fpS11dot3toDouble (uint16_t val);
static double getMinFpS11dot3Value ();
//static const double MIN_FP_S11DOT3_VALUE = -4096;

View File

@@ -305,7 +305,7 @@ LteEnbMac::GetTypeId (void)
.AddTraceSource ("UlScheduling",
"Information regarding UL scheduling.",
MakeTraceSourceAccessor (&LteEnbMac::m_ulScheduling))
;
;
return tid;
}
@@ -442,14 +442,14 @@ LteEnbMac::DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo)
cqiNum = m_ulCqiReceived.size ();
if (cqiNum >= 1)
{
ulcqiInfoReq.m_ulCqi = m_ulCqiReceived.at (cqiNum -1);
ulcqiInfoReq.m_ulCqi = m_ulCqiReceived.at (cqiNum - 1);
if (cqiNum > 1)
{
// empty old ul cqi
while (m_ulCqiReceived.size () > 0)
{
m_ulCqiReceived.pop_back ();
}
// empty old ul cqi
while (m_ulCqiReceived.size () > 0)
{
m_ulCqiReceived.pop_back ();
}
}
m_schedSapProvider->SchedUlCqiInfoReq (ulcqiInfoReq);
}
@@ -465,15 +465,15 @@ LteEnbMac::DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo)
// Get uplink transmission opportunities
FfMacSchedSapProvider::SchedUlTriggerReqParameters ulparams;
ulparams.m_sfnSf = ((0xFF & frameNo) << 4) | (0xF & subframeNo);
std::map <uint16_t,UlInfoListElement_s>::iterator it;
for (it = m_ulInfoListElements.begin (); it != m_ulInfoListElements.end (); it++)
{
ulparams.m_ulInfoList.push_back ((*it).second);
}
m_schedSapProvider->SchedUlTriggerReq (ulparams);
// reset UL info
@@ -514,9 +514,9 @@ void
LteEnbMac::DoUlCqiReport (UlCqi_s ulcqi)
{
if (ulcqi.m_type == UlCqi_s::PUSCH)
{
NS_LOG_DEBUG(this << " eNB rxed an PUSCH UL-CQI");
}
{
NS_LOG_DEBUG (this << " eNB rxed an PUSCH UL-CQI");
}
// TODO store UL-CQI to send them to scheduler
m_ulCqiReceived.push_back (ulcqi);
}
@@ -529,7 +529,7 @@ LteEnbMac::ReceiveDlCqiIdealControlMessage (Ptr<DlCqiIdealControlMessage> msg)
// NS_LOG_FUNCTION (this << msg->GetSourceDevice () << msg->GetDestinationDevice ());
CqiListElement_s dlcqi = msg->GetDlCqi ();
NS_LOG_FUNCTION(this << "Enb Received DL-CQI rnti" << dlcqi.m_rnti);
NS_LOG_FUNCTION (this << "Enb Received DL-CQI rnti" << dlcqi.m_rnti);
m_dlCqiReceived.push_back (dlcqi);
}
@@ -551,9 +551,9 @@ LteEnbMac::DoReceivePhyPdu (Ptr<Packet> p)
NS_LOG_FUNCTION (this);
LteMacTag tag;
p->RemovePacketTag (tag);
// store info of the packet received
std::map <uint16_t,UlInfoListElement_s>::iterator it;
// u_int rnti = tag.GetRnti ();
// u_int lcid = tag.GetLcid ();
@@ -568,15 +568,15 @@ LteEnbMac::DoReceivePhyPdu (Ptr<Packet> p)
ulinfonew.m_receptionStatus = UlInfoListElement_s::Ok;
ulinfonew.m_tpc = 0; // Tx power control not implemented at this stage
m_ulInfoListElements.insert (std::pair<uint16_t, UlInfoListElement_s > (tag.GetRnti (), ulinfonew));
}
else
{
(*it).second.m_ulReception.at (tag.GetLcid () - 1) += p->GetSize ();
(*it).second.m_receptionStatus = UlInfoListElement_s::Ok;
}
// forward the packet to the correspondent RLC
LteFlowId_t flow ( tag.GetRnti (), tag.GetLcid () );
@@ -721,7 +721,7 @@ LteEnbMac::DoSchedDlConfigInd (FfMacSchedSapUser::SchedDlConfigIndParameters ind
{
for (unsigned int j = 0; j < ind.m_buildDataList.at (i).m_rlcPduList.size (); j++)
{
for (uint16_t k = 0; k < ind.m_buildDataList.at (i).m_rlcPduList.at(j).size (); k++)
for (uint16_t k = 0; k < ind.m_buildDataList.at (i).m_rlcPduList.at (j).size (); k++)
{
LteFlowId_t flow (ind.m_buildDataList.at (i).m_rnti,
ind.m_buildDataList.at (i).m_rlcPduList.at (j).at (k).m_logicalChannelIdentity);
@@ -746,7 +746,7 @@ LteEnbMac::DoSchedDlConfigInd (FfMacSchedSapUser::SchedDlConfigIndParameters ind
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
@@ -757,7 +757,7 @@ LteEnbMac::DoSchedDlConfigInd (FfMacSchedSapUser::SchedDlConfigIndParameters ind
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
{
@@ -772,7 +772,7 @@ LteEnbMac::DoSchedUlConfigInd (FfMacSchedSapUser::SchedUlConfigIndParameters ind
{
NS_LOG_FUNCTION (this);
for (unsigned int i = 0; i < ind.m_dciList.size (); i++)
{
// send the correspondent ul dci
@@ -780,12 +780,12 @@ LteEnbMac::DoSchedUlConfigInd (FfMacSchedSapUser::SchedUlConfigIndParameters ind
msg->SetDci (ind.m_dciList.at (i));
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);
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);
}

View File

@@ -132,7 +132,7 @@ public:
* \param msg the BSR message
*/
void ReceiveBsrMessage (MacCeListElement_s bsr);
void DoUlCqiReport (UlCqi_s ulcqi);
@@ -188,13 +188,13 @@ private:
std::vector <CqiListElement_s> m_dlCqiReceived; // DL-CQI received
std::vector <UlCqi_s> m_ulCqiReceived; // UL-CQI received
std::vector <MacCeListElement_s> m_ulCeReceived; // CE received (BSR up to now)
/*
* Map of UE's info element (see 4.3.12 of FF MAC Scheduler API)
*/
std::map <uint16_t,UlInfoListElement_s> m_ulInfoListElements;
LteMacSapProvider* m_macSapProvider;

View File

@@ -56,22 +56,22 @@ TypeId LteEnbNetDevice::GetTypeId (void)
.SetParent<LteNetDevice> ()
.AddConstructor<LteEnbNetDevice> ()
.AddAttribute ("LteEnbRrc",
"The RRC associated to this EnbNetDevice",
"The RRC associated to this EnbNetDevice",
PointerValue (),
MakePointerAccessor (&LteEnbNetDevice::m_rrc),
MakePointerChecker <LteEnbRrc> ())
.AddAttribute ("LteEnbMac",
"The MAC associated to this EnbNetDevice",
"The MAC associated to this EnbNetDevice",
PointerValue (),
MakePointerAccessor (&LteEnbNetDevice::m_mac),
MakePointerChecker <LteEnbMac> ())
.AddAttribute ("FfMacScheduler",
"The scheduler associated to this EnbNetDevice",
"The scheduler associated to this EnbNetDevice",
PointerValue (),
MakePointerAccessor (&LteEnbNetDevice::m_scheduler),
MakePointerChecker <FfMacScheduler> ())
.AddAttribute ("LteEnbPhy",
"The PHY associated to this EnbNetDevice",
"The PHY associated to this EnbNetDevice",
PointerValue (),
MakePointerAccessor (&LteEnbNetDevice::m_phy),
MakePointerChecker <LteEnbPhy> ())
@@ -94,17 +94,17 @@ TypeId LteEnbNetDevice::GetTypeId (void)
MakeUintegerChecker<uint16_t> ())
.AddAttribute ("DlEarfcn",
"Downlink E-UTRA Absolute Radio Frequency Channel Number (EARFCN) "
"as per 3GPP 36.101 Section 5.7.3. ",
"as per 3GPP 36.101 Section 5.7.3. ",
UintegerValue (100),
MakeUintegerAccessor (&LteEnbNetDevice::m_dlEarfcn),
MakeUintegerChecker<uint16_t> ())
.AddAttribute ("UlEarfcn",
"Uplink E-UTRA Absolute Radio Frequency Channel Number (EARFCN) "
"as per 3GPP 36.101 Section 5.7.3. ",
"as per 3GPP 36.101 Section 5.7.3. ",
UintegerValue (18100),
MakeUintegerAccessor (&LteEnbNetDevice::m_ulEarfcn),
MakeUintegerChecker<uint16_t> ())
;
;
return tid;
}
@@ -179,7 +179,7 @@ LteEnbNetDevice::GetCellId () const
{
return m_cellId;
}
uint8_t
LteEnbNetDevice::GetUlBandwidth () const
{
@@ -196,10 +196,10 @@ LteEnbNetDevice::SetUlBandwidth (uint8_t bw)
case 25:
case 50:
case 75:
case 100:
case 100:
m_ulBandwidth = bw;
break;
default:
NS_FATAL_ERROR ("invalid bandwidth value " << (uint16_t) bw);
break;
@@ -222,10 +222,10 @@ LteEnbNetDevice::SetDlBandwidth (uint8_t bw)
case 25:
case 50:
case 75:
case 100:
case 100:
m_dlBandwidth = bw;
break;
default:
NS_FATAL_ERROR ("invalid bandwidth value " << (uint16_t) bw);
break;
@@ -261,7 +261,7 @@ void
LteEnbNetDevice::DoStart (void)
{
m_cellId = ++m_cellIdCounter;
UpdateConfig ();
UpdateConfig ();
m_phy->Start ();
m_mac->Start ();
m_rrc->Start ();
@@ -271,7 +271,7 @@ LteEnbNetDevice::DoStart (void)
bool
LteEnbNetDevice::DoSend (Ptr<Packet> packet, const Mac48Address& source,
const Mac48Address& dest, uint16_t protocolNumber)
const Mac48Address& dest, uint16_t protocolNumber)
{
NS_LOG_FUNCTION (this << source << dest << protocolNumber);
@@ -315,11 +315,11 @@ LteEnbNetDevice::UpdateConfig (void)
m_rrc->ConfigureCell (m_ulBandwidth, m_dlBandwidth);
// Configuring directly for now, but ideally we should use the PHY
// SAP instead. Probably should handle this through the RRC.
// SAP instead. Probably should handle this through the RRC.
m_phy->DoSetBandwidth (m_ulBandwidth, m_dlBandwidth);
m_phy->DoSetEarfcn (m_dlEarfcn, m_ulEarfcn);
m_phy->DoSetCellId (m_cellId);
}

View File

@@ -76,7 +76,7 @@ public:
* \return a pointer to the physical layer.
*/
Ptr<LteEnbPhy> GetPhy (void) const;
/**
* \return a pointer to the Radio Resource Control instance of the eNB
*/
@@ -129,7 +129,6 @@ public:
protected:
// inherited from Object
virtual void DoStart (void);
@@ -142,7 +141,7 @@ private:
void DoReceive (Ptr<Packet> p);
/**
/**
* Several attributes (e.g., the bandwidth) are exported as
* attributes of the LteEnbNetDevice from a user perspective, but
* are actually used also in other modules as well (the RRC, the
@@ -150,7 +149,7 @@ private:
* configuration of all modules so that their copy of the attribute
* values is in sync with the one in the LteEnbNetDevice.
*/
void UpdateConfig (void);
void UpdateConfig (void);
Ptr<LteEnbMac> m_mac;
@@ -160,16 +159,16 @@ private:
Ptr<FfMacScheduler> m_scheduler;
uint16_t m_cellId; /**< Cell Identifer. Part of the CGI, see TS 29.274, section 8.21.1 */
uint16_t m_cellId; /**< Cell Identifer. Part of the CGI, see TS 29.274, section 8.21.1 */
static uint16_t m_cellIdCounter;
static uint16_t m_cellIdCounter;
uint8_t m_dlBandwidth; /**< downlink bandwidth in RBs */
uint8_t m_ulBandwidth; /**< uplink bandwidth in RBs */
uint16_t m_dlEarfcn; /**< downlink carrier frequency */
uint16_t m_ulEarfcn; /**< uplink carrier frequency */
uint16_t m_dlEarfcn; /**< downlink carrier frequency */
uint16_t m_ulEarfcn; /**< uplink carrier frequency */
};
} // namespace ns3

View File

@@ -102,7 +102,7 @@ public:
* \param msg the Ideal Control Message to receive
*/
virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg) = 0;
/**
* \brief Returns to MAC level the UL-CQI evaluated
* \param ulcqi the UL-CQI (see FF MAC API 4.3.29)

View File

@@ -198,7 +198,7 @@ void
LteEnbPhy::SetNoiseFigure (double nf)
{
NS_LOG_FUNCTION (this << nf);
m_noiseFigure = nf;
m_noiseFigure = nf;
}
double
@@ -327,7 +327,7 @@ LteEnbPhy::StartSubFrame (void)
++m_nrSubFrames;
NS_LOG_INFO ("-----sub frame " << m_nrSubFrames << "-----");
// send the current burst of control messages
std::list<Ptr<IdealControlMessage> > ctrlMsg = GetControlMessages ();
std::vector <int> dlRb;
@@ -343,7 +343,7 @@ LteEnbPhy::StartSubFrame (void)
std::map <uint8_t, Ptr<LteUePhy> >::iterator it2;
Ptr<DlDciIdealControlMessage> dci = DynamicCast<DlDciIdealControlMessage> (msg);
it2 = m_ueAttached.find (dci->GetDci ().m_rnti);
if (it2 == m_ueAttached.end ())
{
NS_LOG_ERROR ("UE not attached");
@@ -373,15 +373,15 @@ LteEnbPhy::StartSubFrame (void)
std::map <uint8_t, Ptr<LteUePhy> >::iterator it2;
Ptr<UlDciIdealControlMessage> dci = DynamicCast<UlDciIdealControlMessage> (msg);
it2 = m_ueAttached.find (dci->GetDci ().m_rnti);
if (it2 == m_ueAttached.end ())
{
NS_LOG_ERROR ("UE not attached");
}
{
NS_LOG_ERROR ("UE not attached");
}
else
{
(*it2).second->ReceiveIdealControlMessage (msg);
}
{
(*it2).second->ReceiveIdealControlMessage (msg);
}
}
ctrlMsg.pop_front ();
it = ctrlMsg.begin ();
@@ -400,8 +400,8 @@ LteEnbPhy::StartSubFrame (void)
Ptr<LteEnbMac> macEntity = GetDevice ()->GetObject<LteEnbNetDevice> ()->GetMac ();
m_enbPhySapUser->SubframeIndication (m_nrFrames, m_nrSubFrames);
// trigger the UE(s)
std::map <uint8_t, Ptr<LteUePhy> >::iterator it;
for (it = m_ueAttached.begin (); it != m_ueAttached.end (); it++)
@@ -443,30 +443,30 @@ void
LteEnbPhy::GenerateCqiFeedback (const SpectrumValue& sinr)
{
NS_LOG_FUNCTION (this << sinr);
Ptr<LteEnbNetDevice> thisDevice = GetDevice ()->GetObject<LteEnbNetDevice> ();
m_enbPhySapUser->UlCqiReport (CreateUlCqiReport (sinr));
Ptr<LteEnbNetDevice> thisDevice = GetDevice ()->GetObject<LteEnbNetDevice> ();
m_enbPhySapUser->UlCqiReport (CreateUlCqiReport (sinr));
}
UlCqi_s
LteEnbPhy::CreateUlCqiReport (const SpectrumValue& sinr)
{
NS_LOG_FUNCTION (this << sinr);
NS_LOG_FUNCTION (this << sinr);
Values::const_iterator it;
UlCqi_s ulcqi;
ulcqi.m_type = UlCqi_s::PUSCH;
int i = 0;
for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++)
{
double sinrdb = 10*log10 ((*it));
// convert from double to fixed point notation Sxxxxxxxxxxx.xxx
int16_t sinrFp = LteFfConverter::double2fpS11dot3 (sinrdb);
ulcqi.m_sinr.push_back (sinrFp);
i++;
}
{
double sinrdb = 10 * log10 ((*it));
// convert from double to fixed point notation Sxxxxxxxxxxx.xxx
int16_t sinrFp = LteFfConverter::double2fpS11dot3 (sinrdb);
ulcqi.m_sinr.push_back (sinrFp);
i++;
}
return (ulcqi);
}

View File

@@ -43,19 +43,18 @@ class LteEnbPhy : public LtePhy
friend class EnbMemberLteEnbPhySapProvider;
public:
/**
/**
* @warning the default constructor should not be used
*/
LteEnbPhy ();
/**
*
/**
*
* \param dlPhy the downlink LteSpectrumPhy instance
* \param ulPhy the uplink LteSpectrumPhy instance
*/
LteEnbPhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy);
virtual ~LteEnbPhy ();
// inherited from Object
@@ -76,25 +75,25 @@ public:
*/
void SetLteEnbPhySapUser (LteEnbPhySapUser* s);
/**
/**
* \param pw the transmission power in dBm
*/
void SetTxPower (double pow);
void SetTxPower (double pow);
/**
* \return the transmission power in dBm
*/
double GetTxPower () const;
double GetTxPower () const;
/**
/**
* \param pw the noise figure in dB
*/
void SetNoiseFigure (double pow);
void SetNoiseFigure (double pow);
/**
* \return the noise figure in dB
*/
double GetNoiseFigure () const;
double GetNoiseFigure () const;
/**
* \brief Queue the MAC PDU to be sent
@@ -127,7 +126,7 @@ public:
* \param msg the received message
*/
virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
/**
* \brief Create the UL CQI feedback from SINR values perceived at
* the physical layer with the signal received from eNB
@@ -164,10 +163,10 @@ public:
* \brief PhySpectrum received a new PHY-PDU
*/
void PhyPduReceived (Ptr<Packet> p);
// inherited from LtePhy
virtual void GenerateCqiFeedback (const SpectrumValue& sinr);
private:
std::map <uint8_t, Ptr<LteUePhy> > m_ueAttached;

View File

@@ -71,20 +71,18 @@ class EnbRadioBearerInfo : public Object
{
public:
EnbRadioBearerInfo(void);
EnbRadioBearerInfo (void);
virtual ~EnbRadioBearerInfo (void);
static TypeId GetTypeId (void);
void SetRlc(Ptr<LteRlc> rlc);
void SetRlc (Ptr<LteRlc> rlc);
private:
Ptr<LteRlc> m_rlc;
};
NS_OBJECT_ENSURE_REGISTERED(EnbRadioBearerInfo);
NS_OBJECT_ENSURE_REGISTERED (EnbRadioBearerInfo);
EnbRadioBearerInfo::EnbRadioBearerInfo (void)
{
@@ -107,26 +105,26 @@ TypeId EnbRadioBearerInfo::GetTypeId (void)
PointerValue (),
MakePointerAccessor (&EnbRadioBearerInfo::m_rlc),
MakePointerChecker<LteRlc> ())
;
;
return tid;
}
void EnbRadioBearerInfo::SetRlc(Ptr<LteRlc> rlc)
void EnbRadioBearerInfo::SetRlc (Ptr<LteRlc> rlc)
{
m_rlc = rlc;
}
NS_OBJECT_ENSURE_REGISTERED(UeInfo);
NS_OBJECT_ENSURE_REGISTERED (UeInfo);
UeInfo::UeInfo (void) :
m_lastAllocatedId (0)
UeInfo::UeInfo (void)
: m_lastAllocatedId (0)
{
m_imsi = 0;
}
UeInfo::UeInfo (uint64_t imsi) :
m_lastAllocatedId (0)
UeInfo::UeInfo (uint64_t imsi)
: m_lastAllocatedId (0)
{
m_imsi = imsi;
}
@@ -152,7 +150,7 @@ TypeId UeInfo::GetTypeId (void)
UintegerValue (1),
MakeUintegerAccessor (&UeInfo::m_imsi),
MakeUintegerChecker<uint64_t> ())*/
;
;
return tid;
}
@@ -172,7 +170,7 @@ UeInfo::AddRadioBearer (Ptr<EnbRadioBearerInfo> rbi)
{
if (m_rbMap.find (lcid) == m_rbMap.end ())
{
m_rbMap.insert (std::pair<uint8_t, Ptr<EnbRadioBearerInfo> >(lcid, rbi));
m_rbMap.insert (std::pair<uint8_t, Ptr<EnbRadioBearerInfo> > (lcid, rbi));
m_lastAllocatedId = lcid;
return lcid;
}
@@ -183,7 +181,7 @@ UeInfo::AddRadioBearer (Ptr<EnbRadioBearerInfo> rbi)
}
Ptr<EnbRadioBearerInfo>
UeInfo::GetRadioBerer (uint8_t lcid)
UeInfo::GetRadioBearer (uint8_t lcid)
{
NS_LOG_FUNCTION (this << (uint32_t) lcid);
NS_ASSERT (0 != lcid);
@@ -246,32 +244,32 @@ LteEnbRrc::GetTypeId (void)
ObjectMapValue (),
MakeObjectMapAccessor (&LteEnbRrc::m_ueMap),
MakeObjectMapChecker<UeInfo> ())
;
;
return tid;
}
uint16_t
LteEnbRrc::GetLastAllocatedRnti() const
LteEnbRrc::GetLastAllocatedRnti () const
{
NS_LOG_FUNCTION (this);
return m_lastAllocatedRnti;
NS_LOG_FUNCTION (this);
return m_lastAllocatedRnti;
}
std::map<uint16_t,Ptr<UeInfo> > LteEnbRrc::GetUeMap(void) const
std::map<uint16_t,Ptr<UeInfo> > LteEnbRrc::GetUeMap (void) const
{
return m_ueMap;
return m_ueMap;
}
void LteEnbRrc::SetUeMap(std::map<uint16_t,Ptr<UeInfo> > ueMap)
void LteEnbRrc::SetUeMap (std::map<uint16_t,Ptr<UeInfo> > ueMap)
{
this->m_ueMap = ueMap;
}
void
LteEnbRrc::SetLastAllocatedRnti(uint16_t lastAllocatedRnti)
LteEnbRrc::SetLastAllocatedRnti (uint16_t lastAllocatedRnti)
{
NS_LOG_FUNCTION (this << lastAllocatedRnti);
m_lastAllocatedRnti = lastAllocatedRnti;
NS_LOG_FUNCTION (this << lastAllocatedRnti);
m_lastAllocatedRnti = lastAllocatedRnti;
}

View File

@@ -59,7 +59,7 @@ public:
*
* \return the EnbRadioBearerInfo of the selected radio bearer
*/
Ptr<EnbRadioBearerInfo> GetRadioBerer (uint8_t lcid);
Ptr<EnbRadioBearerInfo> GetRadioBearer (uint8_t lcid);
/**
@@ -169,10 +169,10 @@ public:
*/
void RemoveUe (uint16_t rnti);
uint16_t GetLastAllocatedRnti() const;
void SetLastAllocatedRnti(uint16_t lastAllocatedRnti);
void SetUeMap(std::map<uint16_t,Ptr<UeInfo> > ueMap);
std::map<uint16_t,Ptr<UeInfo> > GetUeMap(void) const;
uint16_t GetLastAllocatedRnti () const;
void SetLastAllocatedRnti (uint16_t lastAllocatedRnti);
void SetUeMap (std::map<uint16_t,Ptr<UeInfo> > ueMap);
std::map<uint16_t,Ptr<UeInfo> > GetUeMap (void) const;
/**
* Setup a new radio bearer for the given user

View File

@@ -77,7 +77,7 @@ LteInterference::StartRx (Ptr<const SpectrumValue> rxPsd)
for (std::list<Ptr<LteSinrChunkProcessor> >::const_iterator it = m_sinrChunkProcessorList.begin (); it != m_sinrChunkProcessorList.end (); ++it)
{
(*it)->Start ();
}
}
}
else
{
@@ -85,7 +85,7 @@ LteInterference::StartRx (Ptr<const SpectrumValue> rxPsd)
// receiving multiple simultaneous signals, make sure they are synchronized
NS_ASSERT (m_lastChangeTime == Now ());
// make sure they use orthogonal resource blocks
NS_ASSERT (Sum((*rxPsd)*(*m_rxSignal)) == 0.0);
NS_ASSERT (Sum ((*rxPsd) * (*m_rxSignal)) == 0.0);
(*m_rxSignal) += (*rxPsd);
}
}
@@ -141,12 +141,15 @@ void
LteInterference::ConditionallyEvaluateChunk ()
{
NS_LOG_FUNCTION (this);
if (m_receiving) NS_LOG_DEBUG (this << " Receiving");
if (m_receiving)
{
NS_LOG_DEBUG (this << " Receiving");
}
NS_LOG_DEBUG (this << " now " << Now () << " last " << m_lastChangeTime);
if (m_receiving && (Now () > m_lastChangeTime))
{
NS_LOG_LOGIC (this << " signal = " << *m_rxSignal << " allSignals = " << *m_allSignals << " noise = " << *m_noise);
SpectrumValue sinr = (*m_rxSignal) / ((*m_allSignals) - (*m_rxSignal) + (*m_noise));
Time duration = Now () - m_lastChangeTime;
for (std::list<Ptr<LteSinrChunkProcessor> >::const_iterator it = m_sinrChunkProcessorList.begin (); it != m_sinrChunkProcessorList.end (); ++it)
@@ -154,7 +157,7 @@ LteInterference::ConditionallyEvaluateChunk ()
(*it)->EvaluateSinrChunk (sinr, duration);
}
}
else
else
{
NS_LOG_DEBUG (this << " NO EV");
}

View File

@@ -33,7 +33,7 @@ LtePhyTag::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::LtePhyTag")
.SetParent<Tag> ()
.AddConstructor<LtePhyTag> ()
.AddConstructor<LtePhyTag> ()
;
return tid;
}

View File

@@ -55,7 +55,6 @@ public:
uint16_t GetCellId () const;
private:
uint16_t m_cellId;
};

View File

@@ -107,7 +107,7 @@ LtePhy::GetDevice ()
NS_LOG_FUNCTION (this);
return m_netDevice;
}
Ptr<LteSpectrumPhy>
LtePhy::GetDownlinkSpectrumPhy ()
{
@@ -222,8 +222,8 @@ LtePhy::DoSetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth)
void
LtePhy::DoSetEarfcn (uint16_t dlEarfcn, uint16_t ulEarfcn)
{
m_dlEarfcn = dlEarfcn;
m_ulEarfcn = ulEarfcn;
m_dlEarfcn = dlEarfcn;
m_ulEarfcn = ulEarfcn;
}
uint8_t
@@ -288,21 +288,21 @@ std::list<Ptr<IdealControlMessage> >
LtePhy::GetControlMessages (void)
{
if (m_controlMessagesQueue.at (0).size () > 0)
{
std::list<Ptr<IdealControlMessage> > ret = m_controlMessagesQueue.at (0);
m_controlMessagesQueue.erase (m_controlMessagesQueue.begin ());
std::list<Ptr<IdealControlMessage> > newlist;
m_controlMessagesQueue.push_back (newlist);
return (ret);
}
{
std::list<Ptr<IdealControlMessage> > ret = m_controlMessagesQueue.at (0);
m_controlMessagesQueue.erase (m_controlMessagesQueue.begin ());
std::list<Ptr<IdealControlMessage> > newlist;
m_controlMessagesQueue.push_back (newlist);
return (ret);
}
else
{
m_controlMessagesQueue.erase (m_controlMessagesQueue.begin ());
std::list<Ptr<IdealControlMessage> > newlist;
m_controlMessagesQueue.push_back (newlist);
std::list<Ptr<IdealControlMessage> > emptylist;
return (emptylist);
}
{
m_controlMessagesQueue.erase (m_controlMessagesQueue.begin ());
std::list<Ptr<IdealControlMessage> > newlist;
m_controlMessagesQueue.push_back (newlist);
std::list<Ptr<IdealControlMessage> > emptylist;
return (emptylist);
}
}

View File

@@ -89,7 +89,7 @@ public:
* \return a pointer to the LteSpectrumPhy instance that manages the uplink
*/
Ptr<LteSpectrumPhy> GetUplinkSpectrumPhy ();
/**
* \brief Queue the MAC PDU to be sent (according to m_macChTtiDelay)
* \param p the MAC PDU to sent
@@ -174,7 +174,7 @@ public:
*/
void DoSetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth);
/**
/**
*
* \param dlEarfcn the carrier frequency (EARFCN) in downlink
* \param ulEarfcn the carrier frequency (EARFCN) in downlink
@@ -186,7 +186,7 @@ public:
* \param cellId the Cell Identifier
*/
void DoSetCellId (uint16_t cellId);
/**
* \returns the RB gruop size according to the bandwidth
@@ -216,7 +216,7 @@ public:
* \param p queue control message to be sent
*/
void SetControlMessages (Ptr<IdealControlMessage> m);
/**
* \returns the list of control messages to be sent
*/
@@ -231,9 +231,8 @@ public:
virtual void GenerateCqiFeedback (const SpectrumValue& sinr) = 0;
protected:
protected:
Ptr<LteNetDevice> m_netDevice;
Ptr<LteSpectrumPhy> m_downlinkSpectrumPhy;
@@ -249,7 +248,7 @@ protected:
uint8_t m_ulBandwidth;
uint8_t m_dlBandwidth;
uint8_t m_rbgSize;
uint16_t m_dlEarfcn;
uint16_t m_ulEarfcn;

View File

@@ -26,15 +26,15 @@ namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (RlcTag);
RlcTag::RlcTag ():
m_senderTimestamp (Seconds (0))
RlcTag::RlcTag ()
: m_senderTimestamp (Seconds (0))
{
// Nothing to do here
}
RlcTag::RlcTag(Time senderTimestamp):
m_senderTimestamp (senderTimestamp)
RlcTag::RlcTag (Time senderTimestamp)
: m_senderTimestamp (senderTimestamp)
{
// Nothing to do here
@@ -64,7 +64,7 @@ RlcTag::GetSerializedSize (void) const
void
RlcTag::Serialize (TagBuffer i) const
{
int64_t senderTimestamp = m_senderTimestamp.GetNanoSeconds();
int64_t senderTimestamp = m_senderTimestamp.GetNanoSeconds ();
i.Write ((const uint8_t *)&senderTimestamp, sizeof(int64_t));
}
@@ -72,7 +72,7 @@ void
RlcTag::Deserialize (TagBuffer i)
{
int64_t senderTimestamp;
i.Read((uint8_t *)&senderTimestamp, 8);
i.Read ((uint8_t *)&senderTimestamp, 8);
m_senderTimestamp = NanoSeconds (senderTimestamp);
}

View File

@@ -25,8 +25,7 @@
#include "ns3/nstime.h"
namespace ns3
{
namespace ns3 {
class Tag;
@@ -37,8 +36,8 @@ class Tag;
class RlcTag : public Tag
{
public:
static TypeId GetTypeId(void);
virtual TypeId GetInstanceTypeId(void) const;
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
/**
* Create an empty RLC tag
@@ -49,15 +48,15 @@ public:
*/
RlcTag (Time senderTimestamp);
virtual void Serialize(TagBuffer i) const;
virtual void Deserialize(TagBuffer i);
virtual uint32_t GetSerializedSize() const;
virtual void Serialize (TagBuffer i) const;
virtual void Deserialize (TagBuffer i);
virtual uint32_t GetSerializedSize () const;
virtual void Print (std::ostream &os) const;
/**
* Get the instant when the RLC delivers the PDU to the MAC SAP provider
*/
Time getSenderTimestamp(void) const
Time getSenderTimestamp (void) const
{
return m_senderTimestamp;
}
@@ -66,13 +65,12 @@ public:
* Set the sender timestamp
* @param senderTimestamp time stamp of the instant when the RLC delivers the PDU to the MAC SAP provider
*/
void setSenderTimestamp(Time senderTimestamp)
void setSenderTimestamp (Time senderTimestamp)
{
this->m_senderTimestamp = senderTimestamp;
}
private:
Time m_senderTimestamp;
};

View File

@@ -99,7 +99,7 @@ TypeId LteRlc::GetTypeId (void)
.AddTraceSource ("RxPDU",
"PDU received.",
MakeTraceSourceAccessor (&LteRlc::m_rxPdu))
;
;
return tid;
}
@@ -163,7 +163,7 @@ LteRlcSm::GetTypeId (void)
static TypeId tid = TypeId ("ns3::LteRlcSm")
.SetParent<LteRlc> ()
.AddConstructor<LteRlcSm> ()
;
;
return tid;
}
@@ -173,12 +173,12 @@ LteRlcSm::DoReceivePdu (Ptr<Packet> p)
// RLC Performance evaluation
RlcTag rlcTag;
Time delay;
if (p->FindFirstMatchingByteTag(rlcTag))
if (p->FindFirstMatchingByteTag (rlcTag))
{
delay = Simulator::Now() - rlcTag.getSenderTimestamp ();
delay = Simulator::Now () - rlcTag.getSenderTimestamp ();
}
NS_LOG_FUNCTION (this << m_rnti << (uint32_t) m_lcid << p->GetSize () << delay.GetNanoSeconds ());
m_rxPdu(m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds () );
m_rxPdu (m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds () );
}
void
@@ -190,10 +190,10 @@ LteRlcSm::DoNotifyTxOpportunity (uint32_t bytes)
params.lcid = m_lcid;
// RLC Performance evaluation
RlcTag tag (Simulator::Now());
RlcTag tag (Simulator::Now ());
params.pdu->AddByteTag (tag);
NS_LOG_FUNCTION (this << m_rnti << (uint32_t) m_lcid << bytes);
m_txPdu(m_rnti, m_lcid, bytes);
m_txPdu (m_rnti, m_lcid, bytes);
m_macSapProvider->TransmitPdu (params);
}

View File

@@ -35,7 +35,7 @@ LteSinrChunkProcessor::~LteSinrChunkProcessor ()
LteCqiSinrChunkProcessor::LteCqiSinrChunkProcessor (Ptr<LtePhy> p)
: m_phy (p)
{
{
NS_LOG_FUNCTION (this << p);
NS_ASSERT (m_phy);
}
@@ -49,7 +49,7 @@ LteCqiSinrChunkProcessor::~LteCqiSinrChunkProcessor ()
void
LteCqiSinrChunkProcessor::Start ()
{
{
NS_LOG_FUNCTION (this);
m_sumSinr = 0;
m_totDuration = MicroSeconds (0);
@@ -63,14 +63,14 @@ LteCqiSinrChunkProcessor::EvaluateSinrChunk (const SpectrumValue& sinr, Time dur
if (m_sumSinr == 0)
{
m_sumSinr = Create<SpectrumValue> (sinr.GetSpectrumModel ());
}
}
(*m_sumSinr) += sinr * duration.GetSeconds ();
m_totDuration += duration;
}
void
LteCqiSinrChunkProcessor::End ()
{
{
NS_LOG_FUNCTION (this);
if (m_totDuration.GetSeconds () > 0)
{

View File

@@ -249,7 +249,7 @@ LteSpectrumPhy::StartTx (Ptr<PacketBurst> pb)
case TX:
NS_FATAL_ERROR ("cannot TX while already TX: the MAC should avoid this");
break;
case IDLE:
{
/*
@@ -259,7 +259,7 @@ LteSpectrumPhy::StartTx (Ptr<PacketBurst> pb)
*/
NS_ASSERT (m_txPsd);
m_txPacketBurst = pb;
// we need to convey some PHY meta information to the receiver
// to be used for simulation purposes (e.g., the CellId). This
// is done by adding an LtePhyTag to the first packet in the
@@ -268,7 +268,7 @@ LteSpectrumPhy::StartTx (Ptr<PacketBurst> pb)
LtePhyTag tag (m_cellId);
Ptr<Packet> firstPacketInBurst = *(pb->Begin ());
firstPacketInBurst->AddPacketTag (tag);
ChangeState (TX);
NS_ASSERT (m_channel);
double tti = 0.001;
@@ -278,7 +278,7 @@ LteSpectrumPhy::StartTx (Ptr<PacketBurst> pb)
}
return true;
break;
default:
NS_FATAL_ERROR ("uknown state");
return true;
@@ -331,20 +331,20 @@ LteSpectrumPhy::StartRx (Ptr<PacketBurst> pb, Ptr <const SpectrumValue> rxPsd, S
break;
case IDLE:
case RX:
case RX:
// the behavior is similar when
// we're IDLE or RX because we can receive more signals
// simultaneously (e.g., at the eNB).
// simultaneously (e.g., at the eNB).
{
// To check if we're synchronized to this signal, we check
// for the CellId which is reported in the LtePhyTag
NS_ASSERT (pb->Begin () != pb->End ());
NS_ASSERT (pb->Begin () != pb->End ());
LtePhyTag tag;
Ptr<Packet> firstPacketInBurst = *(pb->Begin ());
firstPacketInBurst->RemovePacketTag (tag);
if (tag.GetCellId () == m_cellId)
{
NS_LOG_LOGIC (this << " synchronized with this signal (cellId=" << tag.GetCellId () << ")");
{
NS_LOG_LOGIC (this << " synchronized with this signal (cellId=" << tag.GetCellId () << ")");
if (m_rxPacketBurstList.empty ())
{
NS_ASSERT (m_state == IDLE);
@@ -353,7 +353,7 @@ LteSpectrumPhy::StartRx (Ptr<PacketBurst> pb, Ptr <const SpectrumValue> rxPsd, S
m_firstRxStart = Simulator::Now ();
m_firstRxDuration = duration;
NS_LOG_LOGIC (this << " scheduling EndRx with delay " << duration);
Simulator::Schedule (duration, &LteSpectrumPhy::EndRx, this);
Simulator::Schedule (duration, &LteSpectrumPhy::EndRx, this);
}
else
{
@@ -365,24 +365,24 @@ LteSpectrumPhy::StartRx (Ptr<PacketBurst> pb, Ptr <const SpectrumValue> rxPsd, S
NS_ASSERT ((m_firstRxStart == Simulator::Now ())
&& (m_firstRxDuration == duration));
}
ChangeState (RX);
m_interference->StartRx (rxPsd);
m_phyRxStartTrace (pb);
m_phyRxStartTrace (pb);
m_rxPacketBurstList.push_back (pb);
NS_LOG_LOGIC (this << " numSimultaneousRxEvents = " << m_rxPacketBurstList.size ());
}
NS_LOG_LOGIC (this << " numSimultaneousRxEvents = " << m_rxPacketBurstList.size ());
}
else
{
NS_LOG_LOGIC (this << " not in sync with this signal (cellId="
<< tag.GetCellId () << ", m_cellId=" << m_cellId << ")");
<< tag.GetCellId () << ", m_cellId=" << m_cellId << ")");
}
}
break;
default:
NS_FATAL_ERROR ("unknown state");
break;
@@ -412,8 +412,8 @@ LteSpectrumPhy::EndRx ()
bool tbRxOk = true;
if (tbRxOk)
{
m_phyRxEndOkTrace (*i);
{
m_phyRxEndOkTrace (*i);
// forward each PDU in the PacketBurst separately to the MAC
// WILD HACK: we currently don't model properly the aggregation
@@ -421,15 +421,16 @@ LteSpectrumPhy::EndRx ()
// TBs, and it should be left to the MAC to decompose the TB into PDUs
for (std::list<Ptr<Packet> >::const_iterator j = (*i)->Begin ();
j != (*i)->End (); ++j)
{
{
if (!m_genericPhyRxEndOkCallback.IsNull ())
{
m_genericPhyRxEndOkCallback (*j);
m_genericPhyRxEndOkCallback (*j);
}
}
}
else
{ // TB received with errors
{
// TB received with errors
m_phyRxEndErrorTrace (*i);
}
}

View File

@@ -73,7 +73,7 @@ public:
Ptr<Object> GetDevice ();
Ptr<const SpectrumModel> GetRxSpectrumModel () const;
void StartRx (Ptr<PacketBurst> pb, Ptr <const SpectrumValue> rxPsd, SpectrumType st, Time duration);
/**
* Get the SpectrumType used by this PHY
@@ -146,14 +146,14 @@ public:
*/
void SetCellId (uint16_t cellId);
/**
*
*
* \param p the new LteSinrChunkProcessor to be added to the processing chain
*/
void AddSinrChunkProcessor (Ptr<LteSinrChunkProcessor> p);
private:
void ChangeState (State newState);
void EndTx ();

View File

@@ -38,43 +38,43 @@ namespace ns3 {
*/
struct EutraChannelNumbers
{
uint8_t band;
double fDlLow;
uint8_t band;
double fDlLow;
uint16_t nOffsDl;
uint16_t rangeNdl1;
uint16_t rangeNdl2;
double fUlLow;
double fUlLow;
uint16_t nOffsUl;
uint16_t rangeNul1;
uint16_t rangeNul2;
uint16_t rangeNul2;
} g_eutraChannelNumbers[] = {
{1, 2110, 0, 0, 599, 1920, 18000, 18000, 18599},
{2, 1930, 600, 600, 1199, 1850, 18600, 18600, 19199},
{3, 1805, 1200, 1200, 1949, 1710, 19200, 19200, 19949},
{4, 2110, 1950, 1950, 2399, 1710, 19950, 19950, 20399},
{5, 869, 2400, 2400, 2649, 824, 20400, 20400, 20649},
{6, 875, 2650, 2650, 2749, 830, 20650, 20650, 20749},
{7, 2620, 2750, 2750, 3449, 2500, 20750, 20750, 21449},
{8, 925, 3450, 3450, 3799, 880, 21450, 21450, 21799},
{9, 1844.9, 3800, 3800, 4149, 1749.9, 21800, 21800, 22149},
{10, 2110, 4150, 4150, 4749, 1710, 22150, 22150, 22749},
{11, 1475.9, 4750, 4750, 4949, 1427.9, 22750, 22750, 22949},
{12, 728, 5000, 5000, 5179, 698, 23000, 23000, 23179},
{13, 746, 5180, 5180, 5279, 777, 23180, 23180, 23279},
{14, 758, 5280, 5280, 5379, 788, 23280, 23280, 23379},
{17, 734, 5730, 5730, 5849, 704, 23730, 23730, 23849},
{18, 860, 5850, 5850, 5999, 815, 23850, 23850, 23999},
{19, 875, 6000, 6000, 6149, 830, 24000, 24000, 24149},
{20, 791, 6150, 6150, 6449, 832, 24150, 24150 - 24449},
{21, 1495.9, 6450, 6450, 6599, 1447.9, 24450, 24450, 24599},
{33, 1900, 36000, 36000, 36199, 1900, 36000, 36000, 36199},
{34, 2010, 36200, 36200, 36349, 2010, 36200, 36200, 36349},
{35, 1850, 36350, 36350, 36949, 1850, 36350, 36350, 36949},
{36, 1930, 36950, 36950, 37549, 1930, 36950, 36950, 37549},
{37, 1910, 37550, 37550, 37749, 1910, 37550, 37550, 37749},
{38, 2570, 37750, 37750, 38249, 2570, 37750, 37750, 38249},
{39, 1880, 38250, 38250, 38649, 1880, 38250, 38250, 38649},
{40, 2300, 38650, 38650, 39649, 2300, 38650, 38650, 39649}
{ 1, 2110, 0, 0, 599, 1920, 18000, 18000, 18599},
{ 2, 1930, 600, 600, 1199, 1850, 18600, 18600, 19199},
{ 3, 1805, 1200, 1200, 1949, 1710, 19200, 19200, 19949},
{ 4, 2110, 1950, 1950, 2399, 1710, 19950, 19950, 20399},
{ 5, 869, 2400, 2400, 2649, 824, 20400, 20400, 20649},
{ 6, 875, 2650, 2650, 2749, 830, 20650, 20650, 20749},
{ 7, 2620, 2750, 2750, 3449, 2500, 20750, 20750, 21449},
{ 8, 925, 3450, 3450, 3799, 880, 21450, 21450, 21799},
{ 9, 1844.9, 3800, 3800, 4149, 1749.9, 21800, 21800, 22149},
{ 10, 2110, 4150, 4150, 4749, 1710, 22150, 22150, 22749},
{ 11, 1475.9, 4750, 4750, 4949, 1427.9, 22750, 22750, 22949},
{ 12, 728, 5000, 5000, 5179, 698, 23000, 23000, 23179},
{ 13, 746, 5180, 5180, 5279, 777, 23180, 23180, 23279},
{ 14, 758, 5280, 5280, 5379, 788, 23280, 23280, 23379},
{ 17, 734, 5730, 5730, 5849, 704, 23730, 23730, 23849},
{ 18, 860, 5850, 5850, 5999, 815, 23850, 23850, 23999},
{ 19, 875, 6000, 6000, 6149, 830, 24000, 24000, 24149},
{ 20, 791, 6150, 6150, 6449, 832, 24150, 24150 - 24449},
{ 21, 1495.9, 6450, 6450, 6599, 1447.9, 24450, 24450, 24599},
{ 33, 1900, 36000, 36000, 36199, 1900, 36000, 36000, 36199},
{ 34, 2010, 36200, 36200, 36349, 2010, 36200, 36200, 36349},
{ 35, 1850, 36350, 36350, 36949, 1850, 36350, 36350, 36949},
{ 36, 1930, 36950, 36950, 37549, 1930, 36950, 36950, 37549},
{ 37, 1910, 37550, 37550, 37749, 1910, 37550, 37550, 37749},
{ 38, 2570, 37750, 37750, 38249, 2570, 37750, 37750, 38249},
{ 39, 1880, 38250, 38250, 38649, 1880, 38250, 38250, 38649},
{ 40, 2300, 38650, 38650, 39649, 2300, 38650, 38650, 39649}
};
#define NUM_EUTRA_BANDS (sizeof (g_eutraChannelNumbers) / sizeof (EutraChannelNumbers))
@@ -91,7 +91,7 @@ LteSpectrumValueHelper::GetCarrierFrequency (uint16_t earfcn)
else
{
// either FDD uplink or TDD (for which uplink & downlink have same frequency)
return GetUplinkCarrierFrequency (earfcn);
return GetUplinkCarrierFrequency (earfcn);
}
}
@@ -101,8 +101,8 @@ LteSpectrumValueHelper::GetDownlinkCarrierFrequency (uint16_t nDl)
NS_LOG_FUNCTION (nDl);
for (uint16_t i = 0; i < NUM_EUTRA_BANDS; ++i)
{
if ((g_eutraChannelNumbers[i].rangeNdl1 <= nDl) &&
(g_eutraChannelNumbers[i].rangeNdl2 >= nDl))
if ((g_eutraChannelNumbers[i].rangeNdl1 <= nDl)
&& (g_eutraChannelNumbers[i].rangeNdl2 >= nDl))
{
NS_LOG_LOGIC ("entry " << i << " fDlLow=" << g_eutraChannelNumbers[i].fDlLow);
return 1.0e6 * (g_eutraChannelNumbers[i].fDlLow + 0.1 * (nDl - g_eutraChannelNumbers[i].nOffsDl));
@@ -118,8 +118,8 @@ LteSpectrumValueHelper::GetUplinkCarrierFrequency (uint16_t nUl)
NS_LOG_FUNCTION (nUl);
for (uint16_t i = 0; i < NUM_EUTRA_BANDS; ++i)
{
if ((g_eutraChannelNumbers[i].rangeNul1 <= nUl) &&
(g_eutraChannelNumbers[i].rangeNul2 >= nUl))
if ((g_eutraChannelNumbers[i].rangeNul1 <= nUl)
&& (g_eutraChannelNumbers[i].rangeNul2 >= nUl))
{
NS_LOG_LOGIC ("entry " << i << " fUlLow=" << g_eutraChannelNumbers[i].fUlLow);
return 1.0e6 * (g_eutraChannelNumbers[i].fUlLow + 0.1 * (nUl - g_eutraChannelNumbers[i].nOffsUl));
@@ -145,8 +145,8 @@ LteSpectrumValueHelper::GetChannelBandwidth (uint8_t transmissionBandwidth)
return 10.0e6;
case 75:
return 15.0e6;
case 100:
return 20.0e6;
case 100:
return 20.0e6;
default:
NS_FATAL_ERROR ("invalid bandwidth value " << (uint16_t) transmissionBandwidth);
}
@@ -167,7 +167,7 @@ LteSpectrumModelId::LteSpectrumModelId (uint16_t f, uint8_t b)
bandwidth (b)
{
}
bool
operator < (const LteSpectrumModelId& a, const LteSpectrumModelId& b)
{
@@ -203,9 +203,9 @@ LteSpectrumValueHelper::GetSpectrumModel (uint16_t earfcn, uint8_t txBandwidthCo
f += 90e3;
rb.fc = f;
f += 90e3;
rb.fh = f;
rb.fh = f;
rbs.push_back (rb);
}
}
ret = Create<SpectrumModel> (rbs);
g_lteSpectrumModelMap.insert (std::pair<LteSpectrumModelId, Ptr<SpectrumModel> > (key, ret));
}
@@ -232,8 +232,8 @@ Ptr<SpectrumValue>
LteSpectrumValueHelper::CreateTxPowerSpectralDensity (uint16_t earfcn, uint8_t txBandwidthConfiguration, double powerTx, std::vector <int> activeRbs)
{
NS_LOG_FUNCTION (earfcn << (uint16_t) txBandwidthConfiguration << powerTx << activeRbs);
Ptr<SpectrumModel> model = GetSpectrumModel (earfcn, txBandwidthConfiguration);
Ptr<SpectrumModel> model = GetSpectrumModel (earfcn, txBandwidthConfiguration);
Ptr<SpectrumValue> txPsd = Create <SpectrumValue> (model);
// powerTx is expressed in dBm. We must convert it into natural unit.
@@ -258,7 +258,7 @@ LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (uint16_t earfcn, uint8_
{
NS_LOG_FUNCTION (earfcn << (uint16_t) txBandwidthConfiguration << noiseFigure);
Ptr<SpectrumModel> model = GetSpectrumModel (earfcn, txBandwidthConfiguration);
return CreateNoisePowerSpectralDensity (noiseFigure, model);
return CreateNoisePowerSpectralDensity (noiseFigure, model);
}
Ptr<SpectrumValue>
@@ -270,8 +270,8 @@ LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (double noiseFigureDb, P
// see "LTE - From theory to practice"
// Section 22.4.4.2 Thermal Noise and Receiver Noise Figure
const double kT_dBm_Hz = -174.0; // dBm/Hz
double kT_W_Hz = pow (10.0, (kT_dBm_Hz - 30)/10.0);
double noiseFigureLinear = pow (10.0, noiseFigureDb / 10.0);
double kT_W_Hz = pow (10.0, (kT_dBm_Hz - 30) / 10.0);
double noiseFigureLinear = pow (10.0, noiseFigureDb / 10.0);
double noisePowerSpectralDensity = kT_W_Hz * noiseFigureLinear;
Ptr<SpectrumValue> noisePsd = Create <SpectrumValue> (spectrumModel);

View File

@@ -36,76 +36,74 @@ namespace ns3 {
class LteSpectrumValueHelper
{
public:
/**
/**
* Calculates the carrier frequency from the E-UTRA Absolute
* Radio Frequency Channel Number (EARFCN) according to 3GPP TS
* 36.101 section 5.7.3 "Carrier frequency and EARFCN".
*
* \param earfcn the EARFCN
*
*
* \return the carrier frequency in Hz
*/
static double GetCarrierFrequency (uint16_t earfcn);
/**
/**
* Calculates the dowlink carrier frequency from the E-UTRA Absolute
* Radio Frequency Channel Number (EARFCN) using the formula in 3GPP TS
* 36.101 section 5.7.3 "Carrier frequency and EARFCN".
*
* \param earfcn the EARFCN
*
*
* \return the dowlink carrier frequency in Hz
*/
static double GetDownlinkCarrierFrequency (uint16_t earfcn);
/**
/**
* Calculates the uplink carrier frequency from the E-UTRA Absolute
* Radio Frequency Channel Number (EARFCN) using the formula in 3GPP TS
* 36.101 section 5.7.3 "Carrier frequency and EARFCN".
*
* \param earfcn the EARFCN
*
*
* \return the uplink carrier frequency in Hz
*/
static double GetUplinkCarrierFrequency (uint16_t earfcn);
static double GetUplinkCarrierFrequency (uint16_t earfcn);
/**
*
*
/**
*
*
* \param txBandwidthConf the tranmission bandwidth
* configuration in number of resource blocks
*
*
* \return the nominal channel bandwidth in Hz as per 3GPP TS 36.101
*/
static double GetChannelBandwidth (uint8_t txBandwidthConf);
/**
*
* \param earfcn the carrier frequency (EARFCN) at which reception
* is made
* \param bandwidth the Transmission Bandwidth Configuration in
* number of resource blocks
*
* \return the static SpectrumModel instance corresponding to the
* given carrier frequency and transmission bandwidth
* configuration. If such SpectrumModel does not exist, it is
* created.
*/
/**
*
* \param earfcn the carrier frequency (EARFCN) at which reception
* is made
* \param bandwidth the Transmission Bandwidth Configuration in
* number of resource blocks
*
* \return the static SpectrumModel instance corresponding to the
* given carrier frequency and transmission bandwidth
* configuration. If such SpectrumModel does not exist, it is
* created.
*/
static Ptr<SpectrumModel> GetSpectrumModel (uint16_t earfcn, uint8_t bandwdith);
/**
* create a spectrum value representing the power spectral
* density of a signal to be transmitted. See 3GPP TS 36.101 for
* density of a signal to be transmitted. See 3GPP TS 36.101 for
* a definition of most of the parameters described here.
*
* \param earfcn the carrier frequency (EARFCN) of the transmission
* \param bandwidth the Transmission Bandwidth Configuration in
* number of resource blocks
* \param txPower the total power in dBm over the whole bandwidth
* \param ActiveRbs the list of Active Resource Blocks (PRBs)
* \param ActiveRbs the list of Active Resource Blocks (PRBs)
*
* \return a pointer to a newly allocated SpectrumValue representing the TX Power Spectral Density in W/Hz for each Resource Block
*/
@@ -114,23 +112,23 @@ public:
/**
* create a SpectrumValue that models the power spectral density of AWGN
*
*
* \param earfcn the carrier frequency (EARFCN) at which reception
* is made
* \param bandwidth the Transmission Bandwidth Configuration in
* number of resource blocks
* \param noiseFigure the noise figure in dB w.r.t. a reference temperature of 290K
*
*
* \return a pointer to a newly allocated SpectrumValue representing the noise Power Spectral Density in W/Hz for each Resource Block
*/
static Ptr<SpectrumValue> CreateNoisePowerSpectralDensity (uint16_t earfcn, uint8_t bandwdith, double noiseFigure);
/**
/**
* create a SpectrumValue that models the power spectral density of AWGN
*
*
* \param noiseFigure the noise figure in dB w.r.t. a reference temperature of 290K
* \param spectrumModel the SpectrumModel instance to be used
*
*
* \return a pointer to a newly allocated SpectrumValue representing the noise Power Spectral Density in W/Hz for each Resource Block
*/
static Ptr<SpectrumValue> CreateNoisePowerSpectralDensity (double noiseFigure, Ptr<SpectrumModel> spectrumModel);

View File

@@ -339,7 +339,7 @@ LteUeMac::DoReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
std::map <uint8_t, LteMacSapUser*>::iterator it;
it = m_macSapUserMap.begin (); // use only the first LC --> UE-SCHEDULER??
(*it).second->NotifyTxOpportunity (dci.m_tbSize);
}
else
{

View File

@@ -61,13 +61,13 @@ TypeId LteUeNetDevice::GetTypeId (void)
PointerValue (),
MakePointerAccessor (&LteUeNetDevice::m_rrc),
MakePointerChecker <LteUeRrc> ())
.AddAttribute("Imsi",
"International Mobile Subscriber Identity assigned to this UE",
TypeId::ATTR_GET,
UintegerValue (0), // not used because the attribute is read-only
MakeUintegerAccessor (&LteUeNetDevice::m_imsi),
MakeUintegerChecker<uint64_t> ())
;
.AddAttribute ("Imsi",
"International Mobile Subscriber Identity assigned to this UE",
TypeId::ATTR_GET,
UintegerValue (0), // not used because the attribute is read-only
MakeUintegerAccessor (&LteUeNetDevice::m_imsi),
MakeUintegerChecker<uint64_t> ())
;
return tid;
}
@@ -179,7 +179,7 @@ LteUeNetDevice::DoStart (void)
bool
LteUeNetDevice::DoSend (Ptr<Packet> packet, const Mac48Address& source,
const Mac48Address& dest, uint16_t protocolNumber)
const Mac48Address& dest, uint16_t protocolNumber)
{
NS_LOG_FUNCTION (this);

View File

@@ -85,7 +85,6 @@ public:
protected:
// inherited from Object
virtual void DoStart (void);

View File

@@ -102,9 +102,11 @@ LteUePhy::LteUePhy ()
LteUePhy::LteUePhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy)
: LtePhy (dlPhy, ulPhy),
m_p10CqiPeriocity (MilliSeconds (1)), // ideal behavior
m_p10CqiPeriocity (MilliSeconds (1)),
// ideal behavior
m_p10CqiLast (MilliSeconds (0)),
m_a30CqiPeriocity (MilliSeconds (1)), // ideal behavior
m_a30CqiPeriocity (MilliSeconds (1)),
// ideal behavior
m_a30CqiLast (MilliSeconds (0))
{
m_uePhySapProvider = new UeMemberLteUePhySapProvider (this);
@@ -122,7 +124,7 @@ LteUePhy::DoDispose ()
delete m_uePhySapProvider;
LtePhy::DoDispose ();
}
TypeId
@@ -312,7 +314,7 @@ LteUePhy::CreateDlCqiFeedbackMessage (const SpectrumValue& sinr)
// CREATE CqiIdealControlMessage
Ptr<DlCqiIdealControlMessage> msg = Create<DlCqiIdealControlMessage> ();
CqiListElement_s dlcqi;
if (Simulator::Now () > m_p10CqiLast + m_p10CqiPeriocity)
{
@@ -322,7 +324,7 @@ LteUePhy::CreateDlCqiFeedbackMessage (const SpectrumValue& sinr)
// average the CQIs of the different RBs
for (int i = 0; i < nbSubChannels; i++)
{
if (cqi.at (i)!=-1)
if (cqi.at (i) != -1)
{
cqiSum += cqi.at (i);
activeSubChannels++;
@@ -332,7 +334,7 @@ LteUePhy::CreateDlCqiFeedbackMessage (const SpectrumValue& sinr)
dlcqi.m_rnti = m_rnti;
dlcqi.m_ri = 1; // not yet used
dlcqi.m_cqiType = CqiListElement_s::P10; // Peridic CQI using PUCCH wideband
if (activeSubChannels>0)
if (activeSubChannels > 0)
{
dlcqi.m_wbCqi.push_back ((uint16_t) cqiSum / activeSubChannels);
}
@@ -345,7 +347,7 @@ LteUePhy::CreateDlCqiFeedbackMessage (const SpectrumValue& sinr)
dlcqi.m_wbPmi = 0; // not yet used
// dl.cqi.m_sbMeasResult others CQI report modes: not yet implemented
}
else if(Simulator::Now () > m_a30CqiLast + m_a30CqiPeriocity)
else if (Simulator::Now () > m_a30CqiLast + m_a30CqiPeriocity)
{
int nbSubChannels = cqi.size ();
int rbgSize = GetRbgSize ();
@@ -354,25 +356,25 @@ LteUePhy::CreateDlCqiFeedbackMessage (const SpectrumValue& sinr)
SbMeasResult_s rbgMeas;
//NS_LOG_DEBUG (this << " Create A30 CQI feedback, RBG " << rbgSize << " cqiNum " << nbSubChannels << " band " << (uint16_t)m_dlBandwidth);
for (int i = 0; i < nbSubChannels; i++)
{
if (cqi.at (i)!=-1)
{
cqiSum += cqi.at (i);
}
// else "nothing" no CQI is treated as CQI = 0 (worst case scenario)
cqiNum++;
if (cqiNum == rbgSize)
{
// average the CQIs of the different RBGs
//NS_LOG_DEBUG (this << " RBG CQI " << (uint16_t) cqiSum / rbgSize);
HigherLayerSelected_s hlCqi;
hlCqi.m_sbPmi = 0; // not yet used
hlCqi.m_sbCqi.push_back ((uint16_t) cqiSum / rbgSize); // only CW0 (SISO mode)
rbgMeas.m_higherLayerSelected.push_back (hlCqi);
cqiSum = 0.0;
cqiNum = 0;
}
}
{
if (cqi.at (i) != -1)
{
cqiSum += cqi.at (i);
}
// else "nothing" no CQI is treated as CQI = 0 (worst case scenario)
cqiNum++;
if (cqiNum == rbgSize)
{
// average the CQIs of the different RBGs
//NS_LOG_DEBUG (this << " RBG CQI " << (uint16_t) cqiSum / rbgSize);
HigherLayerSelected_s hlCqi;
hlCqi.m_sbPmi = 0; // not yet used
hlCqi.m_sbCqi.push_back ((uint16_t) cqiSum / rbgSize); // only CW0 (SISO mode)
rbgMeas.m_higherLayerSelected.push_back (hlCqi);
cqiSum = 0.0;
cqiNum = 0;
}
}
dlcqi.m_rnti = m_rnti;
dlcqi.m_ri = 1; // not yet used
dlcqi.m_cqiType = CqiListElement_s::A30; // Aperidic CQI using PUSCH
@@ -380,7 +382,7 @@ LteUePhy::CreateDlCqiFeedbackMessage (const SpectrumValue& sinr)
dlcqi.m_wbPmi = 0; // not yet used
dlcqi.m_sbMeasResult = rbgMeas;
}
msg->SetDlCqi (dlcqi);
return msg;
}
@@ -465,7 +467,7 @@ void
LteUePhy::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
{
// trigger from eNB
// send control messages
std::list<Ptr<IdealControlMessage> > ctrlMsg = GetControlMessages ();
if (ctrlMsg.size () > 0)
@@ -481,7 +483,7 @@ LteUePhy::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
it = ctrlMsg.begin ();
}
}
// send packets in queue
// send the current burts of packets
Ptr<PacketBurst> pb = GetPacketBurst ();
@@ -489,7 +491,7 @@ LteUePhy::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
{
m_uplinkSpectrumPhy->StartTx (pb);
}
}

View File

@@ -49,20 +49,18 @@ class LteUePhy : public LtePhy
friend class UeMemberLteUePhySapProvider;
public:
/**
/**
* @warning the default constructor should not be used
*/
LteUePhy ();
/**
*
/**
*
* \param dlPhy the downlink LteSpectrumPhy instance
* \param ulPhy the uplink LteSpectrumPhy instance
*/
LteUePhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy);
virtual ~LteUePhy ();
// inherited from Object
@@ -83,24 +81,24 @@ public:
void SetLteUePhySapUser (LteUePhySapUser* s);
/**
/**
* \param pw the transmission power in dBm
*/
void SetTxPower (double pow);
void SetTxPower (double pow);
/**
* \return the transmission power in dBm
*/
double GetTxPower () const;
/**
double GetTxPower () const;
/**
* \param pw the noise figure in dB
*/
void SetNoiseFigure (double pow);
void SetNoiseFigure (double pow);
/**
* \return the noise figure in dB
*/
double GetNoiseFigure () const;
double GetNoiseFigure () const;
/**
* \brief Queue the MAC PDU to be sent
@@ -163,8 +161,8 @@ public:
* \brief PhySpectrum received a new PHY-PDU
*/
void PhyPduReceived (Ptr<Packet> p);
/**
* \brief trigger from eNB the start from a new frame
*
@@ -180,12 +178,12 @@ public:
void SetRnti (uint16_t rnti);
/**
* set the cellId of the eNb this PHY is synchronized with
*
/**
* set the cellId of the eNb this PHY is synchronized with
*
* \param cellId the cell identifier of the eNB
*/
void SetEnbCellId (uint16_t cellId);
void SetEnbCellId (uint16_t cellId);
private:
@@ -194,7 +192,7 @@ private:
Time m_p10CqiPeriocity; /**< Wideband Periodic CQI: 2, 5, 10, 16, 20, 32, 40, 64, 80 or 160 ms */
Time m_p10CqiLast;
/**< SubBand Aperiodic CQI: activated by DCI format 0 or Random Access Response Grant */
// NOTE defines a periodicity for academic studies
Time m_a30CqiPeriocity;
@@ -206,7 +204,7 @@ private:
uint16_t m_rnti;
uint16_t m_enbCellId;
};

View File

@@ -112,7 +112,7 @@ LteUeRrc::GetTypeId (void)
UintegerValue (1),
MakeUintegerAccessor (&LteUeRrc::m_rnti),
MakeUintegerChecker<uint16_t> ())
;
;
return tid;
}
@@ -195,9 +195,9 @@ std::vector<uint8_t>
LteUeRrc::GetLcIdVector ()
{
std::vector<uint8_t> v;
for (std::map<uint8_t, Ptr<LteRlc> >::iterator it = m_rlcMap.begin(); it != m_rlcMap.end(); ++it)
for (std::map<uint8_t, Ptr<LteRlc> >::iterator it = m_rlcMap.begin (); it != m_rlcMap.end (); ++it)
{
v.push_back(it->first);
v.push_back (it->first);
}
return v;
}

View File

@@ -211,8 +211,9 @@ PfFfMacScheduler::PfFfMacScheduler ()
: m_cschedSapUser (0),
m_schedSapUser (0),
m_timeWindow (99.0),
m_schedTtiDelay (2), // WILD ACK: based on a m_macChTtiDelay = 1
m_nextRntiUl(0)
m_schedTtiDelay (2),
// WILD ACK: based on a m_macChTtiDelay = 1
m_nextRntiUl (0)
{
m_cschedSapProvider = new PfSchedulerMemberCschedSapProvider (this);
m_schedSapProvider = new PfSchedulerMemberSchedSapProvider (this);
@@ -290,12 +291,12 @@ void
PfFfMacScheduler::DoCschedLcConfigReq (const struct FfMacCschedSapProvider::CschedLcConfigReqParameters& params)
{
NS_LOG_FUNCTION (this << " New LC, rnti: " << params.m_rnti);
std::map <uint16_t, pfsFlowPerf_t>::iterator it;
for (uint16_t i = 0; i < params.m_logicalChannelConfigList.size (); i++)
{
{
it = m_flowStatsDl.find (params.m_rnti);
if (it == m_flowStatsDl.end ())
{
pfsFlowPerf_t flowStatsDl;
@@ -316,7 +317,7 @@ PfFfMacScheduler::DoCschedLcConfigReq (const struct FfMacCschedSapProvider::Csch
NS_LOG_ERROR ("RNTI already exists");
}
}
return;
}
@@ -342,13 +343,13 @@ PfFfMacScheduler::DoSchedDlRlcBufferReq (const struct FfMacSchedSapProvider::Sch
{
NS_LOG_FUNCTION (this << params.m_rnti << (uint32_t) params.m_logicalChannelIdentity);
// API generated by RLC for updating RLC parameters on a LC (tx and retx queues)
std::map <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
LteFlowId_t flow (params.m_rnti, params.m_logicalChannelIdentity);
it = m_rlcBufferReq.find (flow);
if (it == m_rlcBufferReq.end ())
{
m_rlcBufferReq.insert (std::pair <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters> (flow, params));
@@ -356,8 +357,8 @@ PfFfMacScheduler::DoSchedDlRlcBufferReq (const struct FfMacSchedSapProvider::Sch
else
{
(*it).second = params;
}
}
return;
}
@@ -393,15 +394,15 @@ PfFfMacScheduler::GetRbgSize (int dlbandwidth)
int
PfFfMacScheduler::LcActivePerFlow(uint16_t rnti)
PfFfMacScheduler::LcActivePerFlow (uint16_t rnti)
{
std::map <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
int lcActive = 0;
for (it = m_rlcBufferReq.begin (); it!= m_rlcBufferReq.end (); it++)
for (it = m_rlcBufferReq.begin (); it != m_rlcBufferReq.end (); it++)
{
if (((*it).first.m_rnti == rnti) && (((*it).second.m_rlcTransmissionQueueSize>0) ||
((*it).second.m_rlcRetransmissionQueueSize>0) ||
((*it).second.m_rlcStatusPduSize>0) ))
if (((*it).first.m_rnti == rnti) && (((*it).second.m_rlcTransmissionQueueSize > 0)
|| ((*it).second.m_rlcRetransmissionQueueSize > 0)
|| ((*it).second.m_rlcStatusPduSize > 0) ))
{
lcActive++;
}
@@ -418,10 +419,10 @@ PfFfMacScheduler::LcActivePerFlow(uint16_t rnti)
void
PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::SchedDlTriggerReqParameters& params)
{
NS_LOG_FUNCTION (this << " Frame no. " << (params.m_sfnSf>>4) << " subframe no. " << (0xF & params.m_sfnSf));
NS_LOG_FUNCTION (this << " Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf));
// API generated by RLC for triggering the scheduling of a DL subframe
// evaluate the relative channel quality indicator for each UE per each RBG
// (since we are using allocation type 0 the small unit of allocation is RBG)
// Resource allocation type 0 (see sec 7.1.6.1 of 36.213)
@@ -456,19 +457,19 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
{
// this UE has data to transmit
uint8_t mcs = LteAmc::GetMcsFromCqi (cqi);
double achievableRate = ((LteAmc::GetTbSizeFromMcs (mcs, 1) / 8)/0.001); // = TB size / TTI
double achievableRate = ((LteAmc::GetTbSizeFromMcs (mcs, 1) / 8) / 0.001); // = TB size / TTI
double rcqi = achievableRate / (*it).second.lastAveragedThroughput;
// NS_LOG_DEBUG (this << " RNTI " << (*it).first << " MCS " << (uint32_t)mcs << " achievableRate " << achievableRate << " avgThr " << (*it).second.lastAveragedThroughput << " RCQI " << rcqi);
if (rcqi > rcqiMax)
{
rcqiMax = rcqi;
itMax = it;
}
}
} // end if cqi
} // end if cqi
} // end for m_rlcBufferReq
if (itMax == m_flowStatsDl.end ())
{
// no UE available for this RB
@@ -492,14 +493,14 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
// NS_LOG_DEBUG (this << " UE assigned " << (*itMax).first);
}
} // end for RBGs
// reset TTI stats of users
std::map <uint16_t, pfsFlowPerf_t>::iterator itStats;
for (itStats = m_flowStatsDl.begin (); itStats != m_flowStatsDl.end (); itStats++)
{
(*itStats).second.lastTtiBytesTrasmitted = 0;
}
// generate the transmission opportunities by grouping the RBGs of the same RNTI and
// creating the correspondent DCIs
FfMacSchedSapUser::SchedDlConfigIndParameters ret;
@@ -513,7 +514,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
DlDciListElement_s newDci;
std::vector <struct RlcPduListElement_s> newRlcPduLe;
newDci.m_rnti = (*itMap).first;
uint16_t lcActives = LcActivePerFlow ((*itMap).first);
// NS_LOG_DEBUG (this << "Allocate user " << newEl.m_rnti << " rbg " << lcActives);
uint16_t RgbPerRnti = (*itMap).second.size ();
@@ -521,20 +522,20 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
itCqi = m_a30CqiRxed.find ((*itMap).first);
uint8_t worstCqi = 15;
for (uint16_t k = 0; k < (*itMap).second.size (); k++)
{
if ((*itCqi).second.m_higherLayerSelected.size () > (*itMap).second.at (k))
{
{
if ((*itCqi).second.m_higherLayerSelected.size () > (*itMap).second.at (k))
{
// NS_LOG_DEBUG (this << " RBG " << (*itMap).second.at (k) << " CQI " << (uint16_t)((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (0)) );
if (((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (0)) < worstCqi)
{
worstCqi = ((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (0));
}
}
else
{
worstCqi = 1; // try with lowest MCS in RBG with no info on channel
}
}
if (((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (0)) < worstCqi)
{
worstCqi = ((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (0));
}
}
else
{
worstCqi = 1; // try with lowest MCS in RBG with no info on channel
}
}
// NS_LOG_DEBUG (this << " CQI " << (uint16_t)worstCqi);
newDci.m_mcs.push_back (LteAmc::GetMcsFromCqi (worstCqi));
int tbSize = (LteAmc::GetTbSizeFromMcs (newDci.m_mcs.at (0), RgbPerRnti * rbgSize) / 8); // (size of TB in bytes according to table 7.1.7.2.1-1 of 36.213)
@@ -553,11 +554,11 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
// create the rlc PDUs -> equally divide resources among actives LCs
int rlcPduSize = tbSize / lcActives;
std::map <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator itBufReq;
for (itBufReq = m_rlcBufferReq.begin (); itBufReq!= m_rlcBufferReq.end (); itBufReq++)
for (itBufReq = m_rlcBufferReq.begin (); itBufReq != m_rlcBufferReq.end (); itBufReq++)
{
if (((*itBufReq).first.m_rnti == (*itMap).first) && (((*itBufReq).second.m_rlcTransmissionQueueSize>0) ||
((*itBufReq).second.m_rlcRetransmissionQueueSize>0) ||
((*itBufReq).second.m_rlcStatusPduSize>0) ))
if (((*itBufReq).first.m_rnti == (*itMap).first) && (((*itBufReq).second.m_rlcTransmissionQueueSize > 0)
|| ((*itBufReq).second.m_rlcRetransmissionQueueSize > 0)
|| ((*itBufReq).second.m_rlcStatusPduSize > 0) ))
{
RlcPduListElement_s newRlcEl;
newRlcEl.m_logicalChannelIdentity = (*itBufReq).first.m_lcId;
@@ -572,33 +573,33 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
}
newDci.m_ndi.push_back (1); // TBD (new data indicator)
newDci.m_rv.push_back (0); // TBD (redundancy version)
newEl.m_dci = newDci;
// ...more parameters -> ingored in this version
newEl.m_rlcPduList.push_back (newRlcPduLe);
ret.m_buildDataList.push_back (newEl);
// update UE stats
std::map <uint16_t, pfsFlowPerf_t>::iterator it;
it = m_flowStatsDl.find ((*itMap).first);
if (it != m_flowStatsDl.end())
if (it != m_flowStatsDl.end ())
{
(*it).second.lastTtiBytesTrasmitted = tbSize;
// NS_LOG_DEBUG (this << " UE bytes txed " << (*it).second.lastTtiBytesTrasmitted);
}
else
{
NS_LOG_DEBUG (this << " No Stats for this allocated UE");
NS_LOG_DEBUG (this << " No Stats for this allocated UE");
}
itMap++;
} // end while allocation
ret.m_nrOfPdcchOfdmSymbols = 1; // TODO: check correct value according the DCIs txed
// update UEs stats
for (itStats = m_flowStatsDl.begin (); itStats != m_flowStatsDl.end (); itStats++)
{
@@ -609,9 +610,9 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
// NS_LOG_DEBUG (this << " UE avg thr " << (*itStats).second.lastAveragedThroughput);
(*itStats).second.lastTtiBytesTrasmitted = 0;
}
m_schedSapUser->SchedDlConfigInd (ret);
return;
}
@@ -676,84 +677,84 @@ PfFfMacScheduler::DoSchedDlCqiInfoReq (const struct FfMacSchedSapProvider::Sched
double
PfFfMacScheduler::EstimateUlSinr(uint16_t rnti, uint16_t rb)
PfFfMacScheduler::EstimateUlSinr (uint16_t rnti, uint16_t rb)
{
std::map <uint16_t, std::vector <double> >::iterator itCqi = m_ueCqi.find (rnti);
if (itCqi == m_ueCqi.end ())
{
// no cqi info about this UE
return (NO_SINR);
}
{
// no cqi info about this UE
return (NO_SINR);
}
else
{
// take the average SINR value among the available
double sinrSum = 0;
int sinrNum = 0;
for (uint32_t i = 0; i < m_cschedCellConfig.m_ulBandwidth; i++)
{
double sinr = (*itCqi).second.at(i);
if (sinr != NO_SINR)
{
sinrSum += sinr;
sinrNum++;
}
}
double estimatedSinr = sinrSum / (double)sinrNum;
// store the value
(*itCqi).second.at(rb) = estimatedSinr;
return (estimatedSinr);
}
{
// take the average SINR value among the available
double sinrSum = 0;
int sinrNum = 0;
for (uint32_t i = 0; i < m_cschedCellConfig.m_ulBandwidth; i++)
{
double sinr = (*itCqi).second.at (i);
if (sinr != NO_SINR)
{
sinrSum += sinr;
sinrNum++;
}
}
double estimatedSinr = sinrSum / (double)sinrNum;
// store the value
(*itCqi).second.at (rb) = estimatedSinr;
return (estimatedSinr);
}
}
void
PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::SchedUlTriggerReqParameters& params)
{
NS_LOG_FUNCTION (this << " Frame no. " << (params.m_sfnSf>>4) << " subframe no. " << (0xF & params.m_sfnSf));
NS_LOG_FUNCTION (this << " Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf));
std::map <uint16_t,uint8_t>::iterator it;
int nflows = 0;
for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++)
{
// remove old entries of this UE-LC
if ((*it).second > 0)
{
nflows++;
}
{
nflows++;
}
}
if (nflows==0)
{
return ; // no flows to be scheduled
}
if (nflows == 0)
{
return ; // no flows to be scheduled
}
// Divide the resource equally among the active users
int rbPerFlow = m_cschedCellConfig.m_ulBandwidth / nflows;
if (rbPerFlow == 0)
{
rbPerFlow = 1; // at least 1 rbg per flow (till available resource)
}
{
rbPerFlow = 1; // at least 1 rbg per flow (till available resource)
}
int rbAllocated = 0;
FfMacSchedSapUser::SchedUlConfigIndParameters ret;
std::vector <uint16_t> rbgAllocationMap;
std::map <uint16_t, pfsFlowPerf_t>::iterator itStats;
if (m_nextRntiUl!=0)
if (m_nextRntiUl != 0)
{
for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++)
{
if ((*it).first == m_nextRntiUl)
if ((*it).first == m_nextRntiUl)
{
break;
}
}
if (it == m_ceBsrRxed.end ())
{
NS_LOG_ERROR (this << " no user found");
}
if (it == m_ceBsrRxed.end ())
{
NS_LOG_ERROR (this << " no user found");
}
}
else
{
@@ -767,10 +768,10 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
// limit to physical resources last resource assignment
rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated;
}
// store info on allocation for managing ul-cqi interpretation
// store info on allocation for managing ul-cqi interpretation
for (int i = 0; i < rbPerFlow; i++)
{
rbgAllocationMap.push_back ((*it).first);
rbgAllocationMap.push_back ((*it).first);
}
UlDciListElement_s uldci;
uldci.m_rnti = (*it).first;
@@ -781,14 +782,14 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
int cqi = 0;
if (itCqi == m_ueCqi.end ())
{
// no cqi info about this UE
// no cqi info about this UE
uldci.m_mcs = 0; // MCS 0 -> UL-AMC TBD
//NS_LOG_DEBUG (this << " UE does not have ULCQI " << (*it).first );
}
else
{
// take the lowest CQI value (worst RB)
double minSinr = (*itCqi).second.at(uldci.m_rbStart);
double minSinr = (*itCqi).second.at (uldci.m_rbStart);
if (minSinr == NO_SINR)
{
minSinr = EstimateUlSinr ((*it).first, uldci.m_rbStart);
@@ -796,26 +797,26 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_rbLen; i++)
{
//NS_LOG_DEBUG (this << " UE " << (*it).first << " has CQI " << (*itCqi).second.at(i));
double sinr = (*itCqi).second.at(i);
double sinr = (*itCqi).second.at (i);
if (sinr == NO_SINR)
{
sinr = EstimateUlSinr ((*it).first, i);
}
if ((*itCqi).second.at(i) < minSinr)
if ((*itCqi).second.at (i) < minSinr)
{
minSinr = (*itCqi).second.at(i);
minSinr = (*itCqi).second.at (i);
}
}
// translate SINR -> cqi: WILD ACK: same as DL
double s = log2 ( 1 + (
pow (10, minSinr / 10 ) /
( (-log (5.0 * 0.00005 )) / 1.5) ));
pow (10, minSinr / 10 ) /
( (-log (5.0 * 0.00005 )) / 1.5) ));
cqi = LteAmc::GetCqiFromSpectralEfficiency (s);
if (cqi == 0)
{
it++;
if (it==m_ceBsrRxed.end ())
if (it == m_ceBsrRxed.end ())
{
// restart from the first
it = m_ceBsrRxed.begin ();
@@ -824,7 +825,7 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
}
uldci.m_mcs = LteAmc::GetMcsFromCqi (cqi);
//NS_LOG_DEBUG (this << " UE " << (*it).first << " minsinr " << minSinr << " -> mcs " << (uint16_t)uldci.m_mcs);
}
uldci.m_tbSize = (LteAmc::GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8);
// NS_LOG_DEBUG (this << " UE " << (*it).first << " startPRB " << (uint32_t)uldci.m_rbStart << " nPRB " << (uint32_t)uldci.m_rbLen << " CQI " << cqi << " MCS " << (uint32_t)uldci.m_mcs << " TBsize " << uldci.m_tbSize);
@@ -841,24 +842,24 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
uldci.m_freqHopping = 0;
uldci.m_pdcchPowerOffset = 0; // not used
ret.m_dciList.push_back (uldci);
// update TTI UE stats
itStats = m_flowStatsUl.find ((*it).first);
if (itStats != m_flowStatsUl.end())
if (itStats != m_flowStatsUl.end ())
{
(*itStats).second.lastTtiBytesTrasmitted = uldci.m_tbSize;
// NS_LOG_DEBUG (this << " UE bytes txed " << (*it).second.lastTtiBytesTrasmitted);
}
else
{
NS_LOG_DEBUG (this << " No Stats for this allocated UE");
}
it++;
if (it==m_ceBsrRxed.end ())
if (it == m_ceBsrRxed.end ())
{
// restart from the first
it = m_ceBsrRxed.begin ();
@@ -869,9 +870,10 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
m_nextRntiUl = (*it).first;
break;
}
} while ((*it).first != m_nextRntiUl);
}
while ((*it).first != m_nextRntiUl);
// Update global UE stats
// update UEs stats
for (itStats = m_flowStatsUl.begin (); itStats != m_flowStatsUl.end (); itStats++)
@@ -908,30 +910,30 @@ void
PfFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::SchedUlMacCtrlInfoReqParameters& params)
{
NS_LOG_FUNCTION (this);
std::map <uint16_t,uint8_t>::iterator it;
for (unsigned int i = 0; i < params.m_macCeList.size (); i++)
{
if ( params.m_macCeList.at (i).m_macCeType == MacCeListElement_s::BSR )
{
// buffer status report
uint16_t rnti = params.m_macCeList.at (i).m_rnti;
it = m_ceBsrRxed.find(rnti);
if (it==m_ceBsrRxed.end())
{
// create the new entry
uint8_t bsr = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
m_ceBsrRxed.insert( std::pair<uint16_t, uint8_t > (rnti, bsr)); // only 1 buffer status is working now
}
else
{
// update the CQI value
(*it).second = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
}
if ( params.m_macCeList.at (i).m_macCeType == MacCeListElement_s::BSR )
{
// buffer status report
uint16_t rnti = params.m_macCeList.at (i).m_rnti;
it = m_ceBsrRxed.find (rnti);
if (it == m_ceBsrRxed.end ())
{
// create the new entry
uint8_t bsr = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
m_ceBsrRxed.insert ( std::pair<uint16_t, uint8_t > (rnti, bsr)); // only 1 buffer status is working now
}
else
{
// update the CQI value
(*it).second = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
}
}
}
}
return;
}
@@ -945,9 +947,9 @@ PfFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::Sched
uint32_t subframeNo = (0xF & params.m_sfnSf);
//NS_LOG_DEBUG (this << " sfn " << frameNo << " sbfn " << subframeNo);
if (subframeNo - m_schedTtiDelay < 0)
{
frameNo--;
}
{
frameNo--;
}
subframeNo = (subframeNo - m_schedTtiDelay) % 10;
//NS_LOG_DEBUG (this << " Actual sfn " << frameNo << " sbfn " << subframeNo);
uint16_t sfnSf = ((0xFF & frameNo) << 4) | (0xF & subframeNo);
@@ -955,46 +957,46 @@ PfFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::Sched
std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
std::map <uint16_t, std::vector <double> >::iterator itCqi;
itMap = m_allocationMaps.find (sfnSf);
if (itMap == m_allocationMaps.end())
{
NS_LOG_DEBUG (this << " Does not find info on allocation");
return;
}
if (itMap == m_allocationMaps.end ())
{
NS_LOG_DEBUG (this << " Does not find info on allocation");
return;
}
for (uint32_t i = 0; i < (*itMap).second.size (); i++)
{
// convert from fixed point notation Sxxxxxxxxxxx.xxx to double
double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i));
//NS_LOG_DEBUG (this << " UE " << (*itMap).second.at (i) << " SINRfp " << params.m_ulCqi.m_sinr.at (i) << " sinrdb " << sinr);
itCqi = m_ueCqi.find ((*itMap).second.at (i));
if (itCqi == m_ueCqi.end ())
{
// create a new entry
std::vector <double> newCqi;
for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
{
if (i==j)
{
newCqi.push_back (sinr);
}
else
{
// convert from fixed point notation Sxxxxxxxxxxx.xxx to double
double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i));
//NS_LOG_DEBUG (this << " UE " << (*itMap).second.at (i) << " SINRfp " << params.m_ulCqi.m_sinr.at (i) << " sinrdb " << sinr);
itCqi = m_ueCqi.find ((*itMap).second.at (i));
if (itCqi == m_ueCqi.end ())
{
// create a new entry
std::vector <double> newCqi;
for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
{
if (i == j)
{
newCqi.push_back (sinr);
}
else
{
// initialize with NO_SINR value.
newCqi.push_back (NO_SINR);
}
}
m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > ((*itMap).second.at (i), newCqi));
}
else
{
// update the value
(*itCqi).second.at (i) = sinr;
}
}
newCqi.push_back (NO_SINR);
}
}
m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > ((*itMap).second.at (i), newCqi));
}
else
{
// update the value
(*itCqi).second.at (i) = sinr;
}
}
// remove obsolete info on allocation
m_allocationMaps.erase (m_allocationMaps.begin (), ++itMap);
return;
}

View File

@@ -86,7 +86,6 @@ public:
friend class PfSchedulerMemberSchedSapProvider;
private:
//
// Implementation of the CSCHED API primitives
// (See 4.1 for description of the primitives)
@@ -131,54 +130,54 @@ private:
int GetRbgSize (int dlbandwidth);
int LcActivePerFlow(uint16_t rnti);
double EstimateUlSinr(uint16_t rnti, uint16_t rb);
int LcActivePerFlow (uint16_t rnti);
double EstimateUlSinr (uint16_t rnti, uint16_t rb);
/*
* Vectors of UE's LC info
*/
std::map <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters> m_rlcBufferReq;
/*
* Map of UE statistics (per RNTI basis) in downlink
* Map of UE statistics (per RNTI basis) in downlink
*/
std::map <uint16_t, pfsFlowPerf_t> m_flowStatsDl;
/*
* Map of UE statistics (per RNTI basis)
*/
std::map <uint16_t, pfsFlowPerf_t> m_flowStatsUl;
/*
* Map of UE's DL CQI P01 received
*/
std::map <uint16_t,uint8_t> m_p10CqiRxed;
std::map <uint16_t,uint8_t> m_p10CqiRxed;
/*
* Map of UE's DL CQI A30 received
*/
std::map <uint16_t,SbMeasResult_s> m_a30CqiRxed;
/*
* Map of previous allocated UE per RBG
* (used to retrieve info from UL-CQI)
*/
std::map <uint16_t, std::vector <uint16_t> > m_allocationMaps;
/*
* Map of UEs' UL-CQI per RBG
*/
std::map <uint16_t, std::vector <double> > m_ueCqi;
/*
* Map of UE's buffer status reports received
*/
std::map <uint16_t,uint8_t> m_ceBsrRxed;
std::map <uint16_t,uint8_t> m_ceBsrRxed;
// MAC SAPs
FfMacCschedSapUser* m_cschedSapUser;
FfMacSchedSapUser* m_schedSapUser;
@@ -188,11 +187,11 @@ private:
// Internal parameters
FfMacCschedSapProvider::CschedCellConfigReqParameters m_cschedCellConfig;
double m_timeWindow;
uint8_t m_schedTtiDelay; // delay between scheduling and reception (based on m_macChTtiDelay)
uint16_t m_nextRntiUl; // RNTI of the next user to be served next scheduling in UL
};

View File

@@ -208,7 +208,8 @@ RrSchedulerMemberSchedSapProvider::SchedUlCqiInfoReq (const struct SchedUlCqiInf
RrFfMacScheduler::RrFfMacScheduler ()
: m_cschedSapUser (0),
m_schedSapUser (0),
m_schedTtiDelay (2), // WILD ACK: based on a m_macChTtiDelay = 1
m_schedTtiDelay (2),
// WILD ACK: based on a m_macChTtiDelay = 1
m_nextRntiDl (0),
m_nextRntiUl (0)
{
@@ -371,7 +372,7 @@ RrFfMacScheduler::GetRbgSize (int dlbandwidth)
void
RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::SchedDlTriggerReqParameters& params)
{
NS_LOG_FUNCTION (this << " Frame no. " << (params.m_sfnSf>>4) << " subframe no. " << (0xF & params.m_sfnSf));
NS_LOG_FUNCTION (this << " Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf));
// API generated by RLC for triggering the scheduling of a DL subframe
// Get the actual active flows (queue!=0)
@@ -394,7 +395,7 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
// CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
nflows++;
itLcRnti = lcActivesPerRnti.find ((*it).m_rnti);
if (itLcRnti!=lcActivesPerRnti.end ())
if (itLcRnti != lcActivesPerRnti.end ())
{
(*itLcRnti).second++;
}
@@ -406,7 +407,7 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
}
}
}
if (nflows == 0)
{
return;
@@ -426,17 +427,17 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
// round robin assignment to all UE-LC registered starting from the subsequent of the one
// served last scheduling trigger
//NS_LOG_DEBUG (this << " next to be served " << m_nextRntiDl << " nflows " << nflows);
if (m_nextRntiDl!=0)
if (m_nextRntiDl != 0)
{
for (it = m_rlcBufferReq.begin (); it != m_rlcBufferReq.end (); it++)
{
if ((*it).m_rnti == m_nextRntiDl)
{
break;
}
if ((*it).m_rnti == m_nextRntiDl)
{
break;
}
}
if (it == m_rlcBufferReq.end ())
if (it == m_rlcBufferReq.end ())
{
NS_LOG_ERROR (this << " no user found");
}
@@ -449,17 +450,17 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
do
{
itLcRnti = lcActivesPerRnti.find ((*it).m_rnti);
if (itLcRnti==lcActivesPerRnti.end ())
{
// skip this entry
it++;
if (it==m_rlcBufferReq.end ())
{
// restart from the first
it = m_rlcBufferReq.begin ();
}
continue;
}
if (itLcRnti == lcActivesPerRnti.end ())
{
// skip this entry
it++;
if (it == m_rlcBufferReq.end ())
{
// restart from the first
it = m_rlcBufferReq.begin ();
}
continue;
}
int lcNum = (*itLcRnti).second;
// create new BuildDataListElement_s for this RNTI
BuildDataListElement_s newEl;
@@ -492,7 +493,7 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
newRlcEl.m_size = rlcPduSize;
newRlcPduLe.push_back (newRlcEl);
it++;
if (it==m_rlcBufferReq.end ())
if (it == m_rlcBufferReq.end ())
{
// restart from the first
it = m_rlcBufferReq.begin ();
@@ -527,7 +528,8 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
m_nextRntiDl = (*it).m_rnti; // store last RNTI served
break; // no more RGB to be allocated
}
} while ((*it).m_rnti != m_nextRntiDl);
}
while ((*it).m_rnti != m_nextRntiDl);
ret.m_nrOfPdcchOfdmSymbols = 1; // TODO: check correct value according the DCIs txed
@@ -585,56 +587,56 @@ RrFfMacScheduler::DoSchedDlCqiInfoReq (const struct FfMacSchedSapProvider::Sched
void
RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::SchedUlTriggerReqParameters& params)
{
NS_LOG_FUNCTION (this << " Frame no. " << (params.m_sfnSf>>4) << " subframe no. " << (0xF & params.m_sfnSf));
NS_LOG_FUNCTION (this << " Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf));
std::map <uint16_t,uint8_t>::iterator it;
int nflows = 0;
for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++)
{
// remove old entries of this UE-LC
if ((*it).second > 0)
{
nflows++;
}
{
nflows++;
}
}
if (nflows==0)
{
return ; // no flows to be scheduled
}
if (nflows == 0)
{
return ; // no flows to be scheduled
}
// Divide the resource equally among the active users starting from the subsequent one served last scheduling trigger
int rbPerFlow = m_cschedCellConfig.m_ulBandwidth / nflows;
if (rbPerFlow == 0)
{
rbPerFlow = 1; // at least 1 rbg per flow (till available resource)
}
{
rbPerFlow = 1; // at least 1 rbg per flow (till available resource)
}
int rbAllocated = 0;
FfMacSchedSapUser::SchedUlConfigIndParameters ret;
std::vector <uint16_t> rbgAllocationMap;
if (m_nextRntiUl!=0)
if (m_nextRntiUl != 0)
{
for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++)
{
if ((*it).first == m_nextRntiUl)
if ((*it).first == m_nextRntiUl)
{
break;
}
}
if (it == m_ceBsrRxed.end ())
{
NS_LOG_ERROR (this << " no user found");
}
if (it == m_ceBsrRxed.end ())
{
NS_LOG_ERROR (this << " no user found");
}
}
else
{
it = m_ceBsrRxed.begin ();
m_nextRntiUl = (*it).first;
}
{
it = m_ceBsrRxed.begin ();
m_nextRntiUl = (*it).first;
}
do
{
if (rbAllocated + rbPerFlow > m_cschedCellConfig.m_ulBandwidth)
@@ -642,10 +644,10 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
// limit to physical resources last resource assignment
rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated;
}
// store info on allocation for managing ul-cqi interpretation
// store info on allocation for managing ul-cqi interpretation
for (int i = 0; i < rbPerFlow; i++)
{
rbgAllocationMap.push_back ((*it).first);
rbgAllocationMap.push_back ((*it).first);
}
UlDciListElement_s uldci;
uldci.m_rnti = (*it).first;
@@ -656,33 +658,33 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
int cqi = 0;
if (itCqi == m_ueCqi.end ())
{
// no cqi info about this UE
// no cqi info about this UE
uldci.m_mcs = 0; // MCS 0 -> UL-AMC TBD
//NS_LOG_DEBUG (this << " UE does not have ULCQI " << (*it).first );
}
else
{
// take the lowest CQI value (worst RB)
double minSinr = (*itCqi).second.at(uldci.m_rbStart);
for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_rbLen; i++)
{
//NS_LOG_DEBUG (this << " UE " << (*it).first << " has CQI " << (*itCqi).second.at(i));
if ((*itCqi).second.at(i) < minSinr)
{
minSinr = (*itCqi).second.at(i);
}
}
// translate SINR -> cqi: WILD ACK: same as DL
double s = log2 ( 1 + (
pow (10, minSinr / 10 ) /
( (-log (5.0 * 0.00005 )) / 1.5) ));
// take the lowest CQI value (worst RB)
double minSinr = (*itCqi).second.at (uldci.m_rbStart);
for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_rbLen; i++)
{
//NS_LOG_DEBUG (this << " UE " << (*it).first << " has CQI " << (*itCqi).second.at(i));
if ((*itCqi).second.at (i) < minSinr)
{
minSinr = (*itCqi).second.at (i);
}
}
// translate SINR -> cqi: WILD ACK: same as DL
double s = log2 ( 1 + (
pow (10, minSinr / 10 ) /
( (-log (5.0 * 0.00005 )) / 1.5) ));
cqi = LteAmc::GetCqiFromSpectralEfficiency (s);
if (cqi == 0)
{
it++;
if (it==m_ceBsrRxed.end ())
if (it == m_ceBsrRxed.end ())
{
// restart from the first
it = m_ceBsrRxed.begin ();
@@ -691,7 +693,7 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
}
uldci.m_mcs = LteAmc::GetMcsFromCqi (cqi);
//NS_LOG_DEBUG (this << " UE " << (*it).first << " minsinr " << minSinr << " -> mcs " << (uint16_t)uldci.m_mcs);
}
uldci.m_tbSize = (LteAmc::GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8); // MCS 0 -> UL-AMC TBD
// NS_LOG_DEBUG (this << " UE " << (*it).first << " startPRB " << (uint32_t)uldci.m_rbStart << " nPRB " << (uint32_t)uldci.m_rbLen << " CQI " << cqi << " MCS " << (uint32_t)uldci.m_mcs << " TBsize " << uldci.m_tbSize);
@@ -709,7 +711,7 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
uldci.m_pdcchPowerOffset = 0; // not used
ret.m_dciList.push_back (uldci);
it++;
if (it==m_ceBsrRxed.end ())
if (it == m_ceBsrRxed.end ())
{
// restart from the first
it = m_ceBsrRxed.begin ();
@@ -720,7 +722,8 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
m_nextRntiUl = (*it).first;
break;
}
} while ((*it).first != m_nextRntiUl);
}
while ((*it).first != m_nextRntiUl);
m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params.m_sfnSf, rbgAllocationMap));
m_schedSapUser->SchedUlConfigInd (ret);
return;
@@ -746,30 +749,30 @@ void
RrFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::SchedUlMacCtrlInfoReqParameters& params)
{
NS_LOG_FUNCTION (this);
std::map <uint16_t,uint8_t>::iterator it;
for (unsigned int i = 0; i < params.m_macCeList.size (); i++)
{
if ( params.m_macCeList.at (i).m_macCeType == MacCeListElement_s::BSR )
{
// buffer status report
uint16_t rnti = params.m_macCeList.at (i).m_rnti;
it = m_ceBsrRxed.find(rnti);
if (it==m_ceBsrRxed.end())
{
// create the new entry
uint8_t bsr = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
m_ceBsrRxed.insert( std::pair<uint16_t, uint8_t > (rnti, bsr)); // only 1 buffer status is working now
}
else
{
// update the CQI value
(*it).second = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
}
if ( params.m_macCeList.at (i).m_macCeType == MacCeListElement_s::BSR )
{
// buffer status report
uint16_t rnti = params.m_macCeList.at (i).m_rnti;
it = m_ceBsrRxed.find (rnti);
if (it == m_ceBsrRxed.end ())
{
// create the new entry
uint8_t bsr = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
m_ceBsrRxed.insert ( std::pair<uint16_t, uint8_t > (rnti, bsr)); // only 1 buffer status is working now
}
else
{
// update the CQI value
(*it).second = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
}
}
}
}
return;
}
@@ -783,9 +786,9 @@ RrFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::Sched
uint32_t subframeNo = (0xF & params.m_sfnSf);
//NS_LOG_DEBUG (this << " sfn " << frameNo << " sbfn " << subframeNo);
if (subframeNo - m_schedTtiDelay < 0)
{
frameNo--;
}
{
frameNo--;
}
subframeNo = (subframeNo - m_schedTtiDelay) % 10;
//NS_LOG_DEBUG (this << " Actual sfn " << frameNo << " sbfn " << subframeNo);
uint16_t sfnSf = ((0xFF & frameNo) << 4) | (0xF & subframeNo);
@@ -793,43 +796,43 @@ RrFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::Sched
std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
std::map <uint16_t, std::vector <double> >::iterator itCqi;
itMap = m_allocationMaps.find (sfnSf);
if (itMap == m_allocationMaps.end())
{
NS_LOG_DEBUG (this << " Does not find info on allocation");
return;
}
if (itMap == m_allocationMaps.end ())
{
NS_LOG_DEBUG (this << " Does not find info on allocation");
return;
}
for (uint32_t i = 0; i < (*itMap).second.size (); i++)
{
// convert from fixed point notation Sxxxxxxxxxxx.xxx to double
double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i));
//NS_LOG_DEBUG (this << " UE " << (*itMap).second.at (i) << " SINRfp " << params.m_ulCqi.m_sinr.at (i) << " sinrdb " << sinr);
itCqi = m_ueCqi.find ((*itMap).second.at (i));
if (itCqi == m_ueCqi.end ())
{
// create a new entry
std::vector <double> newCqi;
for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
{
if (i==j)
{
newCqi.push_back (sinr);
}
else
{
// initialize with maximum value according to the fixed point notation
newCqi.push_back (30.0);
}
}
m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > ((*itMap).second.at (i), newCqi));
}
else
{
// update the value
(*itCqi).second.at (i) = sinr;
}
}
// convert from fixed point notation Sxxxxxxxxxxx.xxx to double
double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i));
//NS_LOG_DEBUG (this << " UE " << (*itMap).second.at (i) << " SINRfp " << params.m_ulCqi.m_sinr.at (i) << " sinrdb " << sinr);
itCqi = m_ueCqi.find ((*itMap).second.at (i));
if (itCqi == m_ueCqi.end ())
{
// create a new entry
std::vector <double> newCqi;
for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
{
if (i == j)
{
newCqi.push_back (sinr);
}
else
{
// initialize with maximum value according to the fixed point notation
newCqi.push_back (30.0);
}
}
m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > ((*itMap).second.at (i), newCqi));
}
else
{
// update the value
(*itCqi).second.at (i) = sinr;
}
}
// remove obsolete info on allocation
m_allocationMaps.erase (m_allocationMaps.begin (), ++itMap);

View File

@@ -74,7 +74,6 @@ public:
friend class RrSchedulerMemberSchedSapProvider;
private:
//
// Implementation of the CSCHED API primitives
// (See 4.1 for description of the primitives)
@@ -129,25 +128,25 @@ private:
* Map of UE's DL CQI P01 received
*/
std::map <uint16_t,uint8_t> m_p10CqiRxed;
/*
* Map of previous allocated UE per RBG
* (used to retrieve info from UL-CQI)
*/
std::map <uint16_t, std::vector <uint16_t> > m_allocationMaps;
/*
* Map of UEs' UL-CQI per RBG
*/
std::map <uint16_t, std::vector <double> > m_ueCqi;
/*
* Map of UE's buffer status reports received
*/
std::map <uint16_t,uint8_t> m_ceBsrRxed;
std::map <uint16_t,uint8_t> m_ceBsrRxed;
// MAC SAPs
FfMacCschedSapUser* m_cschedSapUser;
FfMacSchedSapUser* m_schedSapUser;
@@ -157,9 +156,9 @@ private:
// Internal parameters
FfMacCschedSapProvider::CschedCellConfigReqParameters m_cschedCellConfig;
uint8_t m_schedTtiDelay; // delay between scheduling and reception (based on m_macChTtiDelay)
uint16_t m_nextRntiDl; // RNTI of the next user to be served next scheduling in DL
uint16_t m_nextRntiUl; // RNTI of the next user to be served next scheduling in UL

View File

@@ -0,0 +1,23 @@
#! /usr/bin/env python
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain
# buildable and runnable over time. Each tuple in the list contains
#
# (example_name, do_run, do_valgrind_run).
#
# See test.py for more information.
cpp_examples = [
("lena-first-sim", "True", "True"),
("inter-cell-interference", "True", "True"),
("lena-rlc-calculator", "True", "True"),
("profiling-reference", "False", "False"),
]
# A list of Python examples to run in order to ensure that they remain
# runnable over time. Each tuple in the list contains
#
# (example_name, do_run).
#
# See test.py for more information.
python_examples = []

View File

@@ -201,7 +201,7 @@ LteDownlinkSinrTestCase::DoRun (void)
{
// Create phy tag (different for each packet burst)
// and add to the first packet
pktTag[pb] = LtePhyTag (100 * (pb+1));
pktTag[pb] = LtePhyTag (100 * (pb + 1));
pkt[pb][i]->AddPacketTag ( pktTag[pb] );
}
@@ -246,12 +246,12 @@ LteDownlinkSinrTestCase::DoRun (void)
*/
// eNB sends data to 2 UEs through 2 subcarriers
Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, dlPhy, packetBursts[0], m_sv, dlPhy->GetSpectrumType(), ds);
Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, dlPhy, packetBursts[0], m_sv, dlPhy->GetSpectrumType (), ds);
Simulator::Schedule (ti1, &LteSpectrumPhy::StartRx, dlPhy, packetBursts[1], i1, dlPhy->GetSpectrumType(), di1);
Simulator::Schedule (ti2, &LteSpectrumPhy::StartRx, dlPhy, packetBursts[2], i2, dlPhy->GetSpectrumType(), di2);
Simulator::Schedule (ti3, &LteSpectrumPhy::StartRx, dlPhy, packetBursts[3], i3, dlPhy->GetSpectrumType(), di3);
Simulator::Schedule (ti4, &LteSpectrumPhy::StartRx, dlPhy, packetBursts[4], i4, dlPhy->GetSpectrumType(), di4);
Simulator::Schedule (ti1, &LteSpectrumPhy::StartRx, dlPhy, packetBursts[1], i1, dlPhy->GetSpectrumType (), di1);
Simulator::Schedule (ti2, &LteSpectrumPhy::StartRx, dlPhy, packetBursts[2], i2, dlPhy->GetSpectrumType (), di2);
Simulator::Schedule (ti3, &LteSpectrumPhy::StartRx, dlPhy, packetBursts[3], i3, dlPhy->GetSpectrumType (), di3);
Simulator::Schedule (ti4, &LteSpectrumPhy::StartRx, dlPhy, packetBursts[4], i4, dlPhy->GetSpectrumType (), di4);
Simulator::Stop (Seconds (5.0));
Simulator::Run ();

View File

@@ -41,16 +41,16 @@ public:
class LteDownlinkSinrTestCase : public TestCase
{
public:
LteDownlinkSinrTestCase (Ptr<SpectrumValue> sv, Ptr<SpectrumValue> sinr, std::string name);
virtual ~LteDownlinkSinrTestCase ();
public:
LteDownlinkSinrTestCase (Ptr<SpectrumValue> sv, Ptr<SpectrumValue> sinr, std::string name);
virtual ~LteDownlinkSinrTestCase ();
private:
virtual void DoRun (void);
private:
virtual void DoRun (void);
Ptr<SpectrumValue> m_sv;
Ptr<const SpectrumModel> m_sm;
Ptr<SpectrumValue> m_sinr;
Ptr<SpectrumValue> m_sv;
Ptr<const SpectrumModel> m_sm;
Ptr<SpectrumValue> m_sinr;
};

View File

@@ -39,14 +39,14 @@ protected:
uint16_t m_earfcn;
double m_f;
private:
virtual void DoRun (void);
private:
virtual void DoRun (void);
};
LteEarfcnTestCase::LteEarfcnTestCase (const char* str, uint16_t earfcn, double f)
: TestCase (str),
m_earfcn (earfcn),
m_f (f)
m_earfcn (earfcn),
m_f (f)
{
NS_LOG_FUNCTION (this << str << earfcn << f);
}
@@ -67,8 +67,8 @@ class LteEarfcnDlTestCase : public LteEarfcnTestCase
public:
LteEarfcnDlTestCase (const char* str, uint16_t earfcn, double f);
private:
virtual void DoRun (void);
private:
virtual void DoRun (void);
};
LteEarfcnDlTestCase::LteEarfcnDlTestCase (const char* str, uint16_t earfcn, double f)
@@ -79,7 +79,7 @@ LteEarfcnDlTestCase::LteEarfcnDlTestCase (const char* str, uint16_t earfcn, doub
void
LteEarfcnDlTestCase::DoRun (void)
{
// LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL);
// LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL);
// LogComponentEnable ("LteSpectrumValueHelper", logLevel);
// LogComponentEnable ("LteTestEarfcn", logLevel);
@@ -93,8 +93,8 @@ class LteEarfcnUlTestCase : public LteEarfcnTestCase
public:
LteEarfcnUlTestCase (const char* str, uint16_t earfcn, double f);
private:
virtual void DoRun (void);
private:
virtual void DoRun (void);
};
LteEarfcnUlTestCase::LteEarfcnUlTestCase (const char* str, uint16_t earfcn, double f)

View File

@@ -47,15 +47,15 @@ LteTestDlSchedulingCallback (LteInterferenceTestCase *testcase, std::string path
uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
{
testcase->DlScheduling(frameNo, subframeNo, rnti, mcsTb1, sizeTb1, mcsTb2, sizeTb2);
testcase->DlScheduling (frameNo, subframeNo, rnti, mcsTb1, sizeTb1, mcsTb2, sizeTb2);
}
void
LteTestUlSchedulingCallback (LteInterferenceTestCase *testcase, std::string path,
uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
uint8_t mcs, uint16_t sizeTb)
uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
uint8_t mcs, uint16_t sizeTb)
{
testcase->UlScheduling(frameNo, subframeNo, rnti, mcs, sizeTb);
testcase->UlScheduling (frameNo, subframeNo, rnti, mcs, sizeTb);
}
@@ -68,7 +68,7 @@ LteInterferenceTestSuite::LteInterferenceTestSuite ()
{
NS_LOG_INFO ("Creating LteInterferenceTestSuite");
AddTestCase (new LteInterferenceTestCase ("d1=3000, d2=6000", 3000.000000, 6000.000000, 3.844681, 1.714583, 0.761558, 0.389662, 6, 4));
AddTestCase (new LteInterferenceTestCase ("d1=3000, d2=6000", 3000.000000, 6000.000000, 3.844681, 1.714583, 0.761558, 0.389662, 6, 4));
AddTestCase (new LteInterferenceTestCase ("d1=50, d2=10", 50.000000, 10.000000, 0.040000, 0.040000, 0.010399, 0.010399, 0, 0));
AddTestCase (new LteInterferenceTestCase ("d1=50, d2=20", 50.000000, 20.000000, 0.160000, 0.159998, 0.041154, 0.041153, 0, 0));
AddTestCase (new LteInterferenceTestCase ("d1=50, d2=50", 50.000000, 50.000000, 0.999997, 0.999907, 0.239828, 0.239808, 2, 2));
@@ -79,7 +79,7 @@ LteInterferenceTestSuite::LteInterferenceTestSuite ()
AddTestCase (new LteInterferenceTestCase ("d1=50, d2=10000", 50.000000, 10000.000000, 35964.181431, 8505.970614, 12.667381, 10.588084, 28, 28));
AddTestCase (new LteInterferenceTestCase ("d1=50, d2=100000", 50.000000, 100000.000000, 327284.773828, 10774.181090, 15.853097, 10.928917, 28, 28));
AddTestCase (new LteInterferenceTestCase ("d1=50, d2=1000000", 50.000000, 1000000.000000, 356132.574152, 10802.988445, 15.974963, 10.932767, 28, 28));
}
static LteInterferenceTestSuite lteLinkAdaptationWithInterferenceTestSuite;
@@ -93,8 +93,8 @@ LteInterferenceTestCase::LteInterferenceTestCase (std::string name, double d1, d
: TestCase (name),
m_d1 (d1),
m_d2 (d2),
m_dlSinrDb (10*log10(dlSinr)),
m_ulSinrDb (10*log10(ulSinr)),
m_dlSinrDb (10 * log10 (dlSinr)),
m_ulSinrDb (10 * log10 (ulSinr)),
m_dlSe (dlSe),
m_ulSe (ulSe),
m_dlMcs (dlMcs),
@@ -129,7 +129,7 @@ LteInterferenceTestCase::DoRun (void)
NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes1, ueNodes2);
// the topology is the following:
// d2
// d2
// UE1-----------eNB2
// | |
// d1| |d1
@@ -178,10 +178,10 @@ LteInterferenceTestCase::DoRun (void)
enbPhy->GetUplinkSpectrumPhy ()->AddSinrChunkProcessor (testUlSinr);
Config::Connect ("/NodeList/0/DeviceList/0/LteEnbMac/DlScheduling",
MakeBoundCallback(&LteTestDlSchedulingCallback, this));
MakeBoundCallback (&LteTestDlSchedulingCallback, this));
Config::Connect ("/NodeList/0/DeviceList/0/LteEnbMac/UlScheduling",
MakeBoundCallback(&LteTestUlSchedulingCallback, this));
MakeBoundCallback (&LteTestUlSchedulingCallback, this));
Simulator::Stop (Seconds (0.005));
@@ -199,7 +199,7 @@ LteInterferenceTestCase::DoRun (void)
void
LteInterferenceTestCase::DlScheduling (uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
{
/**
* Note:
@@ -214,7 +214,7 @@ LteInterferenceTestCase::DlScheduling (uint32_t frameNo, uint32_t subframeNo, ui
void
LteInterferenceTestCase::UlScheduling (uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
uint8_t mcs, uint16_t sizeTb)
uint8_t mcs, uint16_t sizeTb)
{
/**
* Note:

View File

@@ -43,16 +43,16 @@ class LteInterferenceTestCase : public TestCase
public:
LteInterferenceTestCase (std::string name, double d1, double d2, double dlSinr, double ulSinr, double dlSe, double ulSe, uint16_t dlMcs, uint16_t ulMcs);
virtual ~LteInterferenceTestCase ();
void DlScheduling (uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2);
uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2);
void UlScheduling (uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
uint8_t mcs, uint16_t sizeTb);
private:
virtual void DoRun (void);
double m_d1;
double m_d2;

View File

@@ -44,10 +44,10 @@ using namespace ns3;
void
LteTestDlSchedulingCallback (LteLinkAdaptationTestCase *testcase, std::string path,
uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
{
testcase->DlScheduling(frameNo, subframeNo, rnti, mcsTb1, sizeTb1, mcsTb2, sizeTb2);
testcase->DlScheduling (frameNo, subframeNo, rnti, mcsTb1, sizeTb1, mcsTb2, sizeTb2);
}
/**
@@ -60,59 +60,59 @@ LteLinkAdaptationTestSuite::LteLinkAdaptationTestSuite ()
NS_LOG_INFO ("Creating LteLinkAdaptionTestSuite");
struct SnrEfficiencyMcs
{
double snrDb;
double efficiency;
int mcsIndex;
};
{
double snrDb;
double efficiency;
int mcsIndex;
};
/**
* Test vectors: SNRDB, Spectral Efficiency, MCS index
* From XXX
*/
SnrEfficiencyMcs snrEfficiencyMcs[] = {
{-5.00000, 0.08024, -1},
{-4.00000, 0.10030, -1},
{-3.00000, 0.12518, -1},
{-2.00000, 0.15589, 0},
{-1.00000, 0.19365, 0},
{0.00000, 0.23983, 2},
{1.00000, 0.29593, 2},
{2.00000, 0.36360, 2},
{3.00000, 0.44451, 4},
{4.00000, 0.54031, 4},
{5.00000, 0.65251, 6},
{6.00000, 0.78240, 6},
{7.00000, 0.93086, 8},
{8.00000, 1.09835, 8},
{9.00000, 1.28485, 10},
{10.00000, 1.48981, 12},
{11.00000, 1.71229, 12},
{12.00000, 1.95096, 14},
{13.00000, 2.20429, 14},
{14.00000, 2.47062, 16},
{15.00000, 2.74826, 18},
{16.00000, 3.03560, 18},
{17.00000, 3.33115, 20},
{18.00000, 3.63355, 20},
{19.00000, 3.94163, 22},
{20.00000, 4.25439, 22},
{21.00000, 4.57095, 24},
{22.00000, 4.89060, 24},
{23.00000, 5.21276, 26},
{24.00000, 5.53693, 26},
{25.00000, 5.86271, 28},
{26.00000, 6.18980, 28},
{27.00000, 6.51792, 28},
{28.00000, 6.84687, 28},
{29.00000, 7.17649, 28},
{30.00000, 7.50663, 28},
{ -5.00000, 0.08024, -1},
{ -4.00000, 0.10030, -1},
{ -3.00000, 0.12518, -1},
{ -2.00000, 0.15589, 0},
{ -1.00000, 0.19365, 0},
{ 0.00000, 0.23983, 2},
{ 1.00000, 0.29593, 2},
{ 2.00000, 0.36360, 2},
{ 3.00000, 0.44451, 4},
{ 4.00000, 0.54031, 4},
{ 5.00000, 0.65251, 6},
{ 6.00000, 0.78240, 6},
{ 7.00000, 0.93086, 8},
{ 8.00000, 1.09835, 8},
{ 9.00000, 1.28485, 10},
{ 10.00000, 1.48981, 12},
{ 11.00000, 1.71229, 12},
{ 12.00000, 1.95096, 14},
{ 13.00000, 2.20429, 14},
{ 14.00000, 2.47062, 16},
{ 15.00000, 2.74826, 18},
{ 16.00000, 3.03560, 18},
{ 17.00000, 3.33115, 20},
{ 18.00000, 3.63355, 20},
{ 19.00000, 3.94163, 22},
{ 20.00000, 4.25439, 22},
{ 21.00000, 4.57095, 24},
{ 22.00000, 4.89060, 24},
{ 23.00000, 5.21276, 26},
{ 24.00000, 5.53693, 26},
{ 25.00000, 5.86271, 28},
{ 26.00000, 6.18980, 28},
{ 27.00000, 6.51792, 28},
{ 28.00000, 6.84687, 28},
{ 29.00000, 7.17649, 28},
{ 30.00000, 7.50663, 28},
};
int numOfTests = sizeof (snrEfficiencyMcs) / sizeof (SnrEfficiencyMcs);
double txPowerDbm = 30; // default eNB TX power over whole bandwdith
double ktDbm = -174; // reference LTE noise PSD
double noisePowerDbm = ktDbm + 10*log10(25*180000); // corresponds to kT*bandwidth in linear units
double noisePowerDbm = ktDbm + 10 * log10 (25 * 180000); // corresponds to kT*bandwidth in linear units
double receiverNoiseFigureDb = 9.0; // default UE noise figure
for ( int i = 0 ; i < numOfTests; i++ )
@@ -200,7 +200,7 @@ LteLinkAdaptationTestCase::DoRun (void)
uePhy->GetDownlinkSpectrumPhy ()->AddSinrChunkProcessor (testSinr);
Config::Connect ("/NodeList/0/DeviceList/0/LteEnbMac/DlScheduling",
MakeBoundCallback(&LteTestDlSchedulingCallback, this));
MakeBoundCallback (&LteTestDlSchedulingCallback, this));
Simulator::Stop (Seconds (0.005));
Simulator::Run ();

View File

@@ -39,20 +39,20 @@ public:
class LteLinkAdaptationTestCase : public TestCase
{
public:
LteLinkAdaptationTestCase (std::string name, double snrDb, double loss, uint16_t mcsIndex);
LteLinkAdaptationTestCase ();
virtual ~LteLinkAdaptationTestCase ();
public:
LteLinkAdaptationTestCase (std::string name, double snrDb, double loss, uint16_t mcsIndex);
LteLinkAdaptationTestCase ();
virtual ~LteLinkAdaptationTestCase ();
void DlScheduling (uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2);
void DlScheduling (uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2);
private:
virtual void DoRun (void);
private:
virtual void DoRun (void);
double m_snrDb;
double m_loss;
uint16_t m_mcsIndex;
double m_snrDb;
double m_loss;
uint16_t m_mcsIndex;
};

View File

@@ -52,11 +52,11 @@ NS_LOG_COMPONENT_DEFINE ("LenaTestPfFfMacCheduler");
using namespace ns3;
LenaTestPfFfMacSchedulerSuite::LenaTestPfFfMacSchedulerSuite ()
: TestSuite ("lte-pf-ff-mac-scheduler", SYSTEM)
: TestSuite ("lte-pf-ff-mac-scheduler", SYSTEM)
{
SetVerbose (true);
NS_LOG_INFO ("creating LenaTestPfFfMacSchedulerSuite");
//Test Case 1: AMC works in PF
// DOWNLINK - DISTANCE 0 -> MCS 28 -> Itbs 26 (from table 7.1.7.2.1-1 of 36.213)
@@ -106,7 +106,7 @@ LenaTestPfFfMacSchedulerSuite::LenaTestPfFfMacSchedulerSuite ()
// 3 users -> 8 PRB at Itbs 11 -> 201 -> 201000 bytes/sec
// 6 users -> 4 PRB at Itbs 11 -> 97 -> 97000 bytes/sec
// 12 users -> 2 PRB at Itbs 11 -> 47 -> 47000 bytes/sec
// 15 users -> 1 PRB at Itbs 11 -> 22 -> 22000 bytes/sec
// 15 users -> 1 PRB at Itbs 11 -> 22 -> 22000 bytes/sec
AddTestCase (new LenaPfFfMacSchedulerTestCase1 (1,0,6000,903000,621000));
AddTestCase (new LenaPfFfMacSchedulerTestCase1 (3,0,6000,301000,201000));
AddTestCase (new LenaPfFfMacSchedulerTestCase1 (6,0,6000,150500,97000));
@@ -136,13 +136,13 @@ LenaTestPfFfMacSchedulerSuite::LenaTestPfFfMacSchedulerSuite ()
// 3 users -> 309000 among 3 users -> 103000 bytes/sec
// 6 users -> 309000 among 6 users -> 51500 bytes/sec
// 12 users -> 309000 among 12 users -> 25750 bytes/sec
// 15 users -> 309000 among 15 users -> 20600 bytes/sec
// 15 users -> 309000 among 15 users -> 20600 bytes/sec
// UPLINK - DISTANCE 15000 -> MCS 6 -> Itbs 6 (from table 7.1.7.2.1-1 of 36.213)
// 1 user -> 25 PRB at Itbs 6 -> 233 -> 233000 bytes/sec
// 3 users -> 8 PRB at Itbs 6 -> 69 -> 69000 bytes/sec
// 6 users -> 4 PRB at Itbs 6 -> 32 -> 32000 bytes/sec
// 12 users -> 2 PRB at Itbs 6 -> 15 -> 15000 bytes/sec
// 15 users -> 1 PRB at Itbs 6 -> 7 -> 7000 bytes/sec
// 15 users -> 1 PRB at Itbs 6 -> 7 -> 7000 bytes/sec
AddTestCase (new LenaPfFfMacSchedulerTestCase1 (1,0,15000,309000,233000));
AddTestCase (new LenaPfFfMacSchedulerTestCase1 (3,0,15000,103000,69000));
AddTestCase (new LenaPfFfMacSchedulerTestCase1 (6,0,15000,51500,32000));
@@ -150,7 +150,7 @@ LenaTestPfFfMacSchedulerSuite::LenaTestPfFfMacSchedulerSuite ()
AddTestCase (new LenaPfFfMacSchedulerTestCase1 (15,0,15000,20600,7000));
// Test Case 2: fairness check
std::vector<uint16_t> dist;
dist.push_back (0); // User 0 distance --> MCS 28
dist.push_back (3000); // User 1 distance --> MCS 24
@@ -204,11 +204,11 @@ LenaPfFfMacSchedulerTestCase1::DoRun (void)
// LogComponentEnable ("LteEnbMac", LOG_LEVEL_ALL);
// LogComponentEnable ("LteUeMac", LOG_LEVEL_ALL);
// LogComponentEnable ("LteRlc", LOG_LEVEL_ALL);
//
// LogComponentEnable ("LtePhy", LOG_LEVEL_ALL);
// LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL);
// LogComponentEnable ("LteUePhy", LOG_LEVEL_ALL);
//
// LogComponentEnable ("LtePhy", LOG_LEVEL_ALL);
// LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL);
// LogComponentEnable ("LteUePhy", LOG_LEVEL_ALL);
// LogComponentEnable ("LteSpectrumPhy", LOG_LEVEL_ALL);
// LogComponentEnable ("LteInterference", LOG_LEVEL_ALL);
// LogComponentEnable ("LteSinrChunkProcessor", LOG_LEVEL_ALL);
@@ -223,7 +223,7 @@ LenaPfFfMacSchedulerTestCase1::DoRun (void)
// LogComponentEnable ("LteNetDevice", LOG_LEVEL_ALL);
// LogComponentEnable ("LteUeNetDevice", LOG_LEVEL_ALL);
// LogComponentEnable ("LteEnbNetDevice", LOG_LEVEL_ALL);
// LogComponentEnable ("PfFfMacScheduler", LOG_LEVEL_ALL);
LogComponentEnable ("LenaTestPfFfMacCheduler", LOG_LEVEL_ALL);
// LogComponentEnable ("LteAmc", LOG_LEVEL_ALL);
@@ -232,7 +232,7 @@ LenaPfFfMacSchedulerTestCase1::DoRun (void)
/**
* Initialize Simulation Scenario: 1 eNB and m_nUser UEs
*/
SetVerbose (true);
Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
@@ -241,36 +241,36 @@ LenaPfFfMacSchedulerTestCase1::DoRun (void)
NodeContainer ueNodes;
enbNodes.Create (1);
ueNodes.Create (m_nUser);
// Install Mobility Model
MobilityHelper mobility;
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (enbNodes);
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (ueNodes);
// Create Devices and install them in the Nodes (eNB and UE)
NetDeviceContainer enbDevs;
NetDeviceContainer ueDevs;
lena->SetSchedulerType ("ns3::PfFfMacScheduler");
enbDevs = lena->InstallEnbDevice (enbNodes);
ueDevs = lena->InstallUeDevice (ueNodes);
// Attach a UE to a eNB
lena->Attach (ueDevs, enbDevs.Get (0));
// Activate an EPS bearer
enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
EpsBearer bearer (q);
lena->ActivateEpsBearer (ueDevs, bearer);
lena->SetAttribute ("PropagationModel", StringValue ("ns3::FriisSpectrumPropagationLossModel"));
Ptr<LteEnbNetDevice> lteEnbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
Ptr<LteEnbPhy> enbPhy = lteEnbDev->GetPhy ();
enbPhy->SetAttribute ("TxPower", DoubleValue (30.0));
enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0));
// Set UEs' position and power
for (int i = 0; i < m_nUser; i++)
{
@@ -281,29 +281,29 @@ LenaPfFfMacSchedulerTestCase1::DoRun (void)
uePhy->SetAttribute ("TxPower", DoubleValue (23.0));
uePhy->SetAttribute ("NoiseFigure", DoubleValue (9.0));
}
lena->EnableRlcTraces();
lena->EnableRlcTraces ();
double simulationTime = 1.0;
double tolerance = 0.1;
Simulator::Stop (Seconds (simulationTime));
Ptr<RlcStatsCalculator> rlcStats = lena->GetRlcStats ();
rlcStats->SetAttribute("EpochDuration", TimeValue(Seconds(simulationTime)));
rlcStats->SetAttribute ("EpochDuration", TimeValue (Seconds (simulationTime)));
Simulator::Run ();
/**
* Check that the downlink assignation is done in a "proportional fair" manner
*/
NS_LOG_INFO("DL - Test with " << m_nUser << " user(s) at distance " << m_dist);
NS_LOG_INFO ("DL - Test with " << m_nUser << " user(s) at distance " << m_dist);
std::vector <uint64_t> dlDataRxed;
for (int i = 0; i < m_nUser; i++)
{
// get the imsi
uint64_t imsi = ueDevs.Get (i)-> GetObject<LteUeNetDevice> ()->GetImsi ();
uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
// get the lcId
uint8_t lcId = ueDevs.Get (i)-> GetObject<LteUeNetDevice> ()->GetRrc ()->GetLcIdVector ().at(0);
uint8_t lcId = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetRrc ()->GetLcIdVector ().at (0);
dlDataRxed.push_back (rlcStats->GetDlRxData (imsi, lcId));
NS_LOG_INFO ("\tUser " << i << " imsi " << imsi << " bytes rxed " << (double)dlDataRxed.at (i) << " thr " << (double)dlDataRxed.at (i) / simulationTime << " ref " << m_thrRefDl);
}
@@ -315,20 +315,20 @@ LenaPfFfMacSchedulerTestCase1::DoRun (void)
*/
for (int i = 0; i < m_nUser; i++)
{
NS_TEST_ASSERT_MSG_EQ_TOL ((double)dlDataRxed.at (i) / simulationTime, m_thrRefDl, m_thrRefDl * tolerance, " Unfair Throughput!");
NS_TEST_ASSERT_MSG_EQ_TOL ((double)dlDataRxed.at (i) / simulationTime, m_thrRefDl, m_thrRefDl * tolerance, " Unfair Throughput!");
}
/**
* Check that the uplink assignation is done in a "proportional fair" manner
*/
NS_LOG_INFO("UL - Test with " << m_nUser << " user(s) at distance " << m_dist);
NS_LOG_INFO ("UL - Test with " << m_nUser << " user(s) at distance " << m_dist);
std::vector <uint64_t> ulDataRxed;
for (int i = 0; i < m_nUser; i++)
{
// get the imsi
uint64_t imsi = ueDevs.Get (i)-> GetObject<LteUeNetDevice> ()->GetImsi ();
uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
// get the lcId
uint8_t lcId = ueDevs.Get (i)-> GetObject<LteUeNetDevice> ()->GetRrc ()->GetLcIdVector ().at(0);
uint8_t lcId = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetRrc ()->GetLcIdVector ().at (0);
ulDataRxed.push_back (rlcStats->GetUlRxData (imsi, lcId));
NS_LOG_INFO ("\tUser " << i << " imsi " << imsi << " bytes rxed " << (double)ulDataRxed.at (i) << " thr " << (double)ulDataRxed.at (i) / simulationTime << " ref " << m_thrRefUl);
}
@@ -340,7 +340,7 @@ LenaPfFfMacSchedulerTestCase1::DoRun (void)
*/
for (int i = 0; i < m_nUser; i++)
{
NS_TEST_ASSERT_MSG_EQ_TOL ((double)ulDataRxed.at (i) / simulationTime, m_thrRefUl, m_thrRefUl * tolerance, " Unfair Throughput!");
NS_TEST_ASSERT_MSG_EQ_TOL ((double)ulDataRxed.at (i) / simulationTime, m_thrRefUl, m_thrRefUl * tolerance, " Unfair Throughput!");
}
Simulator::Destroy ();
@@ -384,7 +384,7 @@ LenaPfFfMacSchedulerTestCase2::DoRun (void)
// LogComponentEnable ("LtePhy", LOG_LEVEL_ALL);
// LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL);
// LogComponentEnable ("LteUePhy", LOG_LEVEL_ALL);
// LogComponentEnable ("LteSpectrumPhy", LOG_LEVEL_ALL);
// LogComponentEnable ("LteInterference", LOG_LEVEL_ALL);
// LogComponentEnable ("LteSinrChunkProcessor", LOG_LEVEL_ALL);
@@ -399,54 +399,54 @@ LenaPfFfMacSchedulerTestCase2::DoRun (void)
// LogComponentEnable ("LteNetDevice", LOG_LEVEL_ALL);
// LogComponentEnable ("LteUeNetDevice", LOG_LEVEL_ALL);
// LogComponentEnable ("LteEnbNetDevice", LOG_LEVEL_ALL);
// LogComponentEnable ("PfFfMacScheduler", LOG_LEVEL_ALL);
LogComponentEnable ("LenaTestPfFfMacCheduler", LOG_LEVEL_ALL);
// LogComponentEnable ("LteAmc", LOG_LEVEL_ALL);
// LogComponentEnable ("RlcStatsCalculator", LOG_LEVEL_ALL);
/**
* Initialize Simulation Scenario: 1 eNB and m_nUser UEs
*/
SetVerbose (true);
Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
// Create Nodes: eNodeB and UE
NodeContainer enbNodes;
NodeContainer ueNodes;
enbNodes.Create (1);
ueNodes.Create (m_nUser);
// Install Mobility Model
MobilityHelper mobility;
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (enbNodes);
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (ueNodes);
// Create Devices and install them in the Nodes (eNB and UE)
NetDeviceContainer enbDevs;
NetDeviceContainer ueDevs;
lena->SetSchedulerType ("ns3::PfFfMacScheduler");
enbDevs = lena->InstallEnbDevice (enbNodes);
ueDevs = lena->InstallUeDevice (ueNodes);
// Attach a UE to a eNB
lena->Attach (ueDevs, enbDevs.Get (0));
// Activate an EPS bearer
enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
EpsBearer bearer (q);
lena->ActivateEpsBearer (ueDevs, bearer);
lena->SetAttribute ("PropagationModel", StringValue ("ns3::FriisSpectrumPropagationLossModel"));
Ptr<LteEnbNetDevice> lteEnbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
Ptr<LteEnbPhy> enbPhy = lteEnbDev->GetPhy ();
enbPhy->SetAttribute ("TxPower", DoubleValue (30.0));
enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0));
// Set UEs' position and power
for (int i = 0; i < m_nUser; i++)
{
@@ -457,34 +457,34 @@ LenaPfFfMacSchedulerTestCase2::DoRun (void)
uePhy->SetAttribute ("TxPower", DoubleValue (23.0));
uePhy->SetAttribute ("NoiseFigure", DoubleValue (9.0));
}
lena->EnableRlcTraces();
lena->EnableRlcTraces ();
double simulationTime = 0.4;
double tolerance = 0.1;
Simulator::Stop (Seconds (simulationTime));
Ptr<RlcStatsCalculator> rlcStats = lena->GetRlcStats ();
rlcStats->SetAttribute("EpochDuration", TimeValue(Seconds(simulationTime)));
rlcStats->SetAttribute ("EpochDuration", TimeValue (Seconds (simulationTime)));
Simulator::Run ();
NS_LOG_INFO("DL - Test with " << m_nUser << " user(s)");
NS_LOG_INFO ("DL - Test with " << m_nUser << " user(s)");
std::vector <uint64_t> dlDataRxed;
double totalData = 0;
double totalEstThrPf = 0;
for (int i = 0; i < m_nUser; i++)
{
// get the imsi
uint64_t imsi = ueDevs.Get (i)-> GetObject<LteUeNetDevice> ()->GetImsi ();
uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
// get the lcId
uint8_t lcId = ueDevs.Get (i)-> GetObject<LteUeNetDevice> ()->GetRrc ()->GetLcIdVector ().at(0);
uint8_t lcId = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetRrc ()->GetLcIdVector ().at (0);
dlDataRxed.push_back (rlcStats->GetDlRxData (imsi, lcId));
totalData += (double)dlDataRxed.at (i);
NS_LOG_INFO ("\tUser " << i << " dist " << m_dist.at (i) << " imsi " << imsi << " bytes rxed " << (double)dlDataRxed.at (i) << " thr " << (double)dlDataRxed.at (i) / simulationTime << " ref " << m_nUser);
totalEstThrPf += m_estThrPfDl.at (i);
}
/**
* Check that the assignation is done in a "proportional fair" manner among users
* with different SINRs: the bandwidht should be distributed according to the
@@ -495,27 +495,27 @@ LenaPfFfMacSchedulerTestCase2::DoRun (void)
double thrRatio = (double)dlDataRxed.at (i) / totalData;
double estThrRatio = (double)m_estThrPfDl.at (i) / totalEstThrPf;
NS_LOG_INFO ("\tUser " << i << " thrRatio " << thrRatio << " estThrRatio " << estThrRatio);
NS_TEST_ASSERT_MSG_EQ_TOL (estThrRatio, thrRatio, tolerance, " Unfair Throughput!");
NS_TEST_ASSERT_MSG_EQ_TOL (estThrRatio, thrRatio, tolerance, " Unfair Throughput!");
}
/**
* Check that the assignation in uplink is done in a round robin manner.
*/
NS_LOG_INFO ("UL - Test with " << m_nUser);
std::vector <uint64_t> ulDataRxed;
for (int i = 0; i < m_nUser; i++)
{
// get the imsi
uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
// get the lcId
uint8_t lcId = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetRrc ()->GetLcIdVector ().at (0);
ulDataRxed.push_back (rlcStats->GetUlRxData (imsi, lcId));
NS_LOG_INFO ("\tUser " << i << " dist " << m_dist.at (i) << " bytes rxed " << (double)ulDataRxed.at (i) << " thr " << (double)ulDataRxed.at (i) / simulationTime << " ref " << (double)m_estThrPfUl.at (i));
NS_TEST_ASSERT_MSG_EQ_TOL ((double)ulDataRxed.at (i) / simulationTime, (double)m_estThrPfUl.at (i), (double)m_estThrPfUl.at (i) * tolerance, " Unfair Throughput!");
}
/**
* Check that the assignation in uplink is done in a round robin manner.
*/
NS_LOG_INFO("UL - Test with " << m_nUser);
std::vector <uint64_t> ulDataRxed;
for (int i = 0; i < m_nUser; i++)
{
// get the imsi
uint64_t imsi = ueDevs.Get (i)-> GetObject<LteUeNetDevice> ()->GetImsi ();
// get the lcId
uint8_t lcId = ueDevs.Get (i)-> GetObject<LteUeNetDevice> ()->GetRrc ()->GetLcIdVector().at(0);
ulDataRxed.push_back (rlcStats->GetUlRxData (imsi, lcId));
NS_LOG_INFO ("\tUser " << i << " dist " << m_dist.at (i) << " bytes rxed " << (double)ulDataRxed.at (i) << " thr " << (double)ulDataRxed.at (i) / simulationTime << " ref " << (double)m_estThrPfUl.at (i));
NS_TEST_ASSERT_MSG_EQ_TOL ((double)ulDataRxed.at (i) / simulationTime, (double)m_estThrPfUl.at (i), (double)m_estThrPfUl.at (i) * tolerance, " Unfair Throughput!");
}
Simulator::Destroy ();
}

View File

@@ -39,32 +39,32 @@ using namespace ns3;
*/
class LenaPfFfMacSchedulerTestCase1 : public TestCase
{
public:
LenaPfFfMacSchedulerTestCase1 (uint16_t nUser, uint16_t nLc, uint16_t dist, double thrRefDl, double thrRefUl);
virtual ~LenaPfFfMacSchedulerTestCase1 ();
public:
LenaPfFfMacSchedulerTestCase1 (uint16_t nUser, uint16_t nLc, uint16_t dist, double thrRefDl, double thrRefUl);
virtual ~LenaPfFfMacSchedulerTestCase1 ();
private:
virtual void DoRun (void);
uint16_t m_nUser;
uint16_t m_nLc;
uint16_t m_dist;
double m_thrRefDl;
double m_thrRefUl;
private:
virtual void DoRun (void);
uint16_t m_nUser;
uint16_t m_nLc;
uint16_t m_dist;
double m_thrRefDl;
double m_thrRefUl;
};
class LenaPfFfMacSchedulerTestCase2 : public TestCase
{
public:
LenaPfFfMacSchedulerTestCase2 (uint16_t nUser, std::vector<uint16_t> dist, std::vector<uint32_t> estThrPfDl, std::vector<uint32_t> estThrPfUl);
virtual ~LenaPfFfMacSchedulerTestCase2 ();
private:
virtual void DoRun (void);
uint16_t m_nUser;
std::vector<uint16_t> m_dist;
std::vector<uint32_t> m_estThrPfDl;
std::vector<uint32_t> m_estThrPfUl;
public:
LenaPfFfMacSchedulerTestCase2 (uint16_t nUser, std::vector<uint16_t> dist, std::vector<uint32_t> estThrPfDl, std::vector<uint32_t> estThrPfUl);
virtual ~LenaPfFfMacSchedulerTestCase2 ();
private:
virtual void DoRun (void);
uint16_t m_nUser;
std::vector<uint16_t> m_dist;
std::vector<uint32_t> m_estThrPfDl;
std::vector<uint32_t> m_estThrPfUl;
};
@@ -72,8 +72,8 @@ class LenaPfFfMacSchedulerTestCase2 : public TestCase
class LenaTestPfFfMacSchedulerSuite : public TestSuite
{
public:
LenaTestPfFfMacSchedulerSuite ();
public:
LenaTestPfFfMacSchedulerSuite ();
};

View File

@@ -50,12 +50,12 @@ using namespace ns3;
LenaTestRrFfMacSchedulerSuite::LenaTestRrFfMacSchedulerSuite ()
: TestSuite ("lte-rr-ff-mac-scheduler", SYSTEM)
: TestSuite ("lte-rr-ff-mac-scheduler", SYSTEM)
{
SetVerbose (true);
NS_LOG_INFO ("creating LenaRrFfMacSchedulerTestCase");
// DOWNLINK- DISTANCE 0 -> MCS 28 -> Itbs 26 (from table 7.1.7.2.1-1 of 36.213)
// 1 user -> 24 PRB at Itbs 26 -> 2196 -> 2196000 bytes/sec
// 3 users -> 8 PRB at Itbs 26 -> 749 -> 749000 bytes/sec
@@ -76,14 +76,14 @@ LenaTestRrFfMacSchedulerSuite::LenaTestRrFfMacSchedulerSuite ()
AddTestCase (new LenaRrFfMacSchedulerTestCase (9,0,0,185000,185000));
AddTestCase (new LenaRrFfMacSchedulerTestCase (12,0,0,185000,185000));
AddTestCase (new LenaRrFfMacSchedulerTestCase (15,0,0,148000,89000));
// DOWNLINK - DISTANCE 3000 -> MCS 22 -> Itbs 20 (from table 7.1.7.2.1-1 of 36.213)
// 1 user -> 24 PRB at Itbs 20 -> 1383 -> 1383000 bytes/sec
// 3 users -> 8 PRB at Itbs 20 -> 469 -> 469000 bytes/sec
// 6 users -> 4 PRB at Itbs 20 -> 233 -> 233000 bytes/sec
// 9 user -> 2 PRB at Itbs 20 -> 113 -> 113000 bytes/sec
// 12 users -> 2 PRB at Itbs 20 -> 113 -> 113000 bytes/sec
// 15 users -> 2 PRB at Itbs 20 * 0.8 -> 90.4 -> 90400 bytes/sec
// 15 users -> 2 PRB at Itbs 20 * 0.8 -> 90.4 -> 90400 bytes/sec
// UPLINK - DISTANCE 3000 -> MCS 20 -> Itbs 18 (from table 7.1.7.2.1-1 of 36.213)
// 1 user -> 25 PRB at Itbs 18 -> 1239 -> 1239000 bytes/sec
// 3 users -> 8 PRB at Itbs 18 -> 389 -> 389000 bytes/sec
@@ -97,28 +97,28 @@ LenaTestRrFfMacSchedulerSuite::LenaTestRrFfMacSchedulerSuite ()
AddTestCase (new LenaRrFfMacSchedulerTestCase (9,0,3000,113000,97000));
AddTestCase (new LenaRrFfMacSchedulerTestCase (12,0,3000,113000,97000));
AddTestCase (new LenaRrFfMacSchedulerTestCase (15,0,3000,90400,47000));
// DOWNLINK - DISTANCE 6000 -> MCS 16 -> Itbs 15 (from table 7.1.7.2.1-1 of 36.213)
// 1 user -> 24 PRB at Itbs 15 -> 903 -> 903000 bytes/sec
// 3 users -> 8 PRB at Itbs 15 -> 309 -> 309000 bytes/sec
// 6 users -> 4 PRB at Itbs 15 -> 153 -> 153000 bytes/sec
// 9 user -> 2 PRB at Itbs 15 -> 75 -> 75000 bytes/sec
// 12 users -> 2 PRB at Itbs 15 -> 75 -> 75000 bytes/sec
// 15 users -> 2 PRB at Itbs 15 * 0.8 -> 60 -> 60000 bytes/sec
// 15 users -> 2 PRB at Itbs 15 * 0.8 -> 60 -> 60000 bytes/sec
// UPLINK - DISTANCE 6000 -> MCS 12 -> Itbs 11 (from table 7.1.7.2.1-1 of 36.213)
// 1 user -> 25 PRB at Itbs 11 -> 621 -> 621000 bytes/sec
// 3 users -> 8 PRB at Itbs 11 -> 201 -> 201000 bytes/sec
// 6 users -> 4 PRB at Itbs 11 -> 97 -> 97000 bytes/sec
// 9 user -> 2 PRB at Itbs 11 -> 47 -> 47000 bytes/sec
// 12 users -> 2 PRB at Itbs 11 -> 47 -> 47000 bytes/sec
// 15 users -> 1 PRB at Itbs 11 -> 22 -> 22000 bytes/sec
// 15 users -> 1 PRB at Itbs 11 -> 22 -> 22000 bytes/sec
AddTestCase (new LenaRrFfMacSchedulerTestCase (1,0,6000,903000,621000));
AddTestCase (new LenaRrFfMacSchedulerTestCase (3,0,6000,309000,201000));
AddTestCase (new LenaRrFfMacSchedulerTestCase (6,0,6000,153000,97000));
AddTestCase (new LenaRrFfMacSchedulerTestCase (9,0,6000,75000,47000));
AddTestCase (new LenaRrFfMacSchedulerTestCase (12,0,6000,75000,47000));
AddTestCase (new LenaRrFfMacSchedulerTestCase (15,0,6000,60000,22000));
// DOWNLINK - DISTANCE 9000 -> MCS 12 -> Itbs 11 (from table 7.1.7.2.1-1 of 36.213)
// 1 user -> 24 PRB at Itbs 11 -> 597 -> 597000 bytes/sec
// 3 users -> 8 PRB at Itbs 11 -> 201 -> 201000 bytes/sec
@@ -132,46 +132,46 @@ LenaTestRrFfMacSchedulerSuite::LenaTestRrFfMacSchedulerSuite ()
// 6 users -> 4 PRB at Itbs 8 -> 67 -> 67000 bytes/sec
// 9 user -> 2 PRB at Itbs 8 -> 32 -> 32000 bytes/sec
// 12 users -> 2 PRB at Itbs 8 -> 32 -> 32000 bytes/sec
// 15 users -> 1 PRB at Itbs 8 -> 15 -> 15000 bytes/sec
// 15 users -> 1 PRB at Itbs 8 -> 15 -> 15000 bytes/sec
AddTestCase (new LenaRrFfMacSchedulerTestCase (1,0,9000,597000,437000));
AddTestCase (new LenaRrFfMacSchedulerTestCase (3,0,9000,201000,137000));
AddTestCase (new LenaRrFfMacSchedulerTestCase (6,0,9000,97000,67000));
AddTestCase (new LenaRrFfMacSchedulerTestCase (9,0,9000,47000,32000));
AddTestCase (new LenaRrFfMacSchedulerTestCase (12,0,9000,47000,32000));
AddTestCase (new LenaRrFfMacSchedulerTestCase (15,0,9000,37600,15000));
// DOWNLINK - DISTANCE 15000 -> MCS 6 -> Itbs 6 (from table 7.1.7.2.1-1 of 36.213)
// 1 user -> 24 PRB at Itbs 6 -> 309 -> 309000 bytes/sec
// 3 users -> 8 PRB at Itbs 6 -> 101 -> 101000 bytes/sec
// 6 users -> 4 PRB at Itbs 6 -> 49 -> 49000 bytes/sec
// 9 user -> 2 PRB at Itbs 6 -> 22 -> 22000 bytes/sec
// 12 users -> 2 PRB at Itbs 6 -> 22 -> 22000 bytes/sec
// 15 users -> 2 PRB at Itbs 6 * 0.8 -> 17.6 -> 17600 bytes/sec
// 15 users -> 2 PRB at Itbs 6 * 0.8 -> 17.6 -> 17600 bytes/sec
// UPLINK - DISTANCE 15000 -> MCS 6 -> Itbs 6 (from table 7.1.7.2.1-1 of 36.213)
// 1 user -> 25 PRB at Itbs 6 -> 233 -> 233000 bytes/sec
// 3 users -> 8 PRB at Itbs 6 -> 69 -> 69000 bytes/sec
// 6 users -> 4 PRB at Itbs 6 -> 32 -> 32000 bytes/sec
// 9 user -> 2 PRB at Itbs 6 -> 15 -> 15000 bytes/sec
// 12 users -> 2 PRB at Itbs 6 -> 15 -> 15000 bytes/sec
// 15 users -> 1 PRB at Itbs 6 -> 7 -> 7000 bytes/sec
// 15 users -> 1 PRB at Itbs 6 -> 7 -> 7000 bytes/sec
AddTestCase (new LenaRrFfMacSchedulerTestCase (1,0,15000,309000,233000));
AddTestCase (new LenaRrFfMacSchedulerTestCase (3,0,15000,101000,69000));
AddTestCase (new LenaRrFfMacSchedulerTestCase (6,0,15000,49000,32000));
AddTestCase (new LenaRrFfMacSchedulerTestCase (9,0,15000,22000,15000));
AddTestCase (new LenaRrFfMacSchedulerTestCase (12,0,15000,22000,15000));
AddTestCase (new LenaRrFfMacSchedulerTestCase (15,0,15000,17600,7000));
}
static LenaTestRrFfMacSchedulerSuite lenaTestRrFfMacSchedulerSuite;
LenaRrFfMacSchedulerTestCase::LenaRrFfMacSchedulerTestCase (uint16_t nUser, uint16_t nLc, uint16_t dist, double thrRefDl, double thrRefUl)
: TestCase (""),
m_nUser (nUser),
m_nLc (nLc),
m_dist (dist),
m_thrRefDl (thrRefDl),
m_thrRefUl (thrRefUl)
m_nUser (nUser),
m_nLc (nLc),
m_dist (dist),
m_thrRefDl (thrRefDl),
m_thrRefUl (thrRefUl)
{
std::ostringstream oss;
oss << nUser << " UEs, distance " << dist << " m" ;
@@ -214,51 +214,51 @@ LenaRrFfMacSchedulerTestCase::DoRun (void)
LogComponentEnable ("LenaTestRrFfMacCheduler", LOG_LEVEL_ALL);
// LogComponentEnable ("LteAmc", LOG_LEVEL_ALL);
// LogComponentEnable ("RlcStatsCalculator", LOG_LEVEL_ALL);
/**
* Initialize Simulation Scenario: 1 eNB and m_nUser UEs
*/
SetVerbose (true);
Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
// Create Nodes: eNodeB and UE
NodeContainer enbNodes;
NodeContainer ueNodes;
enbNodes.Create (1);
ueNodes.Create (m_nUser);
// Install Mobility Model
MobilityHelper mobility;
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (enbNodes);
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (ueNodes);
// Create Devices and install them in the Nodes (eNB and UE)
NetDeviceContainer enbDevs;
NetDeviceContainer ueDevs;
lena->SetSchedulerType ("ns3::RrFfMacScheduler");
enbDevs = lena->InstallEnbDevice (enbNodes);
ueDevs = lena->InstallUeDevice (ueNodes);
// Attach a UE to a eNB
lena->Attach (ueDevs, enbDevs.Get (0));
lena->Attach (ueDevs, enbDevs.Get (0));
// Activate an EPS bearer
enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
EpsBearer bearer (q);
lena->ActivateEpsBearer (ueDevs, bearer);
lena->SetAttribute ("PropagationModel", StringValue ("ns3::FriisSpectrumPropagationLossModel"));
Ptr<LteEnbNetDevice> lteEnbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
Ptr<LteEnbPhy> enbPhy = lteEnbDev->GetPhy ();
enbPhy->SetAttribute ("TxPower", DoubleValue (30.0));
enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0));
// Set UEs' position and power
for (int i = 0; i < m_nUser; i++)
{
@@ -269,45 +269,45 @@ LenaRrFfMacSchedulerTestCase::DoRun (void)
uePhy->SetAttribute ("TxPower", DoubleValue (23.0));
uePhy->SetAttribute ("NoiseFigure", DoubleValue (9.0));
}
lena->EnableRlcTraces ();
double simulationTime = 0.4;
double tolerance = 0.1;
Simulator::Stop (Seconds (simulationTime));
Ptr<RlcStatsCalculator> rlcStats = lena->GetRlcStats ();
rlcStats->SetAttribute ("EpochDuration", TimeValue(Seconds(simulationTime)));
Ptr<RlcStatsCalculator> rlcStats = lena->GetRlcStats ();
rlcStats->SetAttribute ("EpochDuration", TimeValue (Seconds (simulationTime)));
Simulator::Run ();
/**
* Check that the assignation is done in a RR fashion
*/
NS_LOG_INFO("DL - Test with " << m_nUser << " user(s) at distance " << m_dist);
NS_LOG_INFO ("DL - Test with " << m_nUser << " user(s) at distance " << m_dist);
std::vector <uint64_t> dlDataRxed;
for (int i = 0; i < m_nUser; i++)
{
// get the imsi
uint64_t imsi = ueDevs.Get (i)-> GetObject<LteUeNetDevice> ()->GetImsi ();
uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
// get the lcId
uint8_t lcId = ueDevs.Get (i)-> GetObject<LteUeNetDevice> ()->GetRrc ()->GetLcIdVector().at(0);
uint8_t lcId = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetRrc ()->GetLcIdVector ().at (0);
dlDataRxed.push_back (rlcStats->GetDlRxData (imsi, lcId));
NS_LOG_INFO ("\tUser " << i << " imsi " << imsi << " bytes rxed " << (double)dlDataRxed.at (i) << " thr " << (double)dlDataRxed.at (i) / simulationTime << " ref " << m_thrRefDl);
NS_TEST_ASSERT_MSG_EQ_TOL ((double)dlDataRxed.at (i) / simulationTime, m_thrRefDl, m_thrRefDl * tolerance, " Unfair Throughput!");
NS_TEST_ASSERT_MSG_EQ_TOL ((double)dlDataRxed.at (i) / simulationTime, m_thrRefDl, m_thrRefDl * tolerance, " Unfair Throughput!");
}
NS_LOG_INFO("UL - Test with " << m_nUser << " user(s) at distance " << m_dist);
NS_LOG_INFO ("UL - Test with " << m_nUser << " user(s) at distance " << m_dist);
std::vector <uint64_t> ulDataRxed;
for (int i = 0; i < m_nUser; i++)
{
// get the imsi
uint64_t imsi = ueDevs.Get (i)-> GetObject<LteUeNetDevice> ()->GetImsi ();
uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
// get the lcId
uint8_t lcId = ueDevs.Get (i)-> GetObject<LteUeNetDevice> ()->GetRrc ()->GetLcIdVector().at(0);
uint8_t lcId = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetRrc ()->GetLcIdVector ().at (0);
ulDataRxed.push_back (rlcStats->GetUlRxData (imsi, lcId));
NS_LOG_INFO ("\tUser " << i << " imsi " << imsi << " bytes txed " << (double)ulDataRxed.at (i) << " thr " << (double)ulDataRxed.at (i) / simulationTime << " ref " << m_thrRefUl);
NS_TEST_ASSERT_MSG_EQ_TOL ((double)ulDataRxed.at (i) / simulationTime, m_thrRefUl, m_thrRefUl * tolerance, " Unfair Throughput!");
NS_TEST_ASSERT_MSG_EQ_TOL ((double)ulDataRxed.at (i) / simulationTime, m_thrRefUl, m_thrRefUl * tolerance, " Unfair Throughput!");
}
Simulator::Destroy ();

View File

@@ -39,26 +39,26 @@ using namespace ns3;
*/
class LenaRrFfMacSchedulerTestCase : public TestCase
{
public:
LenaRrFfMacSchedulerTestCase (uint16_t nUser, uint16_t nLc, uint16_t dist, double thrRefDl, double thrRefUl);
virtual ~LenaRrFfMacSchedulerTestCase ();
public:
LenaRrFfMacSchedulerTestCase (uint16_t nUser, uint16_t nLc, uint16_t dist, double thrRefDl, double thrRefUl);
virtual ~LenaRrFfMacSchedulerTestCase ();
private:
virtual void DoRun (void);
uint16_t m_nUser;
uint16_t m_nLc;
uint16_t m_dist;
double m_thrRefDl;
double m_thrRefUl;
private:
virtual void DoRun (void);
uint16_t m_nUser;
uint16_t m_nLc;
uint16_t m_dist;
double m_thrRefDl;
double m_thrRefUl;
};
class LenaTestRrFfMacSchedulerSuite : public TestSuite
{
public:
LenaTestRrFfMacSchedulerSuite ();
public:
LenaTestRrFfMacSchedulerSuite ();
};

View File

@@ -38,10 +38,10 @@ public:
protected:
Ptr<SpectrumModel> m_actual;
Ptr<SpectrumModel> m_expected;
Ptr<SpectrumModel> m_expected;
private:
virtual void DoRun (void);
private:
virtual void DoRun (void);
};
LteSpectrumModelTestCase::LteSpectrumModelTestCase (const char* str, uint16_t earfcn, uint8_t bw, std::vector<double> fcs)
@@ -49,7 +49,7 @@ LteSpectrumModelTestCase::LteSpectrumModelTestCase (const char* str, uint16_t ea
{
NS_LOG_FUNCTION (this << str << earfcn << bw);
m_actual = LteSpectrumValueHelper::GetSpectrumModel (earfcn, bw);
m_expected = Create<SpectrumModel> (fcs);
m_expected = Create<SpectrumModel> (fcs);
}
LteSpectrumModelTestCase::~LteSpectrumModelTestCase ()
@@ -74,18 +74,18 @@ public:
protected:
Ptr<SpectrumValue> m_actual;
Ptr<SpectrumValue> m_expected;
Ptr<SpectrumValue> m_expected;
private:
virtual void DoRun (void);
private:
virtual void DoRun (void);
};
LteNoisePsdTestCase::LteNoisePsdTestCase (const char* str, uint16_t earfcn, uint8_t bw, double noiseFigureDb, SpectrumValue& expected)
: TestCase (str),
m_actual (LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (earfcn, bw, noiseFigureDb)),
m_expected (Create<SpectrumValue> (expected))
m_actual (LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (earfcn, bw, noiseFigureDb)),
m_expected (Create<SpectrumValue> (expected))
{
NS_LOG_FUNCTION (this << str << earfcn << bw << noiseFigureDb);
NS_LOG_FUNCTION (this << str << earfcn << bw << noiseFigureDb);
}
LteNoisePsdTestCase::~LteNoisePsdTestCase ()
@@ -111,18 +111,18 @@ public:
protected:
Ptr<SpectrumValue> m_actual;
Ptr<SpectrumValue> m_expected;
Ptr<SpectrumValue> m_expected;
private:
virtual void DoRun (void);
private:
virtual void DoRun (void);
};
LteTxPsdTestCase::LteTxPsdTestCase (const char* str, uint16_t earfcn, uint8_t bw, double txPowerDbm, std::vector<int> activeRbs, SpectrumValue& expected)
: TestCase (str),
m_actual (LteSpectrumValueHelper::CreateTxPowerSpectralDensity (earfcn, bw, txPowerDbm, activeRbs)),
m_expected (Create<SpectrumValue> (expected))
m_actual (LteSpectrumValueHelper::CreateTxPowerSpectralDensity (earfcn, bw, txPowerDbm, activeRbs)),
m_expected (Create<SpectrumValue> (expected))
{
NS_LOG_FUNCTION (this << str << earfcn << bw << txPowerDbm);
NS_LOG_FUNCTION (this << str << earfcn << bw << txPowerDbm);
}
LteTxPsdTestCase::~LteTxPsdTestCase ()

View File

@@ -194,7 +194,7 @@ LteUplinkSinrTestCase::DoRun (void)
// Phy tags
LtePhyTag pktTag[numOfPbs];
/**
* Build packet burst (Data and interference)
*/
@@ -234,7 +234,7 @@ LteUplinkSinrTestCase::DoRun (void)
{
// Create phy tag (different for each packet burst)
// and add to the first packet
pktTag[pb] = LtePhyTag (100 * (pb+1));
pktTag[pb] = LtePhyTag (100 * (pb + 1));
pkt[pb][i]->AddPacketTag ( pktTag[pb] );
}
@@ -279,13 +279,13 @@ LteUplinkSinrTestCase::DoRun (void)
*/
// 2 UEs send data to the eNB through 2 subcarriers
Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, ulPhy, packetBursts[0], m_sv1, ulPhy->GetSpectrumType(), ds);
Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, ulPhy, packetBursts[1], m_sv2, ulPhy->GetSpectrumType(), ds);
Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, ulPhy, packetBursts[0], m_sv1, ulPhy->GetSpectrumType (), ds);
Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, ulPhy, packetBursts[1], m_sv2, ulPhy->GetSpectrumType (), ds);
Simulator::Schedule (ti1, &LteSpectrumPhy::StartRx, ulPhy, packetBursts[2], i1, ulPhy->GetSpectrumType(), di1);
Simulator::Schedule (ti2, &LteSpectrumPhy::StartRx, ulPhy, packetBursts[3], i2, ulPhy->GetSpectrumType(), di2);
Simulator::Schedule (ti3, &LteSpectrumPhy::StartRx, ulPhy, packetBursts[4], i3, ulPhy->GetSpectrumType(), di3);
Simulator::Schedule (ti4, &LteSpectrumPhy::StartRx, ulPhy, packetBursts[5], i4, ulPhy->GetSpectrumType(), di4);
Simulator::Schedule (ti1, &LteSpectrumPhy::StartRx, ulPhy, packetBursts[2], i1, ulPhy->GetSpectrumType (), di1);
Simulator::Schedule (ti2, &LteSpectrumPhy::StartRx, ulPhy, packetBursts[3], i2, ulPhy->GetSpectrumType (), di2);
Simulator::Schedule (ti3, &LteSpectrumPhy::StartRx, ulPhy, packetBursts[4], i3, ulPhy->GetSpectrumType (), di3);
Simulator::Schedule (ti4, &LteSpectrumPhy::StartRx, ulPhy, packetBursts[5], i4, ulPhy->GetSpectrumType (), di4);
Simulator::Stop (Seconds (5.0));
Simulator::Run ();

View File

@@ -41,17 +41,17 @@ public:
class LteUplinkSinrTestCase : public TestCase
{
public:
LteUplinkSinrTestCase (Ptr<SpectrumValue> sv1, Ptr<SpectrumValue> sv2, Ptr<SpectrumValue> sinr, std::string name);
virtual ~LteUplinkSinrTestCase ();
public:
LteUplinkSinrTestCase (Ptr<SpectrumValue> sv1, Ptr<SpectrumValue> sv2, Ptr<SpectrumValue> sinr, std::string name);
virtual ~LteUplinkSinrTestCase ();
private:
virtual void DoRun (void);
private:
virtual void DoRun (void);
Ptr<SpectrumValue> m_sv1;
Ptr<SpectrumValue> m_sv2;
Ptr<const SpectrumModel> m_sm;
Ptr<SpectrumValue> m_sinr;
Ptr<SpectrumValue> m_sv1;
Ptr<SpectrumValue> m_sv2;
Ptr<const SpectrumModel> m_sm;
Ptr<SpectrumValue> m_sinr;
};