A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lora-utils.h
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#ifndef LORA_UTILS_H
21#define LORA_UTILS_H
22
23#include "ns3/nstime.h"
24#include "ns3/uinteger.h"
25
26namespace ns3
27{
28namespace lorawan
29{
30
31/**
32 * Convert from dBm to Watts.
33 *
34 * \param dbm The power in dBm.
35 *
36 * \return The equivalent Watts for the given dBm value.
37 */
38double DbmToW(double dbm);
39/**
40 * Convert from dB to ratio.
41 *
42 * \param db The dB value.
43 *
44 * \return The equivalent ratio from the given dB value.
45 */
46double DbToRatio(double db);
47/**
48 * Convert from Watts to dBm.
49 *
50 * \param w The power in Watts.
51 *
52 * \return The equivalent dBm for the given Watts.
53 */
54double WToDbm(double w);
55/**
56 * Convert from ratio to dB.
57 *
58 * \param ratio The ratio value.
59 *
60 * \return The equivalent dB from the given ratio value.
61 */
62double RatioToDb(double ratio);
63
64} // namespace lorawan
65
66} // namespace ns3
67#endif /* LORA_UTILS_H */
double DbmToW(double dBm)
Convert from dBm to Watts.
Definition: lora-utils.cc:37
double WToDbm(double w)
Convert from Watts to dBm.
Definition: lora-utils.cc:44
double RatioToDb(double ratio)
Convert from ratio to dB.
Definition: lora-utils.cc:50
double DbToRatio(double dB)
Convert from dB to ratio.
Definition: lora-utils.cc:30
Every class exported by the ns3 library is enclosed in the ns3 namespace.