A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
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
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Nicola Baldo <nbaldo@cttc.es>
7
* Modified by : Marco Miozzo <mmiozzo@cttc.es>
8
* (move from CQI to Ctrl and Data SINR Chunk processors
9
*/
10
11
#include "
lte-chunk-processor.h
"
12
13
#include <ns3/log.h>
14
#include <ns3/spectrum-value.h>
15
16
namespace
ns3
17
{
18
19
NS_LOG_COMPONENT_DEFINE
(
"LteChunkProcessor"
);
20
21
LteChunkProcessor::LteChunkProcessor
()
22
{
23
NS_LOG_FUNCTION
(
this
);
24
}
25
26
LteChunkProcessor::~LteChunkProcessor
()
27
{
28
NS_LOG_FUNCTION
(
this
);
29
}
30
31
void
32
LteChunkProcessor::AddCallback
(
LteChunkProcessorCallback
c)
33
{
34
NS_LOG_FUNCTION
(
this
);
35
m_lteChunkProcessorCallbacks
.push_back(c);
36
}
37
38
void
39
LteChunkProcessor::Start
()
40
{
41
NS_LOG_FUNCTION
(
this
);
42
m_sumValues
=
nullptr
;
43
m_totDuration
=
MicroSeconds
(0);
44
}
45
46
void
47
LteChunkProcessor::EvaluateChunk
(
const
SpectrumValue
& sinr,
Time
duration)
48
{
49
NS_LOG_FUNCTION
(
this
<< sinr << duration);
50
if
(!
m_sumValues
)
51
{
52
m_sumValues
=
Create<SpectrumValue>
(sinr.
GetSpectrumModel
());
53
}
54
(*m_sumValues) += sinr * duration.
GetSeconds
();
55
m_totDuration
+= duration;
56
}
57
58
void
59
LteChunkProcessor::End
()
60
{
61
NS_LOG_FUNCTION
(
this
);
62
if
(
m_totDuration
.
GetSeconds
() > 0)
63
{
64
for
(
auto
it =
m_lteChunkProcessorCallbacks
.begin();
65
it !=
m_lteChunkProcessorCallbacks
.end();
66
it++)
67
{
68
(*it)((*m_sumValues) /
m_totDuration
.
GetSeconds
());
69
}
70
}
71
else
72
{
73
NS_LOG_WARN
(
"m_numSinr == 0"
);
74
}
75
}
76
77
void
78
LteSpectrumValueCatcher::ReportValue
(
const
SpectrumValue
& value)
79
{
80
m_value
= value.Copy();
81
}
82
83
Ptr<SpectrumValue>
84
LteSpectrumValueCatcher::GetValue
()
85
{
86
return
m_value
;
87
}
88
89
}
// namespace ns3
ns3::Callback
Callback template class.
Definition
callback.h:422
ns3::LteChunkProcessor::Start
virtual void Start()
Clear internal variables.
Definition
lte-chunk-processor.cc:39
ns3::LteChunkProcessor::AddCallback
virtual void AddCallback(LteChunkProcessorCallback c)
Add callback to list.
Definition
lte-chunk-processor.cc:32
ns3::LteChunkProcessor::~LteChunkProcessor
virtual ~LteChunkProcessor()
Definition
lte-chunk-processor.cc:26
ns3::LteChunkProcessor::EvaluateChunk
virtual void EvaluateChunk(const SpectrumValue &sinr, Time duration)
Collect SpectrumValue and duration of signal.
Definition
lte-chunk-processor.cc:47
ns3::LteChunkProcessor::m_sumValues
Ptr< SpectrumValue > m_sumValues
sum values
Definition
lte-chunk-processor.h:79
ns3::LteChunkProcessor::LteChunkProcessor
LteChunkProcessor()
Definition
lte-chunk-processor.cc:21
ns3::LteChunkProcessor::m_totDuration
Time m_totDuration
total duration
Definition
lte-chunk-processor.h:80
ns3::LteChunkProcessor::m_lteChunkProcessorCallbacks
std::vector< LteChunkProcessorCallback > m_lteChunkProcessorCallbacks
chunk processor callback
Definition
lte-chunk-processor.h:83
ns3::LteChunkProcessor::End
virtual void End()
Finish calculation and inform interested objects about calculated value.
Definition
lte-chunk-processor.cc:59
ns3::LteSpectrumValueCatcher::m_value
Ptr< SpectrumValue > m_value
spectrum value
Definition
lte-chunk-processor.h:109
ns3::LteSpectrumValueCatcher::GetValue
Ptr< SpectrumValue > GetValue()
Definition
lte-chunk-processor.cc:84
ns3::LteSpectrumValueCatcher::ReportValue
void ReportValue(const SpectrumValue &value)
function to be plugged to LteChunkProcessor::AddCallback ()
Definition
lte-chunk-processor.cc:78
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::SpectrumValue
Set of values corresponding to a given SpectrumModel.
Definition
spectrum-value.h:50
ns3::SpectrumValue::GetSpectrumModel
Ptr< const SpectrumModel > GetSpectrumModel() const
Definition
spectrum-value.cc:49
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:94
ns3::Time::GetSeconds
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition
nstime.h:392
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
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:229
NS_LOG_WARN
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition
log.h:250
ns3::Create
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition
ptr.h:436
ns3::MicroSeconds
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition
nstime.h:1368
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 Dec 1 2024 18:20:41 for ns-3 by
1.11.0