From 40443eb69273b8dfdbfd5ce1fa5972037bcd9eb7 Mon Sep 17 00:00:00 2001 From: Marco Miozzo Date: Thu, 12 Jan 2012 17:41:52 +0100 Subject: [PATCH] Add LteSpectrumPhy::PemEnabled atribute for enable/disable the phy error model --- src/lte/model/lte-spectrum-phy.cc | 23 ++++++++++++++++------- src/lte/model/lte-spectrum-phy.h | 1 + 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/lte/model/lte-spectrum-phy.cc b/src/lte/model/lte-spectrum-phy.cc index f67d15b3a..4a9137ee0 100644 --- a/src/lte/model/lte-spectrum-phy.cc +++ b/src/lte/model/lte-spectrum-phy.cc @@ -34,6 +34,7 @@ #include "lte-phy-tag.h" #include #include +#include NS_LOG_COMPONENT_DEFINE ("LteSpectrumPhy"); @@ -112,6 +113,11 @@ LteSpectrumPhy::GetTypeId (void) .AddTraceSource ("RxEndError", "Trace fired when a previosuly started RX terminates with an error", MakeTraceSourceAccessor (&LteSpectrumPhy::m_phyRxEndErrorTrace)) + .AddAttribute ("PemEnabled", + "Activate/Deactivate the error model (by default is active).", + BooleanValue (true), + MakeBooleanAccessor (&LteSpectrumPhy::m_pemEnabled), + MakeBooleanChecker ()); ; return tid; } @@ -439,14 +445,17 @@ LteSpectrumPhy::EndRx () expectedTbs_t::iterator itTb = m_expectedTbs.begin (); while (itTb!=m_expectedTbs.end ()) { - double errorRate = LteMiErrorModel::GetTbError (m_sinrPerceived, (*itTb).second.rbBitmap, (*itTb).second.size, (*itTb).second.mcs); - (*itTb).second.corrupt = m_random.GetValue () > errorRate ? false : true; - NS_LOG_DEBUG (this << "RNTI " << (*itTb).first << " size " << (*itTb).second.size << " mcs " << (uint32_t)(*itTb).second.mcs << " bitmap " << (*itTb).second.rbBitmap.size () << " ErrorRate " << errorRate << " corrupted " << (*itTb).second.corrupt); - - for (uint16_t i = 0; i < (*itTb).second.rbBitmap.size (); i++) + if (m_pemEnabled) { - NS_LOG_DEBUG (this << " RB " << (*itTb).second.rbBitmap.at (i) << " SINR " << m_sinrPerceived[(*itTb).second.rbBitmap.at (i)]); - } + double errorRate = LteMiErrorModel::GetTbError (m_sinrPerceived, (*itTb).second.rbBitmap, (*itTb).second.size, (*itTb).second.mcs); + (*itTb).second.corrupt = m_random.GetValue () > errorRate ? false : true; + NS_LOG_DEBUG (this << "RNTI " << (*itTb).first << " size " << (*itTb).second.size << " mcs " << (uint32_t)(*itTb).second.mcs << " bitmap " << (*itTb).second.rbBitmap.size () << " ErrorRate " << errorRate << " corrupted " << (*itTb).second.corrupt); + } + +// for (uint16_t i = 0; i < (*itTb).second.rbBitmap.size (); i++) +// { +// NS_LOG_DEBUG (this << " RB " << (*itTb).second.rbBitmap.at (i) << " SINR " << m_sinrPerceived[(*itTb).second.rbBitmap.at (i)]); +// } itTb++; } diff --git a/src/lte/model/lte-spectrum-phy.h b/src/lte/model/lte-spectrum-phy.h index 4c5ade8de..299330134 100644 --- a/src/lte/model/lte-spectrum-phy.h +++ b/src/lte/model/lte-spectrum-phy.h @@ -212,6 +212,7 @@ private: SpectrumValue m_sinrPerceived; UniformVariable m_random; + bool m_pemEnabled; // when true (default) the phy error model is enabled };