A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ns3::UanPhyGen Class Reference

Generic PHY model. More...

#include <introspected-doxygen.h>

+ Inheritance diagram for ns3::UanPhyGen:

Public Member Functions

int64_t AssignStreams (int64_t stream)
 
virtual void Clear (void)
 
virtual void EnergyDepletionHandler (void)
 
virtual double GetCcaThresholdDb (void)
 
virtual Ptr< UanChannelGetChannel (void) const
 
virtual Ptr< UanNetDeviceGetDevice (void)
 
virtual UanTxMode GetMode (uint32_t n)
 
virtual uint32_t GetNModes (void)
 
virtual Ptr< PacketGetPacketRx (void) const
 
virtual double GetRxGainDb (void)
 
virtual double GetRxThresholdDb (void)
 
virtual Ptr< UanTransducerGetTransducer (void)
 
virtual double GetTxPowerDb (void)
 
virtual bool IsStateBusy (void)
 
virtual bool IsStateCcaBusy (void)
 
virtual bool IsStateIdle (void)
 
virtual bool IsStateRx (void)
 
virtual bool IsStateSleep (void)
 
virtual bool IsStateTx (void)
 
virtual void NotifyIntChange (void)
 
virtual void NotifyTransStartTx (Ptr< Packet > packet, double txPowerDb, UanTxMode txMode)
 
virtual void RegisterListener (UanPhyListener *listener)
 
virtual void SendPacket (Ptr< Packet > pkt, uint32_t modeNum)
 
virtual void SetCcaThresholdDb (double thresh)
 
virtual void SetChannel (Ptr< UanChannel > channel)
 
virtual void SetDevice (Ptr< UanNetDevice > device)
 
virtual void SetEnergyModelCallback (DeviceEnergyModel::ChangeStateCallback cb)
 
virtual void SetMac (Ptr< UanMac > mac)
 
virtual void SetReceiveErrorCallback (RxErrCallback cb)
 
virtual void SetReceiveOkCallback (RxOkCallback cb)
 
virtual void SetRxGainDb (double gain)
 
virtual void SetRxThresholdDb (double thresh)
 
virtual void SetSleepMode (bool sleep)
 
virtual void SetTransducer (Ptr< UanTransducer > trans)
 
virtual void SetTxPowerDb (double txpwr)
 
virtual void StartRxPacket (Ptr< Packet > pkt, double rxPowerDb, UanTxMode txMode, UanPdp pdp)
 Packet arriving from channel: i.e. leading bit of packet has arrived. More...
 
- Public Member Functions inherited from ns3::UanPhy
void NotifyRxBegin (Ptr< const Packet > packet)
 
void NotifyRxDrop (Ptr< const Packet > packet)
 
void NotifyRxEnd (Ptr< const Packet > packet)
 
void NotifyTxBegin (Ptr< const Packet > packet)
 
void NotifyTxDrop (Ptr< const Packet > packet)
 
void NotifyTxEnd (Ptr< const Packet > packet)
 
- Public Member Functions inherited from ns3::Object
void AggregateObject (Ptr< Object > other)
 
void Dispose (void)
 
AggregateIterator GetAggregateIterator (void) const
 
virtual TypeId GetInstanceTypeId (void) const
 
template<typename T >
Ptr< T > GetObject (void) const
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 
void Initialize (void)
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount (const SimpleRefCount &o)
 
uint32_t GetReferenceCount (void) const
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 
void Ref (void) const
 
void Unref (void) const
 
- Public Member Functions inherited from ns3::ObjectBase
void GetAttribute (std::string name, AttributeValue &value) const
 
bool GetAttributeFailSafe (std::string name, AttributeValue &attribute) const
 
void SetAttribute (std::string name, const AttributeValue &value)
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 

Static Public Member Functions

static UanModesList GetDefaultModes (void)
 
static TypeId GetTypeId (void)
 
- Static Public Member Functions inherited from ns3::UanPhy
static TypeId GetTypeId (void)
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 
- Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
static void Cleanup (void)
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 

