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 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Nicola Baldo <nbaldo@cttc.es>
18 */
19
21
22#include "ns3/lte-enb-net-device.h"
23#include "ns3/lte-spectrum-phy.h"
24#include "ns3/lte-ue-net-device.h"
25
26#include <limits>
27
28namespace ns3
29{
30
31NS_LOG_COMPONENT_DEFINE("LteGlobalPathlossDatabase");
32
34{
35}
36
37void
39{
40 NS_LOG_FUNCTION(this);
41 for (auto cellIdIt = m_pathlossMap.begin(); cellIdIt != m_pathlossMap.end(); ++cellIdIt)
42 {
43 for (auto imsiIt = cellIdIt->second.begin(); imsiIt != cellIdIt->second.end(); ++imsiIt)
44 {
45 std::cout << "CellId: " << cellIdIt->first << " IMSI: " << imsiIt->first
46 << " pathloss: " << imsiIt->second << " dB" << std::endl;
47 }
48 }
49}
50
51double
52LteGlobalPathlossDatabase::GetPathloss(uint16_t cellId, uint64_t imsi)
53{
54 NS_LOG_FUNCTION(this);
55 auto cellIt = m_pathlossMap.find(cellId);
56 if (cellIt == m_pathlossMap.end())
57 {
58 return std::numeric_limits<double>::infinity();
59 }
60 auto ueIt = cellIt->second.find(imsi);
61 if (ueIt == cellIt->second.end())
62 {
63 return std::numeric_limits<double>::infinity();
64 }
65 return ueIt->second;
66}
67
68void
72 double lossDb)
73{
74 NS_LOG_FUNCTION(this << lossDb);
75 uint16_t cellId = txPhy->GetDevice()->GetObject<LteEnbNetDevice>()->GetCellId();
76 uint16_t imsi = rxPhy->GetDevice()->GetObject<LteUeNetDevice>()->GetImsi();
77 m_pathlossMap[cellId][imsi] = lossDb;
78}
79
80void
84 double lossDb)
85{
86 NS_LOG_FUNCTION(this << lossDb);
87 uint16_t imsi = txPhy->GetDevice()->GetObject<LteUeNetDevice>()->GetImsi();
88 uint16_t cellId = rxPhy->GetDevice()->GetObject<LteEnbNetDevice>()->GetCellId();
89 m_pathlossMap[cellId][imsi] = lossDb;
90}
91
92} // 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.
Definition: ptr.h:77
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#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.