24 #include <ns3/object-factory.h>
27 #include <ns3/simulator.h>
28 #include <ns3/trace-source-accessor.h>
29 #include <ns3/antenna-model.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>
84 m_transmissionMode (0)
87 m_random = CreateObject<UniformRandomVariable> ();
93 for (uint8_t i = 0; i < 7; i++)
153 .AddTraceSource (
"TxStart",
154 "Trace fired when a new transmission is started",
156 .AddTraceSource (
"TxEnd",
157 "Trace fired when a previosuly started transmission is finished",
159 .AddTraceSource (
"RxStart",
160 "Trace fired when the start of a signal is detected",
162 .AddTraceSource (
"RxEndOk",
163 "Trace fired when a previosuly started RX terminates successfully",
165 .AddTraceSource (
"RxEndError",
166 "Trace fired when a previosuly started RX terminates with an error",
168 .AddAttribute (
"DataErrorModelEnabled",
169 "Activate/Deactivate the error model of data (TBs of PDSCH and PUSCH) [by default is active].",
172 MakeBooleanChecker ())
173 .AddAttribute (
"CtrlErrorModelEnabled",
174 "Activate/Deactivate the error model of control (PCFICH-PDCCH decodification) [by default is active].",
177 MakeBooleanChecker ())
330 NS_FATAL_ERROR (
"cannot TX while RX: according to FDD channel acces, the physical layer for transmission cannot be used for reception");
334 NS_FATAL_ERROR (
"cannot TX while already TX: the MAC should avoid this");
354 txParams->duration = duration;
355 txParams->txPhy = GetObject<SpectrumPhy> ();
358 txParams->packetBurst = pb;
359 txParams->ctrlMsgList = ctrlMsgList;
386 NS_FATAL_ERROR (
"cannot TX while RX: according to FDD channel acces, the physical layer for transmission cannot be used for reception");
390 NS_FATAL_ERROR (
"cannot TX while already TX: the MAC should avoid this");
411 txParams->txPhy = GetObject<SpectrumPhy> ();
415 txParams->ctrlMsgList = ctrlMsgList;
442 NS_FATAL_ERROR (
"cannot TX while RX: according to FDD channel acces, the physical layer for transmission cannot be used for reception");
446 NS_FATAL_ERROR (
"cannot TX while already TX: the MAC should avoid this");
466 txParams->txPhy = GetObject<SpectrumPhy> ();
517 Time duration = spectrumRxParams->duration;
522 if (lteDataRxParams != 0)
531 if ((lteDlCtrlRxParams!=0)||(lteUlSrsRxParams!=0))
553 NS_FATAL_ERROR (
"cannot RX while TX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
569 NS_LOG_LOGIC (
this <<
" synchronized with this signal (cellId=" << params->cellId <<
")");
577 NS_LOG_LOGIC (
this <<
" scheduling EndRx with delay " << params->duration.GetSeconds () <<
"s");
592 if (params->packetBurst)
599 NS_LOG_DEBUG (
this <<
" insert msgs " << params->ctrlMsgList.size ());
606 NS_LOG_LOGIC (
this <<
" not in sync with this signal (cellId="
607 << params->cellId <<
", m_cellId=" <<
m_cellId <<
")");
629 NS_FATAL_ERROR (
"cannot RX while TX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
646 if (lteDlCtrlRxParams!=0)
648 cellId = lteDlCtrlRxParams->cellId;
654 cellId = lteUlSrsRxParams->cellId;
659 NS_LOG_LOGIC (
this <<
" synchronized with this signal (cellId=" << cellId <<
")");
667 NS_LOG_LOGIC (
this <<
" scheduling EndRx with delay " << params->duration);
696 NS_LOG_LOGIC (
this <<
" not in sync with this signal (cellId="
697 << cellId <<
", m_cellId=" <<
m_cellId <<
")");
722 NS_LOG_LOGIC (
this <<
" rnti: " << rnti <<
" size " << size <<
" mcs " << (uint16_t)mcs <<
" layer " << (uint8_t)layer);
726 expectedTbs_t::iterator it;
734 tbInfo_t tbInfo = {size, mcs, map,
false};
735 m_expectedTbs.insert (std::pair<TbId_t, tbInfo_t> (tbId,tbInfo ));
763 double errorRate =
LteMiErrorModel::GetTbError (m_sinrPerceived, (*itTb).second.rbBitmap, (*itTb).second.size, (*itTb).second.mcs);
765 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 <<
" ErrorRate " << errorRate <<
" corrupted " << (*itTb).second.corrupt);
781 (*j)->PeekPacketTag (tag);
789 if (!(*itTb).second.corrupt)
847 NS_LOG_DEBUG (
this <<
" PCFICH-PDCCH Decodification, errorRate " << errorRate <<
" error " << error);
908 NS_LOG_FUNCTION (
this <<
" txmode " << (uint16_t)txMode <<
" gain " << gain);
910 gain = std::pow (10.0, (gain / 10.0));
915 std::vector <double> temp;
918 for (uint8_t i = 0; i < temp.size (); i++)