DESERT 3.5.1
Loading...
Searching...
No Matches
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 <rng.h>
45#include <packet.h>
46#include <module.h>
47#include <tclcl.h>
48
49#include <iostream>
50#include <string.h>
51#include <cmath>
52#include <limits>
53#include <climits>
54#include <math.h>
55#include <node-core.h>
56#include <fstream>
57#include <sstream>
58#include <map>
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 */
virtual void initializeLUT()
Inizialize LUT of c_variable values.
virtual double lookUpLightNoiseE(double depth)
DepthMap lut_map
Lookup table map of the solar noise versus the depth.
bool variable_temperature_
Flag to set whether the temperature is costant or varialbe with the depth.
virtual void startRx(Packet *p)
virtual double getNoisePower(Packet *p)
virtual void endRx(Packet *p)
string lut_file_name_
char lut_token_separator_
virtual ~UwOpticalPhy()
Destructor of UwMultiPhy class.
double getVarTemperature(Packet *p)
virtual double getSNRdB(Packet *p)
bool use_woss_
Flag to set whether woss is employed.
UwOpticalPhy()
Constructor of UwMultiPhy class.
virtual int command(int, const char *const *)
TCL command interpreter.
virtual double linearInterpolator(double x, double x1, double y1, double x2, double y2)
DepthMap::iterator DMIt
::std::map< double, double > DepthMap