5G-LENA nr-v3.3-81-g75c7590d
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
nr-interference.h
1// Copyright (c) 2019 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
2//
3// SPDX-License-Identifier: GPL-2.0-only
4
5#ifndef NR_INTERFERENCE_H
6#define NR_INTERFERENCE_H
7
8#include "nr-chunk-processor.h"
9#include "nr-interference-base.h"
10
11#include <ns3/nstime.h>
12#include <ns3/object.h>
13#include <ns3/spectrum-signal-parameters.h>
14#include <ns3/spectrum-value.h>
15#include <ns3/traced-callback.h>
16#include <ns3/vector.h>
17
18namespace ns3
19{
20
21// Signal ID increment used in LteInterference
22static constexpr uint32_t NR_LTE_SIGNALID_INCR = 0x10000000;
23
24class NrCovMat;
25class NrSinrMatrix;
26class NrErrorModel;
27class NrMimoChunkProcessor;
28
40{
41 public:
49 ~NrInterference() override;
54 static TypeId GetTypeId();
55
56 void AddSignal(Ptr<const SpectrumValue> spd, Time duration) override;
57
67 bool IsChannelBusyNow(double energyW);
68
77 Time GetEnergyDuration(double energyW);
78
89 void AppendEvent(Time startTime, Time endTime, double rxPowerW);
93 void EraseEvents();
94
95 // inherited from LteInterference
96 void EndRx() override;
97
103 virtual void AddSignalMimo(Ptr<const SpectrumSignalParameters> params, const Time& duration);
104
109 virtual void StartRxMimo(Ptr<const SpectrumSignalParameters> params);
110
116 virtual void DoSubtractSignalMimo(Ptr<const SpectrumSignalParameters> params,
117 uint32_t signalId);
118
121 virtual void AddMimoChunkProcessor(Ptr<NrMimoChunkProcessor> cp);
122
127 bool IsChunkProcessorSet();
128
129 private:
134 NrCovMat CalcOutOfCellInterfCov() const;
135
142 NrCovMat CalcCurrInterfCov(Ptr<const SpectrumSignalParameters> rxSignal,
143 const NrCovMat& outOfCellInterfCov) const;
144
148 void AddInterference(NrCovMat& covMat, Ptr<const SpectrumSignalParameters> signal) const;
149
154 NrSinrMatrix ComputeSinr(NrCovMat& outOfCellInterfCov,
155 Ptr<const SpectrumSignalParameters> rxSignal) const;
156
158 std::vector<Ptr<const SpectrumSignalParameters>> m_allSignalsMimo;
159
161 std::vector<Ptr<const SpectrumSignalParameters>> m_rxSignalsMimo;
162
164 std::list<Ptr<NrMimoChunkProcessor>> m_mimoChunkProcessors;
165
169 class NiChange
170 {
171 public:
178 NiChange(Time time, double delta);
184 Time GetTime() const;
190 double GetDelta() const;
197 bool operator<(const NiChange& o) const;
198
199 private:
200 Time m_time;
201 double m_delta;
202 };
203
207 typedef std::vector<NiChange> NiChanges;
208
219 NrInterference::NiChanges::iterator GetPosition(Time moment);
220
221 // inherited from LteInterference
222 void ConditionallyEvaluateChunk() override;
223
228 void AddNiChangeEvent(NiChange change);
229
230 protected:
234 void DoDispose() override;
235
236 TracedCallback<double> m_snrPerProcessedChunk;
237 TracedCallback<double> m_rssiPerProcessedChunk;
238
241 NiChanges m_niChanges;
244};
245
246} // namespace ns3
247
248#endif /* NR_INTERFERENCE_H */
The NrInterference class inherits LteInterference which implements a gaussian interference model,...
NiChanges m_niChanges
List of events in which there is some change in the energy.
void EndRx() override
NrInterference()
NrInterference constructor.
virtual void AddMimoChunkProcessor(Ptr< NrMimoChunkProcessor > cp)
Add a chunk processor for MIMO signals.
TracedCallback< double > m_rssiPerProcessedChunk
! Trace for RSSI pre processed chunk.
virtual void DoSubtractSignalMimo(Ptr< const SpectrumSignalParameters > params, uint32_t signalId)
Notify that a signals transmission is ending. This means that the signal will be removed from the lis...
bool IsChannelBusyNow(double energyW)
Checks if the sum of the energy, including the energies that start at this moment is greater than pro...
~NrInterference() override
~NrInterference
void AppendEvent(Time startTime, Time endTime, double rxPowerW)
Crates events corresponding to the new energy. One event corresponds to the moment when the energy st...
void AddSignal(Ptr< const SpectrumValue > spd, Time duration) override
Time GetEnergyDuration(double energyW)
Returns the duration of the energy that is above the energy provided detection threshold.
TracedCallback< double > m_snrPerProcessedChunk
! Trace for SNR per processed chunk.
virtual void StartRxMimo(Ptr< const SpectrumSignalParameters > params)
Notify the intended receiver that a new signal is being received. This method is to be called only fo...
virtual void AddSignalMimo(Ptr< const SpectrumSignalParameters > params, const Time &duration)
Notify that a new signal is being perceived in the medium. This method is to be called for all incomi...
void DoDispose() override
DoDispose method inherited from Object.
static TypeId GetTypeId()
Get the object TypeId.
NrSinrMatrix stores the MIMO SINR matrix, with dimension rank x nRbs.