author | Pavel Boyko <boyko@iitp.ru> |
Tue, 16 Jun 2009 17:58:16 +0400 | |
changeset 5074 | 355de6af8ea9 |
parent 5052 | ac896a31075c |
child 5102 | 0bb1dd1c301d |
permissions | -rw-r--r-- |
1889 | 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 |
||
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
21 |
#include "yans-wifi-phy.h" |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
22 |
#include "yans-wifi-channel.h" |
1891
add6fb8761f3
use WifiMode rather than TransmissionMode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1890
diff
changeset
|
23 |
#include "wifi-mode.h" |
1920
1d4864775cf8
replace header mode with preamble mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1919
diff
changeset
|
24 |
#include "wifi-preamble.h" |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
25 |
#include "wifi-phy-state-helper.h" |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3900
diff
changeset
|
26 |
#include "error-rate-model.h" |
1889 | 27 |
#include "ns3/simulator.h" |
28 |
#include "ns3/packet.h" |
|
29 |
#include "ns3/random-variable.h" |
|
1974
0d6b3bead74a
replace cassert by ns3/assert.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
30 |
#include "ns3/assert.h" |
1979
d535a38b7fc4
convert TRACE to NS_LOG
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1978
diff
changeset
|
31 |
#include "ns3/log.h" |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
32 |
#include "ns3/double.h" |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
33 |
#include "ns3/uinteger.h" |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
34 |
#include "ns3/enum.h" |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
35 |
#include "ns3/pointer.h" |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
36 |
#include "ns3/net-device.h" |
4263
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4039
diff
changeset
|
37 |
#include "ns3/trace-source-accessor.h" |
1889 | 38 |
#include <math.h> |
39 |
||
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
40 |
NS_LOG_COMPONENT_DEFINE ("YansWifiPhy"); |
1891
add6fb8761f3
use WifiMode rather than TransmissionMode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1890
diff
changeset
|
41 |
|
1889 | 42 |
namespace ns3 { |
43 |
||
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
44 |
NS_OBJECT_ENSURE_REGISTERED (YansWifiPhy); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
45 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
46 |
TypeId |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
47 |
YansWifiPhy::GetTypeId (void) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
48 |
{ |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
49 |
static TypeId tid = TypeId ("ns3::YansWifiPhy") |
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
50 |
.SetParent<WifiPhy> () |
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
51 |
.AddConstructor<YansWifiPhy> () |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
52 |
.AddAttribute ("EnergyDetectionThreshold", |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
53 |
"The energy of a received signal should be higher than " |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
54 |
"this threshold (dbm) to allow the PHY layer to detect the signal.", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
55 |
DoubleValue (-140.0), |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
56 |
MakeDoubleAccessor (&YansWifiPhy::SetEdThreshold, |
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
57 |
&YansWifiPhy::GetEdThreshold), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
58 |
MakeDoubleChecker<double> ()) |
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
59 |
.AddAttribute ("CcaMode1Threshold", |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
60 |
"The energy of a received signal should be higher than " |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
61 |
"this threshold (dbm) to allow the PHY layer to declare CCA BUSY state", |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
62 |
DoubleValue (-140.0), |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
63 |
MakeDoubleAccessor (&YansWifiPhy::SetCcaMode1Threshold, |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
64 |
&YansWifiPhy::GetCcaMode1Threshold), |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
65 |
MakeDoubleChecker<double> ()) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
66 |
.AddAttribute ("TxGain", |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
67 |
"Transmission gain (dB).", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
68 |
DoubleValue (1.0), |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
69 |
MakeDoubleAccessor (&YansWifiPhy::SetTxGain, |
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
70 |
&YansWifiPhy::GetTxGain), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
71 |
MakeDoubleChecker<double> ()) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
72 |
.AddAttribute ("RxGain", |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
73 |
"Reception gain (dB).", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
74 |
DoubleValue (1.0), |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
75 |
MakeDoubleAccessor (&YansWifiPhy::SetRxGain, |
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
76 |
&YansWifiPhy::GetRxGain), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
77 |
MakeDoubleChecker<double> ()) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
78 |
.AddAttribute ("TxPowerLevels", |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
79 |
"Number of transmission power levels available between " |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
80 |
"TxPowerBase and TxPowerEnd included.", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
81 |
UintegerValue (1), |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
82 |
MakeUintegerAccessor (&YansWifiPhy::m_nTxPower), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
83 |
MakeUintegerChecker<uint32_t> ()) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
84 |
.AddAttribute ("TxPowerEnd", |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
85 |
"Maximum available transmission level (dbm).", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
86 |
DoubleValue (16.0206), |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
87 |
MakeDoubleAccessor (&YansWifiPhy::SetTxPowerEnd, |
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
88 |
&YansWifiPhy::GetTxPowerEnd), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
89 |
MakeDoubleChecker<double> ()) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
90 |
.AddAttribute ("TxPowerStart", |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
91 |
"Minimum available transmission level (dbm).", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
92 |
DoubleValue (16.0206), |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
93 |
MakeDoubleAccessor (&YansWifiPhy::SetTxPowerStart, |
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
94 |
&YansWifiPhy::GetTxPowerStart), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
95 |
MakeDoubleChecker<double> ()) |
4315
56a5bf298339
noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
96 |
.AddAttribute ("RxNoiseFigure", |
56a5bf298339
noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
97 |
"Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver." |
56a5bf298339
noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
98 |
" According to Wikipedia (http://en.wikipedia.org/wiki/Noise_figure), this is " |
56a5bf298339
noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
99 |
"\"the difference in decibels (dB) between" |
56a5bf298339
noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
100 |
" the noise output of the actual receiver to the noise output of an " |
56a5bf298339
noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
101 |
" ideal receiver with the same overall gain and bandwidth when the receivers " |
56a5bf298339
noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
102 |
" are connected to sources at the standard noise temperature T0 (usually 290 K)\"." |
56a5bf298339
noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
103 |
" For", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
104 |
DoubleValue (7), |
4315
56a5bf298339
noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
105 |
MakeDoubleAccessor (&YansWifiPhy::SetRxNoiseFigure, |
56a5bf298339
noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
106 |
&YansWifiPhy::GetRxNoiseFigure), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
107 |
MakeDoubleChecker<double> ()) |
3212
0c00342d6a73
improve attribute documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2989
diff
changeset
|
108 |
.AddAttribute ("Standard", "The standard chosen configures a set of transmission modes" |
0c00342d6a73
improve attribute documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2989
diff
changeset
|
109 |
" and some PHY-specific constants.", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
110 |
EnumValue (WIFI_PHY_STANDARD_80211a), |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
111 |
MakeEnumAccessor (&YansWifiPhy::SetStandard), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
112 |
MakeEnumChecker (WIFI_PHY_STANDARD_80211a, "802.11a", |
4470 | 113 |
WIFI_PHY_STANDARD_80211b, "802.11b", |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
114 |
WIFI_PHY_STANDARD_holland, "holland")) |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
115 |
.AddAttribute ("State", "The state of the PHY layer", |
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
116 |
PointerValue (), |
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
117 |
MakePointerAccessor (&YansWifiPhy::m_state), |
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
118 |
MakePointerChecker<WifiPhyStateHelper> ()) |
5052 | 119 |
.AddAttribute ("ChannelSwitchDelay", |
120 |
"Delay between two short frames transmitted on different frequencies", |
|
121 |
TimeValue (MicroSeconds (250)), |
|
122 |
MakeTimeAccessor (&YansWifiPhy::m_channelSwitchDelay), |
|
123 |
MakeTimeChecker ()) |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
124 |
; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
125 |
return tid; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
126 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
127 |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
128 |
YansWifiPhy::YansWifiPhy () |
5051 | 129 |
: m_channelFreqMhz(2437), |
130 |
m_endSyncEvent (), |
|
131 |
m_random (0.0, 1.0), |
|
132 |
m_channelStartingFrequency(0.0) |
|
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
133 |
{ |
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
134 |
NS_LOG_FUNCTION (this); |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
135 |
m_state = CreateObject<WifiPhyStateHelper> (); |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
136 |
} |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
137 |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
138 |
YansWifiPhy::~YansWifiPhy () |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
139 |
{ |
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
140 |
NS_LOG_FUNCTION (this); |
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
141 |
} |
2530
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
142 |
|
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
143 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
144 |
YansWifiPhy::DoDispose (void) |
1964
041240a915f8
build and link
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1920
diff
changeset
|
145 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
146 |
NS_LOG_FUNCTION (this); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
147 |
m_channel = 0; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
148 |
m_modes.clear (); |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
149 |
m_device = 0; |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
150 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
151 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
152 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
153 |
YansWifiPhy::SetStandard (enum WifiPhyStandard standard) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
154 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
155 |
NS_LOG_FUNCTION (this << standard); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
156 |
m_standard = standard; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
157 |
switch (standard) { |
2166
00b5eb43dba2
Improve the accuracy of 802.11a tx duration calculations.
Federico Maguolo <federico.maguolo@dei.unipd.it>
parents:
2164
diff
changeset
|
158 |
case WIFI_PHY_STANDARD_80211a: |
2083
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
159 |
Configure80211a (); |
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
160 |
break; |
4470 | 161 |
case WIFI_PHY_STANDARD_80211b: |
162 |
Configure80211b (); |
|
163 |
break; |
|
2166
00b5eb43dba2
Improve the accuracy of 802.11a tx duration calculations.
Federico Maguolo <federico.maguolo@dei.unipd.it>
parents:
2164
diff
changeset
|
164 |
case WIFI_PHY_STANDARD_holland: |
2083
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
165 |
ConfigureHolland (); |
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
166 |
break; |
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
167 |
default: |
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
168 |
NS_ASSERT (false); |
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
169 |
break; |
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
170 |
} |
1964
041240a915f8
build and link
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1920
diff
changeset
|
171 |
} |
1889 | 172 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
173 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
174 |
void |
4315
56a5bf298339
noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
175 |
YansWifiPhy::SetRxNoiseFigure (double noiseFigureDb) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
176 |
{ |
4315
56a5bf298339
noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
177 |
NS_LOG_FUNCTION (this << noiseFigureDb); |
56a5bf298339
noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
178 |
m_interference.SetNoiseFigure (DbToRatio (noiseFigureDb)); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
179 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
180 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
181 |
YansWifiPhy::SetTxPowerStart (double start) |
1889 | 182 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
183 |
NS_LOG_FUNCTION (this << start); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
184 |
m_txPowerBaseDbm = start; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
185 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
186 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
187 |
YansWifiPhy::SetTxPowerEnd (double end) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
188 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
189 |
NS_LOG_FUNCTION (this << end); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
190 |
m_txPowerEndDbm = end; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
191 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
192 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
193 |
YansWifiPhy::SetNTxPower (uint32_t n) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
194 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
195 |
NS_LOG_FUNCTION (this << n); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
196 |
m_nTxPower = n; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
197 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
198 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
199 |
YansWifiPhy::SetTxGain (double gain) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
200 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
201 |
NS_LOG_FUNCTION (this << gain); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
202 |
m_txGainDb = gain; |
1889 | 203 |
} |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
204 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
205 |
YansWifiPhy::SetRxGain (double gain) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
206 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
207 |
NS_LOG_FUNCTION (this << gain); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
208 |
m_rxGainDb = gain; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
209 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
210 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
211 |
YansWifiPhy::SetEdThreshold (double threshold) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
212 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
213 |
NS_LOG_FUNCTION (this << threshold); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
214 |
m_edThresholdW = DbmToW (threshold); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
215 |
} |
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
216 |
void |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
217 |
YansWifiPhy::SetCcaMode1Threshold (double threshold) |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
218 |
{ |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
219 |
NS_LOG_FUNCTION (this << threshold); |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
220 |
m_ccaMode1ThresholdW = DbmToW (threshold); |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
221 |
} |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
222 |
void |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
223 |
YansWifiPhy::SetErrorRateModel (Ptr<ErrorRateModel> rate) |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
224 |
{ |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
225 |
m_interference.SetErrorRateModel (rate); |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
226 |
} |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
227 |
void |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
228 |
YansWifiPhy::SetDevice (Ptr<Object> device) |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
229 |
{ |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
230 |
m_device = device; |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
231 |
} |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
232 |
void |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
233 |
YansWifiPhy::SetMobility (Ptr<Object> mobility) |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
234 |
{ |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
235 |
m_mobility = mobility; |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
236 |
} |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
237 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
238 |
double |
4315
56a5bf298339
noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
239 |
YansWifiPhy::GetRxNoiseFigure (void) const |
2155
194dd8bdcf56
add WifiPhy::GetDevice
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2150
diff
changeset
|
240 |
{ |
4315
56a5bf298339
noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
241 |
return RatioToDb (m_interference.GetNoiseFigure ()); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
242 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
243 |
double |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
244 |
YansWifiPhy::GetTxPowerStart (void) const |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
245 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
246 |
return m_txPowerBaseDbm; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
247 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
248 |
double |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
249 |
YansWifiPhy::GetTxPowerEnd (void) const |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
250 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
251 |
return m_txPowerEndDbm; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
252 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
253 |
double |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
254 |
YansWifiPhy::GetTxGain (void) const |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
255 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
256 |
return m_txGainDb; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
257 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
258 |
double |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
259 |
YansWifiPhy::GetRxGain (void) const |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
260 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
261 |
return m_rxGainDb; |
2155
194dd8bdcf56
add WifiPhy::GetDevice
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2150
diff
changeset
|
262 |
} |
194dd8bdcf56
add WifiPhy::GetDevice
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2150
diff
changeset
|
263 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
264 |
double |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
265 |
YansWifiPhy::GetEdThreshold (void) const |
2055
8899d6ef5d52
phy state logger
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1999
diff
changeset
|
266 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
267 |
return WToDbm (m_edThresholdW); |
2055
8899d6ef5d52
phy state logger
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1999
diff
changeset
|
268 |
} |
1889 | 269 |
|
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
270 |
double |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
271 |
YansWifiPhy::GetCcaMode1Threshold (void) const |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
272 |
{ |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
273 |
return WToDbm (m_ccaMode1ThresholdW); |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
274 |
} |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
275 |
|
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
276 |
Ptr<ErrorRateModel> |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
277 |
YansWifiPhy::GetErrorRateModel (void) const |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
278 |
{ |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
279 |
return m_interference.GetErrorRateModel (); |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
280 |
} |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
281 |
Ptr<Object> |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
282 |
YansWifiPhy::GetDevice (void) const |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
283 |
{ |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
284 |
return m_device; |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
285 |
} |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
286 |
Ptr<Object> |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
287 |
YansWifiPhy::GetMobility (void) |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
288 |
{ |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
289 |
return m_mobility; |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
290 |
} |
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
291 |
|
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
292 |
double |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
293 |
YansWifiPhy::CalculateSnr (WifiMode txMode, double ber) const |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
294 |
{ |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
295 |
return m_interference.GetErrorRateModel ()->CalculateSnr (txMode, ber); |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
296 |
} |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
297 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
298 |
Ptr<WifiChannel> |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
299 |
YansWifiPhy::GetChannel (void) const |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
300 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
301 |
return m_channel; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
302 |
} |
1889 | 303 |
void |
3893
94f771c1373a
split WifiChannel in WifiChannel + YansWifiChannel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3888
diff
changeset
|
304 |
YansWifiPhy::SetChannel (Ptr<YansWifiChannel> channel) |
1889 | 305 |
{ |
1891
add6fb8761f3
use WifiMode rather than TransmissionMode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1890
diff
changeset
|
306 |
m_channel = channel; |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
307 |
m_channel->Add (this); |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
308 |
m_channelId = 0; // always start on channel starting frequency |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
309 |
} |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
310 |
|
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
311 |
void |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
312 |
YansWifiPhy::SetFrequencyChannel (uint16_t nch) |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
313 |
{ |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
314 |
Simulator::Schedule (m_channelSwitchDelay, &YansWifiPhy::DoSetChannelId, this, nch); |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
315 |
} |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
316 |
|
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
317 |
void |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
318 |
YansWifiPhy::DoSetChannelId (uint16_t nch) |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
319 |
{ |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
320 |
NS_LOG_DEBUG("switching channel " << m_channelId << " -> " << nch); |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
321 |
m_channelId = nch; |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
322 |
} |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
323 |
|
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
324 |
uint16_t |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
325 |
YansWifiPhy::GetFrequencyChannel() const |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
326 |
{ |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
327 |
return m_channelId; |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
328 |
} |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
329 |
|
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
330 |
double |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
331 |
YansWifiPhy::GetChannelCenterFrequency() const |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
332 |
{ |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
333 |
return m_channelStartingFrequency + 5e6 * GetFrequencyChannel(); |
1889 | 334 |
} |
335 |
||
336 |
void |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
337 |
YansWifiPhy::SetReceiveOkCallback (SyncOkCallback callback) |
1889 | 338 |
{ |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
339 |
m_state->SetReceiveOkCallback (callback); |
1889 | 340 |
} |
5051 | 341 |
|
1889 | 342 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
343 |
YansWifiPhy::SetReceiveErrorCallback (SyncErrorCallback callback) |
1889 | 344 |
{ |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
345 |
m_state->SetReceiveErrorCallback (callback); |
1889 | 346 |
} |
347 |
void |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
348 |
YansWifiPhy::StartReceivePacket (Ptr<Packet> packet, |
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
349 |
double rxPowerDbm, |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
350 |
WifiMode txMode, |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
351 |
enum WifiPreamble preamble) |
1889 | 352 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
353 |
NS_LOG_FUNCTION (this << packet << rxPowerDbm << txMode << preamble); |
2071
122c95ffccdd
use dB instead of dbm where appropriate
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2056
diff
changeset
|
354 |
rxPowerDbm += m_rxGainDb; |
1988
210701141b08
convert to and from dbms when needed
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1979
diff
changeset
|
355 |
double rxPowerW = DbmToW (rxPowerDbm); |
2159
20f882e85b4a
port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2155
diff
changeset
|
356 |
Time rxDuration = CalculateTxDuration (packet->GetSize (), txMode, preamble); |
1889 | 357 |
Time endRx = Simulator::Now () + rxDuration; |
358 |
||
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
359 |
Ptr<InterferenceHelper::Event> event; |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
360 |
event = m_interference.Add (packet->GetSize (), |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
361 |
txMode, |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
362 |
preamble, |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
363 |
rxDuration, |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
364 |
rxPowerW); |
1889 | 365 |
|
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
366 |
switch (m_state->GetState ()) { |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
367 |
case YansWifiPhy::SYNC: |
1979
d535a38b7fc4
convert TRACE to NS_LOG
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1978
diff
changeset
|
368 |
NS_LOG_DEBUG ("drop packet because already in Sync (power="<< |
d535a38b7fc4
convert TRACE to NS_LOG
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1978
diff
changeset
|
369 |
rxPowerW<<"W)"); |
4264
9d2e96c4e6e4
Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4263
diff
changeset
|
370 |
NotifyRxDrop (packet); |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
371 |
if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ()) |
1889 | 372 |
{ |
3897
44645cec42f2
split state management in a helper class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3893
diff
changeset
|
373 |
// that packet will be noise _after_ the reception of the |
44645cec42f2
split state management in a helper class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3893
diff
changeset
|
374 |
// currently-received packet. |
1889 | 375 |
goto maybeCcaBusy; |
376 |
} |
|
377 |
break; |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
378 |
case YansWifiPhy::TX: |
1979
d535a38b7fc4
convert TRACE to NS_LOG
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1978
diff
changeset
|
379 |
NS_LOG_DEBUG ("drop packet because already in Tx (power="<< |
d535a38b7fc4
convert TRACE to NS_LOG
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1978
diff
changeset
|
380 |
rxPowerW<<"W)"); |
4264
9d2e96c4e6e4
Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4263
diff
changeset
|
381 |
NotifyRxDrop (packet); |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
382 |
if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ()) |
1889 | 383 |
{ |
3897
44645cec42f2
split state management in a helper class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3893
diff
changeset
|
384 |
// that packet will be noise _after_ the transmission of the |
44645cec42f2
split state management in a helper class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3893
diff
changeset
|
385 |
// currently-transmitted packet. |
1889 | 386 |
goto maybeCcaBusy; |
387 |
} |
|
388 |
break; |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
389 |
case YansWifiPhy::CCA_BUSY: |
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
390 |
case YansWifiPhy::IDLE: |
1889 | 391 |
if (rxPowerW > m_edThresholdW) |
392 |
{ |
|
2150
e4aff46fe6c5
add some info logs, improve snr vs ber curve output, linearize the ber calculations.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2139
diff
changeset
|
393 |
NS_LOG_DEBUG ("sync (power="<<rxPowerW<<"W)"); |
1889 | 394 |
// sync to signal |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
395 |
m_state->SwitchToSync (rxDuration); |
1974
0d6b3bead74a
replace cassert by ns3/assert.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
396 |
NS_ASSERT (m_endSyncEvent.IsExpired ()); |
4264
9d2e96c4e6e4
Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4263
diff
changeset
|
397 |
NotifyRxBegin (packet); |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
398 |
m_endSyncEvent = Simulator::Schedule (rxDuration, &YansWifiPhy::EndSync, this, |
1889 | 399 |
packet, |
1919
46ed9ed9dac0
remove extra WifiPhy::SendPacket argument. Add header mode support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1909
diff
changeset
|
400 |
event); |
2071
122c95ffccdd
use dB instead of dbm where appropriate
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2056
diff
changeset
|
401 |
} |
1889 | 402 |
else |
403 |
{ |
|
1979
d535a38b7fc4
convert TRACE to NS_LOG
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1978
diff
changeset
|
404 |
NS_LOG_DEBUG ("drop packet because signal power too Small ("<< |
d535a38b7fc4
convert TRACE to NS_LOG
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1978
diff
changeset
|
405 |
rxPowerW<<"<"<<m_edThresholdW<<")"); |
4264
9d2e96c4e6e4
Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4263
diff
changeset
|
406 |
NotifyRxDrop (packet); |
1889 | 407 |
goto maybeCcaBusy; |
408 |
} |
|
409 |
break; |
|
410 |
} |
|
411 |
||
412 |
return; |
|
413 |
||
414 |
maybeCcaBusy: |
|
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
415 |
// We are here because we have received the first bit of a packet and we are |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
416 |
// not going to be able to synchronize on it |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
417 |
// In this model, CCA becomes busy when the aggregation of all signals as |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
418 |
// tracked by the InterferenceHelper class is higher than the CcaBusyThreshold |
1889 | 419 |
|
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
420 |
Time delayUntilCcaEnd = m_interference.GetEnergyDuration (m_ccaMode1ThresholdW); |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
421 |
if (!delayUntilCcaEnd.IsZero ()) |
1889 | 422 |
{ |
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
423 |
m_state->SwitchMaybeToCcaBusy (delayUntilCcaEnd); |
1889 | 424 |
} |
425 |
} |
|
4263
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4039
diff
changeset
|
426 |
|
1889 | 427 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
428 |
YansWifiPhy::SendPacket (Ptr<const Packet> packet, WifiMode txMode, WifiPreamble preamble, uint8_t txPower) |
1889 | 429 |
{ |
3882
05de3d432860
print the tx power, not a random character
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3880
diff
changeset
|
430 |
NS_LOG_FUNCTION (this << packet << txMode << preamble << (uint32_t)txPower); |
1889 | 431 |
/* Transmission can happen if: |
432 |
* - we are syncing on a packet. It is the responsability of the |
|
433 |
* MAC layer to avoid doing this but the PHY does nothing to |
|
434 |
* prevent it. |
|
435 |
* - we are idle |
|
436 |
*/ |
|
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
437 |
NS_ASSERT (!m_state->IsStateTx ()); |
1889 | 438 |
|
2159
20f882e85b4a
port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2155
diff
changeset
|
439 |
Time txDuration = CalculateTxDuration (packet->GetSize (), txMode, preamble); |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
440 |
if (m_state->IsStateSync ()) |
3897
44645cec42f2
split state management in a helper class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3893
diff
changeset
|
441 |
{ |
44645cec42f2
split state management in a helper class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3893
diff
changeset
|
442 |
m_endSyncEvent.Cancel (); |
44645cec42f2
split state management in a helper class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3893
diff
changeset
|
443 |
} |
4264
9d2e96c4e6e4
Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4263
diff
changeset
|
444 |
NotifyTxBegin (packet); |
5051 | 445 |
uint32_t dataRate500KbpsUnits = txMode.GetDataRate () / 500000; |
446 |
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == preamble); |
|
447 |
NotifyPromiscSniffTx (packet, m_channelFreqMhz, dataRate500KbpsUnits, isShortPreamble); |
|
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
448 |
m_state->SwitchToTx (txDuration, packet, txMode, preamble, txPower); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
449 |
m_channel->Send (this, packet, GetPowerDbm (txPower) + m_txGainDb, txMode, preamble); |
1889 | 450 |
} |
451 |
||
452 |
uint32_t |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
453 |
YansWifiPhy::GetNModes (void) const |
1889 | 454 |
{ |
455 |
return m_modes.size (); |
|
456 |
} |
|
1891
add6fb8761f3
use WifiMode rather than TransmissionMode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1890
diff
changeset
|
457 |
WifiMode |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
458 |
YansWifiPhy::GetMode (uint32_t mode) const |
1889 | 459 |
{ |
1891
add6fb8761f3
use WifiMode rather than TransmissionMode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1890
diff
changeset
|
460 |
return m_modes[mode]; |
1889 | 461 |
} |
462 |
uint32_t |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
463 |
YansWifiPhy::GetNTxPower (void) const |
1889 | 464 |
{ |
465 |
return m_nTxPower; |
|
466 |
} |
|
467 |
||
2083
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
468 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
469 |
YansWifiPhy::Configure80211a (void) |
2083
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
470 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
471 |
NS_LOG_FUNCTION (this); |
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
472 |
m_interference.Configure80211aParameters (); |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
473 |
m_channelStartingFrequency = 5e9; // 5 GHz |
4039
50a070c2750c
remove public static variables. Use public static methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3912
diff
changeset
|
474 |
m_modes.push_back (WifiPhy::Get6mba ()); |
50a070c2750c
remove public static variables. Use public static methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3912
diff
changeset
|
475 |
m_modes.push_back (WifiPhy::Get9mba ()); |
50a070c2750c
remove public static variables. Use public static methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3912
diff
changeset
|
476 |
m_modes.push_back (WifiPhy::Get12mba ()); |
50a070c2750c
remove public static variables. Use public static methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3912
diff
changeset
|
477 |
m_modes.push_back (WifiPhy::Get18mba ()); |
50a070c2750c
remove public static variables. Use public static methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3912
diff
changeset
|
478 |
m_modes.push_back (WifiPhy::Get24mba ()); |
50a070c2750c
remove public static variables. Use public static methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3912
diff
changeset
|
479 |
m_modes.push_back (WifiPhy::Get36mba ()); |
50a070c2750c
remove public static variables. Use public static methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3912
diff
changeset
|
480 |
m_modes.push_back (WifiPhy::Get48mba ()); |
50a070c2750c
remove public static variables. Use public static methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3912
diff
changeset
|
481 |
m_modes.push_back (WifiPhy::Get54mba ()); |
2083
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
482 |
} |
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
483 |
|
4470 | 484 |
|
485 |
void |
|
486 |
YansWifiPhy::Configure80211b (void) |
|
487 |
{ |
|
488 |
NS_LOG_FUNCTION (this); |
|
489 |
m_interference.Configure80211bParameters (); |
|
490 |
m_modes.push_back (WifiPhy::Get1mbb ()); |
|
491 |
m_modes.push_back (WifiPhy::Get2mbb ()); |
|
492 |
m_modes.push_back (WifiPhy::Get5_5mbb ()); |
|
493 |
m_modes.push_back (WifiPhy::Get11mbb ()); |
|
494 |
} |
|
495 |
||
2083
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
496 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
497 |
YansWifiPhy::ConfigureHolland (void) |
2083
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
498 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
499 |
NS_LOG_FUNCTION (this); |
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
500 |
m_interference.Configure80211aParameters (); |
4039
50a070c2750c
remove public static variables. Use public static methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3912
diff
changeset
|
501 |
m_modes.push_back (WifiPhy::Get6mba ()); |
50a070c2750c
remove public static variables. Use public static methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3912
diff
changeset
|
502 |
m_modes.push_back (WifiPhy::Get12mba ()); |
50a070c2750c
remove public static variables. Use public static methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3912
diff
changeset
|
503 |
m_modes.push_back (WifiPhy::Get18mba ()); |
50a070c2750c
remove public static variables. Use public static methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3912
diff
changeset
|
504 |
m_modes.push_back (WifiPhy::Get36mba ()); |
50a070c2750c
remove public static variables. Use public static methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3912
diff
changeset
|
505 |
m_modes.push_back (WifiPhy::Get54mba ()); |
2083
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
506 |
} |
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
507 |
|
1889 | 508 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
509 |
YansWifiPhy::RegisterListener (WifiPhyListener *listener) |
1889 | 510 |
{ |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
511 |
m_state->RegisterListener (listener); |
1889 | 512 |
} |
513 |
||
514 |
bool |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
515 |
YansWifiPhy::IsStateCcaBusy (void) |
1889 | 516 |
{ |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
517 |
return m_state->IsStateCcaBusy (); |
1889 | 518 |
} |
519 |
||
520 |
bool |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
521 |
YansWifiPhy::IsStateIdle (void) |
1889 | 522 |
{ |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
523 |
return m_state->IsStateIdle (); |
1889 | 524 |
} |
525 |
bool |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
526 |
YansWifiPhy::IsStateBusy (void) |
1889 | 527 |
{ |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
528 |
return m_state->IsStateBusy (); |
1889 | 529 |
} |
530 |
bool |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
531 |
YansWifiPhy::IsStateSync (void) |
1889 | 532 |
{ |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
533 |
return m_state->IsStateSync (); |
1889 | 534 |
} |
535 |
bool |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
536 |
YansWifiPhy::IsStateTx (void) |
1889 | 537 |
{ |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
538 |
return m_state->IsStateTx (); |
1889 | 539 |
} |
540 |
||
541 |
Time |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
542 |
YansWifiPhy::GetStateDuration (void) |
1889 | 543 |
{ |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
544 |
return m_state->GetStateDuration (); |
1889 | 545 |
} |
546 |
Time |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
547 |
YansWifiPhy::GetDelayUntilIdle (void) |
1889 | 548 |
{ |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
549 |
return m_state->GetDelayUntilIdle (); |
1889 | 550 |
} |
551 |
||
2139
a2cf93c741c3
add WifiPhy::GetLastRxStart
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2083
diff
changeset
|
552 |
Time |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
553 |
YansWifiPhy::GetLastRxStartTime (void) const |
2139
a2cf93c741c3
add WifiPhy::GetLastRxStart
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2083
diff
changeset
|
554 |
{ |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
555 |
return m_state->GetLastRxStartTime (); |
2139
a2cf93c741c3
add WifiPhy::GetLastRxStart
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2083
diff
changeset
|
556 |
} |
a2cf93c741c3
add WifiPhy::GetLastRxStart
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2083
diff
changeset
|
557 |
|
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
558 |
Time |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
559 |
YansWifiPhy::CalculateTxDuration (uint32_t size, WifiMode payloadMode, enum WifiPreamble preamble) const |
1889 | 560 |
{ |
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
561 |
return m_interference.CalculateTxDuration (size, payloadMode, preamble); |
1889 | 562 |
} |
563 |
||
564 |
double |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
565 |
YansWifiPhy::DbToRatio (double dB) const |
1889 | 566 |
{ |
567 |
double ratio = pow(10.0,dB/10.0); |
|
568 |
return ratio; |
|
569 |
} |
|
570 |
||
571 |
double |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
572 |
YansWifiPhy::DbmToW (double dBm) const |
1889 | 573 |
{ |
574 |
double mW = pow(10.0,dBm/10.0); |
|
575 |
return mW / 1000.0; |
|
576 |
} |
|
577 |
||
578 |
double |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
579 |
YansWifiPhy::WToDbm (double w) const |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
580 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
581 |
return 10.0 * log10(w * 1000.0); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
582 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
583 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
584 |
double |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
585 |
YansWifiPhy::RatioToDb (double ratio) const |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
586 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
587 |
return 10.0 * log10(ratio); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
588 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
589 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
590 |
double |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
591 |
YansWifiPhy::GetEdThresholdW (void) const |
1889 | 592 |
{ |
593 |
return m_edThresholdW; |
|
594 |
} |
|
595 |
||
596 |
double |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
597 |
YansWifiPhy::GetPowerDbm (uint8_t power) const |
1889 | 598 |
{ |
1974
0d6b3bead74a
replace cassert by ns3/assert.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
599 |
NS_ASSERT (m_txPowerBaseDbm <= m_txPowerEndDbm); |
0d6b3bead74a
replace cassert by ns3/assert.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
600 |
NS_ASSERT (m_nTxPower > 0); |
2782
4c813b3ea1c3
tx power shoudl reflect the user-selected power level, not be always the power level zero.
Providence SALUMU MUNGA <Providence.Salumu_Munga@it-sudparis.eu>
parents:
2659
diff
changeset
|
601 |
double dbm = m_txPowerBaseDbm + power * (m_txPowerEndDbm - m_txPowerBaseDbm) / m_nTxPower; |
1889 | 602 |
return dbm; |
603 |
} |
|
604 |
||
605 |
void |
|
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
606 |
YansWifiPhy::EndSync (Ptr<Packet> packet, Ptr<InterferenceHelper::Event> event) |
1889 | 607 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
608 |
NS_LOG_FUNCTION (this << packet << event); |
1974
0d6b3bead74a
replace cassert by ns3/assert.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
609 |
NS_ASSERT (IsStateSync ()); |
0d6b3bead74a
replace cassert by ns3/assert.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
610 |
NS_ASSERT (event->GetEndTime () == Simulator::Now ()); |
1889 | 611 |
|
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
612 |
struct InterferenceHelper::SnrPer snrPer; |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
613 |
snrPer = m_interference.CalculateSnrPer (event); |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
614 |
|
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
615 |
NS_LOG_DEBUG ("mode="<<(event->GetPayloadMode ().GetDataRate ())<< |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
616 |
", snr="<<snrPer.snr<<", per="<<snrPer.per<<", size="<<packet->GetSize ()); |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
617 |
if (m_random.GetValue () > snrPer.per) |
1889 | 618 |
{ |
5051 | 619 |
NotifyRxEnd (packet); |
620 |
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000; |
|
621 |
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ()); |
|
622 |
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30; |
|
623 |
double noiseDbm = RatioToDb(event->GetRxPowerW() / snrPer.snr) - GetRxNoiseFigure() + 30 ; |
|
624 |
NotifyPromiscSniffRx (packet, m_channelFreqMhz, dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm); |
|
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
625 |
m_state->SwitchFromSyncEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType ()); |
1889 | 626 |
} |
627 |
else |
|
628 |
{ |
|
629 |
/* failure. */ |
|
4264
9d2e96c4e6e4
Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4263
diff
changeset
|
630 |
NotifyRxDrop (packet); |
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
631 |
m_state->SwitchFromSyncEndError (packet, snrPer.snr); |
1889 | 632 |
} |
633 |
} |
|
1977
4303409f3d8e
remove uneeded trailing ';'
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1974
diff
changeset
|
634 |
} // namespace ns3 |