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-global-pathloss-database.cc
Go to the documentation of this file.
1
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2011,2012 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
*/
20
21
22
#include "
lte-global-pathloss-database.h
"
23
#include "ns3/lte-enb-net-device.h"
24
#include "ns3/lte-ue-net-device.h"
25
#include "ns3/lte-spectrum-phy.h"
26
27
#include <limits>
28
29
namespace
ns3 {
30
31
NS_LOG_COMPONENT_DEFINE
(
"LteGlobalPathlossDatabase"
);
32
33
34
LteGlobalPathlossDatabase::~LteGlobalPathlossDatabase
(
void
)
35
{
36
}
37
38
void
39
LteGlobalPathlossDatabase::Print
()
40
{
41
NS_LOG_FUNCTION
(
this
);
42
for
(std::map<uint16_t, std::map<uint64_t, double> >::const_iterator cellIdIt =
m_pathlossMap
.begin ();
43
cellIdIt !=
m_pathlossMap
.end ();
44
++cellIdIt)
45
{
46
for
(std::map<uint64_t, double>::const_iterator imsiIt = cellIdIt->second.begin ();
47
imsiIt != cellIdIt->second.end ();
48
++imsiIt)
49
{
50
std::cout <<
"CellId: "
<< cellIdIt->first <<
" IMSI: "
<< imsiIt->first <<
" pathloss: "
<< imsiIt->second <<
" dB"
<< std::endl;
51
}
52
}
53
}
54
55
56
double
57
LteGlobalPathlossDatabase::GetPathloss
(uint16_t cellId, uint64_t imsi)
58
{
59
NS_LOG_FUNCTION
(
this
);
60
std::map<uint16_t, std::map<uint64_t, double> >::iterator cellIt =
m_pathlossMap
.find (cellId);
61
if
(cellIt ==
m_pathlossMap
.end())
62
{
63
return
std::numeric_limits<double>::infinity ();
64
}
65
std::map<uint64_t, double>::iterator ueIt = cellIt->second.find (imsi);
66
if
(ueIt == cellIt->second.end())
67
{
68
return
std::numeric_limits<double>::infinity ();
69
}
70
return
ueIt->second;
71
}
72
73
74
void
75
DownlinkLteGlobalPathlossDatabase::UpdatePathloss
(std::string context,
76
Ptr<SpectrumPhy>
txPhy,
77
Ptr<SpectrumPhy>
rxPhy,
78
double
lossDb)
79
{
80
NS_LOG_FUNCTION
(
this
<< lossDb);
81
uint16_t cellId = txPhy->
GetDevice
()->
GetObject
<
LteEnbNetDevice
> ()->GetCellId ();
82
uint16_t imsi = rxPhy->
GetDevice
()->
GetObject
<
LteUeNetDevice
> ()->GetImsi ();
83
m_pathlossMap
[cellId][imsi] = lossDb;
84
}
85
86
87
void
88
UplinkLteGlobalPathlossDatabase::UpdatePathloss
(std::string context,
89
Ptr<SpectrumPhy>
txPhy,
90
Ptr<SpectrumPhy>
rxPhy,
91
double
lossDb)
92
{
93
NS_LOG_FUNCTION
(
this
<< lossDb);
94
uint16_t imsi = txPhy->
GetDevice
()->
GetObject
<
LteUeNetDevice
> ()->GetImsi ();
95
uint16_t cellId = rxPhy->
GetDevice
()->
GetObject
<
LteEnbNetDevice
> ()->GetCellId ();
96
m_pathlossMap
[cellId][imsi] = lossDb;
97
}
98
99
100
101
}
// namespace ns3
src
lte
helper
lte-global-pathloss-database.cc
Generated on Tue May 14 2013 11:08:24 for ns-3 by
1.8.1.2