A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
yans-wifi-phy.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005,2006 INRIA
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 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18 * Ghada Badawy <gbadawy@gmail.com>
19 * Sébastien Deronne <sebastien.deronne@gmail.com>
20 */
21
22#ifndef YANS_WIFI_PHY_H
23#define YANS_WIFI_PHY_H
24
25#include "wifi-phy.h"
26
27namespace ns3
28{
29
30class YansWifiChannel;
31
32/**
33 * \brief 802.11 PHY layer model
34 * \ingroup wifi
35 *
36 * This PHY implements a model of 802.11a. The model
37 * implemented here is based on the model described
38 * in "Yet Another Network Simulator" published in WNS2 2006;
39 * an author-prepared version of this paper is at:
40 * https://hal.inria.fr/file/index/docid/78318/filename/yans-rr.pdf
41 *
42 * This PHY model depends on a channel loss and delay
43 * model as provided by the ns3::PropagationLossModel
44 * and ns3::PropagationDelayModel classes, both of which are
45 * members of the ns3::YansWifiChannel class.
46 */
47class YansWifiPhy : public WifiPhy
48{
49 public:
50 /**
51 * \brief Get the type ID.
52 * \return the object TypeId
53 */
54 static TypeId GetTypeId();
55
57 ~YansWifiPhy() override;
58
59 void SetInterferenceHelper(const Ptr<InterferenceHelper> helper) override;
60 void StartTx(Ptr<const WifiPpdu> ppdu) override;
61 Ptr<Channel> GetChannel() const override;
62 uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const override;
63 std::tuple<double, double, double> GetTxMaskRejectionParams() const override;
64 WifiSpectrumBandInfo GetBand(uint16_t bandWidth, uint8_t bandIndex = 0) override;
67 const WifiSpectrumBandIndices& indices) const override;
68
69 /**
70 * Set the YansWifiChannel this YansWifiPhy is to be connected to.
71 *
72 * \param channel the YansWifiChannel this YansWifiPhy is to be connected to
73 */
74 void SetChannel(const Ptr<YansWifiChannel> channel);
75
76 /**
77 * Logs the arrival of a PPDU, including its power and duration.
78 * This will also trace PPDUs below WifiPhy::RxSensitivity
79 *
80 * \param [in] ppdu The PPDU being traced upon its arrival.
81 * \param [in] rxPowerDbm The received power of the PPDU in dBm.
82 * \param [in] duration The duration of the PPDU signal.
83 */
84 void TraceSignalArrival(Ptr<const WifiPpdu> ppdu, double rxPowerDbm, Time duration);
85
86 /**
87 * Callback invoked when the PHY model starts to process a signal
88 *
89 * \param ppdu The PPDU being processed
90 * \param rxPowerDbm received signal power (dBm)
91 * \param duration Signal duration
92 */
94 double rxPowerDbm,
95 Time duration);
96
97 protected:
98 void DoDispose() override;
99
100 private:
101 Ptr<YansWifiChannel> m_channel; //!< YansWifiChannel that this YansWifiPhy is connected to
102
104 m_signalArrivalCb; //!< Signal Arrival callback
105};
106
107} // namespace ns3
108
109#endif /* YANS_WIFI_PHY_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
802.11 PHY layer model
Definition: wifi-phy.h:65
802.11 PHY layer model
Definition: yans-wifi-phy.h:48
WifiSpectrumBandFrequencies ConvertIndicesToFrequencies(const WifiSpectrumBandIndices &indices) const override
This is a helper function to convert start and stop indices to start and stop frequencies.
void(* SignalArrivalCallback)(Ptr< const WifiPpdu > ppdu, double rxPowerDbm, Time duration)
Callback invoked when the PHY model starts to process a signal.
Definition: yans-wifi-phy.h:93
Ptr< YansWifiChannel > m_channel
YansWifiChannel that this YansWifiPhy is connected to.
FrequencyRange GetCurrentFrequencyRange() const override
Get the frequency range of the current RF interface.
void StartTx(Ptr< const WifiPpdu > ppdu) override
uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const override
WifiSpectrumBandInfo GetBand(uint16_t bandWidth, uint8_t bandIndex=0) override
Get the info of a given band.
TracedCallback< Ptr< const WifiPpdu >, double, Time > m_signalArrivalCb
Signal Arrival callback.
void SetChannel(const Ptr< YansWifiChannel > channel)
Set the YansWifiChannel this YansWifiPhy is to be connected to.
std::tuple< double, double, double > GetTxMaskRejectionParams() const override
~YansWifiPhy() override
void SetInterferenceHelper(const Ptr< InterferenceHelper > helper) override
Sets the interference helper.
Ptr< Channel > GetChannel() const override
Return the Channel this WifiPhy is connected to.
void DoDispose() override
Destructor implementation.
static TypeId GetTypeId()
Get the type ID.
void TraceSignalArrival(Ptr< const WifiPpdu > ppdu, double rxPowerDbm, Time duration)
Logs the arrival of a PPDU, including its power and duration.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::pair< uint64_t, uint64_t > WifiSpectrumBandFrequencies
typedef for a pair of start and stop frequencies in Hz to represent a band
std::pair< uint32_t, uint32_t > WifiSpectrumBandIndices
typedef for a pair of start and stop sub-band indices
Struct defining a frequency range between minFrequency (MHz) and maxFrequency (MHz).
WifiSpectrumBandInfo structure containing info about a spectrum band.