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