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);
virtual void NotifyTransStartTx(Ptr< Packet > packet, double txPowerDb, UanTxMode txMode)
Called when a transmission is beginning on the attached 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.
Simulation virtual time values and 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.
Ptr< Packet > m_pktTx
Sent packet.
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 Callback.
Packet error rate calculation for common tx modes based on UanPhyPerUmodem.
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 (FH-FSK)
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.
EventId m_rxEndEvent
Rx event.
double m_rxThreshDb
Receive SINR threshold.
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.
EventId m_txEndEvent
Tx event.
Ptr< UanPhyPer > m_per
Error model.
virtual void DoDispose()
Destructor implementation.
Time m_pktRxArrTime
Packet arrival time.
bool m_cleared
Flag when we've been cleared.
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 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...
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.
virtual ~UanPhyPerUmodem()
Destructor.
Ptr< UanNetDevice > m_device
Device hosting this Phy.
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 amount of interference this node is experiencing from othe...
UanPdp m_pktRxPdp
Power delay profile of packet.
Ptr< UanPhyCalcSinr > m_sinr
SINR calculator.
virtual Ptr< UanChannel > GetChannel(void) const
Get the attached channel.
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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double DbToKp(double db)
Convert dB to kilopascals.
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.
virtual void SetChannel(Ptr< UanChannel > channel)
Attach to a channel.
Default SINR calculator for UanPhyGen.
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.
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.
virtual ~UanPhyPerGenDefault()
Destructor.
UanPhyCalcSinrFhFsk()
Constructor.
An identifier for simulation events.
ns3::TracedCallback< Ptr< const Packet >, double, UanTxMode > m_txLogger
A packet was sent from this Phy.
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.
virtual Ptr< UanNetDevice > GetDevice(void) const
Get the device hosting this Phy.
static TypeId GetTypeId(void)
Register this type.
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 ~UanPhyPerCommonModes()
Destructor.
virtual Ptr< Packet > GetPacketRx(void) const
Get the packet currently being received.
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 ~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.
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.
UanPhyPerCommonModes()
Constructor.
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 void Clear(void)
Clear all pointer references.
UanPhyCalcSinrDefault()
Constructor.
ns3::TracedCallback< Ptr< const Packet >, double, UanTxMode > m_rxOkLogger
A packet destined for this Phy was received without error.
void NotifyListenersTxStart(Time duration)
Call UanListener::NotifyTxStart on all listeners.
virtual void SetTxPowerDb(double txpwr)
Set the transmit power.