22 #include <ns3/object-factory.h>
26 #include <ns3/simulator.h>
27 #include <ns3/attribute-accessor-helper.h>
28 #include <ns3/double.h>
39 #include <ns3/lte-common.h>
40 #include <ns3/lte-vendor-specific-parameters.h>
43 #include <ns3/node-list.h>
45 #include <ns3/lte-ue-net-device.h>
46 #include <ns3/pointer.h>
74 virtual void SetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth);
135 m_enbCphySapUser (0),
138 m_srsPeriodicity (0),
139 m_srsStartTime (Seconds (0)),
140 m_currentSrsOffset (0),
141 m_interferenceSampleCounter (0)
156 .AddConstructor<LteEnbPhy> ()
157 .AddAttribute (
"TxPower",
158 "Transmission power in dBm",
162 MakeDoubleChecker<double> ())
163 .AddAttribute (
"NoiseFigure",
164 "Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver."
165 " According to Wikipedia (http://en.wikipedia.org/wiki/Noise_figure), this is "
166 "\"the difference in decibels (dB) between"
167 " the noise output of the actual receiver to the noise output of an "
168 " ideal receiver with the same overall gain and bandwidth when the receivers "
169 " are connected to sources at the standard noise temperature T0.\" "
170 "In this model, we consider T0 = 290K.",
174 MakeDoubleChecker<double> ())
175 .AddAttribute (
"MacToChannelDelay",
176 "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.",
180 MakeUintegerChecker<uint8_t> ())
181 .AddTraceSource (
"ReportUeSinr",
182 "Report UEs' averaged linear SINR",
184 .AddAttribute (
"UeSinrSamplePeriod",
185 "The sampling period for reporting UEs' SINR stats (default value 1)",
188 MakeUintegerChecker<uint16_t> ())
189 .AddTraceSource (
"ReportInterference",
190 "Report linear interference power per PHY RB",
192 .AddAttribute (
"InterferenceSamplePeriod",
193 "The sampling period for reporting interference stats (default value 1)",
196 MakeUintegerChecker<uint16_t> ())
197 .AddTraceSource (
"DlPhyTransmission",
198 "DL transmission PHY layer statistics.",
200 .AddAttribute (
"DlSpectrumPhy",
201 "The downlink LteSpectrumPhy associated to this LtePhy",
205 MakePointerChecker <LteSpectrumPhy> ())
206 .AddAttribute (
"UlSpectrumPhy",
207 "The uplink LteSpectrumPhy associated to this LtePhy",
211 MakePointerChecker <LteSpectrumPhy> ())
305 std::list<Ptr<LteControlMessage> > l;
307 std::list<UlDciLteControlMessage> l1;
312 std::list<UlDciLteControlMessage> l1;
339 std::set <uint16_t>::iterator it;
357 std::set <uint16_t>::iterator it;
450 std::list<Ptr<LteControlMessage> >::iterator it;
451 for (it = msgList.begin (); it != msgList.end(); it++)
453 switch ((*it)->GetMessageType ())
515 mibMsg->SetMib (
m_mib);
539 std::list<UlDciLteControlMessage> uldcilist =
DequeueUlDci ();
540 std::list<UlDciLteControlMessage>::iterator dciIt = uldcilist.begin ();
541 NS_LOG_DEBUG (
this <<
" eNB Expected TBs " << uldcilist.size ());
542 for (dciIt = uldcilist.begin (); dciIt!=uldcilist.end (); dciIt++)
544 std::set <uint16_t>::iterator it2;
555 std::vector <int> rbMap;
556 for (
int i = (*dciIt).GetDci ().m_rbStart; i < (*dciIt).GetDci ().m_rbStart + (*dciIt).GetDci ().m_rbLen; i++)
560 m_uplinkSpectrumPhy->
AddExpectedTb ((*dciIt).GetDci ().m_rnti, (*dciIt).GetDci ().m_ndi, (*dciIt).GetDci ().m_tbSize, (*dciIt).GetDci ().m_mcs, rbMap, 0 , 0 , 0 ,
false );
561 if ((*dciIt).GetDci ().m_ndi==1)
563 NS_LOG_DEBUG (
this <<
" RNTI " << (*dciIt).GetDci ().m_rnti <<
" NEW TB");
567 NS_LOG_DEBUG (
this <<
" RNTI " << (*dciIt).GetDci ().m_rnti <<
" HARQ RETX");
575 if (ctrlMsg.size () > 0)
577 std::list<Ptr<LteControlMessage> >::iterator it;
578 it = ctrlMsg.begin ();
579 while (it != ctrlMsg.end ())
588 for (
int i = 0; i < 32; i++)
590 if (((dci->GetDci ().m_rbBitmap & mask) >> i) == 1)
601 for (uint8_t i = 0; i < dci->GetDci ().m_mcs.size (); i++)
607 params.
m_rnti = dci->GetDci ().m_rnti;
610 params.
m_mcs = dci->GetDci ().m_mcs.at (i);
611 params.
m_size = dci->GetDci ().m_tbsSize.at (i);
612 params.
m_rv = dci->GetDci ().m_rv.at (i);
613 params.
m_ndi = dci->GetDci ().m_ndi.at (i);
626 for (std::list<RarLteControlMessage::Rar>::const_iterator it = rarMsg->RarListBegin (); it != rarMsg->RarListEnd (); ++it)
628 if (it->rarPayload.m_grant.m_ulDelay ==
true)
632 UlGrant_s ulGrant = it->rarPayload.m_grant;
679 std::vector <int> dlRb;
702 std::list<Ptr<LteControlMessage> > ctrlMsgList;
703 ctrlMsgList.clear ();
760 m_interferenceSampleCounter = 0;
776 Values::const_iterator it;
782 double sinrdb = 10 * std::log10 ((*it));
797 NS_LOG_FUNCTION (
this << (uint32_t) ulBandwidth << (uint32_t) dlBandwidth);
807 for (
int i = 0; i < 4; i++)
809 if (dlBandwidth < Type0AllocationRbg[i])
849 Values::const_iterator it;
856 double sinrdb = 10 * log10 ((*it));
874 (i > 0) ? (srsSum / i) : DBL_MAX);
913 std::list<UlDciLteControlMessage>
919 std::list<UlDciLteControlMessage> ret =
m_ulDciQueue.at (0);
921 std::list<UlDciLteControlMessage> l;
928 std::list<UlDciLteControlMessage> l;
930 std::list<UlDciLteControlMessage> emptylist;
954 std::map <uint16_t,uint16_t>::iterator it =
m_srsCounter.find (rnti);