A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
lte-sinr-chunk-processor.cc
Go to the documentation of this file.
1
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2010 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Nicola Baldo <nbaldo@cttc.es>
19
* Modified by : Marco Miozzo <mmiozzo@cttc.es>
20
* (move from CQI to Ctrl and Data SINR Chunk processors
21
*/
22
23
24
#include <ns3/log.h>
25
26
#include "
lte-sinr-chunk-processor.h
"
27
28
NS_LOG_COMPONENT_DEFINE
(
"LteSinrChunkProcessor"
);
29
30
namespace
ns3 {
31
32
LteSinrChunkProcessor::~LteSinrChunkProcessor
()
33
{
34
NS_LOG_FUNCTION
(
this
);
35
}
36
37
38
// ------------- LteCtrlSinrChunkProcessor ------------------------------
39
40
LteCtrlSinrChunkProcessor::LteCtrlSinrChunkProcessor
(
Ptr<LtePhy>
p)
41
: m_phy (p),
42
m_spectrumPhy (0)
43
{
44
NS_LOG_FUNCTION
(
this
<< p);
45
NS_ASSERT
(
m_phy
);
46
}
47
48
LteCtrlSinrChunkProcessor::LteCtrlSinrChunkProcessor
(
Ptr<LtePhy>
p,
Ptr<LteSpectrumPhy>
s
)
49
: m_phy (p),
50
m_spectrumPhy (s)
51
{
52
NS_LOG_FUNCTION
(
this
<< p);
53
NS_ASSERT
(
m_phy
);
54
NS_ASSERT
(
m_spectrumPhy
);
55
}
56
57
58
LteCtrlSinrChunkProcessor::~LteCtrlSinrChunkProcessor
()
59
{
60
NS_LOG_FUNCTION
(
this
);
61
}
62
63
64
void
65
LteCtrlSinrChunkProcessor::Start
()
66
{
67
NS_LOG_FUNCTION
(
this
);
68
m_sumSinr
= 0;
69
m_totDuration
= MicroSeconds (0);
70
}
71
72
73
void
74
LteCtrlSinrChunkProcessor::EvaluateSinrChunk
(
const
SpectrumValue
& sinr,
Time
duration)
75
{
76
NS_LOG_FUNCTION
(
this
<< sinr << duration);
77
if
(
m_sumSinr
== 0)
78
{
79
m_sumSinr
= Create<SpectrumValue> (sinr.
GetSpectrumModel
());
80
}
81
(*m_sumSinr) += sinr * duration.
GetSeconds
();
82
m_totDuration
+= duration;
83
}
84
85
void
86
LteCtrlSinrChunkProcessor::End
()
87
{
88
NS_LOG_FUNCTION
(
this
);
89
if
(
m_totDuration
.
GetSeconds
() > 0)
90
{
91
m_phy
->GenerateCtrlCqiReport ((*
m_sumSinr
) /
m_totDuration
.
GetSeconds
());
92
if
(
m_spectrumPhy
)
93
{
94
m_spectrumPhy
->UpdateSinrPerceived ((*
m_sumSinr
) /
m_totDuration
.
GetSeconds
());
95
}
96
}
97
else
98
{
99
NS_LOG_WARN
(
"m_numSinr == 0"
);
100
}
101
}
102
103
104
// ------------- LteDataSinrChunkProcessor ------------------------------
105
106
LteDataSinrChunkProcessor::LteDataSinrChunkProcessor
(
Ptr<LteSpectrumPhy>
s
,
Ptr<LtePhy>
p)
107
: m_spectrumPhy (s),
108
m_phy (p)
109
{
110
NS_LOG_FUNCTION
(
this
<< p);
111
NS_ASSERT
(
m_spectrumPhy
);
112
NS_ASSERT
(
m_phy
);
113
}
114
115
LteDataSinrChunkProcessor::LteDataSinrChunkProcessor
(
Ptr<LteSpectrumPhy>
p)
116
: m_spectrumPhy (p),
117
m_phy (0)
118
{
119
NS_LOG_FUNCTION
(
this
<< p);
120
NS_ASSERT
(
m_spectrumPhy
);
121
122
}
123
124
125
126
LteDataSinrChunkProcessor::~LteDataSinrChunkProcessor
()
127
{
128
NS_LOG_FUNCTION
(
this
);
129
}
130
131
132
void
133
LteDataSinrChunkProcessor::Start
()
134
{
135
NS_LOG_FUNCTION
(
this
);
136
m_sumSinr
= 0;
137
m_totDuration
= MicroSeconds (0);
138
}
139
140
141
void
142
LteDataSinrChunkProcessor::EvaluateSinrChunk
(
const
SpectrumValue
& sinr,
Time
duration)
143
{
144
NS_LOG_FUNCTION
(
this
<< sinr << duration);
145
if
(
m_sumSinr
== 0)
146
{
147
m_sumSinr
= Create<SpectrumValue> (sinr.
GetSpectrumModel
());
148
}
149
(*m_sumSinr) += sinr * duration.
GetSeconds
();
150
m_totDuration
+= duration;
151
}
152
153
void
154
LteDataSinrChunkProcessor::End
()
155
{
156
NS_LOG_FUNCTION
(
this
);
157
if
(
m_totDuration
.
GetSeconds
() > 0)
158
{
159
m_spectrumPhy
->UpdateSinrPerceived ((*
m_sumSinr
) /
m_totDuration
.
GetSeconds
());
160
if
(
m_phy
)
161
{
162
m_phy
->GenerateDataCqiReport ((*
m_sumSinr
) /
m_totDuration
.
GetSeconds
());
163
}
164
}
165
else
166
{
167
NS_LOG_WARN
(
"m_numSinr == 0"
);
168
}
169
}
170
171
172
173
174
// ------------- LteRsReceivedPowerChunkProcessor ------------------------------
175
176
LteRsReceivedPowerChunkProcessor::LteRsReceivedPowerChunkProcessor
(
Ptr<LtePhy>
p)
177
: m_phy (p)
178
{
179
NS_LOG_FUNCTION
(
this
<< p);
180
NS_ASSERT
(
m_phy
);
181
}
182
183
LteRsReceivedPowerChunkProcessor::~LteRsReceivedPowerChunkProcessor
()
184
{
185
NS_LOG_FUNCTION
(
this
);
186
}
187
188
189
void
190
LteRsReceivedPowerChunkProcessor::Start
()
191
{
192
NS_LOG_FUNCTION
(
this
);
193
m_sumSinr
= 0;
194
m_totDuration
= MicroSeconds (0);
195
}
196
197
198
void
199
LteRsReceivedPowerChunkProcessor::EvaluateSinrChunk
(
const
SpectrumValue
& sinr,
Time
duration)
200
{
201
NS_LOG_FUNCTION
(
this
<< sinr << duration);
202
if
(
m_sumSinr
== 0)
203
{
204
m_sumSinr
= Create<SpectrumValue> (sinr.
GetSpectrumModel
());
205
}
206
(*m_sumSinr) += sinr * duration.
GetSeconds
();
207
m_totDuration
+= duration;
208
}
209
210
void
211
LteRsReceivedPowerChunkProcessor::End
()
212
{
213
NS_LOG_FUNCTION
(
this
);
214
if
(
m_totDuration
.
GetSeconds
() > 0)
215
{
216
m_phy
->ReportRsReceivedPower ((*
m_sumSinr
) /
m_totDuration
.
GetSeconds
());
217
}
218
else
219
{
220
NS_LOG_WARN
(
"m_numSinr == 0"
);
221
}
222
}
223
224
225
226
227
228
// ------------- LteInterferencePowerChunkProcessor ------------------------------
229
230
LteInterferencePowerChunkProcessor::LteInterferencePowerChunkProcessor
(
Ptr<LtePhy>
p)
231
: m_phy (p)
232
{
233
NS_LOG_FUNCTION
(
this
<< p);
234
NS_ASSERT
(
m_phy
);
235
}
236
237
LteInterferencePowerChunkProcessor::~LteInterferencePowerChunkProcessor
()
238
{
239
NS_LOG_FUNCTION
(
this
);
240
}
241
242
243
void
244
LteInterferencePowerChunkProcessor::Start
()
245
{
246
NS_LOG_FUNCTION
(
this
);
247
m_sumSinr
= 0;
248
m_totDuration
= MicroSeconds (0);
249
}
250
251
252
void
253
LteInterferencePowerChunkProcessor::EvaluateSinrChunk
(
const
SpectrumValue
& sinr,
Time
duration)
254
{
255
NS_LOG_FUNCTION
(
this
<< sinr << duration);
256
if
(
m_sumSinr
== 0)
257
{
258
m_sumSinr
= Create<SpectrumValue> (sinr.
GetSpectrumModel
());
259
}
260
(*m_sumSinr) += sinr * duration.
GetSeconds
();
261
m_totDuration
+= duration;
262
}
263
264
void
265
LteInterferencePowerChunkProcessor::End
()
266
{
267
NS_LOG_FUNCTION
(
this
);
268
if
(
m_totDuration
.
GetSeconds
() > 0)
269
{
270
m_phy
->ReportInterference ((*
m_sumSinr
) /
m_totDuration
.
GetSeconds
());
271
}
272
else
273
{
274
NS_LOG_WARN
(
"m_numSinr == 0"
);
275
}
276
}
277
278
279
}
// namespace ns3
ns3::LteDataSinrChunkProcessor::m_spectrumPhy
Ptr< LteSpectrumPhy > m_spectrumPhy
Definition:
lte-sinr-chunk-processor.h:101
ns3::Time
keep track of time values and allow control of global simulation resolution
Definition:
nstime.h:81
ns3::LteInterferencePowerChunkProcessor::m_totDuration
Time m_totDuration
Definition:
lte-sinr-chunk-processor.h:146
ns3::Ptr
smart pointer class similar to boost::intrusive_ptr
Definition:
ptr.h:59
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
Definition:
log.h:345
ns3::LteDataSinrChunkProcessor::End
virtual void End()
Definition:
lte-sinr-chunk-processor.cc:154
NS_LOG_COMPONENT_DEFINE
NS_LOG_COMPONENT_DEFINE("LteSinrChunkProcessor")
ns3::LteRsReceivedPowerChunkProcessor::EvaluateSinrChunk
virtual void EvaluateSinrChunk(const SpectrumValue &sinr, Time duration)
Definition:
lte-sinr-chunk-processor.cc:199
ns3::LteCtrlSinrChunkProcessor::End
virtual void End()
Definition:
lte-sinr-chunk-processor.cc:86
ns3::LteInterferencePowerChunkProcessor::End
virtual void End()
Definition:
lte-sinr-chunk-processor.cc:265
ns3::LteDataSinrChunkProcessor::m_sumSinr
Ptr< SpectrumValue > m_sumSinr
Definition:
lte-sinr-chunk-processor.h:99
ns3::LteInterferencePowerChunkProcessor::Start
virtual void Start()
Definition:
lte-sinr-chunk-processor.cc:244
ns3::LteRsReceivedPowerChunkProcessor::m_phy
Ptr< LtePhy > m_phy
Definition:
lte-sinr-chunk-processor.h:123
ns3::LteInterferencePowerChunkProcessor::m_sumSinr
Ptr< SpectrumValue > m_sumSinr
Definition:
lte-sinr-chunk-processor.h:145
NS_ASSERT
#define NS_ASSERT(condition)
Definition:
assert.h:64
ns3::LteSinrChunkProcessor::~LteSinrChunkProcessor
virtual ~LteSinrChunkProcessor()
Definition:
lte-sinr-chunk-processor.cc:32
ns3::LteRsReceivedPowerChunkProcessor::End
virtual void End()
Definition:
lte-sinr-chunk-processor.cc:211
ns3::LteInterferencePowerChunkProcessor::EvaluateSinrChunk
virtual void EvaluateSinrChunk(const SpectrumValue &sinr, Time duration)
Definition:
lte-sinr-chunk-processor.cc:253
ns3::LteInterferencePowerChunkProcessor::m_phy
Ptr< LtePhy > m_phy
Definition:
lte-sinr-chunk-processor.h:147
ns3::LteRsReceivedPowerChunkProcessor::m_sumSinr
Ptr< SpectrumValue > m_sumSinr
Definition:
lte-sinr-chunk-processor.h:121
ns3::Time::GetSeconds
double GetSeconds(void) const
Definition:
nstime.h:274
ns3::LteCtrlSinrChunkProcessor::Start
virtual void Start()
Definition:
lte-sinr-chunk-processor.cc:65
ns3::LteDataSinrChunkProcessor::~LteDataSinrChunkProcessor
virtual ~LteDataSinrChunkProcessor()
Definition:
lte-sinr-chunk-processor.cc:126
ns3::SpectrumValue::GetSpectrumModel
Ptr< const SpectrumModel > GetSpectrumModel() const
Definition:
spectrum-value.cc:58
s
Ptr< SampleEmitter > s
Definition:
double-probe-test-suite.cc:51
ns3::LteDataSinrChunkProcessor::m_totDuration
Time m_totDuration
Definition:
lte-sinr-chunk-processor.h:100
ns3::LteCtrlSinrChunkProcessor::LteCtrlSinrChunkProcessor
LteCtrlSinrChunkProcessor(Ptr< LtePhy > p)
Definition:
lte-sinr-chunk-processor.cc:40
ns3::LteCtrlSinrChunkProcessor::~LteCtrlSinrChunkProcessor
virtual ~LteCtrlSinrChunkProcessor()
Definition:
lte-sinr-chunk-processor.cc:58
ns3::LteCtrlSinrChunkProcessor::m_phy
Ptr< LtePhy > m_phy
Definition:
lte-sinr-chunk-processor.h:76
ns3::LteRsReceivedPowerChunkProcessor::~LteRsReceivedPowerChunkProcessor
virtual ~LteRsReceivedPowerChunkProcessor()
Definition:
lte-sinr-chunk-processor.cc:183
ns3::LteCtrlSinrChunkProcessor::m_sumSinr
Ptr< SpectrumValue > m_sumSinr
Definition:
lte-sinr-chunk-processor.h:74
ns3::LteDataSinrChunkProcessor::m_phy
Ptr< LtePhy > m_phy
Definition:
lte-sinr-chunk-processor.h:102
ns3::LteRsReceivedPowerChunkProcessor::LteRsReceivedPowerChunkProcessor
LteRsReceivedPowerChunkProcessor(Ptr< LtePhy > p)
Definition:
lte-sinr-chunk-processor.cc:176
ns3::LteCtrlSinrChunkProcessor::m_spectrumPhy
Ptr< LteSpectrumPhy > m_spectrumPhy
Definition:
lte-sinr-chunk-processor.h:77
ns3::LteRsReceivedPowerChunkProcessor::Start
virtual void Start()
Definition:
lte-sinr-chunk-processor.cc:190
ns3::LteRsReceivedPowerChunkProcessor::m_totDuration
Time m_totDuration
Definition:
lte-sinr-chunk-processor.h:122
NS_LOG_WARN
#define NS_LOG_WARN(msg)
Definition:
log.h:280
ns3::LteDataSinrChunkProcessor::EvaluateSinrChunk
virtual void EvaluateSinrChunk(const SpectrumValue &sinr, Time duration)
Definition:
lte-sinr-chunk-processor.cc:142
ns3::LteDataSinrChunkProcessor::LteDataSinrChunkProcessor
LteDataSinrChunkProcessor(Ptr< LteSpectrumPhy > p)
Definition:
lte-sinr-chunk-processor.cc:115
lte-sinr-chunk-processor.h
ns3::LteDataSinrChunkProcessor::Start
virtual void Start()
Definition:
lte-sinr-chunk-processor.cc:133
ns3::LteCtrlSinrChunkProcessor::EvaluateSinrChunk
virtual void EvaluateSinrChunk(const SpectrumValue &sinr, Time duration)
Definition:
lte-sinr-chunk-processor.cc:74
ns3::SpectrumValue
Set of values corresponding to a given SpectrumModel.
Definition:
spectrum-value.h:57
ns3::LteInterferencePowerChunkProcessor::LteInterferencePowerChunkProcessor
LteInterferencePowerChunkProcessor(Ptr< LtePhy > p)
Definition:
lte-sinr-chunk-processor.cc:230
ns3::LteCtrlSinrChunkProcessor::m_totDuration
Time m_totDuration
Definition:
lte-sinr-chunk-processor.h:75
ns3::LteInterferencePowerChunkProcessor::~LteInterferencePowerChunkProcessor
virtual ~LteInterferencePowerChunkProcessor()
Definition:
lte-sinr-chunk-processor.cc:237
src
lte
model
lte-sinr-chunk-processor.cc
Generated on Sat Apr 19 2014 14:07:01 for ns-3 by
1.8.6