A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
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
LteGlobalPathlossDatabase::~LteGlobalPathlossDatabase
(
void
)
34
{
35
}
36
37
void
38
LteGlobalPathlossDatabase::Print
()
39
{
40
NS_LOG_FUNCTION
(
this
);
41
for
(std::map<uint16_t, std::map<uint64_t, double> >::const_iterator cellIdIt =
m_pathlossMap
.begin ();
42
cellIdIt !=
m_pathlossMap
.end ();
43
++cellIdIt)
44
{
45
for
(std::map<uint64_t, double>::const_iterator imsiIt = cellIdIt->second.begin ();
46
imsiIt != cellIdIt->second.end ();
47
++imsiIt)
48
{
49
std::cout <<
"CellId: "
<< cellIdIt->first <<
" IMSI: "
<< imsiIt->first <<
" pathloss: "
<< imsiIt->second <<
" dB"
<< std::endl;
50
}
51
}
52
}
53
54
55
double
56
LteGlobalPathlossDatabase::GetPathloss
(uint16_t cellId, uint64_t imsi)
57
{
58
NS_LOG_FUNCTION
(
this
);
59
std::map<uint16_t, std::map<uint64_t, double> >::iterator cellIt =
m_pathlossMap
.find (cellId);
60
if
(cellIt ==
m_pathlossMap
.end())
61
{
62
return
std::numeric_limits<double>::infinity ();
63
}
64
std::map<uint64_t, double>::iterator ueIt = cellIt->second.find (imsi);
65
if
(ueIt == cellIt->second.end())
66
{
67
return
std::numeric_limits<double>::infinity ();
68
}
69
return
ueIt->second;
70
}
71
72
73
void
74
DownlinkLteGlobalPathlossDatabase::UpdatePathloss
(std::string context,
75
Ptr<const SpectrumPhy>
txPhy,
76
Ptr<const SpectrumPhy>
rxPhy,
77
double
lossDb)
78
{
79
NS_LOG_FUNCTION
(
this
<< lossDb);
80
uint16_t cellId = txPhy->GetDevice ()->GetObject<
LteEnbNetDevice
> ()->GetCellId ();
81
uint16_t imsi = rxPhy->GetDevice ()->GetObject<
LteUeNetDevice
> ()->GetImsi ();
82
m_pathlossMap
[cellId][imsi] = lossDb;
83
}
84
85
86
void
87
UplinkLteGlobalPathlossDatabase::UpdatePathloss
(std::string context,
88
Ptr<const SpectrumPhy>
txPhy,
89
Ptr<const SpectrumPhy>
rxPhy,
90
double
lossDb)
91
{
92
NS_LOG_FUNCTION
(
this
<< lossDb);
93
uint16_t imsi = txPhy->GetDevice ()->GetObject<
LteUeNetDevice
> ()->GetImsi ();
94
uint16_t cellId = rxPhy->GetDevice ()->GetObject<
LteEnbNetDevice
> ()->GetCellId ();
95
m_pathlossMap
[cellId][imsi] = lossDb;
96
}
97
98
99
100
}
// namespace ns3
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:205
ns3::DownlinkLteGlobalPathlossDatabase::UpdatePathloss
virtual void UpdatePathloss(std::string context, Ptr< const SpectrumPhy > txPhy, Ptr< const SpectrumPhy > rxPhy, double lossDb)
update the pathloss value
Definition:
lte-global-pathloss-database.cc:74
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::LteGlobalPathlossDatabase::Print
void Print()
print the stored pathloss values to standard output
Definition:
lte-global-pathloss-database.cc:38
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:74
lte-global-pathloss-database.h
ns3::UplinkLteGlobalPathlossDatabase::UpdatePathloss
virtual void UpdatePathloss(std::string context, Ptr< const SpectrumPhy > txPhy, Ptr< const SpectrumPhy > rxPhy, double lossDb)
update the pathloss value
Definition:
lte-global-pathloss-database.cc:87
ns3::LteUeNetDevice
The LteUeNetDevice class implements the UE net device.
Definition:
lte-ue-net-device.h:57
ns3::LteGlobalPathlossDatabase::~LteGlobalPathlossDatabase
virtual ~LteGlobalPathlossDatabase(void)
Definition:
lte-global-pathloss-database.cc:33
ns3::LteGlobalPathlossDatabase::GetPathloss
double GetPathloss(uint16_t cellId, uint64_t imsi)
Definition:
lte-global-pathloss-database.cc:56
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition:
log-macros-enabled.h:244
ns3::LteGlobalPathlossDatabase::m_pathlossMap
std::map< uint16_t, std::map< uint64_t, double > > m_pathlossMap
List of the last pathloss value for each UE by CellId.
Definition:
lte-global-pathloss-database.h:79
ns3::LteEnbNetDevice
The eNodeB device implementation.
Definition:
lte-enb-net-device.h:57
src
lte
helper
lte-global-pathloss-database.cc
Generated on Fri Oct 1 2021 17:03:15 for ns-3 by
1.8.20