42#include "clmsg-stats.h"
43#include "underwater-bpsk.h"
73 virtual Stats *
clone()
const;
85 virtual void updateStats(
int mod_id,
int stck_id,
double rx_pwr,
86 double noise_pwr,
double interf_pwr,
double sinr,
double ber,
87 double per,
bool error);
123 virtual int command(
int,
const char *
const *)
override;
130 virtual void recv(Packet *)
override;
153 virtual void endTx(Packet *p)
override;
161 virtual void endRx(Packet *p)
override;
170 virtual void startRx(Packet *p)
override;
208 virtual double getPER(
double snr,
int nbits, Packet *_p);
225 return std::fabs(value) < std::numeric_limits<double>::epsilon();
402 log2(
const double &_input)
const
404 return (log10(_input) / log10(2));
416 return erfc(sqrt(_snr *
log2(_M)) * sin(M_PI / _M));
int tot_ctrl_pkts_lost
Total number of CTRL pkts lost.
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.
int getCollisionsDATAvsCTRL() const
UnderwaterPhysical()
Constructor of UnderwaterPhysical class.
double tx_power_
Power required in transmission.
bool isZero(const double &value) const
Evaluates is the number passed as input is equal to zero.
double get_prob_error_symbol_mpsk(const double &_snr, const uint32_t _M) const
double Tx_Time_
Time (in seconds) spent by the node in transmission.
uwinterference * interference_
Pointer to the interference module.
std::string modulation_name_
Modulation scheme name.
virtual double consumedEnergyTx(const double &_duration) const
Compute the energy (in Joule) spent by the modem in transmission.
int collisionCTRL
Total number of CTRL pkts lost due to collision.
virtual int command(int, const char *const *) override
TCL command interpreter.
double Get_Energy_Rx() const
Returns the energy (in Joule) spent by the node in reception.
int getCollisionsCTRL() const
int errorCtrlPktsInterf
Total number of CTRL pkts lost due to interference.
void incrErrorCtrlPktsInterf()
Increment the number of CTRL packets discarded due to interference.
int getError_CtrlPktsInterf() const
int getTot_CtrlPkts_lost() const
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.
double Get_Energy_Tx() const
Returns the energy (in Joule) spent by the node in transmission.
virtual void endTx(Packet *p) override
Handles the end of a packet transmission.
virtual void recv(Packet *) override
recv method.
double Energy_Tx_
Energy (in Joule) spent by the node in transmission.
double rx_power_
Power required in reception.
virtual void startRx(Packet *p) override
Handles the start of a reception.
void incrCollisionCTRL()
Increment the number of CTRL pkts discarded due to a collision.
void incrCollisionDATAvsCTRL()
Increment the number of collisions DATA/CTRL.
double time_ready_to_end_rx_
Used to keep track of the rx time.
int collisionDATA
Total number of DATA pkts lost due to collision.
virtual double consumedEnergyRx(const double &_duration) const
Compute the energy (in Joule) spent by the modem in reception.
int collisionDataCTRL
Total number of collisions between DATA pkts and CTRL pkts.
int recvSyncClMsg(ClMessage *m) override
recv syncronous cross layer messages to require an operation from another module
double Get_Tx_Time() const
Returns the time (in seconds) spent by the node in transmission.
int getTot_pkts_lost() const
virtual void endRx(Packet *p) override
Handles the end of a packet reception.
double log2(const double &_input) const
double Rx_Time_
Time (in seconds) spent by the node in reception.
virtual ~UnderwaterPhysical()
Destructor of UnderwaterPhysical class.
void incrCollisionDATA()
Increment the number of DATA pkts discarded due to a collision.
virtual double getPER(double snr, int nbits, Packet *_p)
Returns the packet error rate by using the length of a packet and the information contained in the pa...
void incrTotCrtl_pkts_lost()
Increment the number of CTRL packets discarded.
int getCollisionsDATA() const
double Get_Transmitted_bytes() const
Returns the number of bytes transmitted.
double Get_Rx_Time() const
Returns the time (in seconds) spent by the node in reception.
UwPhysicalStats()
Constructor of UwPhysicalStats class.
double last_per
BER of the last received packet.
double last_rx_power
True if last packet wasn't correctly received.
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,...
virtual ~UwPhysicalStats()=default
Destructor of UwPhysicalStats class.
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.