5G-LENA nr-v3.3-81-g75c7590d
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
nr-phy-rx-trace.h
1// Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
2// Copyright (c) 2015, NYU WIRELESS, Tandon School of Engineering, New York University
3//
4// SPDX-License-Identifier: GPL-2.0-only
5
6#ifndef SRC_NR_HELPER_NR_PHY_RX_TRACE_H_
7#define SRC_NR_HELPER_NR_PHY_RX_TRACE_H_
8
9#include <ns3/nr-control-messages.h>
10#include <ns3/nr-phy-mac-common.h>
11#include <ns3/nr-spectrum-phy.h>
12#include <ns3/object.h>
13#include <ns3/spectrum-phy.h>
14#include <ns3/spectrum-value.h>
15
16#include <fstream>
17#include <iostream>
18
19namespace ns3
20{
21
22class NrPhyRxTrace : public Object
23{
24 public:
26 ~NrPhyRxTrace() override;
27 static TypeId GetTypeId();
28
34 void SetSimTag(const std::string& simTag);
35
40 void SetResultsFolder(const std::string& resultsFolder);
41
51 static void DlDataSinrCallback(Ptr<NrPhyRxTrace> phyStats,
52 std::string path,
53 uint16_t cellId,
54 uint16_t rnti,
55 double avgSinr,
56 uint16_t bwpId);
57
67 static void DlCtrlSinrCallback(Ptr<NrPhyRxTrace> phyStats,
68 std::string path,
69 uint16_t cellId,
70 uint16_t rnti,
71 double avgSinr,
72 uint16_t bwpId);
73
74 static void UlSinrTraceCallback(Ptr<NrPhyRxTrace> phyStats,
75 std::string path,
76 uint64_t imsi,
77 SpectrumValue& sinr,
78 SpectrumValue& power);
79 static void ReportPacketCountUeCallback(Ptr<NrPhyRxTrace> phyStats,
80 std::string path,
82 static void ReportPacketCountGnbCallback(Ptr<NrPhyRxTrace> phyStats,
83 std::string path,
85 static void ReportDownLinkTBSize(Ptr<NrPhyRxTrace> phyStats,
86 std::string path,
87 uint64_t imsi,
88 uint64_t tbSize);
89 static void RxPacketTraceUeCallback(Ptr<NrPhyRxTrace> phyStats,
90 std::string path,
92 static void RxPacketTraceGnbCallback(Ptr<NrPhyRxTrace> phyStats,
93 std::string path,
95
107 static void RxedGnbPhyCtrlMsgsCallback(Ptr<NrPhyRxTrace> phyStats,
108 std::string path,
109 SfnSf sfn,
110 uint16_t nodeId,
111 uint16_t rnti,
112 uint8_t bwpId,
113 Ptr<const NrControlMessage> msg);
114
126 static void TxedGnbPhyCtrlMsgsCallback(Ptr<NrPhyRxTrace> phyStats,
127 std::string path,
128 SfnSf sfn,
129 uint16_t nodeId,
130 uint16_t rnti,
131 uint8_t bwpId,
132 Ptr<const NrControlMessage> msg);
133
145 static void RxedUePhyCtrlMsgsCallback(Ptr<NrPhyRxTrace> phyStats,
146 std::string path,
147 SfnSf sfn,
148 uint16_t nodeId,
149 uint16_t rnti,
150 uint8_t bwpId,
151 Ptr<const NrControlMessage> msg);
152
164 static void TxedUePhyCtrlMsgsCallback(Ptr<NrPhyRxTrace> phyStats,
165 std::string path,
166 SfnSf sfn,
167 uint16_t nodeId,
168 uint16_t rnti,
169 uint8_t bwpId,
170 Ptr<const NrControlMessage> msg);
171
184 static void RxedUePhyDlDciCallback(Ptr<NrPhyRxTrace> phyStats,
185 std::string path,
186 SfnSf sfn,
187 uint16_t nodeId,
188 uint16_t rnti,
189 uint8_t bwpId,
190 uint8_t harqId,
191 uint32_t k1Delay);
204 static void TxedUePhyHarqFeedbackCallback(Ptr<NrPhyRxTrace> phyStats,
205 std::string path,
206 SfnSf sfn,
207 uint16_t nodeId,
208 uint16_t rnti,
209 uint8_t bwpId,
210 uint8_t harqId,
211 uint32_t k1Delay);
221 static void PathlossTraceCallback(Ptr<NrPhyRxTrace> phyStats,
222 std::string path,
223 Ptr<const SpectrumPhy> txPhy,
224 Ptr<const SpectrumPhy> rxPhy,
225 double lossDb);
226
236 static void ReportDlCtrlPathloss(Ptr<NrPhyRxTrace> phyStats,
237 std::string path,
238 uint16_t cellId,
239 uint8_t bwpId,
240 uint32_t ueNodeId,
241 double lossDb);
242
254 static void ReportDlDataPathloss(Ptr<NrPhyRxTrace> phyStats,
255 std::string path,
256 uint16_t cellId,
257 uint8_t bwpId,
258 uint32_t ueNodeId,
259 double lossDb,
260 uint8_t cqi);
261
262 private:
263 void ReportInterferenceTrace(uint64_t imsi, SpectrumValue& sinr);
264 void ReportPowerTrace(uint64_t imsi, SpectrumValue& power);
265 void ReportPacketCountUe(UePhyPacketCountParameter param);
266 void ReportPacketCountGnb(GnbPhyPacketCountParameter param);
267 void ReportDLTbSize(uint64_t imsi, uint64_t tbSize);
275 void WriteDlPathlossTrace(Ptr<NrSpectrumPhy> txNrSpectrumPhy,
276 Ptr<NrSpectrumPhy> rxNrSpectrumPhy,
277 double lossDb);
285 void WriteUlPathlossTrace(Ptr<NrSpectrumPhy> txNrSpectrumPhy,
286 Ptr<NrSpectrumPhy> rxNrSpectrumPhy,
287 double lossDb);
288
289 static std::string m_simTag;
290 static std::string m_resultsFolder;
291
292 static std::ofstream m_dlDataSinrFile;
293 static std::string m_dlDataSinrFileName;
294
295 static std::ofstream m_dlCtrlSinrFile;
296 static std::string m_dlCtrlSinrFileName;
297
298 static std::ofstream m_rxPacketTraceFile;
299 static std::string m_rxPacketTraceFilename;
300
301 static std::ofstream m_rxedGnbPhyCtrlMsgsFile;
302 static std::string m_rxedGnbPhyCtrlMsgsFileName;
303 static std::ofstream m_txedGnbPhyCtrlMsgsFile;
304 static std::string m_txedGnbPhyCtrlMsgsFileName;
305
306 static std::ofstream m_rxedUePhyCtrlMsgsFile;
307 static std::string m_rxedUePhyCtrlMsgsFileName;
308 static std::ofstream m_txedUePhyCtrlMsgsFile;
309 static std::string m_txedUePhyCtrlMsgsFileName;
310 static std::ofstream m_rxedUePhyDlDciFile;
311 static std::string m_rxedUePhyDlDciFileName;
312 static std::ofstream m_dlPathlossFile;
313 static std::string m_dlPathlossFileName;
314 static std::ofstream m_ulPathlossFile;
315 static std::string m_ulPathlossFileName;
316
317 static std::ofstream m_dlCtrlPathlossFile;
318 static std::string m_dlCtrlPathlossFileName;
319 static std::ofstream m_dlDataPathlossFile;
320 static std::string m_dlDataPathlossFileName;
321};
322
323} /* namespace ns3 */
324
325#endif /* SRC_NR_HELPER_NR_PHY_RX_TRACE_H_ */
static void RxedGnbPhyCtrlMsgsCallback(Ptr< NrPhyRxTrace > phyStats, std::string path, SfnSf sfn, uint16_t nodeId, uint16_t rnti, uint8_t bwpId, Ptr< const NrControlMessage > msg)
static void ReportDlDataPathloss(Ptr< NrPhyRxTrace > phyStats, std::string path, uint16_t cellId, uint8_t bwpId, uint32_t ueNodeId, double lossDb, uint8_t cqi)
Write DL DATA pathloss values in a file.
static void PathlossTraceCallback(Ptr< NrPhyRxTrace > phyStats, std::string path, Ptr< const SpectrumPhy > txPhy, Ptr< const SpectrumPhy > rxPhy, double lossDb)
Trace sink for spectrum channel pathloss trace.
static void TxedGnbPhyCtrlMsgsCallback(Ptr< NrPhyRxTrace > phyStats, std::string path, SfnSf sfn, uint16_t nodeId, uint16_t rnti, uint8_t bwpId, Ptr< const NrControlMessage > msg)
void SetResultsFolder(const std::string &resultsFolder)
Set results folder.
static void TxedUePhyCtrlMsgsCallback(Ptr< NrPhyRxTrace > phyStats, std::string path, SfnSf sfn, uint16_t nodeId, uint16_t rnti, uint8_t bwpId, Ptr< const NrControlMessage > msg)
static void TxedUePhyHarqFeedbackCallback(Ptr< NrPhyRxTrace > phyStats, std::string path, SfnSf sfn, uint16_t nodeId, uint16_t rnti, uint8_t bwpId, uint8_t harqId, uint32_t k1Delay)
static void RxedUePhyCtrlMsgsCallback(Ptr< NrPhyRxTrace > phyStats, std::string path, SfnSf sfn, uint16_t nodeId, uint16_t rnti, uint8_t bwpId, Ptr< const NrControlMessage > msg)
static void DlCtrlSinrCallback(Ptr< NrPhyRxTrace > phyStats, std::string path, uint16_t cellId, uint16_t rnti, double avgSinr, uint16_t bwpId)
Trace sink for DL Average SINR of CTRL (in dB).
static void RxedUePhyDlDciCallback(Ptr< NrPhyRxTrace > phyStats, std::string path, SfnSf sfn, uint16_t nodeId, uint16_t rnti, uint8_t bwpId, uint8_t harqId, uint32_t k1Delay)
void SetSimTag(const std::string &simTag)
Set simTag that will be concatenated to output file names.
static void DlDataSinrCallback(Ptr< NrPhyRxTrace > phyStats, std::string path, uint16_t cellId, uint16_t rnti, double avgSinr, uint16_t bwpId)
Trace sink for DL Average SINR of DATA (in dB).
static void ReportDlCtrlPathloss(Ptr< NrPhyRxTrace > phyStats, std::string path, uint16_t cellId, uint8_t bwpId, uint32_t ueNodeId, double lossDb)
Write DL CTRL pathloss values in a file.
The SfnSf class.
Definition sfnsf.h:32
The GnbPhyPacketCountParameter struct.
The RxPacketTraceParams struct.
The UePhyPacketCountParameter struct.