DESERT 4.0.0
UnderwaterPhysical Class Reference

#include <uwphysical.h>

Inheritance diagram for UnderwaterPhysical:
Inheritance graph
Collaboration diagram for UnderwaterPhysical:
Collaboration graph

Public Member Functions

 UnderwaterPhysical ()
 
virtual ~UnderwaterPhysical ()
 
virtual int command (int, const char *const *) override
 
virtual void recv (Packet *) override
 
int recvSyncClMsg (ClMessage *m) override
 

Protected Member Functions

virtual void updateInstantaneousStats ()
 
virtual void endTx (Packet *p) override
 
virtual void endRx (Packet *p) override
 
virtual void startRx (Packet *p) override
 
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
 

Protected Attributes

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

◆ UnderwaterPhysical()

UnderwaterPhysical::UnderwaterPhysical ( )

Constructor of UnderwaterPhysical class.

References rx_power_, and tx_power_.

◆ ~UnderwaterPhysical()

UnderwaterPhysical::~UnderwaterPhysical ( )
virtual

Destructor of UnderwaterPhysical class.

Member Function Documentation

◆ command()

int UnderwaterPhysical::command ( int  argc,
const char *const *  argv 
)
overridevirtual

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 in UnderwaterPhysicalNoise, UwAhoiPhy, UnderwaterGainFromDb, UwHermesPhy, UnderwaterHMMPhysical, UwOFDMPhy, UnderwaterPhysicaldb, and UnderwaterPhysicalfromdb.

References Get_Energy_Rx(), Get_Energy_Tx(), Get_Rx_Time(), Get_Transmitted_bytes(), Get_Tx_Time(), getCollisionsCTRL(), getCollisionsDATA(), getCollisionsDATAvsCTRL(), getError_CtrlPktsInterf(), getTot_CtrlPkts_lost(), getTot_pkts_lost(), interference_, Interference_Model, and modulation_name_.

Referenced by UnderwaterPhysicalNoise::command(), UwAhoiPhy::command(), UnderwaterGainFromDb::command(), UwHermesPhy::command(), UnderwaterHMMPhysical::command(), UwOFDMPhy::command(), and UnderwaterPhysicaldb::command().

Here is the call graph for this function:

◆ consumedEnergyRx()

virtual double UnderwaterPhysical::consumedEnergyRx ( const double &  _duration) const
inlineprotectedvirtual

Compute the energy (in Joule) spent by the modem in reception

Parameters
constdouble& time spent by the modem in reception phase
Returns
double& the value of energy in Joule

References rx_power_.

Referenced by UwAhoiPhy::endRx(), UwHermesPhy::endRx(), UwOFDMPhy::endRx(), UnderwaterPhysicaldb::endRx(), UnderwaterHMMPhysical::endRx(), and endRx().

◆ consumedEnergyTx()

virtual double UnderwaterPhysical::consumedEnergyTx ( const double &  _duration) const
inlineprotectedvirtual

Compute the energy (in Joule) spent by the modem in transmission

Parameters
constdouble& time spent by the modem in transmission phase
Returns
double& the value of energy in Joule

References tx_power_.

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

◆ endRx()

void UnderwaterPhysical::endRx ( Packet *  p)
overrideprotectedvirtual

◆ endTx()

void UnderwaterPhysical::endTx ( Packet *  p)
overrideprotectedvirtual

Handles the end of a packet transmission

Parameters
Packet*p Pointer to the packet transmitted

Reimplemented in UwOFDMPhy.

References consumedEnergyTx(), Energy_Tx_, Transmitted_bytes_, and Tx_Time_.

Here is the call graph for this function:

◆ Get_Energy_Rx()

double UnderwaterPhysical::Get_Energy_Rx ( ) const
inlineprotected

Returns the energy (in Joule) spent by the node in reception.

Returns
energy (in Joule) spent by the node in reception.

References Energy_Rx_.

Referenced by command().

◆ Get_Energy_Tx()

double UnderwaterPhysical::Get_Energy_Tx ( ) const
inlineprotected

Returns the energy (in Joule) spent by the node in transmission.

Returns
energy (in Joule) spent by the node in transmission.

References Energy_Tx_.

Referenced by command().

◆ get_prob_error_symbol_mpsk()

double UnderwaterPhysical::get_prob_error_symbol_mpsk ( const double &  _snr,
const uint32_t  _M 
) const
inlineprotected
Parameters
_snrSignal to Noise Ratio
_MNumber of simbol of the the MPSK
Returns
Probability error for the symbol

References log2().

Referenced by UwOFDMPhy::getOFDMPER(), and getPER().

Here is the call graph for this function:

◆ Get_Rx_Time()

double UnderwaterPhysical::Get_Rx_Time ( ) const
inlineprotected

Returns the time (in seconds) spent by the node in reception.

Returns
time (in seconds) spent by the node in reception.

References Rx_Time_.

Referenced by command().

