examples: Fix configuration of wifi-spectrum-saturation-example.cc

Applies the same fix for issue #1098 in commit f9801065 to another file.
This commit is contained in:
Tom Henderson
2024-07-12 14:17:20 -07:00
parent c4f083cb4a
commit 5d218d6e85

View File

@@ -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<WifiPhyHelper&>(yansPhy)
: dynamic_cast<WifiPhyHelper&>(spectrumPhy));
phy.SetPcapDataLinkType(WifiPhyHelper::DLT_IEEE802_11_RADIO);
std::stringstream ss;
ss << "wifi-spectrum-saturation-example-" << i;