DESERT 3.5.1
Loading...
Searching...
No Matches
UnderwaterPhysicaldb Class Reference

#include <uwphysicaldb.h>

Inheritance diagram for UnderwaterPhysicaldb:
Collaboration diagram for UnderwaterPhysicaldb:

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)
 

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)
 
virtual void startRx (Packet *p)
 
virtual double consumedEnergyTx (const double &_duration)
 
virtual double consumedEnergyRx (const double &_duration)
 
virtual double getPER (double snr, int nbits, Packet *)
 
const bool isZero (const double &value) const
 
double Get_Tx_Time ()
 
double Get_Rx_Time ()
 
double Get_Energy_Tx ()
 
double Get_Energy_Rx ()
 
double Get_Transmitted_bytes ()
 
void incrTot_pkts_lost ()
 
void incrTotCrtl_pkts_lost ()
 
void incrErrorCtrlPktsInterf ()
 
void incrCollisionDATAvsCTRL ()
 
void incrCollisionCTRL ()
 
void incrCollisionDATA ()
 
int getTot_pkts_lost ()
 
int getTot_CtrlPkts_lost ()
 
int getError_CtrlPktsInterf ()
 
int getCollisionsDATAvsCTRL ()
 
int getCollisionsCTRL ()
 
int getCollisionsDATA ()
 
const double log2 (const double &_input) const
 
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
 

Detailed Description

Definition at line 61 of file uwphysicaldb.h.

Constructor & Destructor Documentation

◆ UnderwaterPhysicaldb()

UnderwaterPhysicaldb::UnderwaterPhysicaldb ( )

Constructor of UnderwaterMPhyBpskDb class.

Definition at line 55 of file uwphysicaldb.cpp.

◆ ~UnderwaterPhysicaldb()

virtual UnderwaterPhysicaldb::~UnderwaterPhysicaldb ( )
inlinevirtual

Destructor of UnderwaterMPhyBpskDb class.

Definition at line 73 of file uwphysicaldb.h.

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.

Definition at line 77 of file uwphysicaldb.cpp.

◆ endRx()

void UnderwaterPhysicaldb::endRx ( Packet *  p)
protectedvirtual

Handles the end of a packet reception.

Parameters
Packet*p Pointer to the packet received

Reimplemented from UnderwaterPhysical.

Definition at line 242 of file uwphysicaldb.cpp.

◆ 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.

Definition at line 150 of file uwphysicaldb.h.

◆ 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.

Definition at line 448 of file uwphysicaldb.cpp.

◆ 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.

Definition at line 424 of file uwphysicaldb.cpp.

◆ 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.

Definition at line 318 of file uwphysicaldb.cpp.

◆ 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()

Definition at line 138 of file uwphysicaldb.h.

◆ 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.

Definition at line 165 of file uwphysicaldb.cpp.

◆ retrievePerFromFile()

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

Definition at line 481 of file uwphysicaldb.cpp.

Member Data Documentation

◆ country

string UnderwaterPhysicaldb::country
protected

Name of the Country.

Definition at line 168 of file uwphysicaldb.h.

◆ interf_val

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

(SIR, Overlap)

Definition at line 172 of file uwphysicaldb.h.

◆ interference_

uwinterference* UnderwaterPhysicaldb::interference_
protected

Interference Model.

Definition at line 157 of file uwphysicaldb.h.

◆ ipAddr_

uint8_t UnderwaterPhysicaldb::ipAddr_
protected

IP of the node.

Definition at line 170 of file uwphysicaldb.h.

◆ modulation

string UnderwaterPhysicaldb::modulation
protected

Name of the Modulation.

Definition at line 169 of file uwphysicaldb.h.

◆ osstream

ostringstream UnderwaterPhysicaldb::osstream
private

Definition at line 179 of file uwphysicaldb.h.

◆ overlap

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

Set of the available Overlaps.

Definition at line 159 of file uwphysicaldb.h.

◆ path_

char* UnderwaterPhysicaldb::path_
protected

Name of the trace file writter for the current node.

Definition at line 156 of file uwphysicaldb.h.

◆ range

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

Set of the available Ranges.

Definition at line 162 of file uwphysicaldb.h.

◆ range_nums

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

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

Definition at line 166 of file uwphysicaldb.h.

◆ sir

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

Set of the available SIRs.

Definition at line 160 of file uwphysicaldb.h.

◆ snr

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

Set of the available SNRs.

Definition at line 158 of file uwphysicaldb.h.

◆ token_separator

char UnderwaterPhysicaldb::token_separator
protected

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

Definition at line 175 of file uwphysicaldb.h.

◆ type_of_node

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

Set of the available type of nodes.

Definition at line 164 of file uwphysicaldb.h.


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