A Discrete-Event Network Simulator
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/error-rate-model.h"
26#include "ns3/frame-capture-model.h"
27#include "ns3/preamble-detection-model.h"
28#include "ns3/mobility-model.h"
29#include "ns3/wifi-net-device.h"
31
32namespace ns3 {
33
34NS_LOG_COMPONENT_DEFINE ("SpectrumWifiHelper");
35
37 : m_channel (0)
38{
39 m_phy.SetTypeId ("ns3::SpectrumWifiPhy");
40 SetErrorRateModel ("ns3::TableBasedErrorRateModel");
41}
42
43void
45{
47}
48
49void
50SpectrumWifiPhyHelper::SetChannel (std::string channelName)
51{
52 Ptr<SpectrumChannel> channel = Names::Find<SpectrumChannel> (channelName);
54}
55
58{
60 phy->CreateWifiSpectrumPhyInterface (device);
62 phy->SetErrorRateModel (error);
64 {
65 auto frameCapture = m_frameCaptureModel.Create<FrameCaptureModel> ();
66 phy->SetFrameCaptureModel (frameCapture);
67 }
69 {
70 auto preambleDetection = m_preambleDetectionModel.Create<PreambleDetectionModel> ();
71 phy->SetPreambleDetectionModel (preambleDetection);
72 }
73 phy->SetChannel (m_channel);
74 phy->SetDevice (device);
75 phy->SetMobility (node->GetObject<MobilityModel> ());
76 return phy;
77}
78
79} //namespace ns3
the interface for Wifi's error models
the interface for Wifi's frame capture models
Keep track of the current position and velocity of an object.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
bool IsTypeIdSet(void) const
Check if the ObjectFactory has been configured with a TypeId.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:470
the interface for Wifi's preamble detection models
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
Ptr< WifiPhy > Create(Ptr< Node > node, Ptr< WifiNetDevice > device) const override
void SetChannel(Ptr< SpectrumChannel > channel)
Ptr< SpectrumChannel > m_channel
the channel
SpectrumWifiPhyHelper()
Create a PHY helper.
802.11 PHY layer model
void SetErrorRateModel(std::string name, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Definition: wifi-helper.cc:147
ObjectFactory m_frameCaptureModel
frame capture model
Definition: wifi-helper.h:238
ObjectFactory m_preambleDetectionModel
preamble detection model
Definition: wifi-helper.h:239
ObjectFactory m_errorRateModel
error rate model
Definition: wifi-helper.h:237
ObjectFactory m_phy
PHY object.
Definition: wifi-helper.h:236
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
Every class exported by the ns3 library is enclosed in the ns3 namespace.
channel
Definition: third.py:92
phy
Definition: third.py:93