◆ Get_Transmitted_bytes()

double UnderwaterPhysical::Get_Transmitted_bytes ( ) const
inlineprotected

Returns the number of bytes transmitted.

Returns
the number of bytes transmitted.

References Transmitted_bytes_.

Referenced by command().

◆ Get_Tx_Time()

double UnderwaterPhysical::Get_Tx_Time ( ) const
inlineprotected

Returns the time (in seconds) spent by the node in transmission.

Returns
time (in seconds) spent by the node in transmission.

References Tx_Time_.

Referenced by command().

◆ getCollisionsCTRL()

int UnderwaterPhysical::getCollisionsCTRL ( ) const
inlineprotected
Returns
the number of collisions with a CTRL packet

References collisionCTRL.

Referenced by command().

◆ getCollisionsDATA()

int UnderwaterPhysical::getCollisionsDATA ( ) const
inlineprotected
Returns
the number of collisions with a DATA packet

References collisionDATA.

Referenced by command().

◆ getCollisionsDATAvsCTRL()

int UnderwaterPhysical::getCollisionsDATAvsCTRL ( ) const
inlineprotected
Returns
the total number of collision between DATA and CTRL

References collisionDataCTRL.

Referenced by command().

◆ getError_CtrlPktsInterf()

int UnderwaterPhysical::getError_CtrlPktsInterf ( ) const
inlineprotected
Returns
the total number of CTRL pkts lost due to interference

References errorCtrlPktsInterf.

Referenced by command().

◆ getPER()

