ns3::LorawanMacEndDevice Class Referenceabstract

Class representing the MAC layer of a LoRaWAN device. More...

#include "lorawan-mac-end-device.h"

+ Inheritance diagram for ns3::LorawanMacEndDevice:
+ Collaboration diagram for ns3::LorawanMacEndDevice:

Classes

struct  LoraRetxParameters
 Structure representing the parameters that will be used in the retransmission procedure. More...
 

Public Types

typedef Callback< void, Mac48Address > GatewayUpdateCallback
 Callback to update gateway address after handover. More...
 
- Public Types inherited from ns3::LorawanMac
typedef std::array< std::array< uint8_t, 6 >, 8 > ReplyDataRateMatrix
 
- Public Types inherited from ns3::SatMac
typedef Callback< void, Ptr< const Packet > > LoraReceiveCallback
 Callback to receive packet by upper layer. More...
 
typedef Callback< Ptr< SatControlMessage >, uint32_t > ReadCtrlMsgCallback
 Callback to read control messages from container storing control messages. More...
 
typedef Callback< void, Ptr< Packet >, Mac48Address, Mac48Address > ReceiveCallback
 Callback to receive packet by upper layer. More...
 
typedef Callback< uint32_t, Ptr< SatControlMessage > > ReserveCtrlMsgCallback
 Callback to reserve an id and initially store the control message. More...
 
typedef Callback< void, Address, Address > RoutingUpdateCallback
 Callback to update routing and ARP tables after handover. More...
 
typedef Callback< uint32_t, uint32_t > SendCtrlMsgCallback
 Callback to send a control message and allocate a recv ID for it. More...
 
typedef Callback< void, SatPhy::PacketContainer_t, uint32_t, Time, SatSignalParameters::txInfo_sTransmitCallback
 Callback to send packet to lower layer. More...
 

Public Member Functions

 LorawanMacEndDevice ()
 
 LorawanMacEndDevice (uint32_t satId, uint32_t beamId)
 
virtual ~LorawanMacEndDevice ()
 
void AddLogicalChannel (double frequency)
 Add a logical channel to the helper. More...
 
void AddLogicalChannel (Ptr< LoraLogicalChannel > logicalChannel)
 Add a logical channel to the helper. More...
 
void AddLoraSubBand (double startFrequency, double endFrequency, double dutyCycle, double maxTxPowerDbm)
 Add a subband to the logical channel helper. More...
 
void AddLorawanMacCommand (Ptr< LorawanMacCommand > macCommand)
 Add a MAC command to the list of those that will be sent out in the next packet. More...
 
void ApplyNecessaryOptions (LoraFrameHeader &frameHeader)
 Add the necessary options and MAC commands to the LoraFrameHeader. More...
 
void ApplyNecessaryOptions (LorawanMacHeader &macHeader)
 Add the necessary options and MAC commands to the LorawanMacHeader. More...
 
virtual void DoSend (Ptr< Packet > packet)
 Checking if we are performing the transmission of a new packet or a retransmission, and call SendToPhy function. More...
 
virtual void FailedReception (Ptr< const Packet > packet)
 Function called by lower layers to inform this layer that reception of a packet we were locked on failed. More...
 
double GetAggregatedDutyCycle (void)
 Set a value for the RX1DROffset parameter. More...
 
uint8_t GetDataRate (void)
 Get the data rate this end device is set to use. More...
 
bool GetDataRateAdaptation (void)
 Get if data rate adaptation is enabled or not. More...
 
LoraDeviceAddress GetDeviceAddress (void)
 Get the network address of this device. More...
 
uint8_t GetMaxNumberOfTransmissions (void)
 Set the maximum number of transmissions allowed. More...
 
LorawanMacHeader::MType GetMType (void)
 Get the message type to send when the Send method is called. More...
 
Ptr< SatLoraPhyRxGetPhyRx ()
 
virtual uint8_t GetTransmissionPower (void)
 Get the transmission power this end device is set to use. More...
 
void OnDevStatusReq (void)
 Perform the actions that need to be taken when receiving a DevStatusReq command. More...
 
void OnDutyCycleReq (double dutyCycle)
 Perform the actions that need to be taken when receiving a DutyCycleReq command. More...
 
void OnLinkAdrReq (uint8_t dataRate, uint8_t txPower, std::list< int > enabledChannels, int repetitions)
 Perform the actions that need to be taken when receiving a LinkAdrReq command. More...
 
void OnLinkCheckAns (uint8_t margin, uint8_t gwCnt)
 Perform the actions that need to be taken when receiving a LinkCheckAns command. More...
 
void OnNewChannelReq (uint8_t chIndex, double frequency, uint8_t minDataRate, uint8_t maxDataRate)
 Perform the actions that need to be taken when receiving a NewChannelReq command. More...
 
virtual void OnRxClassParamSetupReq (Ptr< RxParamSetupReq > rxParamSetupReq)
 Perform the actions that need to be taken when receiving a RxParamSetupReq command based on the Device's Class Type. More...
 
void OnRxParamSetupReq (Ptr< RxParamSetupReq > rxParamSetupReq)
 Perform the actions that need to be taken when receiving a RxParamSetupReq command. More...
 
void ParseCommands (LoraFrameHeader frameHeader)
 Parse and take action on the commands contained on this FrameHeader. More...
 
virtual void postponeTransmission (Time nextTxDelay, Ptr< Packet >)
 Postpone transmission to the specified time and delete previously scheduled transmissions if present. More...
 
virtual void Receive (Ptr< Packet > packet)=0
 Receive a packet. More...
 
virtual void Receive (SatPhy::PacketContainer_t packets, Ptr< SatSignalParameters >)
 Receive a packet from the lower layer. More...
 
virtual void resetRetransmissionParameters ()
 Reset retransmission parameters contained in the structure LoraRetxParams. More...
 
virtual void Send (Ptr< Packet > packet)
 Send a packet. More...
 
virtual void SendToPhy (Ptr< Packet > packet)
 Add headers and send a packet with the sending function of the physical layer. More...
 
void SetDataRate (uint8_t dataRate)
 Set the data rate this end device will use when transmitting. More...
 
