correct code style errors in GSoC 2012 LTE NS-3 MAC schedulers

This commit is contained in:
Dizhi Zhou
2012-11-30 18:05:02 -05:00
parent 3408e5bb1e
commit 2a844fe023
5 changed files with 108 additions and 108 deletions

View File

@@ -511,28 +511,28 @@ FdTbfqFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::S
continue;
}
std::set <uint16_t>::iterator rnti;
std::set <uint16_t>::iterator rnti;
rnti = allocatedRnti.find((*it).first);
if (rnti != allocatedRnti.end ()) // already allocated RBGs to this UE
{
continue;
}
if (rnti != allocatedRnti.end ()) // already allocated RBGs to this UE
{
continue;
}
double metric = ( ( (double)(*it).second.counter ) / ( (double)(*it).second.tokenGenerationRate ) );
double metric = ( ( (double)(*it).second.counter ) / ( (double)(*it).second.tokenGenerationRate ) );
if (firstRnti == true)
{
metricMax = metric;
itMax = it;
firstRnti = false;
continue;
}
if (metric > metricMax)
{
metricMax = metric;
itMax = it;
}
} // end for m_flowStatsDl
if (firstRnti == true)
{
metricMax = metric;
itMax = it;
firstRnti = false;
continue;
}
if (metric > metricMax)
{
metricMax = metric;
itMax = it;
}
} // end for m_flowStatsDl
if (itMax == m_flowStatsDl.end())
{
@@ -547,37 +547,37 @@ FdTbfqFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::S
uint32_t budget = 0;
if ( bankSize > 0 )
{
budget = (*itMax).second.counter - (*itMax).second.debtLimit;
if ( budget > (*itMax).second.burstCredit )
budget = (*itMax).second.burstCredit;
if ( budget > bankSize )
budget = bankSize;
}
budget = (*itMax).second.counter - (*itMax).second.debtLimit;
if ( budget > (*itMax).second.burstCredit )
budget = (*itMax).second.burstCredit;
if ( budget > bankSize )
budget = bankSize;
}
budget = budget + (*itMax).second.tokenPoolSize;
// calcualte how much bytes this UE actally need
if (budget == 0)
{
// there are no tokens for this UE
continue;
continue;
}
else
{
// calculate rlc buffer size
uint32_t rlcBufSize;
uint32_t rlcBufSize;
uint8_t lcid;
std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator itRlcBuf;
for (itRlcBuf = m_rlcBufferReq.begin (); itRlcBuf != m_rlcBufferReq.end (); itRlcBuf++)
{
{
if ( (*itRlcBuf).first.m_rnti == (*itMax).first )
lcid = (*itRlcBuf).first.m_lcId;
}
}
LteFlowId_t flow ((*itMax).first, lcid);
itRlcBuf = m_rlcBufferReq.find (flow);
if (itRlcBuf!=m_rlcBufferReq.end ())
rlcBufSize = (*itRlcBuf).second.m_rlcTransmissionQueueSize + (*itRlcBuf).second.m_rlcRetransmissionQueueSize + (*itRlcBuf).second.m_rlcStatusPduSize;
if ( budget > rlcBufSize )
budget = rlcBufSize;
rlcBufSize = (*itRlcBuf).second.m_rlcTransmissionQueueSize + (*itRlcBuf).second.m_rlcRetransmissionQueueSize + (*itRlcBuf).second.m_rlcStatusPduSize;
if ( budget > rlcBufSize )
budget = rlcBufSize;
}
// assign RBGs to this UE
@@ -601,12 +601,12 @@ FdTbfqFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::S
// find RBG with largest achievableRate
double achievableRateMax = 0.0;
rbgIndex = rbgNum;
for (int k = 0; k < rbgNum; k++)
{
for (int k = 0; k < rbgNum; k++)
{
std::set <uint8_t>::iterator rbg;
rbg = allocatedRbg.find (k);
if (rbg != allocatedRbg.end ()) // RBGs are already allocated to this UE
continue;
if (rbg != allocatedRbg.end ()) // RBGs are already allocated to this UE
continue;
std::vector <uint8_t> sbCqi;
if (itCqi == m_a30CqiRxed.end ())
@@ -632,7 +632,7 @@ FdTbfqFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::S
if (LcActivePerFlow ((*itMax).first) > 0)
{
// this UE has data to transmit
double achievableRate = 0.0;
double achievableRate = 0.0;
for (uint8_t j = 0; j < nLayer; j++)
{
uint8_t mcs = 0;
@@ -648,26 +648,26 @@ FdTbfqFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::S
achievableRate += ((m_amc->GetTbSizeFromMcs (mcs, rbgSize) / 8) / 0.001); // = TB size / TTI
}
if ( achievableRate > achievableRateMax )
{
achievableRateMax = achievableRate;
rbgIndex = k;
}
} // end of LcActivePerFlow
} // end of cqi
if ( achievableRate > achievableRateMax )
{
achievableRateMax = achievableRate;
rbgIndex = k;
}
} // end of LcActivePerFlow
} // end of cqi
} // end of for rbgNum
if ( rbgIndex == rbgNum) // impossible
{
// all RBGs are already assigned
totalRbg = rbgNum;
break;
}
else
{
// mark this UE as "allocated"
if ( rbgIndex == rbgNum) // impossible
{
// all RBGs are already assigned
totalRbg = rbgNum;
break;
}
else
{
// mark this UE as "allocated"
allocatedRbg.insert (rbgIndex);
}
}
// assign this RBG to UE
std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
@@ -731,39 +731,39 @@ FdTbfqFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::S
bytesTxedTmp = bytesTxed;
bytesTxed = 0;
for (uint8_t j = 0; j < nLayer; j++)
for (uint8_t j = 0; j < nLayer; j++)
{
int tbSize = (m_amc->GetTbSizeFromMcs (m_amc->GetMcsFromCqi (worstCqi.at (j)), RbgPerRnti * rbgSize) / 8); // (size of TB in bytes according to table 7.1.7.2.1-1 of 36.213)
bytesTxed += tbSize;
}
} // end of while()
} // end of while()
// remove and unmark last RBG assigned to UE
if ( bytesTxed > budget )
{
if ( bytesTxed > budget )
{
std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
itMap = allocationMap.find ((*itMax).first);
(*itMap).second.pop_back ();
allocatedRbg.erase (rbgIndex);
bytesTxed = bytesTxedTmp; // recovery bytesTxed
bytesTxed = bytesTxedTmp; // recovery bytesTxed
totalRbg--;
}
}
// update UE stats
if ( bytesTxed <= (*itMax).second.tokenPoolSize )
{
(*itMax).second.tokenPoolSize -= bytesTxed;
(*itMax).second.tokenPoolSize -= bytesTxed;
}
else
{
(*itMax).second.counter = (*itMax).second.counter - ( bytesTxed - (*itMax).second.tokenPoolSize );
(*itMax).second.tokenPoolSize = 0;
if (bankSize <= ( bytesTxed - (*itMax).second.tokenPoolSize ))
bankSize = 0;
else
bankSize = bankSize - ( bytesTxed - (*itMax).second.tokenPoolSize );
}
{
(*itMax).second.counter = (*itMax).second.counter - ( bytesTxed - (*itMax).second.tokenPoolSize );
(*itMax).second.tokenPoolSize = 0;
if (bankSize <= ( bytesTxed - (*itMax).second.tokenPoolSize ))
bankSize = 0;
else
bankSize = bankSize - ( bytesTxed - (*itMax).second.tokenPoolSize );
}
} // end of RBGs
// generate the transmission opportunities by grouping the RBGs of the same RNTI and

