A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::UanPhyGen Class Reference

Generic PHY model. More...

#include "uan-phy-gen.h"

+ Inheritance diagram for ns3::UanPhyGen:
+ Collaboration diagram for ns3::UanPhyGen:

Public Member Functions

 UanPhyGen ()
 Constructor.
 
 ~UanPhyGen () override
 Dummy destructor, see DoDispose.
 
int64_t AssignStreams (int64_t stream) override
 Assign a fixed random variable stream number to the random variables used by this model.
 
void Clear () override
 Clear all pointer references.
 
void EnergyDepletionHandler () override
 Handle the energy depletion event.
 
void EnergyRechargeHandler () override
 Handle the energy recharge event.
 
double GetCcaThresholdDb () override
 Get the CCA threshold signal strength required to detect channel busy.
 
Ptr< UanChannelGetChannel () const override
 Get the attached channel.
 
Ptr< UanNetDeviceGetDevice () const override
 Get the device hosting this Phy.
 
UanTxMode GetMode (uint32_t n) override
 Get a specific transmission mode.
 
uint32_t GetNModes () override
 Get the number of transmission modes supported by this Phy.
 
Ptr< PacketGetPacketRx () const override
 Get the packet currently being received.
 
double GetRxThresholdDb () override
 Get the minimum received signal strength required to receive a packet without errors.
 
Ptr< UanTransducerGetTransducer () override
 Get the attached transducer.
 
double GetTxPowerDb () override
 Get the current transmit power, in dB.
 
bool IsStateBusy () override
 
bool IsStateCcaBusy () override
 
bool IsStateIdle () override
 
bool IsStateRx () override
 
bool IsStateSleep () override
 
bool IsStateTx () override
 
void NotifyIntChange () override
 Called when there has been a change in the amount of interference this node is experiencing from other transmissions.
 
void NotifyTransStartTx (Ptr< Packet > packet, double txPowerDb, UanTxMode txMode) override
 Called when a transmission is beginning on the attached transducer.
 
void RegisterListener (UanPhyListener *listener) override
 Register a UanPhyListener to be notified of common UanPhy events.
 
void SendPacket (Ptr< Packet > pkt, uint32_t modeNum) override
 Send a packet using a specific transmission mode.
 
void SetCcaThresholdDb (double thresh) override
 Set the threshold for detecting channel busy.
 
void SetChannel (Ptr< UanChannel > channel) override
 Attach to a channel.
 
void SetDevice (Ptr< UanNetDevice > device) override
 Set the device hosting this Phy.
 
void SetEnergyModelCallback (DeviceEnergyModel::ChangeStateCallback cb) override
 Set the DeviceEnergyModel callback for UanPhy device.
 
void SetMac (Ptr< UanMac > mac) override
 Set the MAC forwarding messages to this Phy.
 
void SetReceiveErrorCallback (RxErrCallback cb) override
 Set the callback to be used when a packet is received with errors.
 
void SetReceiveOkCallback (RxOkCallback cb) override
 Set the callback to be used when a packet is received without error.
 
void SetRxThresholdDb (double thresh) override
 Set the minimum SINR threshold to receive a packet without errors.
 
void SetSleepMode (bool sleep) override
 Set the Phy SLEEP mode.
 
void SetTransducer (Ptr< UanTransducer > trans) override
 Attach a transducer to this Phy.
 
void SetTxPowerDb (double txpwr) override
 Set the transmit power.
 
void StartRxPacket (Ptr< Packet > pkt, double rxPowerDb, UanTxMode txMode, UanPdp pdp) override
 Packet arriving from channel: i.e.
 
- Public Member Functions inherited from ns3::UanPhy
virtual int64_t AssignStreams (int64_t stream)=0
 Assign a fixed random variable stream number to the random variables used by this model.
 
virtual void Clear ()=0
 Clear all pointer references.
 
virtual void EnergyDepletionHandler ()=0
 Handle the energy depletion event.
 
virtual void EnergyRechargeHandler ()=0
 Handle the energy recharge event.
 
virtual double GetCcaThresholdDb ()=0
 Get the CCA threshold signal strength required to detect channel busy.
 
virtual Ptr< UanChannelGetChannel () const =0
 Get the attached channel.
 
virtual Ptr< UanNetDeviceGetDevice () const =0
 Get the device hosting this Phy.
 
virtual UanTxMode GetMode (uint32_t n)=0
 Get a specific transmission mode.
 
virtual uint32_t GetNModes ()=0
 Get the number of transmission modes supported by this Phy.
 
virtual Ptr< PacketGetPacketRx () const =0
 Get the packet currently being received.
 
virtual double GetRxThresholdDb ()=0
 Get the minimum received signal strength required to receive a packet without errors.
 
virtual Ptr< UanTransducerGetTransducer ()=0
 Get the attached transducer.
 
virtual double GetTxPowerDb ()=0
 Get the current transmit power, in dB.
 
virtual bool IsStateBusy ()=0
 
virtual bool IsStateCcaBusy ()=0
 
virtual bool IsStateIdle ()=0
 
virtual bool IsStateRx ()=0
 
virtual bool IsStateSleep ()=0
 
virtual bool IsStateTx ()=0
 
virtual void NotifyIntChange ()=0
 Called when there has been a change in the amount of interference this node is experiencing from other transmissions.
 
void NotifyRxBegin (Ptr< const Packet > packet)
 Called when the Phy begins to receive a packet.
 
void NotifyRxDrop (Ptr< const Packet > packet)
 Called when the Phy drops a packet.
 
void NotifyRxEnd (Ptr< const Packet > packet)
 Called when a packet is received without error.
 
virtual void NotifyTransStartTx (Ptr< Packet > packet, double txPowerDb, UanTxMode txMode)=0
 Called when a transmission is beginning on the attached transducer.
 
