A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
spectrum-wifi-helper.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2008 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
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19
* Sébastien Deronne <sebastien.deronne@gmail.com>
20
*/
21
22
#include "ns3/log.h"
23
#include "ns3/names.h"
24
#include "ns3/spectrum-wifi-phy.h"
25
#include "ns3/interference-helper.h"
26
#include "ns3/error-rate-model.h"
27
#include "ns3/frame-capture-model.h"
28
#include "ns3/preamble-detection-model.h"
29
#include "ns3/mobility-model.h"
30
#include "ns3/wifi-net-device.h"
31
#include "
spectrum-wifi-helper.h
"
32
33
namespace
ns3
{
34
35
NS_LOG_COMPONENT_DEFINE
(
"SpectrumWifiHelper"
);
36
37
SpectrumWifiPhyHelper::SpectrumWifiPhyHelper
()
38
: m_channel (0)
39
{
40
m_phy
.
SetTypeId
(
"ns3::SpectrumWifiPhy"
);
41
SetInterferenceHelper
(
"ns3::InterferenceHelper"
);
42
SetErrorRateModel
(
"ns3::TableBasedErrorRateModel"
);
43
}
44
45
void
46
SpectrumWifiPhyHelper::SetChannel
(
Ptr<SpectrumChannel>
channel
)
47
{
48
m_channel
=
channel
;
49
}
50
51
void
52
SpectrumWifiPhyHelper::SetChannel
(std::string channelName)
53
{
54
Ptr<SpectrumChannel>
channel
= Names::Find<SpectrumChannel> (channelName);
55
m_channel
=
channel
;
56
}
57
58
Ptr<WifiPhy>
59
SpectrumWifiPhyHelper::Create
(
Ptr<Node>
node,
Ptr<WifiNetDevice>
device)
const
60
{
61
Ptr<SpectrumWifiPhy>
phy
=
m_phy
.
Create
<
SpectrumWifiPhy
> ();
62
phy
->CreateWifiSpectrumPhyInterface (device);
63
Ptr<InterferenceHelper>
interference =
m_interferenceHelper
.
Create
<
InterferenceHelper
> ();
64
phy
->SetInterferenceHelper (interference);
65
Ptr<ErrorRateModel>
error =
m_errorRateModel
.
Create
<
ErrorRateModel
> ();
66
phy
->SetErrorRateModel (error);
67
if
(
m_frameCaptureModel
.
IsTypeIdSet
())
68
{
69
auto
frameCapture =
m_frameCaptureModel
.
Create
<
FrameCaptureModel
> ();
70
phy
->SetFrameCaptureModel (frameCapture);
71
}
72
if
(
m_preambleDetectionModel
.
IsTypeIdSet
())
73
{
74
auto
preambleDetection =
m_preambleDetectionModel
.
Create
<
PreambleDetectionModel
> ();
75
phy
->SetPreambleDetectionModel (preambleDetection);
76
}
77
phy
->SetChannel (
m_channel
);
78
phy
->SetDevice (device);
79
phy
->SetMobility (node->
GetObject
<
MobilityModel
> ());
80
return
phy
;
81
}
82
83
}
//namespace ns3
ns3::ErrorRateModel
the interface for Wifi's error models
Definition:
error-rate-model.h:35
ns3::FrameCaptureModel
the interface for Wifi's frame capture models
Definition:
frame-capture-model.h:37
ns3::InterferenceHelper
handles interference calculations
Definition:
interference-helper.h:133
ns3::MobilityModel
Keep track of the current position and velocity of an object.
Definition:
mobility-model.h:40
ns3::ObjectFactory::Create
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
Definition:
object-factory.cc:98
ns3::ObjectFactory::IsTypeIdSet
bool IsTypeIdSet(void) const
Check if the ObjectFactory has been configured with a TypeId.
Definition:
object-factory.cc:58
ns3::ObjectFactory::SetTypeId
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Definition:
object-factory.cc:40
ns3::Object::GetObject
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition:
object.h:470
ns3::PreambleDetectionModel
the interface for Wifi's preamble detection models
Definition:
preamble-detection-model.h:34
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:74
ns3::SpectrumWifiPhyHelper::Create
Ptr< WifiPhy > Create(Ptr< Node > node, Ptr< WifiNetDevice > device) const override
Definition:
spectrum-wifi-helper.cc:59
ns3::SpectrumWifiPhyHelper::SetChannel
void SetChannel(Ptr< SpectrumChannel > channel)
Definition:
spectrum-wifi-helper.cc:46
ns3::SpectrumWifiPhyHelper::m_channel
Ptr< SpectrumChannel > m_channel
the channel
Definition:
spectrum-wifi-helper.h:68
ns3::SpectrumWifiPhyHelper::SpectrumWifiPhyHelper
SpectrumWifiPhyHelper()
Create a PHY helper.
Definition:
spectrum-wifi-helper.cc:37
ns3::SpectrumWifiPhy
802.11 PHY layer model
Definition:
spectrum-wifi-phy.h:55
ns3::WifiPhyHelper::SetErrorRateModel
void SetErrorRateModel(std::string type, Args &&... args)
Helper function used to set the error rate model.
Definition:
wifi-helper.h:440
ns3::WifiPhyHelper::SetInterferenceHelper
void SetInterferenceHelper(std::string type, Args &&... args)
Helper function used to set the interference helper.
Definition:
wifi-helper.h:432
ns3::WifiPhyHelper::m_frameCaptureModel
ObjectFactory m_frameCaptureModel
frame capture model
Definition:
wifi-helper.h:189
ns3::WifiPhyHelper::m_preambleDetectionModel
ObjectFactory m_preambleDetectionModel
preamble detection model
Definition:
wifi-helper.h:190
ns3::WifiPhyHelper::m_errorRateModel
ObjectFactory m_errorRateModel
error rate model
Definition:
wifi-helper.h:188
ns3::WifiPhyHelper::m_interferenceHelper
ObjectFactory m_interferenceHelper
interference helper
Definition:
wifi-helper.h:187
ns3::WifiPhyHelper::m_phy
ObjectFactory m_phy
PHY object.
Definition:
wifi-helper.h:186
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:205
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
third.channel
channel
Definition:
third.py:92
third.phy
phy
Definition:
third.py:93
spectrum-wifi-helper.h
src
wifi
helper
spectrum-wifi-helper.cc
Generated on Tue Feb 6 2024 19:21:28 for ns-3 by
1.9.1