double UnderwaterPhysical::getPER ( 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 destiantion.

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.

Reimplemented in UnderwaterPhysicalfromdb, UwHermesPhy, and UnderwaterGainFromDb.

References get_prob_error_symbol_mpsk(), log2(), and modulation_name_.

Referenced by UwOFDMPhy::endRx(), UnderwaterHMMPhysical::endRx(), endRx(), UnderwaterPhysicalfromdb::getPER(), and UnderwaterGainFromDb::getPER().

Here is the call graph for this function:

◆ getTot_CtrlPkts_lost()

int UnderwaterPhysical::getTot_CtrlPkts_lost ( ) const
inlineprotected
Returns
the total number of CTRL packets lost

References tot_ctrl_pkts_lost.

Referenced by command(), and recvSyncClMsg().

◆ getTot_pkts_lost()

int UnderwaterPhysical::getTot_pkts_lost ( ) const
inlineprotected
Returns
the total number of packets lost

References tot_pkts_lost.

Referenced by command(), and recvSyncClMsg().

◆ incrCollisionCTRL()

void UnderwaterPhysical::incrCollisionCTRL ( )
inlineprotected

Increment the number of CTRL pkts discarded due to a collision

References collisionCTRL.

Referenced by UwAhoiPhy::endRx(), UwHermesPhy::endRx(), UwOFDMPhy::endRx(), UnderwaterHMMPhysical::endRx(), and endRx().

◆ incrCollisionDATA()

void UnderwaterPhysical::incrCollisionDATA ( )
inlineprotected

Increment the number of DATA pkts discarded due to a collision

References collisionDATA.

Referenced by UwAhoiPhy::endRx(), UwHermesPhy::endRx(), UwOFDMPhy::endRx(), UnderwaterHMMPhysical::endRx(), and endRx().

◆ incrCollisionDATAvsCTRL()

void UnderwaterPhysical::incrCollisionDATAvsCTRL ( )
inlineprotected

Increment the number of collisions DATA/CTRL

References collisionDataCTRL.

Referenced by UwAhoiPhy::endRx(), UwHermesPhy::endRx(), UwOFDMPhy::endRx(), UnderwaterHMMPhysical::endRx(), and endRx().

◆ incrErrorCtrlPktsInterf()

void UnderwaterPhysical::incrErrorCtrlPktsInterf ( )
inlineprotected

Increment the number of CTRL packets discarded due to interference

References errorCtrlPktsInterf.

Referenced by UwAhoiPhy::endRx(), UwHermesPhy::endRx(), UwOFDMPhy::endRx(), UnderwaterHMMPhysical::endRx(), and endRx().

◆ incrTot_pkts_lost()

void UnderwaterPhysical::incrTot_pkts_lost ( )
inlineprotected

◆ incrTotCrtl_pkts_lost()

void UnderwaterPhysical::incrTotCrtl_pkts_lost ( )
inlineprotected

◆ isZero()

bool UnderwaterPhysical::isZero ( const double &  value) const
inlineprotected

Evaluates is the number passed as input is equal to zero. When C++ works with double and float number you can't compare them with 0. If the absolute value of the number is smaller than eplison that means that the number is equal to zero.

Parameters
double&Number to evaluate.
Returns
true if the number passed in input is equal to zero, false otherwise.
See also
std::numeric_limits<double>::epsilon()

◆ log2()

double UnderwaterPhysical::log2 ( const double &  _input) const
inlineprotected
Parameters
_inputInput value.
Returns
the log base 2 of the input.

Referenced by get_prob_error_symbol_mpsk(), UwOFDMPhy::getOFDMPER(), and getPER().

◆ recv()

void UnderwaterPhysical::recv ( Packet *  p)
overridevirtual

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 in UwOFDMPhy, and UnderwaterPhysicaldb.

References uwinterference::addToInterference(), interference_, and startRx().

Here is the call graph for this function:

◆ recvSyncClMsg()

int UnderwaterPhysical::recvSyncClMsg ( ClMessage *  m)
override

recv syncronous cross layer messages to require an operation from another module

Parameters
mPointer cross layer message

References CLMSG_UWPHY_LOSTPKT, getTot_CtrlPkts_lost(), getTot_pkts_lost(), and updateInstantaneousStats().

Here is the call graph for this function:

◆ startRx()

void UnderwaterPhysical::startRx ( Packet *  p)
overrideprotectedvirtual

Handles the start of a reception. This method is called from the recv method

Parameters
Packet*p Pointer to the packet that the PHY are receiving.

Reimplemented in UwOFDMPhy.

References incrTot_pkts_lost(), and incrTotCrtl_pkts_lost().

Referenced by UnderwaterPhysicaldb::recv(), and recv().

Here is the call graph for this function:

◆ updateInstantaneousStats()

void UnderwaterPhysical::updateInstantaneousStats ( )
protectedvirtual

Update the stats before sending them through crosslayer message

Referenced by recvSyncClMsg().

Member Data Documentation

◆ collisionCTRL

int UnderwaterPhysical::collisionCTRL
protected

Total number of CTRL pkts lost due to collision

Referenced by getCollisionsCTRL(), and incrCollisionCTRL().

◆ collisionDATA

int UnderwaterPhysical::collisionDATA
protected

Total number of DATA pkts lost due to collision

Referenced by getCollisionsDATA(), and incrCollisionDATA().

◆ collisionDataCTRL

int UnderwaterPhysical::collisionDataCTRL
protected

Total number of collisions between DATA pkts and CTRL pkts

Referenced by getCollisionsDATAvsCTRL(), and incrCollisionDATAvsCTRL().

◆ Energy_Rx_

double UnderwaterPhysical::Energy_Rx_
protected

◆ Energy_Tx_

double UnderwaterPhysical::Energy_Tx_
protected

Energy (in Joule) spent by the node in transmission.

Referenced by UwOFDMPhy::endTx(), endTx(), and Get_Energy_Tx().

◆ errorCtrlPktsInterf

int UnderwaterPhysical::errorCtrlPktsInterf
protected

Total number of CTRL pkts lost due to interference

Referenced by getError_CtrlPktsInterf(), and incrErrorCtrlPktsInterf().

◆ interference_

uwinterference* UnderwaterPhysical::interference_
protected

◆ Interference_Model

std::string UnderwaterPhysical::Interference_Model
protected

Interference calcuation mode chosen: CHUNK model or MEANPOWER model

Referenced by command(), UwHermesPhy::endRx(), UwOFDMPhy::endRx(), UnderwaterHMMPhysical::endRx(), endRx(), UwAhoiPhy::UwAhoiPhy(), UwHermesPhy::UwHermesPhy(), and UwOFDMPhy::UwOFDMPhy().

◆ modulation_name_

std::string UnderwaterPhysical::modulation_name_
protected

Modulation scheme name.

Referenced by command(), and getPER().

◆ rx_power_

double UnderwaterPhysical::rx_power_
protected

Power required in reception.

Referenced by consumedEnergyRx(), and UnderwaterPhysical().

◆ Rx_Time_

double UnderwaterPhysical::Rx_Time_
protected

◆ time_ready_to_end_rx_

double UnderwaterPhysical::time_ready_to_end_rx_
protected

◆ tot_ctrl_pkts_lost

int UnderwaterPhysical::tot_ctrl_pkts_lost
protected

Total number of CTRL pkts lost

Referenced by getTot_CtrlPkts_lost(), and incrTotCrtl_pkts_lost().

◆ tot_pkts_lost

int UnderwaterPhysical::tot_pkts_lost
protected

Total number of packets lost

Referenced by getTot_pkts_lost(), and incrTot_pkts_lost().

◆ Transmitted_bytes_

double UnderwaterPhysical::Transmitted_bytes_
protected

Number of bytes transmitted.

Referenced by UwOFDMPhy::endTx(), endTx(), and Get_Transmitted_bytes().

◆ tx_power_

double UnderwaterPhysical::tx_power_
protected

Power required in transmission.

Referenced by consumedEnergyTx(), and UnderwaterPhysical().

◆ Tx_Time_

double UnderwaterPhysical::Tx_Time_
protected

Time (in seconds) spent by the node in transmission.

Referenced by UwOFDMPhy::endTx(), endTx(), and Get_Tx_Time().


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