5G-LENA nr-v3.0-33-g7aea1e4
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
nr-phy-rx-trace.h
1/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
3// Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4// Copyright (c) 2015, NYU WIRELESS, Tandon School of Engineering, New York University
5//
6// SPDX-License-Identifier: GPL-2.0-only
7
8#ifndef SRC_NR_HELPER_NR_PHY_RX_TRACE_H_
9#define SRC_NR_HELPER_NR_PHY_RX_TRACE_H_
10
11#include <ns3/nr-control-messages.h>
12#include <ns3/nr-phy-mac-common.h>
13#include <ns3/nr-spectrum-phy.h>
14#include <ns3/object.h>
15#include <ns3/spectrum-phy.h>
16#include <ns3/spectrum-value.h>
17
18#include <fstream>
19#include <iostream>
20
21namespace ns3
22{
23
24class NrPhyRxTrace : public Object
25{
26 public:
28 ~NrPhyRxTrace() override;
29 static TypeId GetTypeId();
30
36 void SetSimTag(const std::string& simTag);
37
42 void SetResultsFolder(const std::string& resultsFolder);
43
53 static void DlDataSinrCallback(Ptr<NrPhyRxTrace> phyStats,
54 std::string path,
55 uint16_t cellId,
56 uint16_t rnti,
57 double avgSinr,
58 uint16_t bwpId);
59
69 static void DlCtrlSinrCallback(Ptr<NrPhyRxTrace> phyStats,
70 std::string path,
71 uint16_t cellId,
72 uint16_t rnti,
73 double avgSinr,
74 uint16_t bwpId);
75
76 static void UlSinrTraceCallback(Ptr<NrPhyRxTrace> phyStats,
77 std::string path,
78 uint64_t imsi,
79 SpectrumValue& sinr,
80 SpectrumValue& power);
81 static void ReportPacketCountUeCallback(Ptr<NrPhyRxTrace> phyStats,
82 std::string path,
84 static void ReportPacketCountEnbCallback(Ptr<NrPhyRxTrace> phyStats,
85 std::string path,
87 static void ReportDownLinkTBSize(Ptr<NrPhyRxTrace> phyStats,
88 std::string path,
89 uint64_t imsi,
90 uint64_t tbSize);
91 static void RxPacketTraceUeCallback(Ptr<NrPhyRxTrace> phyStats,
92 std::string path,
94 static void RxPacketTraceEnbCallback(Ptr<NrPhyRxTrace> phyStats,
95 std::string path,
97
109 static void RxedGnbPhyCtrlMsgsCallback(Ptr<NrPhyRxTrace> phyStats,
110 std::string path,
111 SfnSf sfn,
112 uint16_t nodeId,
113 uint16_t rnti,
114 uint8_t bwpId,
115 Ptr<const NrControlMessage> msg);
116
128 static void TxedGnbPhyCtrlMsgsCallback(Ptr<NrPhyRxTrace> phyStats,
129 std::string path,
130 SfnSf sfn,
131 uint16_t nodeId,
132 uint16_t rnti,
133 uint8_t bwpId,
134 Ptr<const NrControlMessage> msg);
135
147 static void RxedUePhyCtrlMsgsCallback(Ptr<NrPhyRxTrace> phyStats,
148 std::string path,
149 SfnSf sfn,
150 uint16_t nodeId,
151 uint16_t rnti,
152 uint8_t bwpId,
153 Ptr<const NrControlMessage> msg);
154
166 static void TxedUePhyCtrlMsgsCallback(Ptr<NrPhyRxTrace> phyStats,
167 std::string path,
168 SfnSf sfn,
169 uint16_t nodeId,
170 uint16_t rnti,
171 uint8_t bwpId,
172 Ptr<const NrControlMessage> msg);
173
186 static void RxedUePhyDlDciCallback(Ptr<NrPhyRxTrace> phyStats,
187 std::string path,
188 SfnSf sfn,
189 uint16_t nodeId,
190 uint16_t rnti,
191 uint8_t bwpId,
192 uint8_t harqId,
193 uint32_t k1Delay);
206 static void TxedUePhyHarqFeedbackCallback(Ptr<NrPhyRxTrace> phyStats,
207 std::string path,
208 SfnSf sfn,
209 uint16_t nodeId,
210 uint16_t rnti,
211 uint8_t bwpId,
212 uint8_t harqId,
213 uint32_t k1Delay);
223 static void PathlossTraceCallback(Ptr<NrPhyRxTrace> phyStats,
224 std::string path,
225 Ptr<const SpectrumPhy> txPhy,
226 Ptr<const SpectrumPhy> rxPhy,
227 double lossDb);
228
238 static void ReportDlCtrlPathloss(Ptr<NrPhyRxTrace> phyStats,
239 std::string path,
240 uint16_t cellId,
241 uint8_t bwpId,
242 uint32_t ueNodeId,
243 double lossDb);
244
256 static void ReportDlDataPathloss(Ptr<NrPhyRxTrace> phyStats,
257 std::string path,
258 uint16_t cellId,
259 uint8_t bwpId,
260 uint32_t ueNodeId,
261 double lossDb,
262 uint8_t cqi);
263
264 private:
265 void ReportInterferenceTrace(uint64_t imsi, SpectrumValue& sinr);
266 void ReportPowerTrace(uint64_t imsi, SpectrumValue& power);
267 void ReportPacketCountUe(UePhyPacketCountParameter param);
268 void ReportPacketCountEnb(GnbPhyPacketCountParameter param);
269 void ReportDLTbSize(uint64_t imsi, uint64_t tbSize);
277 void WriteDlPathlossTrace(Ptr<NrSpectrumPhy> txNrSpectrumPhy,
278 Ptr<NrSpectrumPhy> rxNrSpectrumPhy,
279 double lossDb);
287 void WriteUlPathlossTrace(Ptr<NrSpectrumPhy> txNrSpectrumPhy,
288 Ptr<NrSpectrumPhy> rxNrSpectrumPhy,
289 double lossDb);
290
291 static std::string m_simTag;
292 static std::string m_resultsFolder;
293
294 static std::ofstream m_dlDataSinrFile;
295 static std::string m_dlDataSinrFileName;
296
297 static std::ofstream m_dlCtrlSinrFile;
298 static std::string m_dlCtrlSinrFileName;
299
300 static std::ofstream m_rxPacketTraceFile;
301 static std::string m_rxPacketTraceFilename;
302
303 static std::ofstream m_rxedGnbPhyCtrlMsgsFile;
304 static std::string m_rxedGnbPhyCtrlMsgsFileName;
305 static std::ofstream m_txedGnbPhyCtrlMsgsFile;
306 static std::string m_txedGnbPhyCtrlMsgsFileName;
307
308 static std::ofstream m_rxedUePhyCtrlMsgsFile;
309 static std::string m_rxedUePhyCtrlMsgsFileName;
310 static std::ofstream m_txedUePhyCtrlMsgsFile;
311 static std::string m_txedUePhyCtrlMsgsFileName;
312 static std::ofstream m_rxedUePhyDlDciFile;
313 static std::string m_rxedUePhyDlDciFileName;
314 static std::ofstream m_dlPathlossFile;
315 static std::string m_dlPathlossFileName;
316 static std::ofstream m_ulPathlossFile;
317 static std::string m_ulPathlossFileName;
318
319 static std::ofstream m_dlCtrlPathlossFile;
320 static std::string m_dlCtrlPathlossFileName;
321 static std::ofstream m_dlDataPathlossFile;
322 static std::string m_dlDataPathlossFileName;
323};
324
325} /* namespace ns3 */
326
327#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:34
The GnbPhyPacketCountParameter struct.
The RxPacketTraceParams struct.
The UePhyPacketCountParameter struct.