void SetDataRateAdaptation (bool adapt)
 Enable data rate adaptation in the retransmitting procedure. More...
 
void SetDeviceAddress (LoraDeviceAddress address)
 Set the network address of this device. More...
 
void SetGatewayUpdateCallback (LorawanMacEndDevice::GatewayUpdateCallback cb)
 Method to set the gateway address update callback. More...
 
void SetGwAddress (Mac48Address gwAddress)
 Set address of the GW (or its MAC) serving this UT. More...
 
void SetLogicalChannel (uint8_t chIndex, double frequency, uint8_t minDataRate, uint8_t maxDataRate)
 Set a new logical channel in the helper. More...
 
void SetMaxNumberOfTransmissions (uint8_t maxNumbTx)
 Set the maximum number of transmissions allowed. More...
 
void SetMType (LorawanMacHeader::MType mType)
 Set the message type to send when the Send method is called. More...
 
void SetPhyRx (Ptr< SatLoraPhyRx > phyRx)
 
void SetRaChannel (uint32_t raChannel)
 Set RA channel assigned for this UT. More...
 
virtual void TxFinished ()
 Perform the actions that are required after a packet send. More...
 
- Public Member Functions inherited from ns3::LorawanMac
 LorawanMac ()
 
 LorawanMac (uint32_t satId, uint32_t beamId)
 
virtual ~LorawanMac ()
 
double GetBandwidthFromDataRate (uint8_t dataRate)
 Get the BW corresponding to a data rate, based on this MAC's region. More...
 
double GetDbmForTxPower (uint8_t txPower)
 Get the transmission power in dBm that corresponds, in this region, to the encoded 8-bit txPower. More...
 
Ptr< NetDevice > GetDevice (void)
 Get the device this MAC layer is installed on. More...
 
LoraLogicalChannelHelper GetLoraLogicalChannelHelper (void)
 Get the logical lora channel helper associated with this MAC. More...
 
int GetNPreambleSymbols (void)
 Get the number of PHY preamble symbols this MAC is set to use. More...
 
Time GetOnAirTime (Ptr< Packet > packet, LoraTxParameters txParams)
 Compute the time that a packet with certain characteristics will take to be transmitted. More...
 
Ptr< SatPhyGetPhy (void)
 Get the underlying PHY layer. More...
 
Ptr< SatLoraPhyTxGetPhyTx (void)
 Get the underlying PHY TX layer. More...
 
uint8_t GetSfFromDataRate (uint8_t dataRate)
 Get the SF corresponding to a data rate, based on this MAC's region. More...
 
