A Discrete-Event Network Simulator
API
vht-configuration.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Sébastien Deronne
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Sébastien Deronne <sebastien.deronne@gmail.com>
18  */
19 
20 #include "vht-configuration.h"
21 
22 #include "ns3/boolean.h"
23 #include "ns3/double.h"
24 #include "ns3/log.h"
25 #include "ns3/string.h"
26 #include "ns3/tuple.h"
27 
28 namespace ns3
29 {
30 
31 NS_LOG_COMPONENT_DEFINE("VhtConfiguration");
32 
33 NS_OBJECT_ENSURE_REGISTERED(VhtConfiguration);
34 
36 {
37  NS_LOG_FUNCTION(this);
38 }
39 
41 {
42  NS_LOG_FUNCTION(this);
43 }
44 
45 TypeId
47 {
48  static ns3::TypeId tid =
49  ns3::TypeId("ns3::VhtConfiguration")
50  .SetParent<Object>()
51  .SetGroupName("Wifi")
52  .AddConstructor<VhtConfiguration>()
53  .AddAttribute("Support160MHzOperation",
54  "Whether or not 160 MHz operation is to be supported.",
55  BooleanValue(true),
59  .AddAttribute("SecondaryCcaSensitivityThresholds",
60  "Tuple {threshold for 20MHz PPDUs, threshold for 40MHz PPDUs, threshold "
61  "for 80MHz PPDUs} "
62  "describing the CCA sensitivity thresholds for PPDUs that do not occupy "
63  "the primary channel. "
64  "The power of a received PPDU that does not occupy the primary channel "
65  "should be higher than "
66  "the threshold (dBm) associated to the PPDU bandwidth to allow the PHY "
67  "layer to declare CCA BUSY state.",
68  StringValue("{-72.0, -72.0, -69.0}"),
69  MakeTupleAccessor<DoubleValue, DoubleValue, DoubleValue>(
72  MakeTupleChecker<DoubleValue, DoubleValue, DoubleValue>(
73  MakeDoubleChecker<double>(),
74  MakeDoubleChecker<double>(),
75  MakeDoubleChecker<double>()));
76  return tid;
77 }
78 
79 void
81 {
82  NS_LOG_FUNCTION(this << enable);
83  m_160MHzSupported = enable;
84 }
85 
86 bool
88 {
89  return m_160MHzSupported;
90 }
91 
92 void
94  const SecondaryCcaSensitivityThresholds& thresholds)
95 {
96  NS_LOG_FUNCTION(this);
97  m_secondaryCcaSensitivityThresholds[20] = std::get<0>(thresholds);
98  m_secondaryCcaSensitivityThresholds[40] = std::get<1>(thresholds);
99  m_secondaryCcaSensitivityThresholds[80] = std::get<2>(thresholds);
100 }
101 
104 {
108 }
109 
110 const std::map<uint16_t, double>&
112 {
114 }
115 
116 } // namespace ns3
A base class which provides memory management and object aggregation.
Definition: object.h:89
Hold variables of type string.
Definition: string.h:56
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:931
VHT configuration.
std::tuple< double, double, double > SecondaryCcaSensitivityThresholds
Tuple identifying CCA sensitivity thresholds for secondary channels.
void Set160MHzOperationSupported(bool enable)
Enable or disable 160 MHz operation support.
void SetSecondaryCcaSensitivityThresholds(const SecondaryCcaSensitivityThresholds &thresholds)
Sets the CCA sensitivity thresholds for PPDUs that do not occupy the primary channel.
bool Get160MHzOperationSupported() const
bool m_160MHzSupported
whether 160 MHz operation is supported
std::map< uint16_t, double > m_secondaryCcaSensitivityThresholds
CCA sensitivity thresholds for signals that do not occupy the primary channel, indexed by signal band...
SecondaryCcaSensitivityThresholds GetSecondaryCcaSensitivityThresholds() const
static TypeId GetTypeId()
Get the type ID.
const std::map< uint16_t, double > & GetSecondaryCcaSensitivityThresholdsPerBw() const
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition: boolean.cc:124
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition: boolean.h:86