A Discrete-Event Network Simulator
API
lte-enb-phy.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Giuseppe Piro <g.piro@poliba.it>
18  * Marco Miozzo <mmiozzo@cttc.es>
19  */
20 
21 #include "lte-enb-phy.h"
22 
23 #include "lte-common.h"
24 #include "lte-control-messages.h"
25 #include "lte-net-device.h"
28 
29 #include <ns3/attribute-accessor-helper.h>
30 #include <ns3/double.h>
31 #include <ns3/log.h>
32 #include <ns3/object-factory.h>
33 #include <ns3/simulator.h>
34 
35 #include <cfloat>
36 #include <cmath>
37 
38 // WILD HACK for the initialization of direct eNB-UE ctrl messaging
39 #include <ns3/node-list.h>
40 #include <ns3/node.h>
41 #include <ns3/pointer.h>
42 
43 namespace ns3
44 {
45 
46 NS_LOG_COMPONENT_DEFINE("LteEnbPhy");
47 
49 
56 static const Time DL_DATA_DURATION = NanoSeconds(785714 - 1);
57 
64 
66 // member SAP forwarders
68 
71 {
72  public:
79 
80  // inherited from LteEnbPhySapProvider
81  void SendMacPdu(Ptr<Packet> p) override;
83  uint8_t GetMacChTtiDelay() override;
90  virtual void SetBandwidth(uint16_t ulBandwidth, uint16_t dlBandwidth);
96  virtual void SetCellId(uint16_t cellId);
97 
98  private:
100 };
101 
103  : m_phy(phy)
104 {
105 }
106 
107 void
109 {
110  m_phy->DoSendMacPdu(p);
111 }
112 
113 void
114 EnbMemberLteEnbPhySapProvider::SetBandwidth(uint16_t ulBandwidth, uint16_t dlBandwidth)
115 {
116  m_phy->DoSetBandwidth(ulBandwidth, dlBandwidth);
117 }
118 
119 void
121 {
122  m_phy->DoSetCellId(cellId);
123 }
124 
125 void
127 {
129 }
130 
131 uint8_t
133 {
134  return m_phy->DoGetMacChTtiDelay();
135 }
136 
138 // generic LteEnbPhy methods
140 
142 {
143  NS_LOG_FUNCTION(this);
144  NS_FATAL_ERROR("This constructor should not be called");
145 }
146 
148  : LtePhy(dlPhy, ulPhy),
149  m_enbPhySapUser(nullptr),
150  m_enbCphySapUser(nullptr),
151  m_nrFrames(0),
152  m_nrSubFrames(0),
153  m_srsPeriodicity(0),
154  m_srsStartTime(Seconds(0)),
155  m_currentSrsOffset(0),
156  m_interferenceSampleCounter(0)
157 {
160  m_harqPhyModule = Create<LteHarqPhy>();
161  m_downlinkSpectrumPhy->SetHarqPhyModule(m_harqPhyModule);
162  m_uplinkSpectrumPhy->SetHarqPhyModule(m_harqPhyModule);
163 }
164 
165 TypeId
167 {
168  static TypeId tid =
169  TypeId("ns3::LteEnbPhy")
170  .SetParent<LtePhy>()
171  .SetGroupName("Lte")
172  .AddConstructor<LteEnbPhy>()
173  .AddAttribute("TxPower",
174  "Transmission power in dBm",
175  DoubleValue(30.0),
177  MakeDoubleChecker<double>())
178  .AddAttribute(
179  "NoiseFigure",
180  "Loss (dB) in the Signal-to-Noise-Ratio due to "
181  "non-idealities in the receiver. According to Wikipedia "
182  "(http://en.wikipedia.org/wiki/Noise_figure), this is "
183  "\"the difference in decibels (dB) between"
184  " the noise output of the actual receiver to "
185  "the noise output of an ideal receiver with "
186  "the same overall gain and bandwidth when the receivers "
187  "are connected to sources at the standard noise "
188  "temperature T0.\" In this model, we consider T0 = 290K.",
189  DoubleValue(5.0),
191  MakeDoubleChecker<double>())
192  .AddAttribute(
193  "MacToChannelDelay",
194  "The delay in TTI units that occurs between "
195  "a scheduling decision in the MAC and the actual "
196  "start of the transmission by the PHY. This is "
197  "intended to be used to model the latency of real PHY "
198  "and MAC implementations.",
199  UintegerValue(2),
201  MakeUintegerChecker<uint8_t>())
202  .AddTraceSource("ReportUeSinr",
203  "Report UEs' averaged linear SINR",
205  "ns3::LteEnbPhy::ReportUeSinrTracedCallback")
206  .AddAttribute("UeSinrSamplePeriod",
207  "The sampling period for reporting UEs' SINR stats.",
208  UintegerValue(1),
210  MakeUintegerChecker<uint16_t>())
211  .AddTraceSource("ReportInterference",
212  "Report linear interference power per PHY RB",
214  "ns3::LteEnbPhy::ReportInterferenceTracedCallback")
215  .AddAttribute("InterferenceSamplePeriod",
216  "The sampling period for reporting interference stats",
217  UintegerValue(1),
219  MakeUintegerChecker<uint16_t>())
220  .AddTraceSource("DlPhyTransmission",
221  "DL transmission PHY layer statistics.",
223  "ns3::PhyTransmissionStatParameters::TracedCallback")
224  .AddAttribute("DlSpectrumPhy",
225  "The downlink LteSpectrumPhy associated to this LtePhy",
227  PointerValue(),
229  MakePointerChecker<LteSpectrumPhy>())
230  .AddAttribute("UlSpectrumPhy",
231  "The uplink LteSpectrumPhy associated to this LtePhy",
233  PointerValue(),
235  MakePointerChecker<LteSpectrumPhy>());
236  return tid;
237 }
238 
240 {
241 }
242 
243 void
245 {
246  NS_LOG_FUNCTION(this);
247  m_ueAttached.clear();
248  m_srsUeOffset.clear();
249  delete m_enbPhySapProvider;
250  delete m_enbCphySapProvider;
252 }
253 
254 void
256 {
257  NS_LOG_FUNCTION(this);
258 
259  NS_ABORT_MSG_IF(!m_netDevice, "LteEnbDevice is not available in LteEnbPhy");
260  Ptr<Node> node = m_netDevice->GetNode();
261  NS_ABORT_MSG_IF(!node, "Node is not available in the LteNetDevice of LteEnbPhy");
262  uint32_t nodeId = node->GetId();
263 
264  // ScheduleWithContext() is needed here to set context for logs,
265  // because Initialize() is called outside of Node::AddDevice().
266 
268 
269  Ptr<SpectrumValue> noisePsd =
272  m_noiseFigure);
273  m_uplinkSpectrumPhy->SetNoisePowerSpectralDensity(noisePsd);
275 }
276 
277 void
279 {
280  m_enbPhySapUser = s;
281 }
282 
285 {
286  return m_enbPhySapProvider;
287 }
288 
289 void
291 {
292  NS_LOG_FUNCTION(this);
293  m_enbCphySapUser = s;
294 }
295 
298 {
299  NS_LOG_FUNCTION(this);
300  return m_enbCphySapProvider;
301 }
302 
303 void
305 {
306  NS_LOG_FUNCTION(this << pow);
307  m_txPower = pow;
308 }
309 
310 double
312 {
313  NS_LOG_FUNCTION(this);
314  return m_txPower;
315 }
316 
317 int8_t
319 {
320  NS_LOG_FUNCTION(this);
321  return m_txPower;
322 }
323 
324 void
326 {
327  NS_LOG_FUNCTION(this << nf);
328  m_noiseFigure = nf;
329 }
330 
331 double
333 {
334  NS_LOG_FUNCTION(this);
335  return m_noiseFigure;
336 }
337 
338 void
340 {
341  NS_LOG_FUNCTION(this);
342  m_macChTtiDelay = delay;
343  for (int i = 0; i < m_macChTtiDelay; i++)
344  {
345  Ptr<PacketBurst> pb = CreateObject<PacketBurst>();
346  m_packetBurstQueue.push_back(pb);
347  std::list<Ptr<LteControlMessage>> l;
348  m_controlMessagesQueue.push_back(l);
349  std::list<UlDciLteControlMessage> l1;
350  m_ulDciQueue.push_back(l1);
351  }
352  for (int i = 0; i < UL_PUSCH_TTIS_DELAY; i++)
353  {
354  std::list<UlDciLteControlMessage> l1;
355  m_ulDciQueue.push_back(l1);
356  }
357 }
358 
359 uint8_t
361 {
362  return m_macChTtiDelay;
363 }
364 
367 {
368  return m_downlinkSpectrumPhy;
369 }
370 
373 {
374  return m_uplinkSpectrumPhy;
375 }
376 
377 bool
378 LteEnbPhy::AddUePhy(uint16_t rnti)
379 {
380  NS_LOG_FUNCTION(this << rnti);
381  auto it = m_ueAttached.find(rnti);
382  if (it == m_ueAttached.end())
383  {
384  m_ueAttached.insert(rnti);
385  return true;
386  }
387  else
388  {
389  NS_LOG_ERROR("UE already attached");
390  return false;
391  }
392 }
393 
394 bool
396 {
397  NS_LOG_FUNCTION(this << rnti);
398  auto it = m_ueAttached.find(rnti);
399  if (it == m_ueAttached.end())
400  {
401  NS_LOG_ERROR("UE not attached");
402  return false;
403  }
404  else
405  {
406  m_ueAttached.erase(it);
407  return true;
408  }
409 }
410 
411 void
413 {
414  NS_LOG_FUNCTION(this);
415  SetMacPdu(p);
416 }
417 
418 uint8_t
420 {
421  return m_macChTtiDelay;
422 }
423 
424 void
426 {
427  NS_LOG_FUNCTION(this);
429 }
430 
431 void
432 LteEnbPhy::SetDownlinkSubChannels(std::vector<int> mask)
433 {
434  NS_LOG_FUNCTION(this);
437  m_downlinkSpectrumPhy->SetTxPowerSpectralDensity(txPsd);
438 }
439 
440 void
442 {
443  NS_LOG_FUNCTION(this);
446  m_downlinkSpectrumPhy->SetTxPowerSpectralDensity(txPsd);
447 }
448 
449 std::vector<int>
451 {
452  NS_LOG_FUNCTION(this);
454 }
455 
456 void
458 {
459  NS_LOG_FUNCTION(this);
460  double rbgTxPower = m_txPower;
461 
462  auto it = m_paMap.find(rnti);
463  if (it != m_paMap.end())
464  {
465  rbgTxPower = m_txPower + it->second;
466  }
467 
468  m_dlPowerAllocationMap.insert(std::pair<int, double>(rbId, rbgTxPower));
469 }
470 
473 {
474  NS_LOG_FUNCTION(this);
475 
476  Ptr<SpectrumValue> psd =
479  m_txPower,
481 
482  return psd;
483 }
484 
487 {
488  NS_LOG_FUNCTION(this);
489 
490  Ptr<SpectrumValue> psd =
493  m_txPower,
496 
497  return psd;
498 }
499 
500 void
502 {
503  NS_LOG_FUNCTION(this);
504 }
505 
506 void
508 {
509  NS_LOG_FUNCTION(this << msg);
510  // queues the message (wait for MAC-PHY delay)
511  SetControlMessages(msg);
512 }
513 
514 void
516 {
517  NS_FATAL_ERROR("Obsolete function");
518  NS_LOG_FUNCTION(this << msg);
520 }
521 
522 void
524 {
525  NS_LOG_FUNCTION(this);
526  for (auto it = msgList.begin(); it != msgList.end(); it++)
527  {
528  switch ((*it)->GetMessageType())
529  {
532  DynamicCast<RachPreambleLteControlMessage>(*it);
533  m_enbPhySapUser->ReceiveRachPreamble(rachPreamble->GetRapId());
534  }
535  break;
537  Ptr<DlCqiLteControlMessage> dlcqiMsg = DynamicCast<DlCqiLteControlMessage>(*it);
538  CqiListElement_s dlcqi = dlcqiMsg->GetDlCqi();
539  // check whether the UE is connected
540  if (m_ueAttached.find(dlcqi.m_rnti) != m_ueAttached.end())
541  {
543  }
544  }
545  break;
546  case LteControlMessage::BSR: {
547  Ptr<BsrLteControlMessage> bsrMsg = DynamicCast<BsrLteControlMessage>(*it);
548  MacCeListElement_s bsr = bsrMsg->GetBsr();
549  // check whether the UE is connected
550  if (m_ueAttached.find(bsr.m_rnti) != m_ueAttached.end())
551  {
553  }
554  }
555  break;
558  DynamicCast<DlHarqFeedbackLteControlMessage>(*it);
559  DlInfoListElement_s dlharq = dlharqMsg->GetDlHarqFeedback();
560  // check whether the UE is connected
561  if (m_ueAttached.find(dlharq.m_rnti) != m_ueAttached.end())
562  {
564  }
565  }
566  break;
567  default:
568  NS_FATAL_ERROR("Unexpected LteControlMessage type");
569  break;
570  }
571  }
572 }
573 
574 void
576 {
577  NS_LOG_FUNCTION(this);
578 
579  ++m_nrFrames;
580  NS_LOG_INFO("-----frame " << m_nrFrames << "-----");
581  m_nrSubFrames = 0;
582 
583  // send MIB at beginning of every frame
585  Ptr<MibLteControlMessage> mibMsg = Create<MibLteControlMessage>();
586  mibMsg->SetMib(m_mib);
587  m_controlMessagesQueue.at(0).emplace_back(mibMsg);
588 
589  StartSubFrame();
590 }
591 
592 void
594 {
595  NS_LOG_FUNCTION(this);
596 
597  ++m_nrSubFrames;
598 
599  /*
600  * Send SIB1 at 6th subframe of every odd-numbered radio frame. This is
601  * equivalent with Section 5.2.1.2 of 3GPP TS 36.331, where it is specified
602  * "repetitions are scheduled in subframe #5 of all other radio frames for
603  * which SFN mod 2 = 0," except that 3GPP counts frames and subframes starting
604  * from 0, while ns-3 counts starting from 1.
605  */
606  if ((m_nrSubFrames == 6) && ((m_nrFrames % 2) == 1))
607  {
608  Ptr<Sib1LteControlMessage> msg = Create<Sib1LteControlMessage>();
609  msg->SetSib1(m_sib1);
610  m_controlMessagesQueue.at(0).emplace_back(msg);
611  }
612 
613  if (m_srsPeriodicity > 0)
614  {
615  // might be 0 in case the eNB has no UEs attached
616  NS_ASSERT_MSG(m_nrFrames > 1, "the SRS index check code assumes that frameNo starts at 1");
618  "the SRS index check code assumes that subframeNo starts at 1");
619  m_currentSrsOffset = (((m_nrFrames - 1) * 10 + (m_nrSubFrames - 1)) % m_srsPeriodicity);
620  }
621  NS_LOG_INFO("-----sub frame " << m_nrSubFrames << "-----");
622  m_harqPhyModule->SubframeIndication(m_nrFrames, m_nrSubFrames);
623 
624  // update info on TB to be received
625  std::list<UlDciLteControlMessage> uldcilist = DequeueUlDci();
626  NS_LOG_DEBUG(this << " eNB Expected TBs " << uldcilist.size());
627  for (auto dciIt = uldcilist.begin(); dciIt != uldcilist.end(); dciIt++)
628  {
629  auto it2 = m_ueAttached.find((*dciIt).GetDci().m_rnti);
630 
631  if (it2 == m_ueAttached.end())
632  {
633  NS_LOG_ERROR("UE not attached");
634  }
635  else
636  {
637  // send info of TB to LteSpectrumPhy
638  // translate to allocation map
639  std::vector<int> rbMap;
640  for (int i = (*dciIt).GetDci().m_rbStart;
641  i < (*dciIt).GetDci().m_rbStart + (*dciIt).GetDci().m_rbLen;
642  i++)
643  {
644  rbMap.push_back(i);
645  }
646  m_uplinkSpectrumPhy->AddExpectedTb((*dciIt).GetDci().m_rnti,
647  (*dciIt).GetDci().m_ndi,
648  (*dciIt).GetDci().m_tbSize,
649  (*dciIt).GetDci().m_mcs,
650  rbMap,
651  0 /* always SISO*/,
652  0 /* no HARQ proc id in UL*/,
653  0 /*evaluated by LteSpectrumPhy*/,
654  false /* UL*/);
655  if ((*dciIt).GetDci().m_ndi == 1)
656  {
657  NS_LOG_DEBUG(this << " RNTI " << (*dciIt).GetDci().m_rnti << " NEW TB");
658  }
659  else
660  {
661  NS_LOG_DEBUG(this << " RNTI " << (*dciIt).GetDci().m_rnti << " HARQ RETX");
662  }
663  }
664  }
665 
666  // process the current burst of control messages
667  std::list<Ptr<LteControlMessage>> ctrlMsg = GetControlMessages();
668  m_dlDataRbMap.clear();
669  m_dlPowerAllocationMap.clear();
670  if (!ctrlMsg.empty())
671  {
672  auto it = ctrlMsg.begin();
673  while (it != ctrlMsg.end())
674  {
675  Ptr<LteControlMessage> msg = (*it);
676  if (msg->GetMessageType() == LteControlMessage::DL_DCI)
677  {
678  Ptr<DlDciLteControlMessage> dci = DynamicCast<DlDciLteControlMessage>(msg);
679  // get the tx power spectral density according to DL-DCI(s)
680  // translate the DCI to Spectrum framework
681  uint32_t mask = 0x1;
682  for (int i = 0; i < 32; i++)
683  {
684  if (((dci->GetDci().m_rbBitmap & mask) >> i) == 1)
685  {
686  for (int k = 0; k < GetRbgSize(); k++)
687  {
688  m_dlDataRbMap.push_back((i * GetRbgSize()) + k);
689  // NS_LOG_DEBUG(this << " [enb]DL-DCI allocated PRB " <<
690  // (i*GetRbgSize()) + k);
691  GeneratePowerAllocationMap(dci->GetDci().m_rnti,
692  (i * GetRbgSize()) + k);
693  }
694  }
695  mask = (mask << 1);
696  }
697  // fire trace of DL Tx PHY stats
698  for (std::size_t i = 0; i < dci->GetDci().m_mcs.size(); i++)
699  {
701  params.m_cellId = m_cellId;
702  params.m_imsi = 0; // it will be set by DlPhyTransmissionCallback in LteHelper
703  params.m_timestamp = Simulator::Now().GetMilliSeconds();
704  params.m_rnti = dci->GetDci().m_rnti;
705  params.m_txMode = 0; // TBD
706  params.m_layer = i;
707  params.m_mcs = dci->GetDci().m_mcs.at(i);
708  params.m_size = dci->GetDci().m_tbsSize.at(i);
709  params.m_rv = dci->GetDci().m_rv.at(i);
710  params.m_ndi = dci->GetDci().m_ndi.at(i);
711  params.m_ccId = m_componentCarrierId;
713  }
714  }
715  else if (msg->GetMessageType() == LteControlMessage::UL_DCI)
716  {
717  Ptr<UlDciLteControlMessage> dci = DynamicCast<UlDciLteControlMessage>(msg);
718  QueueUlDci(*dci);
719  }
720  else if (msg->GetMessageType() == LteControlMessage::RAR)
721  {
722  Ptr<RarLteControlMessage> rarMsg = DynamicCast<RarLteControlMessage>(msg);
723  for (auto it = rarMsg->RarListBegin(); it != rarMsg->RarListEnd(); ++it)
724  {
725  if (it->rarPayload.m_grant.m_ulDelay)
726  {
727  NS_FATAL_ERROR(" RAR delay is not yet implemented");
728  }
729  UlGrant_s ulGrant = it->rarPayload.m_grant;
730  // translate the UL grant in a standard UL-DCI and queue it
731  UlDciListElement_s dci;
732  dci.m_rnti = ulGrant.m_rnti;
733  dci.m_rbStart = ulGrant.m_rbStart;
734  dci.m_rbLen = ulGrant.m_rbLen;
735  dci.m_tbSize = ulGrant.m_tbSize;
736  dci.m_mcs = ulGrant.m_mcs;
737  dci.m_hopping = ulGrant.m_hopping;
738  dci.m_tpc = ulGrant.m_tpc;
739  dci.m_cqiRequest = ulGrant.m_cqiRequest;
740  dci.m_ndi = 1;
742  msg.SetDci(dci);
743  QueueUlDci(msg);
744  }
745  }
746  it++;
747  }
748  }
749 
750  SendControlChannels(ctrlMsg);
751 
752  // send data frame
754  if (pb)
755  {
756  Simulator::Schedule(DL_CTRL_DELAY_FROM_SUBFRAME_START, // ctrl frame fixed to 3 symbols
758  this,
759  pb);
760  }
761 
762  // trigger the MAC
764 
766 }
767 
768 void
770 {
771  NS_LOG_FUNCTION(this << " eNB " << m_cellId << " start tx ctrl frame");
772  // set the current tx power spectral density (full bandwidth)
773  std::vector<int> dlRb;
774  for (uint16_t i = 0; i < m_dlBandwidth; i++)
775  {
776  dlRb.push_back(i);
777  }
779  NS_LOG_LOGIC(this << " eNB start TX CTRL");
780  bool pss = false;
781  if ((m_nrSubFrames == 1) || (m_nrSubFrames == 6))
782  {
783  pss = true;
784  }
785  m_downlinkSpectrumPhy->StartTxDlCtrlFrame(ctrlMsgList, pss);
786 }
787 
788 void
790 {
791  // set the current tx power spectral density
793  // send the current burts of packets
794  NS_LOG_LOGIC(this << " eNB start TX DATA");
795  std::list<Ptr<LteControlMessage>> ctrlMsgList;
796  ctrlMsgList.clear();
797  m_downlinkSpectrumPhy->StartTxDataFrame(pb, ctrlMsgList, DL_DATA_DURATION);
798 }
799 
800 void
802 {
803  NS_LOG_FUNCTION(this << Simulator::Now().As(Time::S));
804  if (m_nrSubFrames == 10)
805  {
807  }
808  else
809  {
811  }
812 }
813 
814 void
816 {
817  NS_LOG_FUNCTION(this << Simulator::Now().As(Time::S));
819 }
820 
821 void
823 {
824  NS_LOG_FUNCTION(this << sinr << Simulator::Now() << m_srsStartTime);
825  // avoid processing SRSs sent with an old SRS configuration index
827  {
830  }
831 }
832 
833 void
835 {
836  NS_LOG_FUNCTION(this << sinr);
839 }
840 
841 void
843 {
844  NS_LOG_FUNCTION(this << interf);
845  Ptr<SpectrumValue> interfCopy = Create<SpectrumValue>(interf);
848  {
849  m_reportInterferenceTrace(m_cellId, interfCopy);
851  }
852 }
853 
854 void
856 {
857  // not used by eNB
858 }
859 
862 {
863  NS_LOG_FUNCTION(this << sinr);
865  ulcqi.m_ulCqi.m_type = UlCqi_s::PUSCH;
866  for (auto it = sinr.ConstValuesBegin(); it != sinr.ConstValuesEnd(); it++)
867  {
868  double sinrdb = 10 * std::log10(*it);
869  // NS_LOG_DEBUG ("ULCQI RB " << i << " value " << sinrdb);
870  // convert from double to fixed point notation Sxxxxxxxxxxx.xxx
871  int16_t sinrFp = LteFfConverter::double2fpS11dot3(sinrdb);
872  ulcqi.m_ulCqi.m_sinr.push_back(sinrFp);
873  }
874  return ulcqi;
875 }
876 
877 void
878 LteEnbPhy::DoSetBandwidth(uint16_t ulBandwidth, uint16_t dlBandwidth)
879 {
880  NS_LOG_FUNCTION(this << (uint32_t)ulBandwidth << (uint32_t)dlBandwidth);
881  m_ulBandwidth = ulBandwidth;
882  m_dlBandwidth = dlBandwidth;
883 
884  static const int Type0AllocationRbg[4] = {
885  10, // RGB size 1
886  26, // RGB size 2
887  63, // RGB size 3
888  110, // RGB size 4
889  }; // see table 7.1.6.1-1 of 36.213
890  for (int i = 0; i < 4; i++)
891  {
892  if (dlBandwidth < Type0AllocationRbg[i])
893  {
894  m_rbgSize = i + 1;
895  break;
896  }
897  }
898 }
899 
900 void
901 LteEnbPhy::DoSetEarfcn(uint32_t ulEarfcn, uint32_t dlEarfcn)
902 {
903  NS_LOG_FUNCTION(this << ulEarfcn << dlEarfcn);
904  m_ulEarfcn = ulEarfcn;
905  m_dlEarfcn = dlEarfcn;
906 }
907 
908 void
909 LteEnbPhy::DoAddUe(uint16_t rnti)
910 {
911  NS_LOG_FUNCTION(this << rnti);
912 
913  bool success = AddUePhy(rnti);
914  NS_ASSERT_MSG(success, "AddUePhy() failed");
915 
916  // add default P_A value
917  DoSetPa(rnti, 0);
918 }
919 
920 void
921 LteEnbPhy::DoRemoveUe(uint16_t rnti)
922 {
923  NS_LOG_FUNCTION(this << rnti);
924 
925  bool success = DeleteUePhy(rnti);
926  NS_ASSERT_MSG(success, "DeleteUePhy() failed");
927 
928  // remove also P_A value
929  auto it = m_paMap.find(rnti);
930  if (it != m_paMap.end())
931  {
932  m_paMap.erase(it);
933  }
934 
935  // additional data to be removed
936  m_uplinkSpectrumPhy->RemoveExpectedTb(rnti);
937  // remove srs info to avoid trace errors
938  auto sit = m_srsSampleCounterMap.find(rnti);
939  if (sit != m_srsSampleCounterMap.end())
940  {
941  m_srsSampleCounterMap.erase(rnti);
942  }
943  // remove DL_DCI message otherwise errors occur for m_dlPhyTransmission trace
944  // remove also any UL_DCI message for the UE to be removed
945 
946  for (auto& ctrlMessageList : m_controlMessagesQueue)
947  {
948  auto ctrlMsgListIt = ctrlMessageList.begin();
949  while (ctrlMsgListIt != ctrlMessageList.end())
950  {
951  Ptr<LteControlMessage> msg = (*ctrlMsgListIt);
952  if (msg->GetMessageType() == LteControlMessage::DL_DCI)
953  {
954  auto dci = DynamicCast<DlDciLteControlMessage>(msg);
955  if (dci->GetDci().m_rnti == rnti)
956  {
957  NS_LOG_INFO("DL_DCI to be sent from cell id : " << m_cellId << " to RNTI : "
958  << rnti << " is deleted");
959  ctrlMsgListIt = ctrlMessageList.erase(ctrlMsgListIt);
960  }
961  else
962  {
963  ++ctrlMsgListIt;
964  }
965  }
966  else if (msg->GetMessageType() == LteControlMessage::UL_DCI)
967  {
968  auto dci = DynamicCast<UlDciLteControlMessage>(msg);
969  if (dci->GetDci().m_rnti == rnti)
970  {
971  NS_LOG_INFO("UL_DCI to be sent from cell id : " << m_cellId << " to RNTI : "
972  << rnti << " is deleted");
973  ctrlMsgListIt = ctrlMessageList.erase(ctrlMsgListIt);
974  }
975  else
976  {
977  ++ctrlMsgListIt;
978  }
979  }
980  else
981  {
982  ++ctrlMsgListIt;
983  }
984  }
985  }
986 }
987 
988 void
989 LteEnbPhy::DoSetPa(uint16_t rnti, double pa)
990 {
991  NS_LOG_FUNCTION(this << rnti);
992 
993  auto it = m_paMap.find(rnti);
994 
995  if (it == m_paMap.end())
996  {
997  m_paMap.insert(std::pair<uint16_t, double>(rnti, pa));
998  }
999  else
1000  {
1001  it->second = pa;
1002  }
1003 }
1004 
1007 {
1008  NS_LOG_FUNCTION(this << sinr);
1010  ulcqi.m_ulCqi.m_type = UlCqi_s::SRS;
1011  int i = 0;
1012  double srsSum = 0.0;
1013  for (auto it = sinr.ConstValuesBegin(); it != sinr.ConstValuesEnd(); it++)
1014  {
1015  double sinrdb = 10 * log10(*it);
1016  // NS_LOG_DEBUG ("ULCQI RB " << i << " value " << sinrdb);
1017  // convert from double to fixed point notation Sxxxxxxxxxxx.xxx
1018  int16_t sinrFp = LteFfConverter::double2fpS11dot3(sinrdb);
1019  srsSum += (*it);
1020  ulcqi.m_ulCqi.m_sinr.push_back(sinrFp);
1021  i++;
1022  }
1023  // Insert the user generated the srs as a vendor specific parameter
1024  NS_LOG_DEBUG(this << " ENB RX UL-CQI of " << m_srsUeOffset.at(m_currentSrsOffset));
1026  vsp.m_type = SRS_CQI_RNTI_VSP;
1027  vsp.m_length = sizeof(SrsCqiRntiVsp);
1028  Ptr<SrsCqiRntiVsp> rnti = Create<SrsCqiRntiVsp>(m_srsUeOffset.at(m_currentSrsOffset));
1029  vsp.m_value = rnti;
1030  ulcqi.m_vendorSpecificList.push_back(vsp);
1031  // call SRS tracing method
1032  CreateSrsReport(m_srsUeOffset.at(m_currentSrsOffset), (i > 0) ? (srsSum / i) : DBL_MAX);
1033  return ulcqi;
1034 }
1035 
1036 void
1037 LteEnbPhy::CreateSrsReport(uint16_t rnti, double srs)
1038 {
1039  NS_LOG_FUNCTION(this << rnti << srs);
1040  auto it = m_srsSampleCounterMap.find(rnti);
1041  if (it == m_srsSampleCounterMap.end())
1042  {
1043  // create new entry
1044  m_srsSampleCounterMap.insert(std::pair<uint16_t, uint16_t>(rnti, 0));
1045  it = m_srsSampleCounterMap.find(rnti);
1046  }
1047  (*it).second++;
1048  if ((*it).second == m_srsSamplePeriod)
1049  {
1050  m_reportUeSinr(m_cellId, rnti, srs, (uint16_t)m_componentCarrierId);
1051  (*it).second = 0;
1052  }
1053 }
1054 
1055 void
1056 LteEnbPhy::DoSetTransmissionMode(uint16_t rnti, uint8_t txMode)
1057 {
1058  NS_LOG_FUNCTION(this << rnti << (uint16_t)txMode);
1059  // UL supports only SISO MODE
1060 }
1061 
1062 void
1064 {
1065  NS_LOG_FUNCTION(this);
1066  m_ulDciQueue.at(UL_PUSCH_TTIS_DELAY - 1).push_back(m);
1067 }
1068 
1069 std::list<UlDciLteControlMessage>
1071 {
1072  NS_LOG_FUNCTION(this);
1073  if (!m_ulDciQueue.at(0).empty())
1074  {
1075  std::list<UlDciLteControlMessage> ret = m_ulDciQueue.at(0);
1076  m_ulDciQueue.erase(m_ulDciQueue.begin());
1077  std::list<UlDciLteControlMessage> l;
1078  m_ulDciQueue.push_back(l);
1079  return ret;
1080  }
1081  else
1082  {
1083  m_ulDciQueue.erase(m_ulDciQueue.begin());
1084  std::list<UlDciLteControlMessage> l;
1085  m_ulDciQueue.push_back(l);
1086  std::list<UlDciLteControlMessage> emptylist;
1087  return emptylist;
1088  }
1089 }
1090 
1091 void
1092 LteEnbPhy::DoSetSrsConfigurationIndex(uint16_t rnti, uint16_t srcCi)
1093 {
1094  NS_LOG_FUNCTION(this);
1095  uint16_t p = GetSrsPeriodicity(srcCi);
1096  if (p != m_srsPeriodicity)
1097  {
1098  // resize the array of offset -> re-initialize variables
1099  m_srsUeOffset.clear();
1100  m_srsUeOffset.resize(p, 0);
1101  m_srsPeriodicity = p;
1102  // inhibit SRS until RRC Connection Reconfiguration propagates
1103  // to UEs, otherwise we might be wrong in determining the UE who
1104  // actually sent the SRS (if the UE was using a stale SRS config)
1105  // if we use a static SRS configuration index, we can have a 0ms guard time
1107  }
1108 
1109  NS_LOG_DEBUG(this << " ENB SRS P " << m_srsPeriodicity << " RNTI " << rnti << " offset "
1110  << GetSrsSubframeOffset(srcCi) << " CI " << srcCi);
1111  auto it = m_srsCounter.find(rnti);
1112  if (it != m_srsCounter.end())
1113  {
1114  (*it).second = GetSrsSubframeOffset(srcCi) + 1;
1115  }
1116  else
1117  {
1118  m_srsCounter.insert(std::pair<uint16_t, uint16_t>(rnti, GetSrsSubframeOffset(srcCi) + 1));
1119  }
1120  m_srsUeOffset.at(GetSrsSubframeOffset(srcCi)) = rnti;
1121 }
1122 
1123 void
1125 {
1126  NS_LOG_FUNCTION(this);
1127  m_mib = mib;
1128 }
1129 
1130 void
1132 {
1133  NS_LOG_FUNCTION(this);
1134  m_sib1 = sib1;
1135 }
1136 
1137 void
1139 {
1140  m_harqPhyModule = harq;
1141 }
1142 
1143 void
1145 {
1146  NS_LOG_FUNCTION(this);
1147  // forward to scheduler
1149 }
1150 
1151 } // namespace ns3
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
void SendMacPdu(Ptr< Packet > p) override
Send the MAC PDU to the channel.
Definition: lte-enb-phy.cc:108
EnbMemberLteEnbPhySapProvider(LteEnbPhy *phy)
Constructor.
Definition: lte-enb-phy.cc:102
virtual void SetBandwidth(uint16_t ulBandwidth, uint16_t dlBandwidth)
Set bandwidth function.
Definition: lte-enb-phy.cc:114
uint8_t GetMacChTtiDelay() override
Get the delay from MAC to Channel expressed in TTIs.
Definition: lte-enb-phy.cc:132
LteEnbPhy * m_phy
the ENB Phy
Definition: lte-enb-phy.cc:99
virtual void SetCellId(uint16_t cellId)
Set Cell ID function.
Definition: lte-enb-phy.cc:120
void SendLteControlMessage(Ptr< LteControlMessage > msg) override
Send SendLteControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel.
Definition: lte-enb-phy.cc:126
Service Access Point (SAP) offered by the UE PHY to the UE RRC for control purposes.
Service Access Point (SAP) offered by the UE PHY to the UE RRC for control purposes.
LteEnbPhy models the physical layer for the eNodeB.
Definition: lte-enb-phy.h:45
uint16_t m_srsPeriodicity
SRS periodicity.
Definition: lte-enb-phy.h:461
double GetTxPower() const
Definition: lte-enb-phy.cc:311
Time m_srsStartTime
SRS start time.
Definition: lte-enb-phy.h:462
int8_t DoGetReferenceSignalPower() const
Definition: lte-enb-phy.cc:318
void StartSubFrame()
Start a LTE sub frame.
Definition: lte-enb-phy.cc:593
void CreateSrsReport(uint16_t rnti, double srs)
Create SRS report function.
uint16_t m_interferenceSamplePeriod
The InterferenceSamplePeriod attribute.
Definition: lte-enb-phy.h:506
virtual void ReportUlHarqFeedback(UlInfoListElement_s mes)
Report the uplink HARQ feedback generated by LteSpectrumPhy to MAC.
std::list< UlDciLteControlMessage > DequeueUlDci()
uint16_t m_srsSamplePeriod
The UeSinrSamplePeriod trace source.
Definition: lte-enb-phy.h:490
void SetLteEnbCphySapUser(LteEnbCphySapUser *s)
Set the CPHY SAP User.
Definition: lte-enb-phy.cc:290
FfMacSchedSapProvider::SchedUlCqiInfoReqParameters CreatePuschCqiReport(const SpectrumValue &sinr)
Create the UL CQI feedback from SINR values perceived at the physical layer with the PUSCH signal rec...
Definition: lte-enb-phy.cc:861
uint32_t m_nrSubFrames
The subframe number currently served.
Definition: lte-enb-phy.h:459
std::set< uint16_t > m_ueAttached
List of RNTI of attached UEs.
Definition: lte-enb-phy.h:422
LteEnbPhySapProvider * GetLteEnbPhySapProvider()
Get the PHY SAP provider.
Definition: lte-enb-phy.cc:284
void SetLteEnbPhySapUser(LteEnbPhySapUser *s)
Set the PHY SAP User.
Definition: lte-enb-phy.cc:278
void DoSetMasterInformationBlock(LteRrcSap::MasterInformationBlock mib)
Set master information block.
bool DeleteUePhy(uint16_t rnti)
Remove the given RNTI from the list of attached UE m_ueAttached.
Definition: lte-enb-phy.cc:395
std::vector< std::list< UlDciLteControlMessage > > m_ulDciQueue
For storing info on future receptions.
Definition: lte-enb-phy.h:441
double GetNoiseFigure() const
Definition: lte-enb-phy.cc:332
void SetTxPower(double pow)
Definition: lte-enb-phy.cc:304
std::vector< int > m_dlDataRbMap
DL data RB map.
Definition: lte-enb-phy.h:438
TracedCallback< uint16_t, uint16_t, double, uint8_t > m_reportUeSinr
The ReportUeSinr trace source.
Definition: lte-enb-phy.h:485
~LteEnbPhy() override
Definition: lte-enb-phy.cc:239
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage >> msgList)
PhySpectrum received a new list of LteControlMessage.
Definition: lte-enb-phy.cc:523
Ptr< LteSpectrumPhy > GetDlSpectrumPhy() const
Definition: lte-enb-phy.cc:366
void DoDispose() override
Destructor implementation.
Definition: lte-enb-phy.cc:244
void GenerateCtrlCqiReport(const SpectrumValue &sinr) override
generate a CQI report based on the given SINR of Ctrl frame
Definition: lte-enb-phy.cc:822
void GenerateDataCqiReport(const SpectrumValue &sinr) override
generate a CQI report based on the given SINR of Data frame (used for PUSCH CQIs)
Definition: lte-enb-phy.cc:834
void SendDataChannels(Ptr< PacketBurst > pb)
Send the PDSCH.
Definition: lte-enb-phy.cc:789
std::map< uint16_t, uint16_t > m_srsSampleCounterMap
SRS sample counter map.
Definition: lte-enb-phy.h:491
void DoSetSrsConfigurationIndex(uint16_t rnti, uint16_t srcCi)
Set source configuration index.
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
Definition: lte-enb-phy.cc:425
FfMacSchedSapProvider::SchedUlCqiInfoReqParameters CreateSrsCqiReport(const SpectrumValue &sinr)
Create the UL CQI feedback from SINR values perceived at the physical layer with the SRS signal recei...
LteEnbPhySapUser * m_enbPhySapUser
ENB Phy SAP user.
Definition: lte-enb-phy.h:444
void EndFrame()
End a LTE frame.
Definition: lte-enb-phy.cc:815
void CalcChannelQualityForUe(std::vector< double > sinr, Ptr< LteSpectrumPhy > ue)
Calculate the channel quality for a given UE.
Definition: lte-enb-phy.cc:501
void DoSetPa(uint16_t rnti, double pa)
Set PA.
Definition: lte-enb-phy.cc:989
uint8_t GetMacChDelay() const
Definition: lte-enb-phy.cc:360
uint16_t m_currentSrsOffset
current SRS offset
Definition: lte-enb-phy.h:465
void DoSetEarfcn(uint32_t dlEarfcn, uint32_t ulEarfcn)
Set EARFCN.
Definition: lte-enb-phy.cc:901
Ptr< SpectrumValue > CreateTxPowerSpectralDensity() override
Create the PSD for TX.
Definition: lte-enb-phy.cc:472
void DoSetTransmissionMode(uint16_t rnti, uint8_t txMode)
Set transmission mode.
LteEnbPhySapProvider * m_enbPhySapProvider
ENB Phy SAP provider.
Definition: lte-enb-phy.h:443
void SendControlChannels(std::list< Ptr< LteControlMessage >> ctrlMsgList)
Send the PDCCH and PCFICH in the first 3 symbols.
Definition: lte-enb-phy.cc:769
uint8_t DoGetMacChTtiDelay()
Get MAC ch TTI delay function.
Definition: lte-enb-phy.cc:419
std::map< int, double > m_dlPowerAllocationMap
DL power allocation map.
Definition: lte-enb-phy.h:428
std::vector< int > m_listOfDownlinkSubchannel
A vector of integers, if the i-th value is j it means that the j-th resource block is used for transm...
Definition: lte-enb-phy.h:436
void GeneratePowerAllocationMap(uint16_t rnti, int rbId)
Generate power allocation map (i.e.
Definition: lte-enb-phy.cc:457
void QueueUlDci(UlDciLteControlMessage m)
void SetNoiseFigure(double pow)
Definition: lte-enb-phy.cc:325
std::map< uint16_t, uint16_t > m_srsCounter
SRS counter.
Definition: lte-enb-phy.h:463
void SetMacChDelay(uint8_t delay)
Definition: lte-enb-phy.cc:339
void SetHarqPhyModule(Ptr< LteHarqPhy > harq)
Set the HARQ Phy module.
void DoRemoveUe(uint16_t rnti)
Remove UE.
Definition: lte-enb-phy.cc:921
void SetDownlinkSubChannelsWithPowerAllocation(std::vector< int > mask)
set the resource blocks (a.k.a.
Definition: lte-enb-phy.cc:441
void ReportRsReceivedPower(const SpectrumValue &power) override
generate a report based on the linear RS power perceived during CTRL frame NOTE: used only by UE for ...
Definition: lte-enb-phy.cc:855
LteRrcSap::MasterInformationBlock m_mib
The Master Information Block message to be broadcasted every frame.
Definition: lte-enb-phy.h:471
void DoSendMacPdu(Ptr< Packet > p) override
Queue the MAC PDU to be sent (according to m_macChTtiDelay)
Definition: lte-enb-phy.cc:412
void ReportInterference(const SpectrumValue &interf) override
generate a report based on the linear interference and noise power perceived during DATA frame NOTE: ...
Definition: lte-enb-phy.cc:842
TracedCallback< uint16_t, Ptr< SpectrumValue > > m_reportInterferenceTrace
The ReportInterference trace source.
Definition: lte-enb-phy.h:500
Ptr< LteSpectrumPhy > GetUlSpectrumPhy() const
Definition: lte-enb-phy.cc:372
void DoAddUe(uint16_t rnti)
Add UE.
Definition: lte-enb-phy.cc:909
friend class EnbMemberLteEnbPhySapProvider
allow EnbMemberLteEnbPhySapProvider class friend access
Definition: lte-enb-phy.h:47
void DoSetSystemInformationBlockType1(LteRrcSap::SystemInformationBlockType1 sib1)
Set system information block.
void DoSendLteControlMessage(Ptr< LteControlMessage > msg)
Send LTE Control Message function.
Definition: lte-enb-phy.cc:507
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensityWithPowerAllocation()
Create the PSD for TX with power allocation for each RB.
Definition: lte-enb-phy.cc:486
bool AddUePhy(uint16_t rnti)
Add the given RNTI to the list of attached UE m_ueAttached.
Definition: lte-enb-phy.cc:378
void DoInitialize() override
Initialize() implementation.
Definition: lte-enb-phy.cc:255
LteRrcSap::SystemInformationBlockType1 m_sib1
The System Information Block Type 1 message to be broadcasted.
Definition: lte-enb-phy.h:477
std::map< uint16_t, double > m_paMap
P_A per UE RNTI.
Definition: lte-enb-phy.h:425
void DoSetBandwidth(uint16_t ulBandwidth, uint16_t dlBandwidth)
Set bandwidth function.
Definition: lte-enb-phy.cc:878
void EndSubFrame()
End a LTE sub frame.
Definition: lte-enb-phy.cc:801
LteEnbCphySapUser * m_enbCphySapUser
ENB CPhy SAP user.
Definition: lte-enb-phy.h:447
uint16_t m_interferenceSampleCounter
interference sample counter
Definition: lte-enb-phy.h:507
void SetDownlinkSubChannels(std::vector< int > mask)
set the resource blocks (a.k.a.
Definition: lte-enb-phy.cc:432
virtual void ReceiveLteControlMessage(Ptr< LteControlMessage > msg)
Receive the control message.
Definition: lte-enb-phy.cc:515
void StartFrame()
Start a LTE frame.
Definition: lte-enb-phy.cc:575
uint32_t m_nrFrames
The frame number currently served.
Definition: lte-enb-phy.h:453
LteEnbCphySapProvider * m_enbCphySapProvider
ENB CPhy SAP provider.
Definition: lte-enb-phy.h:446
std::vector< uint16_t > m_srsUeOffset
SRS UE offset.
Definition: lte-enb-phy.h:464
LteEnbCphySapProvider * GetLteEnbCphySapProvider()
Get the CPHY SAP provider.
Definition: lte-enb-phy.cc:297
TracedCallback< PhyTransmissionStatParameters > m_dlPhyTransmission
The DlPhyTransmission trace source.
Definition: lte-enb-phy.h:514
std::vector< int > GetDownlinkSubChannels()
Definition: lte-enb-phy.cc:450
Ptr< LteHarqPhy > m_harqPhyModule
HARQ Phy module.
Definition: lte-enb-phy.h:479
friend class MemberLteEnbCphySapProvider< LteEnbPhy >
allow MemberLteEnbCphySapProvider<LteEnbPhy> class friend access
Definition: lte-enb-phy.h:49
static TypeId GetTypeId()
Get the type ID.
Definition: lte-enb-phy.cc:166
Service Access Point (SAP) offered by the eNB-PHY to the eNB-MAC.
Service Access Point (SAP) offered by the eNB-PHY to the eNB-MAC.
virtual void ReceivePhyPdu(Ptr< Packet > p)=0
Called by the Phy to notify the MAC of the reception of a new PHY-PDU.
virtual void UlCqiReport(FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi)=0
Returns to MAC level the UL-CQI evaluated.
virtual void UlInfoListElementHarqFeedback(UlInfoListElement_s params)=0
Notify the HARQ on the UL transmission status.
virtual void ReceiveLteControlMessage(Ptr< LteControlMessage > msg)=0
Receive SendLteControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel.
virtual void ReceiveRachPreamble(uint32_t prachId)=0
notify the reception of a RACH preamble on the PRACH
virtual void SubframeIndication(uint32_t frameNo, uint32_t subframeNo)=0
Trigger the start from a new frame (input from Phy layer)
static uint16_t double2fpS11dot3(double val)
Convert from double to fixed point S11.3 notation.
Definition: lte-common.cc:134
The LtePhy models the physical layer of LTE.
Definition: lte-phy.h:51
void DoSetCellId(uint16_t cellId)
Definition: lte-phy.cc:240
double m_txPower
Transmission power in dBm.
Definition: lte-phy.h:241
uint8_t GetRbgSize() const
Definition: lte-phy.cc:180
void DoDispose() override
Destructor implementation.
Definition: lte-phy.cc:76
uint16_t GetSrsPeriodicity(uint16_t srcCi) const
Definition: lte-phy.cc:144
std::vector< Ptr< PacketBurst > > m_packetBurstQueue
A queue of packet bursts to be sent.
Definition: lte-phy.h:281
uint16_t m_ulBandwidth
The UL bandwidth in number of PRBs.
Definition: lte-phy.h:261
Ptr< PacketBurst > GetPacketBurst()
Definition: lte-phy.cc:192
uint8_t m_componentCarrierId
component carrier Id used to address sap
Definition: lte-phy.h:303
double m_noiseFigure
Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver.
Definition: lte-phy.h:253
uint32_t m_ulEarfcn
The uplink carrier frequency.
Definition: lte-phy.h:278
uint16_t m_dlBandwidth
The DL bandwidth in number of PRBs.
Definition: lte-phy.h:266
Ptr< LteSpectrumPhy > m_downlinkSpectrumPhy
The downlink LteSpectrumPhy associated to this LtePhy.
Definition: lte-phy.h:230
void SetMacPdu(Ptr< Packet > p)
Definition: lte-phy.cc:186
std::list< Ptr< LteControlMessage > > GetControlMessages()
Definition: lte-phy.cc:218
uint16_t GetSrsSubframeOffset(uint16_t srcCi) const
Definition: lte-phy.cc:162
Ptr< LteNetDevice > m_netDevice
Pointer to the NetDevice where this PHY layer is attached.
Definition: lte-phy.h:224
uint16_t m_cellId
Cell identifier.
Definition: lte-phy.h:300
void SetControlMessages(Ptr< LteControlMessage > m)
Definition: lte-phy.cc:210
uint32_t m_dlEarfcn
The downlink carrier frequency.
Definition: lte-phy.h:273
Ptr< LteSpectrumPhy > m_uplinkSpectrumPhy
The uplink LteSpectrumPhy associated to this LtePhy.
Definition: lte-phy.h:235
double GetTti() const
Definition: lte-phy.cc:137
std::vector< std::list< Ptr< LteControlMessage > > > m_controlMessagesQueue
A queue of control messages to be sent.
Definition: lte-phy.h:283
uint8_t m_rbgSize
The RB group size according to the bandwidth.
Definition: lte-phy.h:268
uint8_t m_macChTtiDelay
Delay between MAC and channel layer in terms of TTIs.
Definition: lte-phy.h:293
static Ptr< SpectrumValue > CreateNoisePowerSpectralDensity(uint32_t earfcn, uint16_t bandwidth, double noiseFigure)
create a SpectrumValue that models the power spectral density of AWGN
static Ptr< SpectrumValue > CreateTxPowerSpectralDensity(uint32_t earfcn, uint16_t bandwidth, double powerTx, std::vector< int > activeRbs)
create a spectrum value representing the power spectral density of a signal to be transmitted.
uint32_t GetId() const
Definition: node.cc:117
virtual void DoInitialize()
Initialize() implementation.
Definition: object.cc:359
Hold objects of type Ptr<T>.
Definition: pointer.h:37
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:571
static void ScheduleWithContext(uint32_t context, const Time &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
Definition: simulator.h:588
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:208
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition: simulator.h:605
Set of values corresponding to a given SpectrumModel.
Values::const_iterator ConstValuesBegin() const
Values::const_iterator ConstValuesEnd() const
Define the RNTI that has generated the.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
int64_t GetMilliSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:408
@ S
second
Definition: nstime.h:116
a unique identifier for an interface.
Definition: type-id.h:59
@ ATTR_GET
The attribute can be read.
Definition: type-id.h:64
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:931
Hold an unsigned integer type.
Definition: uinteger.h:45
The Uplink Data Control Indicator messages defines the RB allocation for the users in the uplink.
void SetDci(UlDciListElement_s dci)
add a DCI into the message
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:86
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition: log.h:254
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:282
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:275
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1362
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1326
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1338
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
#define UL_PUSCH_TTIS_DELAY
Definition: lte-common.h:28
#define SRS_CQI_RNTI_VSP
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static const Time DL_CTRL_DELAY_FROM_SUBFRAME_START
Delay from the start of a DL subframe to transmission of the data portion.
Definition: lte-enb-phy.cc:63
static const Time DL_DATA_DURATION
Duration of the data portion of a DL subframe.
Definition: lte-enb-phy.cc:56
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Definition: pointer.h:227
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition: double.h:43
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition: uinteger.h:46
static const int Type0AllocationRbg[4]
Type 0 RGB allocation.
phy
Definition: third.py:89
params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.
#define list
See section 4.3.24 cqiListElement.
uint16_t m_rnti
RNTI.
See section 4.3.23 dlInfoListElement.
Parameters of the SCHED_UL_CQI_INFO_REQ primitive.
std::vector< VendorSpecificListElement_s > m_vendorSpecificList
vendor specific list
MasterInformationBlock structure.
Definition: lte-rrc-sap.h:622
uint16_t systemFrameNumber
system frame number
Definition: lte-rrc-sap.h:624
SystemInformationBlockType1 structure.
Definition: lte-rrc-sap.h:629
See section 4.3.14 macCEListElement.
PhyTransmissionStatParameters structure.
Definition: lte-common.h:188
std::vector< uint16_t > m_sinr
SINR.
See section 4.3.2 ulDciListElement.
int8_t m_tpc
Tx power control command.
bool m_cqiRequest
CQI request.
Substitutive structure for specifying BuildRarListElement_s::m_grant field.
int8_t m_tpc
Tx power control command.
bool m_cqiRequest
CQI request?
bool m_hopping
hopping?
uint16_t m_tbSize
size
uint8_t m_rbLen
length
uint8_t m_mcs
MCS.
uint8_t m_rbStart
start
uint16_t m_rnti
RNTI.
See section 4.3.12 ulInfoListElement.
See section 4.3.3 vendorSpecificListElement.
Ptr< VendorSpecificValue > m_value
value