A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
phy-stats-calculator.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Jaume Nin <jnin@cttc.es>
7 */
8
9#ifndef PHY_STATS_CALCULATOR_H_
10#define PHY_STATS_CALCULATOR_H_
11
13
14#include "ns3/nstime.h"
15#include "ns3/spectrum-value.h"
16#include "ns3/uinteger.h"
17
18#include <fstream>
19#include <string>
20
21namespace ns3
22{
23
24/**
25 * \ingroup lte
26 *
27 * Takes care of storing the information generated at PHY layer. Metrics saved are:
28 * - RSRP and average SINR for DL
29 * - Timestamp (in seconds)
30 * - IMSI
31 * - C-RNTI
32 * - RSRP
33 * - SINR
34 * - componentCarrierId
35 * - UE SINR
36 * - Timestamp (in seconds)
37 * - Cell ID of the reported Enb
38 * - IMSI
39 * - C-RNTI
40 * - measured and reported SINR value in linear
41 * - componentCarrierId
42 * - Interference for UL
43 * - Cell ID of the reported Enb
44 * - IMSI of the scheduled UE
45 * - C-RNTI scheduled
46 * - Measured interference for each RB
47 */
49{
50 public:
51 /**
52 * Constructor
53 */
55
56 /**
57 * Destructor
58 */
59 ~PhyStatsCalculator() override;
60
61 // Inherited from ns3::Object
62 /**
63 * Register this type.
64 * @return The object TypeId.
65 */
66 static TypeId GetTypeId();
67
68 /**
69 * Set the name of the file where the RSRP/SINR statistics will be stored.
70 *
71 * @param filename string with the name of the file
72 */
73 void SetCurrentCellRsrpSinrFilename(std::string filename);
74
75 /**
76 * Get the name of the file where the RSRP/SINR statistics will be stored.
77 * @return the name of the file where the RSRP/SINR statistics will be stored
78 */
80
81 /**
82 * Set the name of the file where the UE SINR statistics will be stored.
83 *
84 * @param filename string with the name of the file
85 */
86 void SetUeSinrFilename(std::string filename);
87
88 /**
89 * Get the name of the file where the UE SINR statistics will be stored.
90 * @return the name of the file where the UE SINR statistics will be stored
91 */
92 std::string GetUeSinrFilename();
93
94 /**
95 * Set the name of the file where the interference statistics will be stored.
96 *
97 * @param filename string with the name of the file
98 */
99 void SetInterferenceFilename(std::string filename);
100
101 /**
102 * Get the name of the file where the interference statistics will be stored.
103 * @return the name of the file where the interference statistics will be stored
104 */
105 std::string GetInterferenceFilename();
106
107 /**
108 * Notifies the stats calculator that an RSRP and SINR report has occurred.
109 * @param cellId CellId for which stats are generated
110 * @param imsi IMSI of the scheduled UE
111 * @param rnti C-RNTI scheduled
112 * @param rsrp Reference Signal Received Power
113 * @param sinr SINR averaged among RBs
114 * @param componentCarrierId
115 */
116 void ReportCurrentCellRsrpSinr(uint16_t cellId,
117 uint64_t imsi,
118 uint16_t rnti,
119 double rsrp,
120 double sinr,
121 uint8_t componentCarrierId);
122
123 /**
124 * Notifies the stats calculator that an UE SINR report has occurred.
125 * @param cellId Cell ID of the reported Enb
126 * @param imsi IMSI of the scheduled UE
127 * @param rnti C-RNTI scheduled
128 * @param sinrLinear measured and reported SINR value in linear
129 * @param componentCarrierId
130 */
131 void ReportUeSinr(uint16_t cellId,
132 uint64_t imsi,
133 uint16_t rnti,
134 double sinrLinear,
135 uint8_t componentCarrierId);
136
137 /**
138 * Notifies the stats calculator that an interference report has occurred.
139 * @param cellId Cell ID of the reported Enb
140 * @param interference Measured interference for each RB
141 */
142 void ReportInterference(uint16_t cellId, Ptr<SpectrumValue> interference);
143
144 /**
145 * trace sink
146 *
147 * \param phyStats
148 * \param path
149 * \param cellId
150 * \param rnti
151 * \param rsrp
152 * \param sinr
153 * \param componentCarrierId
154 */
156 std::string path,
157 uint16_t cellId,
158 uint16_t rnti,
159 double rsrp,
160 double sinr,
161 uint8_t componentCarrierId);
162
163 /**
164 * trace sink
165 *
166 * \param phyStats
167 * \param path
168 * \param cellId
169 * \param rnti
170 * \param sinrLinear
171 * \param componentCarrierId
172 */
173 static void ReportUeSinr(Ptr<PhyStatsCalculator> phyStats,
174 std::string path,
175 uint16_t cellId,
176 uint16_t rnti,
177 double sinrLinear,
178 uint8_t componentCarrierId);
179
180 /**
181 * trace sink
182 *
183 * \param phyStats
184 * \param path
185 * \param cellId
186 * \param interference
187 */
188 static void ReportInterference(Ptr<PhyStatsCalculator> phyStats,
189 std::string path,
190 uint16_t cellId,
191 Ptr<SpectrumValue> interference);
192
193 private:
194 /**
195 * When writing RSRP SINR statistics first time to file,
196 * columns description is added. Then next lines are
197 * appended to file. This value is true if output
198 * files have not been opened yet
199 */
201
202 /**
203 * When writing UE SINR statistics first time to file,
204 * columns description is added. Then next lines are
205 * appended to file. This value is true if output
206 * files have not been opened yet
207 */
209
210 /**
211 * When writing interference statistics first time to file,
212 * columns description is added. Then next lines are
213 * appended to file. This value is true if output
214 * files have not been opened yet
215 */
217
218 /**
219 * Name of the file where the RSRP/SINR statistics will be saved
220 */
222
223 /**
224 * Name of the file where the UE SINR statistics will be saved
225 */
226 std::string m_ueSinrFilename;
227
228 /**
229 * Name of the file where the interference statistics will be saved
230 */
232
233 /**
234 * RSRP statistics output trace file
235 */
236 std::ofstream m_rsrpOutFile;
237
238 /**
239 * UE SINR statistics output trace file
240 */
241 std::ofstream m_ueSinrOutFile;
242
243 /**
244 * Interference statistics output trace file
245 */
247};
248
249} // namespace ns3
250
251#endif /* PHY_STATS_CALCULATOR_H_ */
Base class for ***StatsCalculator classes.
Takes care of storing the information generated at PHY layer.
bool m_UeSinrFirstWrite
When writing UE SINR statistics first time to file, columns description is added.
bool m_InterferenceFirstWrite
When writing interference statistics first time to file, columns description is added.
std::string GetInterferenceFilename()
Get the name of the file where the interference statistics will be stored.
std::string GetUeSinrFilename()
Get the name of the file where the UE SINR statistics will be stored.
void SetInterferenceFilename(std::string filename)
Set the name of the file where the interference statistics will be stored.
void ReportUeSinr(uint16_t cellId, uint64_t imsi, uint16_t rnti, double sinrLinear, uint8_t componentCarrierId)
Notifies the stats calculator that an UE SINR report has occurred.
bool m_RsrpSinrFirstWrite
When writing RSRP SINR statistics first time to file, columns description is added.
std::string m_interferenceFilename
Name of the file where the interference statistics will be saved.
std::string m_ueSinrFilename
Name of the file where the UE SINR statistics will be saved.
void SetCurrentCellRsrpSinrFilename(std::string filename)
Set the name of the file where the RSRP/SINR statistics will be stored.
void ReportCurrentCellRsrpSinr(uint16_t cellId, uint64_t imsi, uint16_t rnti, double rsrp, double sinr, uint8_t componentCarrierId)
Notifies the stats calculator that an RSRP and SINR report has occurred.
void SetUeSinrFilename(std::string filename)
Set the name of the file where the UE SINR statistics will be stored.
std::ofstream m_interferenceOutFile
Interference statistics output trace file.
std::string GetCurrentCellRsrpSinrFilename()
Get the name of the file where the RSRP/SINR statistics will be stored.
static TypeId GetTypeId()
Register this type.
std::ofstream m_ueSinrOutFile
UE SINR statistics output trace file.
std::string m_RsrpSinrFilename
Name of the file where the RSRP/SINR statistics will be saved.
std::ofstream m_rsrpOutFile
RSRP statistics output trace file.
void ReportInterference(uint16_t cellId, Ptr< SpectrumValue > interference)
Notifies the stats calculator that an interference report has occurred.
static void ReportCurrentCellRsrpSinrCallback(Ptr< PhyStatsCalculator > phyStats, std::string path, uint16_t cellId, uint16_t rnti, double rsrp, double sinr, uint8_t componentCarrierId)
trace sink
~PhyStatsCalculator() override
Destructor.
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.