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