Update m_macChTtiDelay fixed to 4 in UL (standard) and make schedulers unaware of channel delays (tests updated according to new delay)

This commit is contained in:
mmiozzo
2012-04-25 17:36:25 +02:00
parent 3d0c117f6c
commit 4fa0cff039
17 changed files with 114 additions and 85 deletions

View File

@@ -24,6 +24,9 @@
#include "ns3/uinteger.h"
#include <math.h>
// see 36.213 section 8
#define UL_PUSCH_TTIS_DELAY 4
namespace ns3 {

View File

@@ -381,7 +381,7 @@ LteEnbMac::GetLteEnbPhySapUser ()
void
LteEnbMac::DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo)
{
NS_LOG_FUNCTION (this);
NS_LOG_FUNCTION (this << " EnbMac - frame " << frameNo << " subframe " << subframeNo);
// Store current frame / subframe number
m_frameNo = frameNo;
@@ -407,8 +407,22 @@ LteEnbMac::DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo)
// Get downlink transmission opportunities
// uint32_t dlSchedFrameNo = (0x3FF & (m_frameNo >> 4));
// uint32_t dlSchedSubframeNo = (0xF & m_subframeNo);
uint32_t dlSchedFrameNo = m_frameNo;
uint32_t dlSchedSubframeNo = m_subframeNo;
// NS_LOG_DEBUG (this << " sfn " << frameNo << " sbfn " << subframeNo);
if (dlSchedSubframeNo + m_macChTtiDelay > 10)
{
dlSchedFrameNo++;
dlSchedSubframeNo = (dlSchedSubframeNo + m_macChTtiDelay) % 10;
}
else
{
dlSchedSubframeNo = dlSchedSubframeNo + m_macChTtiDelay;
}
FfMacSchedSapProvider::SchedDlTriggerReqParameters params; // to be filled
params.m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo);
params.m_sfnSf = ((0x3FF & dlSchedFrameNo) << 4) | (0xF & dlSchedSubframeNo);
m_schedSapProvider->SchedDlTriggerReq (params);
@@ -417,7 +431,14 @@ LteEnbMac::DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo)
if (m_ulCqiReceived.size () > 0)
{
FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqiInfoReq;
ulcqiInfoReq.m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo);
if (subframeNo>1)
{
ulcqiInfoReq.m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo);
}
else
{
ulcqiInfoReq.m_sfnSf = ((0x3FF & (frameNo-1)) << 4) | (0xF & 10);
}
int cqiNum = m_ulCqiReceived.size ();
if (cqiNum >= 1)
{
@@ -446,8 +467,21 @@ LteEnbMac::DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo)
// Get uplink transmission opportunities
uint32_t ulSchedFrameNo = m_frameNo;
uint32_t ulSchedSubframeNo = m_subframeNo;
// NS_LOG_DEBUG (this << " sfn " << frameNo << " sbfn " << subframeNo);
if (ulSchedSubframeNo + (m_macChTtiDelay+UL_PUSCH_TTIS_DELAY) > 10)
{
ulSchedFrameNo++;
ulSchedSubframeNo = (ulSchedSubframeNo + (m_macChTtiDelay+UL_PUSCH_TTIS_DELAY)) % 10;
}
else
{
// ulSchedSubframeNo = (ulSchedSubframeNo + (2*m_macChTtiDelay)) % 11;
ulSchedSubframeNo = ulSchedSubframeNo + (m_macChTtiDelay+UL_PUSCH_TTIS_DELAY);
}
FfMacSchedSapProvider::SchedUlTriggerReqParameters ulparams;
ulparams.m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo);
ulparams.m_sfnSf = ((0x3FF & ulSchedFrameNo) << 4) | (0xF & ulSchedSubframeNo);
std::map <uint16_t,UlInfoListElement_s>::iterator it;
for (it = m_ulInfoListElements.begin (); it != m_ulInfoListElements.end (); it++)
@@ -592,6 +626,7 @@ LteEnbMac::DoConfigureMac (uint8_t ulBandwidth, uint8_t dlBandwidth)
// Configure the subset of parameters used by FfMacScheduler
params.m_ulBandwidth = ulBandwidth;
params.m_dlBandwidth = dlBandwidth;
m_macChTtiDelay = m_enbPhySapProvider->GetMacChTtiDelay ();
// ...more parameters can be configured
m_cschedSapProvider->CschedCellConfigReq (params);
}

