run check-style on src/lte/model

This commit is contained in:
Nicola Baldo
2011-06-17 17:32:20 +02:00
parent 0ad2cadc63
commit 705c30aec9
38 changed files with 740 additions and 747 deletions

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

@@ -72,20 +72,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)
{
@@ -108,26 +106,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;
}
@@ -153,7 +151,7 @@ TypeId UeInfo::GetTypeId (void)
UintegerValue (1),
MakeUintegerAccessor (&UeInfo::m_imsi),
MakeUintegerChecker<uint64_t> ())*/
;
;
return tid;
}
@@ -173,7 +171,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;
}
@@ -247,32 +245,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

@@ -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