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
35
LteGlobalPathlossDatabase::~LteGlobalPathlossDatabase
(
void
)
36
{
37
}
38
39
void
40
LteGlobalPathlossDatabase::Print
()
41
{
42
NS_LOG_FUNCTION
(
this
);
43
for
(std::map<uint16_t, std::map<uint64_t, double> >::const_iterator cellIdIt =
m_pathlossMap
.begin ();
44
cellIdIt !=
m_pathlossMap
.end ();
45
++cellIdIt)
46
{
47
for
(std::map<uint64_t, double>::const_iterator imsiIt = cellIdIt->second.begin ();
48
imsiIt != cellIdIt->second.end ();
49
++imsiIt)
50
{
51
std::cout <<
"CellId: "
<< cellIdIt->first <<
" IMSI: "
<< imsiIt->first <<
" pathloss: "
<< imsiIt->second <<
" dB"
<< std::endl;
52
}
53
}
54
}
55
56
57
double
58
LteGlobalPathlossDatabase::GetPathloss
(uint16_t cellId, uint64_t imsi)
59
{
60
NS_LOG_FUNCTION
(
this
);
61
std::map<uint16_t, std::map<uint64_t, double> >::iterator cellIt =
m_pathlossMap
.find (cellId);
62
if
(cellIt ==
m_pathlossMap
.end())
63
{
64
return
std::numeric_limits<double>::infinity ();
65
}
66
std::map<uint64_t, double>::iterator ueIt = cellIt->second.find (imsi);
67
if
(ueIt == cellIt->second.end())
68
{
69
return
std::numeric_limits<double>::infinity ();
70
}
71
return
ueIt->second;
72
}
73
74
75
void
76
DownlinkLteGlobalPathlossDatabase::UpdatePathloss
(std::string context,
77
Ptr<SpectrumPhy>
txPhy,
78
Ptr<SpectrumPhy>
rxPhy,
79
double
lossDb)
80
{
81
NS_LOG_FUNCTION
(
this
<< lossDb);
82
uint16_t cellId = txPhy->
GetDevice
()->GetObject<
LteEnbNetDevice
> ()->GetCellId ();
83
uint16_t imsi = rxPhy->
GetDevice
()->GetObject<
LteUeNetDevice
> ()->GetImsi ();
84
m_pathlossMap
[cellId][imsi] = lossDb;
85
}
86
87
88
void
89
UplinkLteGlobalPathlossDatabase::UpdatePathloss
(std::string context,
90
Ptr<SpectrumPhy>
txPhy,
91
Ptr<SpectrumPhy>
rxPhy,
92
double
lossDb)
93
{
94
NS_LOG_FUNCTION
(
this
<< lossDb);
95
uint16_t imsi = txPhy->
GetDevice
()->GetObject<
LteUeNetDevice
> ()->GetImsi ();
96
uint16_t cellId = rxPhy->
GetDevice
()->GetObject<
LteEnbNetDevice
> ()->GetCellId ();
97
m_pathlossMap
[cellId][imsi] = lossDb;
98
}
99
100
101
102
}
// namespace ns3
ns3::LteGlobalPathlossDatabase::Print
void Print()
print the stored pathloss values to standard output
Definition:
lte-global-pathloss-database.cc:40
ns3::Ptr< SpectrumPhy >
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
Definition:
log.h:345
ns3::NS_LOG_COMPONENT_DEFINE
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
ns3::UplinkLteGlobalPathlossDatabase::UpdatePathloss
virtual void UpdatePathloss(std::string context, Ptr< SpectrumPhy > txPhy, Ptr< SpectrumPhy > rxPhy, double lossDb)
update the pathloss value
Definition:
lte-global-pathloss-database.cc:89
ns3::LteGlobalPathlossDatabase::~LteGlobalPathlossDatabase
virtual ~LteGlobalPathlossDatabase(void)
Definition:
lte-global-pathloss-database.cc:35
lte-global-pathloss-database.h
ns3::LteGlobalPathlossDatabase::m_pathlossMap
std::map< uint16_t, std::map< uint64_t, double > > m_pathlossMap
Definition:
lte-global-pathloss-database.h:75
ns3::SpectrumPhy::GetDevice
virtual Ptr< NetDevice > GetDevice()=0
get the associated NetDevice instance
ns3::LteGlobalPathlossDatabase::GetPathloss
double GetPathloss(uint16_t cellId, uint64_t imsi)
Definition:
lte-global-pathloss-database.cc:58
ns3::LteEnbNetDevice
The eNodeB device implementation.
Definition:
lte-enb-net-device.h:52
ns3::DownlinkLteGlobalPathlossDatabase::UpdatePathloss
virtual void UpdatePathloss(std::string context, Ptr< SpectrumPhy > txPhy, Ptr< SpectrumPhy > rxPhy, double lossDb)
update the pathloss value
Definition:
lte-global-pathloss-database.cc:76
ns3::LteUeNetDevice
The LteUeNetDevice class implements the UE net device.
Definition:
lte-ue-net-device.h:51
src
lte
helper
lte-global-pathloss-database.cc
Generated on Sat Apr 19 2014 14:06:58 for ns-3 by
1.8.6