This class supports LorawanMac instances by managing a list of the logical channels that the device is supposed to be using, and establishes their relationship with SubBands. More...
#include "logical-lora-channel-helper.h"
Public Member Functions | |
LogicalLoraChannelHelper (uint8_t size) | |
Construct a LogicalLoraChannelHelper of a certain size. | |
~LogicalLoraChannelHelper () | |
Destructor. | |
void | AddEvent (Time duration, Ptr< LogicalLoraChannel > channel) |
Register the transmission of a packet. | |
void | AddEvent (Time duration, uint32_t frequencyHz) |
Register the transmission of a packet. | |
void | AddSubBand (Ptr< SubBand > subBand) |
Add a new SubBand. | |
std::vector< Ptr< LogicalLoraChannel > > | GetRawChannelArray () const |
Get the frequency channel storage array of this device. | |
double | GetTxPowerForChannel (Ptr< LogicalLoraChannel > channel) const |
Returns the maximum transmission power [dBm] that is allowed on a channel. | |
double | GetTxPowerForChannel (uint32_t frequencyHz) const |
Returns the maximum transmission power [dBm] that is allowed on a channel. | |
Time | GetWaitTime (Ptr< LogicalLoraChannel > channel) const |
Get the time it is necessary to wait for before transmitting on a given channel. | |
Time | GetWaitTime (uint32_t frequencyHz) const |
Get the time it is necessary to wait for before transmitting on a given channel. | |
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 class. | |
void | SetChannel (uint8_t chIndex, Ptr< LogicalLoraChannel > channel) |
Set a new channel at a fixed index. | |
![]() | |
SimpleRefCount () | |
Default constructor. | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. | |
void | Ref () const |
Increment the reference count. | |
void | Unref () const |
Decrement the reference count. | |
Private Member Functions | |
Ptr< SubBand > | GetSubBandFromFrequency (uint32_t frequencyHz) const |
Get the SubBand a frequency belongs to, also used to test validity of a frequency. | |
Private Attributes | |
std::vector< Ptr< LogicalLoraChannel > > | m_channelVec |
A vector of the LogicalLoraChannels that are currently registered within this helper. | |
std::vector< Ptr< SubBand > > | m_subBandList |
A vector of the SubBands that are currently registered within this helper. | |
This class supports LorawanMac instances by managing a list of the logical channels that the device is supposed to be using, and establishes their relationship with SubBands.
This class also takes into account duty cycle limitations, by updating a list of SubBand objects and providing methods to query whether transmission on a set channel is admissible or not.
Definition at line 37 of file logical-lora-channel-helper.h.
ns3::lorawan::LogicalLoraChannelHelper::LogicalLoraChannelHelper | ( | uint8_t | size | ) |
Construct a LogicalLoraChannelHelper of a certain size.
size | The maximum number of transmission channels that can be installed on this device according to regional parameter specifications. |
Definition at line 20 of file logical-lora-channel-helper.cc.
References m_channelVec, and NS_LOG_FUNCTION.
ns3::lorawan::LogicalLoraChannelHelper::~LogicalLoraChannelHelper | ( | ) |
Destructor.
Definition at line 26 of file logical-lora-channel-helper.cc.
References m_channelVec, m_subBandList, and NS_LOG_FUNCTION.
void ns3::lorawan::LogicalLoraChannelHelper::AddEvent | ( | Time | duration, |
Ptr< LogicalLoraChannel > | channel ) |
Register the transmission of a packet.
duration | The duration of the transmission event. |
channel | The channel the transmission was made on. |
Definition at line 91 of file logical-lora-channel-helper.cc.
References AddEvent(), and NS_LOG_FUNCTION.
Referenced by AddEvent().
Register the transmission of a packet.
duration | The duration of the transmission event. |
frequencyHz | The carrier frequency [Hz] the transmission was on. |
Definition at line 98 of file logical-lora-channel-helper.cc.
References ns3::Time::As(), GetSubBandFromFrequency(), ns3::Now(), NS_ASSERT_MSG, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::Time::S.
Add a new SubBand.
subBand | A pointer to the SubBand that needs to be added. |
Definition at line 65 of file logical-lora-channel-helper.cc.
References m_subBandList, and NS_LOG_FUNCTION.
std::vector< Ptr< LogicalLoraChannel > > ns3::lorawan::LogicalLoraChannelHelper::GetRawChannelArray | ( | ) | const |
Get the frequency channel storage array of this device.
By specifications, devices are required to hold an indexed structure of a certain size (region-dependent) for storing transmission channels.
Definition at line 34 of file logical-lora-channel-helper.cc.
References m_channelVec, and NS_LOG_FUNCTION.
|
private |
Get the SubBand a frequency belongs to, also used to test validity of a frequency.
frequencyHz | The frequency [Hz] we want to check. |
Definition at line 41 of file logical-lora-channel-helper.cc.
References m_subBandList, NS_LOG_ERROR, and NS_LOG_FUNCTION.
Referenced by AddEvent(), GetTxPowerForChannel(), GetWaitTime(), and IsFrequencyValid().
double ns3::lorawan::LogicalLoraChannelHelper::GetTxPowerForChannel | ( | Ptr< LogicalLoraChannel > | channel | ) | const |
Returns the maximum transmission power [dBm] that is allowed on a channel.
channel | The channel in question. |
Definition at line 110 of file logical-lora-channel-helper.cc.
References GetTxPowerForChannel(), and NS_LOG_FUNCTION.
Referenced by GetTxPowerForChannel().
Returns the maximum transmission power [dBm] that is allowed on a channel.
frequencyHz | The carrier frequency [Hz] of the channel in question. |
Definition at line 117 of file logical-lora-channel-helper.cc.
References GetSubBandFromFrequency(), NS_ASSERT_MSG, and NS_LOG_FUNCTION.
Time ns3::lorawan::LogicalLoraChannelHelper::GetWaitTime | ( | Ptr< LogicalLoraChannel > | channel | ) | const |
Get the time it is necessary to wait for before transmitting on a given channel.
channel | A pointer to the channel we want to know the wait time for. |
Definition at line 72 of file logical-lora-channel-helper.cc.
References GetWaitTime(), and NS_LOG_FUNCTION.
Referenced by GetWaitTime().
Get the time it is necessary to wait for before transmitting on a given channel.
frequencyHz | The channel frequency [Hz] we want to know the wait time of for. |
Definition at line 79 of file logical-lora-channel-helper.cc.
References ns3::Time::As(), GetSubBandFromFrequency(), Max, ns3::Now(), NS_ASSERT_MSG, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::Time::S.
bool ns3::lorawan::LogicalLoraChannelHelper::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 class.
frequencyHz | The frequency [Hz] to be evaluated. |
Definition at line 126 of file logical-lora-channel-helper.cc.
References GetSubBandFromFrequency().
void ns3::lorawan::LogicalLoraChannelHelper::SetChannel | ( | uint8_t | chIndex, |
Ptr< LogicalLoraChannel > | channel ) |
Set a new channel at a fixed index.
chIndex | The index of the channel to substitute. |
channel | A pointer to the channel to add to the list. |
Definition at line 56 of file logical-lora-channel-helper.cc.
References m_channelVec, NS_ASSERT_MSG, and NS_LOG_FUNCTION.
|
private |
A vector of the LogicalLoraChannels that are currently registered within this helper.
This vector represents the node's channel mask. The first N channels are the default ones for a fixed region.
Definition at line 155 of file logical-lora-channel-helper.h.
Referenced by LogicalLoraChannelHelper(), ~LogicalLoraChannelHelper(), GetRawChannelArray(), and SetChannel().
A vector of the SubBands that are currently registered within this helper.
Definition at line 148 of file logical-lora-channel-helper.h.
Referenced by ~LogicalLoraChannelHelper(), AddSubBand(), and GetSubBandFromFrequency().