802.11 PHY layer modelThis PHY implements a model of 802.11a. The model implemented here is based on the model described in "Yet Another Network Simulator", (http://cutebugs.net/files/wns2-yans.pdf). More...
#include <yans-wifi-phy.h>
Public Member Functions | |
int64_t | AssignStreams (int64_t stream) |
virtual double | CalculateSnr (WifiMode txMode, double ber) const |
virtual void | ConfigureStandard (enum WifiPhyStandard standard) |
double | GetCcaMode1Threshold (void) const |
virtual Ptr< WifiChannel > | GetChannel (void) const |
double | GetChannelFrequencyMhz () const |
Return current center channel frequency in MHz, see SetChannelNumber() | |
uint16_t | GetChannelNumber () const |
Return current channel number, see SetChannelNumber() | |
virtual Time | GetDelayUntilIdle (void) |
Ptr< Object > | GetDevice (void) const |
double | GetEdThreshold (void) const |
Ptr< ErrorRateModel > | GetErrorRateModel (void) const |
virtual Time | GetLastRxStartTime (void) const |
Ptr< Object > | GetMobility (void) |
virtual WifiMode | GetMode (uint32_t mode) const |
virtual uint32_t | GetNModes (void) const |
virtual uint32_t | GetNTxPower (void) const |
double | GetRxGain (void) const |
double | GetRxNoiseFigure (void) const |
virtual Time | GetStateDuration (void) |
Time | GetSwitchingDelay (void) |
double | GetTxGain (void) const |
virtual double | GetTxPowerEnd (void) const |
virtual double | GetTxPowerStart (void) const |
virtual bool | IsStateBusy (void) |
virtual bool | IsStateCcaBusy (void) |
virtual bool | IsStateIdle (void) |
virtual bool | IsStateRx (void) |
virtual bool | IsStateSensing (void) |
virtual bool | IsStateSwitching (void) |
virtual bool | IsStateTx (void) |
virtual void | RegisterListener (WifiPhyListener *listener) |
virtual void | SendPacket (Ptr< const Packet > packet, WifiMode mode, enum WifiPreamble preamble, uint8_t txPowerLevel) |
void | SetCcaMode1Threshold (double threshold) |
void | SetChannel (Ptr< YansWifiChannel > channel) |
void | SetChannelNumber (uint16_t id) |
Set channel number. More... | |
void | SetDevice (Ptr< Object > device) |
void | SetEdThreshold (double threshold) |
void | SetErrorRateModel (Ptr< ErrorRateModel > rate) |
virtual void | SetHandoffEndedCallback (WifiPhy::HandoffEndedCallback callback) |
void | SetMobility (Ptr< Object > mobility) |
void | SetNTxPower (uint32_t n) |
virtual void | SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback) |
virtual void | SetReceiveOkCallback (WifiPhy::RxOkCallback callback) |
void | SetRxGain (double gain) |
void | SetRxNoiseFigure (double noiseFigureDb) |
virtual void | SetSenseEndedCallback (WifiPhy::SnsEndedCallback callback) |
void | SetTxGain (double gain) |
void | SetTxPowerEnd (double end) |
void | SetTxPowerStart (double start) |
void | StartReceivePacket (Ptr< Packet > packet, double rxPowerDbm, WifiMode mode, WifiPreamble preamble) |
void | StartSensing (Time duration) |
Start sensing on current channel. More... | |
Public Member Functions inherited from ns3::WifiPhy | |
void | NotifyMonitorSniffRx (Ptr< const Packet > packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, double signalDbm, double noiseDbm) |
void | NotifyMonitorSniffTx (Ptr< const Packet > packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble) |
void | NotifyRxBegin (Ptr< const Packet > packet) |
void | NotifyRxDrop (Ptr< const Packet > packet) |
void | NotifyRxEnd (Ptr< const Packet > packet) |
void | NotifyTxBegin (Ptr< const Packet > packet) |
void | NotifyTxDrop (Ptr< const Packet > packet) |
void | NotifyTxEnd (Ptr< const Packet > packet) |
Public Member Functions inherited from ns3::Object | |
void | AggregateObject (Ptr< Object > other) |
void | Dispose (void) |
AggregateIterator | GetAggregateIterator (void) const |
virtual TypeId | GetInstanceTypeId (void) const |
template<typename T > | |
Ptr< T > | GetObject (void) const |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
void | Initialize (void) |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount (const SimpleRefCount &o) | |
uint32_t | GetReferenceCount (void) const |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
void | Ref (void) const |
void | Unref (void) const |
Public Member Functions inherited from ns3::ObjectBase | |
void | GetAttribute (std::string name, AttributeValue &value) const |
bool | GetAttributeFailSafe (std::string name, AttributeValue &attribute) const |
void | SetAttribute (std::string name, const AttributeValue &value) |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::WifiPhy | |
static Time | CalculateTxDuration (uint32_t size, WifiMode payloadMode, enum WifiPreamble preamble) |
static WifiMode | GetDsssRate11Mbps () |
static WifiMode | GetDsssRate1Mbps () |
static WifiMode | GetDsssRate2Mbps () |
static WifiMode | GetDsssRate5_5Mbps () |
static WifiMode | GetErpOfdmRate12Mbps () |
static WifiMode | GetErpOfdmRate18Mbps () |
static WifiMode | GetErpOfdmRate24Mbps () |
static WifiMode | GetErpOfdmRate36Mbps () |
static WifiMode | GetErpOfdmRate48Mbps () |
static WifiMode | GetErpOfdmRate54Mbps () |
static WifiMode | GetErpOfdmRate6Mbps () |
static WifiMode | GetErpOfdmRate9Mbps () |
static WifiMode | GetOfdmRate12Mbps () |
static WifiMode | GetOfdmRate12MbpsBW10MHz () |
static WifiMode | GetOfdmRate12MbpsBW5MHz () |
static WifiMode | GetOfdmRate13_5MbpsBW5MHz () |
static WifiMode | GetOfdmRate18Mbps () |
static WifiMode | GetOfdmRate18MbpsBW10MHz () |
static WifiMode | GetOfdmRate1_5MbpsBW5MHz () |
static WifiMode | GetOfdmRate24Mbps () |
static WifiMode | GetOfdmRate24MbpsBW10MHz () |
static WifiMode | GetOfdmRate27MbpsBW10MHz () |
static WifiMode | GetOfdmRate2_25MbpsBW5MHz () |
static WifiMode | GetOfdmRate36Mbps () |
static WifiMode | GetOfdmRate3MbpsBW10MHz () |
static WifiMode | GetOfdmRate3MbpsBW5MHz () |
static WifiMode | GetOfdmRate48Mbps () |
static WifiMode | GetOfdmRate4_5MbpsBW10MHz () |
static WifiMode | GetOfdmRate4_5MbpsBW5MHz () |
static WifiMode | GetOfdmRate54Mbps () |
static WifiMode | GetOfdmRate6Mbps () |
static WifiMode | GetOfdmRate6MbpsBW10MHz () |
static WifiMode | GetOfdmRate6MbpsBW5MHz () |
static WifiMode | GetOfdmRate9Mbps () |
static WifiMode | GetOfdmRate9MbpsBW10MHz () |
static WifiMode | GetOfdmRate9MbpsBW5MHz () |
static uint32_t | GetPayloadDurationMicroSeconds (uint32_t size, WifiMode payloadMode) |
static uint32_t | GetPlcpHeaderDurationMicroSeconds (WifiMode payloadMode, WifiPreamble preamble) |
static WifiMode | GetPlcpHeaderMode (WifiMode payloadMode, WifiPreamble preamble) |
static uint32_t | GetPlcpPreambleDurationMicroSeconds (WifiMode payloadMode, WifiPreamble preamble) |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
static void | Cleanup (void) |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
Private Member Functions | |
YansWifiPhy (const YansWifiPhy &o) | |
void | Configure80211_10Mhz (void) |
void | Configure80211_5Mhz () |
void | Configure80211a (void) |
void | Configure80211b (void) |
void | Configure80211g (void) |
void | Configure80211p_CCH (void) |
void | Configure80211p_SCH (void) |
void | ConfigureHolland (void) |
double | DbmToW (double dbm) const |
double | DbToRatio (double db) const |
virtual void | DoDispose (void) |
void | EndReceive (Ptr< Packet > packet, Ptr< InterferenceHelper::Event > event) |
double | GetEdThresholdW (void) const |
double | GetPowerDbm (uint8_t power) const |
double | RatioToDb (double ratio) const |
double | WToDbm (double w) const |
Private Attributes | |
double | m_ccaMode1ThresholdW |
Ptr< YansWifiChannel > | m_channel |
uint16_t | m_channelNumber |
double | m_channelStartingFrequency |
Standard-dependent center frequency of 0-th channel, MHz. | |
Time | m_channelSwitchDelay |
Ptr< Object > | m_device |
WifiModeList | m_deviceRateSet |
double | m_edThresholdW |
EventId | m_endRxEvent |
HandoffEndedCallback | m_handoffEndedCallback |
InterferenceHelper | m_interference |
Ptr< Object > | m_mobility |
uint32_t | m_nTxPower |
Ptr< UniformRandomVariable > | m_random |
Provides uniform random variables. | |
double | m_rxGainDb |
SnsEndedCallback | m_senseEndedCallback |
Ptr< WifiPhyStateHelper > | m_state |
double | m_txGainDb |
double | m_txPowerBaseDbm |
double | m_txPowerEndDbm |
Additional Inherited Members | |
Public Types inherited from ns3::WifiPhy | |
typedef Callback< void > | HandoffEndedCallback |
typedef Callback< void, Ptr < const Packet >, double > | RxErrorCallback |
typedef Callback< void, Ptr < Packet >, double, WifiMode, enum WifiPreamble > | RxOkCallback |
typedef Callback< void > | SnsEndedCallback |
enum | State { IDLE, CCA_BUSY, TX, RX, SWITCHING, SENSING } |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
virtual void | DoInitialize (void) |
virtual void | NotifyNewAggregate (void) |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
virtual void | NotifyConstructionCompleted (void) |
802.11 PHY layer model
This PHY implements a model of 802.11a. The model implemented here is based on the model described in "Yet Another Network Simulator", (http://cutebugs.net/files/wns2-yans.pdf).
This PHY model depends on a channel loss and delay model as provided by the ns3::PropagationLossModel and ns3::PropagationDelayModel classes, both of which are members of the ns3::YansWifiChannel class.
ns3::YansWifiPhy is accessible through the following paths with Config::Set and Config::Connect:
No TraceSources are defined for this type.
Definition at line 61 of file yans-wifi-phy.h.
|
virtual |
Assign a fixed random variable stream number to the random variables used by this model. Return the number of streams (possibly zero) that have been assigned.
stream | first stream index to use |
Implements ns3::WifiPhy.
Definition at line 875 of file yans-wifi-phy.cc.
References m_random, NS_LOG_FUNCTION, and ns3::RandomVariableStream::SetStream().
|
virtual |
txMode | the transmission mode |
ber | the probability of bit error rate |
Implements ns3::WifiPhy.
Definition at line 314 of file yans-wifi-phy.cc.
|
privatevirtual |
This method is called by Object::Dispose or by the object's destructor, whichever comes first.
Subclasses are expected to implement their real destruction code in an overriden version of this method and chain up to their parent's implementation once they are done. i.e., for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose method.
It is safe to call GetObject from within this method.
Reimplemented from ns3::Object.
Definition at line 143 of file yans-wifi-phy.cc.
References m_deviceRateSet, and NS_LOG_FUNCTION.
|
virtual |
The PHY will never become WifiPhy::IDLE before the delay returned by this method but it could become really idle later.
Implements ns3::WifiPhy.
Definition at line 782 of file yans-wifi-phy.cc.
Referenced by SetChannelNumber(), and StartSensing().
|
virtual |
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager) to determine the set of transmission/reception modes that this WifiPhy(-derived class) can support - a set of WifiMode objects which we call the DeviceRateSet, and which is stored as WifiPhy::m_deviceRateSet.
It is important to note that the DeviceRateSet is a superset (not necessarily proper) of the OperationalRateSet (which is logically, if not actually, a property of the associated WifiRemoteStationManager), which itself is a superset (again, not necessarily proper) of the BSSBasicRateSet.
mode | index in array of supported modes |
Implements ns3::WifiPhy.
Definition at line 598 of file yans-wifi-phy.cc.
References m_deviceRateSet.
|
virtual |
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager) to determine the set of transmission/reception modes that this WifiPhy(-derived class) can support - a set of WifiMode objects which we call the DeviceRateSet, and which is stored as WifiPhy::m_deviceRateSet.
It is important to note that the DeviceRateSet is a superset (not necessarily proper) of the OperationalRateSet (which is logically, if not actually, a property of the associated WifiRemoteStationManager), which itself is a superset (again, not necessarily proper) of the BSSBasicRateSet.
Implements ns3::WifiPhy.
Definition at line 593 of file yans-wifi-phy.cc.
References m_deviceRateSet.
|
virtual |
Implements ns3::WifiPhy.
Definition at line 603 of file yans-wifi-phy.cc.
|
virtual |
Implements ns3::WifiPhy.
Definition at line 777 of file yans-wifi-phy.cc.
|
virtual |
Implements ns3::WifiPhy.
Definition at line 751 of file yans-wifi-phy.cc.
|
virtual |
Implements ns3::WifiPhy.
Definition at line 740 of file yans-wifi-phy.cc.
|
virtual |
Implements ns3::WifiPhy.
Definition at line 746 of file yans-wifi-phy.cc.
|
virtual |
Implements ns3::WifiPhy.
Definition at line 756 of file yans-wifi-phy.cc.
|
virtual |
Implements ns3::WifiPhy.
Definition at line 771 of file yans-wifi-phy.cc.
Referenced by SetChannelNumber(), and StartSensing().
|
virtual |
Implements ns3::WifiPhy.
Definition at line 766 of file yans-wifi-phy.cc.
Referenced by SetChannelNumber(), and StartSensing().
|
virtual |
Implements ns3::WifiPhy.
Definition at line 761 of file yans-wifi-phy.cc.
|
virtual |
listener | the new listener |
Add the input listener to the list of objects to be notified of PHY-level events.
Implements ns3::WifiPhy.
Definition at line 734 of file yans-wifi-phy.cc.
|
virtual |
packet | the packet to send |
mode | the transmission mode to use to send this packet |
preamble | the type of preamble to use to send this packet. |
txPowerLevel | a power level to use to send this packet. The real transmission power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txPowerMin) / nTxLevels |
Implements ns3::WifiPhy.
Definition at line 566 of file yans-wifi-phy.cc.
References ns3::WifiPhy::CalculateTxDuration(), ns3::EventId::Cancel(), GetChannelFrequencyMhz(), GetChannelNumber(), ns3::WifiMode::GetDataRate(), ns3::Packet::GetSize(), ns3::WifiPhy::NotifyMonitorSniffTx(), ns3::WifiPhy::NotifyTxBegin(), NS_ASSERT, and NS_LOG_FUNCTION.
|
virtual |
Set channel number.
Channel center frequency = Channel starting frequency + 5 MHz * (nch - 1)
where Starting channel frequency is standard-dependent, see SetStandard() as defined in IEEE 802.11-2007 17.3.8.3.2.
YansWifiPhy can switch among different channels. Basically, YansWifiPhy has a private attribute m_channelNumber that identifies the channel the PHY operates on. Channel switching cannot interrupt an ongoing transmission. When PHY is in TX state, the channel switching is postponed until the end of the current transmission. When the PHY is in RX state, the channel switching causes the drop of the synchronized packet.
Implements ns3::WifiPhy.
Definition at line 332 of file yans-wifi-phy.cc.
References ns3::EventId::Cancel(), ns3::WifiPhy::CCA_BUSY, GetDelayUntilIdle(), ns3::WifiPhy::IDLE, IsStateSensing(), IsStateSwitching(), ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, ns3::WifiPhy::RX, ns3::Simulator::Schedule(), ns3::Seconds(), and ns3::WifiPhy::TX.
Referenced by ns3::MeshWifiInterfaceMac::SwitchFrequencyChannel().
|
virtual |
callback | the callback to invoke when sensing is ended |
Implements ns3::WifiPhy.
Definition at line 453 of file yans-wifi-phy.cc.
|
virtual |
callback | the callback to invoke upon erroneous packet reception. |
Implements ns3::WifiPhy.
Definition at line 443 of file yans-wifi-phy.cc.
|
virtual |
callback | the callback to invoke upon successful packet reception. |
Implements ns3::WifiPhy.
Definition at line 438 of file yans-wifi-phy.cc.
|
virtual |
callback | the callback to invoke when sensing is ended |
Implements ns3::WifiPhy.
Definition at line 448 of file yans-wifi-phy.cc.
|
virtual |
Start sensing on current channel.
duration | Time to sense |
Implements ns3::WifiPhy.
Definition at line 383 of file yans-wifi-phy.cc.
References ns3::WifiPhy::CCA_BUSY, GetDelayUntilIdle(), ns3::WifiPhy::IDLE, IsStateSensing(), IsStateSwitching(), NS_ASSERT, NS_LOG_DEBUG, ns3::WifiPhy::RX, ns3::Simulator::Schedule(), and ns3::WifiPhy::TX.
|
private |
This vector holds the set of transmission modes that this WifiPhy(-derived class) can support. In conversation we call this the DeviceRateSet (not a term you'll find in the standard), and it is a superset of standard-defined parameters such as the OperationalRateSet, and the BSSBasicRateSet (which, themselves, have a superset/subset relationship).
Mandatory rates relevant to this WifiPhy can be found by iterating over this vector looking for WifiMode objects for which WifiMode::IsMandatory() is true.
A quick note is appropriate here (well, here is as good a place as any I can find)...
In the standard there is no text that explicitly precludes production of a device that does not support some rates that are mandatory (according to the standard) for PHYs that the device happens to fully or partially support.
This approach is taken by some devices which choose to only support, for example, 6 and 9 Mbps ERP-OFDM rates for cost and power consumption reasons (i.e., these devices don't need to be designed for and waste current on the increased linearity requirement of higher-order constellations when 6 and 9 Mbps more than meet their data requirements). The wording of the standard allows such devices to have an OperationalRateSet which includes 6 and 9 Mbps ERP-OFDM rates, despite 12 and 24 Mbps being "mandatory" rates for the ERP-OFDM PHY.
Now this doesn't actually have any impact on code, yet. It is, however, something that we need to keep in mind for the future. Basically, the key point is that we can't be making assumptions like "the Operational Rate Set will contain all the mandatory rates".
Definition at line 234 of file yans-wifi-phy.h.
Referenced by DoDispose(), GetMode(), and GetNModes().