22 #include <ns3/object-factory.h>
25 #include <ns3/simulator.h>
26 #include <ns3/attribute-accessor-helper.h>
27 #include <ns3/double.h>
38 #include <ns3/lte-common.h>
39 #include <ns3/lte-vendor-specific-parameters.h>
42 #include <ns3/node-list.h>
44 #include <ns3/lte-ue-net-device.h>
45 #include <ns3/pointer.h>
73 virtual void SetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth);
134 m_enbCphySapUser (0),
137 m_srsPeriodicity (0),
139 m_currentSrsOffset (0),
140 m_interferenceSampleCounter (0)
155 .AddConstructor<LteEnbPhy> ()
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 (
"MacToChannelDelay",
175 "The delay in TTI units that occurs between a scheduling decision in the MAC and the actual start of the transmission by the PHY. This is intended to be used to model the latency of real PHY and MAC implementations.",
179 MakeUintegerChecker<uint8_t> ())
180 .AddTraceSource (
"ReportUeSinr",
181 "Report UEs' averaged linear SINR",
183 .AddAttribute (
"UeSinrSamplePeriod",
184 "The sampling period for reporting UEs' SINR stats (default value 1)",
187 MakeUintegerChecker<uint16_t> ())
188 .AddTraceSource (
"ReportInterference",
189 "Report linear interference power per PHY RB",
191 .AddAttribute (
"InterferenceSamplePeriod",
192 "The sampling period for reporting interference stats (default value 1)",
195 MakeUintegerChecker<uint16_t> ())
196 .AddTraceSource (
"DlPhyTransmission",
197 "DL transmission PHY layer statistics.",
199 .AddAttribute (
"DlSpectrumPhy",
200 "The downlink LteSpectrumPhy associated to this LtePhy",
204 MakePointerChecker <LteSpectrumPhy> ())
205 .AddAttribute (
"UlSpectrumPhy",
206 "The uplink LteSpectrumPhy associated to this LtePhy",
210 MakePointerChecker <LteSpectrumPhy> ())
304 std::list<Ptr<LteControlMessage> > l;
306 std::list<UlDciLteControlMessage> l1;
311 std::list<UlDciLteControlMessage> l1;
338 std::set <uint16_t>::iterator it;
356 std::set <uint16_t>::iterator it;
449 std::list<Ptr<LteControlMessage> >::iterator it;
450 for (it = msgList.begin (); it != msgList.end(); it++)
452 switch ((*it)->GetMessageType ())
482 mibMsg->SetMib (
m_mib);
506 std::list<UlDciLteControlMessage> uldcilist =
DequeueUlDci ();
507 std::list<UlDciLteControlMessage>::iterator dciIt = uldcilist.begin ();
508 NS_LOG_DEBUG (
this <<
" eNB Expected TBs " << uldcilist.size ());
509 for (dciIt = uldcilist.begin (); dciIt!=uldcilist.end (); dciIt++)
511 std::set <uint16_t>::iterator it2;
522 std::vector <int> rbMap;
523 for (
int i = (*dciIt).GetDci ().m_rbStart; i < (*dciIt).GetDci ().m_rbStart + (*dciIt).GetDci ().m_rbLen; i++)
527 m_uplinkSpectrumPhy->
AddExpectedTb ((*dciIt).GetDci ().m_rnti, (*dciIt).GetDci ().m_ndi, (*dciIt).GetDci ().m_tbSize, (*dciIt).GetDci ().m_mcs, rbMap, 0 , 0 , 0 ,
false );
528 if ((*dciIt).GetDci ().m_ndi==1)
530 NS_LOG_DEBUG (
this <<
" RNTI " << (*dciIt).GetDci ().m_rnti <<
" NEW TB");
534 NS_LOG_DEBUG (
this <<
" RNTI " << (*dciIt).GetDci ().m_rnti <<
" HARQ RETX");
542 if (ctrlMsg.size () > 0)
544 std::list<Ptr<LteControlMessage> >::iterator it;
545 it = ctrlMsg.begin ();
546 while (it != ctrlMsg.end ())
555 for (
int i = 0; i < 32; i++)
557 if (((dci->GetDci ().m_rbBitmap & mask) >> i) == 1)
568 for (uint8_t i = 0; i < dci->GetDci ().m_mcs.size (); i++)
574 params.
m_rnti = dci->GetDci ().m_rnti;
577 params.
m_mcs = dci->GetDci ().m_mcs.at (i);
578 params.
m_size = dci->GetDci ().m_tbsSize.at (i);
579 params.
m_rv = dci->GetDci ().m_rv.at (i);
580 params.
m_ndi = dci->GetDci ().m_ndi.at (i);
593 for (std::list<RarLteControlMessage::Rar>::const_iterator it = rarMsg->RarListBegin (); it != rarMsg->RarListEnd (); ++it)
595 if (it->rarPayload.m_grant.m_ulDelay ==
true)
599 UlGrant_s ulGrant = it->rarPayload.m_grant;
646 std::vector <int> dlRb;
664 std::list<Ptr<LteControlMessage> > ctrlMsgList;
665 ctrlMsgList.clear ();
722 m_interferenceSampleCounter = 0;
738 Values::const_iterator it;
744 double sinrdb = 10 * std::log10 ((*it));
759 NS_LOG_FUNCTION (
this << (uint32_t) ulBandwidth << (uint32_t) dlBandwidth);
769 for (
int i = 0; i < 4; i++)
771 if (dlBandwidth < Type0AllocationRbg[i])
811 Values::const_iterator it;
818 double sinrdb = 10 * log10 ((*it));
874 std::list<UlDciLteControlMessage>
880 std::list<UlDciLteControlMessage> ret =
m_ulDciQueue.at (0);
882 std::list<UlDciLteControlMessage> l;
889 std::list<UlDciLteControlMessage> l;
891 std::list<UlDciLteControlMessage> emptylist;
915 std::map <uint16_t,uint16_t>::iterator it =
m_srsCounter.find (rnti);