diff --git a/src/devices/wifi/mac-parameters.cc b/src/devices/wifi/mac-parameters.cc index e105d0da9..91ca350a8 100644 --- a/src/devices/wifi/mac-parameters.cc +++ b/src/devices/wifi/mac-parameters.cc @@ -32,7 +32,8 @@ MacParameters::MacParameters () m_maxSlrc = WifiDefaultParameters::GetMaxSlrc (); // ensure something not too stupid is set by default. - NS_ASSERT (WifiDefaultParameters::GetPhyStandard () == WifiDefaultParameters::PHY_STANDARD_80211a); + NS_ASSERT (WifiDefaultParameters::GetPhyStandard () == WifiDefaultParameters::PHY_STANDARD_80211a || + WifiDefaultParameters::GetPhyStandard () == WifiDefaultParameters::PHY_STANDARD_Holland); uint32_t ctsAckSize = (2 + 2 + 6) * 8; // bits double dataRate = (6e6 / 2); // mb/s Time delay = Seconds (ctsAckSize / dataRate); @@ -42,7 +43,8 @@ MacParameters::MacParameters () void MacParameters::Initialize (Time ctsDelay, Time ackDelay) { - NS_ASSERT (WifiDefaultParameters::GetPhyStandard () == WifiDefaultParameters::PHY_STANDARD_80211a); + NS_ASSERT (WifiDefaultParameters::GetPhyStandard () == WifiDefaultParameters::PHY_STANDARD_80211a || + WifiDefaultParameters::GetPhyStandard () == WifiDefaultParameters::PHY_STANDARD_Holland); // these values are really 802.11a specific m_sifs = MicroSeconds (16); diff --git a/src/devices/wifi/wifi-default-parameters.cc b/src/devices/wifi/wifi-default-parameters.cc index c8ef2ea99..4167b8c3e 100644 --- a/src/devices/wifi/wifi-default-parameters.cc +++ b/src/devices/wifi/wifi-default-parameters.cc @@ -25,6 +25,13 @@ namespace ns3 { namespace WifiDefaultParameters { +static EnumDefaultValue g_phyStandard +("WifiPhyStandard", + "Describe the set of physical-layer tx modes and parameters", + PHY_STANDARD_80211a, "80211a", + PHY_STANDARD_holland, "holland", + 0, (void*)0); + static NumericDefaultValue g_maxSsrc ("WifiMaxSsrc", "The MAC maximum number of short retransmission retries (rts retransmissions).", @@ -185,7 +192,7 @@ GetApBeaconInterval (void) enum PhyStandard GetPhyStandard (void) { - return PHY_STANDARD_80211a; + return g_phyStandard.GetValue (); } enum RateControlAlgorithm GetRateControlAlgorithm (void) diff --git a/src/devices/wifi/wifi-default-parameters.h b/src/devices/wifi/wifi-default-parameters.h index 8a013ff87..b404cc850 100644 --- a/src/devices/wifi/wifi-default-parameters.h +++ b/src/devices/wifi/wifi-default-parameters.h @@ -30,6 +30,7 @@ namespace WifiDefaultParameters { enum PhyStandard { PHY_STANDARD_80211a, + PHY_STANDARD_holland, }; enum RateControlAlgorithm { CONSTANT_RATE, diff --git a/src/devices/wifi/wifi-phy.cc b/src/devices/wifi/wifi-phy.cc index 2ca22000d..457a5dcc7 100644 --- a/src/devices/wifi/wifi-phy.cc +++ b/src/devices/wifi/wifi-phy.cc @@ -193,8 +193,17 @@ WifiPhy::WifiPhy (Ptr device) m_endSyncEvent (), m_random (0.0, 1.0) { - NS_ASSERT (WifiDefaultParameters::GetPhyStandard () == WifiDefaultParameters::PHY_STANDARD_80211a); - Configure80211a (); + switch (WifiDefaultParameters::GetPhyStandard ()) { + case WifiDefaultParameters::PHY_STANDARD_80211a: + Configure80211a (); + break; + case WifiDefaultParameters::PHY_STANDARD_holland: + ConfigureHolland (); + break; + default: + NS_ASSERT (false); + break; + } } WifiPhy::~WifiPhy () @@ -389,7 +398,7 @@ WifiPhy::CalculateSnr (WifiMode txMode, double ber) const } void -WifiPhy::Configure80211a (void) +WifiPhy::Configure80211aParameters (void) { m_plcpLongPreambleDelayUs = 20; m_plcpShortPreambleDelayUs = 20; @@ -398,15 +407,11 @@ WifiPhy::Configure80211a (void) m_plcpHeaderLength = 4 + 1 + 12 + 1 + 6 + 16 + 6; /* 4095 bytes at a 6Mb/s rate with a 1/2 coding rate. */ m_maxPacketDuration = Seconds (4095.0*8.0/6000000.0*(1.0/2.0)); +} - m_modes.push_back (g_6mba); - m_modes.push_back (g_9mba); - m_modes.push_back (g_18mba); - m_modes.push_back (g_24mba); - m_modes.push_back (g_36mba); - m_modes.push_back (g_48mba); - m_modes.push_back (g_54mba); - +void +WifiPhy::PrintModes (void) const +{ #ifdef PHY80211_DEBUG for (double db = 0; db < 30; db+= 0.5) { std::cout < GetTraceResolver (void) const; + void Configure80211aParameters (void); + void PrintModes (void) const; void Configure80211a (void); + void ConfigureHolland (void); char const *StateToString (enum State state); enum WifiPhy::State GetState (void); double GetEdThresholdW (void) const;