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
logical-lora-channel-helper.h
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: Davide Magrin <magrinda@dei.unipd.it>
7
*/
8
9
#ifndef LOGICAL_LORA_CHANNEL_HELPER_H
10
#define LOGICAL_LORA_CHANNEL_HELPER_H
11
12
#include "
logical-lora-channel.h
"
13
#include "
sub-band.h
"
14
15
#include "ns3/nstime.h"
16
#include "ns3/ptr.h"
17
#include "ns3/simple-ref-count.h"
18
19
#include <vector>
20
21
namespace
ns3
22
{
23
namespace
lorawan
24
{
25
26
/**
27
* @ingroup lorawan
28
*
29
* This class supports LorawanMac instances by managing a list of the logical
30
* channels that the device is supposed to be using, and establishes their
31
* relationship with SubBands.
32
*
33
* This class also takes into account duty cycle limitations, by updating a list
34
* of SubBand objects and providing methods to query whether transmission on a
35
* set channel is admissible or not.
36
*/
37
class
LogicalLoraChannelHelper
:
public
SimpleRefCount
<LogicalLoraChannelHelper>
38
{
39
public
:
40
/**
41
* Construct a LogicalLoraChannelHelper of a certain size.
42
*
43
* @param size The maximum number of transmission channels that can be installed on this device
44
* according to regional parameter specifications.
45
*/
46
LogicalLoraChannelHelper
(uint8_t size);
47
48
~LogicalLoraChannelHelper
();
//!< Destructor
49
50
/**
51
* Get the time it is necessary to wait for before transmitting on a given channel.
52
*
53
* @param channel A pointer to the channel we want to know the wait time for.
54
* @return A Time instance containing the wait time before transmission is allowed on the
55
* channel.
56
*/
57
Time
GetWaitTime
(
Ptr<LogicalLoraChannel>
channel)
const
;
58
59
/**
60
* Get the time it is necessary to wait for before transmitting on a given channel.
61
*
62
* @param frequencyHz The channel frequency [Hz] we want to know the wait time of for.
63
* @return A Time instance containing the wait time before transmission is allowed on the
64
* channel.
65
*/
66
Time
GetWaitTime
(
uint32_t
frequencyHz)
const
;
67
68
/**
69
* Register the transmission of a packet.
70
*
71
* @param duration The duration of the transmission event.
72
* @param channel The channel the transmission was made on.
73
*/
74
void
AddEvent
(
Time
duration,
Ptr<LogicalLoraChannel>
channel);
75
76
/**
77
* Register the transmission of a packet.
78
*
79
* @param duration The duration of the transmission event.
80
* @param frequencyHz The carrier frequency [Hz] the transmission was on.
81
*/
82
void
AddEvent
(
Time
duration,
uint32_t
frequencyHz);
83
84
/**
85
* Get the frequency channel storage array of this device.
86
*
87
* By specifications, devices are required to hold an indexed structure
88
* of a certain size (region-dependent) for storing transmission channels.
89
*
90
* @remark Empty index slots hold nullptr.
91
*
92
* @return An indexed vector of pointers to LogicalLoraChannels.
93
*/
94
std::vector<Ptr<LogicalLoraChannel>>
GetRawChannelArray
()
const
;
95
96
/**
97
* Set a new channel at a fixed index.
98
*
99
* @param chIndex The index of the channel to substitute.
100
* @param channel A pointer to the channel to add to the list.
101
*/
102
void
SetChannel
(uint8_t chIndex,
Ptr<LogicalLoraChannel>
channel);
103
104
/**
105
* Add a new SubBand.
106
*
107
* @param subBand A pointer to the SubBand that needs to be added.
108
*/
109
void
AddSubBand
(
Ptr<SubBand>
subBand);
110
111
/**
112
* Returns the maximum transmission power [dBm] that is allowed on a channel.
113
*
114
* @param channel The channel in question.
115
* @return The power in dBm.
116
*/
117
double
GetTxPowerForChannel
(
Ptr<LogicalLoraChannel>
channel)
const
;
118
119
/**
120
* Returns the maximum transmission power [dBm] that is allowed on a channel.
121
*
122
* @param frequencyHz The carrier frequency [Hz] of the channel in question.
123
* @return The power in dBm.
124
*/
125
double
GetTxPowerForChannel
(
uint32_t
frequencyHz)
const
;
126
127
/**
128
* Check if a frequency is valid, that is, if it belongs to any of the sub-bands registered in
129
* this class.
130
*
131
* @param frequencyHz The frequency [Hz] to be evaluated.
132
* @return Whether the input frequency belongs to any of the registered sub-bands.
133
*/
134
bool
IsFrequencyValid
(
uint32_t
frequencyHz)
const
;
135
136
private
:
137
/**
138
* Get the SubBand a frequency belongs to, also used to test validity of a frequency.
139
*
140
* @param frequencyHz The frequency [Hz] we want to check.
141
* @return The SubBand the frequency belongs to, nullptr if none.
142
*/
143
Ptr<SubBand>
GetSubBandFromFrequency
(
uint32_t
frequencyHz)
const
;
144
145
/**
146
* A vector of the SubBands that are currently registered within this helper.
147
*/
148
std::vector<Ptr<SubBand>>
m_subBandList
;
149
150
/**
151
* A vector of the LogicalLoraChannels that are currently registered within
152
* this helper. This vector represents the node's channel mask. The first N
153
* channels are the default ones for a fixed region.
154
*/
155
std::vector<Ptr<LogicalLoraChannel>>
m_channelVec
;
156
};
157
158
}
// namespace lorawan
159
}
// namespace ns3
160
161
#endif
/* LOGICAL_LORA_CHANNEL_HELPER_H */
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::SimpleRefCount
A template-based reference counting class.
Definition
simple-ref-count.h:70
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:94
ns3::lorawan::LogicalLoraChannelHelper
This class supports LorawanMac instances by managing a list of the logical channels that the device i...
Definition
logical-lora-channel-helper.h:38
ns3::lorawan::LogicalLoraChannelHelper::~LogicalLoraChannelHelper
~LogicalLoraChannelHelper()
Destructor.
Definition
logical-lora-channel-helper.cc:26
ns3::lorawan::LogicalLoraChannelHelper::SetChannel
void SetChannel(uint8_t chIndex, Ptr< LogicalLoraChannel > channel)
Set a new channel at a fixed index.
Definition
logical-lora-channel-helper.cc:56
ns3::lorawan::LogicalLoraChannelHelper::GetTxPowerForChannel
double GetTxPowerForChannel(Ptr< LogicalLoraChannel > channel) const
Returns the maximum transmission power [dBm] that is allowed on a channel.
Definition
logical-lora-channel-helper.cc:110
ns3::lorawan::LogicalLoraChannelHelper::IsFrequencyValid
bool IsFrequencyValid(uint32_t frequencyHz) const
Check if a frequency is valid, that is, if it belongs to any of the sub-bands registered in this clas...
Definition
logical-lora-channel-helper.cc:126
ns3::lorawan::LogicalLoraChannelHelper::m_channelVec
std::vector< Ptr< LogicalLoraChannel > > m_channelVec
A vector of the LogicalLoraChannels that are currently registered within this helper.
Definition
logical-lora-channel-helper.h:155
ns3::lorawan::LogicalLoraChannelHelper::LogicalLoraChannelHelper
LogicalLoraChannelHelper(uint8_t size)
Construct a LogicalLoraChannelHelper of a certain size.
Definition
logical-lora-channel-helper.cc:20
ns3::lorawan::LogicalLoraChannelHelper::m_subBandList
std::vector< Ptr< SubBand > > m_subBandList
A vector of the SubBands that are currently registered within this helper.
Definition
logical-lora-channel-helper.h:148
ns3::lorawan::LogicalLoraChannelHelper::GetRawChannelArray
std::vector< Ptr< LogicalLoraChannel > > GetRawChannelArray() const
Get the frequency channel storage array of this device.
Definition
logical-lora-channel-helper.cc:34
ns3::lorawan::LogicalLoraChannelHelper::GetSubBandFromFrequency
Ptr< SubBand > GetSubBandFromFrequency(uint32_t frequencyHz) const
Get the SubBand a frequency belongs to, also used to test validity of a frequency.
Definition
logical-lora-channel-helper.cc:41
ns3::lorawan::LogicalLoraChannelHelper::AddEvent
void AddEvent(Time duration, Ptr< LogicalLoraChannel > channel)
Register the transmission of a packet.
Definition
logical-lora-channel-helper.cc:91
ns3::lorawan::LogicalLoraChannelHelper::AddSubBand
void AddSubBand(Ptr< SubBand > subBand)
Add a new SubBand.
Definition
logical-lora-channel-helper.cc:65
ns3::lorawan::LogicalLoraChannelHelper::GetWaitTime
Time GetWaitTime(Ptr< LogicalLoraChannel > channel) const
Get the time it is necessary to wait for before transmitting on a given channel.
Definition
logical-lora-channel-helper.cc:72
uint32_t
logical-lora-channel.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
sub-band.h
src
lorawan
model
logical-lora-channel-helper.h
Generated on Mon May 19 2025 15:51:16 for ns-3 by
1.11.0