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-tx-current-model.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-tx-current-model.h
"
10
11
#include "
lora-utils.h
"
12
13
#include "ns3/double.h"
14
15
namespace
ns3
16
{
17
namespace
lorawan
18
{
19
20
NS_LOG_COMPONENT_DEFINE
(
"LoraTxCurrentModel"
);
21
22
NS_OBJECT_ENSURE_REGISTERED
(
LoraTxCurrentModel
);
23
24
TypeId
25
LoraTxCurrentModel::GetTypeId
()
26
{
27
static
TypeId
tid =
TypeId
(
"ns3::LoraTxCurrentModel"
).
SetParent
<
Object
>().SetGroupName(
"Lora"
);
28
return
tid;
29
}
30
31
LoraTxCurrentModel::LoraTxCurrentModel
()
32
{
33
}
34
35
LoraTxCurrentModel::~LoraTxCurrentModel
()
36
{
37
}
38
39
// Similarly to the wifi case
40
NS_OBJECT_ENSURE_REGISTERED
(
LinearLoraTxCurrentModel
);
41
42
TypeId
43
LinearLoraTxCurrentModel::GetTypeId
()
44
{
45
static
TypeId
tid =
46
TypeId
(
"ns3::LinearLoraTxCurrentModel"
)
47
.
SetParent
<
LoraTxCurrentModel
>()
48
.SetGroupName(
"Lora"
)
49
.AddConstructor<
LinearLoraTxCurrentModel
>()
50
.AddAttribute(
"Eta"
,
51
"The efficiency of the power amplifier."
,
52
DoubleValue
(0.452750),
// see class description
53
MakeDoubleAccessor
(&
LinearLoraTxCurrentModel::m_eta
),
54
MakeDoubleChecker<double>
())
55
.AddAttribute(
"Voltage"
,
56
"The supply voltage (in Volts)."
,
57
DoubleValue
(3.3),
58
MakeDoubleAccessor
(&
LinearLoraTxCurrentModel::m_voltage
),
59
MakeDoubleChecker<double>
())
60
.AddAttribute(
"BaseCurrent"
,
61
"The TX baseline current (in Ampere) at 0W output."
,
62
DoubleValue
(0.014646),
// see class description
63
MakeDoubleAccessor
(&
LinearLoraTxCurrentModel::m_baseCurrent
),
64
MakeDoubleChecker<double>
());
65
return
tid;
66
}
67
68
LinearLoraTxCurrentModel::LinearLoraTxCurrentModel
()
69
{
70
NS_LOG_FUNCTION
(
this
);
71
}
72
73
LinearLoraTxCurrentModel::~LinearLoraTxCurrentModel
()
74
{
75
NS_LOG_FUNCTION
(
this
);
76
}
77
78
double
79
LinearLoraTxCurrentModel::CalcTxCurrent
(
double
txPowerDbm)
const
80
{
81
NS_LOG_FUNCTION
(
this
<< txPowerDbm);
82
return
DbmToW
(txPowerDbm) / (
m_voltage
*
m_eta
) +
m_baseCurrent
;
83
}
84
85
}
// namespace lorawan
86
}
// namespace ns3
ns3::DoubleValue
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition
double.h:31
ns3::Object::Object
Object()
Caller graph was not generated because of its size.
Definition
object.cc:93
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:50
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:999
ns3::lorawan::LinearLoraTxCurrentModel
A linear model of the transmission current for a LoRa device.
Definition
lora-tx-current-model.h:57
ns3::lorawan::LinearLoraTxCurrentModel::GetTypeId
static TypeId GetTypeId()
Register this type.
Definition
lora-tx-current-model.cc:43
ns3::lorawan::LinearLoraTxCurrentModel::m_voltage
double m_voltage
Voltage.
Definition
lora-tx-current-model.h:72
ns3::lorawan::LinearLoraTxCurrentModel::LinearLoraTxCurrentModel
LinearLoraTxCurrentModel()
Default constructor.
Definition
lora-tx-current-model.cc:68
ns3::lorawan::LinearLoraTxCurrentModel::m_eta
double m_eta
ETA.
Definition
lora-tx-current-model.h:71
ns3::lorawan::LinearLoraTxCurrentModel::~LinearLoraTxCurrentModel
~LinearLoraTxCurrentModel() override
Destructor.
Definition
lora-tx-current-model.cc:73
ns3::lorawan::LinearLoraTxCurrentModel::CalcTxCurrent
double CalcTxCurrent(double txPowerDbm) const override
Get the current for transmission at this power.
Definition
lora-tx-current-model.cc:79
ns3::lorawan::LinearLoraTxCurrentModel::m_baseCurrent
double m_baseCurrent
Base current.
Definition
lora-tx-current-model.h:73
ns3::lorawan::LoraTxCurrentModel
Model the transmit current as a function of the transmit power and mode.
Definition
lora-tx-current-model.h:26
ns3::lorawan::LoraTxCurrentModel::LoraTxCurrentModel
LoraTxCurrentModel()
Default constructor.
Definition
lora-tx-current-model.cc:31
ns3::lorawan::LoraTxCurrentModel::GetTypeId
static TypeId GetTypeId()
Register this type.
Definition
lora-tx-current-model.cc:25
ns3::lorawan::LoraTxCurrentModel::~LoraTxCurrentModel
~LoraTxCurrentModel() override
Destructor.
Definition
lora-tx-current-model.cc:35
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:194
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition
log-macros-enabled.h:231
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
lora-tx-current-model.h
lora-utils.h
ns3::lorawan
Definition
forwarder-helper.cc:19
ns3::lorawan::DbmToW
double DbmToW(double dBm)
Convert from dBm to Watts.
Definition
lora-utils.cc:26
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::MakeDoubleChecker
Ptr< const AttributeChecker > MakeDoubleChecker()
Definition
double.h:82
ns3::MakeDoubleAccessor
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition
double.h:32
src
lorawan
model
lora-tx-current-model.cc
Generated on
for ns-3 by
1.16.1