A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
lte-ue-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 <marco.miozzo@cttc.es>
20  * Nicola Baldo <nbaldo@cttc.es>
21  */
22 
23 #include <ns3/object-factory.h>
24 #include <ns3/log.h>
25 #include <cfloat>
26 #include <cmath>
27 #include <ns3/simulator.h>
28 #include <ns3/double.h>
29 #include "lte-ue-phy.h"
30 #include "lte-enb-phy.h"
31 #include "lte-net-device.h"
32 #include "lte-ue-net-device.h"
33 #include "lte-enb-net-device.h"
35 #include "lte-amc.h"
36 #include "lte-ue-mac.h"
37 #include "ff-mac-common.h"
39 #include <ns3/lte-common.h>
40 #include <ns3/pointer.h>
41 
42 NS_LOG_COMPONENT_DEFINE ("LteUePhy");
43 
44 namespace ns3 {
45 
46 
47 
48 
49 // duration of data portion of UL subframe
50 // = TTI - 1 symbol for SRS - 1ns as margin to avoid overlapping simulator events
51 // (symbol duration in nanoseconds = TTI / 14 (rounded))
52 // in other words, duration of data portion of UL subframe = TTI*(13/14) -1ns
53 static const Time UL_DATA_DURATION = NanoSeconds (1e6 - 71429 - 1);
54 
55 // delay from subframe start to transmission of SRS
56 // = TTI - 1 symbol for SRS
57 static const Time UL_SRS_DELAY_FROM_SUBFRAME_START = NanoSeconds (1e6 - 71429);
58 
59 
60 
61 
63 // member SAP forwarders
65 
66 
68 {
69 public:
71 
72  // inherited from LtePhySapProvider
73  virtual void SendMacPdu (Ptr<Packet> p);
75  virtual void SendRachPreamble (uint32_t prachId, uint32_t raRnti);
76 
77 private:
79 };
80 
82 {
83 
84 }
85 
86 void
88 {
89  m_phy->DoSendMacPdu (p);
90 }
91 
92 void
94 {
96 }
97 
98 void
99 UeMemberLteUePhySapProvider::SendRachPreamble (uint32_t prachId, uint32_t raRnti)
100 {
101  m_phy->DoSendRachPreamble (prachId, raRnti);
102 }
103 
104 
106 // LteUePhy methods
108 
110 {
111  "CELL_SEARCH",
112  "SYNCHRONIZED"
113 };
114 
116 {
117  return std::string (g_uePhyStateName[s]);
118 }
119 
120 
122  ;
123 
124 
126 {
127  NS_LOG_FUNCTION (this);
128  NS_FATAL_ERROR ("This constructor should not be called");
129 }
130 
132  : LtePhy (dlPhy, ulPhy),
133  m_p10CqiPeriocity (MilliSeconds (1)), // ideal behavior
134  m_a30CqiPeriocity (MilliSeconds (1)), // ideal behavior
135  m_uePhySapUser (0),
136  m_ueCphySapUser (0),
137  m_state (CELL_SEARCH),
138  m_subframeNo (0),
139  m_rsReceivedPowerUpdated (false),
140  m_rsInterferencePowerUpdated (false),
141  m_pssReceived (false),
142  m_ueMeasurementsFilterPeriod (MilliSeconds (200)),
143  m_ueMeasurementsFilterLast (MilliSeconds (0)),
144  m_rsrpSinrSampleCounter (0)
145 {
146  m_amc = CreateObject <LteAmc> ();
150 
151  NS_ASSERT_MSG (Simulator::Now ().GetNanoSeconds () == 0,
152  "Cannot create UE devices after simulation started");
155 
156  DoReset ();
157 }
158 
159 
161 {
162  m_txModeGain.clear ();
163 }
164 
165 void
167 {
168  NS_LOG_FUNCTION (this);
169  delete m_uePhySapProvider;
170  delete m_ueCphySapProvider;
172 }
173 
174 
175 
176 TypeId
178 {
179  static TypeId tid = TypeId ("ns3::LteUePhy")
180  .SetParent<LtePhy> ()
181  .AddConstructor<LteUePhy> ()
182  .AddAttribute ("TxPower",
183  "Transmission power in dBm",
184  DoubleValue (10.0),
185  MakeDoubleAccessor (&LteUePhy::SetTxPower,
187  MakeDoubleChecker<double> ())
188  .AddAttribute ("NoiseFigure",
189  "Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver."
190  " According to Wikipedia (http://en.wikipedia.org/wiki/Noise_figure), this is "
191  "\"the difference in decibels (dB) between"
192  " the noise output of the actual receiver to the noise output of an "
193  " ideal receiver with the same overall gain and bandwidth when the receivers "
194  " are connected to sources at the standard noise temperature T0.\" "
195  "In this model, we consider T0 = 290K.",
196  DoubleValue (9.0),
197  MakeDoubleAccessor (&LteUePhy::SetNoiseFigure,
199  MakeDoubleChecker<double> ())
200  .AddAttribute ("TxMode1Gain",
201  "Transmission mode 1 gain in dB",
202  DoubleValue (0.0),
203  MakeDoubleAccessor (&LteUePhy::SetTxMode1Gain),
204  MakeDoubleChecker<double> ())
205  .AddAttribute ("TxMode2Gain",
206  "Transmission mode 2 gain in dB",
207  DoubleValue (4.2),
208  MakeDoubleAccessor (&LteUePhy::SetTxMode2Gain),
209  MakeDoubleChecker<double> ())
210  .AddAttribute ("TxMode3Gain",
211  "Transmission mode 3 gain in dB",
212  DoubleValue (-2.8),
213  MakeDoubleAccessor (&LteUePhy::SetTxMode3Gain),
214  MakeDoubleChecker<double> ())
215  .AddAttribute ("TxMode4Gain",
216  "Transmission mode 4 gain in dB",
217  DoubleValue (0.0),
218  MakeDoubleAccessor (&LteUePhy::SetTxMode4Gain),
219  MakeDoubleChecker<double> ())
220  .AddAttribute ("TxMode5Gain",
221  "Transmission mode 5 gain in dB",
222  DoubleValue (0.0),
223  MakeDoubleAccessor (&LteUePhy::SetTxMode5Gain),
224  MakeDoubleChecker<double> ())
225  .AddAttribute ("TxMode6Gain",
226  "Transmission mode 6 gain in dB",
227  DoubleValue (0.0),
228  MakeDoubleAccessor (&LteUePhy::SetTxMode6Gain),
229  MakeDoubleChecker<double> ())
230  .AddAttribute ("TxMode7Gain",
231  "Transmission mode 7 gain in dB",
232  DoubleValue (0.0),
233  MakeDoubleAccessor (&LteUePhy::SetTxMode7Gain),
234  MakeDoubleChecker<double> ())
235  .AddTraceSource ("ReportCurrentCellRsrpSinr",
236  "RSRP and SINR statistics.",
238  .AddAttribute ("RsrpSinrSamplePeriod",
239  "The sampling period for reporting RSRP-SINR stats (default value 1)",
240  UintegerValue (1),
241  MakeUintegerAccessor (&LteUePhy::m_rsrpSinrSamplePeriod),
242  MakeUintegerChecker<uint16_t> ())
243  .AddTraceSource ("UlPhyTransmission",
244  "DL transmission PHY layer statistics.",
246  .AddAttribute ("DlSpectrumPhy",
247  "The downlink LteSpectrumPhy associated to this LtePhy",
249  PointerValue (),
250  MakePointerAccessor (&LteUePhy::GetDlSpectrumPhy),
251  MakePointerChecker <LteSpectrumPhy> ())
252  .AddAttribute ("UlSpectrumPhy",
253  "The uplink LteSpectrumPhy associated to this LtePhy",
255  PointerValue (),
256  MakePointerAccessor (&LteUePhy::GetUlSpectrumPhy),
257  MakePointerChecker <LteSpectrumPhy> ())
258  .AddAttribute ("RsrqUeMeasThreshold",
259  "Receive threshold for PSS on RSRQ [dB]",
260  DoubleValue (-1000.0),
261  MakeDoubleAccessor (&LteUePhy::m_pssReceptionThreshold),
262  MakeDoubleChecker<double> ())
263  .AddAttribute ("UeMeasurementsFilterPeriod",
264  "Time period for reporting UE measurements (default 200 ms.) ",
265  TimeValue (MilliSeconds (200)),
266  MakeTimeAccessor (&LteUePhy::m_ueMeasurementsFilterPeriod),
267  MakeTimeChecker ())
268  .AddTraceSource ("ReportUeMeasurements",
269  "Report UE measurements RSRP (dBm) and RSRQ (dB).",
271  .AddTraceSource ("StateTransition",
272  "Trace fired upon every UE PHY state transition",
274  ;
275  return tid;
276 }
277 
278 void
280 {
281  NS_LOG_FUNCTION (this);
283 }
284 
285 void
287 {
288  NS_LOG_FUNCTION (this);
289  m_uePhySapUser = s;
290 }
291 
294 {
295  NS_LOG_FUNCTION (this);
296  return (m_uePhySapProvider);
297 }
298 
299 
300 void
302 {
303  NS_LOG_FUNCTION (this);
304  m_ueCphySapUser = s;
305 }
306 
309 {
310  NS_LOG_FUNCTION (this);
311  return (m_ueCphySapProvider);
312 }
313 
314 void
316 {
317  NS_LOG_FUNCTION (this << nf);
318  m_noiseFigure = nf;
319 }
320 
321 double
323 {
324  NS_LOG_FUNCTION (this);
325  return m_noiseFigure;
326 }
327 
328 void
330 {
331  NS_LOG_FUNCTION (this << pow);
332  m_txPower = pow;
333 }
334 
335 double
337 {
338  NS_LOG_FUNCTION (this);
339  return m_txPower;
340 }
341 
342 
343 uint8_t
345 {
346  return (m_macChTtiDelay);
347 }
348 
351 {
352  return m_downlinkSpectrumPhy;
353 }
354 
357 {
358  return m_uplinkSpectrumPhy;
359 }
360 
361 void
363 {
364  NS_LOG_FUNCTION (this);
365 
366  SetMacPdu (p);
367 }
368 
369 
370 void
372 {
374 }
375 
376 void
378 {
379  NS_LOG_FUNCTION (this);
380 
382 
384  m_uplinkSpectrumPhy->SetTxPowerSpectralDensity (txPsd);
385 }
386 
387 
388 void
389 LteUePhy::SetSubChannelsForReception (std::vector <int> mask)
390 {
391  NS_LOG_FUNCTION (this);
393 }
394 
395 
396 std::vector <int>
398 {
399  NS_LOG_FUNCTION (this);
401 }
402 
403 
404 std::vector <int>
406 {
407  NS_LOG_FUNCTION (this);
409 }
410 
411 
414 {
415  NS_LOG_FUNCTION (this);
416  LteSpectrumValueHelper psdHelper;
418 
419  return psd;
420 }
421 
422 void
424 {
425  NS_LOG_FUNCTION (this);
426 
428  NS_ASSERT (m_cellId > 0);
429 
430  if (m_dlConfigured && m_ulConfigured && (m_rnti > 0))
431  {
432  // check periodic wideband CQI
434  {
435  Ptr<LteUeNetDevice> thisDevice = GetDevice ()->GetObject<LteUeNetDevice> ();
437  if (msg)
438  {
440  }
442  }
443  // check aperiodic high-layer configured subband CQI
445  {
446  Ptr<LteUeNetDevice> thisDevice = GetDevice ()->GetObject<LteUeNetDevice> ();
448  if (msg)
449  {
451  }
453  }
454  }
455 
456  // Generate PHY trace
459  {
460  NS_ASSERT_MSG (m_rsReceivedPowerUpdated, " RS received power info obsolete");
461  // RSRP evaluated as averaged received power among RBs
462  double sum = 0.0;
463  uint8_t rbNum = 0;
464  Values::const_iterator it;
466  {
467  // convert PSD [W/Hz] to linear power [W] for the single RE
468  // we consider only one RE for the RS since the channel is
469  // flat within the same RB
470  double powerTxW = ((*it) * 180000.0) / 12.0;
471  sum += powerTxW;
472  rbNum++;
473  }
474  double rsrp = (rbNum > 0) ? (sum / rbNum) : DBL_MAX;
475  // averaged SINR among RBs
476  sum = 0.0;
477  rbNum = 0;
478  for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++)
479  {
480  sum += (*it);
481  rbNum++;
482  }
483  double avSinr = (rbNum > 0) ? (sum / rbNum) : DBL_MAX;
484  NS_LOG_INFO (this << " cellId " << m_cellId << " rnti " << m_rnti << " RSRP " << rsrp << " SINR " << avSinr);
485 
488  }
489 
490  if (m_pssReceived)
491  {
492  // measure instantaneous RSRQ now
493  NS_ASSERT_MSG (m_rsInterferencePowerUpdated, " RS interference power info obsolete");
494 
495  std::list <PssElement>::iterator itPss = m_pssList.begin ();
496  while (itPss != m_pssList.end ())
497  {
498  uint16_t rbNum = 0;
499  double rsrqSum = 0.0;
500 
501  Values::const_iterator itIntN = m_rsInterferencePower.ConstValuesBegin ();
502  Values::const_iterator itPj = m_rsReceivedPower.ConstValuesBegin ();
503  for (itPj = m_rsReceivedPower.ConstValuesBegin ();
505  itIntN++, itPj++)
506  {
507  rbNum++;
508  // convert PSD [W/Hz] to linear power [W] for the single RE
509  double noisePowerTxW = ((*itIntN) * 180000.0) / 12.0;
510  double intPowerTxW = ((*itPj) * 180000.0) / 12.0;
511  rsrqSum += (2 * (noisePowerTxW + intPowerTxW));
512  }
513 
514  NS_ASSERT (rbNum == (*itPss).nRB);
515  double rsrq_dB = 10 * log10 ((*itPss).pssPsdSum / rsrqSum);
516 
517  if (rsrq_dB > m_pssReceptionThreshold)
518  {
519  NS_LOG_INFO (this << " PSS RNTI " << m_rnti << " cellId " << m_cellId
520  << " has RSRQ " << rsrq_dB << " and RBnum " << rbNum);
521  // store measurements
522  std::map <uint16_t, UeMeasurementsElement>::iterator itMeasMap;
523  itMeasMap = m_ueMeasurementsMap.find ((*itPss).cellId);
524  NS_ASSERT (itMeasMap != m_ueMeasurementsMap.end ());
525  (*itMeasMap).second.rsrqSum += rsrq_dB;
526  (*itMeasMap).second.rsrqNum++;
527  }
528 
529  itPss++;
530 
531  } // end of while (itPss != m_pssList.end ())
532 
533  m_pssList.clear ();
534 
535  } // end of if (m_pssReceived)
536 
537 } // end of void LteUePhy::GenerateCtrlCqiReport (const SpectrumValue& sinr)
538 
539 void
541 {
542  // Not used by UE, CQI are based only on RS
543 }
544 
545 void
547 {
548  NS_LOG_FUNCTION (this << interf);
550  m_rsInterferencePower = interf;
551 }
552 
553 void
555 {
556  NS_LOG_FUNCTION (this << power);
558  m_rsReceivedPower = power;
559 }
560 
561 
562 
565 {
566  NS_LOG_FUNCTION (this);
567 
568 
569  // apply transmission mode gain
571  SpectrumValue newSinr = sinr;
572  newSinr *= m_txModeGain.at (m_transmissionMode);
573 
574  // CREATE DlCqiLteControlMessage
575  Ptr<DlCqiLteControlMessage> msg = Create<DlCqiLteControlMessage> ();
576  CqiListElement_s dlcqi;
577  std::vector<int> cqi;
579  {
580  cqi = m_amc->CreateCqiFeedbacks (newSinr, m_dlBandwidth);
581 
583  int nbSubChannels = cqi.size ();
584  double cqiSum = 0.0;
585  int activeSubChannels = 0;
586  // average the CQIs of the different RBs
587  for (int i = 0; i < nbSubChannels; i++)
588  {
589  if (cqi.at (i) != -1)
590  {
591  cqiSum += cqi.at (i);
592  activeSubChannels++;
593  }
594  NS_LOG_DEBUG (this << " subch " << i << " cqi " << cqi.at (i));
595  }
596  dlcqi.m_rnti = m_rnti;
597  dlcqi.m_ri = 1; // not yet used
598  dlcqi.m_cqiType = CqiListElement_s::P10; // Peridic CQI using PUCCH wideband
599  NS_ASSERT_MSG (nLayer > 0, " nLayer negative");
600  NS_ASSERT_MSG (nLayer < 3, " nLayer limit is 2s");
601  for (int i = 0; i < nLayer; i++)
602  {
603  if (activeSubChannels > 0)
604  {
605  dlcqi.m_wbCqi.push_back ((uint16_t) cqiSum / activeSubChannels);
606  }
607  else
608  {
609  // approximate with the worst case -> CQI = 1
610  dlcqi.m_wbCqi.push_back (1);
611  }
612  }
613  //NS_LOG_DEBUG (this << " Generate P10 CQI feedback " << (uint16_t) cqiSum / activeSubChannels);
614  dlcqi.m_wbPmi = 0; // not yet used
615  // dl.cqi.m_sbMeasResult others CQI report modes: not yet implemented
616  }
618  {
619  cqi = m_amc->CreateCqiFeedbacks (newSinr, GetRbgSize ());
621  int nbSubChannels = cqi.size ();
622  int rbgSize = GetRbgSize ();
623  double cqiSum = 0.0;
624  int cqiNum = 0;
625  SbMeasResult_s rbgMeas;
626  //NS_LOG_DEBUG (this << " Create A30 CQI feedback, RBG " << rbgSize << " cqiNum " << nbSubChannels << " band " << (uint16_t)m_dlBandwidth);
627  for (int i = 0; i < nbSubChannels; i++)
628  {
629  if (cqi.at (i) != -1)
630  {
631  cqiSum += cqi.at (i);
632  }
633  // else "nothing" no CQI is treated as CQI = 0 (worst case scenario)
634  cqiNum++;
635  if (cqiNum == rbgSize)
636  {
637  // average the CQIs of the different RBGs
638  //NS_LOG_DEBUG (this << " RBG CQI " << (uint16_t) cqiSum / rbgSize);
639  HigherLayerSelected_s hlCqi;
640  hlCqi.m_sbPmi = 0; // not yet used
641  for (int i = 0; i < nLayer; i++)
642  {
643  hlCqi.m_sbCqi.push_back ((uint16_t) cqiSum / rbgSize);
644  }
645  rbgMeas.m_higherLayerSelected.push_back (hlCqi);
646  cqiSum = 0.0;
647  cqiNum = 0;
648  }
649  }
650  dlcqi.m_rnti = m_rnti;
651  dlcqi.m_ri = 1; // not yet used
652  dlcqi.m_cqiType = CqiListElement_s::A30; // Aperidic CQI using PUSCH
653  //dlcqi.m_wbCqi.push_back ((uint16_t) cqiSum / nbSubChannels);
654  dlcqi.m_wbPmi = 0; // not yet used
655  dlcqi.m_sbMeasResult = rbgMeas;
656  }
657 
658  msg->SetDlCqi (dlcqi);
659  return msg;
660 }
661 
662 
663 void
665 {
666  NS_LOG_FUNCTION (this << Simulator::Now ());
667  NS_LOG_DEBUG (this << " Report UE Measurements ");
668 
670 
671  std::map <uint16_t, UeMeasurementsElement>::iterator it;
672  for (it = m_ueMeasurementsMap.begin (); it != m_ueMeasurementsMap.end (); it++)
673  {
674  double avg_rsrp = (*it).second.rsrpSum / (double)(*it).second.rsrpNum;
675  double avg_rsrq = (*it).second.rsrqSum / (double)(*it).second.rsrqNum;
676  /*
677  * In CELL_SEARCH state, this may result in avg_rsrq = 0/0 = -nan.
678  * UE RRC must take this into account when receiving measurement reports.
679  * TODO remove this shortcoming by calculating RSRQ during CELL_SEARCH
680  */
681  NS_LOG_DEBUG (this << " CellId " << (*it).first
682  << " RSRP " << avg_rsrp
683  << " (nSamples " << (uint16_t)(*it).second.rsrpNum << ")"
684  << " RSRQ " << avg_rsrq
685  << " (nSamples " << (uint16_t)(*it).second.rsrqNum << ")");
686 
688  newEl.m_cellId = (*it).first;
689  newEl.m_rsrp = avg_rsrp;
690  newEl.m_rsrq = avg_rsrq;
691  ret.m_ueMeasurementsList.push_back (newEl);
692 
693  // report to UE measurements trace
694  m_reportUeMeasurements (m_rnti, (*it).first, avg_rsrp, avg_rsrq, ((*it).first == m_cellId ? 1 : 0));
695  }
696 
697  // report to RRC
699 
700  m_ueMeasurementsMap.clear ();
702 }
703 
704 void
706 {
707  NS_LOG_FUNCTION (this << msg);
708 
709  SetControlMessages (msg);
710 }
711 
712 void
713 LteUePhy::DoSendRachPreamble (uint32_t raPreambleId, uint32_t raRnti)
714 {
715  NS_LOG_FUNCTION (this << raPreambleId);
716 
717  // unlike other control messages, RACH preamble is sent ASAP
718  Ptr<RachPreambleLteControlMessage> msg = Create<RachPreambleLteControlMessage> ();
719  msg->SetRapId (raPreambleId);
720  m_raPreambleId = raPreambleId;
721  m_raRnti = raRnti;
722  m_controlMessagesQueue.at (0).push_back (msg);
723 }
724 
725 
726 void
728 {
729  NS_LOG_FUNCTION (this);
730 
731  std::list<Ptr<LteControlMessage> >::iterator it;
732  for (it = msgList.begin (); it != msgList.end(); it++)
733  {
734  Ptr<LteControlMessage> msg = (*it);
735 
736  if (msg->GetMessageType () == LteControlMessage::DL_DCI)
737  {
738  Ptr<DlDciLteControlMessage> msg2 = DynamicCast<DlDciLteControlMessage> (msg);
739 
740  DlDciListElement_s dci = msg2->GetDci ();
741  if (dci.m_rnti != m_rnti)
742  {
743  // DCI not for me
744  continue;
745  }
746 
747  if (dci.m_resAlloc != 0)
748  {
749  NS_FATAL_ERROR ("Resource Allocation type not implemented");
750  }
751 
752  std::vector <int> dlRb;
753 
754  // translate the DCI to Spectrum framework
755  uint32_t mask = 0x1;
756  for (int i = 0; i < 32; i++)
757  {
758  if (((dci.m_rbBitmap & mask) >> i) == 1)
759  {
760  for (int k = 0; k < GetRbgSize (); k++)
761  {
762  dlRb.push_back ((i * GetRbgSize ()) + k);
763 // NS_LOG_DEBUG(this << " RNTI " << m_rnti << " RBG " << i << " DL-DCI allocated PRB " << (i*GetRbgSize()) + k);
764  }
765  }
766  mask = (mask << 1);
767  }
768 
769  // send TB info to LteSpectrumPhy
770  NS_LOG_DEBUG (this << " UE " << m_rnti << " DL-DCI " << dci.m_rnti << " bitmap " << dci.m_rbBitmap);
771  for (uint8_t i = 0; i < dci.m_tbsSize.size (); i++)
772  {
773  m_downlinkSpectrumPhy->AddExpectedTb (dci.m_rnti, dci.m_ndi.at (i), dci.m_tbsSize.at (i), dci.m_mcs.at (i), dlRb, i, dci.m_harqProcess, dci.m_rv.at (i), true /* DL */);
774  }
775 
777 
778 
779  }
780  else if (msg->GetMessageType () == LteControlMessage::UL_DCI)
781  {
782  // set the uplink bandwidth according to the UL-CQI
783  Ptr<UlDciLteControlMessage> msg2 = DynamicCast<UlDciLteControlMessage> (msg);
784  UlDciListElement_s dci = msg2->GetDci ();
785  if (dci.m_rnti != m_rnti)
786  {
787  // DCI not for me
788  continue;
789  }
790  NS_LOG_INFO (this << " UL DCI");
791  std::vector <int> ulRb;
792  for (int i = 0; i < dci.m_rbLen; i++)
793  {
794  ulRb.push_back (i + dci.m_rbStart);
795  //NS_LOG_DEBUG (this << " UE RB " << i + dci.m_rbStart);
796  }
798  // fire trace of UL Tx PHY stats
799  HarqProcessInfoList_t harqInfoList = m_harqPhyModule->GetHarqProcessInfoUl (m_rnti, 0);
801  params.m_cellId = m_cellId;
802  params.m_imsi = 0; // it will be set by DlPhyTransmissionCallback in LteHelper
804  params.m_rnti = m_rnti;
805  params.m_txMode = 0; // always SISO for UE
806  params.m_layer = 0;
807  params.m_mcs = dci.m_mcs;
808  params.m_size = dci.m_tbSize;
809  params.m_rv = harqInfoList.size ();
810  params.m_ndi = dci.m_ndi;
811  m_ulPhyTransmission (params);
812  // pass the info to the MAC
814  }
815  else if (msg->GetMessageType () == LteControlMessage::RAR)
816  {
817  Ptr<RarLteControlMessage> rarMsg = DynamicCast<RarLteControlMessage> (msg);
818  if (rarMsg->GetRaRnti () == m_raRnti)
819  {
820  for (std::list<RarLteControlMessage::Rar>::const_iterator it = rarMsg->RarListBegin (); it != rarMsg->RarListEnd (); ++it)
821  {
822  if (it->rapId != m_raPreambleId)
823  {
824  // UL grant not for me
825  continue;
826  }
827  else
828  {
829  NS_LOG_INFO ("received RAR RNTI " << m_raRnti);
830  // set the uplink bandwidht according to the UL grant
831  std::vector <int> ulRb;
832  for (int i = 0; i < it->rarPayload.m_grant.m_rbLen; i++)
833  {
834  ulRb.push_back (i + it->rarPayload.m_grant.m_rbStart);
835  }
836 
838  // pass the info to the MAC
840  // reset RACH variables with out of range values
841  m_raPreambleId = 255;
842  m_raRnti = 11;
843  }
844  }
845  }
846  }
847  else if (msg->GetMessageType () == LteControlMessage::MIB)
848  {
849  NS_LOG_INFO ("received MIB");
850  NS_ASSERT (m_cellId > 0);
851  Ptr<MibLteControlMessage> msg2 = DynamicCast<MibLteControlMessage> (msg);
853  }
854  else if (msg->GetMessageType () == LteControlMessage::SIB1)
855  {
856  NS_LOG_INFO ("received SIB1");
857  NS_ASSERT (m_cellId > 0);
858  Ptr<Sib1LteControlMessage> msg2 = DynamicCast<Sib1LteControlMessage> (msg);
860  }
861  else
862  {
863  // pass the message to UE-MAC
865  }
866 
867  }
868 
869 
870 }
871 
872 
873 void
875 {
876  NS_LOG_FUNCTION (this << cellId << (*p));
877 
878  double sum = 0.0;
879  uint16_t nRB = 0;
880  Values::const_iterator itPi;
881  for (itPi = p->ConstValuesBegin (); itPi != p->ConstValuesEnd (); itPi++)
882  {
883  // convert PSD [W/Hz] to linear power [W] for the single RE
884  double powerTxW = ((*itPi) * 180000.0) / 12.0;
885  sum += powerTxW;
886  nRB++;
887  }
888 
889  // measure instantaneous RSRP now
890  double rsrp_dBm = 10 * log10 (1000 * (sum / (double)nRB));
891  NS_LOG_INFO (this << " PSS RNTI " << m_rnti << " cellId " << m_cellId
892  << " has RSRP " << rsrp_dBm << " and RBnum " << nRB);
893  // note that m_pssReceptionThreshold does not apply here
894 
895  // store measurements
896  std::map <uint16_t, UeMeasurementsElement>::iterator itMeasMap = m_ueMeasurementsMap.find (cellId);
897  if (itMeasMap == m_ueMeasurementsMap.end ())
898  {
899  // insert new entry
900  UeMeasurementsElement newEl;
901  newEl.rsrpSum = rsrp_dBm;
902  newEl.rsrpNum = 1;
903  newEl.rsrqSum = 0;
904  newEl.rsrqNum = 0;
905  m_ueMeasurementsMap.insert (std::pair <uint16_t, UeMeasurementsElement> (cellId, newEl));
906  }
907  else
908  {
909  (*itMeasMap).second.rsrpSum += rsrp_dBm;
910  (*itMeasMap).second.rsrpNum++;
911  }
912 
913  /*
914  * Collect the PSS for later processing in GenerateCtrlCqiReport()
915  * (to be called from ChunkProcessor after RX is finished).
916  */
917  m_pssReceived = true;
918  PssElement el;
919  el.cellId = cellId;
920  el.pssPsdSum = sum;
921  el.nRB = nRB;
922  m_pssList.push_back (el);
923 
924 } // end of void LteUePhy::ReceivePss (uint16_t cellId, Ptr<SpectrumValue> p)
925 
926 
927 void
929 {
931 }
932 
933 
934 void
935 LteUePhy::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
936 {
937  NS_LOG_FUNCTION (this << frameNo << subframeNo);
938 
939  NS_ASSERT_MSG (frameNo > 0, "the SRS index check code assumes that frameNo starts at 1");
940 
941  // refresh internal variables
942  m_rsReceivedPowerUpdated = false;
944  m_pssReceived = false;
945 
946  if (m_ulConfigured)
947  {
948  // update uplink transmission mask according to previous UL-CQIs
950 
951  // shift the queue
952  for (uint8_t i = 1; i < m_macChTtiDelay; i++)
953  {
955  }
956  m_subChannelsForTransmissionQueue.at (m_macChTtiDelay-1).clear ();
957 
959  {
960 
961  NS_ASSERT_MSG (subframeNo > 0 && subframeNo <= 10, "the SRS index check code assumes that subframeNo starts at 1");
962  if ((((frameNo-1)*10 + (subframeNo-1)) % m_srsPeriodicity) == m_srsSubframeOffset)
963  {
964  NS_LOG_INFO ("frame " << frameNo << " subframe " << subframeNo << " sending SRS (offset=" << m_srsSubframeOffset << ", period=" << m_srsPeriodicity << ")");
967  this);
968  }
969  }
970 
971  std::list<Ptr<LteControlMessage> > ctrlMsg = GetControlMessages ();
972  // send packets in queue
973  NS_LOG_LOGIC (this << " UE - start slot for PUSCH + PUCCH - RNTI " << m_rnti << " CELLID " << m_cellId);
974  // send the current burts of packets
976  if (pb)
977  {
978  m_uplinkSpectrumPhy->StartTxDataFrame (pb, ctrlMsg, UL_DATA_DURATION);
979  }
980  else
981  {
982  // send only PUCCH (ideal: fake null bandwidth signal)
983  if (ctrlMsg.size ()>0)
984  {
985  NS_LOG_LOGIC (this << " UE - start TX PUCCH (NO PUSCH)");
986  std::vector <int> dlRb;
988  m_uplinkSpectrumPhy->StartTxDataFrame (pb, ctrlMsg, UL_DATA_DURATION);
989  }
990  else
991  {
992  NS_LOG_LOGIC (this << " UE - UL NOTHING TO SEND");
993  }
994  }
995  } // m_configured
996 
997  // trigger the MAC
998  m_uePhySapUser->SubframeIndication (frameNo, subframeNo);
999 
1000  m_subframeNo = subframeNo;
1001  ++subframeNo;
1002  if (subframeNo > 10)
1003  {
1004  ++frameNo;
1005  subframeNo = 1;
1006  }
1007 
1008  // schedule next subframe indication
1009  Simulator::Schedule (Seconds (GetTti ()), &LteUePhy::SubframeIndication, this, frameNo, subframeNo);
1010 }
1011 
1012 
1013 void
1015 {
1016  NS_LOG_FUNCTION (this << " UE " << m_rnti << " start tx SRS, cell Id " << (uint32_t) m_cellId);
1017  NS_ASSERT (m_cellId > 0);
1018  // set the current tx power spectral density (full bandwidth)
1019  std::vector <int> dlRb;
1020  for (uint8_t i = 0; i < m_ulBandwidth; i++)
1021  {
1022  dlRb.push_back (i);
1023  }
1025  m_uplinkSpectrumPhy->StartTxUlSrsFrame ();
1026 }
1027 
1028 
1029 void
1031 {
1032  NS_LOG_FUNCTION (this);
1033 
1034  m_rnti = 0;
1035  m_transmissionMode = 0;
1036  m_srsPeriodicity = 0;
1037  m_srsConfigured = false;
1038  m_dlConfigured = false;
1039  m_ulConfigured = false;
1040  m_raPreambleId = 255; // value out of range
1041  m_raRnti = 11; // value out of range
1045 
1046  m_packetBurstQueue.clear ();
1047  m_controlMessagesQueue.clear ();
1049  for (int i = 0; i < m_macChTtiDelay; i++)
1050  {
1051  Ptr<PacketBurst> pb = CreateObject <PacketBurst> ();
1052  m_packetBurstQueue.push_back (pb);
1053  std::list<Ptr<LteControlMessage> > l;
1054  m_controlMessagesQueue.push_back (l);
1055  }
1056  std::vector <int> ulRb;
1057  m_subChannelsForTransmissionQueue.resize (m_macChTtiDelay, ulRb);
1058 
1060  m_downlinkSpectrumPhy->Reset ();
1061  m_uplinkSpectrumPhy->Reset ();
1062 
1063 } // end of void LteUePhy::DoReset ()
1064 
1065 void
1066 LteUePhy::DoStartCellSearch (uint16_t dlEarfcn)
1067 {
1068  NS_LOG_FUNCTION (this << dlEarfcn);
1069  m_dlEarfcn = dlEarfcn;
1070  DoSetDlBandwidth (6); // configure DL for receiving PSS
1072 }
1073 
1074 void
1075 LteUePhy::DoSynchronizeWithEnb (uint16_t cellId, uint16_t dlEarfcn)
1076 {
1077  NS_LOG_FUNCTION (this << cellId << dlEarfcn);
1078  m_dlEarfcn = dlEarfcn;
1079  DoSynchronizeWithEnb (cellId);
1080 }
1081 
1082 void
1084 {
1085  NS_LOG_FUNCTION (this << cellId);
1086 
1087  if (cellId == 0)
1088  {
1089  NS_FATAL_ERROR ("Cell ID shall not be zero");
1090  }
1091 
1092  m_cellId = cellId;
1093  m_downlinkSpectrumPhy->SetCellId (cellId);
1094  m_uplinkSpectrumPhy->SetCellId (cellId);
1095 
1096  // configure DL for receiving the BCH with the minimum bandwidth
1097  DoSetDlBandwidth (6);
1098 
1099  m_dlConfigured = false;
1100  m_ulConfigured = false;
1101 
1103 }
1104 
1105 void
1106 LteUePhy::DoSetDlBandwidth (uint8_t dlBandwidth)
1107 {
1108  NS_LOG_FUNCTION (this << (uint32_t) dlBandwidth);
1109  if (m_dlBandwidth != dlBandwidth or !m_dlConfigured)
1110  {
1111  m_dlBandwidth = dlBandwidth;
1112 
1113  int Type0AllocationRbg[4] = {
1114  10, // RGB size 1
1115  26, // RGB size 2
1116  63, // RGB size 3
1117  110 // RGB size 4
1118  }; // see table 7.1.6.1-1 of 36.213
1119  for (int i = 0; i < 4; i++)
1120  {
1121  if (dlBandwidth < Type0AllocationRbg[i])
1122  {
1123  m_rbgSize = i + 1;
1124  break;
1125  }
1126  }
1127 
1129  m_downlinkSpectrumPhy->SetNoisePowerSpectralDensity (noisePsd);
1130  m_downlinkSpectrumPhy->GetChannel ()->AddRx (m_downlinkSpectrumPhy);
1131  }
1132  m_dlConfigured = true;
1133 }
1134 
1135 
1136 void
1137 LteUePhy::DoConfigureUplink (uint16_t ulEarfcn, uint8_t ulBandwidth)
1138 {
1139  m_ulEarfcn = ulEarfcn;
1140  m_ulBandwidth = ulBandwidth;
1141  m_ulConfigured = true;
1142 }
1143 
1144 
1145 void
1146 LteUePhy::DoSetRnti (uint16_t rnti)
1147 {
1148  NS_LOG_FUNCTION (this << rnti);
1149  m_rnti = rnti;
1150 }
1151 
1152 void
1154 {
1155  NS_LOG_FUNCTION (this << (uint16_t)txMode);
1156  m_transmissionMode = txMode;
1157  m_downlinkSpectrumPhy->SetTransmissionMode (txMode);
1158 }
1159 
1160 void
1162 {
1163  NS_LOG_FUNCTION (this << srcCi);
1166  m_srsConfigured = true;
1167 
1168  // a guard time is needed for the case where the SRS periodicity is changed dynamically at run time
1169  // if we use a static one, we can have a 0ms guard time
1170  m_srsStartTime = Simulator::Now () + MilliSeconds (0);
1171  NS_LOG_DEBUG (this << " UE SRS P " << m_srsPeriodicity << " RNTI " << m_rnti << " offset " << m_srsSubframeOffset << " cellId " << m_cellId << " CI " << srcCi);
1172 }
1173 
1174 
1175 void
1177 {
1178  SetTxModeGain (1, gain);
1179 }
1180 
1181 void
1183 {
1184  SetTxModeGain (2, gain);
1185 }
1186 
1187 void
1189 {
1190  SetTxModeGain (3, gain);
1191 }
1192 
1193 void
1195 {
1196  SetTxModeGain (4, gain);
1197 }
1198 
1199 void
1201 {
1202  SetTxModeGain (5, gain);
1203 }
1204 
1205 void
1207 {
1208  SetTxModeGain (6, gain);
1209 }
1210 
1211 void
1213 {
1214  SetTxModeGain (7, gain);
1215 }
1216 
1217 
1218 void
1219 LteUePhy::SetTxModeGain (uint8_t txMode, double gain)
1220 {
1221  NS_LOG_FUNCTION (this << gain);
1222  // convert to linear
1223  double gainLin = std::pow (10.0, (gain / 10.0));
1224  if (m_txModeGain.size () < txMode)
1225  {
1226  m_txModeGain.resize (txMode);
1227  }
1228  std::vector <double> temp;
1229  temp = m_txModeGain;
1230  m_txModeGain.clear ();
1231  for (uint8_t i = 0; i < temp.size (); i++)
1232  {
1233  if (i==txMode-1)
1234  {
1235  m_txModeGain.push_back (gainLin);
1236  }
1237  else
1238  {
1239  m_txModeGain.push_back (temp.at (i));
1240  }
1241  }
1242  // forward the info to DL LteSpectrumPhy
1243  m_downlinkSpectrumPhy->SetTxModeGain (txMode, gain);
1244 }
1245 
1246 
1247 
1248 void
1250 {
1251  NS_LOG_FUNCTION (this);
1252  // generate feedback to eNB and send it through ideal PUCCH
1253  Ptr<DlHarqFeedbackLteControlMessage> msg = Create<DlHarqFeedbackLteControlMessage> ();
1254  msg->SetDlHarqFeedback (m);
1255  SetControlMessages (msg);
1256 }
1257 
1258 void
1260 {
1261  m_harqPhyModule = harq;
1262 }
1263 
1264 
1267 {
1268  NS_LOG_FUNCTION (this);
1269  return m_state;
1270 }
1271 
1272 
1273 void
1275 {
1276  NS_LOG_FUNCTION (this << newState);
1277  State oldState = m_state;
1278  m_state = newState;
1279  NS_LOG_INFO (this << " cellId=" << m_cellId << " rnti=" << m_rnti
1280  << " UePhy " << ToString (oldState)
1281  << " --> " << ToString (newState));
1282  m_stateTransitionTrace (m_cellId, m_rnti, oldState, newState);
1283 }
1284 
1285 
1286 } // namespace ns3
Values::const_iterator ConstValuesEnd() const
See section 4.3.1 dlDciListElement.
Definition: ff-mac-common.h:88
double GetNoiseFigure() const
Definition: lte-ue-phy.cc:322
Ptr< LteSpectrumPhy > GetUlSpectrumPhy() const
Definition: lte-ue-phy.cc:356
uint16_t m_srsConfigured
Definition: lte-ue-phy.h:301
keep track of time values and allow control of global simulation resolution
Definition: nstime.h:81
uint8_t m_txMode
the transmission Mode
Definition: lte-common.h:124
#define NS_LOG_FUNCTION(parameters)
Definition: log.h:345
virtual void ReceiveLteControlMessage(Ptr< LteControlMessage > msg)=0
Receive SendLteControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel.
double m_noiseFigure
Definition: lte-phy.h:221
See section 4.3.25 sbMeasResult.
double m_txPower
Definition: lte-phy.h:220
std::vector< struct UeMeasurementsElement > m_ueMeasurementsList
uint16_t m_dlEarfcn
Definition: lte-phy.h:228
LteUePhySapUser * m_uePhySapUser
Definition: lte-ue-phy.h:289
void SetTxMode5Gain(double gain)
Definition: lte-ue-phy.cc:1200
virtual void SendMacPdu(Ptr< Packet > p)
Send the MAC PDU to the channel.
Definition: lte-ue-phy.cc:87
virtual void GenerateDataCqiReport(const SpectrumValue &sinr)
generate a CQI report based on the given SINR of Data frame (used for PUSCH CQIs) ...
Definition: lte-ue-phy.cc:540
std::list< PssElement > m_pssList
Definition: lte-ue-phy.h:326
void SetTxMode2Gain(double gain)
Definition: lte-ue-phy.cc:1182
bool m_ulConfigured
Definition: lte-ue-phy.h:305
uint8_t GetMacChDelay(void) const
Definition: lte-ue-phy.cc:344
void DoConfigureUplink(uint16_t ulEarfcn, uint8_t ulBandwidth)
Definition: lte-ue-phy.cc:1137
std::vector< Ptr< PacketBurst > > m_packetBurstQueue
Definition: lte-phy.h:231
std::vector< int > GetSubChannelsForTransmission(void)
Get a list of sub channels to use in RX.
Definition: lte-ue-phy.cc:397
virtual void GenerateCtrlCqiReport(const SpectrumValue &sinr)
generate a CQI report based on the given SINR of Ctrl frame
Definition: lte-ue-phy.cc:423
TracedCallback< uint16_t, uint16_t, double, double > m_reportCurrentCellRsrpSinrTrace
Trace information regarding RSRP and average SINR (see TS 36.214) uint16_t cellId, uint16_t rnti, double rsrp, double sinr.
Definition: lte-ue-phy.h:351
Time m_a30CqiLast
Definition: lte-ue-phy.h:286
void SetSubChannelsForTransmission(std::vector< int > mask)
Set a list of sub channels to use in TX.
Definition: lte-ue-phy.cc:377
uint16_t GetSrsPeriodicity(uint16_t srcCi) const
Definition: lte-phy.cc:148
double GetTti(void) const
Definition: lte-phy.cc:140
LteUePhySapProvider * m_uePhySapProvider
Definition: lte-ue-phy.h:288
#define NS_ASSERT(condition)
Definition: assert.h:64
void SetTxMode6Gain(double gain)
Definition: lte-ue-phy.cc:1206
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
Ptr< LteSpectrumPhy > m_downlinkSpectrumPhy
Definition: lte-phy.h:217
See section 4.3.2 ulDciListElement.
Service Access Point (SAP) offered by the UE PHY to the UE RRC for control purposes.
virtual void SendLteControlMessage(Ptr< LteControlMessage > msg)
Send SendLteControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel.
Definition: lte-ue-phy.cc:93
See section 4.3.24 cqiListElement.
std::vector< double > m_txModeGain
Definition: lte-ue-phy.h:297
#define NS_LOG_INFO(msg)
Definition: log.h:298
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
Definition: simulator.h:824
void QueueSubChannelsForTransmission(std::vector< int > rbMap)
Definition: lte-ue-phy.cc:928
uint8_t m_rv
the redundancy version (HARQ)
Definition: lte-common.h:128
Service Access Point (SAP) offered by the PHY to the MAC.
void SetTxModeGain(uint8_t txMode, double gain)
Definition: lte-ue-phy.cc:1219
virtual void DoSendMacPdu(Ptr< Packet > p)
Queue the MAC PDU to be sent (according to m_macChTtiDelay)
Definition: lte-ue-phy.cc:362
std::vector< int > GetSubChannelsForReception(void)
Get a list of sub channels to use in RX.
Definition: lte-ue-phy.cc:405
This class defines all functions to create spectrum model for lte.
uint8_t m_transmissionMode
Definition: lte-ue-phy.h:296
NS_LOG_COMPONENT_DEFINE("LteUePhy")
EventId m_sendSrsEvent
Definition: lte-ue-phy.h:361
void SetHarqPhyModule(Ptr< LteHarqPhy > harq)
Set the HARQ PHY module.
Definition: lte-ue-phy.cc:1259
Ptr< LteNetDevice > GetDevice()
Get the device where the phy layer is attached.
Definition: lte-phy.cc:98
uint8_t m_ulBandwidth
Definition: lte-phy.h:224
#define NS_FATAL_ERROR(msg)
fatal error handling
Definition: fatal-error.h:72
bool m_pssReceived
Definition: lte-ue-phy.h:319
void DoSetSrsConfigurationIndex(uint16_t srcCi)
Definition: lte-ue-phy.cc:1161
State
The states of the UE PHY entity.
Definition: lte-ue-phy.h:60
void DoSetTransmissionMode(uint8_t txMode)
Definition: lte-ue-phy.cc:1153
The attribute can be read.
Definition: type-id.h:56
UeMemberLteUePhySapProvider(LteUePhy *phy)
Definition: lte-ue-phy.cc:81
Template for the implementation of the LteUeCphySapProvider as a member of an owner class of type C t...
double m_pssReceptionThreshold
Definition: lte-ue-phy.h:328
TracedCallback< uint16_t, uint16_t, double, double, bool > m_reportUeMeasurements
Trace information regarding RSRP and RSRQ (see TS 36.214) uint16_t rnti, uint16_t cellId...
Definition: lte-ue-phy.h:359
uint16_t GetSrsSubframeOffset(uint16_t srcCi) const
Definition: lte-phy.cc:166
void DoSynchronizeWithEnb(uint16_t cellId)
Definition: lte-ue-phy.cc:1083
LteUeCphySapUser * m_ueCphySapUser
Definition: lte-ue-phy.h:292
void DoSetDlBandwidth(uint8_t ulBandwidth)
Definition: lte-ue-phy.cc:1106
void DoDispose()
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Definition: lte-phy.cc:76
hold objects of type ns3::Time
Definition: nstime.h:961
uint8_t GetRbgSize(void) const
Definition: lte-phy.cc:184
uint16_t m_rsrpSinrSamplePeriod
Definition: lte-ue-phy.h:352
uint64_t m_imsi
IMSI of the scheduled UE.
Definition: lte-common.h:122
See section 4.3.27 higherLayerSelected.
Service Access Point (SAP) offered by the UE PHY to the UE RRC for control purposes.
void SetLteUePhySapUser(LteUePhySapUser *s)
Set the PHY SAP User.
Definition: lte-ue-phy.cc:286
Hold an unsigned integer type.
Definition: uinteger.h:46
void SetTxMode3Gain(double gain)
Definition: lte-ue-phy.cc:1188
static uint8_t TxMode2LayerNum(uint8_t txMode)
Definition: lte-common.cc:170
Ptr< SampleEmitter > s
Ptr< DlCqiLteControlMessage > CreateDlCqiFeedbackMessage(const SpectrumValue &sinr)
Create the DL CQI feedback from SINR values perceived at the physical layer with the signal received ...
Definition: lte-ue-phy.cc:564
void SetTxMode4Gain(double gain)
Definition: lte-ue-phy.cc:1194
void SwitchToState(State s)
Definition: lte-ue-phy.cc:1274
TracedCallback< uint16_t, uint16_t, State, State > m_stateTransitionTrace
Definition: lte-ue-phy.h:309
void SendSrs()
Send the SRS signal in the last symbols of the frame.
Definition: lte-ue-phy.cc:1014
uint16_t m_ulEarfcn
Definition: lte-phy.h:229
bool m_rsInterferencePowerUpdated
Definition: lte-ue-phy.h:316
virtual void RecvSystemInformationBlockType1(uint16_t cellId, LteRrcSap::SystemInformationBlockType1 sib1)=0
Relay an SIB1 message from the PHY entity to the RRC layer.
#define NS_LOG_LOGIC(msg)
Definition: log.h:368
std::vector< uint8_t > m_sbCqi
void SetTxMode7Gain(double gain)
Definition: lte-ue-phy.cc:1212
#define list
virtual void RecvMasterInformationBlock(uint16_t cellId, LteRrcSap::MasterInformationBlock mib)=0
Relay an MIB message from the PHY entity to the RRC layer.
See section 4.3.23 dlInfoListElement.
virtual void DoSendRachPreamble(uint32_t prachId, uint32_t raRnti)
Definition: lte-ue-phy.cc:713
uint8_t m_mcs
MCS for transport block.
Definition: lte-common.h:126
virtual void ReceiveLteDlHarqFeedback(DlInfoListElement_s mes)
PhySpectrum generated a new DL HARQ feedback.
Definition: lte-ue-phy.cc:1249
uint8_t m_macChTtiDelay
Definition: lte-phy.h:233
static const Time UL_DATA_DURATION
Definition: lte-ue-phy.cc:53
Ptr< LteHarqPhy > m_harqPhyModule
Definition: lte-ue-phy.h:342
hold objects of type Ptr
Definition: pointer.h:33
void DoStartCellSearch(uint16_t dlEarfcn)
Definition: lte-ue-phy.cc:1066
void SetControlMessages(Ptr< LteControlMessage > m)
Definition: lte-phy.cc:215
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
uint16_t m_rsrpSinrSampleCounter
Definition: lte-ue-phy.h:353
SpectrumValue m_rsReceivedPower
Definition: lte-ue-phy.h:314
double GetTxPower() const
Definition: lte-ue-phy.cc:336
uint16_t m_srsSubframeOffset
Definition: lte-ue-phy.h:300
Time m_srsStartTime
Definition: lte-ue-phy.h:302
uint8_t m_dlBandwidth
Definition: lte-phy.h:225
uint8_t m_subframeNo
Definition: lte-ue-phy.h:311
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
Schedule an event to expire Now.
Definition: simulator.h:985
uint16_t m_size
Size of transport block.
Definition: lte-common.h:127
static Time Now(void)
Return the "current simulation time".
Definition: simulator.cc:180
uint16_t m_cellId
Definition: lte-phy.h:235
uint8_t m_ndi
new data indicator flag
Definition: lte-common.h:129
void SubframeIndication(uint32_t frameNo, uint32_t subframeNo)
trigger from eNB the start from a new frame
Definition: lte-ue-phy.cc:935
virtual void DoInitialize(void)
This method is called only once by Object::Initialize.
Definition: lte-ue-phy.cc:279
#define NS_ASSERT_MSG(condition, message)
Definition: assert.h:86
static Ptr< SpectrumValue > CreateTxPowerSpectralDensity(uint16_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...
void SetTxMode1Gain(double gain)
Definition: lte-ue-phy.cc:1176
std::vector< int > m_subChannelsForTransmission
Definition: lte-ue-phy.h:272
Time m_p10CqiPeriocity
Wideband Periodic CQI: 2, 5, 10, 16, 20, 32, 40, 64, 80 or 160 ms.
Definition: lte-ue-phy.h:280
uint32_t m_raRnti
Definition: lte-ue-phy.h:345
bool m_dlConfigured
Definition: lte-ue-phy.h:304
std::string ToString(EpcUeNas::State s)
Definition: epc-ue-nas.cc:47
std::vector< std::vector< int > > m_subChannelsForTransmissionQueue
Definition: lte-ue-phy.h:275
std::list< Ptr< LteControlMessage > > GetControlMessages(void)
Definition: lte-phy.cc:223
Time m_a30CqiPeriocity
Definition: lte-ue-phy.h:285
LteUeCphySapProvider * m_ueCphySapProvider
Definition: lte-ue-phy.h:291
std::map< uint16_t, UeMeasurementsElement > m_ueMeasurementsMap
Definition: lte-ue-phy.h:338
Ptr< PacketBurst > GetPacketBurst(void)
Definition: lte-phy.cc:196
uint16_t m_cellId
Cell ID of the attached Enb.
Definition: lte-common.h:121
std::vector< int > m_subChannelsForReception
Definition: lte-ue-phy.h:273
Service Access Point (SAP) offered by the UE-PHY to the UE-MAC.
static const Time UL_SRS_DELAY_FROM_SUBFRAME_START
Definition: lte-ue-phy.cc:57
int Type0AllocationRbg[4]
#define NS_LOG_DEBUG(msg)
Definition: log.h:289
uint8_t m_layer
the layer (cw) of the transmission
Definition: lte-common.h:125
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage > >)
Definition: lte-ue-phy.cc:727
void SetTxPower(double pow)
Definition: lte-ue-phy.cc:329
virtual void ReceivePss(uint16_t cellId, Ptr< SpectrumValue > p)
Definition: lte-ue-phy.cc:874
uint16_t m_srsPeriodicity
Definition: lte-ue-phy.h:299
LteUePhySapProvider * GetLteUePhySapProvider()
Get the PHY SAP provider.
Definition: lte-ue-phy.cc:293
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::cancel method.
Definition: event-id.cc:47
virtual void SendRachPreamble(uint32_t prachId, uint32_t raRnti)
send a preamble on the PRACH
Definition: lte-ue-phy.cc:99
State GetState() const
Definition: lte-ue-phy.cc:1266
uint32_t m_raPreambleId
Definition: lte-ue-phy.h:344
uint8_t m_rbgSize
Definition: lte-phy.h:226
void SetLteUeCphySapUser(LteUeCphySapUser *s)
Set the CPHY SAP User.
Definition: lte-ue-phy.cc:301
SpectrumValue m_rsInterferencePower
Definition: lte-ue-phy.h:317
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:452
friend class UeMemberLteUePhySapProvider
Definition: lte-ue-phy.h:53
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
Definition: lte-ue-phy.cc:371
Values::const_iterator ConstValuesBegin() const
virtual void DoSendLteControlMessage(Ptr< LteControlMessage > msg)
Definition: lte-ue-phy.cc:705
std::vector< std::list< Ptr< LteControlMessage > > > m_controlMessagesQueue
Definition: lte-phy.h:232
bool m_rsReceivedPowerUpdated
Definition: lte-ue-phy.h:313
virtual ~LteUePhy()
Definition: lte-ue-phy.cc:160
The LteSpectrumPhy models the physical layer of LTE.
Definition: lte-ue-phy.h:50
Ptr< LteSpectrumPhy > GetDlSpectrumPhy() const
Definition: lte-ue-phy.cc:350
Ptr< LteSpectrumPhy > m_uplinkSpectrumPhy
Definition: lte-phy.h:218
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-ue-phy.cc:554
Time m_p10CqiLast
SubBand Aperiodic CQI: activated by DCI format 0 or Random Access Response Grant. ...
Definition: lte-ue-phy.h:281
Parameters of the ReportUeMeasurements primitive: RSRP [dBm] and RSRQ [dB] See section 5...
LteUeCphySapProvider * GetLteUeCphySapProvider()
Get the CPHY SAP provider.
Definition: lte-ue-phy.cc:308
Hold a floating point type.
Definition: double.h:41
Set of values corresponding to a given SpectrumModel.
void SetMacPdu(Ptr< Packet > p)
Definition: lte-phy.cc:190
std::vector< struct HigherLayerSelected_s > m_higherLayerSelected
a unique identifier for an interface.
Definition: type-id.h:49
uint16_t m_rnti
Definition: lte-ue-phy.h:294
const char * g_uePhyStateName[LteUePhy::NUM_STATES]
Definition: lte-ue-phy.cc:109
int64_t GetMilliSeconds(void) const
Definition: nstime.h:283
TypeId SetParent(TypeId tid)
Definition: type-id.cc:611
void SetNoiseFigure(double nf)
Definition: lte-ue-phy.cc:315
virtual void DoInitialize(void)
This method is called only once by Object::Initialize.
Definition: object.cc:343
TracedCallback< PhyTransmissionStatParameters > m_ulPhyTransmission
Trace information regarding PHY stats from DL Tx perspective PhyTrasmissionStatParameters see lte-com...
Definition: lte-ue-phy.h:367
uint16_t m_rnti
C-RNTI scheduled.
Definition: lte-common.h:123
static TypeId GetTypeId(void)
Definition: lte-ue-phy.cc:177
Ptr< LteAmc > m_amc
Definition: lte-ue-phy.h:278
The LtePhy models the physical layer of LTE.
Definition: lte-phy.h:52
void ReportUeMeasurements()
Layer-1 filtering of RSRP and RSRQ measurements and reporting to the RRC entity.
Definition: lte-ue-phy.cc:664
virtual void ReportInterference(const SpectrumValue &interf)
generate a report based on the linear interference and noise power perceived during DATA frame NOTE: ...
Definition: lte-ue-phy.cc:546
virtual void ReceivePhyPdu(Ptr< Packet > p)=0
Called by the Phy to notify the MAC of the reception of a new PHY-PDU.
static Ptr< SpectrumValue > CreateNoisePowerSpectralDensity(uint16_t earfcn, uint8_t bandwidth, double noiseFigure)
create a SpectrumValue that models the power spectral density of AWGN
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensity()
Create the PSD for the TX.
Definition: lte-ue-phy.cc:413
#define UL_PUSCH_TTIS_DELAY
Definition: lte-common.h:28
void DoSetRnti(uint16_t rnti)
Definition: lte-ue-phy.cc:1146
virtual void SubframeIndication(uint32_t frameNo, uint32_t subframeNo)=0
Trigger the start from a new frame (input from Phy layer)
virtual void ReportUeMeasurements(UeMeasurementsParameters params)=0
Send a report of RSRP and RSRQ values perceived from PSS by the PHY entity (after applying layer-1 fi...
std::vector< HarqProcessInfoElement_t > HarqProcessInfoList_t
Definition: lte-harq-phy.h:47
void SetSubChannelsForReception(std::vector< int > mask)
Get a list of sub channels to use in RX.
Definition: lte-ue-phy.cc:389
The LteUeNetDevice class implements the UE net device.
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Definition: lte-ue-phy.cc:166
Time m_ueMeasurementsFilterPeriod
Definition: lte-ue-phy.h:339