A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
lte-global-pathloss-database.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011,2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Nicola Baldo <nbaldo@cttc.es>
7
*/
8
9
#include "
lte-global-pathloss-database.h
"
10
11
#include "ns3/lte-enb-net-device.h"
12
#include "ns3/lte-spectrum-phy.h"
13
#include "ns3/lte-ue-net-device.h"
14
15
#include <limits>
16
17
namespace
ns3
18
{
19
20
NS_LOG_COMPONENT_DEFINE
(
"LteGlobalPathlossDatabase"
);
21
22
LteGlobalPathlossDatabase::~LteGlobalPathlossDatabase
()
23
{
24
}
25
26
void
27
LteGlobalPathlossDatabase::Print
()
28
{
29
NS_LOG_FUNCTION
(
this
);
30
for
(
auto
cellIdIt =
m_pathlossMap
.begin(); cellIdIt !=
m_pathlossMap
.end(); ++cellIdIt)
31
{
32
for
(
auto
imsiIt = cellIdIt->second.begin(); imsiIt != cellIdIt->second.end(); ++imsiIt)
33
{
34
std::cout <<
"CellId: "
<< cellIdIt->first <<
" IMSI: "
<< imsiIt->first
35
<<
" pathloss: "
<< imsiIt->second <<
" dB"
<< std::endl;
36
}
37
}
38
}
39
40
double
41
LteGlobalPathlossDatabase::GetPathloss
(uint16_t cellId, uint64_t imsi)
42
{
43
NS_LOG_FUNCTION
(
this
);
44
auto
cellIt =
m_pathlossMap
.find(cellId);
45
if
(cellIt ==
m_pathlossMap
.end())
46
{
47
return
std::numeric_limits<double>::infinity();
48
}
49
auto
ueIt = cellIt->second.find(imsi);
50
if
(ueIt == cellIt->second.end())
51
{
52
return
std::numeric_limits<double>::infinity();
53
}
54
return
ueIt->second;
55
}
56
57
void
58
DownlinkLteGlobalPathlossDatabase::UpdatePathloss
(std::string context,
59
Ptr<const SpectrumPhy>
txPhy,
60
Ptr<const SpectrumPhy>
rxPhy,
61
double
lossDb)
62
{
63
NS_LOG_FUNCTION
(
this
<< lossDb);
64
uint16_t cellId = txPhy->GetDevice()->GetObject<
LteEnbNetDevice
>()->GetCellId();
65
uint16_t imsi = rxPhy->GetDevice()->GetObject<
LteUeNetDevice
>()->GetImsi();
66
m_pathlossMap
[cellId][imsi] = lossDb;
67
}
68
69
void
70
UplinkLteGlobalPathlossDatabase::UpdatePathloss
(std::string context,
71
Ptr<const SpectrumPhy>
txPhy,
72
Ptr<const SpectrumPhy>
rxPhy,
73
double
lossDb)
74
{
75
NS_LOG_FUNCTION
(
this
<< lossDb);
76
uint16_t imsi = txPhy->GetDevice()->GetObject<
LteUeNetDevice
>()->GetImsi();
77
uint16_t cellId = rxPhy->GetDevice()->GetObject<
LteEnbNetDevice
>()->GetCellId();
78
m_pathlossMap
[cellId][imsi] = lossDb;
79
}
80
81
}
// namespace ns3
ns3::DownlinkLteGlobalPathlossDatabase::UpdatePathloss
void UpdatePathloss(std::string context, Ptr< const SpectrumPhy > txPhy, Ptr< const SpectrumPhy > rxPhy, double lossDb) override
update the pathloss value
Definition
lte-global-pathloss-database.cc:58
ns3::LteEnbNetDevice
The eNodeB device implementation.
Definition
lte-enb-net-device.h:48
ns3::LteGlobalPathlossDatabase::GetPathloss
double GetPathloss(uint16_t cellId, uint64_t imsi)
Definition
lte-global-pathloss-database.cc:41
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:70
ns3::LteGlobalPathlossDatabase::Print
void Print()
print the stored pathloss values to standard output
Definition
lte-global-pathloss-database.cc:27
ns3::LteGlobalPathlossDatabase::~LteGlobalPathlossDatabase
virtual ~LteGlobalPathlossDatabase()
Definition
lte-global-pathloss-database.cc:22
ns3::LteUeNetDevice
The LteUeNetDevice class implements the UE net device.
Definition
lte-ue-net-device.h:46
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::UplinkLteGlobalPathlossDatabase::UpdatePathloss
void UpdatePathloss(std::string context, Ptr< const SpectrumPhy > txPhy, Ptr< const SpectrumPhy > rxPhy, double lossDb) override
update the pathloss value
Definition
lte-global-pathloss-database.cc:70
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
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:229
lte-global-pathloss-database.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
lte
helper
lte-global-pathloss-database.cc
Generated on Fri Nov 8 2024 13:59:02 for ns-3 by
1.11.0