DESERT 4.0.0
uwoptical-phy.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 UWOPTICAL_PHY_H
40#define UWOPTICAL_PHY_H
41
42#include <bpsk.h>
43
44#include <module.h>
45#include <packet.h>
46#include <rng.h>
47#include <tclcl.h>
48
49#include <climits>
50#include <cmath>
51#include <fstream>
52#include <iostream>
53#include <limits>
54#include <map>
55#include <math.h>
56#include <node-core.h>
57#include <sstream>
58#include <string.h>
59#include <vector>
60
61#define OPTICAL_MODULATION_TYPE "OPTIC_BPSK"
62#define NOT_FOUND_VALUE 0
63#define IL_ILLEGAL -1
64
65typedef ::std::map<double, double> DepthMap;
66typedef DepthMap::iterator DMIt;
67
68class UwOpticalPhy : public MPhy_Bpsk
69{
70
71public:
76
80 virtual ~UwOpticalPhy()
81 {
82 }
83
94 virtual int command(int, const char *const *);
95
96 virtual void startRx(Packet *p);
97
98 virtual double getSNRdB(Packet *p);
99
100 virtual void endRx(Packet *p);
101
102 virtual double getNoisePower(Packet *p);
103
104protected:
105 virtual double lookUpLightNoiseE(double depth);
106
107 virtual double linearInterpolator(
108 double x, double x1, double y1, double x2, double y2);
109
113 virtual void initializeLUT();
114
115 double getVarTemperature(Packet *p);
118 // Variables
119private:
120 // Variables
121 double Id; // dark current
122 double Il; // light current it can be approximated to the short circuit
123 // current
124 double R; // shunt resistance
125 double S; // sensitivity
126 double T; // temperature (K)
127 double Ar_; // receiver area [m^2]
128 string lut_file_name_; // LUT file name
134};
135
136#endif /* UWOPTICAL_H */
Definition uwoptical-phy.h:69
virtual void initializeLUT()
Definition uwoptical-phy.cpp:258
virtual double lookUpLightNoiseE(double depth)
Definition uwoptical-phy.cpp:221
double S
Definition uwoptical-phy.h:125
DepthMap lut_map
Definition uwoptical-phy.h:131
double T
Definition uwoptical-phy.h:126
bool variable_temperature_
Definition uwoptical-phy.h:132
virtual void startRx(Packet *p)
Definition uwoptical-phy.cpp:118
virtual double getNoisePower(Packet *p)
Definition uwoptical-phy.cpp:167
virtual void endRx(Packet *p)
Definition uwoptical-phy.cpp:187
string lut_file_name_
Definition uwoptical-phy.h:128
double Il
Definition uwoptical-phy.h:122
char lut_token_separator_
Definition uwoptical-phy.h:129
double R
Definition uwoptical-phy.h:124
virtual ~UwOpticalPhy()
Definition uwoptical-phy.h:80
double getVarTemperature(Packet *p)
Definition uwoptical-phy.cpp:157
virtual double getSNRdB(Packet *p)
Definition uwoptical-phy.cpp:149
double Id
Definition uwoptical-phy.h:121
bool use_woss_
Definition uwoptical-phy.h:116
double Ar_
Definition uwoptical-phy.h:127
UwOpticalPhy()
Definition uwoptical-phy.cpp:60
virtual int command(int, const char *const *)
Definition uwoptical-phy.cpp:81
virtual double linearInterpolator(double x, double x1, double y1, double x2, double y2)
Definition uwoptical-phy.cpp:248
DepthMap::iterator DMIt
Definition uwoptical-phy.h:66
::std::map< double, double > DepthMap
Definition uwoptical-phy.h:65