A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
lte-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) 2010 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: Nicola Baldo <nbaldo@cttc.es>
19  * Modified by : Marco Miozzo <mmiozzo@cttc.es>
20  * (move from CQI to Ctrl and Data SINR Chunk processors
21  */
22 
23 
24 #include <ns3/log.h>
25 
27 
28 NS_LOG_COMPONENT_DEFINE ("LteSinrChunkProcessor");
29 
30 namespace ns3 {
31 
33 {
34  NS_LOG_FUNCTION (this);
35 }
36 
37 
39  : m_phy (p),
40  m_spectrumPhy (0)
41 {
42  NS_LOG_FUNCTION (this << p);
43  NS_ASSERT (m_phy);
44 }
45 
47 : m_phy (p),
48  m_spectrumPhy (s)
49 {
50  NS_LOG_FUNCTION (this << p);
51  NS_ASSERT (m_phy);
53 }
54 
55 
57 {
58  NS_LOG_FUNCTION (this);
59 }
60 
61 
62 void
64 {
65  NS_LOG_FUNCTION (this);
66  m_sumSinr = 0;
68 }
69 
70 
71 void
73 {
74  NS_LOG_FUNCTION (this << sinr << duration);
75  if (m_sumSinr == 0)
76  {
77  m_sumSinr = Create<SpectrumValue> (sinr.GetSpectrumModel ());
78  }
79  (*m_sumSinr) += sinr * duration.GetSeconds ();
80  m_totDuration += duration;
81 }
82 
83 void
85 {
86  NS_LOG_FUNCTION (this);
87  if (m_totDuration.GetSeconds () > 0)
88  {
90  if (m_spectrumPhy)
91  {
93  }
94  }
95  else
96  {
97  NS_LOG_WARN ("m_numSinr == 0");
98  }
99 }
100 
101 
102 
103 
105 : m_spectrumPhy (s),
106  m_phy (p)
107 {
108  NS_LOG_FUNCTION (this << p);
110  NS_ASSERT (m_phy);
111 }
112 
114 : m_spectrumPhy (p),
115  m_phy (0)
116 {
117  NS_LOG_FUNCTION (this << p);
119 
120 }
121 
122 
123 
125 {
126  NS_LOG_FUNCTION (this);
127 }
128 
129 
130 void
132 {
133  NS_LOG_FUNCTION (this);
134  m_sumSinr = 0;
136 }
137 
138 
139 void
141 {
142  NS_LOG_FUNCTION (this << sinr << duration);
143  if (m_sumSinr == 0)
144  {
145  m_sumSinr = Create<SpectrumValue> (sinr.GetSpectrumModel ());
146  }
147  (*m_sumSinr) += sinr * duration.GetSeconds ();
148  m_totDuration += duration;
149 }
150 
151 void
153 {
154  NS_LOG_FUNCTION (this);
155  if (m_totDuration.GetSeconds () > 0)
156  {
158  if (m_phy)
159  {
161  }
162  }
163  else
164  {
165  NS_LOG_WARN ("m_numSinr == 0");
166  }
167 }
168 
169 
170 } // namespace ns3