void NotifyTxBegin (Ptr< const Packet > packet)
 Called when the transducer begins transmitting a packet.
 
void NotifyTxDrop (Ptr< const Packet > packet)
 Called when the transducer attempts to transmit a new packet while already transmitting a prior packet.
 
void NotifyTxEnd (Ptr< const Packet > packet)
 Called when the transducer finishes transmitting a packet.
 
virtual void RegisterListener (UanPhyListener *listener)=0
 Register a UanPhyListener to be notified of common UanPhy events.
 
virtual void SendPacket (Ptr< Packet > pkt, uint32_t modeNum)=0
 Send a packet using a specific transmission mode.
 
virtual void SetCcaThresholdDb (double thresh)=0
 Set the threshold for detecting channel busy.
 
virtual void SetChannel (Ptr< UanChannel > channel)=0
 Attach to a channel.
 
virtual void SetDevice (Ptr< UanNetDevice > device)=0
 Set the device hosting this Phy.
 
virtual void SetEnergyModelCallback (DeviceEnergyModel::ChangeStateCallback callback)=0
 Set the DeviceEnergyModel callback for UanPhy device.
 
virtual void SetMac (Ptr< UanMac > mac)=0
 Set the MAC forwarding messages to this Phy.
 
virtual void SetReceiveErrorCallback (RxErrCallback cb)=0
 Set the callback to be used when a packet is received with errors.
 
virtual void SetReceiveOkCallback (RxOkCallback cb)=0
 Set the callback to be used when a packet is received without error.
 
virtual void SetRxThresholdDb (double thresh)=0
 Set the minimum SINR threshold to receive a packet without errors.
 
virtual void SetSleepMode (bool sleep)=0
 Set the Phy SLEEP mode.
 
virtual void SetTransducer (Ptr< UanTransducer > trans)=0
 Attach a transducer to this Phy.
 
virtual void SetTxPowerDb (double txpwr)=0
 Set the transmit power.
 
virtual void StartRxPacket (Ptr< Packet > pkt, double rxPowerDb, UanTxMode txMode, UanPdp pdp)=0
 Packet arriving from channel: i.e.
 
