27 #include "ns3/traced-callback.h"
28 #include "ns3/nstime.h"
29 #include "ns3/device-energy-model.h"
30 #include "ns3/random-variable-stream.h"
31 #include "ns3/event-id.h"
113 double NChooseK (uint32_t n, uint32_t
k);
319 virtual void Clear (
void);
401 double DbToKp (
double db);
410 double KpToDb (
double kp);
An identifier for simulation events.
Simulation virtual time values and global simulation resolution.
Forward calls to a chain of Callback.
a unique identifier for an interface.
Container for UanTxModes.
The power delay profile returned by propagation models.
Default SINR calculator for UanPhyGen.
UanPhyCalcSinrDefault()
Constructor.
virtual double CalcSinrDb(Ptr< Packet > pkt, Time arrTime, double rxPowerDb, double ambNoiseDb, UanTxMode mode, UanPdp pdp, const UanTransducer::ArrivalList &arrivalList) const
Calculate the SINR value for a packet.
static TypeId GetTypeId(void)
Register this type.
virtual ~UanPhyCalcSinrDefault()
Destructor.
WHOI Micromodem like FH-FSK model.
UanPhyCalcSinrFhFsk()
Constructor.
virtual double CalcSinrDb(Ptr< Packet > pkt, Time arrTime, double rxPowerDb, double ambNoiseDb, UanTxMode mode, UanPdp pdp, const UanTransducer::ArrivalList &arrivalList) const
Calculate the SINR value for a packet.
virtual ~UanPhyCalcSinrFhFsk()
Destructor.
static TypeId GetTypeId(void)
Register this type.
uint32_t m_hops
Number of hops.
Class used for calculating SINR of packet in UanPhy.
virtual Ptr< UanNetDevice > GetDevice(void) const
Get the device hosting this Phy.
void NotifyListenersRxStart(void)
Call UanListener::NotifyRxStart on all listeners.
double KpToDb(double kp)
Convert kilopascals to dB.
virtual Ptr< UanTransducer > GetTransducer(void)
Get the attached transducer.
Ptr< UanPhyPer > m_per
Error model.
ns3::TracedCallback< Ptr< const Packet >, double, UanTxMode > m_rxOkLogger
A packet destined for this Phy was received without error.
virtual uint32_t GetNModes(void)
Get the number of transmission modes supported by this Phy.
ns3::TracedCallback< Ptr< const Packet >, double, UanTxMode > m_txLogger
A packet was sent from this Phy.
virtual void SetRxThresholdDb(double thresh)
Set the minimum SINR threshold to receive a packet without errors.
virtual void EnergyRechargeHandler(void)
Handle the energy recharge event.
ns3::TracedCallback< Ptr< const Packet >, double, UanTxMode > m_rxErrLogger
A packet destined for this Phy was received with error.
void NotifyListenersTxStart(Time duration)
Call UanListener::NotifyTxStart on all listeners.
virtual bool IsStateRx(void)
Time m_pktRxArrTime
Packet arrival time.
virtual void StartRxPacket(Ptr< Packet > pkt, double rxPowerDb, UanTxMode txMode, UanPdp pdp)
Packet arriving from channel: i.e.
virtual void SetSleepMode(bool sleep)
Set the Phy SLEEP mode.
void UpdatePowerConsumption(const State state)
Update energy source with new state.
void NotifyListenersTxEnd(void)
Call UanListener::NotifyTxEnd on all listeners.
ListenerList m_listeners
List of listeners.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
double m_rxRecvPwrDb
Receiver power.
virtual void SetChannel(Ptr< UanChannel > channel)
Attach to a channel.
virtual Ptr< UanChannel > GetChannel(void) const
Get the attached channel.
Ptr< UanPhyCalcSinr > m_sinr
SINR calculator.
Ptr< Packet > m_pktRx
Received packet.
static UanModesList GetDefaultModes(void)
Get the default transmission modes.
virtual ~UanPhyGen()
Dummy destructor, see DoDispose.
DeviceEnergyModel::ChangeStateCallback m_energyCallback
Energy model callback.
Ptr< UanTransducer > m_transducer
Associated transducer.
double m_rxThreshDb
Receive SINR threshold.
EventId m_rxEndEvent
Rx event.
std::list< UanPhyListener * > ListenerList
List of Phy Listeners.
double m_ccaThreshDb
CCA busy threshold.
virtual bool IsStateSleep(void)
virtual void RegisterListener(UanPhyListener *listener)
Register a UanPhyListener to be notified of common UanPhy events.
RxOkCallback m_recOkCb
Callback for packets received without error.
virtual void SendPacket(Ptr< Packet > pkt, uint32_t modeNum)
Send a packet using a specific transmission mode.
virtual void SetDevice(Ptr< UanNetDevice > device)
Set the device hosting this Phy.
Ptr< UanMac > m_mac
MAC layer.
virtual void SetTransducer(Ptr< UanTransducer > trans)
Attach a transducer to this Phy.
double GetInterferenceDb(Ptr< Packet > pkt)
Calculate interference power from overlapping packet arrivals, in dB.
double m_txPwrDb
Transmit power.
double CalculateSinrDb(Ptr< Packet > pkt, Time arrTime, double rxPowerDb, UanTxMode mode, UanPdp pdp)
Calculate the SINR value for a packet.
void NotifyListenersCcaStart(void)
Call UanListener::NotifyCcaStart on all listeners.
static TypeId GetTypeId(void)
Register this type.
Ptr< UniformRandomVariable > m_pg
Provides uniform random variables.
virtual void DoDispose()
Destructor implementation.
virtual void SetTxPowerDb(double txpwr)
Set the transmit power.
EventId m_txEndEvent
Tx event.
virtual void NotifyTransStartTx(Ptr< Packet > packet, double txPowerDb, UanTxMode txMode)
Called when a transmission is beginning on the attached transducer.
virtual void SetReceiveOkCallback(RxOkCallback cb)
Set the callback to be used when a packet is received without error.
bool m_cleared
Flag when we've been cleared.
virtual bool IsStateCcaBusy(void)
virtual void EnergyDepletionHandler(void)
Handle the energy depletion event.
virtual void SetMac(Ptr< UanMac > mac)
Set the MAC forwarding messages to this Phy.
virtual double GetTxPowerDb(void)
Get the current transmit power, in dB.
double m_minRxSinrDb
Minimum receive SINR during packet reception.
void NotifyListenersRxBad(void)
Call UanListener::NotifyRxEndError on all listeners.
Ptr< UanChannel > m_channel
Attached channel.
virtual Ptr< Packet > GetPacketRx(void) const
Get the packet currently being received.
double DbToKp(double db)
Convert dB to kilopascals.
UanTxMode m_pktRxMode
Packet transmission mode at receiver.
void TxEndEvent()
Event to process end of packet transmission.
virtual bool IsStateTx(void)
virtual UanTxMode GetMode(uint32_t n)
Get a specific transmission mode.
virtual void SetCcaThresholdDb(double thresh)
Set the threshold for detecting channel busy.
RxErrCallback m_recErrCb
Callback for packets received with errors.
virtual bool IsStateIdle(void)
void RxEndEvent(Ptr< Packet > pkt, double rxPowerDb, UanTxMode txMode)
Event to process end of packet reception.
virtual double GetCcaThresholdDb(void)
Get the CCA threshold signal strength required to detect channel busy.
Ptr< UanNetDevice > m_device
Device hosting this Phy.
virtual void Clear(void)
Clear all pointer references.
virtual void SetReceiveErrorCallback(RxErrCallback cb)
Set the callback to be used when a packet is received with errors.
Ptr< Packet > m_pktTx
Sent packet.
virtual void SetEnergyModelCallback(DeviceEnergyModel::ChangeStateCallback cb)
Set the DeviceEnergyModel callback for UanPhy device.
void NotifyListenersRxGood(void)
Call UanListener::NotifyRxEndOk on all listeners.
UanPdp m_pktRxPdp
Power delay profile of packet.
virtual double GetRxThresholdDb(void)
Get the minimum received signal strength required to receive a packet without errors.
UanModesList m_modes
List of modes supported by this PHY.
virtual bool IsStateBusy(void)
virtual void NotifyIntChange(void)
Called when there has been a change in the amount of interference this node is experiencing from othe...
void NotifyListenersCcaEnd(void)
Call UanListener::NotifyCcaEnd on all listeners.
Base class for UAN Phy models.
State
Enum defining possible Phy states.
Interface for PHY event listener.
Packet error rate calculation for common tx modes based on UanPhyPerUmodem.
virtual ~UanPhyPerCommonModes()
Destructor.
virtual double CalcPer(Ptr< Packet > pkt, double sinrDb, UanTxMode mode)
Calculate the Packet ERror probability based on SINR at the receiver and a tx mode.
static TypeId GetTypeId(void)
Register this type.
UanPhyPerCommonModes()
Constructor.
Default Packet Error Rate calculator for UanPhyGen.
UanPhyPerGenDefault()
Constructor.
static TypeId GetTypeId(void)
Register this type.
virtual double CalcPer(Ptr< Packet > pkt, double sinrDb, UanTxMode mode)
Calculate the packet error probability based on SINR at the receiver and a tx mode.
virtual ~UanPhyPerGenDefault()
Destructor.
double m_thresh
SINR threshold.
Calculate packet error probability, based on received SINR and modulation (mode).
Packet error rate calculation assuming WHOI Micromodem-like PHY (FH-FSK)
static TypeId GetTypeId(void)
Register this type.
virtual double CalcPer(Ptr< Packet > pkt, double sinrDb, UanTxMode mode)
Calculate the packet error probability based on SINR at the receiver and a tx mode.
double NChooseK(uint32_t n, uint32_t k)
Binomial coefficient.
UanPhyPerUmodem()
Constructor.
virtual ~UanPhyPerUmodem()
Destructor.
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.