DESERT 4.0.0
UnderwaterGainFromDb Class Reference

#include <uwgainfromdb.h>

Inheritance diagram for UnderwaterGainFromDb:
Inheritance graph
Collaboration diagram for UnderwaterGainFromDb:
Collaboration graph

Public Member Functions

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

Protected Member Functions

virtual double getPER (double snr, int nbits, Packet *p)
 
virtual void setTimeRoughness (const int &)
 
virtual void setDepthRoughness (const int &)
 
virtual void setDistanceRoughness (const int &)
 
virtual void setTotalTime (const int &)
 
virtual void setFrequencyCorrectionFactor (const double &)
 
const int & getTimeRoughness () const
 
const int & getDepthRoughness () const
 
const int & getDistanceRoughness () const
 
const int & getTotalTime () const
 
const double & getFrequencyCorrectionFactor () const
 
virtual double getGain (const double &, const double &, const double &, const double &)
 
virtual double retriveGainFromFile (const string &, const int &, const int &) const
 
virtual string createNameFile (const int &, const int &)
 
const bool isZero (const double &value) const
 
- Protected Member Functions inherited from UnderwaterPhysical
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
 
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_
 
char token_separator_
 
ostringstream osstream_
 
- 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

int time_roughness_
 
int depth_roughness_
 
int distance_roughness_
 
int total_time_
 
double frequency_correction_factor_
 

Constructor & Destructor Documentation

◆ UnderwaterGainFromDb()

UnderwaterGainFromDb::UnderwaterGainFromDb ( )

◆ ~UnderwaterGainFromDb()

virtual UnderwaterGainFromDb::~UnderwaterGainFromDb ( )
inlinevirtual

Destructor of UnderwaterMPhyBpskDb class.

Member Function Documentation

◆ command()

int UnderwaterGainFromDb::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.

Reimplemented in UnderwaterPhysicalfromdb.

References UnderwaterPhysical::command(), and path_.

Referenced by UnderwaterPhysicalfromdb::command().

Here is the call graph for this function:

◆ createNameFile()

string UnderwaterGainFromDb::createNameFile ( const int &  _time,
const int &  _source_depth 
)
protectedvirtual

Creates the name of the file to load.

Parameters
time
depth
Returns
The name of the file to load.

References osstream_, and path_.

Referenced by getGain().

◆ getDepthRoughness()

const int & UnderwaterGainFromDb::getDepthRoughness ( ) const
inlineprotected

Returns the depth_roughness_ parameter.

Returns
depth_roughness_

References depth_roughness_.

Referenced by UnderwaterPhysicalfromdb::getGain(), and UnderwaterPhysicalfromdb::getSelfInterference().

◆ getDistanceRoughness()

const int & UnderwaterGainFromDb::getDistanceRoughness ( ) const
inlineprotected

Returns the distance_roughness_ parameter.

Returns
distance_roughness_

References distance_roughness_.

Referenced by UnderwaterPhysicalfromdb::getGain(), and UnderwaterPhysicalfromdb::getSelfInterference().

◆ getFrequencyCorrectionFactor()

const double & UnderwaterGainFromDb::getFrequencyCorrectionFactor ( ) const
inlineprotected

Returns the frequency_correction_factor_ parameter.

Returns
frequency_correction_factor_

References frequency_correction_factor_.

◆ getGain()

double UnderwaterGainFromDb::getGain ( const double &  _time,
const double &  _source_depth,
const double &  _destination_depth,
const double &  _destination_distance 
)
protectedvirtual
Parameters

param

Parameters

param

Returns

Reimplemented in UnderwaterPhysicalfromdb.

References createNameFile(), depth_roughness_, distance_roughness_, retriveGainFromFile(), time_roughness_, and total_time_.

Referenced by getPER().

Here is the call graph for this function:

◆ getPER()

double UnderwaterGainFromDb::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 from UnderwaterPhysical.

Reimplemented in UnderwaterPhysicalfromdb.

References frequency_correction_factor_, getGain(), and UnderwaterPhysical::getPER().

Here is the call graph for this function:

◆ getTimeRoughness()

const int & UnderwaterGainFromDb::getTimeRoughness ( ) const
inlineprotected

