DESERT 4.0.0
UwOFDMPhy Class Reference

#include <uwofdmphy.h>

Inheritance diagram for UwOFDMPhy:
Inheritance graph
Collaboration diagram for UwOFDMPhy:
Collaboration graph

Public Member Functions

 UwOFDMPhy ()
 
virtual ~UwOFDMPhy ()
 
virtual int command (int, const char *const *)
 
void init_ofdm_node (int nn, int cf, int scn, int ID)
 
void setBufferSize (int)
 
int getNodeNum () const
 
int getSentUpPkts ()
 
void setNodeNum (int)
 
int getSubCarNum () const
 
int getLowSnrPktLost () const
 
int getNoiseErrPktLost () const
 
int getCollErrPktLost () const
 
int getTxPenPktLost () const
 
int getTxPenCtrlLost () const
 
int getFreqCollPktLost () const
 
int getCtrlCErrPktLost () const
 
int getCtrlFCollPktLost () const
 
int getModErrPktLost () const
 
int getPhyPktSent () const
 
void setSubCarNum (int)
 
void setNodeID (int)
 
void showSubCar ()
 
void setSubCar (int, int)
 
void setBrokenCar (int, int)
 
int getNodeID () const
 
double getTransmissionTime () const
 
bool freqOverlap (Packet *, bool)
 
- Public Member Functions inherited from UnderwaterPhysical
 UnderwaterPhysical ()
 
virtual ~UnderwaterPhysical ()
 
int recvSyncClMsg (ClMessage *m) override
 

Public Attributes

bool txongoing_
 

Protected Member Functions

virtual void recv (Packet *)
 
virtual void endRx (Packet *p)
 
virtual void startRx (Packet *p)
 
virtual void endTx (Packet *p)
 
virtual double getOFDMPER (double _snr, int _nbits, Packet *)
 
virtual double getOFDMNoisePower (Packet *p)
 
double getTxDuration (Packet *p)
 
void createOFDMhdr (Packet *p)
 
void interruptReceptions ()
 
int recvSyncClMsg (ClMessage *m)
 
void plotPktQueue ()
 
- Protected Member Functions inherited from UnderwaterPhysical
virtual void updateInstantaneousStats ()
 
virtual double consumedEnergyTx (const double &_duration) const
 
virtual double consumedEnergyRx (const double &_duration) const
 
virtual double getPER (double snr, int nbits, Packet *_p)
 
bool isZero (const double &value) const
 
double Get_Tx_Time () const
 
double Get_Rx_Time () const
 
double Get_Energy_Tx () const
 
double Get_Energy_Rx () const
 
double Get_Transmitted_bytes () const
 
void incrTot_pkts_lost ()
 
void incrTotCrtl_pkts_lost ()
 
void incrErrorCtrlPktsInterf ()
 
void incrCollisionDATAvsCTRL ()
 
void incrCollisionCTRL ()
 
void incrCollisionDATA ()
 
int getTot_pkts_lost () const
 
int getTot_CtrlPkts_lost () const
 
int getError_CtrlPktsInterf () const
 
int getCollisionsDATAvsCTRL () const
 
int getCollisionsCTRL () const
 
int getCollisionsDATA () const
 
double log2 (const double &_input) const
 
double get_prob_error_symbol_mpsk (const double &_snr, const uint32_t _M) const
 

Private Member Functions

virtual double getDistance (Packet *)
 
virtual double getPropagationDelay (Packet *)
 
virtual int getTotalDelay ()
 
string itos (int i)
 
string dtos (double d)
 

Private Attributes

int buffered_pkt_num
 
int current_rcvs
 
int nodeNum_
 
int centerFreq_
 
int subCarrier_
 
int nodeID_
 
double total_delay_
 
int powerScaling
 
int FRAME_BIT
 
int bufferSize_
 
std::vector< Packet > pktqueue_
 
std::vector< Packet * > txqueue_
 
std::vector< double > timesqueue_
 
std::vector< double > brokenCarriers_
 
int sentUpPkts
 
int lostPackets [8]
 
double totTransTime
 
int phySentPkt_
 
int tx_busy_
 
MsgDisplayer msgDisp
 

Additional Inherited Members

- Protected Attributes inherited from UnderwaterPhysical
std::string modulation_name_
 
double time_ready_to_end_rx_
 
double Tx_Time_
 
double Rx_Time_
 
double Energy_Tx_
 
double Energy_Rx_
 
double Transmitted_bytes_
 
double tx_power_
 
double rx_power_
 
int tot_pkts_lost
 
int tot_ctrl_pkts_lost
 
