Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
ns-3: Make wifi creation compatible with ns-3 version 3.34 too
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 24 Aug 2021 21:31:51 +0000 (23:31 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 24 Aug 2021 21:31:51 +0000 (23:31 +0200)
ChangeLog
src/surf/network_ns3.cpp

index 3bb94b6..10bc26e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,8 +18,8 @@ New features:
      - Link: examples/cpp/network-nonlinear
      - CPU: examples/cpp/exec-cpu-nonlinear
  - Dynamic factors for CPU and disk: similarly to dynamic network factors,
- allows the user to set a callback which can affect the progress of activities
- (multiplicative factor applied when updating the amount of work remaining).
  allows the user to set a callback which can affect the progress of activities
  (multiplicative factor applied when updating the amount of work remaining).
    - Example: examples/cpp/exec-cpu-factors
 
 Python:
@@ -50,6 +50,9 @@ Documentation:
   model disks in SimGrid.
   * Improvements in API Reference for C++ and Python interfaces.
 
+ns-3 model:
+ - Make wifi creation compatible with ns-3 version 3.34 too.
+
 Fixed bugs (FG#.. -> FramaGit bugs; FG!.. -> FG merge requests)
  (FG: issues on Framagit; GF: issues on GForge; GH: issues on GitHub)
  - FG#78: Multiple fixes for SMPI replay:
index e8f7300..cc89335 100644 (file)
@@ -114,6 +114,9 @@ static void zoneCreation_cb(simgrid::s4u::NetZone const& zone)
   wifiPhy.Set("Antennas", ns3::UintegerValue(nss_value));
   wifiPhy.Set("MaxSupportedTxSpatialStreams", ns3::UintegerValue(nss_value));
   wifiPhy.Set("MaxSupportedRxSpatialStreams", ns3::UintegerValue(nss_value));
+#if NS3_MINOR_VERSION > 33
+  wifiPhy.Set("ChannelWidth", ns3::UintegerValue(40));
+#endif
   wifiMac.SetType("ns3::ApWifiMac", "Ssid", ns3::SsidValue(ssid));
 
   mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
@@ -158,7 +161,11 @@ static void zoneCreation_cb(simgrid::s4u::NetZone const& zone)
     ns3::Simulator::Schedule(ns3::Seconds(start_time_value), &resumeWifiDevice, device);
   }
 
+#if NS3_MINOR_VERSION < 33
+  // This fails with "The channel width does not uniquely identify an operating channel" on v3.34,
+  // so we specified the ChannelWidth of wifiPhy to 40, above, when creating wifiPhy with v3.34 and higher
   ns3::Config::Set("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", ns3::UintegerValue(40));
+#endif
 
   mobility.SetPositionAllocator(positionAllocS);
   mobility.Install(nodes);