Returns the time_roughness_ parameter.

Returns
time_roughness_

References time_roughness_.

Referenced by UnderwaterPhysicalfromdb::getGain(), and UnderwaterPhysicalfromdb::getSelfInterference().

◆ getTotalTime()

const int & UnderwaterGainFromDb::getTotalTime ( ) const
inlineprotected

Returns the total_time_ parameter.

Returns
total_time_

References total_time_.

Referenced by UnderwaterPhysicalfromdb::getGain(), and UnderwaterPhysicalfromdb::getSelfInterference().

◆ isZero()

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

Referenced by UnderwaterPhysicalfromdb::retrieveFromFile(), and retriveGainFromFile().

◆ retriveGainFromFile()

double UnderwaterGainFromDb::retriveGainFromFile ( const string &  _file_name,
const int &  _row_index,
const int &  _column_index 
) const
protectedvirtual
Parameters

param

Parameters

return

References isZero(), and token_separator_.

Referenced by getGain().

Here is the call graph for this function:

◆ setDepthRoughness()

void UnderwaterGainFromDb::setDepthRoughness ( const int &  _depth)
protectedvirtual

Sets the depth_roughness_ parameter.

Parameters
Roughnessof the depth samples.

References depth_roughness_.

◆ setDistanceRoughness()

void UnderwaterGainFromDb::setDistanceRoughness ( const int &  _distance)
protectedvirtual

Sets the distance_roughness_ parameter.

Parameters
Roughnessof the distance samples.

References distance_roughness_.

◆ setFrequencyCorrectionFactor()

void UnderwaterGainFromDb::setFrequencyCorrectionFactor ( const double &  _frequency_correction_factor)
protectedvirtual

Sets the frequency_correction_factor_ parameter.

Parameters
Frequencycorrection factor.

References frequency_correction_factor_.

◆ setTimeRoughness()

void UnderwaterGainFromDb::setTimeRoughness ( const int &  _time)
protectedvirtual

Sets the time_roughness_ parameter.

Parameters
Roughnessof the temporal samples.

References time_roughness_.

◆ setTotalTime()

void UnderwaterGainFromDb::setTotalTime ( const int &  _total_time)
protectedvirtual

Sets the total_time_ parameter.

Parameters
Maximumvalue of the temporal samples.

References total_time_.

Member Data Documentation

◆ depth_roughness_

int UnderwaterGainFromDb::depth_roughness_
private

Roughness of the depth samples.

Referenced by getDepthRoughness(), getGain(), setDepthRoughness(), and UnderwaterGainFromDb().

◆ distance_roughness_

int UnderwaterGainFromDb::distance_roughness_
private

Roughness of the distance samples.

Referenced by getDistanceRoughness(), getGain(), setDistanceRoughness(), and UnderwaterGainFromDb().

◆ frequency_correction_factor_

double UnderwaterGainFromDb::frequency_correction_factor_
private

used to shift from a frequency value to another one.

Referenced by getFrequencyCorrectionFactor(), getPER(), setFrequencyCorrectionFactor(), and UnderwaterGainFromDb().

◆ osstream_

ostringstream UnderwaterGainFromDb::osstream_
protected

Used to create strings.

Referenced by UnderwaterPhysicalfromdb::createNameFile(), and createNameFile().

◆ path_

char* UnderwaterGainFromDb::path_
protected

Name of the trace file writter for the current node.

Referenced by command(), UnderwaterPhysicalfromdb::command(), createNameFile(), and UnderwaterGainFromDb().

◆ time_roughness_

int UnderwaterGainFromDb::time_roughness_
private

Roughness of the temporal samples.

Referenced by getGain(), getTimeRoughness(), setTimeRoughness(), and UnderwaterGainFromDb().

◆ token_separator_

char UnderwaterGainFromDb::token_separator_
protected

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

Referenced by UnderwaterPhysicalfromdb::retrieveFromFile(), retriveGainFromFile(), and UnderwaterGainFromDb().

◆ total_time_

int UnderwaterGainFromDb::total_time_
private

Maximum value of the temporal samples, after this limit the smilulation time will be reset to zero.

Referenced by getGain(), getTotalTime(), setTotalTime(), and UnderwaterGainFromDb().


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