Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(152)

Unified Diff: src/lte/model/lte-enb-phy.cc

Issue 130130043: GSoC 2014 LTE FFR algorithms project
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/lte/model/lte-enb-phy.cc
===================================================================
--- a/src/lte/model/lte-enb-phy.cc
+++ b/src/lte/model/lte-enb-phy.cc
@@ -75,7 +75,7 @@
virtual void SetCellId (uint16_t cellId);
virtual void SendLteControlMessage (Ptr<LteControlMessage> msg);
virtual uint8_t GetMacChTtiDelay ();
-
+
private:
LteEnbPhy* m_phy;
@@ -279,6 +279,13 @@
return m_txPower;
}
+int8_t
+LteEnbPhy::DoGetReferenceSignalPower () const
+{
+ NS_LOG_FUNCTION (this);
+ return m_txPower;
+}
+
void
LteEnbPhy::SetNoiseFigure (double nf)
{
@@ -400,6 +407,15 @@
m_downlinkSpectrumPhy->SetTxPowerSpectralDensity (txPsd);
}
+void
+LteEnbPhy::SetDownlinkSubChannelsWithPowerAllocation (std::vector<int> mask)
+{
+ NS_LOG_FUNCTION (this);
+ m_listOfDownlinkSubchannel = mask;
+ Ptr<SpectrumValue> txPsd = CreateTxPowerSpectralDensityWithPowerAllocation ();
+ m_downlinkSpectrumPhy->SetTxPowerSpectralDensity (txPsd);
+}
+
std::vector<int>
LteEnbPhy::GetDownlinkSubChannels (void)
{
@@ -407,6 +423,21 @@
return m_listOfDownlinkSubchannel;
}
+void
+LteEnbPhy::GeneratePowerAllocationMap (uint16_t rnti, int rbId)
+{
+ NS_LOG_FUNCTION (this);
+ double rbgTxPower = m_txPower;
+
+ std::map<uint16_t, double>::iterator it = m_paMap.find (rnti);
+ if (it != m_paMap.end ())
+ {
+ rbgTxPower = m_txPower + it->second;
+ }
+
+ m_dlPowerAllocationMap.insert (std::pair<int, double>(rbId, rbgTxPower));
+}
+
Ptr<SpectrumValue>
LteEnbPhy::CreateTxPowerSpectralDensity ()
{
@@ -417,6 +448,16 @@
return psd;
}
+Ptr<SpectrumValue>
+LteEnbPhy::CreateTxPowerSpectralDensityWithPowerAllocation ()
+{
+ NS_LOG_FUNCTION (this);
+
+ Ptr<SpectrumValue> psd = LteSpectrumValueHelper::CreateTxPowerSpectralDensity (m_dlEarfcn, m_dlBandwidth, m_txPower, m_dlPowerAllocationMap, GetDownlinkSubChannels ());
+
+ return psd;
+}
+
void
LteEnbPhy::CalcChannelQualityForUe (std::vector <double> sinr, Ptr<LteSpectrumPhy> ue)
@@ -448,7 +489,7 @@
{
NS_LOG_FUNCTION (this);
std::list<Ptr<LteControlMessage> >::iterator it;
- for (it = msgList.begin (); it != msgList.end(); it++)
+ for (it = msgList.begin (); it != msgList.end (); it++)
{
switch ((*it)->GetMessageType ())
{
@@ -490,7 +531,7 @@
m_enbPhySapUser->ReceiveLteControlMessage (*it);
}
}
- break;
+ break;
default:
NS_FATAL_ERROR ("Unexpected LteControlMessage type");
break;
@@ -543,13 +584,13 @@
if (m_srsPeriodicity>0)
{
// might be 0 in case the eNB has no UEs attached
- NS_ASSERT_MSG (m_nrFrames > 1, "the SRS index check code assumes that frameNo starts at 1");
+ NS_ASSERT_MSG (m_nrFrames > 1, "the SRS index check code assumes that frameNo starts at 1");
NS_ASSERT_MSG (m_nrSubFrames > 0 && m_nrSubFrames <= 10, "the SRS index check code assumes that subframeNo starts at 1");
m_currentSrsOffset = (((m_nrFrames-1)*10 + (m_nrSubFrames-1)) % m_srsPeriodicity);
}
NS_LOG_INFO ("-----sub frame " << m_nrSubFrames << "-----");
m_harqPhyModule->SubframeIndication (m_nrFrames, m_nrSubFrames);
-
+
// update info on TB to be received
std::list<UlDciLteControlMessage> uldcilist = DequeueUlDci ();
std::list<UlDciLteControlMessage>::iterator dciIt = uldcilist.begin ();
@@ -558,7 +599,7 @@
{
std::set <uint16_t>::iterator it2;
it2 = m_ueAttached.find ((*dciIt).GetDci ().m_rnti);
-
+
if (it2 == m_ueAttached.end ())
{
NS_LOG_ERROR ("UE not attached");
@@ -587,6 +628,7 @@
// process the current burst of control messages
std::list<Ptr<LteControlMessage> > ctrlMsg = GetControlMessages ();
m_dlDataRbMap.clear ();
+ m_dlPowerAllocationMap.clear ();
if (ctrlMsg.size () > 0)
{
std::list<Ptr<LteControlMessage> >::iterator it;
@@ -608,6 +650,7 @@
{
m_dlDataRbMap.push_back ((i * GetRbgSize ()) + k);
//NS_LOG_DEBUG(this << " [enb]DL-DCI allocated PRB " << (i*GetRbgSize()) + k);
+ GeneratePowerAllocationMap (dci->GetDci ().m_rnti, (i * GetRbgSize ()) + k );
}
}
mask = (mask << 1);
@@ -628,7 +671,7 @@
params.m_ndi = dci->GetDci ().m_ndi.at (i);
m_dlPhyTransmission (params);
}
-
+
}
else if (msg->GetMessageType () == LteControlMessage::UL_DCI)
{
@@ -665,16 +708,16 @@
}
}
-
+
SendControlChannels (ctrlMsg);
-
+
// send data frame
Ptr<PacketBurst> pb = GetPacketBurst ();
if (pb)
{
Simulator::Schedule (DL_CTRL_DELAY_FROM_SUBFRAME_START, // ctrl frame fixed to 3 symbols
- &LteEnbPhy::SendDataChannels,
- this,pb);
+ &LteEnbPhy::SendDataChannels,
+ this,pb);
}
// trigger the MAC
@@ -704,14 +747,14 @@
pss = true;
}
m_downlinkSpectrumPhy->StartTxDlCtrlFrame (ctrlMsgList, pss);
-
+
}
void
LteEnbPhy::SendDataChannels (Ptr<PacketBurst> pb)
{
// set the current tx power spectral density
- SetDownlinkSubChannels (m_dlDataRbMap);
+ SetDownlinkSubChannelsWithPowerAllocation (m_dlDataRbMap);
// send the current burts of packets
NS_LOG_LOGIC (this << " eNB start TX DATA");
std::list<Ptr<LteControlMessage> > ctrlMsgList;
@@ -845,6 +888,9 @@
bool success = AddUePhy (rnti);
NS_ASSERT_MSG (success, "AddUePhy() failed");
+
+ // add default P_A value
+ DoSetPa (rnti, 0);
}
void
@@ -854,8 +900,29 @@
bool success = DeleteUePhy (rnti);
NS_ASSERT_MSG (success, "DeleteUePhy() failed");
+
+ // remove also P_A value
+ std::map<uint16_t, double>::iterator it = m_paMap.find (rnti);
+ if(it != m_paMap.end ()) {
+ m_paMap.erase (it);
+ }
+
}
+void
+LteEnbPhy::DoSetPa (uint16_t rnti, double pa)
+{
+ NS_LOG_FUNCTION (this << rnti);
+
+ std::map<uint16_t, double>::iterator it = m_paMap.find (rnti);
+
+ if(it == m_paMap.end ()) {
+ m_paMap.insert (std::pair<uint16_t, double>(rnti, pa));
+ } else {
+ it->second = pa;
+ }
+
+}
FfMacSchedSapProvider::SchedUlCqiInfoReqParameters
LteEnbPhy::CreateSrsCqiReport (const SpectrumValue& sinr)
@@ -867,15 +934,15 @@
int i = 0;
double srsSum = 0.0;
for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++)
- {
- double sinrdb = 10 * log10 ((*it));
- // NS_LOG_DEBUG ("ULCQI RB " << i << " value " << sinrdb);
- // convert from double to fixed point notation Sxxxxxxxxxxx.xxx
- int16_t sinrFp = LteFfConverter::double2fpS11dot3 (sinrdb);
- srsSum += (*it);
- ulcqi.m_ulCqi.m_sinr.push_back (sinrFp);
- i++;
- }
+ {
+ double sinrdb = 10 * log10 ((*it));
+ // NS_LOG_DEBUG ("ULCQI RB " << i << " value " << sinrdb);
+ // convert from double to fixed point notation Sxxxxxxxxxxx.xxx
+ int16_t sinrFp = LteFfConverter::double2fpS11dot3 (sinrdb);
+ srsSum += (*it);
+ ulcqi.m_ulCqi.m_sinr.push_back (sinrFp);
+ i++;
+ }
// Insert the user generated the srs as a vendor specific parameter
NS_LOG_DEBUG (this << " ENB RX UL-CQI of " << m_srsUeOffset.at (m_currentSrsOffset));
VendorSpecificListElement_s vsp;
@@ -888,12 +955,12 @@
CreateSrsReport (m_srsUeOffset.at (m_currentSrsOffset),
(i > 0) ? (srsSum / i) : DBL_MAX);
return (ulcqi);
-
+
}
void
-LteEnbPhy::CreateSrsReport(uint16_t rnti, double srs)
+LteEnbPhy::CreateSrsReport (uint16_t rnti, double srs)
{
NS_LOG_FUNCTION (this << rnti << srs);
std::map <uint16_t,uint16_t>::iterator it = m_srsSampleCounterMap.find (rnti);
@@ -976,7 +1043,7 @@
m_srsCounter.insert (std::pair<uint16_t, uint16_t> (rnti, GetSrsSubframeOffset (srcCi) + 1));
}
m_srsUeOffset.at (GetSrsSubframeOffset (srcCi)) = rnti;
-
+
}

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b