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-control-messages.h"
24 #include "lte-enb-mac.h"
25 #include "lte-enb-net-device.h"
26 #include "lte-net-device.h"
28 #include "lte-ue-phy.h"
29 #include "lte-ue-rrc.h"
30 
31 #include <ns3/attribute-accessor-helper.h>
32 #include <ns3/double.h>
33 #include <ns3/log.h>
34 #include <ns3/lte-common.h>
35 #include <ns3/lte-vendor-specific-parameters.h>
36 #include <ns3/object-factory.h>
37 #include <ns3/simulator.h>
38 
39 #include <cfloat>
40 #include <cmath>
41 
42 // WILD HACK for the inizialization of direct eNB-UE ctrl messaging
43 #include <ns3/lte-ue-net-device.h>
44 #include <ns3/node-list.h>
45 #include <ns3/node.h>
46 #include <ns3/pointer.h>
47 
48 namespace ns3
49 {
50 
51 NS_LOG_COMPONENT_DEFINE("LteEnbPhy");
52 
54 
61 static const Time DL_DATA_DURATION = NanoSeconds(785714 - 1);
62 
69 
71 // member SAP forwarders
73 
76 {
77  public:
84 
85  // inherited from LteEnbPhySapProvider
86  void SendMacPdu(Ptr<Packet> p) override;
88  uint8_t GetMacChTtiDelay() override;
95  virtual void SetBandwidth(uint16_t ulBandwidth, uint16_t dlBandwidth);
101  virtual void SetCellId(uint16_t cellId);
102 
103  private:
105 };
106 
108  : m_phy(phy)
109 {
110 }
111 
112 void
114 {
115  m_phy->DoSendMacPdu(p);
116 }
117 
118 void
119 EnbMemberLteEnbPhySapProvider::SetBandwidth(uint16_t ulBandwidth, uint16_t dlBandwidth)
120 {
121  m_phy->DoSetBandwidth(ulBandwidth, dlBandwidth);
122 }
123 
124 void
126 {
127  m_phy->DoSetCellId(cellId);
128 }
129 
130 void
132 {
134 }
135 
136 uint8_t
138 {
139  return (m_phy->DoGetMacChTtiDelay());
140 }
141 
143 // generic LteEnbPhy methods
145 
147 {
148  NS_LOG_FUNCTION(this);
149  NS_FATAL_ERROR("This constructor should not be called");
150 }
151 
153  : LtePhy(dlPhy, ulPhy),
154  m_enbPhySapUser(nullptr),
155  m_enbCphySapUser(nullptr),
156  m_nrFrames(0),
157  m_nrSubFrames(0),
158  m_srsPeriodicity(0),
159  m_srsStartTime(Seconds(0)),
160  m_currentSrsOffset(0),
161  m_interferenceSampleCounter(0)
162 {
165  m_harqPhyModule = Create<LteHarqPhy>();
166  m_downlinkSpectrumPhy->SetHarqPhyModule(m_harqPhyModule);
167  m_uplinkSpectrumPhy->SetHarqPhyModule(m_harqPhyModule);
168 }
169 
170 TypeId
172 {
173  static TypeId tid =
174  TypeId("ns3::LteEnbPhy")
175  .SetParent<LtePhy>()
176  .SetGroupName("Lte")
177  .AddConstructor<LteEnbPhy>()
178  .AddAttribute("TxPower",
179  "Transmission power in dBm",
180  DoubleValue(30.0),
182  MakeDoubleChecker<double>())
183  .AddAttribute(
184  "NoiseFigure",
185  "Loss (dB) in the Signal-to-Noise-Ratio due to "
186  "non-idealities in the receiver. According to Wikipedia "
187  "(http://en.wikipedia.org/wiki/Noise_figure), this is "
188  "\"the difference in decibels (dB) between"
189  " the noise output of the actual receiver to "
190  "the noise output of an ideal receiver with "
191  "the same overall gain and bandwidth when the receivers "
192  "are connected to sources at the standard noise "
193  "temperature T0.\" In this model, we consider T0 = 290K.",
194  DoubleValue(5.0),
196  MakeDoubleChecker<double>())
197  .AddAttribute(
198  "MacToChannelDelay",
199  "The delay in TTI units that occurs between "
200  "a scheduling decision in the MAC and the actual "
201  "start of the transmission by the PHY. This is "
202  "intended to be used to model the latency of real PHY "
203  "and MAC implementations.",
204  UintegerValue(2),
206  MakeUintegerChecker<uint8_t>())
207  .AddTraceSource("ReportUeSinr",
208  "Report UEs' averaged linear SINR",
210  "ns3::LteEnbPhy::ReportUeSinrTracedCallback")
211  .AddAttribute("UeSinrSamplePeriod",
212  "The sampling period for reporting UEs' SINR stats.",
213  UintegerValue(1),
215  MakeUintegerChecker<uint16_t>())
216  .AddTraceSource("ReportInterference",
217  "Report linear interference power per PHY RB",
219  "ns3::LteEnbPhy::ReportInterferenceTracedCallback")
220  .AddAttribute("InterferenceSamplePeriod",
221  "The sampling period for reporting interference stats",
222  UintegerValue(1),
224  MakeUintegerChecker<uint16_t>())
225  .AddTraceSource("DlPhyTransmission",
226  "DL transmission PHY layer statistics.",
228  "ns3::PhyTransmissionStatParameters::TracedCallback")
229  .AddAttribute("DlSpectrumPhy",
230  "The downlink LteSpectrumPhy associated to this LtePhy",
232  PointerValue(),
234  MakePointerChecker<LteSpectrumPhy>())
235  .AddAttribute("UlSpectrumPhy",
236  "The uplink LteSpectrumPhy associated to this LtePhy",
238  PointerValue(),
240  MakePointerChecker<LteSpectrumPhy>());
241  return tid;
242 }
243 
245 {
246 }
247 
248 void
250 {
251  NS_LOG_FUNCTION(this);
252  m_ueAttached.clear();
253  m_srsUeOffset.clear();
254  delete m_enbPhySapProvider;
255  delete m_enbCphySapProvider;
257 }
258 
259 void
261 {
262  NS_LOG_FUNCTION(this);
263 
264  NS_ABORT_MSG_IF(!m_netDevice, "LteEnbDevice is not available in LteEnbPhy");
265  Ptr<Node> node = m_netDevice->GetNode();
266  NS_ABORT_MSG_IF(!node, "Node is not available in the LteNetDevice of LteEnbPhy");
267  uint32_t nodeId = node->GetId();
268 
269  // ScheduleWithContext() is needed here to set context for logs,
270  // because Initialize() is called outside of Node::AddDevice().
271 
273 
274  Ptr<SpectrumValue> noisePsd =
277  m_noiseFigure);
278  m_uplinkSpectrumPhy->SetNoisePowerSpectralDensity(noisePsd);
280 }
281 
282 void
284 {
285  m_enbPhySapUser = s;
286 }
287 
290 {
291  return (m_enbPhySapProvider);
292 }
293 
294 void
296 {
297  NS_LOG_FUNCTION(this);
298  m_enbCphySapUser = s;
299 }
300 
303 {
304  NS_LOG_FUNCTION(this);
305  return (m_enbCphySapProvider);
306 }
307 
308 void
310 {
311  NS_LOG_FUNCTION(this << pow);
312  m_txPower = pow;
313 }
314 
315 double
317 {
318  NS_LOG_FUNCTION(this);
319  return m_txPower;
320 }
321 
322 int8_t
324 {
325  NS_LOG_FUNCTION(this);
326  return m_txPower;
327 }
328 
329 void
331 {
332  NS_LOG_FUNCTION(this << nf);
333  m_noiseFigure = nf;
334 }
335 
336 double
338 {
339  NS_LOG_FUNCTION(this);
340  return m_noiseFigure;
341 }
342 
343 void
345 {
346  NS_LOG_FUNCTION(this);
347  m_macChTtiDelay = delay;
348  for (int i = 0; i < m_macChTtiDelay; i++)
349  {
350  Ptr<PacketBurst> pb = CreateObject<PacketBurst>();
351  m_packetBurstQueue.push_back(pb);
352  std::list<Ptr<LteControlMessage>> l;
353  m_controlMessagesQueue.push_back(l);
354  std::list<UlDciLteControlMessage> l1;
355  m_ulDciQueue.push_back(l1);
356  }
357  for (int i = 0; i < UL_PUSCH_TTIS_DELAY; i++)
358  {
359  std::list<UlDciLteControlMessage> l1;
360  m_ulDciQueue.push_back(l1);
361  }
362 }
363 
364 uint8_t
366 {
367  return (m_macChTtiDelay);
368 }
369 
372 {
373  return m_downlinkSpectrumPhy;
374 }
375 
378 {
379  return m_uplinkSpectrumPhy;
380 }
381 
382 bool
383 LteEnbPhy::AddUePhy(uint16_t rnti)
384 {
385  NS_LOG_FUNCTION(this << rnti);
386  std::set<uint16_t>::iterator it;
387  it = m_ueAttached.find(rnti);
388  if (it == m_ueAttached.end())
389  {
390  m_ueAttached.insert(rnti);
391  return (true);
392  }
393  else
394  {
395  NS_LOG_ERROR("UE already attached");
396  return (false);
397  }
398 }
399 
400 bool
402 {
403  NS_LOG_FUNCTION(this << rnti);
404  std::set<uint16_t>::iterator it;
405  it = m_ueAttached.find(rnti);
406  if (it == m_ueAttached.end())
407  {
408  NS_LOG_ERROR("UE not attached");
409  return (false);
410  }
411  else
412  {
413  m_ueAttached.erase(it);
414  return (true);
415  }
416 }
417 
418 void
420 {
421  NS_LOG_FUNCTION(this);
422  SetMacPdu(p);
423 }
424 
425 uint8_t
427 {
428  return (m_macChTtiDelay);
429 }
430 
431 void
433 {
434  NS_LOG_FUNCTION(this);
436 }
437 
438 void
439 LteEnbPhy::SetDownlinkSubChannels(std::vector<int> mask)
440 {
441  NS_LOG_FUNCTION(this);
444  m_downlinkSpectrumPhy->SetTxPowerSpectralDensity(txPsd);
445 }
446 
447 void
449 {
450  NS_LOG_FUNCTION(this);
453  m_downlinkSpectrumPhy->SetTxPowerSpectralDensity(txPsd);
454 }
455 
456 std::vector<int>
458 {
459  NS_LOG_FUNCTION(this);
461 }
462 
463 void
465 {
466  NS_LOG_FUNCTION(this);
467  double rbgTxPower = m_txPower;
468 
469  std::map<uint16_t, double>::iterator it = m_paMap.find(rnti);
470  if (it != m_paMap.end())
471  {
472  rbgTxPower = m_txPower + it->second;
473  }
474 
475  m_dlPowerAllocationMap.insert(std::pair<int, double>(rbId, rbgTxPower));
476 }
477 
480 {
481  NS_LOG_FUNCTION(this);
482 
483  Ptr<SpectrumValue> psd =
486  m_txPower,
488 
489  return psd;
490 }
491 
494 {
495  NS_LOG_FUNCTION(this);
496 
497  Ptr<SpectrumValue> psd =
500  m_txPower,
503 
504  return psd;
505 }
506 
507 void
509 {
510  NS_LOG_FUNCTION(this);
511 }
512 
513 void
515 {
516  NS_LOG_FUNCTION(this << msg);
517  // queues the message (wait for MAC-PHY delay)
518  SetControlMessages(msg);
519 }
520 
521 void
523 {
524  NS_FATAL_ERROR("Obsolete function");
525  NS_LOG_FUNCTION(this << msg);
527 }
528 
529 void
531 {
532  NS_LOG_FUNCTION(this);
533  std::list<Ptr<LteControlMessage>>::iterator it;
534  for (it = msgList.begin(); it != msgList.end(); it++)
535  {
536  switch ((*it)->GetMessageType())
537  {
540  DynamicCast<RachPreambleLteControlMessage>(*it);
541  m_enbPhySapUser->ReceiveRachPreamble(rachPreamble->GetRapId());
542  }
543  break;
545  Ptr<DlCqiLteControlMessage> dlcqiMsg = DynamicCast<DlCqiLteControlMessage>(*it);
546  CqiListElement_s dlcqi = dlcqiMsg->GetDlCqi();
547  // check whether the UE is connected
548  if (m_ueAttached.find(dlcqi.m_rnti) != m_ueAttached.end())
549  {
551  }
552  }
553  break;
554  case LteControlMessage::BSR: {
555  Ptr<BsrLteControlMessage> bsrMsg = DynamicCast<BsrLteControlMessage>(*it);
556  MacCeListElement_s bsr = bsrMsg->GetBsr();
557  // check whether the UE is connected
558  if (m_ueAttached.find(bsr.m_rnti) != m_ueAttached.end())
559  {
561  }
562  }
563  break;
566  DynamicCast<DlHarqFeedbackLteControlMessage>(*it);
567  DlInfoListElement_s dlharq = dlharqMsg->GetDlHarqFeedback();
568  // check whether the UE is connected
569  if (m_ueAttached.find(dlharq.m_rnti) != m_ueAttached.end())
570  {
572  }
573  }
574  break;
575  default:
576  NS_FATAL_ERROR("Unexpected LteControlMessage type");
577  break;
578  }
579  }
580 }
581 
582 void
584 {
585  NS_LOG_FUNCTION(this);
586 
587  ++m_nrFrames;
588  NS_LOG_INFO("-----frame " << m_nrFrames << "-----");
589  m_nrSubFrames = 0;
590 
591  // send MIB at beginning of every frame
593  Ptr<MibLteControlMessage> mibMsg = Create<MibLteControlMessage>();
594  mibMsg->SetMib(m_mib);
595  m_controlMessagesQueue.at(0).emplace_back(mibMsg);
596 
597  StartSubFrame();
598 }
599 
600 void
602 {
603  NS_LOG_FUNCTION(this);
604 
605  ++m_nrSubFrames;
606 
607  /*
608  * Send SIB1 at 6th subframe of every odd-numbered radio frame. This is
609  * equivalent with Section 5.2.1.2 of 3GPP TS 36.331, where it is specified
610  * "repetitions are scheduled in subframe #5 of all other radio frames for
611  * which SFN mod 2 = 0," except that 3GPP counts frames and subframes starting
612  * from 0, while ns-3 counts starting from 1.
613  */
614  if ((m_nrSubFrames == 6) && ((m_nrFrames % 2) == 1))
615  {
616  Ptr<Sib1LteControlMessage> msg = Create<Sib1LteControlMessage>();
617  msg->SetSib1(m_sib1);
618  m_controlMessagesQueue.at(0).emplace_back(msg);
619  }
620 
621  if (m_srsPeriodicity > 0)
622  {
623  // might be 0 in case the eNB has no UEs attached
624  NS_ASSERT_MSG(m_nrFrames > 1, "the SRS index check code assumes that frameNo starts at 1");
626  "the SRS index check code assumes that subframeNo starts at 1");
627  m_currentSrsOffset = (((m_nrFrames - 1) * 10 + (m_nrSubFrames - 1)) % m_srsPeriodicity);
628  }
629  NS_LOG_INFO("-----sub frame " << m_nrSubFrames << "-----");
630  m_harqPhyModule->SubframeIndication(m_nrFrames, m_nrSubFrames);
631 
632  // update info on TB to be received
633  std::list<UlDciLteControlMessage> uldcilist = DequeueUlDci();
634  std::list<UlDciLteControlMessage>::iterator dciIt = uldcilist.begin();
635  NS_LOG_DEBUG(this << " eNB Expected TBs " << uldcilist.size());
636  for (dciIt = uldcilist.begin(); dciIt != uldcilist.end(); dciIt++)
637  {
638  std::set<uint16_t>::iterator it2;
639  it2 = m_ueAttached.find((*dciIt).GetDci().m_rnti);
640 
641  if (it2 == m_ueAttached.end())
642  {
643  NS_LOG_ERROR("UE not attached");
644  }
645  else
646  {
647  // send info of TB to LteSpectrumPhy
648  // translate to allocation map
649  std::vector<int> rbMap;
650  for (int i = (*dciIt).GetDci().m_rbStart;
651  i < (*dciIt).GetDci().m_rbStart + (*dciIt).GetDci().m_rbLen;
652  i++)
653  {
654  rbMap.push_back(i);
655  }
656  m_uplinkSpectrumPhy->AddExpectedTb((*dciIt).GetDci().m_rnti,
657  (*dciIt).GetDci().m_ndi,
658  (*dciIt).GetDci().m_tbSize,
659  (*dciIt).GetDci().m_mcs,
660  rbMap,
661  0 /* always SISO*/,
662  0 /* no HARQ proc id in UL*/,
663  0 /*evaluated by LteSpectrumPhy*/,
664  false /* UL*/);
665  if ((*dciIt).GetDci().m_ndi == 1)
666  {
667  NS_LOG_DEBUG(this << " RNTI " << (*dciIt).GetDci().m_rnti << " NEW TB");
668  }
669  else
670  {
671  NS_LOG_DEBUG(this << " RNTI " << (*dciIt).GetDci().m_rnti << " HARQ RETX");
672  }
673  }
674  }
675 
676  // process the current burst of control messages
677  std::list<Ptr<LteControlMessage>> ctrlMsg = GetControlMessages();
678  m_dlDataRbMap.clear();
679  m_dlPowerAllocationMap.clear();
680  if (!ctrlMsg.empty())
681  {
682  std::list<Ptr<LteControlMessage>>::iterator it;
683  it = ctrlMsg.begin();
684  while (it != ctrlMsg.end())
685  {
686  Ptr<LteControlMessage> msg = (*it);
687  if (msg->GetMessageType() == LteControlMessage::DL_DCI)
688  {
689  Ptr<DlDciLteControlMessage> dci = DynamicCast<DlDciLteControlMessage>(msg);
690  // get the tx power spectral density according to DL-DCI(s)
691  // translate the DCI to Spectrum framework
692  uint32_t mask = 0x1;
693  for (int i = 0; i < 32; i++)
694  {
695  if (((dci->GetDci().m_rbBitmap & mask) >> i) == 1)
696  {
697  for (int k = 0; k < GetRbgSize(); k++)
698  {
699  m_dlDataRbMap.push_back((i * GetRbgSize()) + k);
700  // NS_LOG_DEBUG(this << " [enb]DL-DCI allocated PRB " <<
701  // (i*GetRbgSize()) + k);
702  GeneratePowerAllocationMap(dci->GetDci().m_rnti,
703  (i * GetRbgSize()) + k);
704  }
705  }
706  mask = (mask << 1);
707  }
708  // fire trace of DL Tx PHY stats
709  for (std::size_t i = 0; i < dci->GetDci().m_mcs.size(); i++)
710  {
712  params.m_cellId = m_cellId;
713  params.m_imsi = 0; // it will be set by DlPhyTransmissionCallback in LteHelper
714  params.m_timestamp = Simulator::Now().GetMilliSeconds();
715  params.m_rnti = dci->GetDci().m_rnti;
716  params.m_txMode = 0; // TBD
717  params.m_layer = i;
718  params.m_mcs = dci->GetDci().m_mcs.at(i);
719  params.m_size = dci->GetDci().m_tbsSize.at(i);
720  params.m_rv = dci->GetDci().m_rv.at(i);
721  params.m_ndi = dci->GetDci().m_ndi.at(i);
722  params.m_ccId = m_componentCarrierId;
724  }
725  }
726  else if (msg->GetMessageType() == LteControlMessage::UL_DCI)
727  {
728  Ptr<UlDciLteControlMessage> dci = DynamicCast<UlDciLteControlMessage>(msg);
729  QueueUlDci(*dci);
730  }
731  else if (msg->GetMessageType() == LteControlMessage::RAR)
732  {
733  Ptr<RarLteControlMessage> rarMsg = DynamicCast<RarLteControlMessage>(msg);
734  for (std::list<RarLteControlMessage::Rar>::const_iterator it =
735  rarMsg->RarListBegin();
736  it != rarMsg->RarListEnd();
737  ++it)
738  {
739  if (it->rarPayload.m_grant.m_ulDelay == true)
740  {
741  NS_FATAL_ERROR(" RAR delay is not yet implemented");
742  }
743  UlGrant_s ulGrant = it->rarPayload.m_grant;
744  // translate the UL grant in a standard UL-DCI and queue it
745  UlDciListElement_s dci;
746  dci.m_rnti = ulGrant.m_rnti;
747  dci.m_rbStart = ulGrant.m_rbStart;
748  dci.m_rbLen = ulGrant.m_rbLen;
749  dci.m_tbSize = ulGrant.m_tbSize;
750  dci.m_mcs = ulGrant.m_mcs;
751  dci.m_hopping = ulGrant.m_hopping;
752  dci.m_tpc = ulGrant.m_tpc;
753  dci.m_cqiRequest = ulGrant.m_cqiRequest;
754  dci.m_ndi = 1;
756  msg.SetDci(dci);
757  QueueUlDci(msg);
758  }
759  }
760  it++;
761  }
762  }
763 
764  SendControlChannels(ctrlMsg);
765 
766  // send data frame
768  if (pb)
769  {
770  Simulator::Schedule(DL_CTRL_DELAY_FROM_SUBFRAME_START, // ctrl frame fixed to 3 symbols
772  this,
773  pb);
774  }
775 
776  // trigger the MAC
778 
780 }
781 
782 void
784 {
785  NS_LOG_FUNCTION(this << " eNB " << m_cellId << " start tx ctrl frame");
786  // set the current tx power spectral density (full bandwidth)
787  std::vector<int> dlRb;
788  for (uint16_t i = 0; i < m_dlBandwidth; i++)
789  {
790  dlRb.push_back(i);
791  }
793  NS_LOG_LOGIC(this << " eNB start TX CTRL");
794  bool pss = false;
795  if ((m_nrSubFrames == 1) || (m_nrSubFrames == 6))
796  {
797  pss = true;
798  }
799  m_downlinkSpectrumPhy->StartTxDlCtrlFrame(ctrlMsgList, pss);
800 }
801 
802 void
804 {
805  // set the current tx power spectral density
807  // send the current burts of packets
808  NS_LOG_LOGIC(this << " eNB start TX DATA");
809  std::list<Ptr<LteControlMessage>> ctrlMsgList;
810  ctrlMsgList.clear();
811  m_downlinkSpectrumPhy->StartTxDataFrame(pb, ctrlMsgList, DL_DATA_DURATION);
812 }
813 
814 void
816 {
817  NS_LOG_FUNCTION(this << Simulator::Now().As(Time::S));
818  if (m_nrSubFrames == 10)
819  {
821  }
822  else
823  {
825  }
826 }
827 
828 void
830 {
831  NS_LOG_FUNCTION(this << Simulator::Now().As(Time::S));
833 }
834 
835 void
837 {
838  NS_LOG_FUNCTION(this << sinr << Simulator::Now() << m_srsStartTime);
839  // avoid processing SRSs sent with an old SRS configuration index
841  {
844  }
845 }
846 
847 void
849 {
850  NS_LOG_FUNCTION(this << sinr);
853 }
854 
855 void
857 {
858  NS_LOG_FUNCTION(this << interf);
859  Ptr<SpectrumValue> interfCopy = Create<SpectrumValue>(interf);
862  {
863  m_reportInterferenceTrace(m_cellId, interfCopy);
865  }
866 }
867 
868 void
870 {
871  // not used by eNB
872 }
873 
876 {
877  NS_LOG_FUNCTION(this << sinr);
878  Values::const_iterator it;
880  ulcqi.m_ulCqi.m_type = UlCqi_s::PUSCH;
881  for (it = sinr.ConstValuesBegin(); it != sinr.ConstValuesEnd(); it++)
882  {
883  double sinrdb = 10 * std::log10((*it));
884  // NS_LOG_DEBUG ("ULCQI RB " << i << " value " << sinrdb);
885  // convert from double to fixed point notation Sxxxxxxxxxxx.xxx
886  int16_t sinrFp = LteFfConverter::double2fpS11dot3(sinrdb);
887  ulcqi.m_ulCqi.m_sinr.push_back(sinrFp);
888  }
889  return ulcqi;
890 }
891 
892 void
893 LteEnbPhy::DoSetBandwidth(uint16_t ulBandwidth, uint16_t dlBandwidth)
894 {
895  NS_LOG_FUNCTION(this << (uint32_t)ulBandwidth << (uint32_t)dlBandwidth);
896  m_ulBandwidth = ulBandwidth;
897  m_dlBandwidth = dlBandwidth;
898 
899  static const int Type0AllocationRbg[4] = {
900  10, // RGB size 1
901  26, // RGB size 2
902  63, // RGB size 3
903  110, // RGB size 4
904  }; // see table 7.1.6.1-1 of 36.213
905  for (int i = 0; i < 4; i++)
906  {
907  if (dlBandwidth < Type0AllocationRbg[i])
908  {
909  m_rbgSize = i + 1;
910  break;
911  }
912  }
913 }
914 
915 void
916 LteEnbPhy::DoSetEarfcn(uint32_t ulEarfcn, uint32_t dlEarfcn)
917 {
918  NS_LOG_FUNCTION(this << ulEarfcn << dlEarfcn);
919  m_ulEarfcn = ulEarfcn;
920  m_dlEarfcn = dlEarfcn;
921 }
922 
923 void
924 LteEnbPhy::DoAddUe(uint16_t rnti)
925 {
926  NS_LOG_FUNCTION(this << rnti);
927 
928  bool success = AddUePhy(rnti);
929  NS_ASSERT_MSG(success, "AddUePhy() failed");
930 
931  // add default P_A value
932  DoSetPa(rnti, 0);
933 }
934 
935 void
936 LteEnbPhy::DoRemoveUe(uint16_t rnti)
937 {
938  NS_LOG_FUNCTION(this << rnti);
939 
940  bool success = DeleteUePhy(rnti);
941  NS_ASSERT_MSG(success, "DeleteUePhy() failed");
942 
943  // remove also P_A value
944  std::map<uint16_t, double>::iterator it = m_paMap.find(rnti);
945  if (it != m_paMap.end())
946  {
947  m_paMap.erase(it);
948  }
949 
950  // additional data to be removed
951  m_uplinkSpectrumPhy->RemoveExpectedTb(rnti);
952  // remove srs info to avoid trace errors
953  std::map<uint16_t, uint16_t>::iterator sit = m_srsSampleCounterMap.find(rnti);
954  if (sit != m_srsSampleCounterMap.end())
955  {
956  m_srsSampleCounterMap.erase(rnti);
957  }
958  // remove DL_DCI message otherwise errors occur for m_dlPhyTransmission trace
959  // remove also any UL_DCI message for the UE to be removed
960 
961  for (auto& ctrlMessageList : m_controlMessagesQueue)
962  {
963  std::list<Ptr<LteControlMessage>>::iterator ctrlMsgListIt = ctrlMessageList.begin();
964  while (ctrlMsgListIt != ctrlMessageList.end())
965  {
966  Ptr<LteControlMessage> msg = (*ctrlMsgListIt);
967  if (msg->GetMessageType() == LteControlMessage::DL_DCI)
968  {
969  auto dci = DynamicCast<DlDciLteControlMessage>(msg);
970  if (dci->GetDci().m_rnti == rnti)
971  {
972  NS_LOG_INFO("DL_DCI to be sent from cell id : " << m_cellId << " to RNTI : "
973  << rnti << " is deleted");
974  ctrlMsgListIt = ctrlMessageList.erase(ctrlMsgListIt);
975  }
976  else
977  {
978  ++ctrlMsgListIt;
979  }
980  }
981  else if (msg->GetMessageType() == LteControlMessage::UL_DCI)
982  {
983  auto dci = DynamicCast<UlDciLteControlMessage>(msg);
984  if (dci->GetDci().m_rnti == rnti)
985  {
986  NS_LOG_INFO("UL_DCI to be sent from cell id : " << m_cellId << " to RNTI : "
987  << rnti << " is deleted");
988  ctrlMsgListIt = ctrlMessageList.erase(ctrlMsgListIt);
989  }
990  else
991  {
992  ++ctrlMsgListIt;
993  }
994  }
995  else
996  {
997  ++ctrlMsgListIt;
998  }
999  }
1000  }
1001 }
1002 
1003 void
1004 LteEnbPhy::DoSetPa(uint16_t rnti, double pa)
1005 {
1006  NS_LOG_FUNCTION(this << rnti);
1007 
1008  std::map<uint16_t, double>::iterator it = m_paMap.find(rnti);
1009 
1010  if (it == m_paMap.end())
1011  {
1012  m_paMap.insert(std::pair<uint16_t, double>(rnti, pa));
1013  }
1014  else
1015  {
1016  it->second = pa;
1017  }
1018 }
1019 
1022 {
1023  NS_LOG_FUNCTION(this << sinr);
1024  Values::const_iterator it;
1026  ulcqi.m_ulCqi.m_type = UlCqi_s::SRS;
1027  int i = 0;
1028  double srsSum = 0.0;
1029  for (it = sinr.ConstValuesBegin(); it != sinr.ConstValuesEnd(); it++)
1030  {
1031  double sinrdb = 10 * log10((*it));
1032  // NS_LOG_DEBUG ("ULCQI RB " << i << " value " << sinrdb);
1033  // convert from double to fixed point notation Sxxxxxxxxxxx.xxx
1034  int16_t sinrFp = LteFfConverter::double2fpS11dot3(sinrdb);
1035  srsSum += (*it);
1036  ulcqi.m_ulCqi.m_sinr.push_back(sinrFp);
1037  i++;
1038  }
1039  // Insert the user generated the srs as a vendor specific parameter
1040  NS_LOG_DEBUG(this << " ENB RX UL-CQI of " << m_srsUeOffset.at(m_currentSrsOffset));
1042  vsp.m_type = SRS_CQI_RNTI_VSP;
1043  vsp.m_length = sizeof(SrsCqiRntiVsp);
1044  Ptr<SrsCqiRntiVsp> rnti = Create<SrsCqiRntiVsp>(m_srsUeOffset.at(m_currentSrsOffset));
1045  vsp.m_value = rnti;
1046  ulcqi.m_vendorSpecificList.push_back(vsp);
1047  // call SRS tracing method
1048  CreateSrsReport(m_srsUeOffset.at(m_currentSrsOffset), (i > 0) ? (srsSum / i) : DBL_MAX);
1049  return (ulcqi);
1050 }
1051 
1052 void
1053 LteEnbPhy::CreateSrsReport(uint16_t rnti, double srs)
1054 {
1055  NS_LOG_FUNCTION(this << rnti << srs);
1056  std::map<uint16_t, uint16_t>::iterator it = m_srsSampleCounterMap.find(rnti);
1057  if (it == m_srsSampleCounterMap.end())
1058  {
1059  // create new entry
1060  m_srsSampleCounterMap.insert(std::pair<uint16_t, uint16_t>(rnti, 0));
1061  it = m_srsSampleCounterMap.find(rnti);
1062  }
1063  (*it).second++;
1064  if ((*it).second == m_srsSamplePeriod)
1065  {
1066  m_reportUeSinr(m_cellId, rnti, srs, (uint16_t)m_componentCarrierId);
1067  (*it).second = 0;
1068  }
1069 }
1070 
1071 void
1072 LteEnbPhy::DoSetTransmissionMode(uint16_t rnti, uint8_t txMode)
1073 {
1074  NS_LOG_FUNCTION(this << rnti << (uint16_t)txMode);
1075  // UL supports only SISO MODE
1076 }
1077 
1078 void
1080 {
1081  NS_LOG_FUNCTION(this);
1082  m_ulDciQueue.at(UL_PUSCH_TTIS_DELAY - 1).push_back(m);
1083 }
1084 
1085 std::list<UlDciLteControlMessage>
1087 {
1088  NS_LOG_FUNCTION(this);
1089  if (!m_ulDciQueue.at(0).empty())
1090  {
1091  std::list<UlDciLteControlMessage> ret = m_ulDciQueue.at(0);
1092  m_ulDciQueue.erase(m_ulDciQueue.begin());
1093  std::list<UlDciLteControlMessage> l;
1094  m_ulDciQueue.push_back(l);
1095  return (ret);
1096  }
1097  else
1098  {
1099  m_ulDciQueue.erase(m_ulDciQueue.begin());
1100  std::list<UlDciLteControlMessage> l;
1101  m_ulDciQueue.push_back(l);
1102  std::list<UlDciLteControlMessage> emptylist;
1103  return (emptylist);
1104  }
1105 }
1106 
1107 void
1108 LteEnbPhy::DoSetSrsConfigurationIndex(uint16_t rnti, uint16_t srcCi)
1109 {
1110  NS_LOG_FUNCTION(this);
1111  uint16_t p = GetSrsPeriodicity(srcCi);
1112  if (p != m_srsPeriodicity)
1113  {
1114  // resize the array of offset -> re-initialize variables
1115  m_srsUeOffset.clear();
1116  m_srsUeOffset.resize(p, 0);
1117  m_srsPeriodicity = p;
1118  // inhibit SRS until RRC Connection Reconfiguration propagates
1119  // to UEs, otherwise we might be wrong in determining the UE who
1120  // actually sent the SRS (if the UE was using a stale SRS config)
1121  // if we use a static SRS configuration index, we can have a 0ms guard time
1123  }
1124 
1125  NS_LOG_DEBUG(this << " ENB SRS P " << m_srsPeriodicity << " RNTI " << rnti << " offset "
1126  << GetSrsSubframeOffset(srcCi) << " CI " << srcCi);
1127  std::map<uint16_t, uint16_t>::iterator it = m_srsCounter.find(rnti);
1128  if (it != m_srsCounter.end())
1129  {
1130  (*it).second = GetSrsSubframeOffset(srcCi) + 1;
1131  }
1132  else
1133  {
1134  m_srsCounter.insert(std::pair<uint16_t, uint16_t>(rnti, GetSrsSubframeOffset(srcCi) + 1));
1135  }
1136  m_srsUeOffset.at(GetSrsSubframeOffset(srcCi)) = rnti;
1137 }
1138 
1139 void
1141 {
1142  NS_LOG_FUNCTION(this);
1143  m_mib = mib;
1144 }
1145 
1146 void
1148 {
1149  NS_LOG_FUNCTION(this);
1150  m_sib1 = sib1;
1151 }
1152 
1153 void
1155 {
1156  m_harqPhyModule = harq;
1157 }
1158 
1159 void
1161 {
1162  NS_LOG_FUNCTION(this);
1163  // forward to scheduler
1165 }
1166 
1167 } // 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:113
EnbMemberLteEnbPhySapProvider(LteEnbPhy *phy)
Constructor.
Definition: lte-enb-phy.cc:107
virtual void SetBandwidth(uint16_t ulBandwidth, uint16_t dlBandwidth)
Set bandwidth function.
Definition: lte-enb-phy.cc:119
uint8_t GetMacChTtiDelay() override
Get the delay from MAC to Channel expressed in TTIs.
Definition: lte-enb-phy.cc:137
LteEnbPhy * m_phy
the ENB Phy
Definition: lte-enb-phy.cc:104
virtual void SetCellId(uint16_t cellId)
Set Cell ID function.
Definition: lte-enb-phy.cc:125
void SendLteControlMessage(Ptr< LteControlMessage > msg) override
Send SendLteControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel.
Definition: lte-enb-phy.cc:131
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:316
Time m_srsStartTime
SRS start time.
Definition: lte-enb-phy.h:462
int8_t DoGetReferenceSignalPower() const
Definition: lte-enb-phy.cc:323
void StartSubFrame()
Start a LTE sub frame.
Definition: lte-enb-phy.cc:601
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:295
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:875
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:289
void SetLteEnbPhySapUser(LteEnbPhySapUser *s)
Set the PHY SAP User.
Definition: lte-enb-phy.cc:283
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:401
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:337
void SetTxPower(double pow)
Definition: lte-enb-phy.cc:309
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:244
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage >> msgList)
PhySpectrum received a new list of LteControlMessage.
Definition: lte-enb-phy.cc:530
Ptr< LteSpectrumPhy > GetDlSpectrumPhy() const
Definition: lte-enb-phy.cc:371
void DoDispose() override
Destructor implementation.
Definition: lte-enb-phy.cc:249
void GenerateCtrlCqiReport(const SpectrumValue &sinr) override
generate a CQI report based on the given SINR of Ctrl frame
Definition: lte-enb-phy.cc:836
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:848
void SendDataChannels(Ptr< PacketBurst > pb)
Send the PDSCH.
Definition: lte-enb-phy.cc:803
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:432
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:829
void CalcChannelQualityForUe(std::vector< double > sinr, Ptr< LteSpectrumPhy > ue)
Calculate the channel quality for a given UE.
Definition: lte-enb-phy.cc:508
void DoSetPa(uint16_t rnti, double pa)
Set PA.
uint8_t GetMacChDelay() const
Definition: lte-enb-phy.cc:365
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:916
Ptr< SpectrumValue > CreateTxPowerSpectralDensity() override
Create the PSD for TX.
Definition: lte-enb-phy.cc:479
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:783
uint8_t DoGetMacChTtiDelay()
Get MAC ch TTI delay function.
Definition: lte-enb-phy.cc:426
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:464
void QueueUlDci(UlDciLteControlMessage m)
void SetNoiseFigure(double pow)
Definition: lte-enb-phy.cc:330
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:344
void SetHarqPhyModule(Ptr< LteHarqPhy > harq)
Set the HARQ Phy module.
void DoRemoveUe(uint16_t rnti)
Remove UE.
Definition: lte-enb-phy.cc:936
void SetDownlinkSubChannelsWithPowerAllocation(std::vector< int > mask)
set the resource blocks (a.k.a.
Definition: lte-enb-phy.cc:448
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:869
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:419
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:856
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:377
void DoAddUe(uint16_t rnti)
Add UE.
Definition: lte-enb-phy.cc:924
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:514
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensityWithPowerAllocation()
Create the PSD for TX with power allocation for each RB.
Definition: lte-enb-phy.cc:493
bool AddUePhy(uint16_t rnti)
Add the given RNTI to the list of attached UE m_ueAttached.
Definition: lte-enb-phy.cc:383
void DoInitialize() override
Initialize() implementation.
Definition: lte-enb-phy.cc:260
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:893
void EndSubFrame()
End a LTE sub frame.
Definition: lte-enb-phy.cc:815
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:439
virtual void ReceiveLteControlMessage(Ptr< LteControlMessage > msg)
Receive the control message.
Definition: lte-enb-phy.cc:522
void StartFrame()
Start a LTE frame.
Definition: lte-enb-phy.cc:583
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:302
TracedCallback< PhyTransmissionStatParameters > m_dlPhyTransmission
The DlPhyTransmission trace source.
Definition: lte-enb-phy.h:514
std::vector< int > GetDownlinkSubChannels()
Definition: lte-enb-phy.cc:457
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:171
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 UlInfoListElementHarqFeeback(UlInfoListElement_s params)=0
Notify the HARQ on the UL transmission status.
virtual void UlCqiReport(FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi)=0
Returns to MAC level the UL-CQI evaluated.
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:50
void DoSetCellId(uint16_t cellId)
Definition: lte-phy.cc:239
double m_txPower
Transmission power in dBm.
Definition: lte-phy.h:240
uint8_t GetRbgSize() const
Definition: lte-phy.cc:179
void DoDispose() override
Destructor implementation.
Definition: lte-phy.cc:75
uint16_t GetSrsPeriodicity(uint16_t srcCi) const
Definition: lte-phy.cc:143
std::vector< Ptr< PacketBurst > > m_packetBurstQueue
A queue of packet bursts to be sent.
Definition: lte-phy.h:280
uint16_t m_ulBandwidth
The UL bandwidth in number of PRBs.
Definition: lte-phy.h:260
Ptr< PacketBurst > GetPacketBurst()
Definition: lte-phy.cc:191
uint8_t m_componentCarrierId
component carrier Id used to address sap
Definition: lte-phy.h:302
double m_noiseFigure
Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver.
Definition: lte-phy.h:252
uint32_t m_ulEarfcn
The uplink carrier frequency.
Definition: lte-phy.h:277
uint16_t m_dlBandwidth
The DL bandwidth in number of PRBs.
Definition: lte-phy.h:265
Ptr< LteSpectrumPhy > m_downlinkSpectrumPhy
The downlink LteSpectrumPhy associated to this LtePhy.
Definition: lte-phy.h:229
void SetMacPdu(Ptr< Packet > p)
Definition: lte-phy.cc:185
std::list< Ptr< LteControlMessage > > GetControlMessages()
Definition: lte-phy.cc:217
uint16_t GetSrsSubframeOffset(uint16_t srcCi) const
Definition: lte-phy.cc:161
Ptr< LteNetDevice > m_netDevice
Pointer to the NetDevice where this PHY layer is attached.
Definition: lte-phy.h:223
uint16_t m_cellId
Cell identifier.
Definition: lte-phy.h:299
void SetControlMessages(Ptr< LteControlMessage > m)
Definition: lte-phy.cc:209
uint32_t m_dlEarfcn
The downlink carrier frequency.
Definition: lte-phy.h:272
Ptr< LteSpectrumPhy > m_uplinkSpectrumPhy
The uplink LteSpectrumPhy associated to this LtePhy.
Definition: lte-phy.h:234
double GetTti() const
Definition: lte-phy.cc:136
std::vector< std::list< Ptr< LteControlMessage > > > m_controlMessagesQueue
A queue of control messages to be sent.
Definition: lte-phy.h:282
uint8_t m_rbgSize
The RB group size according to the bandwidth.
Definition: lte-phy.h:267
uint8_t m_macChTtiDelay
Delay between MAC and channel layer in terms of TTIs.
Definition: lte-phy.h:292
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:360
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:568
static void ScheduleWithContext(uint32_t context, const Time &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
Definition: simulator.h:587
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:199
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition: simulator.h:606
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:407
@ S
second
Definition: nstime.h:116
a unique identifier for an interface.
Definition: type-id.h:60
@ ATTR_GET
The attribute can be read.
Definition: type-id.h:65
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:935
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
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: double.h:43
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: pointer.h:231
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: uinteger.h:46
#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:1372
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1336
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1348
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:68
static const Time DL_DATA_DURATION
Duration of the data portion of a DL subframe.
Definition: lte-enb-phy.cc:61
static const int Type0AllocationRbg[4]
Type 0 RGB allocation.
phy
Definition: third.py:82
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< struct 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:182
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