add the holland 802.11a set of modes.
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Tue, 06 Nov 2007 16:16:06 +0100
changeset 2083 c7541b84285e
parent 2082 d041fc198aad
child 2084 24cfc21bda99
add the holland 802.11a set of modes.
src/devices/wifi/mac-parameters.cc
src/devices/wifi/wifi-default-parameters.cc
src/devices/wifi/wifi-default-parameters.h
src/devices/wifi/wifi-phy.cc
src/devices/wifi/wifi-phy.h
--- a/src/devices/wifi/mac-parameters.cc	Tue Nov 06 15:11:22 2007 +0100
+++ b/src/devices/wifi/mac-parameters.cc	Tue Nov 06 16:16:06 2007 +0100
@@ -32,7 +32,8 @@
   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 @@
 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);
--- a/src/devices/wifi/wifi-default-parameters.cc	Tue Nov 06 15:11:22 2007 +0100
+++ b/src/devices/wifi/wifi-default-parameters.cc	Tue Nov 06 16:16:06 2007 +0100
@@ -25,6 +25,13 @@
 
 namespace WifiDefaultParameters {
 
+static EnumDefaultValue<enum PhyStandard> 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<uint32_t> g_maxSsrc
 ("WifiMaxSsrc", 
  "The MAC maximum number of short retransmission retries (rts retransmissions).",
@@ -185,7 +192,7 @@
 enum PhyStandard 
 GetPhyStandard (void)
 {
-  return PHY_STANDARD_80211a;
+  return g_phyStandard.GetValue ();
 }
 enum RateControlAlgorithm 
 GetRateControlAlgorithm (void)
--- a/src/devices/wifi/wifi-default-parameters.h	Tue Nov 06 15:11:22 2007 +0100
+++ b/src/devices/wifi/wifi-default-parameters.h	Tue Nov 06 16:16:06 2007 +0100
@@ -30,6 +30,7 @@
 
 enum PhyStandard {
   PHY_STANDARD_80211a,
+  PHY_STANDARD_holland,
 };
 enum RateControlAlgorithm {
   CONSTANT_RATE,
--- a/src/devices/wifi/wifi-phy.cc	Tue Nov 06 15:11:22 2007 +0100
+++ b/src/devices/wifi/wifi-phy.cc	Tue Nov 06 16:16:06 2007 +0100
@@ -193,8 +193,17 @@
     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 @@
 }
 
 void
-WifiPhy::Configure80211a (void)
+WifiPhy::Configure80211aParameters (void)
 {
   m_plcpLongPreambleDelayUs = 20;
   m_plcpShortPreambleDelayUs = 20;
@@ -398,15 +407,11 @@
   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 <<db<<" ";
@@ -420,6 +425,35 @@
 #endif
 }
 
+void
+WifiPhy::Configure80211a (void)
+{
+  Configure80211aParameters ();
+  m_modes.push_back (g_6mba);
+  m_modes.push_back (g_9mba);
+  m_modes.push_back (g_12mba);
+  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);
+
+  PrintModes ();
+}
+
+void
+WifiPhy::ConfigureHolland (void)
+{
+  Configure80211aParameters ();
+  m_modes.push_back (g_6mba);
+  m_modes.push_back (g_12mba);
+  m_modes.push_back (g_18mba);
+  m_modes.push_back (g_36mba);
+  m_modes.push_back (g_54mba);
+
+  PrintModes ();
+}
+
 void 
 WifiPhy::RegisterListener (WifiPhyListener *listener)
 {
--- a/src/devices/wifi/wifi-phy.h	Tue Nov 06 15:11:22 2007 +0100
+++ b/src/devices/wifi/wifi-phy.h	Tue Nov 06 16:16:06 2007 +0100
@@ -246,7 +246,10 @@
 private:
   // inherited from ns3::Object.
   virtual Ptr<TraceResolver> 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;