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
*/
20
21
22
#include <ns3/log.h>
23
24
#include "
lte-sinr-chunk-processor.h
"
25
26
NS_LOG_COMPONENT_DEFINE
(
"LteSinrChunkProcessor"
);
27
28
namespace
ns3 {
29
30
LteSinrChunkProcessor::~LteSinrChunkProcessor
()
31
{
32
NS_LOG_FUNCTION
(
this
);
33
}
34
35
36
LteCqiSinrChunkProcessor::LteCqiSinrChunkProcessor
(
Ptr<LtePhy>
p)
37
: m_phy (p)
38
{
39
NS_LOG_FUNCTION
(
this
<< p);
40
NS_ASSERT
(
m_phy
);
41
}
42
43
44
LteCqiSinrChunkProcessor::~LteCqiSinrChunkProcessor
()
45
{
46
NS_LOG_FUNCTION
(
this
);
47
}
48
49
50
void
51
LteCqiSinrChunkProcessor::Start
()
52
{
53
NS_LOG_FUNCTION
(
this
);
54
m_sumSinr
= 0;
55
m_totDuration
=
MicroSeconds
(0);
56
}
57
58
59
void
60
LteCqiSinrChunkProcessor::EvaluateSinrChunk
(
const
SpectrumValue
& sinr,
Time
duration)
61
{
62
NS_LOG_FUNCTION
(
this
<< sinr << duration);
63
if
(
m_sumSinr
== 0)
64
{
65
m_sumSinr
= Create<SpectrumValue> (sinr.
GetSpectrumModel
());
66
}
67
(*m_sumSinr) += sinr * duration.
GetSeconds
();
68
m_totDuration
+= duration;
69
}
70
71
void
72
LteCqiSinrChunkProcessor::End
()
73
{
74
NS_LOG_FUNCTION
(
this
);
75
if
(
m_totDuration
.
GetSeconds
() > 0)
76
{
77
m_phy
->
GenerateCqiReport
((*
m_sumSinr
) /
m_totDuration
.
GetSeconds
());
78
}
79
else
80
{
81
NS_LOG_WARN
(
"m_numSinr == 0"
);
82
}
83
}
84
85
86
87
88
LtePemSinrChunkProcessor::LtePemSinrChunkProcessor
(
Ptr<LteSpectrumPhy>
p)
89
: m_phy (p)
90
{
91
NS_LOG_FUNCTION
(
this
<< p);
92
NS_ASSERT
(
m_phy
);
93
}
94
95
96
LtePemSinrChunkProcessor::~LtePemSinrChunkProcessor
()
97
{
98
NS_LOG_FUNCTION
(
this
);
99
}
100
101
102
void
103
LtePemSinrChunkProcessor::Start
()
104
{
105
NS_LOG_FUNCTION
(
this
);
106
m_sumSinr
= 0;
107
m_totDuration
=
MicroSeconds
(0);
108
}
109
110
111
void
112
LtePemSinrChunkProcessor::EvaluateSinrChunk
(
const
SpectrumValue
& sinr,
Time
duration)
113
{
114
NS_LOG_FUNCTION
(
this
<< sinr << duration);
115
if
(
m_sumSinr
== 0)
116
{
117
m_sumSinr
= Create<SpectrumValue> (sinr.
GetSpectrumModel
());
118
}
119
(*m_sumSinr) += sinr * duration.
GetSeconds
();
120
m_totDuration
+= duration;
121
}
122
123
void
124
LtePemSinrChunkProcessor::End
()
125
{
126
NS_LOG_FUNCTION
(
this
);
127
if
(
m_totDuration
.
GetSeconds
() > 0)
128
{
129
m_phy
->
UpdateSinrPerceived
((*
m_sumSinr
) /
m_totDuration
.
GetSeconds
());
130
}
131
else
132
{
133
NS_LOG_WARN
(
"m_numSinr == 0"
);
134
}
135
}
136
137
138
}
// namespace ns3
src
lte
model
lte-sinr-chunk-processor.cc
Generated on Tue Oct 9 2012 16:45:41 for ns-3 by
1.8.1.2