LinkAdrRequest commands management. More...
#include "adr-component.h"
Public Member Functions | |
AdrComponent () | |
Default constructor. | |
~AdrComponent () override | |
Destructor. | |
void | BeforeSendingReply (Ptr< EndDeviceStatus > status, Ptr< NetworkStatus > networkStatus) override |
Function called as a downlink reply is about to leave the NetworkServer application. | |
void | OnFailedReply (Ptr< EndDeviceStatus > status, Ptr< NetworkStatus > networkStatus) override |
Method that is called when a packet cannot be sent in the downlink. | |
void | OnReceivedPacket (Ptr< const Packet > packet, Ptr< EndDeviceStatus > status, Ptr< NetworkStatus > networkStatus) override |
Function called as a new uplink packet is received by the NetworkServer application. | |
Public Member Functions inherited from ns3::lorawan::NetworkControllerComponent | |
NetworkControllerComponent () | |
Default constructor. | |
~NetworkControllerComponent () override | |
Destructor. | |
virtual void | BeforeSendingReply (Ptr< EndDeviceStatus > status, Ptr< NetworkStatus > networkStatus)=0 |
Function called as a downlink reply is about to leave the NetworkServer application. | |
virtual void | OnFailedReply (Ptr< EndDeviceStatus > status, Ptr< NetworkStatus > networkStatus)=0 |
Method that is called when a packet cannot be sent in the downlink. | |
virtual void | OnReceivedPacket (Ptr< const Packet > packet, Ptr< EndDeviceStatus > status, Ptr< NetworkStatus > networkStatus)=0 |
Function called as a new uplink packet is received by the NetworkServer application. | |
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::lorawan::NetworkControllerComponent | |
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 Types | |
enum | CombiningMethod { AVERAGE , MAXIMUM , MINIMUM } |
Available policies for combining radio metrics in packet history. More... | |
Private Member Functions | |
void | AdrImplementation (uint8_t *newDataRate, uint8_t *newTxPower, Ptr< EndDeviceStatus > status) |
Implementation of the default Adaptive Data Rate (ADR) procedure. | |
double | GetAverageSNR (EndDeviceStatus::ReceivedPacketList packetList, int historyRange) |
Get the average Signal to Noise Ratio (SNR) of the received packet history. | |
double | GetAverageTxFromGateways (EndDeviceStatus::GatewayList gwList) |
Get the average RSSI (dBm) of gateways receiving the same transmission. | |
double | GetMaxSNR (EndDeviceStatus::ReceivedPacketList packetList, int historyRange) |
Get the max Signal to Noise Ratio (SNR) of the receive packet history. | |
double | GetMaxTxFromGateways (EndDeviceStatus::GatewayList gwList) |
Get the max RSSI (dBm) among gateways receiving the same transmission. | |
double | GetMinSNR (EndDeviceStatus::ReceivedPacketList packetList, int historyRange) |
Get the min Signal to Noise Ratio (SNR) of the receive packet history. | |
double | GetMinTxFromGateways (EndDeviceStatus::GatewayList gwList) |
Get the min RSSI (dBm) among gateways receiving the same transmission. | |
double | GetReceivedPower (EndDeviceStatus::GatewayList gwList) |
Get RSSI metric for a transmission according to chosen gateway aggregation policy. | |
int | GetTxPowerIndex (int txPower) |
Get the LoRaWAN protocol TXPower configuration index from the Equivalent Isotropically Radiated Power (EIRP) in dBm. | |
double | RxPowerToSNR (double transmissionPower) const |
Convert reception power values [dBm] to Signal to Noise Ratio (SNR) values [dB]. | |
uint8_t | SfToDr (uint8_t sf) |
Convert spreading factor values [7:12] to respective data rate values [0:5]. | |
Private Attributes | |
const int | B = 125000 |
Bandwidth (Hz) | |
enum CombiningMethod | historyAveraging |
Received SNR history policy. | |
int | historyRange |
Number of previous packets to consider. | |
bool | m_toggleTxPower |
Whether to control transmission power of end devices or not. | |
const int | max_transmissionPower = 14 |
Maximum transmission power (dBm) (Europe) | |
const int | min_spreadingFactor = 7 |
Spreading factor lower limit. | |
const int | min_transmissionPower = 2 |
Minimum transmission power (dBm) (Europe) | |
const int | NF = 6 |
Noise Figure (dB) | |
double | threshold [6] |
Vector containing the required SNR for the 6 allowed spreading factor levels ranging from 7 to 12 (the SNR values are in dB). | |
enum CombiningMethod | tpAveraging |
TX power from gateways policy. | |
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. | |
LinkAdrRequest commands management.
Definition at line 40 of file adr-component.h.
|
private |
Available policies for combining radio metrics in packet history.
Enumerator | |
---|---|
AVERAGE | |
MAXIMUM | |
MINIMUM |
Definition at line 45 of file adr-component.h.
ns3::lorawan::AdrComponent::AdrComponent | ( | ) |
Default constructor.
Definition at line 76 of file adr-component.cc.
|
override |
Destructor.
Definition at line 80 of file adr-component.cc.
|
private |
Implementation of the default Adaptive Data Rate (ADR) procedure.
ADR is meant to optimize radio modulation parameters of end devices to improve energy consuption and radio resource utilization. For more details see https://doi.org/10.1109/NOMS.2018.8406255 .
newDataRate | [out] new data rate value selected for the end device. |
newTxPower | [out] new tx power value selected for the end device. |
status | State representation of the current end device. |
Definition at line 180 of file adr-component.cc.
References AVERAGE, GetAverageSNR(), GetMaxSNR(), GetMinSNR(), historyAveraging, historyRange, max_transmissionPower, MAXIMUM, min_spreadingFactor, min_transmissionPower, MINIMUM, NS_LOG_DEBUG, SfToDr(), and threshold.
Referenced by BeforeSendingReply().
|
overridevirtual |
Function called as a downlink reply is about to leave the NetworkServer application.
status | A pointer to the status of the end device which we are sending the reply to. |
networkStatus | A pointer to the NetworkStatus object. |
Implements ns3::lorawan::NetworkControllerComponent.
Definition at line 96 of file adr-component.cc.
References AdrImplementation(), ns3::lorawan::LoraFrameHeader::GetAdr(), GetTxPowerIndex(), historyRange, m_toggleTxPower, NS_LOG_DEBUG, NS_LOG_ERROR, NS_LOG_FUNCTION, ns3::lorawan::LoraFrameHeader::SetAsUplink(), SfToDr(), and ns3::lorawan::LorawanMacHeader::UNCONFIRMED_DATA_DOWN.
|
private |
Get the average Signal to Noise Ratio (SNR) of the received packet history.
packetList | History of received packets with reception information. |
historyRange | Number of packets to consider going back in time. |
Definition at line 419 of file adr-component.cc.
References GetReceivedPower(), historyRange, NS_LOG_DEBUG, and RxPowerToSNR().
Referenced by AdrImplementation().
|
private |
Get the average RSSI (dBm) of gateways receiving the same transmission.
gwList | List of gateways paired with packet reception information. |
Definition at line 330 of file adr-component.cc.
References NS_LOG_DEBUG.
Referenced by GetReceivedPower().
|
private |
Get the max Signal to Noise Ratio (SNR) of the receive packet history.
packetList | History of received packets with reception information. |
historyRange | Number of packets to consider going back in time. |
Definition at line 392 of file adr-component.cc.
References GetReceivedPower(), historyRange, NS_LOG_DEBUG, and RxPowerToSNR().
Referenced by AdrImplementation().
|
private |
Get the max RSSI (dBm) among gateways receiving the same transmission.
gwList | List of gateways paired with packet reception information. |
Definition at line 312 of file adr-component.cc.
Referenced by GetReceivedPower().
|
private |
Get the min Signal to Noise Ratio (SNR) of the receive packet history.
packetList | History of received packets with reception information. |
historyRange | Number of packets to consider going back in time. |
Definition at line 365 of file adr-component.cc.
References GetReceivedPower(), historyRange, NS_LOG_DEBUG, and RxPowerToSNR().
Referenced by AdrImplementation().
|
private |
Get the min RSSI (dBm) among gateways receiving the same transmission.
gwList | List of gateways paired with reception information. |
Definition at line 294 of file adr-component.cc.
Referenced by GetReceivedPower().
|
private |
Get RSSI metric for a transmission according to chosen gateway aggregation policy.
gwList | List of gateways paired with packet reception information. |
Definition at line 348 of file adr-component.cc.
References AVERAGE, GetAverageTxFromGateways(), GetMaxTxFromGateways(), GetMinTxFromGateways(), MAXIMUM, MINIMUM, and tpAveraging.
Referenced by GetAverageSNR(), GetMaxSNR(), and GetMinSNR().
|
private |
Get the LoRaWAN protocol TXPower configuration index from the Equivalent Isotropically Radiated Power (EIRP) in dBm.
txPower | Transission EIRP configuration. |
Definition at line 444 of file adr-component.cc.
Referenced by BeforeSendingReply().
|
static |
Register this type.
Definition at line 36 of file adr-component.cc.
References ns3::TypeId::AddConstructor(), AVERAGE, historyAveraging, historyRange, m_toggleTxPower, ns3::MakeBooleanAccessor(), ns3::MakeBooleanChecker(), ns3::MakeEnumChecker(), ns3::MakeIntegerAccessor(), MAXIMUM, MINIMUM, ns3::TypeId::SetGroupName(), and tpAveraging.
Referenced by OnFailedReply(), and OnReceivedPacket().
|
overridevirtual |
Method that is called when a packet cannot be sent in the downlink.
status | The EndDeviceStatus of the device to which it was impossible to send a reply. |
networkStatus | A pointer to the NetworkStatus object. |
Implements ns3::lorawan::NetworkControllerComponent.
Definition at line 174 of file adr-component.cc.
References GetTypeId(), and NS_LOG_FUNCTION.
|
overridevirtual |
Function called as a new uplink packet is received by the NetworkServer application.
packet | The newly received packet. |
status | A pointer to the status of the end device that sent the packet. |
networkStatus | A pointer to the NetworkStatus object. |
Implements ns3::lorawan::NetworkControllerComponent.
Definition at line 85 of file adr-component.cc.
References GetTypeId(), and NS_LOG_FUNCTION.
Convert reception power values [dBm] to Signal to Noise Ratio (SNR) values [dB].
The conversion comes from the formula where is the received transmission power, is the transmission bandwidth and is the noise figure of the receiver. The constant is the thermal noise [dBm] in 1 Hz of bandwidth and is influenced the temperature of the receiver, assumed constant in this model. For more details see the SX1301 chip datasheet.
transmissionPower | Value of received transmission power. |
Definition at line 286 of file adr-component.cc.
Referenced by GetAverageSNR(), GetMaxSNR(), and GetMinSNR().
|
private |
Convert spreading factor values [7:12] to respective data rate values [0:5].
sf | The spreading factor value. |
Definition at line 260 of file adr-component.cc.
Referenced by AdrImplementation(), and BeforeSendingReply().
|
private |
|
private |
Received SNR history policy.
Definition at line 171 of file adr-component.h.
Referenced by AdrImplementation(), and GetTypeId().
|
private |
Number of previous packets to consider.
Definition at line 170 of file adr-component.h.
Referenced by AdrImplementation(), BeforeSendingReply(), GetAverageSNR(), GetMaxSNR(), GetMinSNR(), and GetTypeId().
|
private |
Whether to control transmission power of end devices or not.
Definition at line 188 of file adr-component.h.
Referenced by BeforeSendingReply(), and GetTypeId().
|
private |
Maximum transmission power (dBm) (Europe)
Definition at line 175 of file adr-component.h.
Referenced by AdrImplementation().
|
private |
Spreading factor lower limit.
Definition at line 173 of file adr-component.h.
Referenced by AdrImplementation().
|
private |
Minimum transmission power (dBm) (Europe)
Definition at line 174 of file adr-component.h.
Referenced by AdrImplementation().
|
private |
|
private |
Vector containing the required SNR for the 6 allowed spreading factor levels ranging from 7 to 12 (the SNR values are in dB).
Definition at line 179 of file adr-component.h.
Referenced by AdrImplementation().
|
private |
TX power from gateways policy.
Definition at line 169 of file adr-component.h.
Referenced by GetReceivedPower(), and GetTypeId().