A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
lte-chunk-processor.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2010 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: Nicola Baldo <nbaldo@cttc.es>
18
* Modified by : Marco Miozzo <mmiozzo@cttc.es>
19
* (move from CQI to Ctrl and Data SINR Chunk processors
20
*/
21
22
#include "
lte-chunk-processor.h
"
23
24
#include <ns3/log.h>
25
#include <ns3/spectrum-value.h>
26
27
namespace
ns3
28
{
29
30
NS_LOG_COMPONENT_DEFINE
(
"LteChunkProcessor"
);
31
32
LteChunkProcessor::LteChunkProcessor
()
33
{
34
NS_LOG_FUNCTION
(
this
);
35
}
36
37
LteChunkProcessor::~LteChunkProcessor
()
38
{
39
NS_LOG_FUNCTION
(
this
);
40
}
41
42
void
43
LteChunkProcessor::AddCallback
(
LteChunkProcessorCallback
c)
44
{
45
NS_LOG_FUNCTION
(
this
);
46
m_lteChunkProcessorCallbacks
.push_back(c);
47
}
48
49
void
50
LteChunkProcessor::Start
()
51
{
52
NS_LOG_FUNCTION
(
this
);
53
m_sumValues
=
nullptr
;
54
m_totDuration
=
MicroSeconds
(0);
55
}
56
57
void
58
LteChunkProcessor::EvaluateChunk
(
const
SpectrumValue
& sinr,
Time
duration)
59
{
60
NS_LOG_FUNCTION
(
this
<< sinr << duration);
61
if
(!
m_sumValues
)
62
{
63
m_sumValues
= Create<SpectrumValue>(sinr.
GetSpectrumModel
());
64
}
65
(*m_sumValues) += sinr * duration.
GetSeconds
();
66
m_totDuration
+= duration;
67
}
68
69
void
70
LteChunkProcessor::End
()
71
{
72
NS_LOG_FUNCTION
(
this
);
73
if
(
m_totDuration
.
GetSeconds
() > 0)
74
{
75
for
(
auto
it =
m_lteChunkProcessorCallbacks
.begin();
76
it !=
m_lteChunkProcessorCallbacks
.end();
77
it++)
78
{
79
(*it)((*m_sumValues) /
m_totDuration
.
GetSeconds
());
80
}
81
}
82
else
83
{
84
NS_LOG_WARN
(
"m_numSinr == 0"
);
85
}
86
}
87
88
void
89
LteSpectrumValueCatcher::ReportValue
(
const
SpectrumValue
& value)
90
{
91
m_value
= value.Copy();
92
}
93
94
Ptr<SpectrumValue>
95
LteSpectrumValueCatcher::GetValue
()
96
{
97
return
m_value
;
98
}
99
100
}
// namespace ns3
ns3::Callback
Callback template class.
Definition:
callback.h:438
ns3::LteChunkProcessor::Start
virtual void Start()
Clear internal variables.
Definition:
lte-chunk-processor.cc:50
ns3::LteChunkProcessor::AddCallback
virtual void AddCallback(LteChunkProcessorCallback c)
Add callback to list.
Definition:
lte-chunk-processor.cc:43
ns3::LteChunkProcessor::~LteChunkProcessor
virtual ~LteChunkProcessor()
Definition:
lte-chunk-processor.cc:37
ns3::LteChunkProcessor::EvaluateChunk
virtual void EvaluateChunk(const SpectrumValue &sinr, Time duration)
Collect SpectrumValue and duration of signal.
Definition:
lte-chunk-processor.cc:58
ns3::LteChunkProcessor::m_sumValues
Ptr< SpectrumValue > m_sumValues
sum values
Definition:
lte-chunk-processor.h:90
ns3::LteChunkProcessor::LteChunkProcessor
LteChunkProcessor()
Definition:
lte-chunk-processor.cc:32
ns3::LteChunkProcessor::m_totDuration
Time m_totDuration
total duration
Definition:
lte-chunk-processor.h:91
ns3::LteChunkProcessor::m_lteChunkProcessorCallbacks
std::vector< LteChunkProcessorCallback > m_lteChunkProcessorCallbacks
chunk processor callback
Definition:
lte-chunk-processor.h:94
ns3::LteChunkProcessor::End
virtual void End()
Finish calculation and inform interested objects about calculated value.
Definition:
lte-chunk-processor.cc:70
ns3::LteSpectrumValueCatcher::m_value
Ptr< SpectrumValue > m_value
spectrum value
Definition:
lte-chunk-processor.h:120
ns3::LteSpectrumValueCatcher::GetValue
Ptr< SpectrumValue > GetValue()
Definition:
lte-chunk-processor.cc:95
ns3::LteSpectrumValueCatcher::ReportValue
void ReportValue(const SpectrumValue &value)
function to be plugged to LteChunkProcessor::AddCallback ()
Definition:
lte-chunk-processor.cc:89
ns3::Ptr< SpectrumValue >
ns3::SpectrumValue
Set of values corresponding to a given SpectrumModel.
Definition:
spectrum-value.h:61
ns3::SpectrumValue::GetSpectrumModel
Ptr< const SpectrumModel > GetSpectrumModel() const
Definition:
spectrum-value.cc:60
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:105
ns3::Time::GetSeconds
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition:
nstime.h:403
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:202
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition:
log-macros-enabled.h:240
NS_LOG_WARN
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition:
log.h:261
ns3::MicroSeconds
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition:
nstime.h:1350
lte-chunk-processor.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
lte
model
lte-chunk-processor.cc
Generated on Sun Mar 3 2024 17:11:02 for ns-3 by
1.9.1