DESERT 3.5.1
Loading...
Searching...
No Matches
uwgainfromdb.h
Go to the documentation of this file.
1//
2// Copyright (c) 2017 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 UWGAINFROMDB_H
40#define UWGAINFROMDB_H
41
42#include <uwphysical.h>
43
44#include <packet.h>
45#include <module.h>
46#include <tclcl.h>
47
48#include <fstream>
49#include <sstream>
50
52{
53
54public:
59
64 {
65 }
66
77 virtual int command(int, const char *const *);
78
79protected:
91 virtual double getPER(double snr, int nbits, Packet *p);
92
98 virtual void setTimeRoughness(const int &);
99
105 virtual void setDepthRoughness(const int &);
106
112 virtual void setDistanceRoughness(const int &);
113
119 virtual void setTotalTime(const int &);
120
126 virtual void setFrequencyCorrectionFactor(const double &);
127
133 inline const int &
135 {
136 return time_roughness_;
137 }
138
144 inline const int &
146 {
147 return depth_roughness_;
148 }
149
155 inline const int &
157 {
158 return distance_roughness_;
159 }
160
166 inline const int &
168 {
169 return total_time_;
170 }
171
177 inline const double &
182
191 virtual double getGain(
192 const double &, const double &, const double &, const double &);
193
201 virtual double retriveGainFromFile(
202 const string &, const int &, const int &) const;
203
211 virtual string createNameFile(const int &, const int &);
212
225 inline const bool
226 isZero(const double &value) const
227 {
228 return std::fabs(value) < std::numeric_limits<double>::epsilon();
229 }
230
231 char *path_;
236private:
237 // Variables
245};
246
247#endif /* UWGAINFROMDB_H */
double frequency_correction_factor_
used to shift from a frequency value to another one.
const bool isZero(const double &value) const
Evaluates is the number passed as input is equal to zero.
const int & getDepthRoughness() const
Returns the depth_roughness_ parameter.
int time_roughness_
Roughness of the temporal samples.
virtual void setDistanceRoughness(const int &)
Sets the distance_roughness_ parameter.
char * path_
Name of the trace file writter for the current node.
const int & getDistanceRoughness() const
Returns the distance_roughness_ parameter.
const int & getTimeRoughness() const
Returns the time_roughness_ parameter.
virtual int command(int, const char *const *)
TCL command interpreter.
virtual void setTotalTime(const int &)
Sets the total_time_ parameter.
ostringstream osstream_
Used to create strings.
virtual void setTimeRoughness(const int &)
Sets the time_roughness_ parameter.
int depth_roughness_
Roughness of the depth samples.
virtual void setDepthRoughness(const int &)
Sets the depth_roughness_ parameter.
const double & getFrequencyCorrectionFactor() const
Returns the frequency_correction_factor_ parameter.
virtual void setFrequencyCorrectionFactor(const double &)
Sets the frequency_correction_factor_ parameter.
virtual ~UnderwaterGainFromDb()
Destructor of UnderwaterMPhyBpskDb class.
virtual double retriveGainFromFile(const string &, const int &, const int &) const
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...
virtual double getGain(const double &, const double &, const double &, const double &)
int total_time_
Maximum value of the temporal samples, after this limit the smilulation time will be reset to zero.
UnderwaterGainFromDb()
Constructor of UnderwaterMPhyBpskDb class.
const int & getTotalTime() const
Returns the total_time_ parameter.
int distance_roughness_
Roughness of the distance samples.
virtual string createNameFile(const int &, const int &)
Creates the name of the file to load.
char token_separator_
Token used to parse the elements in a line of the database.
Definition of UwPhysical class.