A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
mac-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 * Modified by: Danilo Abrignani <danilo.abrignani@unibo.it> (Carrier Aggregation - GSoC 2015)
19 * Biljana Bojovic <biljana.bojovic@cttc.es> (Carrier Aggregation)
20 */
21
22#ifndef MAC_STATS_CALCULATOR_H_
23#define MAC_STATS_CALCULATOR_H_
24
26
27#include "ns3/lte-enb-mac.h"
28#include "ns3/nstime.h"
29#include "ns3/uinteger.h"
30
31#include <fstream>
32#include <string>
33
34namespace ns3
35{
36
37/**
38 * \ingroup lte
39 *
40 * Takes care of storing the information generated at MAC layer. Metrics saved are:
41 * - Timestamp (in seconds)
42 * - Frame index
43 * - Subframe index
44 * - C-RNTI
45 * - MCS for transport block 1
46 * - Size of transport block 1
47 * - MCS for transport block 2 (0 if not used)
48 * - Size of transport block 2 (0 if not used)
49 */
51{
52 public:
53 /**
54 * Constructor
55 */
57
58 /**
59 * Destructor
60 */
61 ~MacStatsCalculator() override;
62
63 // Inherited from ns3::Object
64 /**
65 * Register this type.
66 * \return The object TypeId.
67 */
68 static TypeId GetTypeId();
69
70 /**
71 * Set the name of the file where the uplink statistics will be stored.
72 *
73 * \param outputFilename string with the name of the file
74 */
75 void SetUlOutputFilename(std::string outputFilename);
76
77 /**
78 * Get the name of the file where the uplink statistics will be stored.
79 * @return the name of the file where the uplink statistics will be stored
80 */
81 std::string GetUlOutputFilename();
82
83 /**
84 * Set the name of the file where the downlink statistics will be stored.
85 *
86 * @param outputFilename string with the name of the file
87 */
88 void SetDlOutputFilename(std::string outputFilename);
89
90 /**
91 * Get the name of the file where the downlink statistics will be stored.
92 * @return the name of the file where the downlink statistics will be stored
93 */
94 std::string GetDlOutputFilename();
95
96 /**
97 * Notifies the stats calculator that an downlink scheduling has occurred.
98 * @param cellId Cell ID of the attached Enb
99 * @param imsi IMSI of the scheduled UE
100 * @param dlSchedulingCallbackInfo the structure that contains downlink scheduling fields:
101 * frameNo Frame number
102 * subframeNo Subframe number
103 * rnti C-RNTI scheduled
104 * mcsTb1 MCS for transport block 1
105 * sizeTb1 Size of transport block 1
106 * mcsTb2 MCS for transport block 2 (0 if not used)
107 * sizeTb2 Size of transport block 2 (0 if not used)
108 * componentCarrierId component carrier ID
109 */
110
111 void DlScheduling(uint16_t cellId,
112 uint64_t imsi,
113 DlSchedulingCallbackInfo dlSchedulingCallbackInfo);
114
115 /**
116 * Notifies the stats calculator that an uplink scheduling has occurred.
117 * @param cellId Cell ID of the attached Enb
118 * @param imsi IMSI of the scheduled UE
119 * @param frameNo Frame number
120 * @param subframeNo Subframe number
121 * @param rnti C-RNTI scheduled
122 * @param mcsTb MCS for transport block
123 * @param sizeTb Size of transport block
124 * @param componentCarrierId component carrier ID
125 */
126 void UlScheduling(uint16_t cellId,
127 uint64_t imsi,
128 uint32_t frameNo,
129 uint32_t subframeNo,
130 uint16_t rnti,
131 uint8_t mcsTb,
132 uint16_t sizeTb,
133 uint8_t componentCarrierId);
134
135 /**
136 * Trace sink for the ns3::LteEnbMac::DlScheduling trace source
137 *
138 * \param macStats
139 * \param path
140 * \param dlSchedulingCallbackInfo DlSchedulingCallbackInfo structure containing all downlink
141 * information that is generated what DlScheduling traces is fired
142 */
144 std::string path,
145 DlSchedulingCallbackInfo dlSchedulingCallbackInfo);
146
147 /**
148 * Trace sink for the ns3::LteEnbMac::UlScheduling trace source
149 *
150 * \param macStats
151 * \param path
152 * \param frameNo
153 * \param subframeNo
154 * \param rnti
155 * \param mcs
156 * \param size
157 * \param componentCarrierId
158 */
160 std::string path,
161 uint32_t frameNo,
162 uint32_t subframeNo,
163 uint16_t rnti,
164 uint8_t mcs,
165 uint16_t size,
166 uint8_t componentCarrierId);
167
168 private:
169 /**
170 * When writing DL MAC statistics first time to file,
171 * columns description is added. Then next lines are
172 * appended to file. This value is true if output
173 * files have not been opened yet
174 */
176
177 /**
178 * When writing UL MAC statistics first time to file,
179 * columns description is added. Then next lines are
180 * appended to file. This value is true if output
181 * files have not been opened yet
182 */
184
185 /**
186 * Downlink output trace file
187 */
188 std::ofstream m_dlOutFile;
189
190 /**
191 * Uplink output trace file
192 */
193 std::ofstream m_ulOutFile;
194};
195
196} // namespace ns3
197
198#endif /* MAC_STATS_CALCULATOR_H_ */
Base class for ***StatsCalculator classes.
Takes care of storing the information generated at MAC layer.
~MacStatsCalculator() override
Destructor.
static TypeId GetTypeId()
Register this type.
std::ofstream m_dlOutFile
Downlink output trace file.
void UlScheduling(uint16_t cellId, uint64_t imsi, uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, uint8_t mcsTb, uint16_t sizeTb, uint8_t componentCarrierId)
Notifies the stats calculator that an uplink scheduling has occurred.
bool m_dlFirstWrite
When writing DL MAC statistics first time to file, columns description is added.
static void DlSchedulingCallback(Ptr< MacStatsCalculator > macStats, std::string path, DlSchedulingCallbackInfo dlSchedulingCallbackInfo)
Trace sink for the ns3::LteEnbMac::DlScheduling trace source.
void SetDlOutputFilename(std::string outputFilename)
Set the name of the file where the downlink statistics will be stored.
std::ofstream m_ulOutFile
Uplink output trace file.
std::string GetUlOutputFilename()
Get the name of the file where the uplink statistics will be stored.
static void UlSchedulingCallback(Ptr< MacStatsCalculator > macStats, std::string path, uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, uint8_t mcs, uint16_t size, uint8_t componentCarrierId)
Trace sink for the ns3::LteEnbMac::UlScheduling trace source.
void DlScheduling(uint16_t cellId, uint64_t imsi, DlSchedulingCallbackInfo dlSchedulingCallbackInfo)
Notifies the stats calculator that an downlink scheduling has occurred.
void SetUlOutputFilename(std::string outputFilename)
Set the name of the file where the uplink statistics will be stored.
bool m_ulFirstWrite
When writing UL MAC statistics first time to file, columns description is added.
std::string GetDlOutputFilename()
Get the name of the file where the downlink statistics will be stored.
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.
DlSchedulingCallbackInfo structure.
Definition: lte-common.h:237