Protected Member Functions

virtual void DoDispose ()
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 
virtual void DoInitialize (void)
 
virtual void NotifyNewAggregate (void)
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 
virtual void NotifyConstructionCompleted (void)
 

Private Types

typedef std::list
< UanPhyListener * > 
ListenerList
 

Private Member Functions

double CalculateSinrDb (Ptr< Packet > pkt, Time arrTime, double rxPowerDb, UanTxMode mode, UanPdp pdp)
 
double DbToKp (double db)
 
double GetInterferenceDb (Ptr< Packet > pkt)
 
double KpToDb (double kp)
 
void NotifyListenersCcaEnd (void)
 
void NotifyListenersCcaStart (void)
 
void NotifyListenersRxBad (void)
 
void NotifyListenersRxGood (void)
 
void NotifyListenersRxStart (void)
 
void NotifyListenersTxStart (Time duration)
 
void RxEndEvent (Ptr< Packet > pkt, double rxPowerDb, UanTxMode txMode)
 
void TxEndEvent ()
 
void UpdatePowerConsumption (const State state)
 

Private Attributes

double m_ccaThreshDb
 
Ptr< UanChannelm_channel
 
bool m_cleared
 
Ptr< UanNetDevicem_device
 
bool m_disabled
 
DeviceEnergyModel::ChangeStateCallback m_energyCallback
 
ListenerList m_listeners
 
Ptr< UanMacm_mac
 
double m_minRxSinrDb
 
UanModesList m_modes
 
Ptr< UanPhyPerm_per
 
Ptr< UniformRandomVariablem_pg
 Provides uniform random variables.
 
Ptr< Packetm_pktRx
 
Time m_pktRxArrTime
 
UanTxMode m_pktRxMode
 
UanPdp m_pktRxPdp
 
RxErrCallback m_recErrCb
 
RxOkCallback m_recOkCb
 
TracedCallback< Ptr< const
Packet >, double, UanTxMode
m_rxErrLogger
 
double m_rxGainDb
 
TracedCallback< Ptr< const
Packet >, double, UanTxMode
m_rxOkLogger
 
double m_rxRecvPwrDb
 
double m_rxThreshDb
 
Ptr< UanPhyCalcSinrm_sinr
 
State m_state
 
Ptr< UanTransducerm_transducer
 
TracedCallback< Ptr< const
Packet >, double, UanTxMode
m_txLogger
 
double m_txPwrDb
 

Additional Inherited Members

- Public Types inherited from ns3::UanPhy
typedef Callback< void, Ptr
< Packet >, double > 
RxErrCallback
 
typedef Callback< void, Ptr
< Packet >, double, UanTxMode
RxOkCallback
 
enum  State {
  IDLE, CCABUSY, RX, TX,
  SLEEP
}
 Enum defining possible Phy states.
 

Detailed Description

Generic PHY model.

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: construct write read
  • 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: construct write read
  • TxPower: Transmission output power in dB
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 190
    • Flags: construct write read
  • RxGain: Gain added to incoming signal at receiver
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 0
    • Flags: construct write read
  • SupportedModes: List of modes supported by this PHY
    • Set with class: UanModesListValue
    • Underlying type: UanModesList
    • Initial value: 2|0|1|
    • Flags: construct write read
  • PerModel: Functor to calculate PER based on SINR and TxMode
    • Set with class: ns3::PointerValue
    • Underlying type: ns3::Ptr< ns3::UanPhyPer >
    • Initial value: 0x1059470
    • Flags: construct write read
  • SinrModel: Functor to calculate SINR based on pkt arrivals and modes
    • Set with class: ns3::PointerValue
    • Underlying type: ns3::Ptr< ns3::UanPhyCalcSinr >
    • Initial value: 0x10592f0
    • Flags: construct write read

TraceSources

  • RxOk: A packet was received successfully
  • RxError: A packet was received unsuccessfully
  • Tx: Packet transmission beginning

TraceSources defined in parent class ns3::UanPhy

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

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.

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

