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