int errorCtrlPktsInterf
 
int collisionDataCTRL
 
int collisionCTRL
 
int collisionDATA
 
std::string Interference_Model
 
uwinterferenceinterference_
 

Constructor & Destructor Documentation

◆ UwOFDMPhy()

UwOFDMPhy::UwOFDMPhy ( )

◆ ~UwOFDMPhy()

UwOFDMPhy::~UwOFDMPhy ( )
virtual

Destructor of UwOFDMPhy class.

Member Function Documentation

◆ command()

int UwOFDMPhy::command ( int  argc,
const char *const *  argv 
)
virtual

TCL command interpreter. It implements the following OTcl methods:

Parameters
argcNumber of arguments in argv.
argvArray of strings which are the command parameters (Note that argv[0] is the name of the object).
Returns
TCL_OK or TCL_ERROR whether the command has been dispatched successfully or not.

Reimplemented from UnderwaterPhysical.

References UnderwaterPhysical::command(), getCollErrPktLost(), getCtrlCErrPktLost(), getCtrlFCollPktLost(), getFreqCollPktLost(), getLowSnrPktLost(), getModErrPktLost(), getNodeID(), getNodeNum(), getNoiseErrPktLost(), getPhyPktSent(), getSentUpPkts(), getSubCarNum(), getTotalDelay(), getTransmissionTime(), getTxPenCtrlLost(), getTxPenPktLost(), init_ofdm_node(), setBrokenCar(), setBufferSize(), setNodeID(), setNodeNum(), setSubCarNum(), and showSubCar().

Here is the call graph for this function:

◆ createOFDMhdr()

void UwOFDMPhy::createOFDMhdr ( Packet *  p)
protected

Creates an OFDM header for non-OFDM packets

Parameters
Packet*p Pointer to the packet transmitted

References hdr_OFDM::carrierNum, hdr_OFDM::carriers, and subCarrier_.

Referenced by recv().

◆ dtos()

string UwOFDMPhy::dtos ( double  d)
inlineprivate
Parameters
da double
Returns
d converted to string

Referenced by getTxDuration(), and recv().

◆ endRx()

◆ endTx()

void UwOFDMPhy::endTx ( Packet *  p)
protectedvirtual

Handles the end of a transmission, redefined to scale the power into the carriers

Parameters
Packet*p Pointer to the packet transmitted

Reimplemented from UnderwaterPhysical.

References hdr_OFDM::carriers, UnderwaterPhysical::consumedEnergyTx(), UnderwaterPhysical::Energy_Tx_, powerScaling, subCarrier_, UnderwaterPhysical::Transmitted_bytes_, and UnderwaterPhysical::Tx_Time_.

Here is the call graph for this function:

◆ freqOverlap()

bool UwOFDMPhy::freqOverlap ( Packet *  p2,
bool  isOFDM 
)

References hdr_OFDM::carrierNum, hdr_OFDM::carriers, and pktqueue_.

Referenced by startRx().

◆ getCollErrPktLost()

int UwOFDMPhy::getCollErrPktLost ( ) const

References COLLERR, and lostPackets.

Referenced by command().

◆ getCtrlCErrPktLost()

int UwOFDMPhy::getCtrlCErrPktLost ( ) const

References CTRLCERR, and lostPackets.

Referenced by command().

◆ getCtrlFCollPktLost()

int UwOFDMPhy::getCtrlFCollPktLost ( ) const

References CTRLFERR, and lostPackets.

Referenced by command().

◆ getDistance()

double UwOFDMPhy::getDistance ( Packet *  _p)
privatevirtual

Return the distance between source and destination.

Parameters
pPacket by witch the module gets information about source and destination.

Referenced by getPropagationDelay().

◆ getFreqCollPktLost()

int UwOFDMPhy::getFreqCollPktLost ( ) const

References FREQCOLL, and lostPackets.

Referenced by command().

◆ getLowSnrPktLost()

int UwOFDMPhy::getLowSnrPktLost ( ) const

References lostPackets, and LOWSNR.

Referenced by command().

◆ getModErrPktLost()

int UwOFDMPhy::getModErrPktLost ( ) const

References lostPackets, and MODERR.

Referenced by command().

◆ getNodeID()

int UwOFDMPhy::getNodeID ( ) const

References nodeID_.

Referenced by command().

◆ getNodeNum()

int UwOFDMPhy::getNodeNum ( ) const

References nodeNum_.

Referenced by command().

◆ getNoiseErrPktLost()

int UwOFDMPhy::getNoiseErrPktLost ( ) const

References lostPackets, and NOISEERR.

Referenced by command().

