Score:0

I'm facing some errors when I try to setup a wireless mesh network using ns3.38 on ubuntu 22.04 LTS

ch flag

I'm using Ubuntu version 22.04, and trying to run a script using ns-3 3.38 that set ups a mesh wireless network. However I get errors after running it.

error: 'Default' is not a member of 'ns3: YansiWifiHelper'

error: 'WIFI_PHY_STANDARD_80211N_5GHZ' was not declared in this scope

I will provide the script without the header files. I have two errors, and I will mark the lines.

using namespace ns3;

NS_LOG_COMPONENT_DEFINE("SimpleMeshNetwork");

int main(int argc, char *argv[]) {
    LogComponentEnable("SimpleMeshNetwork", LOG_LEVEL_INFO);

    NodeContainer nodes;
    nodes.Create(4);

    MobilityHelper mobility;
    mobility.SetPositionAllocator("ns3::GridPositionAllocator",
                                  "MinX", DoubleValue(0.0),
                                  "MinY", DoubleValue(0.0),
                                  "DeltaX", DoubleValue(100.0),
                                  "DeltaY", DoubleValue(100.0),
                                  "GridWidth", UintegerValue(2),
                                  "LayoutType", StringValue("RowFirst"));
    mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
    mobility.Install(nodes);

    WifiHelper wifi;
    wifi.SetStandard(WIFI_PHY_STANDARD_80211s);
    wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
                                 "DataMode", StringValue("OfdmRate6Mbps"));

    YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default();
    wifiPhy.Set("ChannelNumber", UintegerValue(7));

    YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default();
    wifiPhy.SetChannel(wifiChannel.Create());

    MeshHelper mesh = MeshHelper::Default();
    mesh.SetStackInstaller("ns3::Dot11sStack");
    mesh.SetSpreadInterfaceChannels(MeshHelper::SPREAD_CHANNELS);
    mesh.SetMacType("RandomStart", TimeValue(Seconds(0.1)));

    NetDeviceContainer meshDevices = mesh.Install(wifiPhy, nodes);

    InternetStackHelper internet;
    internet.Install(nodes);

    Ipv4AddressHelper address;
    address.SetBase("10.1.1.0", "255.255.255.0");
    Ipv4InterfaceContainer interfaces = address.Assign(meshDevices);

    Simulator::Stop(Seconds(10.0));

    for (uint32_t i = 0; i < nodes.GetN(); ++i) {
        Ptr<Node> node = nodes.Get(i);
        Ptr<Ipv4> ipv4 = node->GetObject<Ipv4>();
        Ipv4InterfaceAddress iaddr = ipv4->GetAddress(1, 0);
        Ipv4Address addr = iaddr.GetLocal();
        NS_LOG_INFO("Node " << i << " has IP address " << addr);
    }

    Simulator::Run();
    Simulator::Destroy();

    return 0;
} 



How to solve such errors?
zain avatar
ch flag
No Ubunto 22.04 LTS
zain avatar
ch flag
Can you help me or no? In solving the errors.
hr flag
AFAIK Ubuntu 22.04 provides libs3-dev version 3.35, so presumably you installed 3.38 by some other means. At least in 3.35, the standards (in wifi-standards.h) use *lower case* a/b/g/n suffixes ex. `WIFI_PHY_STANDARD_80211n`.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.