View File

@@ -227,6 +227,9 @@ private:
* Frame number, Subframe number, RNTI, MCS of TB, size of TB
*/
TracedCallback<uint32_t, uint32_t, uint16_t, uint8_t, uint16_t> m_ulScheduling;
uint8_t m_macChTtiDelay; // delay of MAC, PHY and channel in terms of TTIs
};

View File

@@ -72,6 +72,12 @@ public:
* \param msg the Ideal Control Message to send
*/
virtual void SendIdealControlMessage (Ptr<IdealControlMessage> msg) = 0;
/**
* \brief Get the delay from MAC to Channel expressed in TTIs
*
*/
virtual uint8_t GetMacChTtiDelay () = 0;
};

View File

@@ -56,6 +56,7 @@ public:
virtual void SetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth);
virtual void SetCellId (uint16_t cellId);
virtual void SendIdealControlMessage (Ptr<IdealControlMessage> msg);
virtual uint8_t GetMacChTtiDelay ();
virtual void SetTransmissionMode (uint16_t rnti, uint8_t txMode);
@@ -93,6 +94,12 @@ EnbMemberLteEnbPhySapProvider::SendIdealControlMessage (Ptr<IdealControlMessage>
m_phy->DoSendIdealControlMessage (msg);
}
uint8_t
EnbMemberLteEnbPhySapProvider::GetMacChTtiDelay ()
{
return (m_phy->DoGetMacChTtiDelay ());
}
void
EnbMemberLteEnbPhySapProvider::SetTransmissionMode (uint16_t rnti, uint8_t txMode)
{
@@ -122,11 +129,6 @@ LteEnbPhy::LteEnbPhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy)
{
m_enbPhySapProvider = new EnbMemberLteEnbPhySapProvider (this);
Simulator::ScheduleNow (&LteEnbPhy::StartFrame, this);
for (int i = 0; i < m_macChTtiDelay; i++)
{
std::list<UlDciIdealControlMessage> l;
m_ulDciQueue.push_back (l);
}
}
TypeId
@@ -231,7 +233,20 @@ void
LteEnbPhy::SetMacChDelay (uint8_t delay)
{
m_macChTtiDelay = delay;
m_packetBurstQueue.resize (delay);
for (int i = 0; i < m_macChTtiDelay; i++)
{
Ptr<PacketBurst> pb = CreateObject <PacketBurst> ();
m_packetBurstQueue.push_back (pb);
std::list<Ptr<IdealControlMessage> > l;
m_controlMessagesQueue.push_back (l);
std::list<UlDciIdealControlMessage> l1;
m_ulDciQueue.push_back (l1);
}
for (int i = 0; i < UL_PUSCH_TTIS_DELAY; i++)
{
std::list<UlDciIdealControlMessage> l1;
m_ulDciQueue.push_back (l1);
}
}
uint8_t
@@ -283,6 +298,12 @@ LteEnbPhy::DoSendMacPdu (Ptr<Packet> p)
SetMacPdu (p);
}
uint8_t
LteEnbPhy::DoGetMacChTtiDelay ()
{
return (m_macChTtiDelay);
}
void
LteEnbPhy::PhyPduReceived (Ptr<Packet> p)
@@ -534,7 +555,7 @@ void
LteEnbPhy::QueueUlDci (UlDciIdealControlMessage m)
{
NS_LOG_FUNCTION (this);
m_ulDciQueue.at (m_macChTtiDelay - 1).push_back (m);
m_ulDciQueue.at (UL_PUSCH_TTIS_DELAY - 1).push_back (m);
}
std::list<UlDciIdealControlMessage>

View File

@@ -111,6 +111,8 @@ public:
* \param p the MAC PDU to sent
*/
virtual void DoSendMacPdu (Ptr<Packet> p);
virtual uint8_t DoGetMacChTtiDelay ();
void DoSetDownlinkSubChannels ();

View File

