A Discrete-Event Network Simulator
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
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
17namespace ns3
18{
19
20NS_LOG_COMPONENT_DEFINE("LteGlobalPathlossDatabase");
21
25
26void
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
40double
41LteGlobalPathlossDatabase::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
57void
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
69void
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
The eNodeB device implementation.
double GetPathloss(uint16_t cellId, uint64_t imsi)
std::map< uint16_t, std::map< uint64_t, double > > m_pathlossMap
List of the last pathloss value for each UE by CellId.
void Print()
print the stored pathloss values to standard output
The LteUeNetDevice class implements the UE net device.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Every class exported by the ns3 library is enclosed in the ns3 namespace.