DESERT 4.0.0
UnderwaterPhysicaldb Class Reference

#include <uwphysicaldb.h>

Inheritance diagram for UnderwaterPhysicaldb:
Inheritance graph
Collaboration diagram for UnderwaterPhysicaldb:
Collaboration graph

Public Member Functions

 UnderwaterPhysicaldb ()
 
virtual ~UnderwaterPhysicaldb ()
 
virtual int command (int, const char *const *)
 
virtual void recv (Packet *)
 
- Public Member Functions inherited from UnderwaterPhysical
 UnderwaterPhysical ()
 
virtual ~UnderwaterPhysical ()
 
int recvSyncClMsg (ClMessage *m) override
 

Protected Member Functions

virtual void endRx (Packet *p)
 
virtual double getPERfromSNR (const double &, const int &, const Packet *)
 
virtual double getPERfromSIR (const double &, const double &)
 
virtual double getNearestNeighbor (const std::set< double > &, const double &)
 
virtual const double retrievePerFromFile (const std::string &, const double &) const
 
const bool isZero (const double &_value) const
 
const double fromKmToMiles (const double &_km) const
 
- Protected Member Functions inherited from UnderwaterPhysical
virtual void updateInstantaneousStats ()
 
virtual void endTx (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

char * path_
 
uwinterferenceinterference_
 
std::set< double > snr
 
std::set< double > overlap
 
std::set< double > sir
 
std::map< uint8_t, std::set< double > > range
 
std::map< uint8_t, string > type_of_node
 
std::map< string, uint8_t > range_nums
 
string country
 
string modulation
 
uint8_t ipAddr_
 
std::pair< double, double > interf_val
 
char token_separator
 
- 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_
 

Private Attributes

ostringstream osstream
 

Constructor & Destructor Documentation

◆ UnderwaterPhysicaldb()

UnderwaterPhysicaldb::UnderwaterPhysicaldb ( )

Constructor of UnderwaterMPhyBpskDb class.

◆ ~UnderwaterPhysicaldb()

virtual UnderwaterPhysicaldb::~UnderwaterPhysicaldb ( )
inlinevirtual

Destructor of UnderwaterMPhyBpskDb class.

Member Function Documentation

◆ command()

int UnderwaterPhysicaldb::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(), country, interference_, ipAddr_, modulation, overlap, path_, range, range_nums, sir, snr, and type_of_node.

Here is the call graph for this function:

◆ endRx()

void UnderwaterPhysicaldb::endRx ( Packet *  p)
protectedvirtual

◆ fromKmToMiles()

const double UnderwaterPhysicaldb::fromKmToMiles ( const double &  _km) const
inlineprotected

Converts from kilometers to miles.

Parameters
_kmThe value to be converted in miles.
Returns
The value converted in miles.

Referenced by getPERfromSNR().

◆ getNearestNeighbor()

double UnderwaterPhysicaldb::getNearestNeighbor ( const std::set< double > &  _set,
const double &  _value 
)
protectedvirtual

Nearest neighbor of a value contained in a set.

Parameters
Setthat contains the values in which to search.
valueto search for.
Returns
Nearest neighbor.

Referenced by getPERfromSIR(), and getPERfromSNR().

◆ getPERfromSIR()

double UnderwaterPhysicaldb::getPERfromSIR ( const double &  _sir,
const double &  _overlap 
)
protectedvirtual

Packet error rate based on Overlap and SIR.

Parameters
Overlap.
SIR.
Returns
PER of the packet retrieved from file.

References getNearestNeighbor(), modulation, osstream, overlap, path_, retrievePerFromFile(), and sir.

Referenced by endRx().

Here is the call graph for this function:

◆ getPERfromSNR()

double UnderwaterPhysicaldb::getPERfromSNR ( const double &  _snr,
const int &  _nbits,
const Packet *  p 
)
protectedvirtual

Packet error rate based on SNR.

Parameters
SNR.
nbitslength in bit of the packet.
pPacket.
Returns
PER of the packet retrieved from file.

References country, fromKmToMiles(), getNearestNeighbor(), ipAddr_, modulation, osstream, path_, range, range_nums, retrievePerFromFile(), snr, and type_of_node.

Referenced by endRx().

Here is the call graph for this function:

◆ isZero()

const bool UnderwaterPhysicaldb::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()

◆ recv()

void UnderwaterPhysicaldb::recv ( Packet *  p)
virtual

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(), interference_, ipAddr_, and UnderwaterPhysical::startRx().

Here is the call graph for this function:

◆ retrievePerFromFile()

const double UnderwaterPhysicaldb::retrievePerFromFile ( const std::string &  _file_name,
const double &  _snr 
) const
protectedvirtual

References token_separator.

Referenced by getPERfromSIR(), and getPERfromSNR().

Member Data Documentation

◆ country

string UnderwaterPhysicaldb::country
protected

Name of the Country.

Referenced by command(), and getPERfromSNR().

◆ interf_val

std::pair<double, double> UnderwaterPhysicaldb::interf_val
protected

(SIR, Overlap)

Referenced by endRx().

◆ interference_

uwinterference* UnderwaterPhysicaldb::interference_
protected

Interference Model.

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

◆ ipAddr_

uint8_t UnderwaterPhysicaldb::ipAddr_
protected

IP of the node.

Referenced by command(), getPERfromSNR(), and recv().

◆ modulation

string UnderwaterPhysicaldb::modulation
protected

Name of the Modulation.

Referenced by command(), getPERfromSIR(), and getPERfromSNR().

◆ osstream

ostringstream UnderwaterPhysicaldb::osstream
private

Referenced by getPERfromSIR(), and getPERfromSNR().

◆ overlap

std::set<double> UnderwaterPhysicaldb::overlap
protected

Set of the available Overlaps.

Referenced by command(), and getPERfromSIR().

◆ path_

char* UnderwaterPhysicaldb::path_
protected

Name of the trace file writter for the current node.

Referenced by command(), getPERfromSIR(), and getPERfromSNR().

◆ range

std::map<uint8_t, std::set<double> > UnderwaterPhysicaldb::range
protected

Set of the available Ranges.

Referenced by command(), and getPERfromSNR().

◆ range_nums

std::map<string, uint8_t> UnderwaterPhysicaldb::range_nums
protected

Set of the number of ranges for a given pathtype, e.g "AA".

Referenced by command(), and getPERfromSNR().

◆ sir

std::set<double> UnderwaterPhysicaldb::sir
protected

Set of the available SIRs.

Referenced by command(), and getPERfromSIR().

◆ snr

std::set<double> UnderwaterPhysicaldb::snr
protected

Set of the available SNRs.

Referenced by command(), and getPERfromSNR().

◆ token_separator

char UnderwaterPhysicaldb::token_separator
protected

Token used to parse the elements in a line of the database.

Referenced by retrievePerFromFile().

◆ type_of_node

std::map<uint8_t, string> UnderwaterPhysicaldb::type_of_node
protected

Set of the available type of nodes.

Referenced by command(), and getPERfromSNR().


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