5G-LENA nr-v3.0-33-g7aea1e4
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
nr-interference.h
1/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
3// Copyright (c) 2019 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4//
5// SPDX-License-Identifier: GPL-2.0-only
6
7#ifndef NR_INTERFERENCE_H
8#define NR_INTERFERENCE_H
9
10#include <ns3/lte-interference.h>
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
39class NrInterference : public LteInterference
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
123 private:
128 NrCovMat CalcOutOfCellInterfCov() const;
129
136 NrCovMat CalcCurrInterfCov(Ptr<const SpectrumSignalParameters> rxSignal,
137 const NrCovMat& outOfCellInterfCov) const;
138
142 void AddInterference(NrCovMat& covMat, Ptr<const SpectrumSignalParameters> signal) const;
143
148 NrSinrMatrix ComputeSinr(NrCovMat& outOfCellInterfCov,
149 Ptr<const SpectrumSignalParameters> rxSignal) const;
150
152 std::vector<Ptr<const SpectrumSignalParameters>> m_allSignalsMimo;
153
155 std::vector<Ptr<const SpectrumSignalParameters>> m_rxSignalsMimo;
156
158 std::list<Ptr<NrMimoChunkProcessor>> m_mimoChunkProcessors;
159
163 class NiChange
164 {
165 public:
172 NiChange(Time time, double delta);
178 Time GetTime() const;
184 double GetDelta() const;
191 bool operator<(const NiChange& o) const;
192
193 private:
194 Time m_time;
195 double m_delta;
196 };
197
201 typedef std::vector<NiChange> NiChanges;
202
213 NrInterference::NiChanges::iterator GetPosition(Time moment);
214
215 // inherited from LteInterference
216 void ConditionallyEvaluateChunk() override;
217
222 void AddNiChangeEvent(NiChange change);
223
224 protected:
228 void DoDispose() override;
229
230 TracedCallback<double> m_snrPerProcessedChunk;
231 TracedCallback<double> m_rssiPerProcessedChunk;
232
235 NiChanges m_niChanges;
238};
239
240} // namespace ns3
241
242#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.
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...
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.