--- a/src/lte/model/tdtbfq-ff-mac-scheduler.cc Wed May 15 17:18:23 2013 -0400
+++ b/src/lte/model/tdtbfq-ff-mac-scheduler.cc Thu May 16 02:06:55 2013 -0400
@@ -30,6 +30,7 @@
#include <ns3/boolean.h>
#include <ns3/integer.h>
#include <set>
+#include <cfloat>
NS_LOG_COMPONENT_DEFINE ("TdTbfqFfMacScheduler");
@@ -1098,6 +1099,11 @@
uint16_t lcActives = LcActivePerFlow ((*itMap).first);
NS_LOG_INFO (this << "Allocate user " << newEl.m_rnti << " rbg " << lcActives);
+ if (lcActives == 0)
+ {
+ // Set to max value, to avoid divide by 0 below
+ lcActives = UINT16_MAX;
+ }
uint16_t RgbPerRnti = (*itMap).second.size ();
std::map <uint16_t,SbMeasResult_s>::iterator itCqi;
itCqi = m_a30CqiRxed.find ((*itMap).first);
@@ -1354,7 +1360,7 @@
sinrNum++;
}
}
- double estimatedSinr = sinrSum / (double)sinrNum;
+ double estimatedSinr = (sinrNum > 0) ? (sinrSum / sinrNum) : DBL_MAX;
// store the value
(*itCqi).second.at (rb) = estimatedSinr;
return (estimatedSinr);