The class that delivers packets among PHY layers. More...
#include "lora-channel.h"
Public Member Functions | |
LoraChannel () | |
Default constructor. | |
LoraChannel (Ptr< PropagationLossModel > loss, Ptr< PropagationDelayModel > delay) | |
Construct a LoraChannel with a loss and delay model. | |
~LoraChannel () override | |
Destructor. | |
void | Add (Ptr< LoraPhy > phy) |
Connect a LoraPhy object to the LoraChannel. | |
Ptr< NetDevice > | GetDevice (std::size_t i) const override |
std::size_t | GetNDevices () const override |
double | GetRxPower (double txPowerDbm, Ptr< MobilityModel > senderMobility, Ptr< MobilityModel > receiverMobility) const |
Compute the received power when transmitting from a point to another one. | |
void | Remove (Ptr< LoraPhy > phy) |
Remove a physical layer from the LoraChannel. | |
void | Send (Ptr< LoraPhy > sender, Ptr< Packet > packet, double txPowerDbm, LoraTxParameters txParams, Time duration, double frequencyMHz) const |
Send a packet in the channel. | |
Public Member Functions inherited from ns3::Channel | |
Channel () | |
~Channel () override | |
uint32_t | GetId () const |
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, bool permissive=false) 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. | |
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::Channel | |
static TypeId | GetTypeId () |
Get the type ID. | |
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 Member Functions | |
void | Receive (uint32_t i, Ptr< Packet > packet, LoraChannelParameters parameters) const |
Private method that is scheduled by LoraChannel's Send method to happen after the channel delay, for each of the connected PHY layers. | |
Private Attributes | |
Ptr< PropagationDelayModel > | m_delay |
Pointer to the delay model. | |
Ptr< PropagationLossModel > | m_loss |
Pointer to the loss model. | |
TracedCallback< Ptr< const Packet > > | m_packetSent |
Callback for when a packet is being sent on the channel. | |
std::vector< Ptr< LoraPhy > > | m_phyList |
The vector containing the PHYs that are currently connected to the channel. | |
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 Symbols inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
The class that delivers packets among PHY layers.
This class is tasked with taking packets that PHY layers want to send and, based on some factors like the transmission power and the node positions, computing the power at every receiver using a PropagationLossModel and notifying them of the reception event after a delay based on some PropagationDelayModel.
Definition at line 70 of file lora-channel.h.
ns3::lorawan::LoraChannel::LoraChannel | ( | ) |
Default constructor.
Definition at line 56 of file lora-channel.cc.
|
override |
ns3::lorawan::LoraChannel::LoraChannel | ( | Ptr< PropagationLossModel > | loss, |
Ptr< PropagationDelayModel > | delay ) |
Construct a LoraChannel with a loss and delay model.
loss | The loss model to associate to this channel. |
delay | The delay model to associate to this channel. |
Definition at line 65 of file lora-channel.cc.
Connect a LoraPhy object to the LoraChannel.
This method is needed so that the channel knows it has to notify this PHY of incoming transmissions.
phy | The physical layer to add. |
Definition at line 72 of file lora-channel.cc.
References m_phyList, and NS_LOG_FUNCTION.
i | index of NetDevice to retrieve |
This method must be implemented by subclasses.
Implements ns3::Channel.
Definition at line 96 of file lora-channel.cc.
References ns3::DynamicCast(), GetDevice(), and m_phyList.
Referenced by GetDevice().
|
overridevirtual |
This method must be implemented by subclasses.
Implements ns3::Channel.
Definition at line 90 of file lora-channel.cc.
References m_phyList.
double ns3::lorawan::LoraChannel::GetRxPower | ( | double | txPowerDbm, |
Ptr< MobilityModel > | senderMobility, | ||
Ptr< MobilityModel > | receiverMobility ) const |
Compute the received power when transmitting from a point to another one.
This method can be used by external object to see the receive power of a transmission from one point to another using this Channel's PropagationLossModel.
txPowerDbm | The power the transmitter is using, in dBm. |
senderMobility | The mobility model of the sender. |
receiverMobility | The mobility model of the receiver. |
Definition at line 194 of file lora-channel.cc.
References m_loss.
Referenced by Send().
|
static |
Register this type.
Definition at line 32 of file lora-channel.cc.
References m_delay, m_loss, m_packetSent, ns3::MakePointerAccessor(), ns3::MakePointerChecker(), ns3::MakeTraceSourceAccessor(), and ns3::TypeId::SetParent().
|
private |
Private method that is scheduled by LoraChannel's Send method to happen after the channel delay, for each of the connected PHY layers.
It's here that the Receive method of the PHY is called to initiate packet reception at the PHY.
i | The index of the phy to start reception on. |
packet | The packet the phy will receive. |
parameters | The parameters that characterize this transmission. |
Definition at line 181 of file lora-channel.cc.
References ns3::lorawan::LoraChannelParameters::duration, ns3::lorawan::LoraChannelParameters::frequencyMHz, m_phyList, NS_LOG_FUNCTION, ns3::lorawan::LoraChannelParameters::rxPowerDbm, and ns3::lorawan::LoraChannelParameters::sf.
Referenced by Send().
Remove a physical layer from the LoraChannel.
This method removes a phy from the list of devices we have to notify. Removing unused PHY layers from the channel can improve performance, since it is not necessary to notify them about each transmission.
phy | The physical layer to remove. |
Definition at line 81 of file lora-channel.cc.
References m_phyList, and NS_LOG_FUNCTION.
void ns3::lorawan::LoraChannel::Send | ( | Ptr< LoraPhy > | sender, |
Ptr< Packet > | packet, | ||
double | txPowerDbm, | ||
LoraTxParameters | txParams, | ||
Time | duration, | ||
double | frequencyMHz ) const |
Send a packet in the channel.
This method is typically invoked by a PHY that needs to send a packet. Every connected Phy will be notified of this packet send through a call to their StartReceive methods after a delay based on the channel's PropagationDelayModel.
sender | The phy that is sending this packet. |
packet | The PHY layer packet that is being sent over the channel. |
txPowerDbm | The power of the transmission. |
txParams | The set of parameters that are used by the transmitter. |
duration | The on-air duration of this packet. |
frequencyMHz | The frequency this transmission will happen at. |
When this method is called, the channel schedules an internal Receive call that performs the actual call to the PHY's StartReceive function.
Definition at line 102 of file lora-channel.cc.
References ns3::lorawan::LoraChannelParameters::duration, ns3::lorawan::LoraChannelParameters::frequencyMHz, GetRxPower(), m_delay, m_packetSent, m_phyList, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, Receive(), ns3::lorawan::LoraChannelParameters::rxPowerDbm, ns3::Simulator::ScheduleWithContext(), ns3::lorawan::LoraChannelParameters::sf, and ns3::lorawan::LoraTxParameters::sf.
|
private |
Pointer to the delay model.
Definition at line 189 of file lora-channel.h.
Referenced by GetTypeId(), and Send().
|
private |
Pointer to the loss model.
This loss model can be a concatenation of multiple loss models, obtained via PropagationLossModel's SetNext method.
Definition at line 184 of file lora-channel.h.
Referenced by GetRxPower(), and GetTypeId().
|
private |
Callback for when a packet is being sent on the channel.
Definition at line 194 of file lora-channel.h.
Referenced by GetTypeId(), and Send().
The vector containing the PHYs that are currently connected to the channel.
Definition at line 176 of file lora-channel.h.
Referenced by ~LoraChannel(), Add(), GetDevice(), GetNDevices(), Receive(), Remove(), and Send().