Member Function Documentation

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

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 869 of file uan-phy-gen.cc.

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

void ns3::UanPhyGen::Clear ( void  )
virtual

Clears all pointer references

Implements ns3::UanPhy.

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

Referenced by DoDispose().

void ns3::UanPhyGen::DoDispose ( void  )
protectedvirtual

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

Subclasses are expected to implement their real destruction code in an overriden 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 412 of file uan-phy-gen.cc.

References Clear(), and ns3::Object::DoDispose().

void ns3::UanPhyGen::EnergyDepletionHandler ( void  )
virtual

This function handles the energy depletion event. Must be implemented by UanPhy child classes.

Implements ns3::UanPhy.

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

References NS_LOG_DEBUG, and NS_LOG_FUNCTION.

double ns3::UanPhyGen::GetCcaThresholdDb ( void  )
virtual
Returns
Threshold signal strength in dB to enter CCA busy mode

Implements ns3::UanPhy.

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

Ptr< UanChannel > ns3::UanPhyGen::GetChannel ( void  ) const
virtual
Returns
Channel this phy is attached to

Implements ns3::UanPhy.

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

UanModesList ns3::UanPhyGen::GetDefaultModes ( void  )
static
Returns
Default TX modes of UanPhyGen

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

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

Ptr< UanNetDevice > ns3::UanPhyGen::GetDevice ( void  )
virtual
Returns
the Net Device that this Phy is a part of

Implements ns3::UanPhy.

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

UanTxMode ns3::UanPhyGen::GetMode ( uint32_t  n)
virtual
Parameters
nMode number of mode to return (place in Modeslist)
Returns
Mode n

Implements ns3::UanPhy.

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

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

Referenced by SendPacket(), and StartRxPacket().

uint32_t ns3::UanPhyGen::GetNModes ( void  )
virtual
Returns
Number of TX modes supported by this PHY

Implements ns3::UanPhy.

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

References ns3::UanModesList::GetNModes().

Referenced by StartRxPacket().

Ptr< Packet > ns3::UanPhyGen::GetPacketRx ( void  ) const
virtual
Warning
Returns non-valid pointer if IsStateRx == false
Returns
Packet currently being received in PHY

Implements ns3::UanPhy.

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

double ns3::UanPhyGen::GetRxGainDb ( void  )
virtual
Returns
Gain added to signal at receiver in dB

Implements ns3::UanPhy.

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

double ns3::UanPhyGen::GetRxThresholdDb ( void  )
virtual
Returns
Required signal strength, in dB, to begin receiving packet

Implements ns3::UanPhy.

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

Ptr< UanTransducer > ns3::UanPhyGen::GetTransducer ( void  )
virtual
Returns
Transducer this Phy outputs to / receives from

Implements ns3::UanPhy.

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

double ns3::UanPhyGen::GetTxPowerDb ( void  )
virtual
Returns
Current TX power output

Implements ns3::UanPhy.

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

bool ns3::UanPhyGen::IsStateBusy ( void  )
virtual
Returns
True if Phy is not IDLE

Implements ns3::UanPhy.

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

References IsStateIdle(), and IsStateSleep().

bool ns3::UanPhyGen::IsStateCcaBusy ( void  )
virtual
Returns
True if Phy is not TX or RX but the channel is sensed busy

Implements ns3::UanPhy.

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

bool ns3::UanPhyGen::IsStateIdle ( void  )
virtual
Returns
True if Phy is IDLE

Implements ns3::UanPhy.

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

Referenced by IsStateBusy().

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

Implements ns3::UanPhy.

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

bool ns3::UanPhyGen::IsStateSleep ( void  )
virtual
Returns
True if Phy is SLEEP

Implements ns3::UanPhy.

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

Referenced by IsStateBusy().

bool ns3::UanPhyGen::IsStateTx ( void  )
virtual
Returns
True if Phy is busy transmitting

Implements ns3::UanPhy.

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

void ns3::UanPhyGen::NotifyIntChange ( void  )
virtual

