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 
49 static const Time UL_SRS_DURATION = NanoSeconds (71429 -1);
50 
53 static const Time DL_CTRL_DURATION = NanoSeconds (214286 -1);
54 
56 static const double EffectiveCodingRate[29] = {
57  0.08,
58  0.1,
59  0.11,
60  0.15,
61  0.19,
62  0.24,
63  0.3,
64  0.37,
65  0.44,
66  0.51,
67  0.3,
68  0.33,
69  0.37,
70  0.42,
71  0.48,
72  0.54,
73  0.6,
74  0.43,
75  0.45,
76  0.5,
77  0.55,
78  0.6,
79  0.65,
80  0.7,
81  0.75,
82  0.8,
83  0.85,
84  0.89,
85  0.92
86 };
87 
88 
89 
90 
92 {
93 }
94 
95 TbId_t::TbId_t (const uint16_t a, const uint8_t b)
96 : m_rnti (a),
97  m_layer (b)
98 {
99 }
100 
108 bool
109 operator == (const TbId_t &a, const TbId_t &b)
110 {
111  return ( (a.m_rnti == b.m_rnti) && (a.m_layer == b.m_layer) );
112 }
113 
121 bool
122 operator < (const TbId_t& a, const TbId_t& b)
123 {
124  return ( (a.m_rnti < b.m_rnti) || ( (a.m_rnti == b.m_rnti) && (a.m_layer < b.m_layer) ) );
125 }
126 
127 NS_OBJECT_ENSURE_REGISTERED (LteSpectrumPhy);
128 
130  : m_state (IDLE),
131  m_cellId (0),
132  m_componentCarrierId (0),
133  m_transmissionMode (0),
134  m_layersNum (1)
135 {
136  NS_LOG_FUNCTION (this);
137  m_random = CreateObject<UniformRandomVariable> ();
138  m_random->SetAttribute ("Min", DoubleValue (0.0));
139  m_random->SetAttribute ("Max", DoubleValue (1.0));
140  m_interferenceData = CreateObject<LteInterference> ();
141  m_interferenceCtrl = CreateObject<LteInterference> ();
142 
143  for (uint8_t i = 0; i < 7; i++)
144  {
145  m_txModeGain.push_back (1.0);
146  }
147 }
148 
149 
151 {
152  NS_LOG_FUNCTION (this);
153  m_expectedTbs.clear ();
154  m_txModeGain.clear ();
155 }
156 
158 {
159  NS_LOG_FUNCTION (this);
160  m_channel = 0;
161  m_mobility = 0;
162  m_device = 0;
163  m_interferenceData->Dispose ();
164  m_interferenceData = 0;
165  m_interferenceCtrl->Dispose ();
166  m_interferenceCtrl = 0;
167  m_ltePhyRxDataEndErrorCallback = MakeNullCallback< void > ();
168  m_ltePhyRxDataEndOkCallback = MakeNullCallback< void, Ptr<Packet> > ();
169  m_ltePhyRxCtrlEndOkCallback = MakeNullCallback< void, std::list<Ptr<LteControlMessage> > > ();
170  m_ltePhyRxCtrlEndErrorCallback = MakeNullCallback< void > ();
171  m_ltePhyDlHarqFeedbackCallback = MakeNullCallback< void, DlInfoListElement_s > ();
172  m_ltePhyUlHarqFeedbackCallback = MakeNullCallback< void, UlInfoListElement_s > ();
173  m_ltePhyRxPssCallback = MakeNullCallback< void, uint16_t, Ptr<SpectrumValue> > ();
175 }
176 
184 std::ostream& operator<< (std::ostream& os, LteSpectrumPhy::State s)
185 {
186  switch (s)
187  {
189  os << "IDLE";
190  break;
192  os << "RX_DATA";
193  break;
195  os << "RX_DL_CTRL";
196  break;
198  os << "TX_DATA";
199  break;
201  os << "TX_DL_CTRL";
202  break;
204  os << "TX_UL_SRS";
205  break;
206  default:
207  os << "UNKNOWN";
208  break;
209  }
210  return os;
211 }
212 
213 TypeId
215 {
216  static TypeId tid = TypeId ("ns3::LteSpectrumPhy")
218  .SetGroupName("Lte")
219  .AddTraceSource ("TxStart",
220  "Trace fired when a new transmission is started",
222  "ns3::PacketBurst::TracedCallback")
223  .AddTraceSource ("TxEnd",
224  "Trace fired when a previously started transmission is finished",
226  "ns3::PacketBurst::TracedCallback")
227  .AddTraceSource ("RxStart",
228  "Trace fired when the start of a signal is detected",
230  "ns3::PacketBurst::TracedCallback")
231  .AddTraceSource ("RxEndOk",
232  "Trace fired when a previously started RX terminates successfully",
234  "ns3::Packet::TracedCallback")
235  .AddTraceSource ("RxEndError",
236  "Trace fired when a previously started RX terminates with an error",
238  "ns3::Packet::TracedCallback")
239  .AddAttribute ("DataErrorModelEnabled",
240  "Activate/Deactivate the error model of data (TBs of PDSCH and PUSCH) [by default is active].",
241  BooleanValue (true),
244  .AddAttribute ("CtrlErrorModelEnabled",
245  "Activate/Deactivate the error model of control (PCFICH-PDCCH decodification) [by default is active].",
246  BooleanValue (true),
249  .AddTraceSource ("DlPhyReception",
250  "DL reception PHY layer statistics.",
252  "ns3::PhyReceptionStatParameters::TracedCallback")
253  .AddTraceSource ("UlPhyReception",
254  "DL reception PHY layer statistics.",
256  "ns3::PhyReceptionStatParameters::TracedCallback")
257  ;
258  return tid;
259 }
260 
261 
262 
265 {
266  NS_LOG_FUNCTION (this);
267  return m_device;
268 }
269 
270 
273 {
274  NS_LOG_FUNCTION (this);
275  return m_mobility;
276 }
277 
278 
279 void
281 {
282  NS_LOG_FUNCTION (this << d);
283  m_device = d;
284 }
285 
286 
287 void
289 {
290  NS_LOG_FUNCTION (this << m);
291  m_mobility = m;
292 }
293 
294 
295 void
297 {
298  NS_LOG_FUNCTION (this << c);
299  m_channel = c;
300 }
301 
304 {
305  return m_channel;
306 }
307 
310 {
311  return m_rxSpectrumModel;
312 }
313 
314 
315 void
317 {
318  NS_LOG_FUNCTION (this << txPsd);
319  NS_ASSERT (txPsd);
320  m_txPsd = txPsd;
321 }
322 
323 
324 void
326 {
327  NS_LOG_FUNCTION (this << noisePsd);
328  NS_ASSERT (noisePsd);
329  m_rxSpectrumModel = noisePsd->GetSpectrumModel ();
330  m_interferenceData->SetNoisePowerSpectralDensity (noisePsd);
331  m_interferenceCtrl->SetNoisePowerSpectralDensity (noisePsd);
332 }
333 
334 
335 void
337 {
338  NS_LOG_FUNCTION (this);
339  m_cellId = 0;
340  m_state = IDLE;
341  m_transmissionMode = 0;
342  m_layersNum = 1;
343  m_endTxEvent.Cancel ();
347  m_rxControlMessageList.clear ();
348  m_expectedTbs.clear ();
349  m_txControlMessageList.clear ();
350  m_rxPacketBurstList.clear ();
351  m_txPacketBurst = 0;
352  m_rxSpectrumModel = 0;
353 }
354 
355 
356 void
358 {
359  NS_LOG_FUNCTION (this);
361 }
362 
363 
364 void
366 {
367  NS_LOG_FUNCTION (this);
369 }
370 
371 void
373 {
374  NS_LOG_FUNCTION (this);
376 }
377 
378 void
380 {
381  NS_LOG_FUNCTION (this);
383 }
384 
385 
386 void
388 {
389  NS_LOG_FUNCTION (this);
391 }
392 
393 void
395 {
396  NS_LOG_FUNCTION (this);
398 }
399 
400 void
402 {
403  NS_LOG_FUNCTION (this);
405 }
406 
407 
410 {
411  return m_antenna;
412 }
413 
414 void
416 {
417  NS_LOG_FUNCTION (this << a);
418  m_antenna = a;
419 }
420 
421 void
423 {
424  ChangeState (newState);
425 }
426 
427 
428 void
430 {
431  NS_LOG_LOGIC (this << " state: " << m_state << " -> " << newState);
432  m_state = newState;
433 }
434 
435 
436 void
438 {
439  m_harqPhyModule = harq;
440 }
441 
442 
443 
444 
445 bool
447 {
448  NS_LOG_FUNCTION (this << pb);
449  NS_LOG_LOGIC (this << " state: " << m_state);
450 
451  m_phyTxStartTrace (pb);
452 
453  switch (m_state)
454  {
455  case RX_DATA:
456  case RX_DL_CTRL:
457  case RX_UL_SRS:
458  NS_FATAL_ERROR ("cannot TX while RX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
459  break;
460 
461  case TX_DATA:
462  case TX_DL_CTRL:
463  case TX_UL_SRS:
464  NS_FATAL_ERROR ("cannot TX while already TX: the MAC should avoid this");
465  break;
466 
467  case IDLE:
468  {
469  /*
470  m_txPsd must be set by the device, according to
471  (i) the available subchannel for transmission
472  (ii) the power transmission
473  */
474  NS_ASSERT (m_txPsd);
475  m_txPacketBurst = pb;
476 
477  // we need to convey some PHY meta information to the receiver
478  // to be used for simulation purposes (e.g., the CellId). This
479  // is done by setting the ctrlMsgList parameter of
480  // LteSpectrumSignalParametersDataFrame
483  Ptr<LteSpectrumSignalParametersDataFrame> txParams = Create<LteSpectrumSignalParametersDataFrame> ();
484  txParams->duration = duration;
485  txParams->txPhy = GetObject<SpectrumPhy> ();
486  txParams->txAntenna = m_antenna;
487  txParams->psd = m_txPsd;
488  txParams->packetBurst = pb;
489  txParams->ctrlMsgList = ctrlMsgList;
490  txParams->cellId = m_cellId;
491  m_channel->StartTx (txParams);
493  }
494  return false;
495  break;
496 
497  default:
498  NS_FATAL_ERROR ("unknown state");
499  return true;
500  break;
501  }
502 }
503 
504 bool
506 {
507  NS_LOG_FUNCTION (this << " PSS " << (uint16_t)pss);
508  NS_LOG_LOGIC (this << " state: " << m_state);
509 
510  switch (m_state)
511  {
512  case RX_DATA:
513  case RX_DL_CTRL:
514  case RX_UL_SRS:
515  NS_FATAL_ERROR ("cannot TX while RX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
516  break;
517 
518  case TX_DATA:
519  case TX_DL_CTRL:
520  case TX_UL_SRS:
521  NS_FATAL_ERROR ("cannot TX while already TX: the MAC should avoid this");
522  break;
523 
524  case IDLE:
525  {
526  /*
527  m_txPsd must be set by the device, according to
528  (i) the available subchannel for transmission
529  (ii) the power transmission
530  */
531  NS_ASSERT (m_txPsd);
532 
533  // we need to convey some PHY meta information to the receiver
534  // to be used for simulation purposes (e.g., the CellId). This
535  // is done by setting the cellId parameter of
536  // LteSpectrumSignalParametersDlCtrlFrame
539 
540  Ptr<LteSpectrumSignalParametersDlCtrlFrame> txParams = Create<LteSpectrumSignalParametersDlCtrlFrame> ();
541  txParams->duration = DL_CTRL_DURATION;
542  txParams->txPhy = GetObject<SpectrumPhy> ();
543  txParams->txAntenna = m_antenna;
544  txParams->psd = m_txPsd;
545  txParams->cellId = m_cellId;
546  txParams->pss = pss;
547  txParams->ctrlMsgList = ctrlMsgList;
548  m_channel->StartTx (txParams);
550  }
551  return false;
552  break;
553 
554  default:
555  NS_FATAL_ERROR ("unknown state");
556  return true;
557  break;
558  }
559 }
560 
561 
562 bool
564 {
565  NS_LOG_FUNCTION (this);
566  NS_LOG_LOGIC (this << " state: " << m_state);
567 
568  switch (m_state)
569  {
570  case RX_DATA:
571  case RX_DL_CTRL:
572  case RX_UL_SRS:
573  NS_FATAL_ERROR ("cannot TX while RX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
574  break;
575 
576  case TX_DL_CTRL:
577  case TX_DATA:
578  case TX_UL_SRS:
579  NS_FATAL_ERROR ("cannot TX while already TX: the MAC should avoid this");
580  break;
581 
582  case IDLE:
583  {
584  /*
585  m_txPsd must be set by the device, according to
586  (i) the available subchannel for transmission
587  (ii) the power transmission
588  */
589  NS_ASSERT (m_txPsd);
590  NS_LOG_LOGIC (this << " m_txPsd: " << *m_txPsd);
591 
592  // we need to convey some PHY meta information to the receiver
593  // to be used for simulation purposes (e.g., the CellId). This
594  // is done by setting the cellId parameter of
595  // LteSpectrumSignalParametersDlCtrlFrame
598  Ptr<LteSpectrumSignalParametersUlSrsFrame> txParams = Create<LteSpectrumSignalParametersUlSrsFrame> ();
599  txParams->duration = UL_SRS_DURATION;
600  txParams->txPhy = GetObject<SpectrumPhy> ();
601  txParams->txAntenna = m_antenna;
602  txParams->psd = m_txPsd;
603  txParams->cellId = m_cellId;
604  m_channel->StartTx (txParams);
606  }
607  return false;
608  break;
609 
610  default:
611  NS_FATAL_ERROR ("unknown state");
612  return true;
613  break;
614  }
615 }
616 
617 
618 
619 void
621 {
622  NS_LOG_FUNCTION (this);
623  NS_LOG_LOGIC (this << " state: " << m_state);
624 
627  m_txPacketBurst = 0;
628  ChangeState (IDLE);
629 }
630 
631 void
633 {
634  NS_LOG_FUNCTION (this);
635  NS_LOG_LOGIC (this << " state: " << m_state);
636 
638  NS_ASSERT (m_txPacketBurst == 0);
639  ChangeState (IDLE);
640 }
641 
642 void
644 {
645  NS_LOG_FUNCTION (this);
646  NS_LOG_LOGIC (this << " state: " << m_state);
647 
649  NS_ASSERT (m_txPacketBurst == 0);
650  ChangeState (IDLE);
651 }
652 
653 
654 
655 
656 void
658 {
659  NS_LOG_FUNCTION (this << spectrumRxParams);
660  NS_LOG_LOGIC (this << " state: " << m_state);
661 
662  Ptr <const SpectrumValue> rxPsd = spectrumRxParams->psd;
663  Time duration = spectrumRxParams->duration;
664 
665  // the device might start RX only if the signal is of a type
666  // understood by this device - in this case, an LTE signal.
667  Ptr<LteSpectrumSignalParametersDataFrame> lteDataRxParams = DynamicCast<LteSpectrumSignalParametersDataFrame> (spectrumRxParams);
668  Ptr<LteSpectrumSignalParametersDlCtrlFrame> lteDlCtrlRxParams = DynamicCast<LteSpectrumSignalParametersDlCtrlFrame> (spectrumRxParams);
669  Ptr<LteSpectrumSignalParametersUlSrsFrame> lteUlSrsRxParams = DynamicCast<LteSpectrumSignalParametersUlSrsFrame> (spectrumRxParams);
670  if (lteDataRxParams != 0)
671  {
672  m_interferenceData->AddSignal (rxPsd, duration);
673  StartRxData (lteDataRxParams);
674  }
675  else if (lteDlCtrlRxParams!=0)
676  {
677  m_interferenceCtrl->AddSignal (rxPsd, duration);
678  StartRxDlCtrl (lteDlCtrlRxParams);
679  }
680  else if (lteUlSrsRxParams!=0)
681  {
682  m_interferenceCtrl->AddSignal (rxPsd, duration);
683  StartRxUlSrs (lteUlSrsRxParams);
684  }
685  else
686  {
687  // other type of signal (could be 3G, GSM, whatever) -> interference
688  m_interferenceData->AddSignal (rxPsd, duration);
689  m_interferenceCtrl->AddSignal (rxPsd, duration);
690  }
691 }
692 
693 void
695 {
696  NS_LOG_FUNCTION (this);
697  switch (m_state)
698  {
699  case TX_DATA:
700  case TX_DL_CTRL:
701  case TX_UL_SRS:
702  NS_FATAL_ERROR ("cannot RX while TX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
703  break;
704  case RX_DL_CTRL:
705  NS_FATAL_ERROR ("cannot RX Data while receiving control");
706  break;
707  case IDLE:
708  case RX_DATA:
709  // the behavior is similar when
710  // we're IDLE or RX because we can receive more signals
711  // simultaneously (e.g., at the eNB).
712  {
713  // To check if we're synchronized to this signal, we check
714  // for the CellId which is reported in the
715  // LteSpectrumSignalParametersDataFrame
716  if (params->cellId == m_cellId)
717  {
718  NS_LOG_LOGIC (this << " synchronized with this signal (cellId=" << params->cellId << ")");
719  if ((m_rxPacketBurstList.empty ())&&(m_rxControlMessageList.empty ()))
720  {
721  NS_ASSERT (m_state == IDLE);
722  // first transmission, i.e., we're IDLE and we
723  // start RX
725  m_firstRxDuration = params->duration;
726  NS_LOG_LOGIC (this << " scheduling EndRx with delay " << params->duration.GetSeconds () << "s");
728  }
729  else
730  {
732  // sanity check: if there are multiple RX events, they
733  // should occur at the same time and have the same
734  // duration, otherwise the interference calculation
735  // won't be correct
737  && (m_firstRxDuration == params->duration));
738  }
739 
741  if (params->packetBurst)
742  {
743  m_rxPacketBurstList.push_back (params->packetBurst);
744  m_interferenceData->StartRx (params->psd);
745 
746  m_phyRxStartTrace (params->packetBurst);
747  }
748  NS_LOG_DEBUG (this << " insert msgs " << params->ctrlMsgList.size ());
749  m_rxControlMessageList.insert (m_rxControlMessageList.end (), params->ctrlMsgList.begin (), params->ctrlMsgList.end ());
750 
751  NS_LOG_LOGIC (this << " numSimultaneousRxEvents = " << m_rxPacketBurstList.size ());
752  }
753  else
754  {
755  NS_LOG_LOGIC (this << " not in sync with this signal (cellId="
756  << params->cellId << ", m_cellId=" << m_cellId << ")");
757  }
758  }
759  break;
760 
761  default:
762  NS_FATAL_ERROR ("unknown state");
763  break;
764  }
765 
766  NS_LOG_LOGIC (this << " state: " << m_state);
767 }
768 
769 
770 
771 void
773 {
774  NS_LOG_FUNCTION (this);
775 
776  // To check if we're synchronized to this signal, we check
777  // for the CellId which is reported in the
778  // LteSpectrumSignalParametersDlCtrlFrame
779  uint16_t cellId;
780  NS_ASSERT (lteDlCtrlRxParams != 0);
781  cellId = lteDlCtrlRxParams->cellId;
782 
783  switch (m_state)
784  {
785  case TX_DATA:
786  case TX_DL_CTRL:
787  case TX_UL_SRS:
788  case RX_DATA:
789  case RX_UL_SRS:
790  NS_FATAL_ERROR ("unexpected event in state " << m_state);
791  break;
792 
793  case RX_DL_CTRL:
794  case IDLE:
795 
796  // common code for the two states
797  // check presence of PSS for UE measuerements
798  if (lteDlCtrlRxParams->pss == true)
799  {
801  {
802  m_ltePhyRxPssCallback (cellId, lteDlCtrlRxParams->psd);
803  }
804  }
805 
806  // differentiated code for the two states
807  switch (m_state)
808  {
809  case RX_DL_CTRL:
810  NS_ASSERT_MSG (m_cellId != cellId, "any other DlCtrl should be from a different cell");
811  NS_LOG_LOGIC (this << " ignoring other DlCtrl (cellId="
812  << cellId << ", m_cellId=" << m_cellId << ")");
813  break;
814 
815  case IDLE:
816  if (cellId == m_cellId)
817  {
818  NS_LOG_LOGIC (this << " synchronized with this signal (cellId=" << cellId << ")");
819 
822  m_firstRxDuration = lteDlCtrlRxParams->duration;
823  NS_LOG_LOGIC (this << " scheduling EndRx with delay " << lteDlCtrlRxParams->duration);
824 
825  // store the DCIs
826  m_rxControlMessageList = lteDlCtrlRxParams->ctrlMsgList;
827  m_endRxDlCtrlEvent = Simulator::Schedule (lteDlCtrlRxParams->duration, &LteSpectrumPhy::EndRxDlCtrl, this);
829  m_interferenceCtrl->StartRx (lteDlCtrlRxParams->psd);
830  }
831  else
832  {
833  NS_LOG_LOGIC (this << " not synchronizing with this signal (cellId="
834  << cellId << ", m_cellId=" << m_cellId << ")");
835  }
836  break;
837 
838  default:
839  NS_FATAL_ERROR ("unexpected event in state " << m_state);
840  break;
841  }
842  break; // case RX_DL_CTRL or IDLE
843 
844  default:
845  NS_FATAL_ERROR ("unknown state");
846  break;
847  }
848 
849  NS_LOG_LOGIC (this << " state: " << m_state);
850 }
851 
852 
853 
854 
855 void
857 {
858  NS_LOG_FUNCTION (this);
859  switch (m_state)
860  {
861  case TX_DATA:
862  case TX_DL_CTRL:
863  case TX_UL_SRS:
864  NS_FATAL_ERROR ("cannot RX while TX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
865  break;
866 
867  case RX_DATA:
868  case RX_DL_CTRL:
869  NS_FATAL_ERROR ("cannot RX SRS while receiving something else");
870  break;
871 
872  case IDLE:
873  case RX_UL_SRS:
874  // the behavior is similar when
875  // we're IDLE or RX_UL_SRS because we can receive more signals
876  // simultaneously at the eNB
877  {
878  // To check if we're synchronized to this signal, we check
879  // for the CellId which is reported in the
880  // LteSpectrumSignalParametersDlCtrlFrame
881  uint16_t cellId;
882  cellId = lteUlSrsRxParams->cellId;
883  if (cellId == m_cellId)
884  {
885  NS_LOG_LOGIC (this << " synchronized with this signal (cellId=" << cellId << ")");
886  if (m_state == IDLE)
887  {
888  // first transmission, i.e., we're IDLE and we
889  // start RX
892  m_firstRxDuration = lteUlSrsRxParams->duration;
893  NS_LOG_LOGIC (this << " scheduling EndRx with delay " << lteUlSrsRxParams->duration);
894 
895  m_endRxUlSrsEvent = Simulator::Schedule (lteUlSrsRxParams->duration, &LteSpectrumPhy::EndRxUlSrs, this);
896  }
897  else if (m_state == RX_UL_SRS)
898  {
899  // sanity check: if there are multiple RX events, they
900  // should occur at the same time and have the same
901  // duration, otherwise the interference calculation
902  // won't be correct
904  && (m_firstRxDuration == lteUlSrsRxParams->duration));
905  }
907  m_interferenceCtrl->StartRx (lteUlSrsRxParams->psd);
908  }
909  else
910  {
911  NS_LOG_LOGIC (this << " not in sync with this signal (cellId="
912  << cellId << ", m_cellId=" << m_cellId << ")");
913  }
914  }
915  break;
916 
917  default:
918  NS_FATAL_ERROR ("unknown state");
919  break;
920  }
921 
922  NS_LOG_LOGIC (this << " state: " << m_state);
923 }
924 
925 
926 void
928 {
929  NS_LOG_FUNCTION (this << sinr);
930  m_sinrPerceived = sinr;
931 }
932 
933 
934 void
935 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)
936 {
937  NS_LOG_FUNCTION (this << " rnti: " << rnti << " NDI " << (uint16_t)ndi << " size " << size << " mcs " << (uint16_t)mcs << " layer " << (uint16_t)layer << " rv " << (uint16_t)rv);
938  TbId_t tbId;
939  tbId.m_rnti = rnti;
940  tbId.m_layer = layer;
941  expectedTbs_t::iterator it;
942  it = m_expectedTbs.find (tbId);
943  if (it != m_expectedTbs.end ())
944  {
945  // migth be a TB of an unreceived packet (due to high progpalosses)
946  m_expectedTbs.erase (it);
947  }
948  // insert new entry
949  tbInfo_t tbInfo = {ndi, size, mcs, map, harqId, rv, 0.0, downlink, false, false};
950  m_expectedTbs.insert (std::pair<TbId_t, tbInfo_t> (tbId,tbInfo));
951 }
952 
953 
954 void
956 {
957  NS_LOG_FUNCTION (this);
958  NS_LOG_LOGIC (this << " state: " << m_state);
959 
961 
962  // this will trigger CQI calculation and Error Model evaluation
963  // as a side effect, the error model should update the error status of all TBs
964  m_interferenceData->EndRx ();
965  NS_LOG_DEBUG (this << " No. of burts " << m_rxPacketBurstList.size ());
966  NS_LOG_DEBUG (this << " Expected TBs " << m_expectedTbs.size ());
967  expectedTbs_t::iterator itTb = m_expectedTbs.begin ();
968 
969  // apply transmission mode gain
970  NS_LOG_DEBUG (this << " txMode " << (uint16_t)m_transmissionMode << " gain " << m_txModeGain.at (m_transmissionMode));
973 
974  while (itTb!=m_expectedTbs.end ())
975  {
976  if ((m_dataErrorModelEnabled)&&(m_rxPacketBurstList.size ()>0)) // avoid to check for errors when there is no actual data transmitted
977  {
978  // retrieve HARQ info
979  HarqProcessInfoList_t harqInfoList;
980  if ((*itTb).second.ndi == 0)
981  {
982  // TB retxed: retrieve HARQ history
983  uint16_t ulHarqId = 0;
984  if ((*itTb).second.downlink)
985  {
986  harqInfoList = m_harqPhyModule->GetHarqProcessInfoDl ((*itTb).second.harqProcessId, (*itTb).first.m_layer);
987  }
988  else
989  {
990  harqInfoList = m_harqPhyModule->GetHarqProcessInfoUl ((*itTb).first.m_rnti, ulHarqId);
991  }
992  }
993  TbStats_t tbStats = LteMiErrorModel::GetTbDecodificationStats (m_sinrPerceived, (*itTb).second.rbBitmap, (*itTb).second.size, (*itTb).second.mcs, harqInfoList);
994  (*itTb).second.mi = tbStats.mi;
995  (*itTb).second.corrupt = m_random->GetValue () > tbStats.tbler ? false : true;
996  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);
997  // fire traces on DL/UL reception PHY stats
1000  params.m_cellId = m_cellId;
1001  params.m_imsi = 0; // it will be set by DlPhyTransmissionCallback in LteHelper
1002  params.m_rnti = (*itTb).first.m_rnti;
1003  params.m_txMode = m_transmissionMode;
1004  params.m_layer = (*itTb).first.m_layer;
1005  params.m_mcs = (*itTb).second.mcs;
1006  params.m_size = (*itTb).second.size;
1007  params.m_rv = (*itTb).second.rv;
1008  params.m_ndi = (*itTb).second.ndi;
1009  params.m_correctness = (uint8_t)!(*itTb).second.corrupt;
1010  params.m_ccId = m_componentCarrierId;
1011  if ((*itTb).second.downlink)
1012  {
1013  // DL
1014  m_dlPhyReception (params);
1015  }
1016  else
1017  {
1018  // UL
1019  params.m_rv = harqInfoList.size ();
1020  m_ulPhyReception (params);
1021  }
1022  }
1023 
1024  itTb++;
1025  }
1026  std::map <uint16_t, DlInfoListElement_s> harqDlInfoMap;
1027  for (std::list<Ptr<PacketBurst> >::const_iterator i = m_rxPacketBurstList.begin ();
1028  i != m_rxPacketBurstList.end (); ++i)
1029  {
1030  for (std::list<Ptr<Packet> >::const_iterator j = (*i)->Begin (); j != (*i)->End (); ++j)
1031  {
1032  // retrieve TB info of this packet
1033  LteRadioBearerTag tag;
1034  (*j)->PeekPacketTag (tag);
1035  TbId_t tbId;
1036  tbId.m_rnti = tag.GetRnti ();
1037  tbId.m_layer = tag.GetLayer ();
1038  itTb = m_expectedTbs.find (tbId);
1039  NS_LOG_INFO (this << " Packet of " << tbId.m_rnti << " layer " << (uint16_t) tag.GetLayer ());
1040  if (itTb!=m_expectedTbs.end ())
1041  {
1042  if (!(*itTb).second.corrupt)
1043  {
1044  m_phyRxEndOkTrace (*j);
1045 
1047  {
1049  }
1050  }
1051  else
1052  {
1053  // TB received with errors
1054  m_phyRxEndErrorTrace (*j);
1055  }
1056 
1057  // send HARQ feedback (if not already done for this TB)
1058  if (!(*itTb).second.harqFeedbackSent)
1059  {
1060  (*itTb).second.harqFeedbackSent = true;
1061  if (!(*itTb).second.downlink)
1062  {
1063  UlInfoListElement_s harqUlInfo;
1064  harqUlInfo.m_rnti = tbId.m_rnti;
1065  harqUlInfo.m_tpc = 0;
1066  if ((*itTb).second.corrupt)
1067  {
1069  NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " send UL-HARQ-NACK");
1070  m_harqPhyModule->UpdateUlHarqProcessStatus (tbId.m_rnti, (*itTb).second.mi, (*itTb).second.size, (*itTb).second.size / EffectiveCodingRate [(*itTb).second.mcs]);
1071  }
1072  else
1073  {
1075  NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " send UL-HARQ-ACK");
1076  m_harqPhyModule->ResetUlHarqProcessStatus (tbId.m_rnti, (*itTb).second.harqProcessId);
1077  }
1079  {
1080  m_ltePhyUlHarqFeedbackCallback (harqUlInfo);
1081  }
1082  }
1083  else
1084  {
1085  std::map <uint16_t, DlInfoListElement_s>::iterator itHarq = harqDlInfoMap.find (tbId.m_rnti);
1086  if (itHarq==harqDlInfoMap.end ())
1087  {
1088  DlInfoListElement_s harqDlInfo;
1089  harqDlInfo.m_harqStatus.resize (m_layersNum, DlInfoListElement_s::ACK);
1090  harqDlInfo.m_rnti = tbId.m_rnti;
1091  harqDlInfo.m_harqProcessId = (*itTb).second.harqProcessId;
1092  if ((*itTb).second.corrupt)
1093  {
1094  harqDlInfo.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::NACK;
1095  NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " harqId " << (uint16_t)(*itTb).second.harqProcessId << " layer " <<(uint16_t)tbId.m_layer << " send DL-HARQ-NACK");
1096  m_harqPhyModule->UpdateDlHarqProcessStatus ((*itTb).second.harqProcessId, tbId.m_layer, (*itTb).second.mi, (*itTb).second.size, (*itTb).second.size / EffectiveCodingRate [(*itTb).second.mcs]);
1097  }
1098  else
1099  {
1100 
1101  harqDlInfo.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::ACK;
1102  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");
1103  m_harqPhyModule->ResetDlHarqProcessStatus ((*itTb).second.harqProcessId);
1104  }
1105  harqDlInfoMap.insert (std::pair <uint16_t, DlInfoListElement_s> (tbId.m_rnti, harqDlInfo));
1106  }
1107  else
1108  {
1109  if ((*itTb).second.corrupt)
1110  {
1111  (*itHarq).second.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::NACK;
1112  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");
1113  m_harqPhyModule->UpdateDlHarqProcessStatus ((*itTb).second.harqProcessId, tbId.m_layer, (*itTb).second.mi, (*itTb).second.size, (*itTb).second.size / EffectiveCodingRate [(*itTb).second.mcs]);
1114  }
1115  else
1116  {
1117  NS_ASSERT_MSG (tbId.m_layer < (*itHarq).second.m_harqStatus.size (), " layer " << (uint16_t)tbId.m_layer);
1118  (*itHarq).second.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::ACK;
1119  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");
1120  m_harqPhyModule->ResetDlHarqProcessStatus ((*itTb).second.harqProcessId);
1121  }
1122  }
1123  } // end if ((*itTb).second.downlink) HARQ
1124  } // end if (!(*itTb).second.harqFeedbackSent)
1125  }
1126  }
1127  }
1128 
1129  // send DL HARQ feedback to LtePhy
1130  std::map <uint16_t, DlInfoListElement_s>::iterator itHarq;
1131  for (itHarq = harqDlInfoMap.begin (); itHarq != harqDlInfoMap.end (); itHarq++)
1132  {
1134  {
1135  m_ltePhyDlHarqFeedbackCallback ((*itHarq).second);
1136  }
1137  }
1138  // forward control messages of this frame to LtePhy
1139  if (!m_rxControlMessageList.empty ())
1140  {
1142  {
1144  }
1145  }
1146  ChangeState (IDLE);
1147  m_rxPacketBurstList.clear ();
1148  m_rxControlMessageList.clear ();
1149  m_expectedTbs.clear ();
1150 }
1151 
1152 
1153 void
1155 {
1156  NS_LOG_FUNCTION (this);
1157  NS_LOG_LOGIC (this << " state: " << m_state);
1158 
1160 
1161  // this will trigger CQI calculation and Error Model evaluation
1162  // as a side effect, the error model should update the error status of all TBs
1163  m_interferenceCtrl->EndRx ();
1164  // apply transmission mode gain
1165  NS_LOG_DEBUG (this << " txMode " << (uint16_t)m_transmissionMode << " gain " << m_txModeGain.at (m_transmissionMode));
1167  if (m_transmissionMode>0)
1168  {
1169  // in case of MIMO, ctrl is always txed as TX diversity
1170  m_sinrPerceived *= m_txModeGain.at (1);
1171  }
1172 // m_sinrPerceived *= m_txModeGain.at (m_transmissionMode);
1173  bool error = false;
1175  {
1177  error = m_random->GetValue () > errorRate ? false : true;
1178  NS_LOG_DEBUG (this << " PCFICH-PDCCH Decodification, errorRate " << errorRate << " error " << error);
1179  }
1180 
1181  if (!error)
1182  {
1184  {
1185  NS_LOG_DEBUG (this << " PCFICH-PDCCH Rxed OK");
1187  }
1188  }
1189  else
1190  {
1192  {
1193  NS_LOG_DEBUG (this << " PCFICH-PDCCH Error");
1195  }
1196  }
1197  ChangeState (IDLE);
1198  m_rxControlMessageList.clear ();
1199 }
1200 
1201 void
1203 {
1205  ChangeState (IDLE);
1206  m_interferenceCtrl->EndRx ();
1207  // nothing to do (used only for SRS at this stage)
1208 }
1209 
1210 void
1211 LteSpectrumPhy::SetCellId (uint16_t cellId)
1212 {
1213  m_cellId = cellId;
1214 }
1215 
1216 void
1217 LteSpectrumPhy::SetComponentCarrierId (uint8_t componentCarrierId)
1218 {
1219  m_componentCarrierId = componentCarrierId;
1220 }
1221 
1222 void
1224 {
1225  m_interferenceCtrl->AddRsPowerChunkProcessor (p);
1226 }
1227 
1228 void
1230 {
1231  m_interferenceData->AddRsPowerChunkProcessor (p);
1232 }
1233 
1234 void
1236 {
1237  m_interferenceData->AddSinrChunkProcessor (p);
1238 }
1239 
1240 void
1242 {
1243  m_interferenceCtrl->AddInterferenceChunkProcessor (p);
1244 }
1245 
1246 void
1248 {
1249  m_interferenceData->AddInterferenceChunkProcessor (p);
1250 }
1251 
1252 void
1254 {
1255  m_interferenceCtrl->AddSinrChunkProcessor (p);
1256 }
1257 
1258 void
1260 {
1261  NS_LOG_FUNCTION (this << (uint16_t) txMode);
1262  NS_ASSERT_MSG (txMode < m_txModeGain.size (), "TransmissionMode not available: 1.." << m_txModeGain.size ());
1263  m_transmissionMode = txMode;
1265 }
1266 
1267 
1268 void
1269 LteSpectrumPhy::SetTxModeGain (uint8_t txMode, double gain)
1270 {
1271  NS_LOG_FUNCTION (this << " txmode " << (uint16_t)txMode << " gain " << gain);
1272  // convert to linear
1273  gain = std::pow (10.0, (gain / 10.0));
1274  if (m_txModeGain.size () < txMode)
1275  {
1276  m_txModeGain.resize (txMode);
1277  }
1278  std::vector <double> temp;
1279  temp = m_txModeGain;
1280  m_txModeGain.clear ();
1281  for (uint8_t i = 0; i < temp.size (); i++)
1282  {
1283  if (i==txMode-1)
1284  {
1285  m_txModeGain.push_back (gain);
1286  }
1287  else
1288  {
1289  m_txModeGain.push_back (temp.at (i));
1290  }
1291  }
1292 }
1293 
1294 int64_t
1296 {
1297  NS_LOG_FUNCTION (this << stream);
1298  m_random->SetStream (stream);
1299  return 1;
1300 }
1301 
1302 
1303 
1304 } // namespace ns3
static const Time UL_SRS_DURATION
duration of SRS portion of UL subframe = 1 symbol for SRS -1ns as margin to avoid overlapping simula...
Ptr< LteHarqPhy > m_harqPhyModule
the HARQ phy module
void EndTxData()
End transmit data function.
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 the RngStream.
void StartRxData(Ptr< LteSpectrumSignalParametersDataFrame > params)
Start receive data function.
Abstract base class for Spectrum-aware PHY layers.
Definition: spectrum-phy.h:45
Ptr< LteInterference > m_interferenceCtrl
the control interference
AttributeValue implementation for Boolean.
Definition: boolean.h:36
LtePhyRxCtrlEndOkCallback m_ltePhyRxCtrlEndOkCallback
the LTE phy receive control end ok callback
uint8_t m_mcs
MCS for transport block.
Definition: lte-common.h:220
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
TracedCallback< Ptr< const PacketBurst > > m_phyTxEndTrace
the phy transmit end trace callback
void AddDataSinrChunkProcessor(Ptr< LteChunkProcessor > p)
Time m_firstRxStart
the first receive start
void SetState(State newState)
Set the state of the phy layer.
double tbler
tbler
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:84
TbStats_t structure.
void StartRxUlSrs(Ptr< LteSpectrumSignalParametersUlSrsFrame > lteUlSrsRxParams)
Start receive UL SRS function.
#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:222
TracedCallback< Ptr< const Packet > > m_phyRxEndErrorTrace
the phy receive end error trace callback
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)
Set transmit mode gain function
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
LtePhyRxCtrlEndErrorCallback m_ltePhyRxCtrlEndErrorCallback
the LTE phy receive control end error callback
void SetTransmissionMode(uint8_t txMode)
Ptr< SpectrumChannel > m_channel
the channel
std::list< Ptr< LteControlMessage > > m_txControlMessageList
the transmit control message list
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:278
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:162
expectedTbs_t m_expectedTbs
the expected TBS
virtual void DoDispose(void)
Destructor implementation.
Definition: object.cc:346
int64_t m_timestamp
in millisecond
Definition: lte-common.h:214
Ptr< LteInterference > m_interferenceData
the data interference
Ptr< SpectrumChannel > GetChannel()
LtePhyRxDataEndErrorCallback m_ltePhyRxDataEndErrorCallback
the LTE phy receive data end error callback
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
the receive burst list
static const Time DL_CTRL_DURATION
duration of the control portion of a subframe = 0.001 / 14 * 3 (ctrl fixed to 3 symbols) -1ns as marg...
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
bool operator<(const EventId &a, const EventId &b)
Definition: event-id.h:153
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 EndRxData()
End receive data function.
void ChangeState(State newState)
Change state function
std::list< Ptr< LteControlMessage > > m_rxControlMessageList
the receive control message list
void SetLtePhyRxCtrlEndOkCallback(LtePhyRxCtrlEndOkCallback c)
set the callback for the successful end of a RX ctrl frame, as part of the interconnections between t...
Time m_firstRxDuration
the first receive duration
void SetTxPowerSpectralDensity(Ptr< SpectrumValue > txPsd)
set the Power Spectral Density of outgoing signals in W/Hz.
uint16_t GetRnti(void) const
Get RNTI function.
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Definition: simulator.h:1381
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:1038
Ptr< AntennaModel > m_antenna
the antenna model
TracedCallback< Ptr< const PacketBurst > > m_phyRxStartTrace
the phy receive start trace callback
uint8_t m_componentCarrierId
the component carrier ID
LtePhyRxDataEndOkCallback m_ltePhyRxDataEndOkCallback
the LTE phy receive data end ok callback
void EndTxUlSrs()
End transmit UL SRS function.
void AddDataPowerChunkProcessor(Ptr< LteChunkProcessor > p)
static uint8_t TxMode2LayerNum(uint8_t txMode)
Transmit mode 2 layer number.
Definition: lte-common.cc:212
void EndTxDlCtrl()
End transmit DL control function.
static const double EffectiveCodingRate[29]
Effective coding rate.
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_transmissionMode
for UEs: store the transmission mode
uint8_t m_layer
the layer (cw) of the transmission
Definition: lte-common.h:219
Ptr< MobilityModel > m_mobility
the modility model
void SetHarqPhyModule(Ptr< LteHarqPhy > harq)
Set HARQ phy function.
Ptr< NetDevice > GetDevice() const
Get the associated NetDevice instance.
uint8_t m_layersNum
layers num
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 list
State m_state
the state
virtual void DoDispose()
Destructor implementation.
See section 4.3.23 dlInfoListElement.
Ptr< SpectrumValue > m_txPsd
the transmit PSD
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:42
uint8_t GetLayer(void) const
Get layer function.
void SetAntenna(Ptr< AntennaModel > a)
set the AntennaModel to be used
uint16_t m_rnti
RNTI.
EventId m_endRxDlCtrlEvent
end receive DL control event
void SetComponentCarrierId(uint8_t componentCarrierId)
bool m_dataErrorModelEnabled
when true (default) the phy error model is enabled
uint8_t m_ndi
new data indicator flag
Definition: lte-common.h:223
Every class exported by the ns3 library is enclosed in the ns3 namespace.
PhyReceptionStatParameters structure.
Definition: lte-common.h:212
void EndRxDlCtrl()
End receive DL control function.
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 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
the spectrum model
LtePhyDlHarqFeedbackCallback m_ltePhyDlHarqFeedbackCallback
the LTE phy DL HARQ feedback callback
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
HARQ status.
Ptr< PacketBurst > m_txPacketBurst
the transmit packet burst
void SetChannel(Ptr< SpectrumChannel > c)
Set the channel attached to this device.
TbId_t structure.
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:218
EventId m_endTxEvent
end transmit event
uint16_t m_size
Size of transport block.
Definition: lte-common.h:221
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:249
Ptr< const SpectrumModel > GetRxSpectrumModel() const
Ptr< NetDevice > m_device
the device
bool m_ctrlErrorModelEnabled
when true (default) the phy error model is enabled for DL ctrl frame
uint8_t m_ccId
component carrier id
Definition: lte-common.h:225
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
uint8_t m_correctness
correctness of the TB received
Definition: lte-common.h:224
LtePhyUlHarqFeedbackCallback m_ltePhyUlHarqFeedbackCallback
the LTE phy UL HARQ feedback callback
static TypeId GetTypeId(void)
Get the type ID.
TracedCallback< Ptr< const Packet > > m_phyRxEndOkTrace
the phy receive end ok trace callback
uint8_t m_layer
layer
uint8_t m_harqProcessId
HARQ process ID.
bool StartTxDlCtrlFrame(std::list< Ptr< LteControlMessage > > ctrlMsgList, bool pss)
Start a transmission of control frame in DL.
uint16_t m_rnti
C-RNTI scheduled.
Definition: lte-common.h:217
uint16_t m_cellId
the cell ID
uint16_t m_cellId
Cell ID of the attached Enb.
Definition: lte-common.h:215
void SetLtePhyDlHarqFeedbackCallback(LtePhyDlHarqFeedbackCallback c)
set the callback for the DL HARQ feedback as part of the interconnections between the LteSpectrumPhy ...
if(desigRtr==addrLocal)
void SetLtePhyRxPssCallback(LtePhyRxPssCallback c)
set the callback for the reception of the PSS as part of the interconnections between the LteSpectrum...
int64_t GetMilliSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:359
LtePhyRxPssCallback m_ltePhyRxPssCallback
the LTE phy receive PSS callback
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:270
bool operator==(const EventId &a, const EventId &b)
Definition: event-id.h:135
void EndRxUlSrs()
End receive UL SRS function.
EventId m_endRxUlSrsEvent
end receive UL SRS event
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.
tbInfo_t structure
enum ns3::UlInfoListElement_s::ReceptionStatus_e m_receptionStatus
the status
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1270
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 &#39;double&#39; or &#39;float&#39;...
Definition: double.h:41
TracedCallback< Ptr< const PacketBurst > > m_phyTxStartTrace
the phy transmit start trace callback
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:185
Set of values corresponding to a given SpectrumModel.
uint64_t m_imsi
IMSI of the scheduled UE.
Definition: lte-common.h:216
void StartRxDlCtrl(Ptr< LteSpectrumSignalParametersDlCtrlFrame > lteDlCtrlRxParams)
Start receive DL control function.
a unique identifier for an interface.
Definition: type-id.h:58
void UpdateSinrPerceived(const SpectrumValue &sinr)
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:915
EventId m_endRxDataEvent
end receive data event
bool StartTxUlSrsFrame()
Start a transmission of control frame in UL.
void SetCellId(uint16_t cellId)
SpectrumValue m_sinrPerceived
the preceived SINR
std::vector< double > m_txModeGain
duplicate value of LteUePhy
TracedCallback< PhyReceptionStatParameters > m_dlPhyReception
Trace information regarding PHY stats from DL Rx perspective PhyReceptionStatParameters (see lte-comm...
std::vector< HarqProcessInfoElement_t > HarqProcessInfoList_t
HarqProcessInfoList_t typedef.
Definition: lte-harq-phy.h:48