virtual void Send (Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
 Send a packet. More...
 
void SetBandwidthForDataRate (std::vector< double > bandwidthForDataRate)
 Set the vector to use to check up correspondence between bandwidth and DataRate. More...
 
void SetDevice (Ptr< NetDevice > device)
 Set the device this MAC layer is installed on. More...
 
void SetLoraLogicalChannelHelper (LoraLogicalChannelHelper helper)
 Set the LoraLogicalChannelHelper this MAC instance will use. More...
 
void SetMaxAppPayloadForDataRate (std::vector< uint32_t > maxAppPayloadForDataRate)
 Set the maximum App layer payload for a set DataRate. More...
 
void SetNPreambleSymbols (int nPreambleSymbols)
 Set the number of PHY preamble symbols this MAC is set to use. More...
 
void SetPhy (Ptr< SatPhy > phy)
 Set the underlying PHY layer. More...
 
void SetPhyTx (Ptr< SatLoraPhyTx > phyTx)
 Set the underlying PHY TX layer. More...
 
void setRegenerative (bool isRegenerative)
 Indicates if the satellite is regenerative on the link this layer is sending packets. More...
 
void SetReplyDataRateMatrix (ReplyDataRateMatrix replyDataRateMatrix)
 Set the matrix to use when deciding with which DataRate to respond. More...
 
void SetSfForDataRate (std::vector< uint8_t > sfForDataRate)
 Set the vector to use to check up correspondence between SF and DataRate. More...
 
void SetTxDbmForTxPower (std::vector< double > txDbmForTxPower)
 Set the vector to use to check up which transmission power in Dbm corresponds to a certain TxPower value in this MAC's region. More...
 
- Public Member Functions inherited from ns3::SatMac
 SatMac ()
 Construct a SatMac. More...
 
 SatMac (uint32_t satId, uint32_t beamId, SatEnums::RegenerationMode_t forwardLinkRegenerationMode, SatEnums::RegenerationMode_t returnLinkRegenerationMode)
 Construct a SatMac. More...
 
 ~SatMac ()
 Destroy a SatMac. More...
 
virtual void Disable ()
 Disable the MAC layer, i.e. More...
 
virtual void Enable ()
 Enable the MAC layer, i.e. More...
 
Address GetAddress () const
 Get MAC address. More...
 
uint32_t GetBeamId () const
 Get beam ID of the object. More...
 
uint32_t GetSatId () const
 Get sat ID of the object. More...
 
virtual void ReceiveQueueEvent (SatQueue::QueueEvent_t event, uint8_t flowIndex)
 Receive a queue event: More...
 
uint32_t ReserveIdAndStoreCtrlMsgToContainer (Ptr< SatControlMessage > msg)
 Reserve id and store the control message. More...
 
uint32_t SendCtrlMsgFromContainer (uint32_t sendId)
 Send the control message from the container. More...
 
void SetLoraReceiveCallback (SatMac::LoraReceiveCallback cb)
 Method to set receive callback. More...
 
virtual void SetNodeInfo (Ptr< SatNodeInfo > nodeInfo)
 Set the node info. More...
 
void SetReadCtrlCallback (SatMac::ReadCtrlMsgCallback cb)
 Method to set read control message callback. More...
 
void SetReceiveCallback (SatMac::ReceiveCallback cb)
 Method to set receive callback. More...
 
void SetReserveCtrlCallback (SatMac::ReserveCtrlMsgCallback cb)
 Method to set reserve control message id callback. More...
 
void SetRoutingUpdateCallback (SatMac::RoutingUpdateCallback cb)
 Method to set the routing update callback. More...
 
virtual void SetSatelliteAddress (Address satelliteAddress)
 Set the satellite MAC address on the other side of this link (if regenerative satellite). More...
 
void SetSendCtrlCallback (SatMac::SendCtrlMsgCallback cb)
 Method to set send control message callback. More...
 
void SetTransmitCallback (SatMac::TransmitCallback cb)
 Method to set transmit callback. More...
 

Static Public Member Functions

static TypeId GetTypeId (void)
 
- Static Public Member Functions inherited from ns3::LorawanMac
static TypeId GetTypeId (void)
 
- Static Public Member Functions inherited from ns3::SatMac
static TypeId GetTypeId (void)
 Derived from Object. More...
 

Protected Member Functions

Ptr< LoraLogicalChannelGetChannelForTx (void)
 Find a suitable channel for transmission. More...
 
virtual Time GetNextClassTransmissionDelay (Time waitingTime)
 Find the minimum waiting time before the next possible transmission based on End Device's Class Type. More...
 
- Protected Member Functions inherited from ns3::SatMac
void DoDispose (void)
 Dispose of SatMac. More...
 
void RxTraces (SatPhy::PacketContainer_t packets)
 Invoke the Rx trace source for each received packet. More...
 
virtual void SendPacket (SatPhy::PacketContainer_t packets, uint32_t carrierId, Time duration, SatSignalParameters::txInfo_s txInfo)
 Send packets to lower layer by using a callback. More...
 
void SetTimeTag (SatPhy::PacketContainer_t packets)
 Set SatMacTimeTag of packets. More...
 

Protected Attributes

LoraDeviceAddress m_address
 The address of this device. More...
 
uint8_t m_codingRate
 The coding rate used by this device. More...
 
TracedValue< uint8_t > m_dataRate
 The DataRate this device is using to transmit. More...
 
bool m_enableDRAdapt
 Enable Data Rate adaptation during the retransmission procedure. More...
 
LorawanMacEndDevice::GatewayUpdateCallback m_gatewayUpdateCallback
 Gateway address update callback. More...
 
Mac48Address m_gwAddress
 
bool m_headerDisabled
 Whether or not the header is disabled for communications by this device. More...
 
std::list< Ptr< LorawanMacCommand > > m_macCommandList
 List of the MAC commands that need to be applied to the next UL packet. More...
 
uint8_t m_maxNumbTx
 Maximum number of transmission allowed. More...
 
Ptr< SatLoraPhyRxm_phyRx
 Reception phy layer for Lora operations. More...
 
uint32_t m_raChannel
 RA channel assigned to the UT. More...
 
uint8_t m_receiveWindowDurationInSymbols
 The duration of a receive window in number of symbols. More...
 
TracedCallback< uint8_t, bool, Time, Ptr< Packet > > m_requiredTxCallback
 The trace source fired when the transmission procedure is finished. More...
 
struct LoraRetxParameters m_retxParams
 
TracedValue< double > m_txPower
 The transmission power this device is using to transmit. More...
 
Ptr< UniformRandomVariable > m_uniformRV
 An uniform random variable, used by the Shuffle method to randomly reorder the channel list. More...
 
- Protected Attributes inherited from ns3::LorawanMac
std::vector< double > m_bandwidthForDataRate
 A vector holding the bandwidth each Data Rate corresponds to. More...
 
uint32_t m_beamId
 ID of beam for UT. More...
 
TracedCallback< Ptr< const Packet > > m_cannotSendBecauseDutyCycle
 The trace source that is fired when a packet cannot be sent because of duty cycle limitations. More...
 
LoraLogicalChannelHelper m_channelHelper
 The LoraLogicalChannelHelper instance that is assigned to this MAC. More...
 
Ptr< NetDevice > m_device
 The device this MAC layer is installed on. More...
 
bool m_isRegenerative
 Indicates if satellite is regenerative on the link where this layer is sending packets. More...
 
std::vector< uint32_t > m_maxAppPayloadForDataRate
 A vector holding the maximum app payload size that corresponds to a certain DataRate. More...
 
int m_nPreambleSymbols
 The number of symbols to use in the PHY preamble. More...
 
Ptr< SatPhym_phy
 The PHY instance that sits under this MAC layer. More...
 
TracedCallback< Ptr< const Packet > > m_receivedPacket
 Trace source that is fired when a packet reaches the MAC layer. More...
 
ReplyDataRateMatrix m_replyDataRateMatrix
 The matrix that decides the DR the GW will use in a reply based on the ED's sending DR and on the value of the RX1DROffset parameter. More...
 
TracedCallback< Ptr< const Packet > > m_sentNewPacket
 Trace source that is fired when a new APP layer packet arrives at the MAC layer. More...
 
std::vector< uint8_t > m_sfForDataRate
 A vector holding the SF each Data Rate corresponds to. More...
 
std::vector< double > m_txDbmForTxPower
 A vector holding the power that corresponds to a certain TxPower value. More...
 
- Protected Attributes inherited from ns3::SatMac
Time m_beamEnabledTime
 Time of the last beam enable event. More...
 
uint32_t m_beamId
 The ID of the beam where mac belongs. More...
 
TracedCallback< Time > m_beamServiceTrace
 Traced callback for beam being disabled and including service time. More...
 
SatEnums::RegenerationMode_t m_forwardLinkRegenerationMode
 Regeneration mode on forward link. More...
 
bool m_isRegenerative
 Indicate if satellite is regeneration (at least LINK level) for TX. More...
 
bool m_isStatisticsTagsEnabled
 EnableStatisticsTags attribute. More...
 
Time m_lastDelay
 Last delay measurement. More...
 
Time m_lastLinkDelay
 Last delay measurement for link. More...
 
std::queue< Time > m_lastSOF
 Store last 3 SOF date for Forward messages, to insert in NCR packets. More...
 
std::queue< Ptr< SatNcrMessage > > m_ncrMessagesToSend
 List of NCR control messages created but not sent yet. More...
 
bool m_ncrV2
 Use of version 2 of NCR dates. More...
 
Ptr< SatNodeInfom_nodeInfo
 Node info containing node related information, such as node type, node id and MAC address (of the SatNetDevice) More...
 
TracedCallback< Time, SatEnums::SatPacketEvent_t, SatEnums::SatNodeType_t, uint32_t, Mac48Address, SatEnums::SatLogLevel_t, SatEnums::SatLinkDir_t, std::string > m_packetTrace
 Trace callback used for packet tracing. More...
 
SatMac::ReadCtrlMsgCallback m_readCtrlCallback
 The read control message callback. More...
 
SatMac::ReserveCtrlMsgCallback m_reserveCtrlCallback
 The reserve control message id callback. More...
 
SatEnums::RegenerationMode_t m_returnLinkRegenerationMode
 Regeneration mode on return link. More...
 
SatMac::RoutingUpdateCallback m_routingUpdateCallback
 Callback to update routing and ARP tables after a beam handover. More...
 
SatMac::ReceiveCallback m_rxCallback
 The upper layer package receive callback. More...
 
TracedCallback< const Time &, const Address & > m_rxDelayTrace
 Traced callback for all received packets, including delay information and the address of the senders. More...
 
TracedCallback< const Time &, const Address & > m_rxJitterTrace
 Traced callback for all received packets, including jitter information and the address of the senders. More...
 
TracedCallback< const Time &, const Address & > m_rxLinkDelayTrace
 Traced callback for all received packets, including link delay information and the address of the senders. More...
 
TracedCallback< const Time &, const Address & > m_rxLinkJitterTrace
 Traced callback for all received packets, including link jitter information and the address of the senders. More...
 
SatMac::LoraReceiveCallback m_rxLoraCallback
 The upper layer package receive callback. More...
 
TracedCallback< Ptr< const Packet >, const Address & > m_rxTrace
 Traced callback for all received packets, including the address of the senders. More...
 
Address m_satelliteAddress
 MAC address of satellite on other side of the link. More...
 
uint32_t m_satId
 The ID of the sat where mac belongs. More...
 
SatMac::SendCtrlMsgCallback m_sendCtrlCallback
 The send control message callback. More...
 
SatMac::TransmitCallback m_txCallback
 The lower layer packet transmit callback. More...
 
bool m_txEnabled
 Flag indicating whether the MAC is enabled, i.e. More...
 

Private Member Functions

Time GetNextTransmissionDelay (void)
 Find the minimum waiting time before the next possible transmission. More...
 
std::vector< Ptr< LoraLogicalChannel > > Shuffle (std::vector< Ptr< LoraLogicalChannel >> vector)
 Randomly shuffle a Ptr<LoraLogicalChannel> vector. More...
 

Private Attributes

TracedValue< double > m_aggregatedDutyCycle
 The aggregated duty cycle this device needs to respect across all sub-bands. More...
 
bool m_controlDataRate
 Whether this device's data rate should be controlled by the NS. More...
 
uint16_t m_currentFCnt
 
TracedValue< int > m_lastKnownGatewayCount
 The last known gateway count (i.e., gateways that are in communication range with this end device) More...
 
TracedValue< double > m_lastKnownLinkMargin
 The last known link margin. More...
 
LorawanMacHeader::MType m_mType
 The message type to apply to packets sent with the Send method. More...
 
EventId m_nextRetx
 The event of transmitting a packet in a consecutive moment, when the duty cycle let us transmit. More...
 
EventId m_nextTx
 The event of retransmitting a packet in a consecutive moment if an ACK is not received. More...
 

Detailed Description

Class representing the MAC layer of a LoRaWAN device.

Definition at line 45 of file lorawan-mac-end-device.h.

Member Typedef Documentation

◆ GatewayUpdateCallback

typedef Callback<void, Mac48Address> ns3::LorawanMacEndDevice::GatewayUpdateCallback

Callback to update gateway address after handover.

Parameters
Mac48Addressthe address of the new gateway

Definition at line 354 of file lorawan-mac-end-device.h.

Constructor & Destructor Documentation

◆ LorawanMacEndDevice() [1/2]

ns3::LorawanMacEndDevice::LorawanMacEndDevice ( )

Definition at line 111 of file lorawan-mac-end-device.cc.

◆ LorawanMacEndDevice() [2/2]

ns3::LorawanMacEndDevice::LorawanMacEndDevice ( uint32_t  satId,
uint32_t  beamId 
)

◆ ~LorawanMacEndDevice()

ns3::LorawanMacEndDevice::~LorawanMacEndDevice ( )
virtual

Definition at line 154 of file lorawan-mac-end-device.cc.

Member Function Documentation

◆ AddLogicalChannel() [1/2]

void ns3::LorawanMacEndDevice::AddLogicalChannel ( double  frequency)

Add a logical channel to the helper.

Parameters
frequencyThe channel's center frequency.

Definition at line 890 of file lorawan-mac-end-device.cc.

References ns3::LoraLogicalChannelHelper::AddChannel(), and ns3::LorawanMac::m_channelHelper.

+ Here is the call graph for this function:

◆ AddLogicalChannel() [2/2]

void ns3::LorawanMacEndDevice::AddLogicalChannel ( Ptr< LoraLogicalChannel logicalChannel)

Add a logical channel to the helper.

Parameters
frequencyThe channel's center frequency.

Definition at line 898 of file lorawan-mac-end-device.cc.

References ns3::LoraLogicalChannelHelper::AddChannel(), and ns3::LorawanMac::m_channelHelper.

+ Here is the call graph for this function:

◆ AddLoraSubBand()

void ns3::LorawanMacEndDevice::AddLoraSubBand ( double  startFrequency,
double  endFrequency,
double  dutyCycle,
double  maxTxPowerDbm 
)

Add a subband to the logical channel helper.

Parameters
startFrequencyThe LoraSubBand's lowest frequency.
endFrequencyThe LoraSubBand's highest frequency.
dutyCycleThe LoraSubBand's duty cycle, in fraction form.
maxTxPowerDbmThe maximum transmission power allowed on the LoraSubBand.

Definition at line 920 of file lorawan-mac-end-device.cc.

References ns3::LoraLogicalChannelHelper::AddLoraSubBand(), and ns3::LorawanMac::m_channelHelper.

+ Here is the call graph for this function:

◆ AddLorawanMacCommand()

void ns3::LorawanMacEndDevice::AddLorawanMacCommand ( Ptr< LorawanMacCommand macCommand)

Add a MAC command to the list of those that will be sent out in the next packet.

Definition at line 939 of file lorawan-mac-end-device.cc.

References m_macCommandList.

◆ ApplyNecessaryOptions() [1/2]

void ns3::LorawanMacEndDevice::ApplyNecessaryOptions ( LoraFrameHeader frameHeader)

Add the necessary options and MAC commands to the LoraFrameHeader.

Parameters
frameHeaderThe frame header on which to apply the options.

Definition at line 478 of file lorawan-mac-end-device.cc.

References ns3::LoraFrameHeader::AddCommand(), ns3::LorawanMacCommand::GetCIDFromLorawanMacCommand(), m_address, m_controlDataRate, m_currentFCnt, m_macCommandList, ns3::LoraFrameHeader::SetAddress(), ns3::LoraFrameHeader::SetAdr(), ns3::LoraFrameHeader::SetAdrAckReq(), ns3::LoraFrameHeader::SetAsUplink(), ns3::LoraFrameHeader::SetFCnt(), and ns3::LoraFrameHeader::SetFPort().

Referenced by DoSend().

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

◆ ApplyNecessaryOptions() [2/2]

void ns3::LorawanMacEndDevice::ApplyNecessaryOptions ( LorawanMacHeader macHeader)

Add the necessary options and MAC commands to the LorawanMacHeader.

Parameters
macHeaderThe mac header on which to apply the options.

Definition at line 502 of file lorawan-mac-end-device.cc.

References m_mType, ns3::LorawanMacHeader::SetMajor(), and ns3::LorawanMacHeader::SetMType().

+ Here is the call graph for this function:

◆ DoSend()

void ns3::LorawanMacEndDevice::DoSend ( Ptr< Packet >  packet)
virtual

◆ FailedReception()

void ns3::LorawanMacEndDevice::FailedReception ( Ptr< const Packet >  packet)
virtual

Function called by lower layers to inform this layer that reception of a packet we were locked on failed.

Parameters
packetthe packet we failed to receive

Implements ns3::LorawanMac.

Reimplemented in ns3::LorawanMacEndDeviceClassA.

Definition at line 348 of file lorawan-mac-end-device.cc.

◆ GetAggregatedDutyCycle()

double ns3::LorawanMacEndDevice::GetAggregatedDutyCycle ( void  )

Set a value for the RX1DROffset parameter.

This value decides the offset to use when deciding the DataRate of the downlink transmission during the first receive window from the replyDataRateMatrix.

Parameters
rx1DrOffsetThe value to set for the offset. Get the value of the RX1DROffset parameter.
Returns
The value of the RX1DROffset parameter. Get the aggregated duty cycle.
A time instance containing the aggregated duty cycle in fractional form.

Definition at line 931 of file lorawan-mac-end-device.cc.

References m_aggregatedDutyCycle.

◆ GetChannelForTx()

Ptr< LoraLogicalChannel > ns3::LorawanMacEndDevice::GetChannelForTx ( void  )
protected

Find a suitable channel for transmission.

The channel is chosen among the ones that are available in the ED's LoraLogicalChannel, based on their duty cycle limitations.

Definition at line 570 of file lorawan-mac-end-device.cc.

References ns3::LoraLogicalChannelHelper::GetEnabledChannelList(), ns3::LoraLogicalChannelHelper::GetWaitingTime(), ns3::LorawanMac::m_channelHelper, and Shuffle().

Referenced by Send(), and ns3::LorawanMacEndDeviceClassA::SendToPhy().

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

◆ GetDataRate()

uint8_t ns3::LorawanMacEndDevice::GetDataRate ( void  )

Get the data rate this end device is set to use.

Returns
The data rate this device uses when transmitting.

Definition at line 680 of file lorawan-mac-end-device.cc.

References m_dataRate.

◆ GetDataRateAdaptation()

bool ns3::LorawanMacEndDevice::GetDataRateAdaptation ( void  )

Get if data rate adaptation is enabled or not.

Definition at line 651 of file lorawan-mac-end-device.cc.

References m_enableDRAdapt.

◆ GetDeviceAddress()

LoraDeviceAddress ns3::LorawanMacEndDevice::GetDeviceAddress ( void  )

Get the network address of this device.

Returns
This device's address.

Definition at line 696 of file lorawan-mac-end-device.cc.

References m_address.

◆ GetMaxNumberOfTransmissions()

uint8_t ns3::LorawanMacEndDevice::GetMaxNumberOfTransmissions ( void  )

Set the maximum number of transmissions allowed.

Definition at line 665 of file lorawan-mac-end-device.cc.

References m_maxNumbTx.

◆ GetMType()

LorawanMacHeader::MType ns3::LorawanMacEndDevice::GetMType ( void  )

Get the message type to send when the Send method is called.

Definition at line 518 of file lorawan-mac-end-device.cc.

References m_mType.

◆ GetNextClassTransmissionDelay()

Time ns3::LorawanMacEndDevice::GetNextClassTransmissionDelay ( Time  waitingTime)
protectedvirtual

Find the minimum waiting time before the next possible transmission based on End Device's Class Type.

Reimplemented in ns3::LorawanMacEndDeviceClassA.

Definition at line 529 of file lorawan-mac-end-device.cc.

Referenced by GetNextTransmissionDelay().

+ Here is the caller graph for this function:

◆ GetNextTransmissionDelay()

Time ns3::LorawanMacEndDevice::GetNextTransmissionDelay ( void  )
private

Find the minimum waiting time before the next possible transmission.

Definition at line 536 of file lorawan-mac-end-device.cc.

References ns3::LoraLogicalChannelHelper::GetEnabledChannelList(), GetNextClassTransmissionDelay(), ns3::LoraLogicalChannelHelper::GetWaitingTime(), and ns3::LorawanMac::m_channelHelper.

Referenced by Send().

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

◆ GetPhyRx()

Ptr< SatLoraPhyRx > ns3::LorawanMacEndDevice::GetPhyRx ( )

Definition at line 981 of file lorawan-mac-end-device.cc.

References m_phyRx.

◆ GetTransmissionPower()

uint8_t ns3::LorawanMacEndDevice::GetTransmissionPower ( void  )
virtual

Get the transmission power this end device is set to use.

Returns
The transmission power this device uses when transmitting.

Definition at line 947 of file lorawan-mac-end-device.cc.

References m_txPower.

◆ GetTypeId()

◆ OnDevStatusReq()

void ns3::LorawanMacEndDevice::OnDevStatusReq ( void  )

Perform the actions that need to be taken when receiving a DevStatusReq command.

Definition at line 857 of file lorawan-mac-end-device.cc.

References m_macCommandList.

Referenced by ParseCommands().

+ Here is the caller graph for this function:

◆ OnDutyCycleReq()

void ns3::LorawanMacEndDevice::OnDutyCycleReq ( double  dutyCycle)

Perform the actions that need to be taken when receiving a DutyCycleReq command.

Parameters
dutyCycleThe aggregate duty cycle prescribed by the command, in fraction form.

Definition at line 827 of file lorawan-mac-end-device.cc.

References m_aggregatedDutyCycle, and m_macCommandList.

Referenced by ParseCommands().

+ Here is the caller graph for this function:

◆ OnLinkAdrReq()

void ns3::LorawanMacEndDevice::OnLinkAdrReq ( uint8_t  dataRate,
uint8_t  txPower,
std::list< int >  enabledChannels,
int  repetitions 
)

Perform the actions that need to be taken when receiving a LinkAdrReq command.

Parameters
dataRateThe data rate value of the command.
txPowerThe transmission power value of the command.
enabledChannelsA list of the enabled channels.
repetitionsThe number of repetitions prescribed by the command.

Definition at line 713 of file lorawan-mac-end-device.cc.

References ns3::LorawanMac::GetBandwidthFromDataRate(), ns3::LoraLogicalChannelHelper::GetChannelList(), ns3::LorawanMac::GetDbmForTxPower(), ns3::LorawanMac::GetSfFromDataRate(), ns3::LorawanMac::m_channelHelper, m_dataRate, m_macCommandList, and m_txPower.

Referenced by ParseCommands().

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

◆ OnLinkCheckAns()

void ns3::LorawanMacEndDevice::OnLinkCheckAns ( uint8_t  margin,
uint8_t  gwCnt 
)

Perform the actions that need to be taken when receiving a LinkCheckAns command.

Parameters
marginThe margin value of the command.
gwCntThe gateway count value of the command.

Definition at line 704 of file lorawan-mac-end-device.cc.

References m_lastKnownGatewayCount, and m_lastKnownLinkMargin.

Referenced by ParseCommands().

+ Here is the caller graph for this function:

◆ OnNewChannelReq()

void ns3::LorawanMacEndDevice::OnNewChannelReq ( uint8_t  chIndex,
double  frequency,
uint8_t  minDataRate,
uint8_t  maxDataRate 
)

Perform the actions that need to be taken when receiving a NewChannelReq command.

Definition at line 870 of file lorawan-mac-end-device.cc.

References m_macCommandList, and SetLogicalChannel().

Referenced by ParseCommands().

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

◆ OnRxClassParamSetupReq()

void ns3::LorawanMacEndDevice::OnRxClassParamSetupReq ( Ptr< RxParamSetupReq rxParamSetupReq)
virtual

Perform the actions that need to be taken when receiving a RxParamSetupReq command based on the Device's Class Type.

Parameters
rxParamSetupReqThe Parameter Setup Request

Reimplemented in ns3::LorawanMacEndDeviceClassA.

Definition at line 843 of file lorawan-mac-end-device.cc.

Referenced by OnRxParamSetupReq().

+ Here is the caller graph for this function:

◆ OnRxParamSetupReq()

void ns3::LorawanMacEndDevice::OnRxParamSetupReq ( Ptr< RxParamSetupReq rxParamSetupReq)

Perform the actions that need to be taken when receiving a RxParamSetupReq command.

Parameters
rxParamSetupReqThe Parameter Setup Request

Definition at line 848 of file lorawan-mac-end-device.cc.

References OnRxClassParamSetupReq().

Referenced by ParseCommands().

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

◆ ParseCommands()

◆ postponeTransmission()

void ns3::LorawanMacEndDevice::postponeTransmission ( Time  nextTxDelay,
Ptr< Packet >  packet 
)
virtual

Postpone transmission to the specified time and delete previously scheduled transmissions if present.

Parameters
nextTxDelayDelay at which the transmission will be performed.

Definition at line 204 of file lorawan-mac-end-device.cc.

References DoSend(), and m_nextTx.

Referenced by Send().

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

◆ Receive() [1/2]

virtual void ns3::LorawanMacEndDevice::Receive ( Ptr< Packet >  packet)
pure virtual

Receive a packet.

This method is typically registered as a callback in the underlying PHY layer so that it's called when a packet is going up the stack.

Parameters
packetthe received packet.

Implemented in ns3::LorawanMacEndDeviceClassA.

Referenced by Receive().

+ Here is the caller graph for this function:

◆ Receive() [2/2]

void ns3::LorawanMacEndDevice::Receive ( SatPhy::PacketContainer_t  packets,
Ptr< SatSignalParameters  
)
virtual

Receive a packet from the lower layer.

Parameters
packetsthe received packets

Implements ns3::LorawanMac.

Definition at line 337 of file lorawan-mac-end-device.cc.

References Receive().

+ Here is the call graph for this function:

◆ resetRetransmissionParameters()

◆ Send()

void ns3::LorawanMacEndDevice::Send ( Ptr< Packet >  packet)
virtual

◆ SendToPhy()

void ns3::LorawanMacEndDevice::SendToPhy ( Ptr< Packet >  packet)
virtual

Add headers and send a packet with the sending function of the physical layer.

Parameters
packetthe packet to send

Reimplemented in ns3::LorawanMacEndDeviceClassA.

Definition at line 328 of file lorawan-mac-end-device.cc.

Referenced by DoSend().

+ Here is the caller graph for this function:

◆ SetDataRate()

void ns3::LorawanMacEndDevice::SetDataRate ( uint8_t  dataRate)

Set the data rate this end device will use when transmitting.

For End Devices, this value is assumed to be fixed, and can be modified via MAC commands issued by the GW.

Parameters
dataRateThe dataRate to use when transmitting.

Definition at line 672 of file lorawan-mac-end-device.cc.

References m_dataRate.

◆ SetDataRateAdaptation()

void ns3::LorawanMacEndDevice::SetDataRateAdaptation ( bool  adapt)

Enable data rate adaptation in the retransmitting procedure.

Parameters
adaptIf the data rate adaptation is enabled or not.

Definition at line 644 of file lorawan-mac-end-device.cc.

References m_enableDRAdapt.

◆ SetDeviceAddress()

void ns3::LorawanMacEndDevice::SetDeviceAddress ( LoraDeviceAddress  address)

Set the network address of this device.

Parameters
addressThe address to set.

Definition at line 688 of file lorawan-mac-end-device.cc.

References m_address.

◆ SetGatewayUpdateCallback()

void ns3::LorawanMacEndDevice::SetGatewayUpdateCallback ( LorawanMacEndDevice::GatewayUpdateCallback  cb)

Method to set the gateway address update callback.

Parameters
cbcallback to invoke to update gateway address

Definition at line 953 of file lorawan-mac-end-device.cc.

References m_gatewayUpdateCallback.

◆ SetGwAddress()

void ns3::LorawanMacEndDevice::SetGwAddress ( Mac48Address  gwAddress)

Set address of the GW (or its MAC) serving this UT.

Parameters
gwAddressAddress of the GW.

Definition at line 960 of file lorawan-mac-end-device.cc.

References m_gwAddress.

◆ SetLogicalChannel()

void ns3::LorawanMacEndDevice::SetLogicalChannel ( uint8_t  chIndex,
double  frequency,
uint8_t  minDataRate,
uint8_t  maxDataRate 
)

Set a new logical channel in the helper.

Parameters
chIndexThe channel's new index.
frequencyThe channel's center frequency.
minDataRateThe minimum data rate allowed on the channel.
maxDataRateThe maximum data rate allowed on the channel.

Definition at line 906 of file lorawan-mac-end-device.cc.

References ns3::LorawanMac::m_channelHelper, and ns3::LoraLogicalChannelHelper::SetChannel().

Referenced by OnNewChannelReq().

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

◆ SetMaxNumberOfTransmissions()

void ns3::LorawanMacEndDevice::SetMaxNumberOfTransmissions ( uint8_t  maxNumbTx)

Set the maximum number of transmissions allowed.

Parameters
maxNumbTxThe maximum number of transmissions allowed

Definition at line 657 of file lorawan-mac-end-device.cc.

References m_maxNumbTx, m_retxParams, and ns3::LorawanMacEndDevice::LoraRetxParameters::retxLeft.

◆ SetMType()

void ns3::LorawanMacEndDevice::SetMType ( LorawanMacHeader::MType  mType)

Set the message type to send when the Send method is called.

Definition at line 511 of file lorawan-mac-end-device.cc.

References m_mType.

◆ SetPhyRx()

void ns3::LorawanMacEndDevice::SetPhyRx ( Ptr< SatLoraPhyRx phyRx)

Definition at line 975 of file lorawan-mac-end-device.cc.

References m_phyRx.

◆ SetRaChannel()

void ns3::LorawanMacEndDevice::SetRaChannel ( uint32_t  raChannel)

Set RA channel assigned for this UT.

Parameters
raChannelRA channel assigned to this UT.

Definition at line 969 of file lorawan-mac-end-device.cc.

References m_raChannel.

Referenced by ns3::SatUtHelper::InstallLora().

+ Here is the caller graph for this function:

◆ Shuffle()

std::vector< Ptr< LoraLogicalChannel > > ns3::LorawanMacEndDevice::Shuffle ( std::vector< Ptr< LoraLogicalChannel >>  vector)
private

Randomly shuffle a Ptr<LoraLogicalChannel> vector.

Used to pick a random channel on which to send the packet.

Definition at line 610 of file lorawan-mac-end-device.cc.

References m_uniformRV.

Referenced by GetChannelForTx().

+ Here is the caller graph for this function:

◆ TxFinished()

void ns3::LorawanMacEndDevice::TxFinished ( )
virtual

Perform the actions that are required after a packet send.

This function handles opening of the first receive window.

Implements ns3::LorawanMac.

Reimplemented in ns3::LorawanMacEndDeviceClassA.

Definition at line 524 of file lorawan-mac-end-device.cc.

Member Data Documentation

◆ m_address

LoraDeviceAddress ns3::LorawanMacEndDevice::m_address
protected

The address of this device.

Definition at line 426 of file lorawan-mac-end-device.h.

Referenced by ApplyNecessaryOptions(), GetDeviceAddress(), ns3::LorawanMacEndDeviceClassA::Receive(), and SetDeviceAddress().

◆ m_aggregatedDutyCycle

TracedValue<double> ns3::LorawanMacEndDevice::m_aggregatedDutyCycle
private

The aggregated duty cycle this device needs to respect across all sub-bands.

Definition at line 552 of file lorawan-mac-end-device.h.

Referenced by GetAggregatedDutyCycle(), GetTypeId(), and OnDutyCycleReq().

◆ m_codingRate

uint8_t ns3::LorawanMacEndDevice::m_codingRate
protected

The coding rate used by this device.

Definition at line 416 of file lorawan-mac-end-device.h.

◆ m_controlDataRate

bool ns3::LorawanMacEndDevice::m_controlDataRate
private

Whether this device's data rate should be controlled by the NS.

Definition at line 513 of file lorawan-mac-end-device.h.

Referenced by ApplyNecessaryOptions(), and GetTypeId().

◆ m_currentFCnt

uint16_t ns3::LorawanMacEndDevice::m_currentFCnt
private

Definition at line 559 of file lorawan-mac-end-device.h.

Referenced by ApplyNecessaryOptions(), and DoSend().

◆ m_dataRate

TracedValue<uint8_t> ns3::LorawanMacEndDevice::m_dataRate
protected

◆ m_enableDRAdapt

bool ns3::LorawanMacEndDevice::m_enableDRAdapt
protected

Enable Data Rate adaptation during the retransmission procedure.

Definition at line 396 of file lorawan-mac-end-device.h.

Referenced by GetDataRateAdaptation(), GetTypeId(), ns3::LorawanMacEndDeviceClassA::SendToPhy(), and SetDataRateAdaptation().

◆ m_gatewayUpdateCallback

LorawanMacEndDevice::GatewayUpdateCallback ns3::LorawanMacEndDevice::m_gatewayUpdateCallback
protected

Gateway address update callback.

Definition at line 483 of file lorawan-mac-end-device.h.

Referenced by SetGatewayUpdateCallback().

◆ m_gwAddress

Mac48Address ns3::LorawanMacEndDevice::m_gwAddress
protected

◆ m_headerDisabled

bool ns3::LorawanMacEndDevice::m_headerDisabled
protected

Whether or not the header is disabled for communications by this device.

Definition at line 421 of file lorawan-mac-end-device.h.

Referenced by ns3::LorawanMacEndDeviceClassA::SendToPhy().

◆ m_lastKnownGatewayCount

TracedValue<int> ns3::LorawanMacEndDevice::m_lastKnownGatewayCount
private

The last known gateway count (i.e., gateways that are in communication range with this end device)

This value is obtained (and updated) when a LinkCheckAns Mac command is received.

Definition at line 547 of file lorawan-mac-end-device.h.

Referenced by GetTypeId(), and OnLinkCheckAns().

◆ m_lastKnownLinkMargin

TracedValue<double> ns3::LorawanMacEndDevice::m_lastKnownLinkMargin
private

The last known link margin.

This value is obtained (and updated) when a LinkCheckAns Mac command is received.

Definition at line 538 of file lorawan-mac-end-device.h.

Referenced by GetTypeId(), and OnLinkCheckAns().

◆ m_macCommandList

std::list<Ptr<LorawanMacCommand> > ns3::LorawanMacEndDevice::m_macCommandList
protected

List of the MAC commands that need to be applied to the next UL packet.

Definition at line 456 of file lorawan-mac-end-device.h.

Referenced by AddLorawanMacCommand(), ApplyNecessaryOptions(), DoSend(), OnDevStatusReq(), OnDutyCycleReq(), OnLinkAdrReq(), OnNewChannelReq(), and ns3::LorawanMacEndDeviceClassA::OnRxClassParamSetupReq().

◆ m_maxNumbTx

◆ m_mType

LorawanMacHeader::MType ns3::LorawanMacEndDevice::m_mType
private

The message type to apply to packets sent with the Send method.

Definition at line 557 of file lorawan-mac-end-device.h.

Referenced by ApplyNecessaryOptions(), DoSend(), GetMType(), GetTypeId(), and SetMType().

◆ m_nextRetx

EventId ns3::LorawanMacEndDevice::m_nextRetx
private

The event of transmitting a packet in a consecutive moment, when the duty cycle let us transmit.

This Event is used to cancel the transmission of this packet if a newer packet is delivered from the application to be sent.

Definition at line 530 of file lorawan-mac-end-device.h.

◆ m_nextTx

EventId ns3::LorawanMacEndDevice::m_nextTx
private

The event of retransmitting a packet in a consecutive moment if an ACK is not received.

This Event is used to cancel the retransmission if the ACK is found in ParseCommand function and if a newer packet is delivered from the application to be sent.

Definition at line 521 of file lorawan-mac-end-device.h.

Referenced by LorawanMacEndDevice(), postponeTransmission(), and resetRetransmissionParameters().

◆ m_phyRx

◆ m_raChannel

uint32_t ns3::LorawanMacEndDevice::m_raChannel
protected

RA channel assigned to the UT.

Definition at line 490 of file lorawan-mac-end-device.h.

Referenced by SetRaChannel().

◆ m_receiveWindowDurationInSymbols

uint8_t ns3::LorawanMacEndDevice::m_receiveWindowDurationInSymbols
protected

The duration of a receive window in number of symbols.

This should be converted to time based or the reception parameter used.

The downlink preamble transmitted by the gateways contains 8 symbols. The receiver requires 5 symbols to detect the preamble and synchronize. Therefore there must be a 5 symbols overlap between the receive window and the transmitted preamble. (Ref: Recommended SX1272/76 Settings for EU868 LoRaWAN Network Operation )

Definition at line 451 of file lorawan-mac-end-device.h.

Referenced by ns3::LorawanMacEndDeviceClassA::GetNextClassTransmissionDelay().

◆ m_requiredTxCallback

TracedCallback<uint8_t, bool, Time, Ptr<Packet> > ns3::LorawanMacEndDevice::m_requiredTxCallback
protected

The trace source fired when the transmission procedure is finished.

See also
class CallBackTraceSource

Definition at line 478 of file lorawan-mac-end-device.h.

Referenced by ns3::LorawanMacEndDeviceClassA::CloseSecondReceiveWindow(), DoSend(), ns3::LorawanMacEndDeviceClassA::FailedReception(), GetTypeId(), ParseCommands(), and ns3::LorawanMacEndDeviceClassA::Receive().

◆ m_retxParams

◆ m_txPower

TracedValue<double> ns3::LorawanMacEndDevice::m_txPower
protected

The transmission power this device is using to transmit.

Definition at line 411 of file lorawan-mac-end-device.h.

Referenced by GetTransmissionPower(), GetTypeId(), OnLinkAdrReq(), Send(), and ns3::LorawanMacEndDeviceClassA::SendToPhy().

◆ m_uniformRV

Ptr<UniformRandomVariable> ns3::LorawanMacEndDevice::m_uniformRV
protected

An uniform random variable, used by the Shuffle method to randomly reorder the channel list.

Definition at line 467 of file lorawan-mac-end-device.h.

Referenced by LorawanMacEndDevice(), ns3::LorawanMacEndDeviceClassA::GetNextClassTransmissionDelay(), and Shuffle().


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