Class representing a simple LoRa transceiver, with an error model based on receiver sensitivity and a SIR table. More...
#include "simple-end-device-lora-phy.h"
Public Member Functions | |
| SimpleEndDeviceLoraPhy () | |
| Default constructor. | |
| ~SimpleEndDeviceLoraPhy () override | |
| Destructor. | |
| void | Send (Ptr< Packet > packet, uint32_t frequencyHz, IQPolarity iqPolarity, const LoraTxParameters &txParams, double txPowerDbm) override |
| Instruct the PHY to send a packet according to some parameters. | |
| void | StartReceive (Ptr< Packet > packet, uint32_t frequencyHz, IQPolarity iqPolarity, uint8_t spreadingFactor, double rxPowerDbm, Time duration) override |
| Start receiving a packet. | |
| Public Member Functions inherited from ns3::lorawan::EndDeviceLoraPhy | |
| EndDeviceLoraPhy () | |
| Default constructor. | |
| ~EndDeviceLoraPhy () override | |
| Destructor. | |
| State | GetState () |
| Return the internal state this end device is currently in. | |
| bool | IsOnFrequency (uint32_t frequencyHz) const override |
| Whether this device is listening on the specified frequency or not. | |
| bool | IsTransmitting () const override |
| Whether this device is transmitting or not. | |
| void | ReceiveSingle (uint32_t frequencyHz, IQPolarity iqPolarity, uint8_t spreadingFactor, uint32_t bandwidthHz, uint8_t symbNumTimeout, RxTimeoutCallback rxTimeoutCallback) |
| This function starts a reception attempt that will time-out if no transmission preamble is detected. | |
| void | RegisterListener (const std::shared_ptr< EndDeviceLoraPhyListener > &listener) |
| Add the input listener to the list of objects to be notified of PHY-level events. | |
| void | Sleep () |
| Set this PHY LoRa chip to sleep from standby after a transmission / reception. | |
| void | UnregisterListener (const std::shared_ptr< EndDeviceLoraPhyListener > &listener) |
| Remove the input listener from the list of objects to be notified of PHY-level events. | |
| Public Member Functions inherited from ns3::lorawan::LoraPhy | |
| LoraPhy () | |
| Default constructor. | |
| ~LoraPhy () override | |
| Destructor. | |
| Ptr< LoraChannel > | GetChannel () const |
| Get the channel instance associated to this PHY. | |
| Ptr< NetDevice > | GetDevice () const |
| Get the NetDevice associated to this PHY. | |
| Ptr< MobilityModel > | GetMobility () |
| Get the mobility model associated to this PHY. | |
| void | SetChannel (Ptr< LoraChannel > channel) |
| Set the LoraChannel instance PHY transmits on. | |
| void | SetDevice (Ptr< NetDevice > device) |
| Set the NetDevice that owns this PHY. | |
| void | SetMobility (Ptr< MobilityModel > mobility) |
| Set the mobility model associated to this PHY. | |
| void | SetReceiveFailedCallback (RxFailedCallback callback) |
| Set the callback to call upon failed reception of a packet we were previously locked on. | |
| void | SetReceiveOkCallback (RxOkCallback callback) |
| Set the callback to call upon successful reception of a packet. | |
| void | SetTxFinishedCallback (TxFinishedCallback callback) |
| Set the callback to call after transmission of a packet. | |
| Public Member Functions inherited from ns3::Object | |
| Object () | |
| Caller graph was not generated because of its size. | |
| ~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 final |
| Get the most derived TypeId for this Object. | |
| template<> | |
| Ptr< Object > | GetObject () const |
| Specialization of () for objects of type ns3::Object. | |
| template<typename T> | |
| Ptr< T > | GetObject () const |
| Get a pointer to the requested aggregated Object. | |
| template<> | |
| Ptr< Object > | GetObject (TypeId tid) const |
| Specialization of (TypeId tid) 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. | |
| 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. | |
| 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::lorawan::EndDeviceLoraPhy | |
| static TypeId | GetTypeId () |
| Register this type. | |
| Static Public Member Functions inherited from ns3::lorawan::LoraPhy | |
| static Time | GetTimeOnAir (uint32_t phyPayloadLen, const LoraTxParameters &txParams) |
| Compute the total transmission time for a physical packet based on modulation parameters. | |
| static Time | GetTSym (uint8_t spreadingFactor, uint32_t bandwidthHz) |
| Compute the symbol time from spreading factor and bandwidth. | |
| 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 Member Functions | |
| void | EndReceive (Ptr< Packet > packet, Ptr< LoraInterferenceHelper::Event > event) override |
| Finish reception of a packet. | |
Additional Inherited Members | |
| Public Types inherited from ns3::lorawan::EndDeviceLoraPhy | |
| typedef Callback< void > | RxTimeoutCallback |
| Type definition for a callback for when a packet reception hardware timeout expires. | |
| enum class | State { SLEEP , STANDBY , TX , RX_ENABLED , RX_ACTIVE } |
| An enumeration of the possible internal states of an EndDeviceLoraPhy. More... | |
| Public Types inherited from ns3::lorawan::LoraPhy | |
| typedef Callback< void, Ptr< const Packet > > | RxFailedCallback |
| Type definition for a callback for when a packet reception fails. | |
| typedef Callback< void, Ptr< const Packet > > | RxOkCallback |
| Type definition for a callback for when a packet is correctly received. | |
| typedef Callback< void, Ptr< const Packet > > | TxFinishedCallback |
| Type definition for a callback to call when a packet has finished sending. | |
| Static Public Attributes inherited from ns3::lorawan::EndDeviceLoraPhy | |
| static const double | SENSITIVITY [6] = {-124, -127, -130, -133, -135, -137} |
| The sensitivity vector of this device to different SFs. | |
| Protected Member Functions inherited from ns3::lorawan::EndDeviceLoraPhy | |
| void | DoEndReceive () |
| This function should be called by parent classes to signal that the PHY is finishing to demodulate a transmission. | |
| void | DoStartReceive () |
| This function should be called by parent classes to signal that the PHY is starting to demodulate a transmission. | |
| void | RequestRxSingleMode () |
| This function reads RX parameters from the internal registers of the PHY hardware and begins a reception attempt that will time-out if no transmission preamble is detected, automatically reverting to STANDBY. | |
| void | RequestSleepMode () |
| Request a switch to SLEEP mode. | |
| void | RequestTxMode () |
| This function puts the PHY in transmission mode. | |
| void | TxFinished (Ptr< const Packet > packet) override |
| Internal call when transmission of a packet finishes. | |
| 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. | |
| Protected Attributes inherited from ns3::lorawan::EndDeviceLoraPhy | |
| EndDeviceLoraRegisters | m_regs |
| High level model of LoRa chip registers. | |
| TracedCallback< Ptr< const Packet >, uint32_t > | m_wrongFrequency |
| Trace source for when a packet is lost because it was transmitted on a frequency different from the one this EndDeviceLoraPhy was configured to listen on. | |
| TracedCallback< Ptr< const Packet >, uint32_t > | m_wrongPolarity |
| Trace source for when a packet is lost because it was transmitted with a different I/Q polarity (uplink or downlink) from the one this EndDeviceLoraPhy was configured to listen on. | |
| TracedCallback< Ptr< const Packet >, uint32_t > | m_wrongSf |
| Trace source for when a packet is lost because it was using a spreading factor different from the one this EndDeviceLoraPhy was configured to listen for. | |
| Protected Attributes inherited from ns3::lorawan::LoraPhy | |
| Ptr< LoraChannel > | m_channel |
| The channel this PHY transmits on. | |
| Ptr< NetDevice > | m_device |
| The net device this PHY is attached to. | |
| TracedCallback< Ptr< const Packet >, uint32_t > | m_interferedPacket |
| The trace source fired when a packet cannot be correctly received because of interference. | |
| LoraInterferenceHelper | m_interference |
| The LoraInterferenceHelper associated to this PHY. | |
| TracedCallback< Ptr< const Packet > > | m_phyRxBeginTrace |
| The trace source fired when a packet begins the reception process from the medium. | |
| TracedCallback< Ptr< const Packet > > | m_phyRxEndTrace |
| The trace source fired when a packet reception ends. | |
| RxFailedCallback | m_rxFailedCallback |
| The callback to perform upon failed reception of a packet we were locked on. | |
| RxOkCallback | m_rxOkCallback |
| The callback to perform upon correct reception of a packet. | |
| TracedCallback< Ptr< const Packet >, uint32_t > | m_startSending |
| The trace source fired when a packet is sent. | |
| TracedCallback< Ptr< const Packet >, uint32_t > | m_successfullyReceivedPacket |
| The trace source fired when a packet was correctly received. | |
| TxFinishedCallback | m_txFinishedCallback |
| The callback to perform upon the end of a transmission. | |
| TracedCallback< Ptr< const Packet >, uint32_t > | m_underSensitivity |
| The trace source fired when a packet cannot be received because its power is below the sensitivity threshold. | |
| Related Symbols inherited from ns3::ObjectBase | |
| static TypeId | GetObjectIid () |
| Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
Class representing a simple LoRa transceiver, with an error model based on receiver sensitivity and a SIR table.
Definition at line 25 of file simple-end-device-lora-phy.h.
| ns3::lorawan::SimpleEndDeviceLoraPhy::SimpleEndDeviceLoraPhy | ( | ) |
Default constructor.
Definition at line 37 of file simple-end-device-lora-phy.cc.
References NS_LOG_FUNCTION.
Referenced by GetTypeId().
|
override |
Destructor.
Definition at line 42 of file simple-end-device-lora-phy.cc.
References NS_LOG_FUNCTION.
|
overrideprivatevirtual |
Finish reception of a packet.
This method is scheduled by StartReceive, based on the packet duration. By passing a LoraInterferenceHelper Event to this method, the class will be able to identify the packet that is being received among all those that were registered as interference by StartReceive.
| Packet | The received packet. |
| event | The event tied to this packet in the LoraInterferenceHelper. |
Implements ns3::lorawan::EndDeviceLoraPhy.
Definition at line 189 of file simple-end-device-lora-phy.cc.
References ns3::lorawan::EndDeviceLoraPhy::DoEndReceive(), ns3::lorawan::LoraPhy::m_device, ns3::lorawan::LoraPhy::m_interferedPacket, ns3::lorawan::LoraPhy::m_interference, ns3::lorawan::LoraPhy::m_phyRxEndTrace, ns3::lorawan::LoraPhy::m_rxFailedCallback, ns3::lorawan::LoraPhy::m_rxOkCallback, ns3::lorawan::LoraPhy::m_successfullyReceivedPacket, NS_LOG_FUNCTION, NS_LOG_INFO, ns3::lorawan::LoraTag::SetFrequency(), and ns3::lorawan::LoraTag::SetReceivePower().
Referenced by StartReceive().
|
static |
Register this type.
Definition at line 27 of file simple-end-device-lora-phy.cc.
References ns3::lorawan::EndDeviceLoraPhy::EndDeviceLoraPhy(), SimpleEndDeviceLoraPhy(), and ns3::TypeId::SetParent().
|
overridevirtual |
Instruct the PHY to send a packet according to some parameters.
| Packet | The packet to send. |
| frequencyHz | The frequency on which to transmit. |
| iqPolarity | The transmission's I/Q polarity (uplink or downlink). |
| txParams | The desired transmission parameters. |
| txPowerDbm | The power in dBm with which to transmit the packet. |
Implements ns3::lorawan::EndDeviceLoraPhy.
Definition at line 48 of file simple-end-device-lora-phy.cc.
References ns3::lorawan::LoraTxParameters::bandwidthHz, ns3::lorawan::LoraTxParameters::codingRate, ns3::lorawan::LoraTxParameters::crcEnabled, ns3::lorawan::EndDeviceLoraPhy::GetState(), ns3::lorawan::LoraPhy::GetTimeOnAir(), ns3::lorawan::LoraTxParameters::implicitHeader, ns3::lorawan::LoraTxParameters::lowDataRateOptimize, ns3::lorawan::LoraPhy::m_channel, ns3::lorawan::LoraPhy::m_device, ns3::lorawan::EndDeviceLoraPhy::m_regs, ns3::lorawan::LoraPhy::m_startSending, NS_LOG_ERROR, NS_LOG_FUNCTION, ns3::lorawan::LoraTxParameters::preambleLenSymb, ns3::lorawan::EndDeviceLoraPhy::RequestTxMode(), ns3::Simulator::Schedule(), ns3::lorawan::LoraTag::SetSpreadingFactor(), ns3::lorawan::EndDeviceLoraPhy::SLEEP, ns3::lorawan::LoraTxParameters::spreadingFactor, ns3::lorawan::EndDeviceLoraPhy::STANDBY, and ns3::lorawan::EndDeviceLoraPhy::TxFinished().
Referenced by PhyConnectivityTest::DoRun().
|
overridevirtual |
Start receiving a packet.
This method is typically called by LoraChannel.
| Packet | The packet that is arriving at this PHY layer. |
| frequencyHz | The frequency this packet is being transmitted on. |
| iqPolarity | The transmission's I/Q polarity (uplink or downlink). |
| spreadingFactor | The Spreading Factor of the arriving packet. |
| rxPowerDbm | The power of the arriving packet (assumed to be constant for the whole reception). |
| duration | The on air time of this packet. |
Implements ns3::lorawan::EndDeviceLoraPhy.
Definition at line 97 of file simple-end-device-lora-phy.cc.
References ns3::Time::As(), ns3::lorawan::EndDeviceLoraPhy::DoStartReceive(), EndReceive(), ns3::lorawan::EndDeviceLoraPhy::GetState(), ns3::lorawan::LoraPhy::m_device, ns3::lorawan::LoraPhy::m_interference, ns3::lorawan::LoraPhy::m_phyRxBeginTrace, ns3::lorawan::EndDeviceLoraPhy::m_regs, ns3::lorawan::LoraPhy::m_underSensitivity, ns3::lorawan::EndDeviceLoraPhy::m_wrongFrequency, ns3::lorawan::EndDeviceLoraPhy::m_wrongPolarity, ns3::lorawan::EndDeviceLoraPhy::m_wrongSf, NS_LOG_FUNCTION, NS_LOG_INFO, ns3::lorawan::EndDeviceLoraPhy::RX_ACTIVE, ns3::lorawan::EndDeviceLoraPhy::RX_ENABLED, ns3::Time::S, ns3::Simulator::Schedule(), and ns3::lorawan::EndDeviceLoraPhy::SENSITIVITY.
Referenced by AdrBackoffTest::ScheduleRx1Downlink(), and RetransmissionTest::ScheduleRx1Downlink().