author | Pavel Boyko <boyko@iitp.ru> |
Fri, 29 May 2009 10:15:19 +0400 | |
changeset 5028 | 01f02baebba9 |
parent 4966 | 29d73c832841 |
parent 4470 | 51b5c1a272d3 |
child 5050 | 5c2002bda934 |
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> ()) |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
119 |
.AddAttribute ("ChannelSwitchDelay", |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
120 |
"Delay between two short frames transmitted on different frequencies", |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
121 |
TimeValue (MicroSeconds (250)), |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
122 |
MakeTimeAccessor (&YansWifiPhy::m_channelSwitchDelay), |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
123 |
MakeTimeChecker ()) |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
124 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
125 |
; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
126 |
return tid; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
127 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
128 |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
129 |
YansWifiPhy::YansWifiPhy () |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
130 |
: m_channelId(0), |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
131 |
m_endSyncEvent (), |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
132 |
m_random (0.0, 1.0), |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
133 |
m_channelStartingFrequency(0.0) |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
134 |
{ |
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
135 |
NS_LOG_FUNCTION (this); |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
136 |
m_state = CreateObject<WifiPhyStateHelper> (); |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
137 |
} |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
138 |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
139 |
YansWifiPhy::~YansWifiPhy () |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
140 |
{ |
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
141 |
NS_LOG_FUNCTION (this); |
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
142 |
} |
2530
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
143 |
|
05f9cec44621
avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
144 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
145 |
YansWifiPhy::DoDispose (void) |
1964
041240a915f8
build and link
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1920
diff
changeset
|
146 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
147 |
NS_LOG_FUNCTION (this); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
148 |
m_channel = 0; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
149 |
m_modes.clear (); |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
150 |
m_device = 0; |
2524
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 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
153 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
154 |
YansWifiPhy::SetStandard (enum WifiPhyStandard standard) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
155 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
156 |
NS_LOG_FUNCTION (this << standard); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
157 |
m_standard = standard; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
158 |
switch (standard) { |
2166
00b5eb43dba2
Improve the accuracy of 802.11a tx duration calculations.
Federico Maguolo <federico.maguolo@dei.unipd.it>
parents:
2164
diff
changeset
|
159 |
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
|
160 |
Configure80211a (); |
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
161 |
break; |
4470 | 162 |
case WIFI_PHY_STANDARD_80211b: |
163 |
Configure80211b (); |
|
164 |
break; |
|
2166
00b5eb43dba2
Improve the accuracy of 802.11a tx duration calculations.
Federico Maguolo <federico.maguolo@dei.unipd.it>
parents:
2164
diff
changeset
|
165 |
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
|
166 |
ConfigureHolland (); |
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
167 |
break; |
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
168 |
default: |
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
169 |
NS_ASSERT (false); |
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
170 |
break; |
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
171 |
} |
1964
041240a915f8
build and link
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1920
diff
changeset
|
172 |
} |
1889 | 173 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
174 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
175 |
void |
4315
56a5bf298339
noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
176 |
YansWifiPhy::SetRxNoiseFigure (double noiseFigureDb) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
177 |
{ |
4315
56a5bf298339
noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
178 |
NS_LOG_FUNCTION (this << noiseFigureDb); |
56a5bf298339
noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
179 |
m_interference.SetNoiseFigure (DbToRatio (noiseFigureDb)); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
180 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
181 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
182 |
YansWifiPhy::SetTxPowerStart (double start) |
1889 | 183 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
184 |
NS_LOG_FUNCTION (this << start); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
185 |
m_txPowerBaseDbm = start; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
186 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
187 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
188 |
YansWifiPhy::SetTxPowerEnd (double end) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
189 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
190 |
NS_LOG_FUNCTION (this << end); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
191 |
m_txPowerEndDbm = end; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
192 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
193 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
194 |
YansWifiPhy::SetNTxPower (uint32_t n) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
195 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
196 |
NS_LOG_FUNCTION (this << n); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
197 |
m_nTxPower = n; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
198 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
199 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
200 |
YansWifiPhy::SetTxGain (double gain) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
201 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
202 |
NS_LOG_FUNCTION (this << gain); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
203 |
m_txGainDb = gain; |
1889 | 204 |
} |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
205 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
206 |
YansWifiPhy::SetRxGain (double gain) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
207 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
208 |
NS_LOG_FUNCTION (this << gain); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
209 |
m_rxGainDb = gain; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
210 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
211 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
212 |
YansWifiPhy::SetEdThreshold (double threshold) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
213 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
214 |
NS_LOG_FUNCTION (this << threshold); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
215 |
m_edThresholdW = DbmToW (threshold); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
216 |
} |
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
217 |
void |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
218 |
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
|
219 |
{ |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
220 |
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
|
221 |
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
|
222 |
} |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
223 |
void |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
224 |
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
|
225 |
{ |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
226 |
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
|
227 |
} |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
228 |
void |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
229 |
YansWifiPhy::SetDevice (Ptr<Object> device) |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
230 |
{ |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
231 |
m_device = device; |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
232 |
} |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
233 |
void |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
234 |
YansWifiPhy::SetMobility (Ptr<Object> mobility) |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
235 |
{ |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
236 |
m_mobility = mobility; |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
237 |
} |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
238 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
239 |
double |
4315
56a5bf298339
noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
240 |
YansWifiPhy::GetRxNoiseFigure (void) const |
2155
194dd8bdcf56
add WifiPhy::GetDevice
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2150
diff
changeset
|
241 |
{ |
4315
56a5bf298339
noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
242 |
return RatioToDb (m_interference.GetNoiseFigure ()); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
243 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
244 |
double |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
245 |
YansWifiPhy::GetTxPowerStart (void) const |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
246 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
247 |
return m_txPowerBaseDbm; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
248 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
249 |
double |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
250 |
YansWifiPhy::GetTxPowerEnd (void) const |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
251 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
252 |
return m_txPowerEndDbm; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
253 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
254 |
double |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
255 |
YansWifiPhy::GetTxGain (void) const |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
256 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
257 |
return m_txGainDb; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
258 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
259 |
double |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
260 |
YansWifiPhy::GetRxGain (void) const |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
261 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
262 |
return m_rxGainDb; |
2155
194dd8bdcf56
add WifiPhy::GetDevice
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2150
diff
changeset
|
263 |
} |
194dd8bdcf56
add WifiPhy::GetDevice
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2150
diff
changeset
|
264 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
265 |
double |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
266 |
YansWifiPhy::GetEdThreshold (void) const |
2055
8899d6ef5d52
phy state logger
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1999
diff
changeset
|
267 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
268 |
return WToDbm (m_edThresholdW); |
2055
8899d6ef5d52
phy state logger
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1999
diff
changeset
|
269 |
} |
1889 | 270 |
|
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
271 |
double |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
272 |
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
|
273 |
{ |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
274 |
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
|
275 |
} |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
276 |
|
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
277 |
Ptr<ErrorRateModel> |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
278 |
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
|
279 |
{ |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
280 |
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
|
281 |
} |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
282 |
Ptr<Object> |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
283 |
YansWifiPhy::GetDevice (void) const |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
284 |
{ |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
285 |
return m_device; |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
286 |
} |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
287 |
Ptr<Object> |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
288 |
YansWifiPhy::GetMobility (void) |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
289 |
{ |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
290 |
return m_mobility; |
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
291 |
} |
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
292 |
|
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
293 |
double |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
294 |
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
|
295 |
{ |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
296 |
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
|
297 |
} |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
298 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
299 |
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
|
300 |
YansWifiPhy::GetChannel (void) const |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
301 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
302 |
return m_channel; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
303 |
} |
1889 | 304 |
void |
3893
94f771c1373a
split WifiChannel in WifiChannel + YansWifiChannel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3888
diff
changeset
|
305 |
YansWifiPhy::SetChannel (Ptr<YansWifiChannel> channel) |
1889 | 306 |
{ |
1891
add6fb8761f3
use WifiMode rather than TransmissionMode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1890
diff
changeset
|
307 |
m_channel = channel; |
3912
4d1a61f80745
new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3906
diff
changeset
|
308 |
m_channel->Add (this); |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
309 |
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
|
310 |
} |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
311 |
|
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
312 |
void |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
313 |
YansWifiPhy::SetFrequencyChannel (uint16_t nch) |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
314 |
{ |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
315 |
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
|
316 |
} |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
317 |
|
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
318 |
void |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
319 |
YansWifiPhy::DoSetChannelId (uint16_t nch) |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
320 |
{ |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
321 |
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
|
322 |
m_channelId = nch; |
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 |
|
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
325 |
uint16_t |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
326 |
YansWifiPhy::GetFrequencyChannel() const |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
327 |
{ |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
328 |
return m_channelId; |
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 |
|
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
331 |
double |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
332 |
YansWifiPhy::GetChannelCenterFrequency() const |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
333 |
{ |
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
334 |
return m_channelStartingFrequency + 5e6 * GetFrequencyChannel(); |
1889 | 335 |
} |
336 |
||
337 |
void |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
338 |
YansWifiPhy::SetReceiveOkCallback (SyncOkCallback callback) |
1889 | 339 |
{ |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
340 |
m_state->SetReceiveOkCallback (callback); |
1889 | 341 |
} |
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); |
9d2e96c4e6e4
Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4263
diff
changeset
|
445 |
NotifyPromiscSniff (packet); |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
446 |
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
|
447 |
m_channel->Send (this, packet, GetPowerDbm (txPower) + m_txGainDb, txMode, preamble); |
1889 | 448 |
} |
449 |
||
450 |
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
|
451 |
YansWifiPhy::GetNModes (void) const |
1889 | 452 |
{ |
453 |
return m_modes.size (); |
|
454 |
} |
|
1891
add6fb8761f3
use WifiMode rather than TransmissionMode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1890
diff
changeset
|
455 |
WifiMode |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
456 |
YansWifiPhy::GetMode (uint32_t mode) const |
1889 | 457 |
{ |
1891
add6fb8761f3
use WifiMode rather than TransmissionMode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1890
diff
changeset
|
458 |
return m_modes[mode]; |
1889 | 459 |
} |
460 |
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
|
461 |
YansWifiPhy::GetNTxPower (void) const |
1889 | 462 |
{ |
463 |
return m_nTxPower; |
|
464 |
} |
|
465 |
||
2083
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
466 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
467 |
YansWifiPhy::Configure80211a (void) |
2083
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
468 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
469 |
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
|
470 |
m_interference.Configure80211aParameters (); |
4934
345b49df838b
Frequency channel switch on channel, PHY and MAC levels
Pavel Boyko <boyko@iitp.ru>
parents:
4264
diff
changeset
|
471 |
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
|
472 |
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
|
473 |
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
|
474 |
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
|
475 |
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
|
476 |
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
|
477 |
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
|
478 |
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
|
479 |
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
|
480 |
} |
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
481 |
|
4470 | 482 |
|
483 |
void |
|
484 |
YansWifiPhy::Configure80211b (void) |
|
485 |
{ |
|
486 |
NS_LOG_FUNCTION (this); |
|
487 |
m_interference.Configure80211bParameters (); |
|
488 |
m_modes.push_back (WifiPhy::Get1mbb ()); |
|
489 |
m_modes.push_back (WifiPhy::Get2mbb ()); |
|
490 |
m_modes.push_back (WifiPhy::Get5_5mbb ()); |
|
491 |
m_modes.push_back (WifiPhy::Get11mbb ()); |
|
492 |
} |
|
493 |
||
2083
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
494 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
495 |
YansWifiPhy::ConfigureHolland (void) |
2083
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
496 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
497 |
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
|
498 |
m_interference.Configure80211aParameters (); |
4039
50a070c2750c
remove public static variables. Use public static methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3912
diff
changeset
|
499 |
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
|
500 |
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
|
501 |
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
|
502 |
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
|
503 |
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
|
504 |
} |
c7541b84285e
add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2077
diff
changeset
|
505 |
|
1889 | 506 |
void |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
507 |
YansWifiPhy::RegisterListener (WifiPhyListener *listener) |
1889 | 508 |
{ |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
509 |
m_state->RegisterListener (listener); |
1889 | 510 |
} |
511 |
||
512 |
bool |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
513 |
YansWifiPhy::IsStateCcaBusy (void) |
1889 | 514 |
{ |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
515 |
return m_state->IsStateCcaBusy (); |
1889 | 516 |
} |
517 |
||
518 |
bool |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
519 |
YansWifiPhy::IsStateIdle (void) |
1889 | 520 |
{ |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
521 |
return m_state->IsStateIdle (); |
1889 | 522 |
} |
523 |
bool |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
524 |
YansWifiPhy::IsStateBusy (void) |
1889 | 525 |
{ |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
526 |
return m_state->IsStateBusy (); |
1889 | 527 |
} |
528 |
bool |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
529 |
YansWifiPhy::IsStateSync (void) |
1889 | 530 |
{ |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
531 |
return m_state->IsStateSync (); |
1889 | 532 |
} |
533 |
bool |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
534 |
YansWifiPhy::IsStateTx (void) |
1889 | 535 |
{ |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
536 |
return m_state->IsStateTx (); |
1889 | 537 |
} |
538 |
||
539 |
Time |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
540 |
YansWifiPhy::GetStateDuration (void) |
1889 | 541 |
{ |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
542 |
return m_state->GetStateDuration (); |
1889 | 543 |
} |
544 |
Time |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
545 |
YansWifiPhy::GetDelayUntilIdle (void) |
1889 | 546 |
{ |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
547 |
return m_state->GetDelayUntilIdle (); |
1889 | 548 |
} |
549 |
||
2139
a2cf93c741c3
add WifiPhy::GetLastRxStart
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2083
diff
changeset
|
550 |
Time |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
551 |
YansWifiPhy::GetLastRxStartTime (void) const |
2139
a2cf93c741c3
add WifiPhy::GetLastRxStart
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2083
diff
changeset
|
552 |
{ |
3900
1687492ff059
re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3897
diff
changeset
|
553 |
return m_state->GetLastRxStartTime (); |
2139
a2cf93c741c3
add WifiPhy::GetLastRxStart
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2083
diff
changeset
|
554 |
} |
a2cf93c741c3
add WifiPhy::GetLastRxStart
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2083
diff
changeset
|
555 |
|
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
556 |
Time |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
557 |
YansWifiPhy::CalculateTxDuration (uint32_t size, WifiMode payloadMode, enum WifiPreamble preamble) const |
1889 | 558 |
{ |
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
559 |
return m_interference.CalculateTxDuration (size, payloadMode, preamble); |
1889 | 560 |
} |
561 |
||
562 |
double |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
563 |
YansWifiPhy::DbToRatio (double dB) const |
1889 | 564 |
{ |
565 |
double ratio = pow(10.0,dB/10.0); |
|
566 |
return ratio; |
|
567 |
} |
|
568 |
||
569 |
double |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
570 |
YansWifiPhy::DbmToW (double dBm) const |
1889 | 571 |
{ |
572 |
double mW = pow(10.0,dBm/10.0); |
|
573 |
return mW / 1000.0; |
|
574 |
} |
|
575 |
||
576 |
double |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
577 |
YansWifiPhy::WToDbm (double w) const |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
578 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
579 |
return 10.0 * log10(w * 1000.0); |
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 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
582 |
double |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
583 |
YansWifiPhy::RatioToDb (double ratio) const |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
584 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
585 |
return 10.0 * log10(ratio); |
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 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2503
diff
changeset
|
588 |
double |
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
589 |
YansWifiPhy::GetEdThresholdW (void) const |
1889 | 590 |
{ |
591 |
return m_edThresholdW; |
|
592 |
} |
|
593 |
||
594 |
double |
|
3888
a15618dcd0eb
rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3882
diff
changeset
|
595 |
YansWifiPhy::GetPowerDbm (uint8_t power) const |
1889 | 596 |
{ |
1974
0d6b3bead74a
replace cassert by ns3/assert.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
597 |
NS_ASSERT (m_txPowerBaseDbm <= m_txPowerEndDbm); |
0d6b3bead74a
replace cassert by ns3/assert.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
598 |
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
|
599 |
double dbm = m_txPowerBaseDbm + power * (m_txPowerEndDbm - m_txPowerBaseDbm) / m_nTxPower; |
1889 | 600 |
return dbm; |
601 |
} |
|
602 |
||
603 |
void |
|
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
604 |
YansWifiPhy::EndSync (Ptr<Packet> packet, Ptr<InterferenceHelper::Event> event) |
1889 | 605 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2782
diff
changeset
|
606 |
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
|
607 |
NS_ASSERT (IsStateSync ()); |
0d6b3bead74a
replace cassert by ns3/assert.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
608 |
NS_ASSERT (event->GetEndTime () == Simulator::Now ()); |
1889 | 609 |
|
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
610 |
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
|
611 |
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
|
612 |
|
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
613 |
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
|
614 |
", snr="<<snrPer.snr<<", per="<<snrPer.per<<", size="<<packet->GetSize ()); |
1889 | 615 |
|
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
616 |
if (m_random.GetValue () > snrPer.per) |
1889 | 617 |
{ |
4264
9d2e96c4e6e4
Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4263
diff
changeset
|
618 |
NotifyRxEnd (packet); |
9d2e96c4e6e4
Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4263
diff
changeset
|
619 |
NotifyPromiscSniff (packet); |
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
620 |
m_state->SwitchFromSyncEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType ()); |
1889 | 621 |
} |
622 |
else |
|
623 |
{ |
|
624 |
/* failure. */ |
|
4264
9d2e96c4e6e4
Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4263
diff
changeset
|
625 |
NotifyRxDrop (packet); |
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
626 |
m_state->SwitchFromSyncEndError (packet, snrPer.snr); |
1889 | 627 |
} |
628 |
} |
|
629 |
||
1977
4303409f3d8e
remove uneeded trailing ';'
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1974
diff
changeset
|
630 |
} // namespace ns3 |