@@ -48,19 +48,9 @@ LtePhy::LtePhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy)
m_ulBandwidth (0),
m_dlBandwidth (0),
m_rbgSize (0),
m_macChTtiDelay (2) // 1 TTI delay between MAC and CH
m_macChTtiDelay (0)
{
NS_LOG_FUNCTION (this);
for (int i = 0; i < m_macChTtiDelay; i++)
{
Ptr<PacketBurst> pb = CreateObject <PacketBurst> ();
m_packetBurstQueue.push_back (pb);
}
for (int i = 0; i < m_macChTtiDelay; i++)
{
std::list<Ptr<IdealControlMessage> > l;
m_controlMessagesQueue.push_back (l);
}
}

View File

@@ -388,8 +388,15 @@ LteUeMac::DoReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
if (itBsr!=m_ulBsrReceived.end ())
{
NS_LOG_FUNCTION (this << "\t" << dci.m_tbSize / m_macSapUserMap.size () << " bytes to LC " << (uint16_t)(*it).first << " queue " << (*itBsr).second);
(*it).second->NotifyTxOpportunity (dci.m_tbSize / activeLcs, 0); // UE works only in SISO mode
(*itBsr).second -= dci.m_tbSize / activeLcs;
(*it).second->NotifyTxOpportunity (dci.m_tbSize / activeLcs, 0);
if ((*itBsr).second >= dci.m_tbSize / activeLcs)
{
(*itBsr).second -= dci.m_tbSize / activeLcs;
}
else
{
(*itBsr).second = 0;
}
}
}

View File

