A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
interference-helper.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2005,2006 INRIA
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19
*/
20
#ifndef INTERFERENCE_HELPER_H
21
#define INTERFERENCE_HELPER_H
22
23
#include <stdint.h>
24
#include <vector>
25
#include <list>
26
#include "
wifi-mode.h
"
27
#include "
wifi-preamble.h
"
28
#include "
wifi-phy-standard.h
"
29
#include "ns3/nstime.h"
30
#include "ns3/simple-ref-count.h"
31
#include "ns3/wifi-tx-vector.h"
32
33
namespace
ns3 {
34
35
class
ErrorRateModel;
36
41
class
InterferenceHelper
42
{
43
public
:
44
class
Event
:
public
SimpleRefCount
<InterferenceHelper::Event>
45
{
46
public
:
47
Event
(uint32_t size,
WifiMode
payloadMode,
48
enum
WifiPreamble
preamble,
49
Time
duration,
double
rxPower,
WifiTxVector
txvector);
50
~Event
();
51
52
Time
GetDuration
(
void
)
const
;
53
Time
GetStartTime
(
void
)
const
;
54
Time
GetEndTime
(
void
)
const
;
55
double
GetRxPowerW
(
void
)
const
;
56
uint32_t
GetSize
(
void
)
const
;
57
WifiMode
GetPayloadMode
(
void
)
const
;
58
enum
WifiPreamble
GetPreambleType
(
void
)
const
;
59
WifiTxVector
GetTxVector
(
void
)
const
;
60
private
:
61
uint32_t
m_size
;
62
WifiMode
m_payloadMode
;
63
enum
WifiPreamble
m_preamble
;
64
Time
m_startTime
;
65
Time
m_endTime
;
66
double
m_rxPowerW
;
67
WifiTxVector
m_txVector
;
68
};
69
struct
SnrPer
70
{
71
double
snr
;
72
double
per
;
73
};
74
75
InterferenceHelper
();
76
~InterferenceHelper
();
77
78
void
SetNoiseFigure
(
double
value);
79
void
SetErrorRateModel
(
Ptr<ErrorRateModel>
rate);
80
81
double
GetNoiseFigure
(
void
)
const
;
82
Ptr<ErrorRateModel>
GetErrorRateModel
(
void
)
const
;
83
84
91
Time
GetEnergyDuration
(
double
energyW);
92
93
94
Ptr<InterferenceHelper::Event>
Add
(uint32_t size,
WifiMode
payloadMode,
95
enum
WifiPreamble
preamble,
96
Time
duration,
double
rxPower,
WifiTxVector
txvector);
97
98
struct
InterferenceHelper::SnrPer
CalculateSnrPer
(
Ptr
<
InterferenceHelper
::
Event
> event);
99
void
NotifyRxStart
();
100
void
NotifyRxEnd
();
101
void
EraseEvents
(void);
102
private
:
103
class
NiChange
104
{
105
public
:
106
NiChange
(
Time
time,
double
delta);
107
Time
GetTime (
void
)
const
;
108
double
GetDelta (
void
)
const
;
109
bool
operator <
(
const
NiChange
& o)
const
;
110
private
:
111
Time
m_time
;
112
double
m_delta
;
113
};
114
typedef
std::vector <NiChange>
NiChanges
;
115
typedef
std::list<Ptr<Event> >
Events
;
116
117
InterferenceHelper
(
const
InterferenceHelper
&o);
118
InterferenceHelper
&
operator =
(
const
InterferenceHelper
&o);
119
void
AppendEvent
(
Ptr<Event>
event);
120
double
CalculateNoiseInterferenceW
(
Ptr<Event>
event,
NiChanges
*ni)
const
;
121
double
CalculateSnr
(
double
signal,
double
noiseInterference,
WifiMode
mode)
const
;
122
double
CalculateChunkSuccessRate
(
double
snir,
Time
delay,
WifiMode
mode)
const
;
123
double
CalculatePer
(
Ptr<const Event>
event,
NiChanges
*ni)
const
;
124
125
double
m_noiseFigure
;
126
Ptr<ErrorRateModel>
m_errorRateModel
;
128
NiChanges
m_niChanges
;
129
double
m_firstPower
;
130
bool
m_rxing
;
132
NiChanges::iterator
GetPosition
(
Time
moment);
133
void
AddNiChangeEvent
(
NiChange
change);
134
};
135
136
}
// namespace ns3
137
138
#endif
/* INTERFERENCE_HELPER_H */
src
wifi
model
interference-helper.h
Generated on Fri Aug 30 2013 01:43:05 for ns-3 by
1.8.1.2