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
24
#include "
lte-test-sinr-chunk-processor.h
"
25
26
NS_LOG_COMPONENT_DEFINE
(
"LteTestSinrChunkProcessor"
);
27
28
namespace
ns3 {
29
30
31
LteTestSinrChunkProcessor::LteTestSinrChunkProcessor
(
Ptr<LtePhy>
p)
32
: m_phy (p)
33
{
34
NS_LOG_FUNCTION
(
this
<< p);
35
NS_ASSERT
(
m_phy
);
36
}
37
38
LteTestSinrChunkProcessor::~LteTestSinrChunkProcessor
()
39
{
40
NS_LOG_FUNCTION
(
this
);
41
}
42
43
void
44
LteTestSinrChunkProcessor::Start
()
45
{
46
NS_LOG_FUNCTION
(
this
);
47
m_sumSinr
= 0;
48
m_totDuration
= MicroSeconds (0);
49
}
50
51
void
52
LteTestSinrChunkProcessor::EvaluateSinrChunk
(
const
SpectrumValue
& sinr,
Time
duration)
53
{
54
NS_LOG_FUNCTION
(
this
<< sinr << duration);
55
if
(
m_sumSinr
== 0)
56
{
57
m_sumSinr
= Create<SpectrumValue> (sinr.
GetSpectrumModel
());
58
}
59
(*m_sumSinr) += sinr * duration.
GetSeconds
();
60
m_totDuration
+= duration;
61
NS_LOG_LOGIC
(
this
<<
" m_sumSinr = "
<< *
m_sumSinr
);
62
NS_LOG_LOGIC
(
this
<<
" m_totDuration = "
<<
m_totDuration
);
63
}
64
65
void
66
LteTestSinrChunkProcessor::End
()
67
{
68
NS_LOG_FUNCTION
(
this
);
69
if
(
m_totDuration
.
GetSeconds
() > 0)
70
{
71
NS_LOG_LOGIC
(
this
<<
" m_sumSinr = "
<< *
m_sumSinr
);
72
NS_LOG_LOGIC
(
this
<<
" m_totDuration = "
<<
m_totDuration
);
73
m_sinr
= Create<SpectrumValue> ((*m_sumSinr) /
m_totDuration
.
GetSeconds
());
74
NS_LOG_LOGIC
(
this
<<
" m_sumSinr / m_totDuration = "
<< *
m_sinr
);
75
}
76
else
77
{
78
NS_LOG_WARN
(
"m_numSinr == 0"
);
79
}
80
}
81
82
Ptr<SpectrumValue>
83
LteTestSinrChunkProcessor::GetSinr
()
84
{
85
NS_LOG_FUNCTION
(
this
);
86
87
NS_ASSERT
(
m_sinr
);
88
return
m_sinr
;
89
}
90
91
}
// namespace ns3
ns3::LteTestSinrChunkProcessor::m_totDuration
Time m_totDuration
Definition:
lte-test-sinr-chunk-processor.h:50
ns3::Time
keep track of time values and allow control of global simulation resolution
Definition:
nstime.h:81
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::LteTestSinrChunkProcessor::~LteTestSinrChunkProcessor
virtual ~LteTestSinrChunkProcessor()
Definition:
lte-test-sinr-chunk-processor.cc:38
NS_ASSERT
#define NS_ASSERT(condition)
Definition:
assert.h:64
lte-test-sinr-chunk-processor.h
ns3::Time::GetSeconds
double GetSeconds(void) const
Definition:
nstime.h:274
ns3::LteTestSinrChunkProcessor::LteTestSinrChunkProcessor
LteTestSinrChunkProcessor(Ptr< LtePhy > p)
Definition:
lte-test-sinr-chunk-processor.cc:31
ns3::SpectrumValue::GetSpectrumModel
Ptr< const SpectrumModel > GetSpectrumModel() const
Definition:
spectrum-value.cc:58
ns3::LteTestSinrChunkProcessor::GetSinr
Ptr< SpectrumValue > GetSinr()
Definition:
lte-test-sinr-chunk-processor.cc:83
NS_LOG_LOGIC
#define NS_LOG_LOGIC(msg)
Definition:
log.h:368
ns3::LteTestSinrChunkProcessor::Start
virtual void Start()
Definition:
lte-test-sinr-chunk-processor.cc:44
ns3::LteTestSinrChunkProcessor::m_sumSinr
Ptr< SpectrumValue > m_sumSinr
Definition:
lte-test-sinr-chunk-processor.h:48
ns3::LteTestSinrChunkProcessor::EvaluateSinrChunk
virtual void EvaluateSinrChunk(const SpectrumValue &sinr, Time duration)
Definition:
lte-test-sinr-chunk-processor.cc:52
ns3::LteTestSinrChunkProcessor::m_phy
Ptr< LtePhy > m_phy
Definition:
lte-test-sinr-chunk-processor.h:51
NS_LOG_WARN
#define NS_LOG_WARN(msg)
Definition:
log.h:280
ns3::LteTestSinrChunkProcessor::m_sinr
Ptr< SpectrumValue > m_sinr
Definition:
lte-test-sinr-chunk-processor.h:49
ns3::LteTestSinrChunkProcessor::End
virtual void End()
Definition:
lte-test-sinr-chunk-processor.cc:66
ns3::SpectrumValue
Set of values corresponding to a given SpectrumModel.
Definition:
spectrum-value.h:57
NS_LOG_COMPONENT_DEFINE
NS_LOG_COMPONENT_DEFINE("LteTestSinrChunkProcessor")
src
lte
test
lte-test-sinr-chunk-processor.cc
Generated on Sat Apr 19 2014 14:07:02 for ns-3 by
1.8.6