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-test-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) 2011 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: Manuel Requena <manuel.requena@cttc.es> : Based on lte-sinr-chunk-processor code
19
* Nicola Baldo <nbaldo>@cttc.es>
20
*/
21
22
#include <ns3/log.h>
23
#include <ns3/spectrum-value.h>
24
#include "
lte-test-sinr-chunk-processor.h
"
25
26
NS_LOG_COMPONENT_DEFINE
(
"LteTestSinrChunkProcessor"
);
27
28
namespace
ns3 {
29
30
31
LteTestSinrChunkProcessor::LteTestSinrChunkProcessor
()
32
{
33
NS_LOG_FUNCTION
(
this
);
34
}
35
36
LteTestSinrChunkProcessor::~LteTestSinrChunkProcessor
()
37
{
38
NS_LOG_FUNCTION
(
this
);
39
}
40
41
void
42
LteTestSinrChunkProcessor::AddCallback
(
LteChunkProcessorCallback
c)
43
{
44
NS_LOG_FUNCTION
(
this
);
45
}
46
47
void
48
LteTestSinrChunkProcessor::Start
()
49
{
50
NS_LOG_FUNCTION
(
this
);
51
m_sumSinr
= 0;
52
m_totDuration
=
MicroSeconds
(0);
53
}
54
55
void
56
LteTestSinrChunkProcessor::EvaluateChunk
(
const
SpectrumValue
& sinr,
Time
duration)
57
{
58
NS_LOG_FUNCTION
(
this
<< sinr << duration);
59
if
(
m_sumSinr
== 0)
60
{
61
m_sumSinr
= Create<SpectrumValue> (sinr.
GetSpectrumModel
());
62
}
63
(*m_sumSinr) += sinr * duration.
GetSeconds
();
64
m_totDuration
+= duration;
65
NS_LOG_LOGIC
(
this
<<
" m_sumSinr = "
<< *
m_sumSinr
);
66
NS_LOG_LOGIC
(
this
<<
" m_totDuration = "
<<
m_totDuration
);
67
}
68
69
void
70
LteTestSinrChunkProcessor::End
()
71
{
72
NS_LOG_FUNCTION
(
this
);
73
if
(
m_totDuration
.
GetSeconds
() > 0)
74
{
75
NS_LOG_LOGIC
(
this
<<
" m_sumSinr = "
<< *
m_sumSinr
);
76
NS_LOG_LOGIC
(
this
<<
" m_totDuration = "
<<
m_totDuration
);
77
m_sinr
= Create<SpectrumValue> ((*m_sumSinr) /
m_totDuration
.
GetSeconds
());
78
NS_LOG_LOGIC
(
this
<<
" m_sumSinr / m_totDuration = "
<< *
m_sinr
);
79
}
80
else
81
{
82
NS_LOG_WARN
(
"m_numSinr == 0"
);
83
}
84
}
85
86
Ptr<SpectrumValue>
87
LteTestSinrChunkProcessor::GetSinr
()
88
{
89
NS_LOG_FUNCTION
(
this
);
90
91
NS_ASSERT
(
m_sinr
);
92
return
m_sinr
;
93
}
94
95
}
// namespace ns3
ns3::LteTestSinrChunkProcessor::m_totDuration
Time m_totDuration
Definition:
lte-test-sinr-chunk-processor.h:50
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:95
ns3::Ptr< SpectrumValue >
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:207
ns3::Callback
Callback template class.
Definition:
callback.h:972
ns3::LteTestSinrChunkProcessor::~LteTestSinrChunkProcessor
virtual ~LteTestSinrChunkProcessor()
Definition:
lte-test-sinr-chunk-processor.cc:36
NS_ASSERT
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition:
assert.h:61
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:170
lte-test-sinr-chunk-processor.h
ns3::Time::GetSeconds
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition:
nstime.h:322
ns3::SpectrumValue::GetSpectrumModel
Ptr< const SpectrumModel > GetSpectrumModel() const
Definition:
spectrum-value.cc:64
ns3::LteTestSinrChunkProcessor::GetSinr
Ptr< SpectrumValue > GetSinr()
Definition:
lte-test-sinr-chunk-processor.cc:87
ns3::LteTestSinrChunkProcessor::EvaluateChunk
virtual void EvaluateChunk(const SpectrumValue &sinr, Time duration)
Collect SpectrumValue and duration of signal.
Definition:
lte-test-sinr-chunk-processor.cc:56
NS_LOG_LOGIC
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition:
log.h:233
ns3::LteTestSinrChunkProcessor::LteTestSinrChunkProcessor
LteTestSinrChunkProcessor()
Definition:
lte-test-sinr-chunk-processor.cc:31
ns3::LteTestSinrChunkProcessor::Start
virtual void Start()
Clear internal variables.
Definition:
lte-test-sinr-chunk-processor.cc:48
ns3::LteTestSinrChunkProcessor::m_sumSinr
Ptr< SpectrumValue > m_sumSinr
Definition:
lte-test-sinr-chunk-processor.h:48
ns3::LteTestSinrChunkProcessor::AddCallback
virtual void AddCallback(LteChunkProcessorCallback c)
Add callback to list.
Definition:
lte-test-sinr-chunk-processor.cc:42
NS_LOG_WARN
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition:
log.h:203
ns3::MicroSeconds
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition:
nstime.h:861
ns3::LteTestSinrChunkProcessor::m_sinr
Ptr< SpectrumValue > m_sinr
Definition:
lte-test-sinr-chunk-processor.h:49
ns3::LteTestSinrChunkProcessor::End
virtual void End()
Finish calculation and inform interested objects about calculated value.
Definition:
lte-test-sinr-chunk-processor.cc:70
ns3::SpectrumValue
Set of values corresponding to a given SpectrumModel.
Definition:
spectrum-value.h:57
src
lte
test
lte-test-sinr-chunk-processor.cc
Generated on Wed Sep 17 2014 23:33:34 for ns-3 by
1.8.6