- 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< ObjectGetObject () 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< ObjectGetObject (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.
 
- 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.
 
SimpleRefCountoperator= (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 UanModesList GetDefaultModes ()
 Get the default transmission modes.
 
static TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::UanPhy
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.
 

Protected Member Functions

void DoDispose () override
 Destructor implementation.
 
- 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.
 

Private Types

typedef std::list< UanPhyListener * > ListenerList
 List of Phy Listeners.
 

Private Member Functions

double CalculateSinrDb (Ptr< Packet > pkt, Time arrTime, double rxPowerDb, UanTxMode mode, UanPdp pdp)
 Calculate the SINR value for a packet.
 
double DbToKp (double db)
 Convert dB to kilopascals.
 
double GetInterferenceDb (Ptr< Packet > pkt)
 Calculate interference power from overlapping packet arrivals, in dB.
 
double KpToDb (double kp)
 Convert kilopascals to dB.
 
void NotifyListenersCcaEnd ()
 Call UanListener::NotifyCcaEnd on all listeners.
 
void NotifyListenersCcaStart ()
 Call UanListener::NotifyCcaStart on all listeners.
 
void NotifyListenersRxBad ()
 Call UanListener::NotifyRxEndError on all listeners.
 
void NotifyListenersRxGood ()
 Call UanListener::NotifyRxEndOk on all listeners.
 
void NotifyListenersRxStart ()
 Call UanListener::NotifyRxStart on all listeners.
 
void NotifyListenersTxEnd ()
 Call UanListener::NotifyTxEnd on all listeners.
 
void NotifyListenersTxStart (Time duration)
 Call UanListener::NotifyTxStart on all listeners.
 
void RxEndEvent (Ptr< Packet > pkt, double rxPowerDb, UanTxMode txMode)
 Event to process end of packet reception.
 
void TxEndEvent ()
 Event to process end of packet transmission.
 
void UpdatePowerConsumption (const State state)
 Update energy source with new state.
 

Private Attributes

double m_ccaThreshDb
 CCA busy threshold.
 
Ptr< UanChannelm_channel
 Attached channel.
 
bool m_cleared
 Flag when we've been cleared.
 
Ptr< UanNetDevicem_device
 Device hosting this Phy.
 
DeviceEnergyModel::ChangeStateCallback m_energyCallback
 Energy model callback.
 
ListenerList m_listeners
 List of listeners.
 
Ptr< UanMacm_mac
 MAC layer.
 
double m_minRxSinrDb
 Minimum receive SINR during packet reception.
 
UanModesList m_modes
 List of modes supported by this PHY.
 
Ptr< UanPhyPerm_per
 Error model.
 
Ptr< UniformRandomVariablem_pg
 Provides uniform random variables.
 
Ptr< Packetm_pktRx
 Received packet.
 
Time m_pktRxArrTime
 Packet arrival time.
 
UanTxMode m_pktRxMode
 Packet transmission mode at receiver.
 
UanPdp m_pktRxPdp
 Power delay profile of packet.
 
Ptr< Packetm_pktTx
 Sent packet.
 
RxErrCallback m_recErrCb
 Callback for packets received with errors.
 
RxOkCallback m_recOkCb
 Callback for packets received without error.
 
EventId m_rxEndEvent
 Rx event.
 
ns3::TracedCallback< Ptr< const Packet >, double, UanTxModem_rxErrLogger
 A packet destined for this Phy was received with error.
 
ns3::TracedCallback< Ptr< const Packet >, double, UanTxModem_rxOkLogger
 A packet destined for this Phy was received without error.
 
double m_rxRecvPwrDb
 Receiver power.
 
double m_rxThreshDb
 Receive SINR threshold.
 
Ptr< UanPhyCalcSinrm_sinr
 SINR calculator.
 
State m_state
 Phy state.
 
Ptr< UanTransducerm_transducer
 Associated transducer.
 
EventId m_txEndEvent
 Tx event.
 
ns3::TracedCallback< Ptr< const Packet >, double, UanTxModem_txLogger
 A packet was sent from this Phy.
 
double m_txPwrDb
 Transmit power.
 

Additional Inherited Members

- Public Types inherited from ns3::UanPhy
typedef Callback< void, Ptr< Packet >, doubleRxErrCallback
 Packet receive error callback function type.
 
typedef Callback< void, Ptr< Packet >, double, UanTxModeRxOkCallback
 Packet received successfully callback function type.
 
enum  State {
  IDLE , CCABUSY , RX , TX ,
  SLEEP , DISABLED
}
 Enum defining possible Phy states. More...
 
typedef void(* TracedCallback) (Ptr< const Packet > pkt, double sinr, UanTxMode mode)
 TracedCallback signature for UanPhy packet send/receive events.
 

Detailed Description

Generic PHY model.

This is a generic PHY class. SINR and PER information are controlled via attributes. By adapting the SINR and PER models to a specific situation, this PHY should be able to model a wide variety of networks.

Config Paths

ns3::UanPhyGen is accessible through the following paths with Config::Set and Config::Connect:

  • "/NodeList/[i]/DeviceList/[i]/$ns3::UanNetDevice/Phy/$ns3::UanPhyGen"

Attributes

  • CcaThreshold: Aggregate energy of incoming signals to move to CCA Busy state dB.
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 10
    • Flags: constructwriteread
  • PerModel: Functor to calculate PER based on SINR and TxMode.
  • RxThreshold: Required SNR for signal acquisition in dB.
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 10
    • Flags: constructwriteread
  • SinrModel: Functor to calculate SINR based on pkt arrivals and modes.
  • SupportedModes: List of modes supported by this PHY.
  • TxPower: Transmission output power in dB.
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 190
    • Flags: constructwriteread

TraceSources

TraceSources defined in parent class ns3::UanPhy

  • PhyRxBegin: Trace source indicating a packet has begun being received from the channel medium by the device.
    Callback signature: ns3::Packet::TracedCallback
  • PhyRxDrop: Trace source indicating a packet has been dropped by the device during reception.
    Callback signature: ns3::Packet::TracedCallback
  • PhyRxEnd: Trace source indicating a packet has been completely received from the channel medium by the device.
    Callback signature: ns3::Packet::TracedCallback
  • PhyTxBegin: Trace source indicating a packet has begun transmitting over the channel medium.
    Callback signature: ns3::Packet::TracedCallback
  • PhyTxDrop: Trace source indicating a packet has been dropped by the device during transmission.
    Callback signature: ns3::Packet::TracedCallback
  • PhyTxEnd: Trace source indicating a packet has been completely transmitted over the channel.
    Callback signature: ns3::Packet::TracedCallback

Size of this type is 464 bytes (on a 64-bit architecture).

Definition at line 260 of file uan-phy-gen.h.

Member Typedef Documentation

◆ ListenerList

typedef std::list<UanPhyListener*> ns3::UanPhyGen::ListenerList
private

List of Phy Listeners.

Definition at line 319 of file uan-phy-gen.h.

Constructor & Destructor Documentation

◆ UanPhyGen()

ns3::UanPhyGen::UanPhyGen ( )

Constructor.

Definition at line 493 of file uan-phy-gen.cc.

References m_energyCallback, m_pg, and ns3::Callback< R, UArgs >::Nullify().

+ Here is the call graph for this function:

◆ ~UanPhyGen()

ns3::UanPhyGen::~UanPhyGen ( )
override

Dummy destructor, see DoDispose.

Definition at line 512 of file uan-phy-gen.cc.

Member Function Documentation

◆ AssignStreams()

int64_t ns3::UanPhyGen::AssignStreams ( int64_t  stream)
overridevirtual

Assign a fixed random variable stream number to the random variables used by this model.

Return the number of streams (possibly zero) that have been assigned.

Parameters
streamFirst stream index to use.
Returns
The number of stream indices assigned by this model.

Implements ns3::UanPhy.

Definition at line 1043 of file uan-phy-gen.cc.

References m_pg, NS_LOG_FUNCTION, and ns3::RandomVariableStream::SetStream().

+ Here is the call graph for this function:

◆ CalculateSinrDb()

double ns3::UanPhyGen::CalculateSinrDb ( Ptr< Packet pkt,
Time  arrTime,
double  rxPowerDb,
UanTxMode  mode,
UanPdp  pdp 
)
private

Calculate the SINR value for a packet.

Parameters
pktPacket to calculate SINR for.
arrTimeArrival time of pkt.
rxPowerDbThe received signal strength of the packet in dB re 1 uPa.
modeTX Mode of pkt.
pdpPower delay profile of pkt.
Returns
The SINR in dB re 1 uPa.

Definition at line 1072 of file uan-phy-gen.cc.

References ns3::UanTxMode::GetBandwidthHz(), ns3::UanTxMode::GetCenterFreqHz(), m_channel, m_sinr, and m_transducer.

Referenced by StartRxPacket().

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

◆ Clear()

void ns3::UanPhyGen::Clear ( )
overridevirtual

Clear all pointer references.

Implements ns3::UanPhy.

Definition at line 517 of file uan-phy-gen.cc.

References m_channel, m_cleared, m_device, m_listeners, m_mac, m_per, m_pktRx, m_sinr, and m_transducer.

Referenced by DoDispose().

+ Here is the caller graph for this function:

◆ DbToKp()

double ns3::UanPhyGen::DbToKp ( double  db)
private

Convert dB to kilopascals.

\[{\rm{kPa}} = {10^{\frac{{{\rm{dB}}}}{{10}}}}\]

Parameters
dbSignal level in dB.
Returns
Sound pressure in kPa.

Definition at line 1105 of file uan-phy-gen.cc.

Referenced by GetInterferenceDb().

+ Here is the caller graph for this function:

◆ DoDispose()

void ns3::UanPhyGen::DoDispose ( )
overrideprotectedvirtual

Destructor implementation.

This method is called by Dispose() or by the Object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overridden version of this method and chain up to their parent's implementation once they are done. i.e, for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose() method.

It is safe to call GetObject() from within this method.

Reimplemented from ns3::Object.

Definition at line 559 of file uan-phy-gen.cc.

References Clear(), ns3::Object::DoDispose(), m_energyCallback, and ns3::Callback< R, UArgs >::Nullify().

+ Here is the call graph for this function:

◆ EnergyDepletionHandler()

void ns3::UanPhyGen::EnergyDepletionHandler ( )
overridevirtual

Handle the energy depletion event.

Implements ns3::UanPhy.

Definition at line 652 of file uan-phy-gen.cc.

References ns3::Simulator::Cancel(), ns3::UanPhy::DISABLED, ns3::EventId::IsRunning(), m_device, m_pktRx, m_pktTx, m_rxEndEvent, m_state, m_txEndEvent, ns3::UanPhy::NotifyRxDrop(), ns3::UanPhy::NotifyTxDrop(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ EnergyRechargeHandler()

void ns3::UanPhyGen::EnergyRechargeHandler ( )
overridevirtual

Handle the energy recharge event.

Implements ns3::UanPhy.

Definition at line 674 of file uan-phy-gen.cc.

References ns3::UanPhy::IDLE, m_device, m_state, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

◆ GetCcaThresholdDb()

double ns3::UanPhyGen::GetCcaThresholdDb ( )
overridevirtual

Get the CCA threshold signal strength required to detect channel busy.

Returns
The CCA threshold signal strength in dB.

Implements ns3::UanPhy.

Definition at line 964 of file uan-phy-gen.cc.

References m_ccaThreshDb.

◆ GetChannel()

Ptr< UanChannel > ns3::UanPhyGen::GetChannel ( ) const
overridevirtual

Get the attached channel.

Returns
The channel.

Implements ns3::UanPhy.

Definition at line 970 of file uan-phy-gen.cc.

References m_channel.

◆ GetDefaultModes()

UanModesList ns3::UanPhyGen::GetDefaultModes ( )
static

Get the default transmission modes.

Returns
The default mode list.

Definition at line 567 of file uan-phy-gen.cc.

References ns3::UanModesList::AppendMode(), ns3::UanTxModeFactory::CreateMode(), ns3::UanTxMode::FSK, and ns3::UanTxMode::PSK.

Referenced by UanTest::DoRun(), ns3::UanPhyDual::GetTypeId(), and GetTypeId().

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

◆ GetDevice()

Ptr< UanNetDevice > ns3::UanPhyGen::GetDevice ( ) const
overridevirtual

Get the device hosting this Phy.

Returns
The net device.

Implements ns3::UanPhy.

Definition at line 976 of file uan-phy-gen.cc.

References m_device.

◆ GetInterferenceDb()

double ns3::UanPhyGen::GetInterferenceDb ( Ptr< Packet pkt)
private

Calculate interference power from overlapping packet arrivals, in dB.

The "signal" packet power is excluded. Use GetInterferenceDb ( (Ptr<Packet>) 0) to treat all signals as interference, for instance in calculating the CCA busy.

Parameters
pktThe arriving (signal) packet.
Returns
The total interference power, in dB.

Definition at line 1085 of file uan-phy-gen.cc.

References DbToKp(), KpToDb(), and m_transducer.

Referenced by NotifyIntChange(), RxEndEvent(), SetSleepMode(), StartRxPacket(), and TxEndEvent().

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

◆ GetMode()

UanTxMode ns3::UanPhyGen::GetMode ( uint32_t  n)
overridevirtual

Get a specific transmission mode.

Parameters
nThe mode number.
Returns
The mode.

Implements ns3::UanPhy.

Definition at line 1193 of file uan-phy-gen.cc.

References ns3::UanModesList::GetNModes(), m_modes, and NS_ASSERT.

Referenced by SendPacket(), and StartRxPacket().

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

◆ GetNModes()

uint32_t ns3::UanPhyGen::GetNModes ( )
overridevirtual

Get the number of transmission modes supported by this Phy.

Returns
The number modes.

Implements ns3::UanPhy.

Definition at line 1187 of file uan-phy-gen.cc.

References ns3::UanModesList::GetNModes(), and m_modes.

Referenced by StartRxPacket().

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

◆ GetPacketRx()

Ptr< Packet > ns3::UanPhyGen::GetPacketRx ( ) const
overridevirtual

Get the packet currently being received.

Warning
Returns non-valid pointer if IsStateRx == false.
Returns
The packet.

Implements ns3::UanPhy.

Definition at line 1201 of file uan-phy-gen.cc.

References m_pktRx.

◆ GetRxThresholdDb()

double ns3::UanPhyGen::GetRxThresholdDb ( )
overridevirtual

Get the minimum received signal strength required to receive a packet without errors.

Returns
The minimum required signal strength, in dB.

Implements ns3::UanPhy.

Definition at line 958 of file uan-phy-gen.cc.

References m_rxThreshDb.

◆ GetTransducer()

Ptr< UanTransducer > ns3::UanPhyGen::GetTransducer ( )
overridevirtual

Get the attached transducer.

Returns
The transducer.

Implements ns3::UanPhy.

Definition at line 982 of file uan-phy-gen.cc.

References m_transducer.

◆ GetTxPowerDb()

double ns3::UanPhyGen::GetTxPowerDb ( )
overridevirtual

Get the current transmit power, in dB.

Returns
The transmit power.

Implements ns3::UanPhy.

Definition at line 952 of file uan-phy-gen.cc.

References m_txPwrDb.

◆ GetTypeId()

TypeId ns3::UanPhyGen::GetTypeId ( )
static

◆ IsStateBusy()

bool ns3::UanPhyGen::IsStateBusy ( )
overridevirtual
Returns
True if Phy is neither IDLE nor SLEEP.

Implements ns3::UanPhy.

Definition at line 910 of file uan-phy-gen.cc.

References IsStateIdle(), and IsStateSleep().

+ Here is the call graph for this function:

◆ IsStateCcaBusy()

bool ns3::UanPhyGen::IsStateCcaBusy ( )
overridevirtual
Returns
True if Phy is in CCABUSY state.

Implements ns3::UanPhy.

Definition at line 928 of file uan-phy-gen.cc.

References ns3::UanPhy::CCABUSY, and m_state.

◆ IsStateIdle()

bool ns3::UanPhyGen::IsStateIdle ( )
overridevirtual
Returns
True if Phy is in IDLE state.

Implements ns3::UanPhy.

Definition at line 904 of file uan-phy-gen.cc.

References ns3::UanPhy::IDLE, and m_state.

Referenced by IsStateBusy().

+ Here is the caller graph for this function:

◆ IsStateRx()

bool ns3::UanPhyGen::IsStateRx ( )
overridevirtual
Returns
True if Phy is currently in receive mode.

Implements ns3::UanPhy.

Definition at line 916 of file uan-phy-gen.cc.

References m_state, and ns3::UanPhy::RX.

◆ IsStateSleep()

bool ns3::UanPhyGen::IsStateSleep ( )
overridevirtual
Returns
True if Phy is in SLEEP state.

Implements ns3::UanPhy.

Definition at line 898 of file uan-phy-gen.cc.

References m_state, and ns3::UanPhy::SLEEP.

Referenced by IsStateBusy().

+ Here is the caller graph for this function:

◆ IsStateTx()

bool ns3::UanPhyGen::IsStateTx ( )
overridevirtual
Returns
True if Phy is busy transmitting.

Implements ns3::UanPhy.

Definition at line 922 of file uan-phy-gen.cc.

References m_state, and ns3::UanPhy::TX.

◆ KpToDb()

double ns3::UanPhyGen::KpToDb ( double  kp)
private

Convert kilopascals to dB.

\[{\rm{dB}} = 10{\log _{10}}{\rm{kPa}}\]

Parameters
kpSound pressure in kPa.
Returns
Signal level in dB.

Definition at line 1111 of file uan-phy-gen.cc.

Referenced by GetInterferenceDb().

+ Here is the caller graph for this function:

◆ NotifyIntChange()

void ns3::UanPhyGen::NotifyIntChange ( )
overridevirtual

Called when there has been a change in the amount of interference this node is experiencing from other transmissions.

Implements ns3::UanPhy.

Definition at line 1062 of file uan-phy-gen.cc.

References ns3::UanPhy::CCABUSY, GetInterferenceDb(), ns3::UanPhy::IDLE, m_ccaThreshDb, m_state, and NotifyListenersCcaEnd().

+ Here is the call graph for this function:

◆ NotifyListenersCcaEnd()

void ns3::UanPhyGen::NotifyListenersCcaEnd ( )
private

Call UanListener::NotifyCcaEnd on all listeners.

Definition at line 1157 of file uan-phy-gen.cc.

References m_listeners.

Referenced by NotifyIntChange().

+ Here is the caller graph for this function:

◆ NotifyListenersCcaStart()

void ns3::UanPhyGen::NotifyListenersCcaStart ( )
private

Call UanListener::NotifyCcaStart on all listeners.

Definition at line 1147 of file uan-phy-gen.cc.

References m_listeners.

Referenced by RxEndEvent(), SetSleepMode(), StartRxPacket(), and TxEndEvent().

+ Here is the caller graph for this function:

◆ NotifyListenersRxBad()

void ns3::UanPhyGen::NotifyListenersRxBad ( )
private

Call UanListener::NotifyRxEndError on all listeners.

Definition at line 1137 of file uan-phy-gen.cc.

References m_listeners.

Referenced by RxEndEvent().

+ Here is the caller graph for this function:

◆ NotifyListenersRxGood()

void ns3::UanPhyGen::NotifyListenersRxGood ( )
private

Call UanListener::NotifyRxEndOk on all listeners.

Definition at line 1127 of file uan-phy-gen.cc.

References m_listeners.

Referenced by RxEndEvent().

+ Here is the caller graph for this function:

◆ NotifyListenersRxStart()

void ns3::UanPhyGen::NotifyListenersRxStart ( )
private

Call UanListener::NotifyRxStart on all listeners.

Definition at line 1117 of file uan-phy-gen.cc.

References m_listeners.

Referenced by StartRxPacket().

+ Here is the caller graph for this function:

◆ NotifyListenersTxEnd()

void ns3::UanPhyGen::NotifyListenersTxEnd ( )
private

Call UanListener::NotifyTxEnd on all listeners.

Definition at line 1177 of file uan-phy-gen.cc.

References m_listeners.

Referenced by TxEndEvent().

+ Here is the caller graph for this function:

◆ NotifyListenersTxStart()

void ns3::UanPhyGen::NotifyListenersTxStart ( Time  duration)
private

Call UanListener::NotifyTxStart on all listeners.

Parameters
durationDuration of transmission.

Definition at line 1167 of file uan-phy-gen.cc.

References m_listeners.

Referenced by SendPacket().

+ Here is the caller graph for this function:

◆ NotifyTransStartTx()

void ns3::UanPhyGen::NotifyTransStartTx ( Ptr< Packet packet,
double  txPowerDb,
UanTxMode  txMode 
)
overridevirtual

Called when a transmission is beginning on the attached transducer.

Parameters
packetPacket that is beginning transmission.
txPowerDbTransmit power of packet.
txModeTransmission mode of packet.

Implements ns3::UanPhy.

Definition at line 1051 of file uan-phy-gen.cc.

References m_minRxSinrDb, and m_pktRx.

◆ RegisterListener()

void ns3::UanPhyGen::RegisterListener ( UanPhyListener listener)
overridevirtual

Register a UanPhyListener to be notified of common UanPhy events.

Parameters
listenerNew listener to register.

Implements ns3::UanPhy.

Definition at line 748 of file uan-phy-gen.cc.

References m_listeners.

◆ RxEndEvent()

void ns3::UanPhyGen::RxEndEvent ( Ptr< Packet pkt,
double  rxPowerDb,
UanTxMode  txMode 
)
private

Event to process end of packet reception.

Parameters
pktThe packet.
rxPowerDbReceived signal power.
txModeTransmission mode.

Definition at line 836 of file uan-phy-gen.cc.

References ns3::UanPhy::CCABUSY, ns3::UanPhy::DISABLED, GetInterferenceDb(), ns3::UniformRandomVariable::GetValue(), ns3::UanPhy::IDLE, ns3::Callback< R, UArgs >::IsNull(), m_ccaThreshDb, m_minRxSinrDb, m_per, m_pg, m_pktRx, m_recErrCb, m_recOkCb, m_rxErrLogger, m_rxOkLogger, m_state, NotifyListenersCcaStart(), NotifyListenersRxBad(), NotifyListenersRxGood(), ns3::UanPhy::NotifyRxDrop(), ns3::UanPhy::NotifyRxEnd(), NS_LOG_DEBUG, ns3::UanPhy::SLEEP, and UpdatePowerConsumption().

Referenced by StartRxPacket().

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

◆ SendPacket()

void ns3::UanPhyGen::SendPacket ( Ptr< Packet pkt,
uint32_t  modeNum 
)
overridevirtual

Send a packet using a specific transmission mode.

Parameters
pktPacket to transmit.
modeNumIndex of mode in SupportedModes list to use for transmission.

Implements ns3::UanPhy.

Definition at line 684 of file uan-phy-gen.cc.

References ns3::UanPhy::DISABLED, ns3::UanTxMode::GetDataRateBps(), GetMode(), m_mac, m_minRxSinrDb, m_pktRx, m_pktTx, m_state, m_transducer, m_txEndEvent, m_txLogger, m_txPwrDb, NotifyListenersTxStart(), NS_LOG_DEBUG, ns3::Simulator::Schedule(), ns3::Seconds(), ns3::UanPhy::SLEEP, ns3::UanPhy::TX, TxEndEvent(), and UpdatePowerConsumption().

+ Here is the call graph for this function:

◆ SetCcaThresholdDb()

void ns3::UanPhyGen::SetCcaThresholdDb ( double  thresh)
overridevirtual

Set the threshold for detecting channel busy.

Parameters
threshSignal power threshold at receiver.

Implements ns3::UanPhy.

Definition at line 946 of file uan-phy-gen.cc.

References m_ccaThreshDb.

◆ SetChannel()

void ns3::UanPhyGen::SetChannel ( Ptr< UanChannel channel)
overridevirtual

Attach to a channel.

Parameters
channelThe channel to attach to.

Implements ns3::UanPhy.

Definition at line 988 of file uan-phy-gen.cc.

References m_channel.

◆ SetDevice()

void ns3::UanPhyGen::SetDevice ( Ptr< UanNetDevice device)
overridevirtual

Set the device hosting this Phy.

Parameters
deviceThe device.

Implements ns3::UanPhy.

Definition at line 994 of file uan-phy-gen.cc.

References m_device.

◆ SetEnergyModelCallback()

void ns3::UanPhyGen::SetEnergyModelCallback ( DeviceEnergyModel::ChangeStateCallback  callback)
overridevirtual

Set the DeviceEnergyModel callback for UanPhy device.

Parameters
callbackThe DeviceEnergyModel change state callback.

Implements ns3::UanPhy.

Definition at line 634 of file uan-phy-gen.cc.

References m_energyCallback, and NS_LOG_FUNCTION.

◆ SetMac()

void ns3::UanPhyGen::SetMac ( Ptr< UanMac mac)
overridevirtual

Set the MAC forwarding messages to this Phy.

Parameters
macThe MAC.

Implements ns3::UanPhy.

Definition at line 1000 of file uan-phy-gen.cc.

References m_mac.

◆ SetReceiveErrorCallback()

void ns3::UanPhyGen::SetReceiveErrorCallback ( RxErrCallback  cb)
overridevirtual

Set the callback to be used when a packet is received with errors.

Parameters
cbThe callback.

Implements ns3::UanPhy.

Definition at line 892 of file uan-phy-gen.cc.

References m_recErrCb.

◆ SetReceiveOkCallback()

void ns3::UanPhyGen::SetReceiveOkCallback ( RxOkCallback  cb)
overridevirtual

Set the callback to be used when a packet is received without error.

Parameters
cbThe callback.

Implements ns3::UanPhy.

Definition at line 886 of file uan-phy-gen.cc.

References m_recOkCb.

◆ SetRxThresholdDb()

void ns3::UanPhyGen::SetRxThresholdDb ( double  thresh)
overridevirtual

Set the minimum SINR threshold to receive a packet without errors.

Deprecated:
See UanPhyPer.
Parameters
threshThreshold SINR for proper reception in dB re 1 uPa.

Implements ns3::UanPhy.

Definition at line 940 of file uan-phy-gen.cc.

References m_rxThreshDb.

◆ SetSleepMode()

void ns3::UanPhyGen::SetSleepMode ( bool  sleep)
overridevirtual

Set the Phy SLEEP mode.

Parameters
sleepSLEEP on or off.

Implements ns3::UanPhy.

Definition at line 1013 of file uan-phy-gen.cc.

References ns3::UanPhy::CCABUSY, GetInterferenceDb(), ns3::UanPhy::IDLE, ns3::Callback< R, UArgs >::IsNull(), m_ccaThreshDb, m_energyCallback, m_state, NotifyListenersCcaStart(), and ns3::UanPhy::SLEEP.

+ Here is the call graph for this function:

◆ SetTransducer()

void ns3::UanPhyGen::SetTransducer ( Ptr< UanTransducer trans)
overridevirtual

Attach a transducer to this Phy.

Parameters
transThe transducer.

Implements ns3::UanPhy.

Definition at line 1006 of file uan-phy-gen.cc.

References m_transducer.

◆ SetTxPowerDb()

void ns3::UanPhyGen::SetTxPowerDb ( double  txpwr)
overridevirtual

Set the transmit power.

Parameters
txpwrFinal output transmission power, in dB.

Implements ns3::UanPhy.

Definition at line 934 of file uan-phy-gen.cc.

References m_txPwrDb.

◆ StartRxPacket()

void ns3::UanPhyGen::StartRxPacket ( Ptr< Packet pkt,
double  rxPowerDb,
UanTxMode  txMode,
UanPdp  pdp 
)
overridevirtual

Packet arriving from channel: i.e.

leading bit of packet has arrived.

Parameters
pktPacket which is arriving.
rxPowerDbSignal power of incoming packet in dB re 1 uPa.
txModeTransmission mode defining modulation of incoming packet.
pdpPower delay profile of incoming packet.

Implements ns3::UanPhy.

Definition at line 754 of file uan-phy-gen.cc.

References CalculateSinrDb(), ns3::UanPhy::CCABUSY, ns3::UanPhy::DISABLED, ns3::UanTxMode::GetDataRateBps(), GetInterferenceDb(), GetMode(), GetNModes(), ns3::UanTxMode::GetUid(), ns3::UanPhy::IDLE, m_ccaThreshDb, m_mac, m_minRxSinrDb, m_pktRx, m_pktRxArrTime, m_pktRxMode, m_pktRxPdp, m_rxEndEvent, m_rxRecvPwrDb, m_rxThreshDb, m_state, NotifyListenersCcaStart(), NotifyListenersRxStart(), ns3::UanPhy::NotifyRxBegin(), ns3::UanPhy::NotifyRxDrop(), ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, ns3::UanPhy::RX, RxEndEvent(), ns3::Simulator::Schedule(), ns3::Seconds(), ns3::UanPhy::SLEEP, ns3::UanPhy::TX, and UpdatePowerConsumption().

+ Here is the call graph for this function:

◆ TxEndEvent()

void ns3::UanPhyGen::TxEndEvent ( )
private

Event to process end of packet transmission.

Definition at line 724 of file uan-phy-gen.cc.

References ns3::UanPhy::CCABUSY, ns3::UanPhy::DISABLED, GetInterferenceDb(), ns3::UanPhy::IDLE, m_ccaThreshDb, m_state, NotifyListenersCcaStart(), NotifyListenersTxEnd(), NS_ASSERT, NS_LOG_DEBUG, ns3::UanPhy::SLEEP, ns3::UanPhy::TX, and UpdatePowerConsumption().

Referenced by SendPacket().

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

◆ UpdatePowerConsumption()

void ns3::UanPhyGen::UpdatePowerConsumption ( const State  state)
private

Update energy source with new state.

Parameters
stateThe new Phy state.

Definition at line 641 of file uan-phy-gen.cc.

References ns3::Callback< R, UArgs >::IsNull(), m_energyCallback, and NS_LOG_FUNCTION.

Referenced by RxEndEvent(), SendPacket(), StartRxPacket(), and TxEndEvent().

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

Member Data Documentation

◆ m_ccaThreshDb

double ns3::UanPhyGen::m_ccaThreshDb
private

◆ m_channel

Ptr<UanChannel> ns3::UanPhyGen::m_channel
private

Attached channel.

Definition at line 327 of file uan-phy-gen.h.

Referenced by CalculateSinrDb(), Clear(), GetChannel(), and SetChannel().

◆ m_cleared

bool ns3::UanPhyGen::m_cleared
private

Flag when we've been cleared.

Definition at line 346 of file uan-phy-gen.h.

Referenced by Clear().

◆ m_device

Ptr<UanNetDevice> ns3::UanPhyGen::m_device
private

Device hosting this Phy.

Definition at line 329 of file uan-phy-gen.h.

Referenced by Clear(), EnergyDepletionHandler(), EnergyRechargeHandler(), GetDevice(), and SetDevice().

◆ m_energyCallback

DeviceEnergyModel::ChangeStateCallback ns3::UanPhyGen::m_energyCallback
private

Energy model callback.

Definition at line 355 of file uan-phy-gen.h.

Referenced by UanPhyGen(), DoDispose(), SetEnergyModelCallback(), SetSleepMode(), and UpdatePowerConsumption().

◆ m_listeners

◆ m_mac

Ptr<UanMac> ns3::UanPhyGen::m_mac
private

MAC layer.

Definition at line 330 of file uan-phy-gen.h.

Referenced by Clear(), SendPacket(), SetMac(), and StartRxPacket().

◆ m_minRxSinrDb

double ns3::UanPhyGen::m_minRxSinrDb
private

Minimum receive SINR during packet reception.

Definition at line 340 of file uan-phy-gen.h.

Referenced by NotifyTransStartTx(), RxEndEvent(), SendPacket(), and StartRxPacket().

◆ m_modes

UanModesList ns3::UanPhyGen::m_modes
private

List of modes supported by this PHY.

Definition at line 321 of file uan-phy-gen.h.

Referenced by GetMode(), GetNModes(), and GetTypeId().

◆ m_per

Ptr<UanPhyPer> ns3::UanPhyGen::m_per
private

Error model.

Definition at line 331 of file uan-phy-gen.h.

Referenced by Clear(), GetTypeId(), and RxEndEvent().

◆ m_pg

Ptr<UniformRandomVariable> ns3::UanPhyGen::m_pg
private

Provides uniform random variables.

Definition at line 352 of file uan-phy-gen.h.

Referenced by UanPhyGen(), AssignStreams(), and RxEndEvent().

◆ m_pktRx

Ptr<Packet> ns3::UanPhyGen::m_pktRx
private

Received packet.

Definition at line 338 of file uan-phy-gen.h.

Referenced by Clear(), EnergyDepletionHandler(), GetPacketRx(), NotifyTransStartTx(), RxEndEvent(), SendPacket(), and StartRxPacket().

◆ m_pktRxArrTime

Time ns3::UanPhyGen::m_pktRxArrTime
private

Packet arrival time.

Definition at line 342 of file uan-phy-gen.h.

Referenced by StartRxPacket().

◆ m_pktRxMode

UanTxMode ns3::UanPhyGen::m_pktRxMode
private

Packet transmission mode at receiver.

Definition at line 344 of file uan-phy-gen.h.

Referenced by StartRxPacket().

◆ m_pktRxPdp

UanPdp ns3::UanPhyGen::m_pktRxPdp
private

Power delay profile of packet.

Definition at line 343 of file uan-phy-gen.h.

Referenced by StartRxPacket().

◆ m_pktTx

Ptr<Packet> ns3::UanPhyGen::m_pktTx
private

Sent packet.

Definition at line 339 of file uan-phy-gen.h.

Referenced by EnergyDepletionHandler(), and SendPacket().

◆ m_recErrCb

RxErrCallback ns3::UanPhyGen::m_recErrCb
private

Callback for packets received with errors.

Definition at line 326 of file uan-phy-gen.h.

Referenced by RxEndEvent(), and SetReceiveErrorCallback().

◆ m_recOkCb

RxOkCallback ns3::UanPhyGen::m_recOkCb
private

Callback for packets received without error.

Definition at line 325 of file uan-phy-gen.h.

Referenced by RxEndEvent(), and SetReceiveOkCallback().

◆ m_rxEndEvent

EventId ns3::UanPhyGen::m_rxEndEvent
private

Rx event.

Definition at line 349 of file uan-phy-gen.h.

Referenced by EnergyDepletionHandler(), and StartRxPacket().

◆ m_rxErrLogger

ns3::TracedCallback<Ptr<const Packet>, double, UanTxMode> ns3::UanPhyGen::m_rxErrLogger
private

A packet destined for this Phy was received with error.

Definition at line 359 of file uan-phy-gen.h.

Referenced by GetTypeId(), and RxEndEvent().

◆ m_rxOkLogger

ns3::TracedCallback<Ptr<const Packet>, double, UanTxMode> ns3::UanPhyGen::m_rxOkLogger
private

A packet destined for this Phy was received without error.

Definition at line 357 of file uan-phy-gen.h.

Referenced by GetTypeId(), and RxEndEvent().

◆ m_rxRecvPwrDb

double ns3::UanPhyGen::m_rxRecvPwrDb
private

Receiver power.

Definition at line 341 of file uan-phy-gen.h.

Referenced by StartRxPacket().

◆ m_rxThreshDb

double ns3::UanPhyGen::m_rxThreshDb
private

Receive SINR threshold.

Definition at line 335 of file uan-phy-gen.h.

Referenced by GetRxThresholdDb(), GetTypeId(), SetRxThresholdDb(), and StartRxPacket().

◆ m_sinr

Ptr<UanPhyCalcSinr> ns3::UanPhyGen::m_sinr
private

SINR calculator.

Definition at line 332 of file uan-phy-gen.h.

Referenced by CalculateSinrDb(), Clear(), and GetTypeId().

◆ m_state

◆ m_transducer

Ptr<UanTransducer> ns3::UanPhyGen::m_transducer
private

Associated transducer.

Definition at line 328 of file uan-phy-gen.h.

Referenced by CalculateSinrDb(), Clear(), GetInterferenceDb(), GetTransducer(), SendPacket(), and SetTransducer().

◆ m_txEndEvent

EventId ns3::UanPhyGen::m_txEndEvent
private

Tx event.

Definition at line 348 of file uan-phy-gen.h.

Referenced by EnergyDepletionHandler(), and SendPacket().

◆ m_txLogger

ns3::TracedCallback<Ptr<const Packet>, double, UanTxMode> ns3::UanPhyGen::m_txLogger
private

A packet was sent from this Phy.

Definition at line 361 of file uan-phy-gen.h.

Referenced by GetTypeId(), and SendPacket().

◆ m_txPwrDb

double ns3::UanPhyGen::m_txPwrDb
private

Transmit power.

Definition at line 334 of file uan-phy-gen.h.

Referenced by GetTxPowerDb(), GetTypeId(), SendPacket(), and SetTxPowerDb().


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