A Discrete-Event Network Simulator
API
lte-spectrum-phy.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009, 2011 CTTC
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: Nicola Baldo <nbaldo@cttc.es>
19  * Giuseppe Piro <g.piro@poliba.it>
20  * Marco Miozzo <marco.miozzo@cttc.es> (add physical error model)
21  */
22 
23 
24 #include <ns3/object-factory.h>
25 #include <ns3/log.h>
26 #include <cmath>
27 #include <ns3/simulator.h>
28 #include <ns3/trace-source-accessor.h>
29 #include <ns3/antenna-model.h>
30 #include "lte-spectrum-phy.h"
32 #include "lte-net-device.h"
33 #include "lte-radio-bearer-tag.h"
34 #include "lte-chunk-processor.h"
35 #include "lte-phy-tag.h"
36 #include <ns3/lte-mi-error-model.h>
37 #include <ns3/lte-radio-bearer-tag.h>
38 #include <ns3/boolean.h>
39 #include <ns3/double.h>
40 #include <ns3/config.h>
41 
42 namespace ns3 {
43 
44 NS_LOG_COMPONENT_DEFINE ("LteSpectrumPhy");
45 
46 
47 // duration of SRS portion of UL subframe
48 // = 1 symbol for SRS -1ns as margin to avoid overlapping simulator events
49 static const Time UL_SRS_DURATION = NanoSeconds (71429 -1);
50 
51 // duration of the control portion of a subframe
52 // = 0.001 / 14 * 3 (ctrl fixed to 3 symbols) -1ns as margin to avoid overlapping simulator events
53 static const Time DL_CTRL_DURATION = NanoSeconds (214286 -1);
54 
55 static const double EffectiveCodingRate[29] = {
56  0.08,
57  0.1,
58  0.11,
59  0.15,
60  0.19,
61  0.24,
62  0.3,
63  0.37,
64  0.44,
65  0.51,
66  0.3,
67  0.33,
68  0.37,
69  0.42,
70  0.48,
71  0.54,
72  0.6,
73  0.43,
74  0.45,
75  0.5,
76  0.55,
77  0.6,
78  0.65,
79  0.7,
80  0.75,
81  0.8,
82  0.85,
83  0.89,
84  0.92
85 };
86 
87 
88 
89 
91 {
92 }
93 
94 TbId_t::TbId_t (const uint16_t a, const uint8_t b)
95 : m_rnti (a),
96  m_layer (b)
97 {
98 }
99 
100 bool
101 operator == (const TbId_t &a, const TbId_t &b)
102 {
103  return ( (a.m_rnti == b.m_rnti) && (a.m_layer == b.m_layer) );
104 }
105 
106 bool
107 operator < (const TbId_t& a, const TbId_t& b)
108 {
109  return ( (a.m_rnti < b.m_rnti) || ( (a.m_rnti == b.m_rnti) && (a.m_layer < b.m_layer) ) );
110 }
111 
112 NS_OBJECT_ENSURE_REGISTERED (LteSpectrumPhy);
113 
115  : m_state (IDLE),
116  m_cellId (0),
117  m_transmissionMode (0),
118  m_layersNum (1)
119 {
120  NS_LOG_FUNCTION (this);
121  m_random = CreateObject<UniformRandomVariable> ();
122  m_random->SetAttribute ("Min", DoubleValue (0.0));
123  m_random->SetAttribute ("Max", DoubleValue (1.0));
124  m_interferenceData = CreateObject<LteInterference> ();
125  m_interferenceCtrl = CreateObject<LteInterference> ();
126 
127  for (uint8_t i = 0; i < 7; i++)
128  {
129  m_txModeGain.push_back (1.0);
130  }
131 }
132 
133 
135 {
136  NS_LOG_FUNCTION (this);
137  m_expectedTbs.clear ();
138  m_txModeGain.clear ();
139 }
140 
142 {
143  NS_LOG_FUNCTION (this);
144  m_channel = 0;
145  m_mobility = 0;
146  m_device = 0;
147  m_interferenceData->Dispose ();
148  m_interferenceData = 0;
149  m_interferenceCtrl->Dispose ();
150  m_interferenceCtrl = 0;
151  m_ltePhyRxDataEndErrorCallback = MakeNullCallback< void > ();
152  m_ltePhyRxDataEndOkCallback = MakeNullCallback< void, Ptr<Packet> > ();
153  m_ltePhyRxCtrlEndOkCallback = MakeNullCallback< void, std::list<Ptr<LteControlMessage> > > ();
154  m_ltePhyRxCtrlEndErrorCallback = MakeNullCallback< void > ();
155  m_ltePhyDlHarqFeedbackCallback = MakeNullCallback< void, DlInfoListElement_s > ();
156  m_ltePhyUlHarqFeedbackCallback = MakeNullCallback< void, UlInfoListElement_s > ();
157  m_ltePhyRxPssCallback = MakeNullCallback< void, uint16_t, Ptr<SpectrumValue> > ();
159 }
160 
161 std::ostream& operator<< (std::ostream& os, LteSpectrumPhy::State s)
162 {
163  switch (s)
164  {
166  os << "IDLE";
167  break;
169  os << "RX_DATA";
170  break;
172  os << "RX_DL_CTRL";
173  break;
175  os << "TX_DATA";
176  break;
178  os << "TX_DL_CTRL";
179  break;
181  os << "TX_UL_SRS";
182  break;
183  default:
184  os << "UNKNOWN";
185  break;
186  }
187  return os;
188 }
189 
190 TypeId
192 {
193  static TypeId tid = TypeId ("ns3::LteSpectrumPhy")
195  .SetGroupName("Lte")
196  .AddTraceSource ("TxStart",
197  "Trace fired when a new transmission is started",
199  "ns3::PacketBurst::TracedCallback")
200  .AddTraceSource ("TxEnd",
201  "Trace fired when a previosuly started transmission is finished",
203  "ns3::PacketBurst::TracedCallback")
204  .AddTraceSource ("RxStart",
205  "Trace fired when the start of a signal is detected",
207  "ns3::PacketBurst::TracedCallback")
208  .AddTraceSource ("RxEndOk",
209  "Trace fired when a previosuly started RX terminates successfully",
211  "ns3::Packet::TracedCallback")
212  .AddTraceSource ("RxEndError",
213  "Trace fired when a previosuly started RX terminates with an error",
215  "ns3::Packet::TracedCallback")
216  .AddAttribute ("DataErrorModelEnabled",
217  "Activate/Deactivate the error model of data (TBs of PDSCH and PUSCH) [by default is active].",
218  BooleanValue (true),
221  .AddAttribute ("CtrlErrorModelEnabled",
222  "Activate/Deactivate the error model of control (PCFICH-PDCCH decodification) [by default is active].",
223  BooleanValue (true),
226  .AddTraceSource ("DlPhyReception",
227  "DL reception PHY layer statistics.",
229  "ns3::PhyReceptionStatParameters::TracedCallback")
230  .AddTraceSource ("UlPhyReception",
231  "DL reception PHY layer statistics.",
233  "ns3::PhyReceptionStatParameters::TracedCallback")
234  ;
235  return tid;
236 }
237 
238 
239 
242 {
243  NS_LOG_FUNCTION (this);
244  return m_device;
245 }
246 
247 
250 {
251  NS_LOG_FUNCTION (this);
252  return m_mobility;
253 }
254 
255 
256 void
258 {
259  NS_LOG_FUNCTION (this << d);
260  m_device = d;
261 }
262 
263 
264 void
266 {
267  NS_LOG_FUNCTION (this << m);
268  m_mobility = m;
269 }
270 
271 
272 void
274 {
275  NS_LOG_FUNCTION (this << c);
276  m_channel = c;
277 }
278 
281 {
282  return m_channel;
283 }
284 
287 {
288  return m_rxSpectrumModel;
289 }
290 
291 
292 void
294 {
295  NS_LOG_FUNCTION (this << txPsd);
296  NS_ASSERT (txPsd);
297  m_txPsd = txPsd;
298 }
299 
300 
301 void
303 {
304  NS_LOG_FUNCTION (this << noisePsd);
305  NS_ASSERT (noisePsd);
306  m_rxSpectrumModel = noisePsd->GetSpectrumModel ();
307  m_interferenceData->SetNoisePowerSpectralDensity (noisePsd);
308  m_interferenceCtrl->SetNoisePowerSpectralDensity (noisePsd);
309 }
310 
311 
312 void
314 {
315  NS_LOG_FUNCTION (this);
316  m_cellId = 0;
317  m_state = IDLE;
318  m_transmissionMode = 0;
319  m_layersNum = 1;
320  m_endTxEvent.Cancel ();
324  m_rxControlMessageList.clear ();
325  m_expectedTbs.clear ();
326  m_txControlMessageList.clear ();
327  m_rxPacketBurstList.clear ();
328  m_txPacketBurst = 0;
329  m_rxSpectrumModel = 0;
330 }
331 
332 
333 void
335 {
336  NS_LOG_FUNCTION (this);
338 }
339 
340 
341 void
343 {
344  NS_LOG_FUNCTION (this);
346 }
347 
348 void
350 {
351  NS_LOG_FUNCTION (this);
353 }
354 
355 void
357 {
358  NS_LOG_FUNCTION (this);
360 }
361 
362 
363 void
365 {
366  NS_LOG_FUNCTION (this);
368 }
369 
370 void
372 {
373  NS_LOG_FUNCTION (this);
375 }
376 
377 void
379 {
380  NS_LOG_FUNCTION (this);
382 }
383 
384 
387 {
388  return m_antenna;
389 }
390 
391 void
393 {
394  NS_LOG_FUNCTION (this << a);
395  m_antenna = a;
396 }
397 
398 void
400 {
401  ChangeState (newState);
402 }
403 
404 
405 void
407 {
408  NS_LOG_LOGIC (this << " state: " << m_state << " -> " << newState);
409  m_state = newState;
410 }
411 
412 
413 void
415 {
416  m_harqPhyModule = harq;
417 }
418 
419 
420 
421 
422 bool
424 {
425  NS_LOG_FUNCTION (this << pb);
426  NS_LOG_LOGIC (this << " state: " << m_state);
427 
428  m_phyTxStartTrace (pb);
429 
430  switch (m_state)
431  {
432  case RX_DATA:
433  case RX_DL_CTRL:
434  case RX_UL_SRS:
435  NS_FATAL_ERROR ("cannot TX while RX: according to FDD channel acces, the physical layer for transmission cannot be used for reception");
436  break;
437 
438  case TX_DATA:
439  case TX_DL_CTRL:
440  case TX_UL_SRS:
441  NS_FATAL_ERROR ("cannot TX while already TX: the MAC should avoid this");
442  break;
443 
444  case IDLE:
445  {
446  /*
447  m_txPsd must be setted by the device, according to
448  (i) the available subchannel for transmission
449  (ii) the power transmission
450  */
451  NS_ASSERT (m_txPsd);
452  m_txPacketBurst = pb;
453 
454  // we need to convey some PHY meta information to the receiver
455  // to be used for simulation purposes (e.g., the CellId). This
456  // is done by setting the ctrlMsgList parameter of
457  // LteSpectrumSignalParametersDataFrame
460  Ptr<LteSpectrumSignalParametersDataFrame> txParams = Create<LteSpectrumSignalParametersDataFrame> ();
461  txParams->duration = duration;
462  txParams->txPhy = GetObject<SpectrumPhy> ();
463  txParams->txAntenna = m_antenna;
464  txParams->psd = m_txPsd;
465  txParams->packetBurst = pb;
466  txParams->ctrlMsgList = ctrlMsgList;
467  txParams->cellId = m_cellId;
468  m_channel->StartTx (txParams);
470  }
471  return false;
472  break;
473 
474  default:
475  NS_FATAL_ERROR ("unknown state");
476  return true;
477  break;
478  }
479 }
480 
481 bool
483 {
484  NS_LOG_FUNCTION (this << " PSS " << (uint16_t)pss);
485  NS_LOG_LOGIC (this << " state: " << m_state);
486 
487  switch (m_state)
488  {
489  case RX_DATA:
490  case RX_DL_CTRL:
491  case RX_UL_SRS:
492  NS_FATAL_ERROR ("cannot TX while RX: according to FDD channel acces, the physical layer for transmission cannot be used for reception");
493  break;
494 
495  case TX_DATA:
496  case TX_DL_CTRL:
497  case TX_UL_SRS:
498  NS_FATAL_ERROR ("cannot TX while already TX: the MAC should avoid this");
499  break;
500 
501  case IDLE:
502  {
503  /*
504  m_txPsd must be setted by the device, according to
505  (i) the available subchannel for transmission
506  (ii) the power transmission
507  */
508  NS_ASSERT (m_txPsd);
509 
510  // we need to convey some PHY meta information to the receiver
511  // to be used for simulation purposes (e.g., the CellId). This
512  // is done by setting the cellId parameter of
513  // LteSpectrumSignalParametersDlCtrlFrame
516 
517  Ptr<LteSpectrumSignalParametersDlCtrlFrame> txParams = Create<LteSpectrumSignalParametersDlCtrlFrame> ();
518  txParams->duration = DL_CTRL_DURATION;
519  txParams->txPhy = GetObject<SpectrumPhy> ();
520  txParams->txAntenna = m_antenna;
521  txParams->psd = m_txPsd;
522  txParams->cellId = m_cellId;
523  txParams->pss = pss;
524  txParams->ctrlMsgList = ctrlMsgList;
525  m_channel->StartTx (txParams);
526  m_endTxEvent = Simulator::Schedule (DL_CTRL_DURATION, &LteSpectrumPhy::EndTxDlCtrl, this);
527  }
528  return false;
529  break;
530 
531  default:
532  NS_FATAL_ERROR ("unknown state");
533  return true;
534  break;
535  }
536 }
537 
538 
539 bool
541 {
542  NS_LOG_FUNCTION (this);
543  NS_LOG_LOGIC (this << " state: " << m_state);
544 
545  switch (m_state)
546  {
547  case RX_DATA:
548  case RX_DL_CTRL:
549  case RX_UL_SRS:
550  NS_FATAL_ERROR ("cannot TX while RX: according to FDD channel acces, the physical layer for transmission cannot be used for reception");
551  break;
552 
553  case TX_DL_CTRL:
554  case TX_DATA:
555  case TX_UL_SRS:
556  NS_FATAL_ERROR ("cannot TX while already TX: the MAC should avoid this");
557  break;
558 
559  case IDLE:
560  {
561  /*
562  m_txPsd must be setted by the device, according to
563  (i) the available subchannel for transmission
564  (ii) the power transmission
565  */
566  NS_ASSERT (m_txPsd);
567  NS_LOG_LOGIC (this << " m_txPsd: " << *m_txPsd);
568 
569  // we need to convey some PHY meta information to the receiver
570  // to be used for simulation purposes (e.g., the CellId). This
571  // is done by setting the cellId parameter of
572  // LteSpectrumSignalParametersDlCtrlFrame
575  Ptr<LteSpectrumSignalParametersUlSrsFrame> txParams = Create<LteSpectrumSignalParametersUlSrsFrame> ();
576  txParams->duration = UL_SRS_DURATION;
577  txParams->txPhy = GetObject<SpectrumPhy> ();
578  txParams->txAntenna = m_antenna;
579  txParams->psd = m_txPsd;
580  txParams->cellId = m_cellId;
581  m_channel->StartTx (txParams);
582  m_endTxEvent = Simulator::Schedule (UL_SRS_DURATION, &LteSpectrumPhy::EndTxUlSrs, this);
583  }
584  return false;
585  break;
586 
587  default:
588  NS_FATAL_ERROR ("unknown state");
589  return true;
590  break;
591  }
592 }
593 
594 
595 
596 void
598 {
599  NS_LOG_FUNCTION (this);
600  NS_LOG_LOGIC (this << " state: " << m_state);
601 
604  m_txPacketBurst = 0;
605  ChangeState (IDLE);
606 }
607 
608 void
610 {
611  NS_LOG_FUNCTION (this);
612  NS_LOG_LOGIC (this << " state: " << m_state);
613 
615  NS_ASSERT (m_txPacketBurst == 0);
616  ChangeState (IDLE);
617 }
618 
619 void
621 {
622  NS_LOG_FUNCTION (this);
623  NS_LOG_LOGIC (this << " state: " << m_state);
624 
626  NS_ASSERT (m_txPacketBurst == 0);
627  ChangeState (IDLE);
628 }
629 
630 
631 
632 
633 void
635 {
636  NS_LOG_FUNCTION (this << spectrumRxParams);
637  NS_LOG_LOGIC (this << " state: " << m_state);
638 
639  Ptr <const SpectrumValue> rxPsd = spectrumRxParams->psd;
640  Time duration = spectrumRxParams->duration;
641 
642  // the device might start RX only if the signal is of a type
643  // understood by this device - in this case, an LTE signal.
644  Ptr<LteSpectrumSignalParametersDataFrame> lteDataRxParams = DynamicCast<LteSpectrumSignalParametersDataFrame> (spectrumRxParams);
645  Ptr<LteSpectrumSignalParametersDlCtrlFrame> lteDlCtrlRxParams = DynamicCast<LteSpectrumSignalParametersDlCtrlFrame> (spectrumRxParams);
646  Ptr<LteSpectrumSignalParametersUlSrsFrame> lteUlSrsRxParams = DynamicCast<LteSpectrumSignalParametersUlSrsFrame> (spectrumRxParams);
647  if (lteDataRxParams != 0)
648  {
649  m_interferenceData->AddSignal (rxPsd, duration);
650  StartRxData (lteDataRxParams);
651  }
652  else if (lteDlCtrlRxParams!=0)
653  {
654  m_interferenceCtrl->AddSignal (rxPsd, duration);
655  StartRxDlCtrl (lteDlCtrlRxParams);
656  }
657  else if (lteUlSrsRxParams!=0)
658  {
659  m_interferenceCtrl->AddSignal (rxPsd, duration);
660  StartRxUlSrs (lteUlSrsRxParams);
661  }
662  else
663  {
664  // other type of signal (could be 3G, GSM, whatever) -> interference
665  m_interferenceData->AddSignal (rxPsd, duration);
666  m_interferenceCtrl->AddSignal (rxPsd, duration);
667  }
668 }
669 
670 void
672 {
673  NS_LOG_FUNCTION (this);
674  switch (m_state)
675  {
676  case TX_DATA:
677  case TX_DL_CTRL:
678  case TX_UL_SRS:
679  NS_FATAL_ERROR ("cannot RX while TX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
680  break;
681  case RX_DL_CTRL:
682  NS_FATAL_ERROR ("cannot RX Data while receiving control");
683  break;
684  case IDLE:
685  case RX_DATA:
686  // the behavior is similar when
687  // we're IDLE or RX because we can receive more signals
688  // simultaneously (e.g., at the eNB).
689  {
690  // To check if we're synchronized to this signal, we check
691  // for the CellId which is reported in the
692  // LteSpectrumSignalParametersDataFrame
693  if (params->cellId == m_cellId)
694  {
695  NS_LOG_LOGIC (this << " synchronized with this signal (cellId=" << params->cellId << ")");
696  if ((m_rxPacketBurstList.empty ())&&(m_rxControlMessageList.empty ()))
697  {
698  NS_ASSERT (m_state == IDLE);
699  // first transmission, i.e., we're IDLE and we
700  // start RX
702  m_firstRxDuration = params->duration;
703  NS_LOG_LOGIC (this << " scheduling EndRx with delay " << params->duration.GetSeconds () << "s");
705  }
706  else
707  {
709  // sanity check: if there are multiple RX events, they
710  // should occur at the same time and have the same
711  // duration, otherwise the interference calculation
712  // won't be correct
714  && (m_firstRxDuration == params->duration));
715  }
716 
718  if (params->packetBurst)
719  {
720  m_rxPacketBurstList.push_back (params->packetBurst);
721  m_interferenceData->StartRx (params->psd);
722 
723  m_phyRxStartTrace (params->packetBurst);
724  }
725  NS_LOG_DEBUG (this << " insert msgs " << params->ctrlMsgList.size ());
726  m_rxControlMessageList.insert (m_rxControlMessageList.end (), params->ctrlMsgList.begin (), params->ctrlMsgList.end ());
727 
728  NS_LOG_LOGIC (this << " numSimultaneousRxEvents = " << m_rxPacketBurstList.size ());
729  }
730  else
731  {
732  NS_LOG_LOGIC (this << " not in sync with this signal (cellId="
733  << params->cellId << ", m_cellId=" << m_cellId << ")");
734  }
735  }
736  break;
737 
738  default:
739  NS_FATAL_ERROR ("unknown state");
740  break;
741  }
742 
743  NS_LOG_LOGIC (this << " state: " << m_state);
744 }
745 
746 
747 
748 void
750 {
751  NS_LOG_FUNCTION (this);
752 
753  // To check if we're synchronized to this signal, we check
754  // for the CellId which is reported in the
755  // LteSpectrumSignalParametersDlCtrlFrame
756  uint16_t cellId;
757  NS_ASSERT (lteDlCtrlRxParams != 0);
758  cellId = lteDlCtrlRxParams->cellId;
759 
760  switch (m_state)
761  {
762  case TX_DATA:
763  case TX_DL_CTRL:
764  case TX_UL_SRS:
765  case RX_DATA:
766  case RX_UL_SRS:
767  NS_FATAL_ERROR ("unexpected event in state " << m_state);
768  break;
769 
770  case RX_DL_CTRL:
771  case IDLE:
772 
773  // common code for the two states
774  // check presence of PSS for UE measuerements
775  if (lteDlCtrlRxParams->pss == true)
776  {
778  {
779  m_ltePhyRxPssCallback (cellId, lteDlCtrlRxParams->psd);
780  }
781  }
782 
783  // differentiated code for the two states
784  switch (m_state)
785  {
786  case RX_DL_CTRL:
787  NS_ASSERT_MSG (m_cellId != cellId, "any other DlCtrl should be from a different cell");
788  NS_LOG_LOGIC (this << " ignoring other DlCtrl (cellId="
789  << cellId << ", m_cellId=" << m_cellId << ")");
790  break;
791 
792  case IDLE:
793  if (cellId == m_cellId)
794  {
795  NS_LOG_LOGIC (this << " synchronized with this signal (cellId=" << cellId << ")");
796 
799  m_firstRxDuration = lteDlCtrlRxParams->duration;
800  NS_LOG_LOGIC (this << " scheduling EndRx with delay " << lteDlCtrlRxParams->duration);
801 
802  // store the DCIs
803  m_rxControlMessageList = lteDlCtrlRxParams->ctrlMsgList;
804  m_endRxDlCtrlEvent = Simulator::Schedule (lteDlCtrlRxParams->duration, &LteSpectrumPhy::EndRxDlCtrl, this);
806  m_interferenceCtrl->StartRx (lteDlCtrlRxParams->psd);
807  }
808  else
809  {
810  NS_LOG_LOGIC (this << " not synchronizing with this signal (cellId="
811  << cellId << ", m_cellId=" << m_cellId << ")");
812  }
813  break;
814 
815  default:
816  NS_FATAL_ERROR ("unexpected event in state " << m_state);
817  break;
818  }
819  break; // case RX_DL_CTRL or IDLE
820 
821  default:
822  NS_FATAL_ERROR ("unknown state");
823  break;
824  }
825 
826  NS_LOG_LOGIC (this << " state: " << m_state);
827 }
828 
829 
830 
831 
832 void
834 {
835  NS_LOG_FUNCTION (this);
836  switch (m_state)
837  {
838  case TX_DATA:
839  case TX_DL_CTRL:
840  case TX_UL_SRS:
841  NS_FATAL_ERROR ("cannot RX while TX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
842  break;
843 
844  case RX_DATA:
845  case RX_DL_CTRL:
846  NS_FATAL_ERROR ("cannot RX SRS while receiving something else");
847  break;
848 
849  case IDLE:
850  case RX_UL_SRS:
851  // the behavior is similar when
852  // we're IDLE or RX_UL_SRS because we can receive more signals
853  // simultaneously at the eNB
854  {
855  // To check if we're synchronized to this signal, we check
856  // for the CellId which is reported in the
857  // LteSpectrumSignalParametersDlCtrlFrame
858  uint16_t cellId;
859  cellId = lteUlSrsRxParams->cellId;
860  if (cellId == m_cellId)
861  {
862  NS_LOG_LOGIC (this << " synchronized with this signal (cellId=" << cellId << ")");
863  if (m_state == IDLE)
864  {
865  // first transmission, i.e., we're IDLE and we
866  // start RX
869  m_firstRxDuration = lteUlSrsRxParams->duration;
870  NS_LOG_LOGIC (this << " scheduling EndRx with delay " << lteUlSrsRxParams->duration);
871 
872  m_endRxUlSrsEvent = Simulator::Schedule (lteUlSrsRxParams->duration, &LteSpectrumPhy::EndRxUlSrs, this);
873  }
874  else if (m_state == RX_UL_SRS)
875  {
876  // sanity check: if there are multiple RX events, they
877  // should occur at the same time and have the same
878  // duration, otherwise the interference calculation
879  // won't be correct
881  && (m_firstRxDuration == lteUlSrsRxParams->duration));
882  }
884  m_interferenceCtrl->StartRx (lteUlSrsRxParams->psd);
885  }
886  else
887  {
888  NS_LOG_LOGIC (this << " not in sync with this signal (cellId="
889  << cellId << ", m_cellId=" << m_cellId << ")");
890  }
891  }
892  break;
893 
894  default:
895  NS_FATAL_ERROR ("unknown state");
896  break;
897  }
898 
899  NS_LOG_LOGIC (this << " state: " << m_state);
900 }
901 
902 
903 void
905 {
906  NS_LOG_FUNCTION (this << sinr);
907  m_sinrPerceived = sinr;
908 }
909 
910 
911 void
912 LteSpectrumPhy::AddExpectedTb (uint16_t rnti, uint8_t ndi, uint16_t size, uint8_t mcs, std::vector<int> map, uint8_t layer, uint8_t harqId,uint8_t rv, bool downlink)
913 {
914  NS_LOG_FUNCTION (this << " rnti: " << rnti << " NDI " << (uint16_t)ndi << " size " << size << " mcs " << (uint16_t)mcs << " layer " << (uint16_t)layer << " rv " << (uint16_t)rv);
915  TbId_t tbId;
916  tbId.m_rnti = rnti;
917  tbId.m_layer = layer;
918  expectedTbs_t::iterator it;
919  it = m_expectedTbs.find (tbId);
920  if (it != m_expectedTbs.end ())
921  {
922  // migth be a TB of an unreceived packet (due to high progpalosses)
923  m_expectedTbs.erase (it);
924  }
925  // insert new entry
926  tbInfo_t tbInfo = {ndi, size, mcs, map, harqId, rv, 0.0, downlink, false, false};
927  m_expectedTbs.insert (std::pair<TbId_t, tbInfo_t> (tbId,tbInfo));
928 }
929 
930 
931 void
933 {
934  NS_LOG_FUNCTION (this);
935  NS_LOG_LOGIC (this << " state: " << m_state);
936 
938 
939  // this will trigger CQI calculation and Error Model evaluation
940  // as a side effect, the error model should update the error status of all TBs
941  m_interferenceData->EndRx ();
942  NS_LOG_DEBUG (this << " No. of burts " << m_rxPacketBurstList.size ());
943  NS_LOG_DEBUG (this << " Expected TBs " << m_expectedTbs.size ());
944  expectedTbs_t::iterator itTb = m_expectedTbs.begin ();
945 
946  // apply transmission mode gain
947  NS_LOG_DEBUG (this << " txMode " << (uint16_t)m_transmissionMode << " gain " << m_txModeGain.at (m_transmissionMode));
950 
951  while (itTb!=m_expectedTbs.end ())
952  {
953  if ((m_dataErrorModelEnabled)&&(m_rxPacketBurstList.size ()>0)) // avoid to check for errors when there is no actual data transmitted
954  {
955  // retrieve HARQ info
956  HarqProcessInfoList_t harqInfoList;
957  if ((*itTb).second.ndi == 0)
958  {
959  // TB retxed: retrieve HARQ history
960  uint16_t ulHarqId = 0;
961  if ((*itTb).second.downlink)
962  {
963  harqInfoList = m_harqPhyModule->GetHarqProcessInfoDl ((*itTb).second.harqProcessId, (*itTb).first.m_layer);
964  }
965  else
966  {
967  harqInfoList = m_harqPhyModule->GetHarqProcessInfoUl ((*itTb).first.m_rnti, ulHarqId);
968  }
969  }
970  TbStats_t tbStats = LteMiErrorModel::GetTbDecodificationStats (m_sinrPerceived, (*itTb).second.rbBitmap, (*itTb).second.size, (*itTb).second.mcs, harqInfoList);
971  (*itTb).second.mi = tbStats.mi;
972  (*itTb).second.corrupt = m_random->GetValue () > tbStats.tbler ? false : true;
973  NS_LOG_DEBUG (this << "RNTI " << (*itTb).first.m_rnti << " size " << (*itTb).second.size << " mcs " << (uint32_t)(*itTb).second.mcs << " bitmap " << (*itTb).second.rbBitmap.size () << " layer " << (uint16_t)(*itTb).first.m_layer << " TBLER " << tbStats.tbler << " corrupted " << (*itTb).second.corrupt);
974  // fire traces on DL/UL reception PHY stats
977  params.m_cellId = m_cellId;
978  params.m_imsi = 0; // it will be set by DlPhyTransmissionCallback in LteHelper
979  params.m_rnti = (*itTb).first.m_rnti;
980  params.m_txMode = m_transmissionMode;
981  params.m_layer = (*itTb).first.m_layer;
982  params.m_mcs = (*itTb).second.mcs;
983  params.m_size = (*itTb).second.size;
984  params.m_rv = (*itTb).second.rv;
985  params.m_ndi = (*itTb).second.ndi;
986  params.m_correctness = (uint8_t)!(*itTb).second.corrupt;
987  if ((*itTb).second.downlink)
988  {
989  // DL
990  m_dlPhyReception (params);
991  }
992  else
993  {
994  // UL
995  params.m_rv = harqInfoList.size ();
996  m_ulPhyReception (params);
997  }
998  }
999 
1000  itTb++;
1001  }
1002  std::map <uint16_t, DlInfoListElement_s> harqDlInfoMap;
1003  for (std::list<Ptr<PacketBurst> >::const_iterator i = m_rxPacketBurstList.begin ();
1004  i != m_rxPacketBurstList.end (); ++i)
1005  {
1006  for (std::list<Ptr<Packet> >::const_iterator j = (*i)->Begin (); j != (*i)->End (); ++j)
1007  {
1008  // retrieve TB info of this packet
1009  LteRadioBearerTag tag;
1010  (*j)->PeekPacketTag (tag);
1011  TbId_t tbId;
1012  tbId.m_rnti = tag.GetRnti ();
1013  tbId.m_layer = tag.GetLayer ();
1014  itTb = m_expectedTbs.find (tbId);
1015  NS_LOG_INFO (this << " Packet of " << tbId.m_rnti << " layer " << (uint16_t) tag.GetLayer ());
1016  if (itTb!=m_expectedTbs.end ())
1017  {
1018  if (!(*itTb).second.corrupt)
1019  {
1020  m_phyRxEndOkTrace (*j);
1021 
1023  {
1025  }
1026  }
1027  else
1028  {
1029  // TB received with errors
1030  m_phyRxEndErrorTrace (*j);
1031  }
1032 
1033  // send HARQ feedback (if not already done for this TB)
1034  if (!(*itTb).second.harqFeedbackSent)
1035  {
1036  (*itTb).second.harqFeedbackSent = true;
1037  if (!(*itTb).second.downlink)
1038  {
1039  UlInfoListElement_s harqUlInfo;
1040  harqUlInfo.m_rnti = tbId.m_rnti;
1041  harqUlInfo.m_tpc = 0;
1042  if ((*itTb).second.corrupt)
1043  {
1045  NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " send UL-HARQ-NACK");
1046  m_harqPhyModule->UpdateUlHarqProcessStatus (tbId.m_rnti, (*itTb).second.mi, (*itTb).second.size, (*itTb).second.size / EffectiveCodingRate [(*itTb).second.mcs]);
1047  }
1048  else
1049  {
1051  NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " send UL-HARQ-ACK");
1052  m_harqPhyModule->ResetUlHarqProcessStatus (tbId.m_rnti, (*itTb).second.harqProcessId);
1053  }
1055  {
1056  m_ltePhyUlHarqFeedbackCallback (harqUlInfo);
1057  }
1058  }
1059  else
1060  {
1061  std::map <uint16_t, DlInfoListElement_s>::iterator itHarq = harqDlInfoMap.find (tbId.m_rnti);
1062  if (itHarq==harqDlInfoMap.end ())
1063  {
1064  DlInfoListElement_s harqDlInfo;
1065  harqDlInfo.m_harqStatus.resize (m_layersNum, DlInfoListElement_s::NACK);
1066  harqDlInfo.m_rnti = tbId.m_rnti;
1067  harqDlInfo.m_harqProcessId = (*itTb).second.harqProcessId;
1068  if ((*itTb).second.corrupt)
1069  {
1070  harqDlInfo.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::NACK;
1071  NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " harqId " << (uint16_t)(*itTb).second.harqProcessId << " layer " <<(uint16_t)tbId.m_layer << " send DL-HARQ-NACK");
1072  m_harqPhyModule->UpdateDlHarqProcessStatus ((*itTb).second.harqProcessId, tbId.m_layer, (*itTb).second.mi, (*itTb).second.size, (*itTb).second.size / EffectiveCodingRate [(*itTb).second.mcs]);
1073  }
1074  else
1075  {
1076 
1077  harqDlInfo.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::ACK;
1078  NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " harqId " << (uint16_t)(*itTb).second.harqProcessId << " layer " <<(uint16_t)tbId.m_layer << " size " << (*itTb).second.size << " send DL-HARQ-ACK");
1079  m_harqPhyModule->ResetDlHarqProcessStatus ((*itTb).second.harqProcessId);
1080  }
1081  harqDlInfoMap.insert (std::pair <uint16_t, DlInfoListElement_s> (tbId.m_rnti, harqDlInfo));
1082  }
1083  else
1084  {
1085  if ((*itTb).second.corrupt)
1086  {
1087  (*itHarq).second.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::NACK;
1088  NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " harqId " << (uint16_t)(*itTb).second.harqProcessId << " layer " <<(uint16_t)tbId.m_layer << " size " << (*itHarq).second.m_harqStatus.size () << " send DL-HARQ-NACK");
1089  m_harqPhyModule->UpdateDlHarqProcessStatus ((*itTb).second.harqProcessId, tbId.m_layer, (*itTb).second.mi, (*itTb).second.size, (*itTb).second.size / EffectiveCodingRate [(*itTb).second.mcs]);
1090  }
1091  else
1092  {
1093  NS_ASSERT_MSG (tbId.m_layer < (*itHarq).second.m_harqStatus.size (), " layer " << (uint16_t)tbId.m_layer);
1094  (*itHarq).second.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::ACK;
1095  NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " harqId " << (uint16_t)(*itTb).second.harqProcessId << " layer " << (uint16_t)tbId.m_layer << " size " << (*itHarq).second.m_harqStatus.size () << " send DL-HARQ-ACK");
1096  m_harqPhyModule->ResetDlHarqProcessStatus ((*itTb).second.harqProcessId);
1097  }
1098  }
1099  } // end if ((*itTb).second.downlink) HARQ
1100  } // end if (!(*itTb).second.harqFeedbackSent)
1101  }
1102  }
1103  }
1104 
1105  // send DL HARQ feedback to LtePhy
1106  std::map <uint16_t, DlInfoListElement_s>::iterator itHarq;
1107  for (itHarq = harqDlInfoMap.begin (); itHarq != harqDlInfoMap.end (); itHarq++)
1108  {
1110  {
1111  m_ltePhyDlHarqFeedbackCallback ((*itHarq).second);
1112  }
1113  }
1114  // forward control messages of this frame to LtePhy
1115  if (!m_rxControlMessageList.empty ())
1116  {
1118  {
1120  }
1121  }
1122  ChangeState (IDLE);
1123  m_rxPacketBurstList.clear ();
1124  m_rxControlMessageList.clear ();
1125  m_expectedTbs.clear ();
1126 }
1127 
1128 
1129 void
1131 {
1132  NS_LOG_FUNCTION (this);
1133  NS_LOG_LOGIC (this << " state: " << m_state);
1134 
1136 
1137  // this will trigger CQI calculation and Error Model evaluation
1138  // as a side effect, the error model should update the error status of all TBs
1139  m_interferenceCtrl->EndRx ();
1140  // apply transmission mode gain
1141  NS_LOG_DEBUG (this << " txMode " << (uint16_t)m_transmissionMode << " gain " << m_txModeGain.at (m_transmissionMode));
1143  if (m_transmissionMode>0)
1144  {
1145  // in case of MIMO, ctrl is always txed as TX diversity
1146  m_sinrPerceived *= m_txModeGain.at (1);
1147  }
1148 // m_sinrPerceived *= m_txModeGain.at (m_transmissionMode);
1149  bool error = false;
1151  {
1153  error = m_random->GetValue () > errorRate ? false : true;
1154  NS_LOG_DEBUG (this << " PCFICH-PDCCH Decodification, errorRate " << errorRate << " error " << error);
1155  }
1156 
1157  if (!error)
1158  {
1160  {
1161  NS_LOG_DEBUG (this << " PCFICH-PDCCH Rxed OK");
1163  }
1164  }
1165  else
1166  {
1168  {
1169  NS_LOG_DEBUG (this << " PCFICH-PDCCH Error");
1171  }
1172  }
1173  ChangeState (IDLE);
1174  m_rxControlMessageList.clear ();
1175 }
1176 
1177 void
1179 {
1181  ChangeState (IDLE);
1182  m_interferenceCtrl->EndRx ();
1183  // nothing to do (used only for SRS at this stage)
1184 }
1185 
1186 void
1187 LteSpectrumPhy::SetCellId (uint16_t cellId)
1188 {
1189  m_cellId = cellId;
1190 }
1191 
1192 
1193 void
1195 {
1196  m_interferenceCtrl->AddRsPowerChunkProcessor (p);
1197 }
1198 
1199 void
1201 {
1202  m_interferenceData->AddRsPowerChunkProcessor (p);
1203 }
1204 
1205 void
1207 {
1208  m_interferenceData->AddSinrChunkProcessor (p);
1209 }
1210 
1211 void
1213 {
1214  m_interferenceCtrl->AddInterferenceChunkProcessor (p);
1215 }
1216 
1217 void
1219 {
1220  m_interferenceData->AddInterferenceChunkProcessor (p);
1221 }
1222 
1223 void
1225 {
1226  m_interferenceCtrl->AddSinrChunkProcessor (p);
1227 }
1228 
1229 void
1231 {
1232  NS_LOG_FUNCTION (this << (uint16_t) txMode);
1233  NS_ASSERT_MSG (txMode < m_txModeGain.size (), "TransmissionMode not available: 1.." << m_txModeGain.size ());
1234  m_transmissionMode = txMode;
1236 }
1237 
1238 
1239 void
1240 LteSpectrumPhy::SetTxModeGain (uint8_t txMode, double gain)
1241 {
1242  NS_LOG_FUNCTION (this << " txmode " << (uint16_t)txMode << " gain " << gain);
1243  // convert to linear
1244  gain = std::pow (10.0, (gain / 10.0));
1245  if (m_txModeGain.size () < txMode)
1246  {
1247  m_txModeGain.resize (txMode);
1248  }
1249  std::vector <double> temp;
1250  temp = m_txModeGain;
1251  m_txModeGain.clear ();
1252  for (uint8_t i = 0; i < temp.size (); i++)
1253  {
1254  if (i==txMode-1)
1255  {
1256  m_txModeGain.push_back (gain);
1257  }
1258  else
1259  {
1260  m_txModeGain.push_back (temp.at (i));
1261  }
1262  }
1263 }
1264 
1265 int64_t
1267 {
1268  NS_LOG_FUNCTION (this << stream);
1269  m_random->SetStream (stream);
1270  return 1;
1271 }
1272 
1273 
1274 
1275 } // namespace ns3
static const Time UL_SRS_DURATION
Ptr< LteHarqPhy > m_harqPhyModule
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
void StartRxData(Ptr< LteSpectrumSignalParametersDataFrame > params)
Abstract base class for Spectrum-aware PHY layers.
Definition: spectrum-phy.h:45
Ptr< LteInterference > m_interferenceCtrl
AttributeValue implementation for Boolean.
Definition: boolean.h:34
LtePhyRxCtrlEndOkCallback m_ltePhyRxCtrlEndOkCallback
uint8_t m_mcs
MCS for transport block.
Definition: lte-common.h:150
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:44
TracedCallback< Ptr< const PacketBurst > > m_phyTxEndTrace
void AddDataSinrChunkProcessor(Ptr< LteChunkProcessor > p)
uint16_t GetRnti(void) const
void SetState(State newState)
Set the state of the phy layer.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: boolean.h:81
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1270
void StartRxUlSrs(Ptr< LteSpectrumSignalParametersUlSrsFrame > lteUlSrsRxParams)
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:67
uint8_t m_rv
the redundancy version (HARQ)
Definition: lte-common.h:152
TracedCallback< Ptr< const Packet > > m_phyRxEndErrorTrace
void SetLtePhyRxDataEndErrorCallback(LtePhyRxDataEndErrorCallback c)
set the callback for the end of a RX in error, as part of the interconnections between the PHY and th...
Channel is IDLE, no packet is being transmitted.
Definition: csma-channel.h:75
void SetTxModeGain(uint8_t txMode, double gain)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
LtePhyRxCtrlEndErrorCallback m_ltePhyRxCtrlEndErrorCallback
void SetTransmissionMode(uint8_t txMode)
Ptr< SpectrumChannel > m_channel
std::list< Ptr< LteControlMessage > > m_txControlMessageList
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:244
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:162
expectedTbs_t m_expectedTbs
virtual void DoDispose(void)
Destructor implementation.
Definition: object.cc:346
Ptr< LteInterference > m_interferenceData
Ptr< SpectrumChannel > GetChannel()
LtePhyRxDataEndErrorCallback m_ltePhyRxDataEndErrorCallback
See section 4.3.12 ulInfoListElement.
static TbStats_t GetTbDecodificationStats(const SpectrumValue &sinr, const std::vector< int > &map, uint16_t size, uint8_t mcs, HarqProcessInfoList_t miHistory)
run the error-model algorithm for the specified TB
void AddCtrlSinrChunkProcessor(Ptr< LteChunkProcessor > p)
void SetNoisePowerSpectralDensity(Ptr< const SpectrumValue > noisePsd)
set the noise power spectral density
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
void SetDevice(Ptr< NetDevice > d)
Set the associated NetDevice instance.
std::list< Ptr< PacketBurst > > m_rxPacketBurstList
static const Time DL_CTRL_DURATION
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
void AddInterferenceCtrlChunkProcessor(Ptr< LteChunkProcessor > p)
LteChunkProcessor devoted to evaluate interference + noise power in control symbols of the subframe...
void SetLtePhyUlHarqFeedbackCallback(LtePhyUlHarqFeedbackCallback c)
set the callback for the UL HARQ feedback as part of the interconnections between the LteSpectrumPhy ...
void ChangeState(State newState)
std::list< Ptr< LteControlMessage > > m_rxControlMessageList
void SetLtePhyRxCtrlEndOkCallback(LtePhyRxCtrlEndOkCallback c)
set the callback for the successful end of a RX ctrl frame, as part of the interconnections between t...
void SetTxPowerSpectralDensity(Ptr< SpectrumValue > txPsd)
set the Power Spectral Density of outgoing signals in W/Hz.
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Definition: simulator.h:1238
void SetLtePhyRxCtrlEndErrorCallback(LtePhyRxCtrlEndErrorCallback c)
set the callback for the erroneous end of a RX ctrl frame, as part of the interconnections between th...
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:919
Ptr< AntennaModel > m_antenna
TracedCallback< Ptr< const PacketBurst > > m_phyRxStartTrace
LtePhyRxDataEndOkCallback m_ltePhyRxDataEndOkCallback
void AddDataPowerChunkProcessor(Ptr< LteChunkProcessor > p)
static uint8_t TxMode2LayerNum(uint8_t txMode)
Definition: lte-common.cc:169
static const double EffectiveCodingRate[29]
bool StartTxDataFrame(Ptr< PacketBurst > pb, std::list< Ptr< LteControlMessage > > ctrlMsgList, Time duration)
Start a transmission of data frame in DL and UL.
uint8_t m_layer
the layer (cw) of the transmission
Definition: lte-common.h:149
Ptr< MobilityModel > m_mobility
void SetHarqPhyModule(Ptr< LteHarqPhy > harq)
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
static double GetPcfichPdcchError(const SpectrumValue &sinr)
run the error-model algorithm for the specified PCFICH+PDCCH channels
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:252
#define list
virtual void DoDispose()
Destructor implementation.
See section 4.3.23 dlInfoListElement.
bool operator<(const int64x64_t &lhs, const int64x64_t &rhs)
Less than operator.
Definition: int64x64-128.h:356
Ptr< SpectrumValue > m_txPsd
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:42
void SetAntenna(Ptr< AntennaModel > a)
set the AntennaModel to be used
uint16_t m_rnti
uint8_t m_ndi
new data indicator flag
Definition: lte-common.h:153
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void AddExpectedTb(uint16_t rnti, uint8_t ndi, uint16_t size, uint8_t mcs, std::vector< int > map, uint8_t layer, uint8_t harqId, uint8_t rv, bool downlink)
Ptr< const SpectrumModel > GetRxSpectrumModel() const
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
Ptr< AntennaModel > GetRxAntenna()
Get the AntennaModel used by the NetDevice for reception.
Ptr< MobilityModel > GetMobility()
Get the associated MobilityModel instance.
Ptr< const SpectrumModel > m_rxSpectrumModel
LtePhyDlHarqFeedbackCallback m_ltePhyDlHarqFeedbackCallback
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
std::vector< enum HarqStatus_e > m_harqStatus
Ptr< PacketBurst > m_txPacketBurst
void SetChannel(Ptr< SpectrumChannel > c)
Set the channel attached to this device.
void AddInterferenceDataChunkProcessor(Ptr< LteChunkProcessor > p)
LteChunkProcessor devoted to evaluate interference + noise power in data symbols of the subframe...
uint8_t m_txMode
the transmission Mode
Definition: lte-common.h:148
uint16_t m_size
Size of transport block.
Definition: lte-common.h:151
void Reset()
reset the internal state
TracedCallback< PhyReceptionStatParameters > m_ulPhyReception
Trace information regarding PHY stats from UL Rx perspective PhyReceptionStatParameters (see lte-comm...
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:224
Ptr< NetDevice > m_device
uint8_t m_correctness
correctness of the TB received
Definition: lte-common.h:154
LtePhyUlHarqFeedbackCallback m_ltePhyUlHarqFeedbackCallback
static TypeId GetTypeId(void)
TracedCallback< Ptr< const Packet > > m_phyRxEndOkTrace
bool StartTxDlCtrlFrame(std::list< Ptr< LteControlMessage > > ctrlMsgList, bool pss)
Start a transmission of control frame in DL.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:90
uint16_t m_rnti
C-RNTI scheduled.
Definition: lte-common.h:147
uint16_t m_cellId
Cell ID of the attached Enb.
Definition: lte-common.h:145
void SetLtePhyDlHarqFeedbackCallback(LtePhyDlHarqFeedbackCallback c)
set the callback for the DL HARQ feedback as part of the interconnections between the LteSpectrumPhy ...
Ptr< NetDevice > GetDevice() const
Get the associated NetDevice instance.
void SetLtePhyRxPssCallback(LtePhyRxPssCallback c)
set the callback for the reception of the PSS as part of the interconnections between the LteSpectrum...
LtePhyRxPssCallback m_ltePhyRxPssCallback
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:236
bool operator==(const EventId &a, const EventId &b)
Definition: event-id.cc:95
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:53
Tag used to define the RNTI and LC id for each MAC packet trasmitted.
void SetLtePhyRxDataEndOkCallback(LtePhyRxDataEndOkCallback c)
set the callback for the successful end of a RX, as part of the interconnections between the PHY and ...
void AddRsPowerChunkProcessor(Ptr< LteChunkProcessor > p)
void SetMobility(Ptr< MobilityModel > m)
Set the mobility model associated with this device.
enum ns3::UlInfoListElement_s::ReceptionStatus_e m_receptionStatus
void StartRx(Ptr< SpectrumSignalParameters > params)
Notify the SpectrumPhy instance of an incoming signal.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
Definition: double.h:41
TracedCallback< Ptr< const PacketBurst > > m_phyTxStartTrace
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:191
Set of values corresponding to a given SpectrumModel.
uint64_t m_imsi
IMSI of the scheduled UE.
Definition: lte-common.h:146
void StartRxDlCtrl(Ptr< LteSpectrumSignalParametersDlCtrlFrame > lteDlCtrlRxParams)
a unique identifier for an interface.
Definition: type-id.h:58
uint8_t GetLayer(void) const
void UpdateSinrPerceived(const SpectrumValue &sinr)
int64_t GetMilliSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:345
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:904
bool StartTxUlSrsFrame()
Start a transmission of control frame in UL.
void SetCellId(uint16_t cellId)
SpectrumValue m_sinrPerceived
std::vector< double > m_txModeGain
TracedCallback< PhyReceptionStatParameters > m_dlPhyReception
Trace information regarding PHY stats from DL Rx perspective PhyReceptionStatParameters (see lte-comm...
std::vector< HarqProcessInfoElement_t > HarqProcessInfoList_t
Definition: lte-harq-phy.h:47