18#include "ns3/device-energy-model.h"
19#include "ns3/object.h"
69 inline double DbToKp(
double db)
const
71 return std::pow(10, db / 10.0);
80 inline double KpToDb(
double kp)
const
82 return 10 * std::log10(kp);
118 virtual void Clear();
A base class which provides memory management and object aggregation.
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Forward calls to a chain of Callback.
a unique identifier for an interface.
The power delay profile returned by propagation models.
Class used for calculating SINR of packet in UanPhy.
static TypeId GetTypeId()
Register this type.
double DbToKp(double db) const
Convert dB re 1 uPa to kilopascals.
virtual void Clear()
Clear all pointer references.
void DoDispose() override
Destructor implementation.
virtual double CalcSinrDb(Ptr< Packet > pkt, Time arrTime, double rxPowerDb, double ambNoiseDb, UanTxMode mode, UanPdp pdp, const UanTransducer::ArrivalList &arrivalList) const =0
Calculate the SINR value for a packet.
double KpToDb(double kp) const
Convert kilopascals to dB re 1 uPa.
Base class for UAN Phy models.
virtual bool IsStateRx()=0
Callback< void, Ptr< Packet >, double, UanTxMode > RxOkCallback
Packet received successfully callback function type.
virtual void SetTxPowerDb(double txpwr)=0
Set the transmit power.
virtual double GetTxPowerDb()=0
Get the current transmit power, in dB.
static TypeId GetTypeId()
Register this type.
virtual Ptr< Packet > GetPacketRx() const =0
Get the packet currently being received.
virtual uint32_t GetNModes()=0
Get the number of transmission modes supported by this Phy.
virtual void SetChannel(Ptr< UanChannel > channel)=0
Attach to a channel.
virtual bool IsStateTx()=0
void NotifyTxDrop(Ptr< const Packet > packet)
Called when the transducer attempts to transmit a new packet while already transmitting a prior packe...
ns3::TracedCallback< Ptr< const Packet > > m_phyRxBeginTrace
Trace source indicating a packet has begun being received from the channel medium by the device.
virtual void SetTransducer(Ptr< UanTransducer > trans)=0
Attach a transducer to this Phy.
virtual void SetEnergyModelCallback(energy::DeviceEnergyModel::ChangeStateCallback callback)=0
Set the DeviceEnergyModel callback for UanPhy device.
virtual void SetCcaThresholdDb(double thresh)=0
Set the threshold for detecting channel busy.
void NotifyTxEnd(Ptr< const Packet > packet)
Called when the transducer finishes transmitting a packet.
void NotifyRxDrop(Ptr< const Packet > packet)
Called when the Phy drops a packet.
virtual void StartRxPacket(Ptr< Packet > pkt, double rxPowerDb, UanTxMode txMode, UanPdp pdp)=0
Packet arriving from channel: i.e.
virtual void SetDevice(Ptr< UanNetDevice > device)=0
Set the device hosting this Phy.
ns3::TracedCallback< Ptr< const Packet > > m_phyTxDropTrace
Trace source indicating a packet has been dropped by the device during transmission.
virtual double GetRxThresholdDb()=0
Get the minimum received signal strength required to receive a packet without errors.
ns3::TracedCallback< Ptr< const Packet > > m_phyRxDropTrace
Trace source indicating a packet has been dropped by the device during reception.
ns3::TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
Trace source indicating a packet has been completely received from the channel medium by the device.
virtual void NotifyIntChange()=0
Called when there has been a change in the amount of interference this node is experiencing from othe...
virtual void NotifyTransStartTx(Ptr< Packet > packet, double txPowerDb, UanTxMode txMode)=0
Called when a transmission is beginning on the attached transducer.
virtual UanTxMode GetMode(uint32_t n)=0
Get a specific transmission mode.
virtual bool IsStateSleep()=0
virtual void EnergyRechargeHandler()=0
Handle the energy recharge event.
virtual void RegisterListener(UanPhyListener *listener)=0
Register a UanPhyListener to be notified of common UanPhy events.
virtual void EnergyDepletionHandler()=0
Handle the energy depletion event.
ns3::TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
Trace source indicating a packet has been completely transmitted over the channel.
virtual bool IsStateIdle()=0
virtual Ptr< UanChannel > GetChannel() const =0
Get the attached channel.
virtual Ptr< UanNetDevice > GetDevice() const =0
Get the device hosting this Phy.
virtual void SetReceiveErrorCallback(RxErrCallback cb)=0
Set the callback to be used when a packet is received with errors.
virtual bool IsStateBusy()=0
virtual bool IsStateCcaBusy()=0
virtual void SetRxThresholdDb(double thresh)=0
Set the minimum SINR threshold to receive a packet without errors.
ns3::TracedCallback< Ptr< const Packet > > m_phyTxBeginTrace
Trace source indicating a packet has begun transmitting over the channel medium.
virtual void SetMac(Ptr< UanMac > mac)=0
Set the MAC forwarding messages to this Phy.
virtual void SendPacket(Ptr< Packet > pkt, uint32_t modeNum)=0
Send a packet using a specific transmission mode.
virtual void SetReceiveOkCallback(RxOkCallback cb)=0
Set the callback to be used when a packet is received without error.
void NotifyRxBegin(Ptr< const Packet > packet)
Called when the Phy begins to receive a packet.
virtual int64_t AssignStreams(int64_t stream)=0
Assign a fixed random variable stream number to the random variables used by this model.
void NotifyRxEnd(Ptr< const Packet > packet)
Called when a packet is received without error.
virtual Ptr< UanTransducer > GetTransducer()=0
Get the attached transducer.
Callback< void, Ptr< Packet >, double > RxErrCallback
Packet receive error callback function type.
virtual double GetCcaThresholdDb()=0
Get the CCA threshold signal strength required to detect channel busy.
void NotifyTxBegin(Ptr< const Packet > packet)
Called when the transducer begins transmitting a packet.
virtual void Clear()=0
Clear all pointer references.
State
Enum defining possible Phy states.
virtual void SetSleepMode(bool sleep)=0
Set the Phy SLEEP mode.
Interface for PHY event listener.
virtual ~UanPhyListener()
Default destructor.
virtual void NotifyRxStart()=0
Called when UanPhy begins receiving packet.
virtual void NotifyTxStart(Time duration)=0
Called when transmission starts from Phy object.
virtual void NotifyRxEndError()=0
Called when UanPhy finishes receiving packet in error.
virtual void NotifyTxEnd()=0
Function called when Phy object finishes transmitting packet.
virtual void NotifyCcaStart()=0
Called when UanPhy begins sensing channel is busy.
virtual void NotifyCcaEnd()=0
Called when UanPhy stops sensing channel is busy.
virtual void NotifyRxEndOk()=0
Called when UanPhy finishes receiving packet without error.
Calculate packet error probability, based on received SINR and modulation (mode).
virtual void Clear()
Clear all pointer references.
static TypeId GetTypeId()
Register this type.
virtual double CalcPer(Ptr< Packet > pkt, double sinrDb, UanTxMode mode)=0
Calculate the packet error probability based on SINR at the receiver and a tx mode.
void DoDispose() override
Destructor implementation.
std::list< UanPacketArrival > ArrivalList
List of arriving packets overlapping in time.
Abstraction of packet modulation information.
Every class exported by the ns3 library is enclosed in the ns3 namespace.