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
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Romagnolo Stefano <romagnolostefano93@gmail.com>
7
*/
8
9
#include "
lora-utils.h
"
10
11
#include <cmath>
12
13
namespace
ns3
14
{
15
namespace
lorawan
16
{
17
18
double
19
DbToRatio
(
double
dB)
20
{
21
double
ratio = std::pow(10.0, dB / 10.0);
22
return
ratio;
23
}
24
25
double
26
DbmToW
(
double
dBm)
27
{
28
double
mW = std::pow(10.0, dBm / 10.0);
29
return
mW / 1000.0;
30
}
31
32
double
33
WToDbm
(
double
w)
34
{
35
return
10.0 * std::log10(w * 1000.0);
36
}
37
38
double
39
RatioToDb
(
double
ratio)
40
{
41
return
10.0 * std::log10(ratio);
42
}
43
44
}
// namespace lorawan
45
}
// namespace ns3
lora-utils.h
ns3::lorawan::DbmToW
double DbmToW(double dBm)
Convert from dBm to Watts.
Definition
lora-utils.cc:26
ns3::lorawan::WToDbm
double WToDbm(double w)
Convert from Watts to dBm.
Definition
lora-utils.cc:33
ns3::lorawan::RatioToDb
double RatioToDb(double ratio)
Convert from ratio to dB.
Definition
lora-utils.cc:39
ns3::lorawan::DbToRatio
double DbToRatio(double dB)
Convert from dB to ratio.
Definition
lora-utils.cc:19
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
lorawan
model
lora-utils.cc
Generated on Fri Nov 8 2024 13:59:02 for ns-3 by
1.11.0