Function called when there has been a change in the ammount of interference this node is experiencing from other transmissions

Implements ns3::UanPhy.

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

void ns3::UanPhyGen::NotifyTransStartTx ( Ptr< Packet packet,
double  txPowerDb,
UanTxMode  txMode 
)
virtual
Parameters
packetPacket that is beginning transmission
txPowerDbTransmit power of packet
txModeTransmission mode of packet

Notification that there is a transmission beginning on the transducer that this Phy is attached to.

Implements ns3::UanPhy.

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

void ns3::UanPhyGen::RegisterListener ( UanPhyListener listener)
virtual
Parameters
listenerNew listener to register

Register an object to be notified of common Phy events

Implements ns3::UanPhy.

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

void ns3::UanPhyGen::SendPacket ( Ptr< Packet pkt,
uint32_t  modeNum 
)
virtual
Parameters
pktPacket to transmit
modeNumIndex of mode in SupportedModes list to use for transmission

Implements ns3::UanPhy.

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

References ns3::UanTxMode::GetDataRateBps(), GetMode(), ns3::Packet::GetSize(), NS_LOG_DEBUG, ns3::Simulator::Schedule(), and ns3::Seconds().

void ns3::UanPhyGen::SetCcaThresholdDb ( double  thresh)
virtual
Parameters
threshSignal power at receiver required for CCA busy state

Implements ns3::UanPhy.

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

void ns3::UanPhyGen::SetChannel ( Ptr< UanChannel channel)
virtual
Parameters
channelThe channel this Phy is attached to

Implements ns3::UanPhy.

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

void ns3::UanPhyGen::SetDevice ( Ptr< UanNetDevice device)
virtual
Parameters
deviceThe Net Device this Phy is a part of

Implements ns3::UanPhy.

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

void ns3::UanPhyGen::SetEnergyModelCallback ( DeviceEnergyModel::ChangeStateCallback  callback)
virtual
Parameters
callbackDeviceEnergyModel change state callback.

This function sets the DeviceEnergyModel callback for UanPhy device. Must be implemented by UanPhy child classes.

Implements ns3::UanPhy.

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

References NS_LOG_FUNCTION.

void ns3::UanPhyGen::SetMac ( Ptr< UanMac mac)
virtual
Parameters
macThe MAC forwarding messages to this Phy

Implements ns3::UanPhy.

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

void ns3::UanPhyGen::SetReceiveErrorCallback ( RxErrCallback  cb)
virtual
Parameters
cbCallback to be enabled when a packet is received with errors

Implements ns3::UanPhy.

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

void ns3::UanPhyGen::SetReceiveOkCallback ( RxOkCallback  cb)
virtual
Parameters
cbCallback to be enabled when packet is received without error

Implements ns3::UanPhy.

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

void ns3::UanPhyGen::SetRxGainDb ( double  gain)
virtual
Parameters
gainGain added at receiver

Implements ns3::UanPhy.

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

void ns3::UanPhyGen::SetRxThresholdDb ( double  thresh)
virtual
Parameters
threshThreshold SINR for propper reception in dB

Implements ns3::UanPhy.

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

void ns3::UanPhyGen::SetTransducer ( Ptr< UanTransducer trans)
virtual
Parameters
transTransducer this Phy outputs to / receives from

Implements ns3::UanPhy.

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

void ns3::UanPhyGen::SetTxPowerDb ( double  txpwr)
virtual
Parameters
txpwrFinal output transmission power in dB

Implements ns3::UanPhy.

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

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

Packet arriving from channel: i.e. leading bit of packet has arrived.

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

Implements ns3::UanPhy.

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

References ns3::UanTxMode::GetDataRateBps(), GetMode(), GetNModes(), ns3::Packet::GetSize(), ns3::UanTxMode::GetUid(), ns3::UanPhy::NotifyRxBegin(), ns3::UanPhy::NotifyRxDrop(), ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, ns3::Simulator::Schedule(), and ns3::Seconds().


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