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 () | |
Default constructor. | |
~LogicalLoraChannelHelper () override | |
Destructor. | |
void | AddChannel (double frequency) |
Add a new channel to the list. | |
void | AddChannel (Ptr< LogicalLoraChannel > logicalChannel) |
Add a new channel to the list. | |
void | AddEvent (Time duration, Ptr< LogicalLoraChannel > channel) |
Register the transmission of a packet. | |
void | AddSubBand (double firstFrequency, double lastFrequency, double dutyCycle, double maxTxPowerDbm) |
Add a new SubBand to this helper. | |
void | AddSubBand (Ptr< SubBand > subBand) |
Add a new SubBand. | |
void | DisableChannel (int index) |
Disable the channel at a specified index. | |
Time | GetAggregatedWaitingTime () |
Get the time it is necessary to wait before transmitting again, according to the aggregate duty cycle timer. | |
std::vector< Ptr< LogicalLoraChannel > > | GetChannelList () |
Get the list of LogicalLoraChannels currently registered on this helper. | |
std::vector< Ptr< LogicalLoraChannel > > | GetEnabledChannelList () |
Get the list of LogicalLoraChannels currently registered on this helper that have been enabled for Uplink transmission with the channel mask. | |
Ptr< SubBand > | GetSubBandFromChannel (Ptr< LogicalLoraChannel > channel) |
Get the SubBand a channel belongs to. | |
Ptr< SubBand > | GetSubBandFromFrequency (double frequency) |
Get the SubBand a frequency belongs to. | |
double | GetTxPowerForChannel (Ptr< LogicalLoraChannel > logicalChannel) |
Returns the maximum transmission power [dBm] that is allowed on a channel. | |
Time | GetWaitingTime (Ptr< LogicalLoraChannel > channel) |
Get the time it is necessary to wait for before transmitting on a given channel. | |
void | RemoveChannel (Ptr< LogicalLoraChannel > channel) |
Remove a channel. | |
void | SetChannel (uint8_t chIndex, Ptr< LogicalLoraChannel > logicalChannel) |
Set a new channel at a fixed index. | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. | |
~Object () override | |
Destructor. | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. | |
void | Dispose () |
Dispose of this Object. | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. | |
bool | IsInitialized () const |
Check if the object has been initialized. | |
void | UnidirectionalAggregateObject (Ptr< Object > other) |
Aggregate an Object to another Object. | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
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. | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. | |
virtual TypeId | GetInstanceTypeId () const =0 |
Get the most derived TypeId for this Object. | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Register this type. | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. | |
Private Attributes | |
double | m_aggregatedDutyCycle |
transmission will be possible according to the aggregated transmission timer | |
std::vector< Ptr< LogicalLoraChannel > > | m_channelList |
A vector of the LogicalLoraChannels that are currently registered within this helper. | |
Time | m_nextAggregatedTransmissionTime |
The next time at which. | |
std::list< Ptr< SubBand > > | m_subBandList |
A list of the SubBands that are currently registered within this helper. | |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. | |
virtual void | DoDispose () |
Destructor implementation. | |
virtual void | DoInitialize () |
Initialize() implementation. | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
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 50 of file logical-lora-channel-helper.h.
ns3::lorawan::LogicalLoraChannelHelper::LogicalLoraChannelHelper | ( | ) |
Default constructor.
Definition at line 42 of file logical-lora-channel-helper.cc.
References NS_LOG_FUNCTION.
|
override |
Destructor.
Definition at line 49 of file logical-lora-channel-helper.cc.
References NS_LOG_FUNCTION.
void ns3::lorawan::LogicalLoraChannelHelper::AddChannel | ( | double | frequency | ) |
Add a new channel to the list.
frequency | The frequency of the channel to create. |
Definition at line 118 of file logical-lora-channel-helper.cc.
References m_channelList, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by ns3::lorawan::EndDeviceLorawanMac::AddLogicalChannel(), ns3::lorawan::LorawanMacHelper::ApplyCommonAlohaConfigurations(), ns3::lorawan::LorawanMacHelper::ApplyCommonEuConfigurations(), and ns3::lorawan::LorawanMacHelper::ApplyCommonSingleChannelConfigurations().
void ns3::lorawan::LogicalLoraChannelHelper::AddChannel | ( | Ptr< LogicalLoraChannel > | logicalChannel | ) |
Add a new channel to the list.
logicalChannel | A pointer to the channel to add to the list. |
Definition at line 132 of file logical-lora-channel-helper.cc.
References m_channelList, 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 218 of file logical-lora-channel-helper.cc.
References ns3::Time::GetSeconds(), GetSubBandFromChannel(), m_aggregatedDutyCycle, m_nextAggregatedTransmissionTime, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::Seconds().
Referenced by ns3::lorawan::GatewayLorawanMac::Send(), and ns3::lorawan::ClassAEndDeviceLorawanMac::SendToPhy().
void ns3::lorawan::LogicalLoraChannelHelper::AddSubBand | ( | double | firstFrequency, |
double | lastFrequency, | ||
double | dutyCycle, | ||
double | maxTxPowerDbm | ||
) |
Add a new SubBand to this helper.
firstFrequency | The first frequency of the subband, in MHz. |
lastFrequency | The last frequency of the subband, in MHz. |
dutyCycle | The duty cycle that needs to be enforced on this subband. |
maxTxPowerDbm | The maximum transmission power [dBm] that can be used. on this SubBand. |
Definition at line 150 of file logical-lora-channel-helper.cc.
References m_subBandList, and NS_LOG_FUNCTION.
Referenced by ns3::lorawan::EndDeviceLorawanMac::AddSubBand(), ns3::lorawan::LorawanMacHelper::ApplyCommonAlohaConfigurations(), ns3::lorawan::LorawanMacHelper::ApplyCommonEuConfigurations(), and ns3::lorawan::LorawanMacHelper::ApplyCommonSingleChannelConfigurations().
Add a new SubBand.
subBand | A pointer to the SubBand that needs to be added. |
Definition at line 163 of file logical-lora-channel-helper.cc.
References m_subBandList, and NS_LOG_FUNCTION.
void ns3::lorawan::LogicalLoraChannelHelper::DisableChannel | ( | int | index | ) |
Disable the channel at a specified index.
index | The index of the channel to disable. |
Definition at line 264 of file logical-lora-channel-helper.cc.
References m_channelList, and NS_LOG_FUNCTION.
Time ns3::lorawan::LogicalLoraChannelHelper::GetAggregatedWaitingTime | ( | ) |
Get the time it is necessary to wait before transmitting again, according to the aggregate duty cycle timer.
Definition at line 187 of file logical-lora-channel-helper.cc.
References ns3::Time::GetSeconds(), m_nextAggregatedTransmissionTime, ns3::Simulator::Now(), NS_LOG_DEBUG, and ns3::Seconds().
std::vector< Ptr< LogicalLoraChannel > > ns3::lorawan::LogicalLoraChannelHelper::GetChannelList | ( | ) |
Get the list of LogicalLoraChannels currently registered on this helper.
Definition at line 55 of file logical-lora-channel-helper.cc.
References m_channelList, and NS_LOG_FUNCTION.
Referenced by ns3::lorawan::EndDeviceLorawanMac::OnLinkAdrReq().
std::vector< Ptr< LogicalLoraChannel > > ns3::lorawan::LogicalLoraChannelHelper::GetEnabledChannelList | ( | ) |
Get the list of LogicalLoraChannels currently registered on this helper that have been enabled for Uplink transmission with the channel mask.
Definition at line 68 of file logical-lora-channel-helper.cc.
References m_channelList, and NS_LOG_FUNCTION.
Referenced by ns3::lorawan::EndDeviceLorawanMac::GetChannelForTx(), and ns3::lorawan::EndDeviceLorawanMac::GetNextTransmissionDelay().
Ptr< SubBand > ns3::lorawan::LogicalLoraChannelHelper::GetSubBandFromChannel | ( | Ptr< LogicalLoraChannel > | channel | ) |
Get the SubBand a channel belongs to.
channel | The channel whose SubBand we want to get. |
Definition at line 93 of file logical-lora-channel-helper.cc.
References GetSubBandFromFrequency().
Referenced by AddEvent(), and GetWaitingTime().
Get the SubBand a frequency belongs to.
frequency | The frequency we want to check. |
Definition at line 99 of file logical-lora-channel-helper.cc.
References m_subBandList, NS_ABORT_MSG, and NS_LOG_ERROR.
Referenced by GetSubBandFromChannel().
double ns3::lorawan::LogicalLoraChannelHelper::GetTxPowerForChannel | ( | Ptr< LogicalLoraChannel > | logicalChannel | ) |
Returns the maximum transmission power [dBm] that is allowed on a channel.
logicalChannel | The power for which to check the maximum allowed. transmission power. |
Definition at line 244 of file logical-lora-channel-helper.cc.
References m_subBandList, NS_ABORT_MSG, and NS_LOG_FUNCTION_NOARGS.
Referenced by ns3::lorawan::EndDeviceLorawanMac::Send(), and ns3::lorawan::GatewayLorawanMac::Send().
|
static |
Register this type.
Definition at line 35 of file logical-lora-channel-helper.cc.
References ns3::TypeId::SetParent().
Time ns3::lorawan::LogicalLoraChannelHelper::GetWaitingTime | ( | Ptr< LogicalLoraChannel > | channel | ) |
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 waiting time. for. |
Definition at line 201 of file logical-lora-channel-helper.cc.
References ns3::Time::GetSeconds(), GetSubBandFromChannel(), ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::Seconds().
Referenced by ns3::lorawan::EndDeviceLorawanMac::GetChannelForTx(), ns3::lorawan::EndDeviceLorawanMac::GetNextTransmissionDelay(), ns3::lorawan::GatewayLorawanMac::GetWaitingTime(), and ns3::lorawan::GatewayLorawanMac::Send().
void ns3::lorawan::LogicalLoraChannelHelper::RemoveChannel | ( | Ptr< LogicalLoraChannel > | channel | ) |
Remove a channel.
channel | A pointer to the channel we want to remove. |
Definition at line 171 of file logical-lora-channel-helper.cc.
References m_channelList.
void ns3::lorawan::LogicalLoraChannelHelper::SetChannel | ( | uint8_t | chIndex, |
Ptr< LogicalLoraChannel > | logicalChannel | ||
) |
Set a new channel at a fixed index.
chIndex | The index of the channel to substitute. |
logicalChannel | A pointer to the channel to add to the list. |
Definition at line 141 of file logical-lora-channel-helper.cc.
References m_channelList, and NS_LOG_FUNCTION.
Referenced by ns3::lorawan::EndDeviceLorawanMac::SetLogicalChannel().
|
private |
transmission will be possible according to the aggregated transmission timer
The next time at which transmission will be possible
Definition at line 207 of file logical-lora-channel-helper.h.
Referenced by AddEvent().
|
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 200 of file logical-lora-channel-helper.h.
Referenced by AddChannel(), DisableChannel(), GetChannelList(), GetEnabledChannelList(), RemoveChannel(), and SetChannel().
|
private |
The next time at which.
Definition at line 202 of file logical-lora-channel-helper.h.
Referenced by AddEvent(), and GetAggregatedWaitingTime().
A list of the SubBands that are currently registered within this helper.
Definition at line 193 of file logical-lora-channel-helper.h.
Referenced by AddSubBand(), GetSubBandFromFrequency(), and GetTxPowerForChannel().