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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 * Ghada Badawy <gbadawy@gmail.com>
8 * Sébastien Deronne <sebastien.deronne@gmail.com>
9 */
10
11#ifndef YANS_WIFI_PHY_H
12#define YANS_WIFI_PHY_H
13
14#include "wifi-phy.h"
15
16#include "ns3/wifi-export.h"
17
18namespace ns3
19{
20
21class YansWifiChannel;
22
23/**
24 * @brief 802.11 PHY layer model
25 * @ingroup wifi
26 *
27 * This PHY implements a model of 802.11a. The model
28 * implemented here is based on the model described
29 * in "Yet Another Network Simulator" published in WNS2 2006;
30 * an author-prepared version of this paper is at:
31 * https://hal.inria.fr/file/index/docid/78318/filename/yans-rr.pdf
32 *
33 * This PHY model depends on a channel loss and delay
34 * model as provided by the ns3::PropagationLossModel
35 * and ns3::PropagationDelayModel classes, both of which are
36 * members of the ns3::YansWifiChannel class.
37 */
38class WIFI_EXPORT YansWifiPhy : public WifiPhy
39{
40 public:
41 /**
42 * @brief Get the type ID.
43 * @return the object TypeId
44 */
45 static TypeId GetTypeId();
46
48 ~YansWifiPhy() override;
49
50 void SetInterferenceHelper(const Ptr<InterferenceHelper> helper) override;
51 void StartTx(Ptr<const WifiPpdu> ppdu) override;
52 Ptr<Channel> GetChannel() const override;
53 MHz_u GetGuardBandwidth(MHz_u currentChannelWidth) const override;
54 std::tuple<dBr_u, dBr_u, dBr_u> GetTxMaskRejectionParams() const override;
55 WifiSpectrumBandInfo GetBand(MHz_u bandWidth, uint8_t bandIndex = 0) override;
58 const WifiSpectrumBandIndices& indices) const override;
59
60 /**
61 * Set the YansWifiChannel this YansWifiPhy is to be connected to.
62 *
63 * @param channel the YansWifiChannel this YansWifiPhy is to be connected to
64 */
65 void SetChannel(const Ptr<YansWifiChannel> channel);
66
67 /**
68 * Logs the arrival of a PPDU, including its power and duration.
69 * This will also trace PPDUs below WifiPhy::RxSensitivity
70 *
71 * @param [in] ppdu The PPDU being traced upon its arrival.
72 * @param [in] rxPowerDbm The received power of the PPDU in dBm.
73 * @param [in] duration The duration of the PPDU signal.
74 */
75 void TraceSignalArrival(Ptr<const WifiPpdu> ppdu, double rxPowerDbm, Time duration);
76
77 /**
78 * Callback invoked when the PHY model starts to process a signal
79 *
80 * @param ppdu The PPDU being processed
81 * @param rxPowerDbm received signal power (dBm)
82 * @param duration Signal duration
83 */
85 double rxPowerDbm,
86 Time duration);
87
88 protected:
89 void DoDispose() override;
90
91 private:
92 void FinalizeChannelSwitch() override;
93
94 Ptr<YansWifiChannel> m_channel; //!< YansWifiChannel that this YansWifiPhy is connected to
95
97 m_signalArrivalCb; //!< Signal Arrival callback
98};
99
100} // namespace ns3
101
102#endif /* YANS_WIFI_PHY_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition type-id.h:50
a channel to interconnect ns3::YansWifiPhy objects.
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.
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
std::tuple< dBr_u, dBr_u, dBr_u > GetTxMaskRejectionParams() const override
MHz_u GetGuardBandwidth(MHz_u currentChannelWidth) const override
WifiSpectrumBandInfo GetBand(MHz_u 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.
void FinalizeChannelSwitch() override
Method that can be overridden by subclasses to perform operations after the channel is actually switc...
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.
double MHz_u
MHz weak type.
Definition wifi-units.h:31
std::pair< Hz_u, Hz_u > WifiSpectrumBandFrequencies
typedef for a pair of start and stop frequencies 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).
Definition wifi-types.h:94
WifiSpectrumBandInfo structure containing info about a spectrum band.