A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::lorawan::LogicalLoraChannelHelper Class Reference

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"

+ Inheritance diagram for ns3::lorawan::LogicalLoraChannelHelper:
+ Collaboration diagram for ns3::lorawan::LogicalLoraChannelHelper:

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.
 
- Public Member Functions inherited from ns3::SimpleRefCount< LogicalLoraChannelHelper >
 SimpleRefCount ()
 Default constructor.
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor.
 
uint32_t GetReferenceCount () const
 Get the reference count of the object.
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
 
void Ref () const
 Increment the reference count.
 
void Unref () const
 Decrement the reference count.
 

Private Member Functions

Ptr< SubBandGetSubBandFromFrequency (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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ LogicalLoraChannelHelper()

ns3::lorawan::LogicalLoraChannelHelper::LogicalLoraChannelHelper ( uint8_t size)

Construct a LogicalLoraChannelHelper of a certain size.

Parameters
sizeThe 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.

◆ ~LogicalLoraChannelHelper()

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.

Member Function Documentation

◆ AddEvent() [1/2]

void ns3::lorawan::LogicalLoraChannelHelper::AddEvent ( Time duration,
Ptr< LogicalLoraChannel > channel )

Register the transmission of a packet.

Parameters
durationThe duration of the transmission event.
channelThe 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddEvent() [2/2]

void ns3::lorawan::LogicalLoraChannelHelper::AddEvent ( Time duration,
uint32_t frequencyHz )

Register the transmission of a packet.

Parameters
durationThe duration of the transmission event.
frequencyHzThe 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.

+ Here is the call graph for this function:

◆ AddSubBand()

void ns3::lorawan::LogicalLoraChannelHelper::AddSubBand ( Ptr< SubBand > subBand)

Add a new SubBand.

Parameters
subBandA 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.

◆ GetRawChannelArray()

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.

Remarks
Empty index slots hold nullptr.
Returns
An indexed vector of pointers to LogicalLoraChannels.

Definition at line 34 of file logical-lora-channel-helper.cc.

References m_channelVec, and NS_LOG_FUNCTION.

◆ GetSubBandFromFrequency()

Ptr< SubBand > ns3::lorawan::LogicalLoraChannelHelper::GetSubBandFromFrequency ( uint32_t frequencyHz) const
private

Get the SubBand a frequency belongs to, also used to test validity of a frequency.

Parameters
frequencyHzThe frequency [Hz] we want to check.
Returns
The SubBand the frequency belongs to, nullptr if none.

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().

+ Here is the caller graph for this function:

◆ GetTxPowerForChannel() [1/2]

double ns3::lorawan::LogicalLoraChannelHelper::GetTxPowerForChannel ( Ptr< LogicalLoraChannel > channel) const

Returns the maximum transmission power [dBm] that is allowed on a channel.

Parameters
channelThe channel in question.
Returns
The power in dBm.

Definition at line 110 of file logical-lora-channel-helper.cc.

References GetTxPowerForChannel(), and NS_LOG_FUNCTION.

Referenced by GetTxPowerForChannel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetTxPowerForChannel() [2/2]

double ns3::lorawan::LogicalLoraChannelHelper::GetTxPowerForChannel ( uint32_t frequencyHz) const

Returns the maximum transmission power [dBm] that is allowed on a channel.

Parameters
frequencyHzThe carrier frequency [Hz] of the channel in question.
Returns
The power in dBm.

Definition at line 117 of file logical-lora-channel-helper.cc.

References GetSubBandFromFrequency(), NS_ASSERT_MSG, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ GetWaitTime() [1/2]

Time ns3::lorawan::LogicalLoraChannelHelper::GetWaitTime ( Ptr< LogicalLoraChannel > channel) const

Get the time it is necessary to wait for before transmitting on a given channel.

Parameters
channelA pointer to the channel we want to know the wait time for.
Returns
A Time instance containing the wait time before transmission is allowed on the channel.

Definition at line 72 of file logical-lora-channel-helper.cc.

References GetWaitTime(), and NS_LOG_FUNCTION.

Referenced by GetWaitTime().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetWaitTime() [2/2]

Time ns3::lorawan::LogicalLoraChannelHelper::GetWaitTime ( uint32_t frequencyHz) const

Get the time it is necessary to wait for before transmitting on a given channel.

Parameters
frequencyHzThe channel frequency [Hz] we want to know the wait time of for.
Returns
A Time instance containing the wait time before transmission is allowed on the channel.

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.

+ Here is the call graph for this function:

◆ IsFrequencyValid()

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.

Parameters
frequencyHzThe frequency [Hz] to be evaluated.
Returns
Whether the input frequency belongs to any of the registered sub-bands.

Definition at line 126 of file logical-lora-channel-helper.cc.

References GetSubBandFromFrequency().

+ Here is the call graph for this function:

◆ SetChannel()

void ns3::lorawan::LogicalLoraChannelHelper::SetChannel ( uint8_t chIndex,
Ptr< LogicalLoraChannel > channel )

Set a new channel at a fixed index.

Parameters
chIndexThe index of the channel to substitute.
channelA 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.

Member Data Documentation

◆ m_channelVec

std::vector<Ptr<LogicalLoraChannel> > ns3::lorawan::LogicalLoraChannelHelper::m_channelVec
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().

◆ m_subBandList

std::vector<Ptr<SubBand> > ns3::lorawan::LogicalLoraChannelHelper::m_subBandList
private

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().


The documentation for this class was generated from the following files: