DESERT 3.5.1
Loading...
Searching...
No Matches
uwinterferenceofdm.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
41#ifndef UW_INTERFERENCEOFDM
42#define UW_INTERFERENCEOFDM
43
44#include "uwinterference.h"
45#include "uwofdmphy_hdr.h"
46
47
48typedef std::pair<int, int> counter;
52
53class ListNodeOFDM : public ListNode
54{
55public:
56 std::vector<double> carrier_power;
57
58
66 ListNodeOFDM(double t, double sum_pw, int ctrl, int data, const std::vector<double>& carPwr):
67 carrier_power(carPwr)
68 {
69 time = t;
70 sum_power = sum_pw;
71 ctrl_cnt = ctrl;
72 data_cnt = data;
73 }
74
78 virtual ~ListNodeOFDM()
79 {
80 }
81};
82
83class EndInterfTimerOFDM : public Handler
84{
85public:
90 virtual void handle(Event *e);
91
92protected:
94};
95
96
98{
99public:
101
112 virtual int command(int, const char *const *);
113
121 virtual ~uwinterferenceofdm();
126 virtual void addToInterference(Packet *p);
134 virtual void addToInterference(double pw, PKT_TYPE tp, int* carriers, int carNum);
140 virtual void removeFromInterference(double pw, PKT_TYPE tp, const std::vector<double>& carPwr);
146 virtual double getInterferencePower(Packet *p);
154 virtual double getInterferencePower(
155 double power, double starttime, double duration, int* carriers, int ncar);
156
157 virtual double getCurrentTotalPower();
163 virtual double getCurrentTotalPowerOnCarrier(int carrier);
170 virtual double getTimeOverlap(Packet *p);
178 virtual double getTimeOverlap(double starttime, double duration);
184 virtual counter getCounters(Packet *p);
192 virtual counter getCounters(double starttime, double duration, PKT_TYPE tp);
193
197 inline int getInterfCarriers(){
198 return interfSubCarriers_;
199 }
204 inline void setInterfCarriers(int sc){
205 interfSubCarriers_ = sc;
206 return;
207 }
208
213 inline double
215 {
216 return start_rx_time;
217 }
222 inline double
224 {
225 return end_rx_time;
226 }
233 inline double
238
239protected:
240
241 std::list<ListNodeOFDM> power_list;
243 int inodeID; /* ID of the node */
244
245};
246
247#endif /*UW_INTERFERENCE*/
EndInterfTimerOFDM(uwinterferenceofdm *ptr)
uwinterferenceofdm * interference
virtual void handle(Event *e)
virtual ~ListNodeOFDM()
Destructor of the class ListNode.
std::vector< double > carrier_power
ListNodeOFDM(double t, double sum_pw, int ctrl, int data, const std::vector< double > &carPwr)
Constructor of the class ListNode when used with multicarrier.
int ctrl_cnt
sum of the rx power in the node at the given time
double time
int data_cnt
control packet counter
double sum_power
double end_rx_time
timetamp of the end of reception phase
double initial_interference_time
timestamp of the begin of reception of the first interferer packet
double start_rx_time
timestamp of the start of reception phase
double getStartRxTime()
Get the timestamp of the start of reception phase.
virtual int command(int, const char *const *)
TCL command interpreter.
std::list< ListNodeOFDM > power_list
List with power and counters.
void setInterfCarriers(int sc)
Sets number of carriers used by the node.
virtual void removeFromInterference(double pw, PKT_TYPE tp, const std::vector< double > &carPwr)
Remove a packet to the interference calculation.
double getInitialInterferenceTime()
Get the timestamp of the begin of reception of the first interferer packet.
uwinterferenceofdm()
Constructor of the class uwinterference.
virtual ~uwinterferenceofdm()
Destructor of the class uwinterference.
virtual double getCurrentTotalPowerOnCarrier(int carrier)
Compute the total power on a carrier.
virtual counter getCounters(Packet *p)
Returns the counters of collisions.
EndInterfTimerOFDM end_timerOFDM
Timer for schedules end of interference for a transmission.
virtual void addToInterference(Packet *p)
Add a packet to the interference calculation.
virtual double getInterferencePower(Packet *p)
Compute the average interference power for the given packet.
double getEndRxTime()
Get the timestamp of the end of reception phase.
virtual double getTimeOverlap(Packet *p)
Returns the percentage of overlap between current packet and interference packets.
virtual double getCurrentTotalPower()
Implementation of uwinterference class.
PKT_TYPE
std::pair< int, int > counter
counter of collisions
Common structures and variables in the protocol.