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
lora-utils.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2017 University of Padova
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: Romagnolo Stefano <romagnolostefano93@gmail.com>
18
*/
19
20
#include "
lora-utils.h
"
21
22
#include <cmath>
23
24
namespace
ns3
25
{
26
namespace
lorawan
27
{
28
29
double
30
DbToRatio
(
double
dB)
31
{
32
double
ratio = std::pow(10.0, dB / 10.0);
33
return
ratio;
34
}
35
36
double
37
DbmToW
(
double
dBm)
38
{
39
double
mW = std::pow(10.0, dBm / 10.0);
40
return
mW / 1000.0;
41
}
42
43
double
44
WToDbm
(
double
w)
45
{
46
return
10.0 * std::log10(w * 1000.0);
47
}
48
49
double
50
RatioToDb
(
double
ratio)
51
{
52
return
10.0 * std::log10(ratio);
53
}
54
55
}
// namespace lorawan
56
}
// namespace ns3
lora-utils.h
ns3::lorawan::DbmToW
double DbmToW(double dBm)
Convert from dBm to Watts.
Definition:
lora-utils.cc:37
ns3::lorawan::WToDbm
double WToDbm(double w)
Convert from Watts to dBm.
Definition:
lora-utils.cc:44
ns3::lorawan::RatioToDb
double RatioToDb(double ratio)
Convert from ratio to dB.
Definition:
lora-utils.cc:50
ns3::lorawan::DbToRatio
double DbToRatio(double dB)
Convert from dB to ratio.
Definition:
lora-utils.cc:30
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
lorawan
model
lora-utils.cc
Generated on Mon Aug 12 2024 11:16:15 for ns-3 by
1.9.6