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 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Jaume Nin <jnin@cttc.es>
18 */
19
20#ifndef PHY_STATS_CALCULATOR_H_
21#define PHY_STATS_CALCULATOR_H_
22
24
25#include "ns3/nstime.h"
26#include "ns3/spectrum-value.h"
27#include "ns3/uinteger.h"
28
29#include <fstream>
30#include <string>
31
32namespace ns3
33{
34
35/**
36 * \ingroup lte
37 *
38 * Takes care of storing the information generated at PHY layer. Metrics saved are:
39 * - RSRP and average SINR for DL
40 * - Timestamp (in seconds)
41 * - IMSI
42 * - C-RNTI
43 * - RSRP
44 * - SINR
45 * - componentCarrierId
46 * - UE SINR
47 * - Timestamp (in seconds)
48 * - Cell ID of the reported Enb
49 * - IMSI
50 * - C-RNTI
51 * - measured and reported SINR value in linear
52 * - componentCarrierId
53 * - Interference for UL
54 * - Cell ID of the reported Enb
55 * - IMSI of the scheduled UE
56 * - C-RNTI scheduled
57 * - Measured interference for each RB
58 */
60{
61 public:
62 /**
63 * Constructor
64 */
66
67 /**
68 * Destructor
69 */
70 ~PhyStatsCalculator() override;
71
72 // Inherited from ns3::Object
73 /**
74 * Register this type.
75 * @return The object TypeId.
76 */
77 static TypeId GetTypeId();
78
79 /**
80 * Set the name of the file where the RSRP/SINR statistics will be stored.
81 *
82 * @param filename string with the name of the file
83 */
84 void SetCurrentCellRsrpSinrFilename(std::string filename);
85
86 /**
87 * Get the name of the file where the RSRP/SINR statistics will be stored.
88 * @return the name of the file where the RSRP/SINR statistics will be stored
89 */
91
92 /**
93 * Set the name of the file where the UE SINR statistics will be stored.
94 *
95 * @param filename string with the name of the file
96 */
97 void SetUeSinrFilename(std::string filename);
98
99 /**
100 * Get the name of the file where the UE SINR statistics will be stored.
101 * @return the name of the file where the UE SINR statistics will be stored
102 */
103 std::string GetUeSinrFilename();
104
105 /**
106 * Set the name of the file where the interference statistics will be stored.
107 *
108 * @param filename string with the name of the file
109 */
110 void SetInterferenceFilename(std::string filename);
111
112 /**
113 * Get the name of the file where the interference statistics will be stored.
114 * @return the name of the file where the interference statistics will be stored
115 */
116 std::string GetInterferenceFilename();
117
118 /**
119 * Notifies the stats calculator that an RSRP and SINR report has occurred.
120 * @param cellId CellId for which stats are generated
121 * @param imsi IMSI of the scheduled UE
122 * @param rnti C-RNTI scheduled
123 * @param rsrp Reference Signal Received Power
124 * @param sinr SINR averaged among RBs
125 * @param componentCarrierId
126 */
127 void ReportCurrentCellRsrpSinr(uint16_t cellId,
128 uint64_t imsi,
129 uint16_t rnti,
130 double rsrp,
131 double sinr,
132 uint8_t componentCarrierId);
133
134 /**
135 * Notifies the stats calculator that an UE SINR report has occurred.
136 * @param cellId Cell ID of the reported Enb
137 * @param imsi IMSI of the scheduled UE
138 * @param rnti C-RNTI scheduled
139 * @param sinrLinear measured and reported SINR value in linear
140 * @param componentCarrierId
141 */
142 void ReportUeSinr(uint16_t cellId,
143 uint64_t imsi,
144 uint16_t rnti,
145 double sinrLinear,
146 uint8_t componentCarrierId);
147
148 /**
149 * Notifies the stats calculator that an interference report has occurred.
150 * @param cellId Cell ID of the reported Enb
151 * @param interference Measured interference for each RB
152 */
153 void ReportInterference(uint16_t cellId, Ptr<SpectrumValue> interference);
154
155 /**
156 * trace sink
157 *
158 * \param phyStats
159 * \param path
160 * \param cellId
161 * \param rnti
162 * \param rsrp
163 * \param sinr
164 * \param componentCarrierId
165 */
167 std::string path,
168 uint16_t cellId,
169 uint16_t rnti,
170 double rsrp,
171 double sinr,
172 uint8_t componentCarrierId);
173
174 /**
175 * trace sink
176 *
177 * \param phyStats
178 * \param path
179 * \param cellId
180 * \param rnti
181 * \param sinrLinear
182 * \param componentCarrierId
183 */
184 static void ReportUeSinr(Ptr<PhyStatsCalculator> phyStats,
185 std::string path,
186 uint16_t cellId,
187 uint16_t rnti,
188 double sinrLinear,
189 uint8_t componentCarrierId);
190
191 /**
192 * trace sink
193 *
194 * \param phyStats
195 * \param path
196 * \param cellId
197 * \param interference
198 */
199 static void ReportInterference(Ptr<PhyStatsCalculator> phyStats,
200 std::string path,
201 uint16_t cellId,
202 Ptr<SpectrumValue> interference);
203
204 private:
205 /**
206 * When writing RSRP SINR statistics first time to file,
207 * columns description is added. Then next lines are
208 * appended to file. This value is true if output
209 * files have not been opened yet
210 */
212
213 /**
214 * When writing UE SINR statistics first time to file,
215 * columns description is added. Then next lines are
216 * appended to file. This value is true if output
217 * files have not been opened yet
218 */
220
221 /**
222 * When writing interference statistics first time to file,
223 * columns description is added. Then next lines are
224 * appended to file. This value is true if output
225 * files have not been opened yet
226 */
228
229 /**
230 * Name of the file where the RSRP/SINR statistics will be saved
231 */
233
234 /**
235 * Name of the file where the UE SINR statistics will be saved
236 */
237 std::string m_ueSinrFilename;
238
239 /**
240 * Name of the file where the interference statistics will be saved
241 */
243
244 /**
245 * RSRP statistics output trace file
246 */
247 std::ofstream m_rsrpOutFile;
248
249 /**
250 * UE SINR statistics output trace file
251 */
252 std::ofstream m_ueSinrOutFile;
253
254 /**
255 * Interference statistics output trace file
256 */
258};
259
260} // namespace ns3
261
262#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.
Definition: ptr.h:77
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.