◆ getOFDMNoisePower()

double UwOFDMPhy::getOFDMNoisePower ( Packet *  p)
protectedvirtual

Handles the end of a transmission, redefined to scale the power into the carriers

Parameters
Packet*p Pointer to the packet transmitted
Returns
Noise power on used carriers

References hdr_OFDM::carrierNum, hdr_OFDM::carriers, and hdr_OFDM::carrierSize.

Referenced by recv().

◆ getOFDMPER()

double UwOFDMPhy::getOFDMPER ( double  _snr,
int  _nbits,
Packet *  p 
)
protectedvirtual

Returns the packet error rate by using the length of a packet and the information contained in the packet (position of the source and the destination). The error rate is computed only on the carriers used by the packet.

Parameters
snrCalculated by nsmiracle with the Urick model (unused).
nbitslength in bit of the packet.
pPacket by witch the module gets information about source and destination.
Returns
PER of the packet passed as parameter.

References hdr_OFDM::carMod, hdr_OFDM::carrierNum, hdr_OFDM::carriers, hdr_OFDM::carrierSize, UnderwaterPhysical::get_prob_error_symbol_mpsk(), UnderwaterPhysical::log2(), and nodeID_.

Referenced by endRx().

Here is the call graph for this function:

◆ getPhyPktSent()

int UwOFDMPhy::getPhyPktSent ( ) const

References phySentPkt_.

Referenced by command().

◆ getPropagationDelay()

double UwOFDMPhy::getPropagationDelay ( Packet *  _p)
privatevirtual

Return the propagation delay for the packet. The delay is calculated based on the distance between the source and the sink.

Parameters
pPacket by witch the module gets information about source and destination.

References getDistance().

Referenced by endRx().

Here is the call graph for this function:

◆ getSentUpPkts()

int UwOFDMPhy::getSentUpPkts ( )

References sentUpPkts.

Referenced by command().

◆ getSubCarNum()

int UwOFDMPhy::getSubCarNum ( ) const

References subCarrier_.

Referenced by command().

◆ getTotalDelay()

virtual int UwOFDMPhy::getTotalDelay ( )
inlineprivatevirtual

returns total delay

References total_delay_.

Referenced by command().

◆ getTransmissionTime()

double UwOFDMPhy::getTransmissionTime ( ) const

References totTransTime.

Referenced by command().

◆ getTxDuration()

double UwOFDMPhy::getTxDuration ( Packet *  p)
protected

Computes the transmission time duration depending on the used carriers

Parameters
Packet*p Pointer to the packet transmitted
Returns
Transmission duration

References hdr_OFDM::carMod, hdr_OFDM::carrierNum, hdr_OFDM::carriers, dtos(), itos(), msgDisp, nodeID_, and MsgDisplayer::printStatus().

Referenced by recv().

Here is the call graph for this function:

◆ getTxPenCtrlLost()

int UwOFDMPhy::getTxPenCtrlLost ( ) const

References lostPackets, and TXPENCTRL.

Referenced by command().

◆ getTxPenPktLost()

int UwOFDMPhy::getTxPenPktLost ( ) const

References lostPackets, and TXPEN.

Referenced by command().

◆ init_ofdm_node()

void UwOFDMPhy::init_ofdm_node ( int  nn,
int  cf,
int  scn,
int  ID 
)

References centerFreq_, MsgDisplayer::initDisplayer(), msgDisp, nodeID_, nodeNum_, MsgDisplayer::printStatus(), and subCarrier_.

Referenced by command().

Here is the call graph for this function:

◆ interruptReceptions()

void UwOFDMPhy::interruptReceptions ( )
protected

Interrupts reception if MAC has other priorities Theoretically should never be called

References buffered_pkt_num, current_rcvs, nodeID_, and pktqueue_.

Referenced by recv().

◆ itos()

string UwOFDMPhy::itos ( int  i)
inlineprivate
Parameters
ian integer
Returns
i converted to string

Referenced by endRx(), getTxDuration(), and recv().

◆ plotPktQueue()

void UwOFDMPhy::plotPktQueue ( )
protected

Plots pktqueue elements

References hdr_OFDM::nativeOFDM, nodeID_, and pktqueue_.

Referenced by endRx(), and startRx().

◆ recv()

void UwOFDMPhy::recv ( Packet *  p)
protectedvirtual

recv method. It is called when a packet is received from the channel

Parameters
Packet*Pointer to the packet that are going to be received

Reimplemented from UnderwaterPhysical.

