A Discrete-Event Network Simulator
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
10
11#include "lora-utils.h"
12
13#include "ns3/double.h"
14
15namespace ns3
16{
17namespace lorawan
18{
19
20NS_LOG_COMPONENT_DEFINE("LoraTxCurrentModel");
21
23
24TypeId
26{
27 static TypeId tid = TypeId("ns3::LoraTxCurrentModel").SetParent<Object>().SetGroupName("Lora");
28 return tid;
29}
30
34
38
39// Similarly to the wifi case
41
44{
45 static TypeId tid =
46 TypeId("ns3::LinearLoraTxCurrentModel")
48 .SetGroupName("Lora")
49 .AddConstructor<LinearLoraTxCurrentModel>()
50 .AddAttribute("Eta",
51 "The efficiency of the power amplifier.",
52 DoubleValue(0.452750), // see class description
55 .AddAttribute("Voltage",
56 "The supply voltage (in Volts).",
57 DoubleValue(3.3),
60 .AddAttribute("BaseCurrent",
61 "The TX baseline current (in Ampere) at 0W output.",
62 DoubleValue(0.014646), // see class description
65 return tid;
66}
67
72
77
78double
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
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition double.h:31
Object()
Caller graph was not generated because of its size.
Definition object.cc:93
a unique identifier for an interface.
Definition type-id.h:50
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:999
A linear model of the transmission current for a LoRa device.
static TypeId GetTypeId()
Register this type.
double CalcTxCurrent(double txPowerDbm) const override
Get the current for transmission at this power.
Model the transmit current as a function of the transmit power and mode.
static TypeId GetTypeId()
Register this type.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:194
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
double DbmToW(double dBm)
Convert from dBm to Watts.
Definition lora-utils.cc:26
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeDoubleChecker()
Definition double.h:82
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition double.h:32