@@ -35,6 +35,7 @@
#include "lte-ue-mac.h"
#include "ff-mac-common.h"
#include "lte-sinr-chunk-processor.h"
#include <ns3/lte-common.h>
NS_LOG_COMPONENT_DEFINE ("LteUePhy");
@@ -118,8 +119,15 @@ LteUePhy::LteUePhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy)
{
m_amc = CreateObject <LteAmc> ();
m_uePhySapProvider = new UeMemberLteUePhySapProvider (this);
m_macChTtiDelay = UL_PUSCH_TTIS_DELAY + 1; // +1 for avoiding UL/DL trigger synchronization remove 1 TTI of delay
for (int i = 0; i < m_macChTtiDelay; i++)
{
Ptr<PacketBurst> pb = CreateObject <PacketBurst> ();
m_packetBurstQueue.push_back (pb);
std::list<Ptr<IdealControlMessage> > l;
m_controlMessagesQueue.push_back (l);
}
std::vector <int> ulRb;
SetMacChDelay (m_macChTtiDelay + 1); // +1 for avoiding UL/DL trigger synchronization remove 1 TTI of delay
m_subChannelsForTransmissionQueue.resize (m_macChTtiDelay, ulRb);
}
@@ -253,13 +261,6 @@ LteUePhy::GetTxPower () const
return m_txPower;
}
void
LteUePhy::SetMacChDelay (uint8_t delay)
{
m_macChTtiDelay = delay;
Ptr<PacketBurst> pb = CreateObject <PacketBurst> ();
m_packetBurstQueue.resize (delay, pb);
}
uint8_t
LteUePhy::GetMacChDelay (void) const
@@ -527,6 +528,7 @@ LteUePhy::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
else if (msg->GetMessageType () == IdealControlMessage::UL_DCI)
{
// set the uplink bandwidht according to the UL-CQI
NS_LOG_DEBUG (this << " UL DCI");
Ptr<UlDciIdealControlMessage> msg2 = DynamicCast<UlDciIdealControlMessage> (msg);
UlDciListElement_s dci = msg2->GetDci ();
std::vector <int> ulRb;
@@ -592,7 +594,7 @@ LteUePhy::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
Ptr<PacketBurst> pb = GetPacketBurst ();
if (pb)
{
NS_LOG_LOGIC (this << " UE " << m_rnti << " start TX " << pb->GetNPackets());
NS_LOG_LOGIC (this << " UE - start TX");
m_uplinkSpectrumPhy->StartTx (pb);
}

View File

@@ -101,11 +101,6 @@ public:
*/
double GetNoiseFigure () const;
/**
* \param delay the TTI delay between MAC and channel
*/
void SetMacChDelay (uint8_t delay);
/**
* \returns the TTI delay between MAC and channel
*/

View File

@@ -211,8 +211,6 @@ PfFfMacScheduler::PfFfMacScheduler ()
: m_cschedSapUser (0),
m_schedSapUser (0),
m_timeWindow (99.0),
m_schedTtiDelay (4),
// WILD HACK: based on a m_macChTtiDelay = 2
m_nextRntiUl (0)
{
m_amc = CreateObject <LteAmc> ();
@@ -811,7 +809,7 @@ PfFfMacScheduler::EstimateUlSinr (uint16_t rnti, uint16_t rb)
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 << " UL - Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf));
RefreshUlCqiMaps ();
@@ -1047,26 +1045,11 @@ void
PfFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters& params)
{
NS_LOG_FUNCTION (this);
// NS_LOG_DEBUG (this << " RX SFNID " << params.m_sfnSf << " delay " << (uint32_t)m_schedTtiDelay);
// correlate info on UL-CQIs with previous scheduling -> calculate m_sfnSf of transmission
uint32_t frameNo = (0x3FF & (params.m_sfnSf >> 4));
uint32_t subframeNo = (0xF & params.m_sfnSf);
// NS_LOG_DEBUG (this << " sfn " << frameNo << " sbfn " << subframeNo);
if (subframeNo <= (uint32_t)(m_schedTtiDelay + 1))
{
frameNo--;
subframeNo = (10 + subframeNo - (m_schedTtiDelay + 1)) % 11;
}
else
{
subframeNo = (subframeNo - (m_schedTtiDelay + 1)) % 11;
}
uint16_t sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo);
// NS_LOG_DEBUG (this << " Actual sfn " << frameNo << " sbfn " << subframeNo << " sfnSf " << sfnSf);
// NS_LOG_DEBUG (this << " RX SFNID " << params.m_sfnSf);
// retrieve the allocation for this subframe
std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
std::map <uint16_t, std::vector <double> >::iterator itCqi;
itMap = m_allocationMaps.find (sfnSf);
itMap = m_allocationMaps.find (params.m_sfnSf);
if (itMap == m_allocationMaps.end ())
{
NS_LOG_DEBUG (this << " Does not find info on allocation, size : " << m_allocationMaps.size ());

View File

@@ -212,7 +212,6 @@ private:
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

@@ -212,8 +212,6 @@ RrSchedulerMemberSchedSapProvider::SchedUlCqiInfoReq (const struct SchedUlCqiInf
RrFfMacScheduler::RrFfMacScheduler ()
: m_cschedSapUser (0),
m_schedSapUser (0),
m_schedTtiDelay (4),
// WILD ACK: based on a m_macChTtiDelay = 1
m_nextRntiDl (0),
m_nextRntiUl (0)
{
@@ -537,7 +535,7 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
// int totRbg = lcNum * rbgPerFlow;
// totRbg = rbgNum / nTbs;
int tbSize = (m_amc->GetTbSizeFromMcs (newDci.m_mcs.at (0), rbgPerTb * rbgSize) / 8);
// NS_LOG_DEBUG (this << "Allocate user " << newEl.m_rnti << " LCs " << (uint16_t)(*itLcRnti).second << " bytes " << tbSize << " PRBs " << rbgAllocated * rbgSize << "..." << (rbgAllocated* rbgSize) + (rbgPerTb * rbgSize) - 1 << " mcs " << (uint16_t) newDci.m_mcs.at (0) << " layers " << nLayer);
NS_LOG_DEBUG (this << "Allocate user " << newEl.m_rnti << " LCs " << (uint16_t)(*itLcRnti).second << " bytes " << tbSize << " PRBs " << rbgAllocated * rbgSize << "..." << (rbgAllocated* rbgSize) + (rbgPerTb * rbgSize) - 1 << " mcs " << (uint16_t) newDci.m_mcs.at (0) << " layers " << nLayer);
uint16_t rlcPduSize = tbSize / lcNum;
for (int i = 0; i < lcNum ; i++)
{
@@ -650,7 +648,7 @@ 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 << " Ul - Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf));
RefreshUlCqiMaps ();
@@ -763,7 +761,7 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
}
uldci.m_tbSize = (m_amc->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);
NS_LOG_DEBUG (this << " UL - 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);
UpdateUlRlcBufferInfo (uldci.m_rnti, uldci.m_tbSize);
uldci.m_ndi = 1;
uldci.m_cceIndex = 0;
@@ -851,24 +849,11 @@ RrFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::Sched
{
NS_LOG_FUNCTION (this);
NS_LOG_DEBUG (this << " RX SFNID " << params.m_sfnSf);
// correlate info on UL-CQIs with previous scheduling -> calculate m_sfnSf of transmission
uint32_t frameNo = (0x3FF & (params.m_sfnSf >> 4));
uint32_t subframeNo = (0xF & params.m_sfnSf);
if (subframeNo <= (uint32_t)(m_schedTtiDelay + 1))
{
frameNo--;
subframeNo = (10 + subframeNo - (m_schedTtiDelay + 1)) % 11;
}
else
{
subframeNo = (subframeNo - (m_schedTtiDelay + 1)) % 11;
}
uint16_t sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo);
// NS_LOG_DEBUG (this << " Actual sfn " << frameNo << " sbfn " << subframeNo << " sfnSf " << sfnSf);
// retrieve the allocation for this subframe
std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
std::map <uint16_t, std::vector <double> >::iterator itCqi;
itMap = m_allocationMaps.find (sfnSf);
itMap = m_allocationMaps.find (params.m_sfnSf);
if (itMap == m_allocationMaps.end ())
{
NS_LOG_DEBUG (this << " Does not find info on allocation");

View File

@@ -178,8 +178,6 @@ private:
// Internal parameters
FfMacCschedSapProvider::CschedCellConfigReqParameters m_cschedCellConfig;
uint8_t m_schedTtiDelay; // delay between scheduling and reception (based on m_macChTtiDelay)
uint16_t m_nextRntiDl; // RNTI of the next user to be served next scheduling in DL
uint16_t m_nextRntiUl; // RNTI of the next user to be served next scheduling in UL

View File

@@ -202,7 +202,7 @@ LteInterferenceTestCase::DoRun (void)
MakeBoundCallback (&LteTestUlSchedulingCallback, this));
Simulator::Stop (Seconds (0.010));
Simulator::Stop (Seconds (0.020));
Simulator::Run ();
@@ -232,7 +232,7 @@ LteInterferenceTestCase::DlScheduling (uint32_t frameNo, uint32_t subframeNo, ui
* For first 4 subframeNo in the first frameNo, the MCS cannot be properly evaluated,
* because CQI feedback is still not available at the eNB.
*/
if ( (frameNo > 1) || (subframeNo > 8) )
if ( (frameNo > 1) || (subframeNo > 9) )
{
NS_TEST_ASSERT_MSG_EQ ((uint16_t)mcsTb1, m_dlMcs, "Wrong DL MCS ");
}
@@ -247,7 +247,7 @@ LteInterferenceTestCase::UlScheduling (uint32_t frameNo, uint32_t subframeNo, ui
* For first 5 subframeNo in the first frameNo, the MCS cannot be properly evaluated,
* because CQI feedback is still not available at the eNB.
*/
if ( (frameNo > 1) || (subframeNo > 9) )
if ( (frameNo > 1) && (subframeNo > 4) )
{
NS_TEST_ASSERT_MSG_EQ ((uint16_t)mcs, m_ulMcs, "Wrong UL MCS");
}

View File

@@ -232,7 +232,7 @@ LteLinkAdaptationTestCase::DlScheduling (uint32_t frameNo, uint32_t subframeNo,
* For first 4 subframeNo in the first frameNo, the MCS cannot be properly evaluated,
* because CQI feedback is still not available at the eNB.
*/
if ( (frameNo > 1) || (subframeNo > 6) )
if ( (frameNo > 1) || (subframeNo > 8) )
{
NS_LOG_INFO (m_snrDb << "\t" << m_mcsIndex << "\t" << (uint16_t)mcsTb1);

View File

@@ -144,7 +144,7 @@ LteEnbAntennaTestCase::DoRun (void)
enbphy->GetUplinkSpectrumPhy ()->AddSinrChunkProcessor (testUlSinr);
Simulator::Stop (Seconds (0.010));
Simulator::Stop (Seconds (0.020));
Simulator::Run ();