DESERT 4.0.0
uwhmmphysical.h
Go to the documentation of this file.
1//
2// Copyright (c) 2021 Regents of the SIGNET lab, University of Padova.
3// All rights reserved.
4//
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions
7// are met:
8// 1. Redistributions of source code must retain the above copyright
9// notice, this list of conditions and the following disclaimer.
10// 2. Redistributions in binary form must reproduce the above copyright
11// notice, this list of conditions and the following disclaimer in the
12// documentation and/or other materials provided with the distribution.
13// 3. Neither the name of the University of Padova (SIGNET lab) nor the
14// names of its contributors may be used to endorse or promote products
15// derived from this software without specific prior written permission.
16//
17// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
21// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28//
29
39#ifndef UWHMMPHYSICAL_H
40#define UWHMMPHYSICAL_H
41
42#include "mclink.h"
43#include "uwphysical.h"
44
46{
47public:
51 virtual ~UwHMMPhysicalStats() = default;
58 virtual Stats *clone() const;
59
71 virtual void updateStats(int mod_id, int stck_id, double rx_pwr,
72 double noise_pwr, double interf_pwr, double sinr, double ber,
73 double per, bool error,
75
78};
79
84{
85
86public:
91
95 virtual ~UnderwaterHMMPhysical();
96
107 virtual int command(int, const char *const *);
108
115 void setMCLink(int mac, MCLink *link);
116
121 int
123 {
124 return pkts_tot_bad;
125 }
126
131 int
133 {
134 return pkts_tot_medium;
135 }
136
141 int
143 {
144 return pkts_tot_good;
145 }
146
152 void
154 {
155 if (ch_state == MCLink::GOOD) {
157 } else if (ch_state == MCLink::MEDIUM) {
159 } else if (ch_state == MCLink::BAD) {
160 pkts_tot_bad++;
161 }
162 }
163
164protected:
171 virtual void endRx(Packet *p) override;
172
181 virtual double ber2per(double ber, Packet *p);
182
183 // Variables
184 std::map<int, MCLink *>
191private:
192 // Variables
193};
194
195#endif /* UWHMMPHYSICAL_H */
UnderwaterHMMPhysical models an hidden Markov Model phy channel.
Definition uwhmmphysical.h:84
virtual double ber2per(double ber, Packet *p)
Definition uwhmmphysical.cpp:314
virtual void endRx(Packet *p) override
Definition uwhmmphysical.cpp:156
int getPktsTotMedium() const
Definition uwhmmphysical.h:132
void incrTotPkts(MCLink::ChState ch_state)
Definition uwhmmphysical.h:153
void setMCLink(int mac, MCLink *link)
Definition uwhmmphysical.cpp:150
virtual ~UnderwaterHMMPhysical()
Definition uwhmmphysical.cpp:107
int getPktsTotGood() const
Definition uwhmmphysical.h:142
int getPktsTotBad() const
Definition uwhmmphysical.h:122
virtual int command(int, const char *const *)
Definition uwhmmphysical.cpp:114
int pkts_tot_good
Definition uwhmmphysical.h:186
std::map< int, MCLink * > link_map
Definition uwhmmphysical.h:185
int pkts_tot_bad
Definition uwhmmphysical.h:189
int pkts_tot_medium
Definition uwhmmphysical.h:187
UnderwaterHMMPhysical()
Definition uwhmmphysical.cpp:97
Definition uwphysical.h:100
Definition uwhmmphysical.h:46
virtual ~UwHMMPhysicalStats()=default
virtual Stats * clone() const
Definition uwhmmphysical.cpp:61
MCLink::ChState channel_state
Definition uwhmmphysical.h:76
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, MCLink::ChState channel_state=MCLink::ChState::NOT_DEFINED)
Definition uwhmmphysical.cpp:67
Definition uwphysical.h:50
Definition of UwPhysical class.