View File

@@ -505,7 +505,7 @@ PssFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sche
}
int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).second);
uint8_t wbCqi = 0;
if (itCqi == m_p10CqiRxed.end())
if (itCqi == m_p10CqiRxed.end())
{
wbCqi = 1; // start with lowest value
}
@@ -701,34 +701,34 @@ PssFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sche
} // end if cqi
double metric;
if (colMetric != 0)
metric= weight * colMetric;
else
metric = 1;
if (colMetric != 0)
metric= weight * colMetric;
else
metric = 1;
if (metric > metricMax )
if (metric > metricMax )
{
metricMax = metric;
itMax = it;
}
} // end of tdUeSet
} // end of tdUeSet
if (itMax == m_flowStatsDl.end ())
{
// no UE available for downlink
return;
return;
}
else
{
// assign all RBGs to this UE
std::vector <uint16_t> tempMap;
for (int i = 0; i < rbgNum; i++)
{
for (int i = 0; i < rbgNum; i++)
{
tempMap.push_back (i);
}
}
allocationMap.insert (std::pair <uint16_t, std::vector <uint16_t> > ((*itMax).first, tempMap));
}
}// end of rbgNum
}// end of rbgNum
}// end of CoIta
@@ -743,8 +743,8 @@ PssFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sche
{
// calculate PF weigth
double weight = (*it).second.targetThroughput / (*it).second.lastAveragedThroughput;
if (weight < 1.0)
weight = 1.0;
if (weight < 1.0)
weight = 1.0;
std::map <uint16_t,SbMeasResult_s>::iterator itCqi;
itCqi = m_a30CqiRxed.find ((*it).first);
@@ -784,15 +784,15 @@ PssFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sche
uint8_t mcs = 0;
if (sbCqis.size () > k)
{
mcs = m_amc->GetMcsFromCqi (sbCqis.at (k));
mcs = m_amc->GetMcsFromCqi (sbCqis.at (k));
}
else
{
// no info on this subband -> worst MCS
mcs = 0;
}
}
achievableRate += ((m_amc->GetTbSizeFromMcs (mcs, rbgSize) / 8) / 0.001); // = TB size / TTI
}
}
schMetric = achievableRate / (*it).second.secondLastAveragedThroughput;
} // end if cqi
@@ -899,7 +899,7 @@ PssFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sche
}
}
uint32_t bytesTxed = 0;
for (uint8_t j = 0; j < nLayer; j++)
for (uint8_t j = 0; j < nLayer; j++)
{
newDci.m_mcs.push_back (m_amc->GetMcsFromCqi (worstCqi.at (j)));
int tbSize = (m_amc->GetTbSizeFromMcs (newDci.m_mcs.at (j), rbgPerRnti * rbgSize) / 8); // (size of TB in bytes according to table 7.1.7.2.1-1 of 36.213)

View File

@@ -518,7 +518,7 @@ TdBetFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sc
}
for (uint8_t i = 0; i < nLayer; i++)
{
{
int tbSize = (m_amc->GetTbSizeFromMcs (newDci.m_mcs.at (0), rbgNum * rbgSize) / 8); // (size of TB in bytes according to table 7.1.7.2.1-1 of 36.213)
newDci.m_tbsSize.push_back (tbSize);
bytesTxed += tbSize;

View File

@@ -657,18 +657,18 @@ TdTbfqFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::S
if (it != m_flowStatsDl.end ())
{
if ( bytesTxed <= (*it).second.tokenPoolSize )
{
(*it).second.tokenPoolSize -= bytesTxed;
}
else
{
(*it).second.counter = (*it).second.counter - ( bytesTxed - (*it).second.tokenPoolSize );
(*it).second.tokenPoolSize = 0;
if (bankSize <= ( bytesTxed - (*it).second.tokenPoolSize ))
bankSize = 0;
else
bankSize = bankSize - ( bytesTxed - (*it).second.tokenPoolSize );
}
{
(*it).second.tokenPoolSize -= bytesTxed;
}
else
{
(*it).second.counter = (*it).second.counter - ( bytesTxed - (*it).second.tokenPoolSize );
(*it).second.tokenPoolSize = 0;
if (bankSize <= ( bytesTxed - (*it).second.tokenPoolSize ))
bankSize = 0;
else
bankSize = bankSize - ( bytesTxed - (*it).second.tokenPoolSize );
}
}
else
{

View File

@@ -471,14 +471,14 @@ TtaFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sche
sbCqi = (*itCqi).second.m_higherLayerSelected.at (i).m_sbCqi;
}
uint8_t wbCqi = 0;
if (itWbCqi == m_p10CqiRxed.end())
{
wbCqi = 1; // start with lowest value
}
uint8_t wbCqi = 0;
if (itWbCqi == m_p10CqiRxed.end())
{
wbCqi = 1; // start with lowest value
}
else
{
wbCqi = (*itWbCqi).second;
wbCqi = (*itWbCqi).second;
}
uint8_t cqi1 = sbCqi.at(0);
@@ -493,7 +493,7 @@ TtaFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sche
if (LcActivePerFlow (*it) > 0)
{
// this UE has data to transmit
uint8_t sbMcs = 0;
uint8_t sbMcs = 0;
uint8_t wbMcs = 0;
double achievableSbRate = 1.0;
double achievableWbRate = 1.0;
@@ -515,7 +515,7 @@ TtaFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sche
double metric = achievableSbRate / achievableWbRate;
if (metric > metricMax)
if (metric > metricMax)
{
metricMax = metric;
itMax = it;