A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
wifi
model
yans-wifi-phy.cc
Go to the documentation of this file.
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
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19
* Ghada Badawy <gbadawy@gmail.com>
20
* Sébastien Deronne <sebastien.deronne@gmail.com>
21
*/
22
23
#include "ns3/log.h"
24
#include "ns3/packet.h"
25
#include "
yans-wifi-phy.h
"
26
#include "
yans-wifi-channel.h
"
27
28
namespace
ns3
{
29
30
NS_LOG_COMPONENT_DEFINE
(
"YansWifiPhy"
);
31
32
NS_OBJECT_ENSURE_REGISTERED
(YansWifiPhy);
33
34
TypeId
35
YansWifiPhy::GetTypeId
(
void
)
36
{
37
static
TypeId
tid =
TypeId
(
"ns3::YansWifiPhy"
)
38
.
SetParent
<
WifiPhy
> ()
39
.SetGroupName (
"Wifi"
)
40
.AddConstructor<
YansWifiPhy
> ()
41
;
42
return
tid;
43
}
44
45
YansWifiPhy::YansWifiPhy
()
46
{
47
NS_LOG_FUNCTION
(
this
);
48
}
49
50
YansWifiPhy::~YansWifiPhy
()
51
{
52
NS_LOG_FUNCTION
(
this
);
53
}
54
55
void
56
YansWifiPhy::DoDispose
(
void
)
57
{
58
NS_LOG_FUNCTION
(
this
);
59
m_channel
= 0;
60
WifiPhy::DoDispose
();
61
}
62
63
Ptr<Channel>
64
YansWifiPhy::GetChannel
(
void
)
const
65
{
66
return
m_channel
;
67
}
68
69
void
70
YansWifiPhy::SetChannel
(
const
Ptr<YansWifiChannel>
channel
)
71
{
72
NS_LOG_FUNCTION
(
this
<<
channel
);
73
m_channel
=
channel
;
74
m_channel
->Add (
this
);
75
}
76
77
void
78
YansWifiPhy::StartTx
(
Ptr<Packet>
packet,
WifiTxVector
txVector,
Time
txDuration)
79
{
80
NS_LOG_DEBUG
(
"Start transmission: signal power before antenna gain="
<<
GetPowerDbm
(txVector.
GetTxPowerLevel
()) <<
"dBm"
);
81
m_channel
->Send (
this
, packet,
GetPowerDbm
(txVector.
GetTxPowerLevel
()) +
GetTxGain
(), txDuration);
82
}
83
84
}
//namespace ns3
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:102
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:73
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Definition:
log-macros-enabled.h:213
ns3::WifiTxVector
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Definition:
wifi-tx-vector.h:61
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:45
ns3::YansWifiPhy::SetChannel
void SetChannel(const Ptr< YansWifiChannel > channel)
Set the YansWifiChannel this YansWifiPhy is to be connected to.
Definition:
yans-wifi-phy.cc:70
ns3::YansWifiPhy::m_channel
Ptr< YansWifiChannel > m_channel
YansWifiChannel that this YansWifiPhy is connected to.
Definition:
yans-wifi-phy.h:84
ns3::WifiPhy
802.11 PHY layer model
Definition:
wifi-phy.h:64
ns3::WifiPhy::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition:
wifi-phy.cc:389
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:202
yans-wifi-phy.h
third.channel
channel
Definition:
third.py:85
ns3::YansWifiPhy::StartTx
void StartTx(Ptr< Packet > packet, WifiTxVector txVector, Time txDuration)
Definition:
yans-wifi-phy.cc:78
yans-wifi-channel.h
ns3::YansWifiPhy::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition:
yans-wifi-phy.cc:56
ns3::WifiPhy::GetPowerDbm
double GetPowerDbm(uint8_t power) const
Get the power of the given power level in dBm.
Definition:
wifi-phy.cc:700
ns3::YansWifiPhy::~YansWifiPhy
virtual ~YansWifiPhy()
Definition:
yans-wifi-phy.cc:50
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::YansWifiPhy
802.11 PHY layer modelThis PHY implements a model of 802.11a.
Definition:
yans-wifi-phy.h:47
ns3::YansWifiPhy::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
yans-wifi-phy.cc:35
ns3::YansWifiPhy::YansWifiPhy
YansWifiPhy()
Definition:
yans-wifi-phy.cc:45
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition:
log.h:270
ns3::WifiTxVector::GetTxPowerLevel
uint8_t GetTxPowerLevel(void) const
Definition:
wifi-tx-vector.cc:76
ns3::WifiPhy::GetTxGain
double GetTxGain(void) const
Return the transmission gain (dB).
Definition:
wifi-phy.cc:552
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:58
ns3::YansWifiPhy::GetChannel
virtual Ptr< Channel > GetChannel(void) const
Return the Channel this WifiPhy is connected to.
Definition:
yans-wifi-phy.cc:64
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:915
Generated on Wed Nov 7 2018 10:02:15 for ns-3 by
1.8.14