author | mmiozzo |
Mon, 28 Nov 2011 12:32:08 +0100 | |
changeset 8415 | e9a27a8c6331 |
parent 8253 | 6faee3d1d1d0 |
child 8506 | f9616c9094a5 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
6852
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
6705 | 2 |
/* |
3 |
* Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari |
|
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: Giuseppe Piro <g.piro@poliba.it> |
|
7886 | 19 |
* Marco Miozzo <mmiozzo@cttc.es> |
6705 | 20 |
*/ |
21 |
||
22 |
#include <ns3/object-factory.h> |
|
23 |
#include <ns3/log.h> |
|
24 |
#include <math.h> |
|
25 |
#include <ns3/simulator.h> |
|
7949 | 26 |
#include <ns3/attribute-accessor-helper.h> |
27 |
#include <ns3/double.h> |
|
28 |
||
29 |
||
7887 | 30 |
#include "lte-enb-phy.h" |
6705 | 31 |
#include "lte-net-device.h" |
32 |
#include "lte-spectrum-value-helper.h" |
|
33 |
#include "ideal-control-messages.h" |
|
7887 | 34 |
#include "lte-enb-net-device.h" |
7886 | 35 |
#include "lte-enb-mac.h" |
7947 | 36 |
#include <ns3/lte-common.h> |
7886 | 37 |
|
6705 | 38 |
|
7887 | 39 |
NS_LOG_COMPONENT_DEFINE ("LteEnbPhy"); |
6705 | 40 |
|
41 |
namespace ns3 { |
|
42 |
||
43 |
||
7886 | 44 |
//////////////////////////////////////// |
45 |
// member SAP forwarders |
|
46 |
//////////////////////////////////////// |
|
47 |
||
48 |
||
49 |
class EnbMemberLteEnbPhySapProvider : public LteEnbPhySapProvider |
|
50 |
{ |
|
51 |
public: |
|
7887 | 52 |
EnbMemberLteEnbPhySapProvider (LteEnbPhy* phy); |
7886 | 53 |
|
54 |
// inherited from LteEnbPhySapProvider |
|
55 |
virtual void SendMacPdu (Ptr<Packet> p); |
|
56 |
virtual void SetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth); |
|
57 |
virtual void SetCellId (uint16_t cellId); |
|
58 |
virtual void SendIdealControlMessage (Ptr<IdealControlMessage> msg); |
|
59 |
||
60 |
private: |
|
7887 | 61 |
LteEnbPhy* m_phy; |
7886 | 62 |
}; |
63 |
||
7887 | 64 |
EnbMemberLteEnbPhySapProvider::EnbMemberLteEnbPhySapProvider (LteEnbPhy* phy) : m_phy (phy) |
7886 | 65 |
{ |
66 |
||
67 |
} |
|
68 |
||
69 |
||
70 |
void |
|
71 |
EnbMemberLteEnbPhySapProvider::SendMacPdu (Ptr<Packet> p) |
|
72 |
{ |
|
73 |
m_phy->DoSendMacPdu (p); |
|
74 |
} |
|
75 |
||
76 |
void |
|
77 |
EnbMemberLteEnbPhySapProvider::SetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth) |
|
78 |
{ |
|
79 |
m_phy->DoSetBandwidth (ulBandwidth, dlBandwidth); |
|
80 |
} |
|
81 |
||
82 |
void |
|
83 |
EnbMemberLteEnbPhySapProvider::SetCellId (uint16_t cellId) |
|
84 |
{ |
|
85 |
m_phy->DoSetCellId (cellId); |
|
86 |
} |
|
87 |
||
88 |
void |
|
89 |
EnbMemberLteEnbPhySapProvider::SendIdealControlMessage (Ptr<IdealControlMessage> msg) |
|
90 |
{ |
|
91 |
m_phy->DoSendIdealControlMessage (msg); |
|
92 |
} |
|
93 |
||
94 |
||
95 |
//////////////////////////////////////// |
|
7887 | 96 |
// generic LteEnbPhy methods |
7886 | 97 |
//////////////////////////////////////// |
98 |
||
99 |
||
100 |
||
7887 | 101 |
NS_OBJECT_ENSURE_REGISTERED (LteEnbPhy); |
6705 | 102 |
|
103 |
||
7887 | 104 |
LteEnbPhy::LteEnbPhy () |
7980
f07d99163a56
LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents:
7977
diff
changeset
|
105 |
{ |
f07d99163a56
LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents:
7977
diff
changeset
|
106 |
NS_LOG_FUNCTION (this); |
f07d99163a56
LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents:
7977
diff
changeset
|
107 |
NS_FATAL_ERROR ("This constructor should not be called"); |
f07d99163a56
LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents:
7977
diff
changeset
|
108 |
} |
f07d99163a56
LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents:
7977
diff
changeset
|
109 |
|
f07d99163a56
LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents:
7977
diff
changeset
|
110 |
LteEnbPhy::LteEnbPhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy) |
f07d99163a56
LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents:
7977
diff
changeset
|
111 |
: LtePhy (dlPhy, ulPhy), |
f07d99163a56
LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents:
7977
diff
changeset
|
112 |
m_nrFrames (0), |
7886 | 113 |
m_nrSubFrames (0) |
6705 | 114 |
{ |
7886 | 115 |
m_enbPhySapProvider = new EnbMemberLteEnbPhySapProvider (this); |
7944
f7e5e0540487
connection of SAPs moved from EnbNetDevice to LenaHelper
Nicola Baldo <nicola@baldo.biz>
parents:
7943
diff
changeset
|
116 |
Simulator::ScheduleNow (&LteEnbPhy::StartFrame, this); |
6705 | 117 |
} |
118 |
||
119 |
TypeId |
|
7887 | 120 |
LteEnbPhy::GetTypeId (void) |
6705 | 121 |
{ |
7887 | 122 |
static TypeId tid = TypeId ("ns3::LteEnbPhy") |
6707
2ac68a0381ca
improved module after Tom's review
Giuseppe Piro <g.piro@poliba.it>
parents:
6705
diff
changeset
|
123 |
.SetParent<LtePhy> () |
7887 | 124 |
.AddConstructor<LteEnbPhy> () |
7949 | 125 |
.AddAttribute ("TxPower", |
126 |
"Transmission power in dBm", |
|
127 |
DoubleValue (30.0), |
|
128 |
MakeDoubleAccessor (&LteEnbPhy::SetTxPower, |
|
129 |
&LteEnbPhy::GetTxPower), |
|
130 |
MakeDoubleChecker<double> ()) |
|
7981 | 131 |
.AddAttribute ("NoiseFigure", |
132 |
"Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver." |
|
133 |
" According to Wikipedia (http://en.wikipedia.org/wiki/Noise_figure), this is " |
|
134 |
"\"the difference in decibels (dB) between" |
|
135 |
" the noise output of the actual receiver to the noise output of an " |
|
136 |
" ideal receiver with the same overall gain and bandwidth when the receivers " |
|
137 |
" are connected to sources at the standard noise temperature T0.\" " |
|
138 |
"In this model, we consider T0 = 290K.", |
|
139 |
DoubleValue (5.0), |
|
140 |
MakeDoubleAccessor (&LteEnbPhy::SetNoiseFigure, |
|
141 |
&LteEnbPhy::GetNoiseFigure), |
|
142 |
MakeDoubleChecker<double> ()) |
|
6705 | 143 |
; |
144 |
return tid; |
|
145 |
} |
|
146 |
||
147 |
||
7887 | 148 |
LteEnbPhy::~LteEnbPhy () |
6705 | 149 |
{ |
150 |
} |
|
151 |
||
7886 | 152 |
void |
7913
ed3a9f8a76d7
added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents:
7887
diff
changeset
|
153 |
LteEnbPhy::DoDispose () |
ed3a9f8a76d7
added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents:
7887
diff
changeset
|
154 |
{ |
ed3a9f8a76d7
added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents:
7887
diff
changeset
|
155 |
NS_LOG_FUNCTION (this); |
7921 | 156 |
m_ueAttached.clear (); |
7930
ccb40542ae88
fixed memory leak in PHY SAP usage
Nicola Baldo <nbaldo@cttc.es>
parents:
7928
diff
changeset
|
157 |
delete m_enbPhySapProvider; |
7913
ed3a9f8a76d7
added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents:
7887
diff
changeset
|
158 |
LtePhy::DoDispose (); |
ed3a9f8a76d7
added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents:
7887
diff
changeset
|
159 |
} |
ed3a9f8a76d7
added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents:
7887
diff
changeset
|
160 |
|
ed3a9f8a76d7
added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents:
7887
diff
changeset
|
161 |
void |
8015 | 162 |
LteEnbPhy::DoStart () |
163 |
{ |
|
164 |
NS_LOG_FUNCTION (this); |
|
165 |
Ptr<SpectrumValue> noisePsd = LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (m_ulEarfcn, m_ulBandwidth, m_noiseFigure); |
|
166 |
m_uplinkSpectrumPhy->SetNoisePowerSpectralDensity (noisePsd); |
|
167 |
LtePhy::DoStart (); |
|
168 |
} |
|
169 |
||
170 |
||
171 |
void |
|
7887 | 172 |
LteEnbPhy::SetLteEnbPhySapUser (LteEnbPhySapUser* s) |
7886 | 173 |
{ |
174 |
m_enbPhySapUser = s; |
|
175 |
} |
|
176 |
||
177 |
LteEnbPhySapProvider* |
|
7887 | 178 |
LteEnbPhy::GetLteEnbPhySapProvider () |
7886 | 179 |
{ |
180 |
return (m_enbPhySapProvider); |
|
181 |
} |
|
182 |
||
7949 | 183 |
void |
184 |
LteEnbPhy::SetTxPower (double pow) |
|
185 |
{ |
|
186 |
NS_LOG_FUNCTION (this << pow); |
|
187 |
m_txPower = pow; |
|
188 |
} |
|
7886 | 189 |
|
7949 | 190 |
double |
191 |
LteEnbPhy::GetTxPower () const |
|
192 |
{ |
|
193 |
NS_LOG_FUNCTION (this); |
|
194 |
return m_txPower; |
|
195 |
} |
|
7886 | 196 |
|
7981 | 197 |
void |
198 |
LteEnbPhy::SetNoiseFigure (double nf) |
|
199 |
{ |
|
200 |
NS_LOG_FUNCTION (this << nf); |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
201 |
m_noiseFigure = nf; |
7981 | 202 |
} |
203 |
||
204 |
double |
|
205 |
LteEnbPhy::GetNoiseFigure () const |
|
206 |
{ |
|
207 |
NS_LOG_FUNCTION (this); |
|
208 |
return m_noiseFigure; |
|
209 |
} |
|
210 |
||
7886 | 211 |
bool |
8180
5429db8b8c37
Fix Bug JIRA:LENA-145, RNTI as uint16_t in LteEnbPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8148
diff
changeset
|
212 |
LteEnbPhy::AddUePhy (uint16_t rnti, Ptr<LteUePhy> phy) |
7886 | 213 |
{ |
8180
5429db8b8c37
Fix Bug JIRA:LENA-145, RNTI as uint16_t in LteEnbPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8148
diff
changeset
|
214 |
std::map <uint16_t, Ptr<LteUePhy> >::iterator it; |
7886 | 215 |
it = m_ueAttached.find (rnti); |
216 |
if (it == m_ueAttached.end ()) |
|
217 |
{ |
|
8180
5429db8b8c37
Fix Bug JIRA:LENA-145, RNTI as uint16_t in LteEnbPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8148
diff
changeset
|
218 |
m_ueAttached.insert (std::pair<uint16_t, Ptr<LteUePhy> > (rnti, phy)); |
7886 | 219 |
return (true); |
220 |
} |
|
221 |
else |
|
222 |
{ |
|
223 |
NS_LOG_ERROR ("UE already attached"); |
|
224 |
return (false); |
|
225 |
} |
|
226 |
} |
|
6705 | 227 |
|
228 |
bool |
|
8180
5429db8b8c37
Fix Bug JIRA:LENA-145, RNTI as uint16_t in LteEnbPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8148
diff
changeset
|
229 |
LteEnbPhy::DeleteUePhy (uint16_t rnti) |
6705 | 230 |
{ |
8180
5429db8b8c37
Fix Bug JIRA:LENA-145, RNTI as uint16_t in LteEnbPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8148
diff
changeset
|
231 |
std::map <uint16_t, Ptr<LteUePhy> >::iterator it; |
7886 | 232 |
it = m_ueAttached.find (rnti); |
233 |
if (it == m_ueAttached.end ()) |
|
234 |
{ |
|
235 |
NS_LOG_ERROR ("UE not attached"); |
|
236 |
return (false); |
|
237 |
} |
|
238 |
else |
|
239 |
{ |
|
240 |
m_ueAttached.erase (it); |
|
241 |
return (true); |
|
242 |
} |
|
243 |
} |
|
244 |
||
245 |
||
246 |
||
247 |
void |
|
7887 | 248 |
LteEnbPhy::DoSendMacPdu (Ptr<Packet> p) |
7886 | 249 |
{ |
250 |
// NS_LOG_FUNCTION (this << pb->GetNPackets () << pb->GetSize ()); |
|
251 |
// return GetDownlinkSpectrumPhy ()->StartTx (pb); |
|
252 |
||
253 |
NS_LOG_FUNCTION (this); |
|
254 |
SetMacPdu (p); |
|
255 |
} |
|
256 |
||
257 |
||
258 |
void |
|
7887 | 259 |
LteEnbPhy::PhyPduReceived (Ptr<Packet> p) |
7886 | 260 |
{ |
261 |
NS_LOG_FUNCTION (this); |
|
262 |
m_enbPhySapUser->ReceivePhyPdu (p); |
|
6705 | 263 |
} |
264 |
||
265 |
void |
|
7887 | 266 |
LteEnbPhy::DoSetDownlinkSubChannels () |
6705 | 267 |
{ |
268 |
NS_LOG_FUNCTION (this); |
|
269 |
Ptr<SpectrumValue> txPsd = CreateTxPowerSpectralDensity (); |
|
7928
b736f63e9bdf
removed LtePhy::Get{Up,Down}linkSpectrumPhy methods which are evil
Nicola Baldo <nbaldo@cttc.es>
parents:
7921
diff
changeset
|
270 |
m_downlinkSpectrumPhy->SetTxPowerSpectralDensity (txPsd); |
6705 | 271 |
} |
272 |
||
273 |
||
274 |
Ptr<SpectrumValue> |
|
7887 | 275 |
LteEnbPhy::CreateTxPowerSpectralDensity () |
6705 | 276 |
{ |
277 |
NS_LOG_FUNCTION (this); |
|
278 |
||
8015 | 279 |
Ptr<SpectrumValue> psd = LteSpectrumValueHelper::CreateTxPowerSpectralDensity (m_dlEarfcn, m_dlBandwidth, m_txPower, GetDownlinkSubChannels ()); |
6705 | 280 |
|
281 |
return psd; |
|
282 |
} |
|
283 |
||
284 |
||
285 |
void |
|
7887 | 286 |
LteEnbPhy::CalcChannelQualityForUe (std::vector <double> sinr, Ptr<LteSpectrumPhy> ue) |
6705 | 287 |
{ |
288 |
NS_LOG_FUNCTION (this); |
|
289 |
} |
|
290 |
||
7886 | 291 |
|
6705 | 292 |
void |
7887 | 293 |
LteEnbPhy::DoSendIdealControlMessage (Ptr<IdealControlMessage> msg) |
6705 | 294 |
{ |
295 |
NS_LOG_FUNCTION (this << msg); |
|
7886 | 296 |
// queues the message (wait for MAC-PHY delay) |
297 |
SetControlMessages (msg); |
|
6705 | 298 |
} |
299 |
||
300 |
||
7886 | 301 |
|
6705 | 302 |
void |
7887 | 303 |
LteEnbPhy::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg) |
6705 | 304 |
{ |
305 |
NS_LOG_FUNCTION (this << msg); |
|
7886 | 306 |
m_enbPhySapUser->ReceiveIdealControlMessage (msg); |
6705 | 307 |
} |
308 |
||
309 |
||
310 |
||
311 |
void |
|
7887 | 312 |
LteEnbPhy::StartFrame (void) |
6705 | 313 |
{ |
7886 | 314 |
NS_LOG_FUNCTION (this); |
6705 | 315 |
|
7886 | 316 |
++m_nrFrames; |
317 |
NS_LOG_INFO ("-----frame " << m_nrFrames << "-----"); |
|
318 |
m_nrSubFrames = 0; |
|
6705 | 319 |
StartSubFrame (); |
320 |
} |
|
321 |
||
322 |
||
323 |
void |
|
7887 | 324 |
LteEnbPhy::StartSubFrame (void) |
6705 | 325 |
{ |
7886 | 326 |
NS_LOG_FUNCTION (this); |
6705 | 327 |
|
7886 | 328 |
++m_nrSubFrames; |
329 |
NS_LOG_INFO ("-----sub frame " << m_nrSubFrames << "-----"); |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
330 |
|
7886 | 331 |
// send the current burst of control messages |
332 |
std::list<Ptr<IdealControlMessage> > ctrlMsg = GetControlMessages (); |
|
333 |
std::vector <int> dlRb; |
|
334 |
if (ctrlMsg.size () > 0) |
|
335 |
{ |
|
336 |
std::list<Ptr<IdealControlMessage> >::iterator it; |
|
337 |
it = ctrlMsg.begin (); |
|
338 |
while (it != ctrlMsg.end ()) |
|
339 |
{ |
|
340 |
Ptr<IdealControlMessage> msg = (*it); |
|
341 |
if (msg->GetMessageType () == IdealControlMessage::DL_DCI) |
|
342 |
{ |
|
8180
5429db8b8c37
Fix Bug JIRA:LENA-145, RNTI as uint16_t in LteEnbPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8148
diff
changeset
|
343 |
std::map <uint16_t, Ptr<LteUePhy> >::iterator it2; |
7886 | 344 |
Ptr<DlDciIdealControlMessage> dci = DynamicCast<DlDciIdealControlMessage> (msg); |
345 |
it2 = m_ueAttached.find (dci->GetDci ().m_rnti); |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
346 |
|
7886 | 347 |
if (it2 == m_ueAttached.end ()) |
348 |
{ |
|
349 |
NS_LOG_ERROR ("UE not attached"); |
|
350 |
} |
|
351 |
else |
|
352 |
{ |
|
353 |
// get the tx power spectral density according to DL-DCI(s) |
|
354 |
// translate the DCI to Spectrum framework |
|
355 |
uint32_t mask = 0x1; |
|
356 |
for (int i = 0; i < 32; i++) |
|
357 |
{ |
|
358 |
if (((dci->GetDci ().m_rbBitmap & mask) >> i) == 1) |
|
359 |
{ |
|
360 |
for (int k = 0; k < GetRbgSize (); k++) |
|
361 |
{ |
|
362 |
dlRb.push_back ((i * GetRbgSize ()) + k); |
|
363 |
//NS_LOG_DEBUG(this << " [enb]DL-DCI allocated PRB " << (i*GetRbgSize()) + k); |
|
364 |
} |
|
365 |
} |
|
366 |
mask = (mask << 1); |
|
367 |
} |
|
368 |
(*it2).second->ReceiveIdealControlMessage (msg); |
|
369 |
} |
|
370 |
} |
|
371 |
else if (msg->GetMessageType () == IdealControlMessage::UL_DCI) |
|
372 |
{ |
|
8180
5429db8b8c37
Fix Bug JIRA:LENA-145, RNTI as uint16_t in LteEnbPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8148
diff
changeset
|
373 |
std::map <uint16_t, Ptr<LteUePhy> >::iterator it2; |
7886 | 374 |
Ptr<UlDciIdealControlMessage> dci = DynamicCast<UlDciIdealControlMessage> (msg); |
375 |
it2 = m_ueAttached.find (dci->GetDci ().m_rnti); |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
376 |
|
7886 | 377 |
if (it2 == m_ueAttached.end ()) |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
378 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
379 |
NS_LOG_ERROR ("UE not attached"); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
380 |
} |
7886 | 381 |
else |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
382 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
383 |
(*it2).second->ReceiveIdealControlMessage (msg); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
384 |
} |
7886 | 385 |
} |
386 |
ctrlMsg.pop_front (); |
|
387 |
it = ctrlMsg.begin (); |
|
388 |
} |
|
389 |
} |
|
390 |
// set the current tx power spectral density |
|
391 |
SetDownlinkSubChannels (dlRb); |
|
392 |
// send the current burts of packets |
|
393 |
Ptr<PacketBurst> pb = GetPacketBurst (); |
|
394 |
if (pb) |
|
395 |
{ |
|
7928
b736f63e9bdf
removed LtePhy::Get{Up,Down}linkSpectrumPhy methods which are evil
Nicola Baldo <nbaldo@cttc.es>
parents:
7921
diff
changeset
|
396 |
m_downlinkSpectrumPhy->StartTx (pb); |
7886 | 397 |
} |
6705 | 398 |
|
7886 | 399 |
// trigger the MAC |
400 |
m_enbPhySapUser->SubframeIndication (m_nrFrames, m_nrSubFrames); |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
401 |
|
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
402 |
|
7886 | 403 |
// trigger the UE(s) |
8180
5429db8b8c37
Fix Bug JIRA:LENA-145, RNTI as uint16_t in LteEnbPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8148
diff
changeset
|
404 |
std::map <uint16_t, Ptr<LteUePhy> >::iterator it; |
7886 | 405 |
for (it = m_ueAttached.begin (); it != m_ueAttached.end (); it++) |
406 |
{ |
|
407 |
(*it).second->SubframeIndication (m_nrFrames, m_nrSubFrames); |
|
408 |
} |
|
6705 | 409 |
|
410 |
Simulator::Schedule (Seconds (GetTti ()), |
|
7887 | 411 |
&LteEnbPhy::EndSubFrame, |
6705 | 412 |
this); |
413 |
||
414 |
} |
|
415 |
||
416 |
||
417 |
void |
|
7887 | 418 |
LteEnbPhy::EndSubFrame (void) |
6705 | 419 |
{ |
420 |
NS_LOG_FUNCTION (this << Simulator::Now ().GetSeconds ()); |
|
7886 | 421 |
if (m_nrSubFrames == 10) |
6705 | 422 |
{ |
7887 | 423 |
Simulator::ScheduleNow (&LteEnbPhy::EndFrame, this); |
6705 | 424 |
} |
425 |
else |
|
426 |
{ |
|
7887 | 427 |
Simulator::ScheduleNow (&LteEnbPhy::StartSubFrame, this); |
6705 | 428 |
} |
429 |
} |
|
430 |
||
431 |
||
432 |
void |
|
7887 | 433 |
LteEnbPhy::EndFrame (void) |
6705 | 434 |
{ |
435 |
NS_LOG_FUNCTION (this << Simulator::Now ().GetSeconds ()); |
|
7887 | 436 |
Simulator::ScheduleNow (&LteEnbPhy::StartFrame, this); |
6705 | 437 |
} |
438 |
||
439 |
||
7886 | 440 |
void |
7887 | 441 |
LteEnbPhy::GenerateCqiFeedback (const SpectrumValue& sinr) |
7886 | 442 |
{ |
443 |
NS_LOG_FUNCTION (this << sinr); |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
444 |
Ptr<LteEnbNetDevice> thisDevice = GetDevice ()->GetObject<LteEnbNetDevice> (); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
445 |
|
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
446 |
m_enbPhySapUser->UlCqiReport (CreateUlCqiReport (sinr)); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
447 |
|
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
448 |
|
7910 | 449 |
} |
450 |
||
451 |
||
7934
0f09fc707a8c
Convert UL-CQI from IdealControlMessage to PhySap Primitive
mmiozzo
parents:
7930
diff
changeset
|
452 |
UlCqi_s |
0f09fc707a8c
Convert UL-CQI from IdealControlMessage to PhySap Primitive
mmiozzo
parents:
7930
diff
changeset
|
453 |
LteEnbPhy::CreateUlCqiReport (const SpectrumValue& sinr) |
7910 | 454 |
{ |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
455 |
NS_LOG_FUNCTION (this << sinr); |
7910 | 456 |
Values::const_iterator it; |
457 |
UlCqi_s ulcqi; |
|
458 |
ulcqi.m_type = UlCqi_s::PUSCH; |
|
459 |
int i = 0; |
|
460 |
for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++) |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
461 |
{ |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
462 |
double sinrdb = 10 * log10 ((*it)); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
463 |
// convert from double to fixed point notation Sxxxxxxxxxxx.xxx |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
464 |
int16_t sinrFp = LteFfConverter::double2fpS11dot3 (sinrdb); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
465 |
ulcqi.m_sinr.push_back (sinrFp); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
466 |
i++; |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
8015
diff
changeset
|
467 |
} |
7934
0f09fc707a8c
Convert UL-CQI from IdealControlMessage to PhySap Primitive
mmiozzo
parents:
7930
diff
changeset
|
468 |
return (ulcqi); |
7910 | 469 |
|
7886 | 470 |
} |
6705 | 471 |
|
472 |
}; |