42#include "underwater-bpsk.h"
46#include "clmsg-stats.h"
47#include <phymac-clmsg.h>
86 virtual Stats*
clone()
const;
98 virtual void updateStats(
int mod_id,
int stck_id,
double rx_pwr,
99 double noise_pwr,
double interf_pwr,
double sinr,
double ber,
double per,
bool error);
136 virtual int command(
int,
const char *
const *);
143 virtual void recv(Packet *);
165 virtual void endTx(Packet *p);
172 virtual void endRx(Packet *p);
180 virtual void startRx(Packet *p);
187 inline virtual double
199 inline virtual double
216 virtual double getPER(
double snr,
int nbits, Packet *);
233 return std::fabs(value) < std::numeric_limits<double>::epsilon();
411 log2(
const double &_input)
const
413 return (log10(_input) / log10(2));
425 return erfc(sqrt(_snr *
log2(_M)) * sin(M_PI / _M));
int tot_ctrl_pkts_lost
Total number of CTRL pkts lost.
virtual void endRx(Packet *p)
Handles the end of a packet reception.
void incrTot_pkts_lost()
Increment the number of packets discarded.
std::string Interference_Model
Interference calcuation mode chosen: CHUNK model or MEANPOWER model.
int tot_pkts_lost
Total number of packets lost.
virtual double consumedEnergyTx(const double &_duration)
Compute the energy (in Joule) spent by the modem in transmission.
UnderwaterPhysical()
Constructor of UnderwaterPhysical class.
int recvSyncClMsg(ClMessage *m)
recv syncronous cross layer messages to require an operation from another module
double tx_power_
Power required in transmission.
virtual double consumedEnergyRx(const double &_duration)
Compute the energy (in Joule) spent by the modem in reception.
double Tx_Time_
Time (in seconds) spent by the node in transmission.
uwinterference * interference_
Pointer to the interference model module.
std::string modulation_name_
Modulation scheme name.
int collisionCTRL
Total number of CTRL pkts lost due to collision.
double Get_Energy_Rx()
Returns the energy (in Joule) spent by the node in reception.
int getError_CtrlPktsInterf()
virtual void endTx(Packet *p)
Handles the end of a packet transmission.
int errorCtrlPktsInterf
Total number of CTRL pkts lost due to interference.
void incrErrorCtrlPktsInterf()
Increment the number of CTRL packets discarded due to interference.
virtual double getPER(double snr, int nbits, Packet *)
Returns the packet error rate by using the length of a packet and the information contained in the pa...
double Energy_Rx_
Energy (in Joule) spent by the node in transmission.
double Transmitted_bytes_
Number of bytes transmitted.
virtual void updateInstantaneousStats()
Update the stats before sending them through crosslayer message.
virtual void startRx(Packet *p)
Handles the start of a reception.
virtual void recv(Packet *)
recv method.
const double log2(const double &_input) const
double Get_Rx_Time()
Returns the time (in seconds) spent by the node in reception.
double Energy_Tx_
Energy (in Joule) spent by the node in transmission.
double Get_Energy_Tx()
Returns the energy (in Joule) spent by the node in transmission.
double rx_power_
Power required in reception.
void incrCollisionCTRL()
Increment the number of CTRL pkts discarded due to a collision.
void incrCollisionDATAvsCTRL()
Increment the number of collisions DATA/CTRL.
double Get_Transmitted_bytes()
Returns the number of bytes transmitted.
double time_ready_to_end_rx_
Used to keep track of the arrival time.
const bool isZero(const double &value) const
Evaluates is the number passed as input is equal to zero.
int collisionDATA
Total number of DATA pkts lost due to collision.
int collisionDataCTRL
Total number of collisions between DATA pkts and CTRL pkts.
int getTot_CtrlPkts_lost()
double Get_Tx_Time()
Returns the time (in seconds) spent by the node in transmission.
int getCollisionsDATAvsCTRL()
const double get_prob_error_symbol_mpsk(const double &_snr, const uint32_t _M) const
double Rx_Time_
Time (in seconds) spent by the node in reception.
virtual ~UnderwaterPhysical()
Destructor of UnderwaterPhysical class.
virtual int command(int, const char *const *)
TCL command interpreter.
void incrCollisionDATA()
Increment the number of DATA pkts discarded due to a collision.
void incrTotCrtl_pkts_lost()
Increment the number of CTRL packets discarded.
UwPhysicalStats()
Constructor of UwPhysicalStats class.
double last_per
BER of the last received packet.
virtual ~UwPhysicalStats()
Destructor of UwPhysicalStats class.
virtual void updateStats(int mod_id, int stck_id, double rx_pwr, double noise_pwr, double interf_pwr, double sinr, double ber, double per, bool error)
Method to update stats with the param of last received packet.
virtual Stats * clone() const
Virtual method used by the Module class in order to copy its stats an a generic fashion,...
bool has_error
PER of the last received packet.
double last_ber
SINR of the last received packet.
double last_noise_power
Power of the last received packet.
double last_interf_power
Noise power measured on query.
double last_sinr
Interference power of the last rx packet.
double instant_noise_power
Noise power of the last received packet.
Implementation of uwinterference class.