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 TbId_t::TbId_t (const uint16_t a, const uint8_t b)
95  : m_rnti (a),
96  m_layer (b)
97 {}
98 
106 bool
107 operator == (const TbId_t &a, const TbId_t &b)
108 {
109  return ( (a.m_rnti == b.m_rnti) && (a.m_layer == b.m_layer) );
110 }
111 
119 bool
120 operator < (const TbId_t& a, const TbId_t& b)
121 {
122  return ( (a.m_rnti < b.m_rnti) || ( (a.m_rnti == b.m_rnti) && (a.m_layer < b.m_layer) ) );
123 }
124 
126 
128  : m_state (IDLE),
129  m_cellId (0),
130  m_componentCarrierId (0),
131  m_transmissionMode (0),
132  m_layersNum (1)
133 {
134  NS_LOG_FUNCTION (this);
135  m_random = CreateObject<UniformRandomVariable> ();
136  m_random->SetAttribute ("Min", DoubleValue (0.0));
137  m_random->SetAttribute ("Max", DoubleValue (1.0));
138  m_interferenceData = CreateObject<LteInterference> ();
139  m_interferenceCtrl = CreateObject<LteInterference> ();
140 
141  for (uint8_t i = 0; i < 7; i++)
142  {
143  m_txModeGain.push_back (1.0);
144  }
145 }
146 
147 
149 {
150  NS_LOG_FUNCTION (this);
151  m_expectedTbs.clear ();
152  m_txModeGain.clear ();
153 }
154 
156 {
157  NS_LOG_FUNCTION (this);
158  m_channel = 0;
159  m_mobility = 0;
160  m_device = 0;
161  m_interferenceData->Dispose ();
162  m_interferenceData = 0;
163  m_interferenceCtrl->Dispose ();
164  m_interferenceCtrl = 0;
165  m_ltePhyRxDataEndErrorCallback = MakeNullCallback< void > ();
166  m_ltePhyRxDataEndOkCallback = MakeNullCallback< void, Ptr<Packet> > ();
167  m_ltePhyRxCtrlEndOkCallback = MakeNullCallback< void, std::list<Ptr<LteControlMessage> > > ();
168  m_ltePhyRxCtrlEndErrorCallback = MakeNullCallback< void > ();
169  m_ltePhyDlHarqFeedbackCallback = MakeNullCallback< void, DlInfoListElement_s > ();
170  m_ltePhyUlHarqFeedbackCallback = MakeNullCallback< void, UlInfoListElement_s > ();
171  m_ltePhyRxPssCallback = MakeNullCallback< void, uint16_t, Ptr<SpectrumValue> > ();
173 }
174 
182 std::ostream& operator<< (std::ostream& os, LteSpectrumPhy::State s)
183 {
184  switch (s)
185  {
187  os << "IDLE";
188  break;
190  os << "RX_DATA";
191  break;
193  os << "RX_DL_CTRL";
194  break;
196  os << "TX_DATA";
197  break;
199  os << "TX_DL_CTRL";
200  break;
202  os << "TX_UL_SRS";
203  break;
204  default:
205  os << "UNKNOWN";
206  break;
207  }
208  return os;
209 }
210 
211 TypeId
213 {
214  static TypeId tid = TypeId ("ns3::LteSpectrumPhy")
216  .SetGroupName ("Lte")
217  .AddTraceSource ("TxStart",
218  "Trace fired when a new transmission is started",
220  "ns3::PacketBurst::TracedCallback")
221  .AddTraceSource ("TxEnd",
222  "Trace fired when a previously started transmission is finished",
224  "ns3::PacketBurst::TracedCallback")
225  .AddTraceSource ("RxStart",
226  "Trace fired when the start of a signal is detected",
228  "ns3::PacketBurst::TracedCallback")
229  .AddTraceSource ("RxEndOk",
230  "Trace fired when a previously started RX terminates successfully",
232  "ns3::Packet::TracedCallback")
233  .AddTraceSource ("RxEndError",
234  "Trace fired when a previously started RX terminates with an error",
236  "ns3::Packet::TracedCallback")
237  .AddAttribute ("DataErrorModelEnabled",
238  "Activate/Deactivate the error model of data (TBs of PDSCH and PUSCH) [by default is active].",
239  BooleanValue (true),
242  .AddAttribute ("CtrlErrorModelEnabled",
243  "Activate/Deactivate the error model of control (PCFICH-PDCCH decodification) [by default is active].",
244  BooleanValue (true),
247  .AddTraceSource ("DlPhyReception",
248  "DL reception PHY layer statistics.",
250  "ns3::PhyReceptionStatParameters::TracedCallback")
251  .AddTraceSource ("UlPhyReception",
252  "DL reception PHY layer statistics.",
254  "ns3::PhyReceptionStatParameters::TracedCallback")
255  ;
256  return tid;
257 }
258 
259 
260 
263 {
264  NS_LOG_FUNCTION (this);
265  return m_device;
266 }
267 
268 
271 {
272  NS_LOG_FUNCTION (this);
273  return m_mobility;
274 }
275 
276 
277 void
279 {
280  NS_LOG_FUNCTION (this << d);
281  m_device = d;
282 }
283 
284 
285 void
287 {
288  NS_LOG_FUNCTION (this << m);
289  m_mobility = m;
290 }
291 
292 
293 void
295 {
296  NS_LOG_FUNCTION (this << c);
297  m_channel = c;
298 }
299 
302 {
303  return m_channel;
304 }
305 
308 {
309  return m_rxSpectrumModel;
310 }
311 
312 
313 void
315 {
316  NS_LOG_FUNCTION (this << txPsd);
317  NS_ASSERT (txPsd);
318  m_txPsd = txPsd;
319 }
320 
321 
322 void
324 {
325  NS_LOG_FUNCTION (this << noisePsd);
326  NS_ASSERT (noisePsd);
327  m_rxSpectrumModel = noisePsd->GetSpectrumModel ();
328  m_interferenceData->SetNoisePowerSpectralDensity (noisePsd);
329  m_interferenceCtrl->SetNoisePowerSpectralDensity (noisePsd);
330 }
331 
332 
333 void
335 {
336  NS_LOG_FUNCTION (this);
337  m_cellId = 0;
338  m_state = IDLE;
339  m_transmissionMode = 0;
340  m_layersNum = 1;
341  m_endTxEvent.Cancel ();
345  m_rxControlMessageList.clear ();
346  m_expectedTbs.clear ();
347  m_txControlMessageList.clear ();
348  m_rxPacketBurstList.clear ();
349  m_txPacketBurst = 0;
350  m_rxSpectrumModel = 0;
351 
352  // Detach from the channel, because receiving any signal without
353  // spectrum model is an error.
354  if (m_channel)
355  {
356  m_channel->RemoveRx (this);
357  }
358 }
359 
360 
361 void
363 {
364  NS_LOG_FUNCTION (this);
366 }
367 
368 
369 void
371 {
372  NS_LOG_FUNCTION (this);
374 }
375 
376 void
378 {
379  NS_LOG_FUNCTION (this);
381 }
382 
383 void
385 {
386  NS_LOG_FUNCTION (this);
388 }
389 
390 
391 void
393 {
394  NS_LOG_FUNCTION (this);
396 }
397 
398 void
400 {
401  NS_LOG_FUNCTION (this);
403 }
404 
405 void
407 {
408  NS_LOG_FUNCTION (this);
410 }
411 
412 
415 {
416  return m_antenna;
417 }
418 
419 void
421 {
422  NS_LOG_FUNCTION (this << a);
423  m_antenna = a;
424 }
425 
426 void
428 {
429  ChangeState (newState);
430 }
431 
432 
433 void
435 {
436  NS_LOG_LOGIC (this << " state: " << m_state << " -> " << newState);
437  m_state = newState;
438 }
439 
440 
441 void
443 {
444  m_harqPhyModule = harq;
445 }
446 
447 
448 
449 
450 bool
452 {
453  NS_LOG_FUNCTION (this << pb);
454  NS_LOG_LOGIC (this << " state: " << m_state);
455 
456  m_phyTxStartTrace (pb);
457 
458  switch (m_state)
459  {
460  case RX_DATA:
461  case RX_DL_CTRL:
462  case RX_UL_SRS:
463  NS_FATAL_ERROR ("cannot TX while RX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
464  break;
465 
466  case TX_DATA:
467  case TX_DL_CTRL:
468  case TX_UL_SRS:
469  NS_FATAL_ERROR ("cannot TX while already TX: the MAC should avoid this");
470  break;
471 
472  case IDLE:
473  {
474  /*
475  m_txPsd must be set by the device, according to
476  (i) the available subchannel for transmission
477  (ii) the power transmission
478  */
479  NS_ASSERT (m_txPsd);
480  m_txPacketBurst = pb;
481 
482  // we need to convey some PHY meta information to the receiver
483  // to be used for simulation purposes (e.g., the CellId). This
484  // is done by setting the ctrlMsgList parameter of
485  // LteSpectrumSignalParametersDataFrame
488  Ptr<LteSpectrumSignalParametersDataFrame> txParams = Create<LteSpectrumSignalParametersDataFrame> ();
489  txParams->duration = duration;
490  txParams->txPhy = GetObject<SpectrumPhy> ();
491  txParams->txAntenna = m_antenna;
492  txParams->psd = m_txPsd;
493  txParams->packetBurst = pb;
494  txParams->ctrlMsgList = ctrlMsgList;
495  txParams->cellId = m_cellId;
496  m_channel->StartTx (txParams);
498  }
499  return false;
500  break;
501 
502  default:
503  NS_FATAL_ERROR ("unknown state");
504  return true;
505  break;
506  }
507 }
508 
509 bool
511 {
512  NS_LOG_FUNCTION (this << " PSS " << (uint16_t)pss);
513  NS_LOG_LOGIC (this << " state: " << m_state);
514 
515  switch (m_state)
516  {
517  case RX_DATA:
518  case RX_DL_CTRL:
519  case RX_UL_SRS:
520  NS_FATAL_ERROR ("cannot TX while RX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
521  break;
522 
523  case TX_DATA:
524  case TX_DL_CTRL:
525  case TX_UL_SRS:
526  NS_FATAL_ERROR ("cannot TX while already TX: the MAC should avoid this");
527  break;
528 
529  case IDLE:
530  {
531  /*
532  m_txPsd must be set by the device, according to
533  (i) the available subchannel for transmission
534  (ii) the power transmission
535  */
536  NS_ASSERT (m_txPsd);
537 
538  // we need to convey some PHY meta information to the receiver
539  // to be used for simulation purposes (e.g., the CellId). This
540  // is done by setting the cellId parameter of
541  // LteSpectrumSignalParametersDlCtrlFrame
544 
545  Ptr<LteSpectrumSignalParametersDlCtrlFrame> txParams = Create<LteSpectrumSignalParametersDlCtrlFrame> ();
546  txParams->duration = DL_CTRL_DURATION;
547  txParams->txPhy = GetObject<SpectrumPhy> ();
548  txParams->txAntenna = m_antenna;
549  txParams->psd = m_txPsd;
550  txParams->cellId = m_cellId;
551  txParams->pss = pss;
552  txParams->ctrlMsgList = ctrlMsgList;
553  m_channel->StartTx (txParams);
555  }
556  return false;
557  break;
558 
559  default:
560  NS_FATAL_ERROR ("unknown state");
561  return true;
562  break;
563  }
564 }
565 
566 
567 bool
569 {
570  NS_LOG_FUNCTION (this);
571  NS_LOG_LOGIC (this << " state: " << m_state);
572 
573  switch (m_state)
574  {
575  case RX_DATA:
576  case RX_DL_CTRL:
577  case RX_UL_SRS:
578  NS_FATAL_ERROR ("cannot TX while RX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
579  break;
580 
581  case TX_DL_CTRL:
582  case TX_DATA:
583  case TX_UL_SRS:
584  NS_FATAL_ERROR ("cannot TX while already TX: the MAC should avoid this");
585  break;
586 
587  case IDLE:
588  {
589  /*
590  m_txPsd must be set by the device, according to
591  (i) the available subchannel for transmission
592  (ii) the power transmission
593  */
594  NS_ASSERT (m_txPsd);
595  NS_LOG_LOGIC (this << " m_txPsd: " << *m_txPsd);
596 
597  // we need to convey some PHY meta information to the receiver
598  // to be used for simulation purposes (e.g., the CellId). This
599  // is done by setting the cellId parameter of
600  // LteSpectrumSignalParametersDlCtrlFrame
603  Ptr<LteSpectrumSignalParametersUlSrsFrame> txParams = Create<LteSpectrumSignalParametersUlSrsFrame> ();
604  txParams->duration = UL_SRS_DURATION;
605  txParams->txPhy = GetObject<SpectrumPhy> ();
606  txParams->txAntenna = m_antenna;
607  txParams->psd = m_txPsd;
608  txParams->cellId = m_cellId;
609  m_channel->StartTx (txParams);
611  }
612  return false;
613  break;
614 
615  default:
616  NS_FATAL_ERROR ("unknown state");
617  return true;
618  break;
619  }
620 }
621 
622 
623 
624 void
626 {
627  NS_LOG_FUNCTION (this);
628  NS_LOG_LOGIC (this << " state: " << m_state);
629 
632  m_txPacketBurst = 0;
633  ChangeState (IDLE);
634 }
635 
636 void
638 {
639  NS_LOG_FUNCTION (this);
640  NS_LOG_LOGIC (this << " state: " << m_state);
641 
643  NS_ASSERT (m_txPacketBurst == 0);
644  ChangeState (IDLE);
645 }
646 
647 void
649 {
650  NS_LOG_FUNCTION (this);
651  NS_LOG_LOGIC (this << " state: " << m_state);
652 
654  NS_ASSERT (m_txPacketBurst == 0);
655  ChangeState (IDLE);
656 }
657 
658 
659 
660 
661 void
663 {
664  NS_LOG_FUNCTION (this << spectrumRxParams);
665  NS_LOG_LOGIC (this << " state: " << m_state);
666 
667  Ptr <const SpectrumValue> rxPsd = spectrumRxParams->psd;
668  Time duration = spectrumRxParams->duration;
669 
670  // the device might start RX only if the signal is of a type
671  // understood by this device - in this case, an LTE signal.
672  Ptr<LteSpectrumSignalParametersDataFrame> lteDataRxParams = DynamicCast<LteSpectrumSignalParametersDataFrame> (spectrumRxParams);
673  Ptr<LteSpectrumSignalParametersDlCtrlFrame> lteDlCtrlRxParams = DynamicCast<LteSpectrumSignalParametersDlCtrlFrame> (spectrumRxParams);
674  Ptr<LteSpectrumSignalParametersUlSrsFrame> lteUlSrsRxParams = DynamicCast<LteSpectrumSignalParametersUlSrsFrame> (spectrumRxParams);
675  if (lteDataRxParams != 0)
676  {
677  m_interferenceData->AddSignal (rxPsd, duration);
678  StartRxData (lteDataRxParams);
679  }
680  else if (lteDlCtrlRxParams != 0)
681  {
682  m_interferenceCtrl->AddSignal (rxPsd, duration);
683  StartRxDlCtrl (lteDlCtrlRxParams);
684  }
685  else if (lteUlSrsRxParams != 0)
686  {
687  m_interferenceCtrl->AddSignal (rxPsd, duration);
688  StartRxUlSrs (lteUlSrsRxParams);
689  }
690  else
691  {
692  // other type of signal (could be 3G, GSM, whatever) -> interference
693  m_interferenceData->AddSignal (rxPsd, duration);
694  m_interferenceCtrl->AddSignal (rxPsd, duration);
695  }
696 }
697 
698 void
700 {
701  NS_LOG_FUNCTION (this);
702  switch (m_state)
703  {
704  case TX_DATA:
705  case TX_DL_CTRL:
706  case TX_UL_SRS:
707  NS_FATAL_ERROR ("cannot RX while TX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
708  break;
709  case RX_DL_CTRL:
710  NS_FATAL_ERROR ("cannot RX Data while receiving control");
711  break;
712  case IDLE:
713  case RX_DATA:
714  // the behavior is similar when
715  // we're IDLE or RX because we can receive more signals
716  // simultaneously (e.g., at the eNB).
717  {
718  // To check if we're synchronized to this signal, we check
719  // for the CellId which is reported in the
720  // LteSpectrumSignalParametersDataFrame
721  if (params->cellId == m_cellId)
722  {
723  NS_LOG_LOGIC (this << " synchronized with this signal (cellId=" << params->cellId << ")");
724  if ((m_rxPacketBurstList.empty ())&&(m_rxControlMessageList.empty ()))
725  {
726  NS_ASSERT (m_state == IDLE);
727  // first transmission, i.e., we're IDLE and we
728  // start RX
730  m_firstRxDuration = params->duration;
731  NS_LOG_LOGIC (this << " scheduling EndRx with delay " << params->duration.As (Time::S));
733  }
734  else
735  {
737  // sanity check: if there are multiple RX events, they
738  // should occur at the same time and have the same
739  // duration, otherwise the interference calculation
740  // won't be correct
742  && (m_firstRxDuration == params->duration));
743  }
744 
746  if (params->packetBurst)
747  {
748  m_rxPacketBurstList.push_back (params->packetBurst);
749  m_interferenceData->StartRx (params->psd);
750 
751  m_phyRxStartTrace (params->packetBurst);
752  }
753  NS_LOG_DEBUG (this << " insert msgs " << params->ctrlMsgList.size ());
754  m_rxControlMessageList.insert (m_rxControlMessageList.end (), params->ctrlMsgList.begin (), params->ctrlMsgList.end ());
755 
756  NS_LOG_LOGIC (this << " numSimultaneousRxEvents = " << m_rxPacketBurstList.size ());
757  }
758  else
759  {
760  NS_LOG_LOGIC (this << " not in sync with this signal (cellId="
761  << params->cellId << ", m_cellId=" << m_cellId << ")");
762  }
763  }
764  break;
765 
766  default:
767  NS_FATAL_ERROR ("unknown state");
768  break;
769  }
770 
771  NS_LOG_LOGIC (this << " state: " << m_state);
772 }
773 
774 
775 
776 void
778 {
779  NS_LOG_FUNCTION (this);
780 
781  // To check if we're synchronized to this signal, we check
782  // for the CellId which is reported in the
783  // LteSpectrumSignalParametersDlCtrlFrame
784  uint16_t cellId;
785  NS_ASSERT (lteDlCtrlRxParams != 0);
786  cellId = lteDlCtrlRxParams->cellId;
787 
788  switch (m_state)
789  {
790  case TX_DATA:
791  case TX_DL_CTRL:
792  case TX_UL_SRS:
793  case RX_DATA:
794  case RX_UL_SRS:
795  NS_FATAL_ERROR ("unexpected event in state " << m_state);
796  break;
797 
798  case RX_DL_CTRL:
799  case IDLE:
800 
801  // common code for the two states
802  // check presence of PSS for UE measuerements
803  if (lteDlCtrlRxParams->pss == true)
804  {
806  {
807  m_ltePhyRxPssCallback (cellId, lteDlCtrlRxParams->psd);
808  }
809  }
810 
811  // differentiated code for the two states
812  switch (m_state)
813  {
814  case RX_DL_CTRL:
815  NS_ASSERT_MSG (m_cellId != cellId, "any other DlCtrl should be from a different cell");
816  NS_LOG_LOGIC (this << " ignoring other DlCtrl (cellId="
817  << cellId << ", m_cellId=" << m_cellId << ")");
818  break;
819 
820  case IDLE:
821  if (cellId == m_cellId)
822  {
823  NS_LOG_LOGIC (this << " synchronized with this signal (cellId=" << cellId << ")");
824 
827  m_firstRxDuration = lteDlCtrlRxParams->duration;
828  NS_LOG_LOGIC (this << " scheduling EndRx with delay " << lteDlCtrlRxParams->duration);
829 
830  // store the DCIs
831  m_rxControlMessageList = lteDlCtrlRxParams->ctrlMsgList;
832  m_endRxDlCtrlEvent = Simulator::Schedule (lteDlCtrlRxParams->duration, &LteSpectrumPhy::EndRxDlCtrl, this);
834  m_interferenceCtrl->StartRx (lteDlCtrlRxParams->psd);
835  }
836  else
837  {
838  NS_LOG_LOGIC (this << " not synchronizing with this signal (cellId="
839  << cellId << ", m_cellId=" << m_cellId << ")");
840  }
841  break;
842 
843  default:
844  NS_FATAL_ERROR ("unexpected event in state " << m_state);
845  break;
846  }
847  break; // case RX_DL_CTRL or IDLE
848 
849  default:
850  NS_FATAL_ERROR ("unknown state");
851  break;
852  }
853 
854  NS_LOG_LOGIC (this << " state: " << m_state);
855 }
856 
857 
858 
859 
860 void
862 {
863  NS_LOG_FUNCTION (this);
864  switch (m_state)
865  {
866  case TX_DATA:
867  case TX_DL_CTRL:
868  case TX_UL_SRS:
869  NS_FATAL_ERROR ("cannot RX while TX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
870  break;
871 
872  case RX_DATA:
873  case RX_DL_CTRL:
874  NS_FATAL_ERROR ("cannot RX SRS while receiving something else");
875  break;
876 
877  case IDLE:
878  case RX_UL_SRS:
879  // the behavior is similar when
880  // we're IDLE or RX_UL_SRS because we can receive more signals
881  // simultaneously at the eNB
882  {
883  // To check if we're synchronized to this signal, we check
884  // for the CellId which is reported in the
885  // LteSpectrumSignalParametersDlCtrlFrame
886  uint16_t cellId;
887  cellId = lteUlSrsRxParams->cellId;
888  if (cellId == m_cellId)
889  {
890  NS_LOG_LOGIC (this << " synchronized with this signal (cellId=" << cellId << ")");
891  if (m_state == IDLE)
892  {
893  // first transmission, i.e., we're IDLE and we
894  // start RX
897  m_firstRxDuration = lteUlSrsRxParams->duration;
898  NS_LOG_LOGIC (this << " scheduling EndRx with delay " << lteUlSrsRxParams->duration);
899 
900  m_endRxUlSrsEvent = Simulator::Schedule (lteUlSrsRxParams->duration, &LteSpectrumPhy::EndRxUlSrs, this);
901  }
902  else if (m_state == RX_UL_SRS)
903  {
904  // sanity check: if there are multiple RX events, they
905  // should occur at the same time and have the same
906  // duration, otherwise the interference calculation
907  // won't be correct
909  && (m_firstRxDuration == lteUlSrsRxParams->duration));
910  }
912  m_interferenceCtrl->StartRx (lteUlSrsRxParams->psd);
913  }
914  else
915  {
916  NS_LOG_LOGIC (this << " not in sync with this signal (cellId="
917  << cellId << ", m_cellId=" << m_cellId << ")");
918  }
919  }
920  break;
921 
922  default:
923  NS_FATAL_ERROR ("unknown state");
924  break;
925  }
926 
927  NS_LOG_LOGIC (this << " state: " << m_state);
928 }
929 
930 
931 void
933 {
934  NS_LOG_FUNCTION (this << sinr);
935  m_sinrPerceived = sinr;
936 }
937 
938 
939 void
940 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)
941 {
942  NS_LOG_FUNCTION (this << " rnti: " << rnti << " NDI " << (uint16_t)ndi << " size " << size << " mcs " << (uint16_t)mcs << " layer " << (uint16_t)layer << " rv " << (uint16_t)rv);
943  TbId_t tbId;
944  tbId.m_rnti = rnti;
945  tbId.m_layer = layer;
946  expectedTbs_t::iterator it;
947  it = m_expectedTbs.find (tbId);
948  if (it != m_expectedTbs.end ())
949  {
950  // migth be a TB of an unreceived packet (due to high progpalosses)
951  m_expectedTbs.erase (it);
952  }
953  // insert new entry
954  tbInfo_t tbInfo = {ndi, size, mcs, map, harqId, rv, 0.0, downlink, false, false};
955  m_expectedTbs.insert (std::pair<TbId_t, tbInfo_t> (tbId,tbInfo));
956 }
957 
958 void
960 {
961  NS_LOG_FUNCTION (this << rnti);
962  TbId_t tbId;
963  tbId.m_rnti = rnti;
964  //Remove TB of both the layers
965  for (uint8_t i = 0; i < 2; i++)
966  {
967  tbId.m_layer = i;
968  expectedTbs_t::iterator it;
969  it = m_expectedTbs.find (tbId);
970  if (it != m_expectedTbs.end ())
971  {
972  m_expectedTbs.erase (it);
973  }
974  }
975 }
976 
977 
978 
979 
980 void
982 {
983  NS_LOG_FUNCTION (this);
984  NS_LOG_LOGIC (this << " state: " << m_state);
985 
987 
988  // this will trigger CQI calculation and Error Model evaluation
989  // as a side effect, the error model should update the error status of all TBs
990  m_interferenceData->EndRx ();
991  NS_LOG_DEBUG (this << " No. of burts " << m_rxPacketBurstList.size ());
992  NS_LOG_DEBUG (this << " Expected TBs " << m_expectedTbs.size ());
993  expectedTbs_t::iterator itTb = m_expectedTbs.begin ();
994 
995  // apply transmission mode gain
996  NS_LOG_DEBUG (this << " txMode " << (uint16_t)m_transmissionMode << " gain " << m_txModeGain.at (m_transmissionMode));
999 
1000  while (itTb != m_expectedTbs.end ())
1001  {
1002  if ((m_dataErrorModelEnabled)&&(m_rxPacketBurstList.size () > 0)) // avoid to check for errors when there is no actual data transmitted
1003  {
1004  // retrieve HARQ info
1005  HarqProcessInfoList_t harqInfoList;
1006  if ((*itTb).second.ndi == 0)
1007  {
1008  // TB retxed: retrieve HARQ history
1009  uint16_t ulHarqId = 0;
1010  if ((*itTb).second.downlink)
1011  {
1012  harqInfoList = m_harqPhyModule->GetHarqProcessInfoDl ((*itTb).second.harqProcessId, (*itTb).first.m_layer);
1013  }
1014  else
1015  {
1016  harqInfoList = m_harqPhyModule->GetHarqProcessInfoUl ((*itTb).first.m_rnti, ulHarqId);
1017  }
1018  }
1019  TbStats_t tbStats = LteMiErrorModel::GetTbDecodificationStats (m_sinrPerceived, (*itTb).second.rbBitmap, (*itTb).second.size, (*itTb).second.mcs, harqInfoList);
1020  (*itTb).second.mi = tbStats.mi;
1021  (*itTb).second.corrupt = !(m_random->GetValue () > tbStats.tbler);
1022  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);
1023  // fire traces on DL/UL reception PHY stats
1026  params.m_cellId = m_cellId;
1027  params.m_imsi = 0; // it will be set by DlPhyTransmissionCallback in LteHelper
1028  params.m_rnti = (*itTb).first.m_rnti;
1029  params.m_txMode = m_transmissionMode;
1030  params.m_layer = (*itTb).first.m_layer;
1031  params.m_mcs = (*itTb).second.mcs;
1032  params.m_size = (*itTb).second.size;
1033  params.m_rv = (*itTb).second.rv;
1034  params.m_ndi = (*itTb).second.ndi;
1035  params.m_correctness = (uint8_t) !(*itTb).second.corrupt;
1036  params.m_ccId = m_componentCarrierId;
1037  if ((*itTb).second.downlink)
1038  {
1039  // DL
1040  m_dlPhyReception (params);
1041  }
1042  else
1043  {
1044  // UL
1045  params.m_rv = harqInfoList.size ();
1046  m_ulPhyReception (params);
1047  }
1048  }
1049 
1050  itTb++;
1051  }
1052  std::map <uint16_t, DlInfoListElement_s> harqDlInfoMap;
1053  for (std::list<Ptr<PacketBurst> >::const_iterator i = m_rxPacketBurstList.begin ();
1054  i != m_rxPacketBurstList.end (); ++i)
1055  {
1056  for (std::list<Ptr<Packet> >::const_iterator j = (*i)->Begin (); j != (*i)->End (); ++j)
1057  {
1058  // retrieve TB info of this packet
1059  LteRadioBearerTag tag;
1060  (*j)->PeekPacketTag (tag);
1061  TbId_t tbId;
1062  tbId.m_rnti = tag.GetRnti ();
1063  tbId.m_layer = tag.GetLayer ();
1064  itTb = m_expectedTbs.find (tbId);
1065  NS_LOG_INFO (this << " Packet of " << tbId.m_rnti << " layer " << (uint16_t) tag.GetLayer ());
1066  if (itTb != m_expectedTbs.end ())
1067  {
1068  if (!(*itTb).second.corrupt)
1069  {
1070  m_phyRxEndOkTrace (*j);
1071 
1073  {
1075  }
1076  }
1077  else
1078  {
1079  // TB received with errors
1080  m_phyRxEndErrorTrace (*j);
1081  }
1082 
1083  // send HARQ feedback (if not already done for this TB)
1084  if (!(*itTb).second.harqFeedbackSent)
1085  {
1086  (*itTb).second.harqFeedbackSent = true;
1087  if (!(*itTb).second.downlink)
1088  {
1089  UlInfoListElement_s harqUlInfo;
1090  harqUlInfo.m_rnti = tbId.m_rnti;
1091  harqUlInfo.m_tpc = 0;
1092  if ((*itTb).second.corrupt)
1093  {
1094  harqUlInfo.m_receptionStatus = UlInfoListElement_s::NotOk;
1095  NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " send UL-HARQ-NACK");
1096  m_harqPhyModule->UpdateUlHarqProcessStatus (tbId.m_rnti, (*itTb).second.mi, (*itTb).second.size, (*itTb).second.size / EffectiveCodingRate [(*itTb).second.mcs]);
1097  }
1098  else
1099  {
1100  harqUlInfo.m_receptionStatus = UlInfoListElement_s::Ok;
1101  NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " send UL-HARQ-ACK");
1102  m_harqPhyModule->ResetUlHarqProcessStatus (tbId.m_rnti, (*itTb).second.harqProcessId);
1103  }
1105  {
1106  m_ltePhyUlHarqFeedbackCallback (harqUlInfo);
1107  }
1108  }
1109  else
1110  {
1111  std::map <uint16_t, DlInfoListElement_s>::iterator itHarq = harqDlInfoMap.find (tbId.m_rnti);
1112  if (itHarq == harqDlInfoMap.end ())
1113  {
1114  DlInfoListElement_s harqDlInfo;
1115  harqDlInfo.m_harqStatus.resize (m_layersNum, DlInfoListElement_s::ACK);
1116  harqDlInfo.m_rnti = tbId.m_rnti;
1117  harqDlInfo.m_harqProcessId = (*itTb).second.harqProcessId;
1118  if ((*itTb).second.corrupt)
1119  {
1120  harqDlInfo.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::NACK;
1121  NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " harqId " << (uint16_t)(*itTb).second.harqProcessId << " layer " << (uint16_t)tbId.m_layer << " send DL-HARQ-NACK");
1122  m_harqPhyModule->UpdateDlHarqProcessStatus ((*itTb).second.harqProcessId, tbId.m_layer, (*itTb).second.mi, (*itTb).second.size, (*itTb).second.size / EffectiveCodingRate [(*itTb).second.mcs]);
1123  }
1124  else
1125  {
1126 
1127  harqDlInfo.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::ACK;
1128  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");
1129  m_harqPhyModule->ResetDlHarqProcessStatus ((*itTb).second.harqProcessId);
1130  }
1131  harqDlInfoMap.insert (std::pair <uint16_t, DlInfoListElement_s> (tbId.m_rnti, harqDlInfo));
1132  }
1133  else
1134  {
1135  if ((*itTb).second.corrupt)
1136  {
1137  (*itHarq).second.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::NACK;
1138  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");
1139  m_harqPhyModule->UpdateDlHarqProcessStatus ((*itTb).second.harqProcessId, tbId.m_layer, (*itTb).second.mi, (*itTb).second.size, (*itTb).second.size / EffectiveCodingRate [(*itTb).second.mcs]);
1140  }
1141  else
1142  {
1143  NS_ASSERT_MSG (tbId.m_layer < (*itHarq).second.m_harqStatus.size (), " layer " << (uint16_t)tbId.m_layer);
1144  (*itHarq).second.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::ACK;
1145  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");
1146  m_harqPhyModule->ResetDlHarqProcessStatus ((*itTb).second.harqProcessId);
1147  }
1148  }
1149  } // end if ((*itTb).second.downlink) HARQ
1150  } // end if (!(*itTb).second.harqFeedbackSent)
1151  }
1152  }
1153  }
1154 
1155  // send DL HARQ feedback to LtePhy
1156  std::map <uint16_t, DlInfoListElement_s>::iterator itHarq;
1157  for (itHarq = harqDlInfoMap.begin (); itHarq != harqDlInfoMap.end (); itHarq++)
1158  {
1160  {
1161  m_ltePhyDlHarqFeedbackCallback ((*itHarq).second);
1162  }
1163  }
1164  // forward control messages of this frame to LtePhy
1165  if (!m_rxControlMessageList.empty ())
1166  {
1168  {
1170  }
1171  }
1172  ChangeState (IDLE);
1173  m_rxPacketBurstList.clear ();
1174  m_rxControlMessageList.clear ();
1175  m_expectedTbs.clear ();
1176 }
1177 
1178 
1179 void
1181 {
1182  NS_LOG_FUNCTION (this);
1183  NS_LOG_LOGIC (this << " state: " << m_state);
1184 
1186 
1187  // this will trigger CQI calculation and Error Model evaluation
1188  // as a side effect, the error model should update the error status of all TBs
1189  m_interferenceCtrl->EndRx ();
1190  // apply transmission mode gain
1191  NS_LOG_DEBUG (this << " txMode " << (uint16_t)m_transmissionMode << " gain " << m_txModeGain.at (m_transmissionMode));
1193  if (m_transmissionMode > 0)
1194  {
1195  // in case of MIMO, ctrl is always txed as TX diversity
1196  m_sinrPerceived *= m_txModeGain.at (1);
1197  }
1198 // m_sinrPerceived *= m_txModeGain.at (m_transmissionMode);
1199  bool error = false;
1201  {
1203  error = !(m_random->GetValue () > errorRate);
1204  NS_LOG_DEBUG (this << " PCFICH-PDCCH Decodification, errorRate " << errorRate << " error " << error);
1205  }
1206 
1207  if (!error)
1208  {
1210  {
1211  NS_LOG_DEBUG (this << " PCFICH-PDCCH Rxed OK");
1213  }
1214  }
1215  else
1216  {
1218  {
1219  NS_LOG_DEBUG (this << " PCFICH-PDCCH Error");
1221  }
1222  }
1223  ChangeState (IDLE);
1224  m_rxControlMessageList.clear ();
1225 }
1226 
1227 void
1229 {
1231  ChangeState (IDLE);
1232  m_interferenceCtrl->EndRx ();
1233  // nothing to do (used only for SRS at this stage)
1234 }
1235 
1236 void
1237 LteSpectrumPhy::SetCellId (uint16_t cellId)
1238 {
1239  m_cellId = cellId;
1240 }
1241 
1242 void
1243 LteSpectrumPhy::SetComponentCarrierId (uint8_t componentCarrierId)
1244 {
1245  m_componentCarrierId = componentCarrierId;
1246 }
1247 
1248 void
1250 {
1251  m_interferenceCtrl->AddRsPowerChunkProcessor (p);
1252 }
1253 
1254 void
1256 {
1257  m_interferenceData->AddRsPowerChunkProcessor (p);
1258 }
1259 
1260 void
1262 {
1263  m_interferenceData->AddSinrChunkProcessor (p);
1264 }
1265 
1266 void
1268 {
1269  m_interferenceCtrl->AddInterferenceChunkProcessor (p);
1270 }
1271 
1272 void
1274 {
1275  m_interferenceData->AddInterferenceChunkProcessor (p);
1276 }
1277 
1278 void
1280 {
1281  m_interferenceCtrl->AddSinrChunkProcessor (p);
1282 }
1283 
1284 void
1286 {
1287  NS_LOG_FUNCTION (this << (uint16_t) txMode);
1288  NS_ASSERT_MSG (txMode < m_txModeGain.size (), "TransmissionMode not available: 1.." << m_txModeGain.size ());
1289  m_transmissionMode = txMode;
1291 }
1292 
1293 
1294 void
1295 LteSpectrumPhy::SetTxModeGain (uint8_t txMode, double gain)
1296 {
1297  NS_LOG_FUNCTION (this << " txmode " << (uint16_t)txMode << " gain " << gain);
1298  // convert to linear
1299  gain = std::pow (10.0, (gain / 10.0));
1300  if (m_txModeGain.size () < txMode)
1301  {
1302  m_txModeGain.resize (txMode);
1303  }
1304  std::vector <double> temp;
1305  temp = m_txModeGain;
1306  m_txModeGain.clear ();
1307  for (uint8_t i = 0; i < temp.size (); i++)
1308  {
1309  if (i == txMode - 1)
1310  {
1311  m_txModeGain.push_back (gain);
1312  }
1313  else
1314  {
1315  m_txModeGain.push_back (temp.at (i));
1316  }
1317  }
1318 }
1319 
1320 int64_t
1322 {
1323  NS_LOG_FUNCTION (this << stream);
1324  m_random->SetStream (stream);
1325  return 1;
1326 }
1327 
1328 
1329 
1330 } // namespace ns3
AttributeValue implementation for Boolean.
Definition: boolean.h:37
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1386
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:53
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
static double GetPcfichPdcchError(const SpectrumValue &sinr)
run the error-model algorithm for the specified PCFICH+PDCCH channels
Tag used to define the RNTI and LC id for each MAC packet trasmitted.
uint16_t GetRnti(void) const
Get RNTI function.
uint8_t GetLayer(void) const
Get layer function.
The LteSpectrumPhy models the physical layer of LTE.
void RemoveExpectedTb(uint16_t rnti)
Remove expected transport block.
void SetChannel(Ptr< SpectrumChannel > c)
Set the channel attached to this device.
Ptr< const SpectrumModel > m_rxSpectrumModel
the spectrum model
TracedCallback< Ptr< const PacketBurst > > m_phyTxEndTrace
the phy transmit end trace callback
bool m_dataErrorModelEnabled
when true (default) the phy error model is enabled
void SetState(State newState)
Set the state of the phy layer.
Ptr< LteInterference > m_interferenceData
the data interference
uint8_t m_transmissionMode
for UEs: store the transmission mode
EventId m_endRxDlCtrlEvent
end receive DL control event
void AddCtrlSinrChunkProcessor(Ptr< LteChunkProcessor > p)
void AddDataSinrChunkProcessor(Ptr< LteChunkProcessor > p)
virtual void DoDispose()
Destructor implementation.
LtePhyUlHarqFeedbackCallback m_ltePhyUlHarqFeedbackCallback
the LTE phy UL HARQ feedback callback
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)
void SetHarqPhyModule(Ptr< LteHarqPhy > harq)
Set HARQ phy function.
LtePhyRxPssCallback m_ltePhyRxPssCallback
the LTE phy receive PSS callback
void StartRxDlCtrl(Ptr< LteSpectrumSignalParametersDlCtrlFrame > lteDlCtrlRxParams)
Start receive DL control function.
void StartRxUlSrs(Ptr< LteSpectrumSignalParametersUlSrsFrame > lteUlSrsRxParams)
Start receive UL SRS function.
void AddDataPowerChunkProcessor(Ptr< LteChunkProcessor > p)
EventId m_endRxDataEvent
end receive data event
void SetLtePhyRxPssCallback(LtePhyRxPssCallback c)
set the callback for the reception of the PSS as part of the interconnections between the LteSpectrum...
void SetAntenna(Ptr< AntennaModel > a)
set the AntennaModel to be used
bool StartTxDataFrame(Ptr< PacketBurst > pb, std::list< Ptr< LteControlMessage > > ctrlMsgList, Time duration)
Start a transmission of data frame in DL and UL.
void StartRxData(Ptr< LteSpectrumSignalParametersDataFrame > params)
Start receive data function.
TracedCallback< PhyReceptionStatParameters > m_dlPhyReception
Trace information regarding PHY stats from DL Rx perspective PhyReceptionStatParameters (see lte-comm...
Ptr< NetDevice > m_device
the device
Ptr< SpectrumChannel > GetChannel()
TracedCallback< Ptr< const PacketBurst > > m_phyTxStartTrace
the phy transmit start trace callback
void EndTxData()
End transmit data function.
void SetTransmissionMode(uint8_t txMode)
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...
SpectrumValue m_sinrPerceived
the preceived SINR
Ptr< SpectrumValue > m_txPsd
the transmit PSD
void AddInterferenceDataChunkProcessor(Ptr< LteChunkProcessor > p)
LteChunkProcessor devoted to evaluate interference + noise power in data symbols of the subframe.
void ChangeState(State newState)
Change state function.
void SetTxModeGain(uint8_t txMode, double gain)
Set transmit mode gain function.
std::vector< double > m_txModeGain
duplicate value of LteUePhy
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Time m_firstRxStart
the first receive start
Ptr< NetDevice > GetDevice() const
Get the associated NetDevice instance.
Ptr< LteHarqPhy > m_harqPhyModule
the HARQ phy module
void SetLtePhyRxDataEndOkCallback(LtePhyRxDataEndOkCallback c)
set the callback for the successful end of a RX, as part of the interconnections between the PHY and ...
void EndRxUlSrs()
End receive UL SRS function.
void SetLtePhyUlHarqFeedbackCallback(LtePhyUlHarqFeedbackCallback c)
set the callback for the UL HARQ feedback as part of the interconnections between the LteSpectrumPhy ...
Ptr< MobilityModel > GetMobility() const
Get the associated MobilityModel instance.
void SetComponentCarrierId(uint8_t componentCarrierId)
TracedCallback< Ptr< const PacketBurst > > m_phyRxStartTrace
the phy receive start trace callback
expectedTbs_t m_expectedTbs
the expected TBS
void EndTxUlSrs()
End transmit UL SRS function.
void SetNoisePowerSpectralDensity(Ptr< const SpectrumValue > noisePsd)
set the noise power spectral density
void UpdateSinrPerceived(const SpectrumValue &sinr)
Ptr< SpectrumChannel > m_channel
the channel
Ptr< Object > GetAntenna() const
Get the AntennaModel used by this SpectrumPhy instance for transmission and/or reception.
void EndRxDlCtrl()
End receive DL control function.
void SetTxPowerSpectralDensity(Ptr< SpectrumValue > txPsd)
set the Power Spectral Density of outgoing signals in W/Hz.
EventId m_endTxEvent
end transmit event
LtePhyRxDataEndOkCallback m_ltePhyRxDataEndOkCallback
the LTE phy receive data end ok callback
void SetLtePhyRxCtrlEndErrorCallback(LtePhyRxCtrlEndErrorCallback c)
set the callback for the erroneous end of a RX ctrl frame, as part of the interconnections between th...
State m_state
the state
uint16_t m_cellId
the cell ID
Ptr< const SpectrumModel > GetRxSpectrumModel() const
Ptr< AntennaModel > m_antenna
the antenna model
void SetMobility(Ptr< MobilityModel > m)
Set the mobility model associated with this device.
void SetLtePhyDlHarqFeedbackCallback(LtePhyDlHarqFeedbackCallback c)
set the callback for the DL HARQ feedback as part of the interconnections between the LteSpectrumPhy ...
Time m_firstRxDuration
the first receive duration
Ptr< PacketBurst > m_txPacketBurst
the transmit packet burst
uint8_t m_componentCarrierId
the component carrier ID
LtePhyRxDataEndErrorCallback m_ltePhyRxDataEndErrorCallback
the LTE phy receive data end error callback
bool StartTxDlCtrlFrame(std::list< Ptr< LteControlMessage > > ctrlMsgList, bool pss)
Start a transmission of control frame in DL.
uint8_t m_layersNum
layers num
void SetDevice(Ptr< NetDevice > d)
Set the associated NetDevice instance.
Ptr< MobilityModel > m_mobility
the modility model
TracedCallback< PhyReceptionStatParameters > m_ulPhyReception
Trace information regarding PHY stats from UL Rx perspective PhyReceptionStatParameters (see lte-comm...
LtePhyDlHarqFeedbackCallback m_ltePhyDlHarqFeedbackCallback
the LTE phy DL HARQ feedback callback
void EndTxDlCtrl()
End transmit DL control function.
static TypeId GetTypeId(void)
Get the type ID.
std::list< Ptr< LteControlMessage > > m_rxControlMessageList
the receive control message list
void AddRsPowerChunkProcessor(Ptr< LteChunkProcessor > p)
Ptr< LteInterference > m_interferenceCtrl
the control interference
TracedCallback< Ptr< const Packet > > m_phyRxEndErrorTrace
the phy receive end error trace callback
void EndRxData()
End receive data function.
std::list< Ptr< LteControlMessage > > m_txControlMessageList
the transmit control message list
bool m_ctrlErrorModelEnabled
when true (default) the phy error model is enabled for DL ctrl frame
std::list< Ptr< PacketBurst > > m_rxPacketBurstList
the receive burst list
void AddInterferenceCtrlChunkProcessor(Ptr< LteChunkProcessor > p)
LteChunkProcessor devoted to evaluate interference + noise power in control symbols of the subframe.
TracedCallback< Ptr< const Packet > > m_phyRxEndOkTrace
the phy receive end ok trace callback
bool StartTxUlSrsFrame()
Start a transmission of control frame in UL.
LtePhyRxCtrlEndErrorCallback m_ltePhyRxCtrlEndErrorCallback
the LTE phy receive control end error callback
void StartRx(Ptr< SpectrumSignalParameters > params)
Notify the SpectrumPhy instance of an incoming signal.
void SetLtePhyRxCtrlEndOkCallback(LtePhyRxCtrlEndOkCallback c)
set the callback for the successful end of a RX ctrl frame, as part of the interconnections between t...
void Reset()
reset the internal state
EventId m_endRxUlSrsEvent
end receive UL SRS event
void SetCellId(uint16_t cellId)
LtePhyRxCtrlEndOkCallback m_ltePhyRxCtrlEndOkCallback
the LTE phy receive control end ok callback
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:256
virtual void DoDispose(void)
Destructor implementation.
Definition: object.cc:346
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:556
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
Abstract base class for Spectrum-aware PHY layers.
Definition: spectrum-phy.h:47
Set of values corresponding to a given SpectrumModel.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
@ S
second
Definition: nstime.h:114
int64_t GetMilliSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:383
static uint8_t TxMode2LayerNum(uint8_t txMode)
Transmit mode 2 layer number.
Definition: lte-common.cc:212
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
#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
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:88
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
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:85
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1268
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool operator==(const EventId &a, const EventId &b)
Definition: event-id.h:158
bool operator<(const EventId &a, const EventId &b)
Definition: event-id.h:176
std::vector< HarqProcessInfoElement_t > HarqProcessInfoList_t
HarqProcessInfoList_t typedef.
Definition: lte-harq-phy.h:48
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...
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:139
static const Time UL_SRS_DURATION
duration of SRS portion of UL subframe = 1 symbol for SRS -1ns as margin to avoid overlapping simulat...
static const double EffectiveCodingRate[29]
Effective coding rate.
@ IDLE
Channel is IDLE, no packet is being transmitted.
Definition: csma-channel.h:75
#define list
See section 4.3.23 dlInfoListElement.
uint8_t m_harqProcessId
HARQ process ID.
std::vector< enum HarqStatus_e > m_harqStatus
HARQ status.
PhyReceptionStatParameters structure.
Definition: lte-common.h:213
uint8_t m_txMode
the transmission Mode
Definition: lte-common.h:218
uint8_t m_rv
the redundancy version (HARQ)
Definition: lte-common.h:222
uint8_t m_layer
the layer (cw) of the transmission
Definition: lte-common.h:219
uint64_t m_imsi
IMSI of the scheduled UE.
Definition: lte-common.h:216
uint8_t m_correctness
correctness of the TB received
Definition: lte-common.h:224
uint16_t m_rnti
C-RNTI scheduled.
Definition: lte-common.h:217
uint16_t m_cellId
Cell ID of the attached Enb.
Definition: lte-common.h:215
uint8_t m_ndi
new data indicator flag
Definition: lte-common.h:223
uint8_t m_mcs
MCS for transport block.
Definition: lte-common.h:220
int64_t m_timestamp
in millisecond
Definition: lte-common.h:214
uint16_t m_size
Size of transport block.
Definition: lte-common.h:221
uint8_t m_ccId
component carrier id
Definition: lte-common.h:225
TbId_t structure.
uint8_t m_layer
layer
uint16_t m_rnti
RNTI.
TbStats_t structure.
double mi
Mutual information.
double tbler
Transport block BLER.
See section 4.3.12 ulInfoListElement.
uint8_t m_tpc
Tx power control command.
tbInfo_t structure