References uwinterference::addToInterference(), buffered_pkt_num, bufferSize_, hdr_OFDM::carriers, createOFDMhdr(), current_rcvs, dtos(), getOFDMNoisePower(), getTxDuration(), UnderwaterPhysical::interference_, interruptReceptions(), itos(), msgDisp, hdr_OFDM::nativeOFDM, nodeID_, phySentPkt_, powerScaling, MsgDisplayer::printStatus(), hdr_OFDM::srcID, startRx(), subCarrier_, and totTransTime.

Here is the call graph for this function:

◆ recvSyncClMsg()

int UwOFDMPhy::recvSyncClMsg ( ClMessage *  m)
protected

Handles receiving messages from the MAC layer

References CLMSG_UWPHY_TX_BUSY, nodeID_, and tx_busy_.

◆ setBrokenCar()

void UwOFDMPhy::setBrokenCar ( int  bottom,
int  top 
)

References brokenCarriers_.

Referenced by command().

◆ setBufferSize()

void UwOFDMPhy::setBufferSize ( int  s)

References bufferSize_.

Referenced by command().

◆ setNodeID()

void UwOFDMPhy::setNodeID ( int  n)

References nodeID_.

Referenced by command().

◆ setNodeNum()

void UwOFDMPhy::setNodeNum ( int  n)

References nodeNum_.

Referenced by command().

◆ setSubCar()

void UwOFDMPhy::setSubCar ( int  index,
int  value 
)

◆ setSubCarNum()

void UwOFDMPhy::setSubCarNum ( int  n)

References subCarrier_.

Referenced by command().

◆ showSubCar()

void UwOFDMPhy::showSubCar ( )

Referenced by command().

◆ startRx()

void UwOFDMPhy::startRx ( Packet *  p)
protectedvirtual

Handles the start of a packet reception

Parameters
Packet*p Pointer to the packet received

Reimplemented from UnderwaterPhysical.

References CTRLFERR, current_rcvs, FREQCOLL, freqOverlap(), UnderwaterPhysical::incrTot_pkts_lost(), UnderwaterPhysical::incrTotCrtl_pkts_lost(), lostPackets, LOWSNR, MODERR, msgDisp, hdr_OFDM::nativeOFDM, nodeID_, pktqueue_, plotPktQueue(), MsgDisplayer::printStatus(), tx_busy_, TXPEN, and TXPENCTRL.

Referenced by recv().

Here is the call graph for this function:

Member Data Documentation

◆ brokenCarriers_

std::vector<double> UwOFDMPhy::brokenCarriers_
private

Referenced by setBrokenCar().

◆ buffered_pkt_num

int UwOFDMPhy::buffered_pkt_num
private

Referenced by endRx(), interruptReceptions(), and recv().

◆ bufferSize_

int UwOFDMPhy::bufferSize_
private

Referenced by recv(), and setBufferSize().

◆ centerFreq_

int UwOFDMPhy::centerFreq_
private

Referenced by init_ofdm_node().

◆ current_rcvs

int UwOFDMPhy::current_rcvs
private

◆ FRAME_BIT

int UwOFDMPhy::FRAME_BIT
private

Referenced by UwOFDMPhy().

◆ lostPackets

◆ msgDisp

MsgDisplayer UwOFDMPhy::msgDisp
private

◆ nodeID_

◆ nodeNum_

int UwOFDMPhy::nodeNum_
private

◆ phySentPkt_

int UwOFDMPhy::phySentPkt_
private

Referenced by getPhyPktSent(), and recv().

◆ pktqueue_

std::vector<Packet> UwOFDMPhy::pktqueue_
private

◆ powerScaling

int UwOFDMPhy::powerScaling
private

Referenced by endTx(), recv(), and UwOFDMPhy().

◆ sentUpPkts

int UwOFDMPhy::sentUpPkts
private

Referenced by endRx(), and getSentUpPkts().

◆ subCarrier_

int UwOFDMPhy::subCarrier_
private

◆ timesqueue_

std::vector<double> UwOFDMPhy::timesqueue_
private

◆ total_delay_

double UwOFDMPhy::total_delay_
private

Referenced by endRx(), and getTotalDelay().

◆ totTransTime

double UwOFDMPhy::totTransTime
private

Referenced by getTransmissionTime(), and recv().

◆ tx_busy_

int UwOFDMPhy::tx_busy_
private

transmission power might be carried out just by re-setting this value. More complex strategies (e.g., packet-specific transmission power) can be implemented by overriding the getTxPower() method.

Referenced by recvSyncClMsg(), and startRx().

◆ txongoing_

bool UwOFDMPhy::txongoing_

◆ txqueue_

std::vector<Packet *> UwOFDMPhy::txqueue_
private

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