diff --git a/examples/wireless/wifi-spectrum-saturation-example.cc b/examples/wireless/wifi-spectrum-saturation-example.cc index 11dd67263..ee7135523 100644 --- a/examples/wireless/wifi-spectrum-saturation-example.cc +++ b/examples/wireless/wifi-spectrum-saturation-example.cc @@ -141,22 +141,22 @@ main(int argc, char* argv[]) NodeContainer wifiApNode; wifiApNode.Create(1); - YansWifiPhyHelper phy; + YansWifiPhyHelper yansPhy; SpectrumWifiPhyHelper spectrumPhy; if (wifiType == "ns3::YansWifiPhy") { YansWifiChannelHelper channel; channel.AddPropagationLoss("ns3::FriisPropagationLossModel"); channel.SetPropagationDelay("ns3::ConstantSpeedPropagationDelayModel"); - phy.SetChannel(channel.Create()); - phy.Set("TxPowerStart", DoubleValue(1)); - phy.Set("TxPowerEnd", DoubleValue(1)); + yansPhy.SetChannel(channel.Create()); + yansPhy.Set("TxPowerStart", DoubleValue(1)); + yansPhy.Set("TxPowerEnd", DoubleValue(1)); if (i > 31 && i <= 63) { - phy.Set("Antennas", UintegerValue(2)); - phy.Set("MaxSupportedTxSpatialStreams", UintegerValue(2)); - phy.Set("MaxSupportedRxSpatialStreams", UintegerValue(2)); + yansPhy.Set("Antennas", UintegerValue(2)); + yansPhy.Set("MaxSupportedTxSpatialStreams", UintegerValue(2)); + yansPhy.Set("MaxSupportedRxSpatialStreams", UintegerValue(2)); } } else if (wifiType == "ns3::SpectrumWifiPhy") @@ -535,20 +535,20 @@ main(int argc, char* argv[]) if (wifiType == "ns3::YansWifiPhy") { mac.SetType("ns3::StaWifiMac", "Ssid", SsidValue(ssid)); - phy.Set("ChannelSettings", StringValue(channelStr)); + yansPhy.Set("ChannelSettings", StringValue(channelStr)); - staDevice = wifi.Install(phy, mac, wifiStaNode); + staDevice = wifi.Install(yansPhy, mac, wifiStaNode); mac.SetType("ns3::ApWifiMac", "Ssid", SsidValue(ssid)); - phy.Set("ChannelSettings", StringValue(channelStr)); - apDevice = wifi.Install(phy, mac, wifiApNode); + yansPhy.Set("ChannelSettings", StringValue(channelStr)); + apDevice = wifi.Install(yansPhy, mac, wifiApNode); } else if (wifiType == "ns3::SpectrumWifiPhy") { mac.SetType("ns3::StaWifiMac", "Ssid", SsidValue(ssid)); - phy.Set("ChannelSettings", StringValue(channelStr)); + spectrumPhy.Set("ChannelSettings", StringValue(channelStr)); staDevice = wifi.Install(spectrumPhy, mac, wifiStaNode); mac.SetType("ns3::ApWifiMac", "Ssid", SsidValue(ssid)); - phy.Set("ChannelSettings", StringValue(channelStr)); + spectrumPhy.Set("ChannelSettings", StringValue(channelStr)); apDevice = wifi.Install(spectrumPhy, mac, wifiApNode); } @@ -602,6 +602,9 @@ main(int argc, char* argv[]) if (enablePcap) { + auto& phy = + (wifiType == "ns3::YansWifiPhy" ? dynamic_cast(yansPhy) + : dynamic_cast(spectrumPhy)); phy.SetPcapDataLinkType(WifiPhyHelper::DLT_IEEE802_11_RADIO); std::stringstream ss; ss << "wifi-spectrum-saturation-example-" << i;