22 #include "lte-interference.h"
23 #include "lte-sinr-chunk-processor.h"
25 #include <ns3/simulator.h>
34 LteInterference::LteInterference ()
35 : m_receiving (false),
37 m_lastSignalIdBeforeReset (0)
42 LteInterference::~LteInterference ()
62 LteInterference::GetTypeId (
void)
75 if (m_receiving ==
false)
101 (*m_rxSignal) += (*rxPsd);
110 if (m_receiving !=
true)
112 NS_LOG_INFO (
"EndRx was already evaluated or RX was aborted");
116 ConditionallyEvaluateChunk ();
139 uint32_t signalId = ++m_lastSignalId;
140 if (signalId == m_lastSignalIdBeforeReset)
147 m_lastSignalIdBeforeReset += 0x10000000;
157 ConditionallyEvaluateChunk ();
158 (*m_allSignals) += (*spd);
162 LteInterference::DoSubtractSignal (Ptr<const SpectrumValue> spd, uint32_t signalId)
165 ConditionallyEvaluateChunk ();
166 int32_t deltaSignalId = signalId - m_lastSignalIdBeforeReset;
167 if (deltaSignalId > 0)
169 (*m_allSignals) -= (*spd);
173 NS_LOG_INFO (
"ignoring signal scheduled for subtraction before last reset");
179 LteInterference::ConditionallyEvaluateChunk ()
191 SpectrumValue interf = (*m_allSignals) - (*m_rxSignal) + (*m_noise);
193 SpectrumValue sinr = (*m_rxSignal) / interf;
197 (*it)->EvaluateSinrChunk (sinr, duration);
201 (*it)->EvaluateSinrChunk (*
m_rxSignal, duration);
205 NS_LOG_DEBUG (
this <<
"ConditionallyEvaluateChunk INTERF ");
206 (*it)->EvaluateSinrChunk (interf, duration);
220 ConditionallyEvaluateChunk ();
224 m_allSignals = Create<SpectrumValue> (noisePsd->GetSpectrumModel ());
225 if (m_receiving ==
true)
232 m_lastSignalIdBeforeReset = m_lastSignalId;
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
std::list< Ptr< LteSinrChunkProcessor > > m_interfChunkProcessorList
void AddInterferenceChunkProcessor(Ptr< LteSinrChunkProcessor > p)
#define NS_ASSERT(condition)
#define NS_LOG_COMPONENT_DEFINE(name)
virtual void DoDispose(void)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
void AddSinrChunkProcessor(Ptr< LteSinrChunkProcessor > p)
#define NS_LOG_LOGIC(msg)
void SetNoisePowerSpectralDensity(Ptr< const SpectrumValue > noisePsd)
void StartRx(Ptr< const SpectrumValue > rxPsd)
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
void AddRsPowerChunkProcessor(Ptr< LteSinrChunkProcessor > p)
#define NS_LOG_DEBUG(msg)
void AddSignal(Ptr< const SpectrumValue > spd, const Time duration)
double Sum(const SpectrumValue &x)
Ptr< SpectrumValue > m_rxSignal
std::list< Ptr< LteSinrChunkProcessor > > m_rsPowerChunkProcessorList
std::list< Ptr< LteSinrChunkProcessor > > m_sinrChunkProcessorList
a base class which provides memory management and object aggregation
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Ptr< SpectrumValue > m_allSignals