23 #include <ns3/object-factory.h>
26 #include <ns3/simulator.h>
27 #include <ns3/double.h>
38 #include <ns3/lte-common.h>
57 virtual void SetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth);
120 m_amc = CreateObject <LteAmc> ();
127 std::list<Ptr<IdealControlMessage> > l;
130 std::vector <int> ulRb;
155 .AddConstructor<LteUePhy> ()
156 .AddAttribute (
"TxPower",
157 "Transmission power in dBm",
161 MakeDoubleChecker<double> ())
162 .AddAttribute (
"NoiseFigure",
163 "Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver."
164 " According to Wikipedia (http://en.wikipedia.org/wiki/Noise_figure), this is "
165 "\"the difference in decibels (dB) between"
166 " the noise output of the actual receiver to the noise output of an "
167 " ideal receiver with the same overall gain and bandwidth when the receivers "
168 " are connected to sources at the standard noise temperature T0.\" "
169 "In this model, we consider T0 = 290K.",
173 MakeDoubleChecker<double> ())
174 .AddAttribute (
"TxMode1Gain",
175 "Transmission mode 1 gain in dB",
178 MakeDoubleChecker<double> ())
179 .AddAttribute (
"TxMode2Gain",
180 "Transmission mode 2 gain in dB",
183 MakeDoubleChecker<double> ())
184 .AddAttribute (
"TxMode3Gain",
185 "Transmission mode 3 gain in dB",
188 MakeDoubleChecker<double> ())
189 .AddAttribute (
"TxMode4Gain",
190 "Transmission mode 4 gain in dB",
193 MakeDoubleChecker<double> ())
194 .AddAttribute (
"TxMode5Gain",
195 "Transmission mode 5 gain in dB",
198 MakeDoubleChecker<double> ())
199 .AddAttribute (
"TxMode6Gain",
200 "Transmission mode 6 gain in dB",
203 MakeDoubleChecker<double> ())
204 .AddAttribute (
"TxMode7Gain",
205 "Transmission mode 7 gain in dB",
208 MakeDoubleChecker<double> ())
385 std::vector<int> cqi;
391 int nbSubChannels = cqi.size ();
393 int activeSubChannels = 0;
395 for (
int i = 0; i < nbSubChannels; i++)
397 if (cqi.at (i) != -1)
399 cqiSum += cqi.at (i);
402 NS_LOG_DEBUG (
this <<
" subch " << i <<
" cqi " << cqi.at (i));
409 for (
int i = 0; i < nLayer; i++)
411 if (activeSubChannels > 0)
413 dlcqi.m_wbCqi.push_back ((uint16_t) cqiSum / activeSubChannels);
418 dlcqi.m_wbCqi.push_back (1);
429 int nbSubChannels = cqi.size ();
435 for (
int i = 0; i < nbSubChannels; i++)
437 if (cqi.at (i) != -1)
439 cqiSum += cqi.at (i);
443 if (cqiNum == rbgSize)
449 for (
int i = 0; i < nLayer; i++)
451 hlCqi.
m_sbCqi.push_back ((uint16_t) cqiSum / rbgSize);
463 dlcqi.m_sbMeasResult = rbgMeas;
466 msg->SetDlCqi (dlcqi);
495 if (dci.m_resAlloc != 0)
500 std::vector <int> dlRb;
504 for (
int i = 0; i < 32; i++)
506 if (((dci.m_rbBitmap & mask) >> i) == 1)
510 dlRb.push_back ((i * GetRbgSize ()) + k);
518 NS_LOG_DEBUG (
this <<
" UE " <<
m_rnti <<
" DCI " << dci.m_rnti <<
" bitmap " << dci.m_rbBitmap);
519 for (uint8_t i = 0; i < dci.m_tbsSize.size (); i++)
534 std::vector <int> ulRb;
535 for (
int i = 0; i < dci.m_rbLen; i++)
537 ulRb.push_back (i + dci.m_rbStart);
578 if (ctrlMsg.size () > 0)
581 std::list<Ptr<IdealControlMessage> >::iterator it;
582 it = ctrlMsg.begin ();
583 while (it != ctrlMsg.end ())
587 ctrlMsg.pop_front ();
588 it = ctrlMsg.begin ();
682 double gainLin = pow (10.0, (gain / 10.0));
687 std::vector <double> temp;
690 for (uint8_t i = 0; i < temp.size (); i++)