A Discrete-Event Network Simulator
API
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>
25 
26 namespace ns3 {
27 
28 NS_LOG_COMPONENT_DEFINE ("LteTestSinrChunkProcessor");
29 
31 {
32  NS_LOG_FUNCTION (this);
33 }
34 
36 {
37  NS_LOG_FUNCTION (this);
38 }
39 
40 void
42 {
43  NS_LOG_FUNCTION (this);
44 }
45 
46 void
48 {
49  NS_LOG_FUNCTION (this);
50  m_sumSinr = 0;
52 }
53 
54 void
56 {
57  NS_LOG_FUNCTION (this << sinr << duration);
58  if (m_sumSinr == 0)
59  {
60  m_sumSinr = Create<SpectrumValue> (sinr.GetSpectrumModel ());
61  }
62  (*m_sumSinr) += sinr * duration.GetSeconds ();
63  m_totDuration += duration;
64  NS_LOG_LOGIC (this << " m_sumSinr = " << *m_sumSinr);
65  NS_LOG_LOGIC (this << " m_totDuration = " << m_totDuration);
66 }
67 
68 void
70 {
71  NS_LOG_FUNCTION (this);
72  if (m_totDuration.GetSeconds () > 0)
73  {
74  NS_LOG_LOGIC (this << " m_sumSinr = " << *m_sumSinr);
75  NS_LOG_LOGIC (this << " m_totDuration = " << m_totDuration);
76  m_sinr = Create<SpectrumValue> ((*m_sumSinr) / m_totDuration.GetSeconds ());
77  NS_LOG_LOGIC (this << " m_sumSinr / m_totDuration = " << *m_sinr);
78  }
79  else
80  {
81  NS_LOG_WARN ("m_numSinr == 0");
82  }
83 }
84 
87 {
88  NS_LOG_FUNCTION (this);
89 
90  NS_ASSERT (m_sinr);
91  return m_sinr;
92 }
93 
94 } // namespace ns3
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:95
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Callback template class.
Definition: callback.h:978
#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
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:327
Ptr< const SpectrumModel > GetSpectrumModel() const
virtual void EvaluateChunk(const SpectrumValue &sinr, Time duration)
Collect SpectrumValue and duration of signal.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:252
virtual void Start()
Clear internal variables.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual void AddCallback(LteChunkProcessorCallback c)
Add callback to list.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:228
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:875
virtual void End()
Finish calculation and inform interested objects about calculated value.
Set of values corresponding to a given SpectrumModel.