zoukankan      html  css  js  c++  java
  • possible for Wifi Adhoc using 802.11n with OFDM ?

    https://groups.google.com/forum/#!msg/ns-3-users/-5onD0T4OUc/RNOILM2SwmgJ

    Riyanto Jayadi

    13/10/31

    将帖子翻译为中文  

    Dear all,

    I would like to know, is it possible to have scenario with Wifi Adhoc using 802.11n with OFDM datarate 135Mbps BW 40Hz  ?

    I have code below for this scenario, but it is always failed with status : "Can't find response rate for OfdmRate135MbpsBW40MHz. Check standard and selected rates match.", file=../src/wifi/model/wifi-remote-station-manager.cc, line=980

    terminate called without an active exception

    any sugestion ?

    Best,

    Riyanto Jayadi.

    CODE using NS3.18:

    #include "ns3/core-module.h"

    #include "ns3/network-module.h"

    #include "ns3/mobility-module.h"

    #include "ns3/config-store-module.h"

    #include "ns3/wifi-module.h"

    #include "ns3/internet-module.h"

    #include <iostream>

    #include <fstream>

    #include <vector>

    #include <string>

    NS_LOG_COMPONENT_DEFINE ("WifiSimpleAdhoc");

    using namespace ns3;

    void ReceivePacket (Ptr<Socket> socket)

    {

      NS_LOG_UNCOND ("Received one packet!");

    }

    static void GenerateTraffic (Ptr<Socket> socket, uint32_t pktSize, 

                                 uint32_t pktCount, Time pktInterval )

    {

      if (pktCount > 0)

        {

          socket->Send (Create<Packet> (pktSize));

          Simulator::Schedule (pktInterval, &GenerateTraffic, 

                               socket, pktSize,pktCount-1, pktInterval);

        }

      else

        {

          socket->Close ();

        }

    }

    int main (int argc, char *argv[])

    {

    WifiHelper wifi;

    wifi.SetStandard (WIFI_PHY_STANDARD_80211n_2_4GHZ);

    std::string phyMode ("OfdmRate135MbpsBW40MHz");

    double rss = 0;  // -dBm

    uint32_t packetSize = 1000; // bytes

    uint32_t numPackets = 100;

    double interval = 0.00001; // seconds

    Time interPacketInterval = Seconds (interval);

    Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200"));

    Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("2200"));

    Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode",

      StringValue (phyMode));

    NodeContainer c;

    c.Create (2);

    YansWifiPhyHelper wifiPhy =  YansWifiPhyHelper::Default ();

    wifiPhy.Set ("RxGain", DoubleValue (0) );

    YansWifiChannelHelper wifiChannel;

    wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");

    wifiChannel.AddPropagationLoss ("ns3::FixedRssLossModel","Rss",DoubleValue (rss));

    wifiPhy.SetChannel (wifiChannel.Create ());

    NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();

    wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",

    "DataMode",StringValue (phyMode),

    "ControlMode",StringValue (phyMode));

    wifiMac.SetType ("ns3::AdhocWifiMac");

    NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c);

    MobilityHelper mobility;

    Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();

    positionAlloc->Add (Vector (0.0, 0.0, 0.0));

    positionAlloc->Add (Vector (5.0, 0.0, 0.0));

    mobility.SetPositionAllocator (positionAlloc);

    mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");

    mobility.Install (c);

    InternetStackHelper internet;

    internet.Install (c);

    Ipv4AddressHelper ipv4;

    NS_LOG_INFO ("Assign IP Addresses.");

    ipv4.SetBase ("10.1.1.0", "255.255.255.0");

    Ipv4InterfaceContainer i = ipv4.Assign (devices);

    TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");

    Ptr<Socket> recvSink = Socket::CreateSocket (c.Get (0), tid);

    InetSocketAddress local = InetSocketAddress (Ipv4Address::GetAny (), 80);

    recvSink->Bind (local);

    recvSink->SetRecvCallback (MakeCallback (&ReceivePacket));

    Ptr<Socket> source = Socket::CreateSocket (c.Get (1), tid);

    InetSocketAddress remote = InetSocketAddress (i.GetAddress(0), 80);

    source->SetAllowBroadcast (true);

    source->Connect (remote);

    // Tracing

    wifiPhy.EnablePcap ("wifi-simple-adhoc", devices);

    Simulator::ScheduleWithContext (source->GetNode ()->GetId (),

      Seconds (0.0001), &GenerateTraffic,

      source, packetSize, numPackets, interPacketInterval);

    Simulator::Run ();

    Simulator::Destroy ();

    return 0;

    }

    Konstantinos

    13/11/1

    Hi,

    Please read the documentation and what the output of the compiler says.

    I haven't used the 11n to begin with, but this is what I see in the docs.

    In the yans-wifi-phy.cc that for the HT the supported rates/BW are as follows


    supportedmodes.push_back (WifiPhy::GetOfdmRate6_5MbpsBW20MHz ()); 
    supportedmodes.push_back (WifiPhy::GetOfdmRate13MbpsBW20MHz ()); 
    supportedmodes.push_back (WifiPhy::GetOfdmRate19_5MbpsBW20MHz ()); 
    supportedmodes.push_back (WifiPhy::GetOfdmRate26MbpsBW20MHz ()); 

    supportedmodes.push_back (WifiPhy::GetOfdmRate39MbpsBW20MHz ()); 
    supportedmodes.push_back (WifiPhy::GetOfdmRate52MbpsBW20MHz ()); 
    supportedmodes.push_back (WifiPhy::GetOfdmRate58_5MbpsBW20MHz ()); 
    supportedmodes.push_back (WifiPhy::GetOfdmRate65MbpsBW20MHz ());

    Further down there is this:

       if (mode.GetUniqueName() == "OfdmRate135MbpsBW40MHzShGi" || mode.GetUniqueName() == "OfdmRate65MbpsBW20MHzShGi" )

    So, try to update the mode to OfdmRate135MbpsBW40MHzShGi

    - 显示引用文字 -

    Riyanto Jayadi

    13/11/1

    将帖子翻译为中文  

    Hi Konstantinos,

    Thank you for replying. I used your suggest and it failed (errors message below). NS3 cannot find WifiMode named "OfdmRate135MbpsBW40MHzShGi".

    Error message :

    ----------------------------------------

    Could not find match for WifiMode named "OfdmRate135MbpsBW40MHzShGi". Valid options are:

      Invalid-WifiMode

      DsssRate1Mbps

      DsssRate2Mbps

      DsssRate5_5Mbps

      DsssRate11Mbps

      ErpOfdmRate6Mbps

      ErpOfdmRate9Mbps

      ErpOfdmRate12Mbps

      ErpOfdmRate18Mbps

      ErpOfdmRate24Mbps

      ErpOfdmRate36Mbps

      ErpOfdmRate48Mbps

      ErpOfdmRate54Mbps

      OfdmRate6Mbps

      OfdmRate9Mbps

      OfdmRate12Mbps

      OfdmRate18Mbps

      OfdmRate24Mbps

      OfdmRate36Mbps

      OfdmRate48Mbps

      OfdmRate54Mbps

      OfdmRate3MbpsBW10MHz

      OfdmRate4_5MbpsBW10MHz

      OfdmRate6MbpsBW10MHz

      OfdmRate9MbpsBW10MHz

      OfdmRate12MbpsBW10MHz

      OfdmRate18MbpsBW10MHz

      OfdmRate24MbpsBW10MHz

      OfdmRate27MbpsBW10MHz

      OfdmRate1_5MbpsBW5MHz

      OfdmRate2_25MbpsBW5MHz

      OfdmRate3MbpsBW5MHz

      OfdmRate4_5MbpsBW5MHz

      OfdmRate6MbpsBW5MHz

      OfdmRate9MbpsBW5MHz

      OfdmRate12MbpsBW5MHz

      OfdmRate13_5MbpsBW5MHz

      OfdmRate6_5MbpsBW20MHz

      OfdmRate13MbpsBW20MHz

      OfdmRate19_5MbpsBW20MHz

      OfdmRate26MbpsBW20MHz

      OfdmRate39MbpsBW20MHz

      OfdmRate52MbpsBW20MHz

      OfdmRate58_5MbpsBW20MHz

      OfdmRate65MbpsBW20MHz

      OfdmRate13_5MbpsBW40MHz

      OfdmRate27MbpsBW40MHz

      OfdmRate40_5MbpsBW40MHz

      OfdmRate54MbpsBW40MHz

      OfdmRate81MbpsBW40MHz

      OfdmRate108MbpsBW40MHz

      OfdmRate121_5MbpsBW40MHz

      OfdmRate135MbpsBW40MHz

      OfdmRate7_2MbpsBW20MHz

      OfdmRate14_4MbpsBW20MHz

      OfdmRate21_7MbpsBW20MHz

      OfdmRate28_9MbpsBW20MHz

      OfdmRate43_3MbpsBW20MHz

      OfdmRate57_8MbpsBW20MHz

      OfdmRate65MbpsBW20MHzShGi

      OfdmRate72_2MbpsBW20MHz

    msg="", file=../src/wifi/model/wifi-mode.cc, line=203

    terminate called without an active exception

    ​--------------------------------------------------------------------

    But, thank you for your sugesstion to look for documentation, I gonna trace yans-wifi-phy.cc to check how to activate 802.11n with highest 135Mbps in Ad-Hoc scenario now. I am using "Adhoc" scenario in 802.11n, I already tried all datarate available and I only able to use DsssRate*Mbps and   ErpOfdmRate*Mbps. I failed to use  OfdmRate* with error status : "Can't find response rate.....

    Best,

    Riyanto Jayadi

    Diego Romero

    13/11/3

    将帖子翻译为中文  

    I have another problem. when I use:

       wifi.SetStandard (WIFI_PHY_STANDARD_80211n_2_4GHZ);

    or

       wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);

    then I have no traffic (throughput = 0 )!!!!

    I'm also using 

    wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", StringValue("OfdmRate54Mbps")); 

    or 

    Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode", StringValue ("OfdmRate54Mbps"));


    Any help?
    Thanks!
    Diego.

    - 显示引用文字 -

    Riyanto Jayadi

    13/11/4

    将帖子翻译为中文  

    Hi Diego,

    I think it's not because wifi phy setting, instead it is because application setting. Maybe you can paste all your code and ns3 version here!

    Best,

    Hoi

    - 显示引用文字 -

    - 显示引用文字 -

    -- 

    You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
    To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/-5onD0T4OUc/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
    To post to this group, send email to ns-3-...@googlegroups.com.
    Visit this group at http://groups.google.com/group/ns-3-users.
    For more options, visit https://groups.google.com/groups/opt_out.

    Riyanto Jayadi

    13/11/4

    将帖子翻译为中文  

    Dear all,

    I found reason why my code fail to use high throughput mac (you can see my code at thread starting).

    It is because mac layer implement NqosWifiMacHelper instead of HtWifiMacHelper. HtWifiMacHelper is for HT-enabled MAC layers.

    Wrong code : 

    NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();

    Right code :

    HtWifiMacHelper wifiMac = HtWifiMacHelper::Default ();

    So, it is possible for Wifi Adhoc using 802.11n with OFDM in NS3

    Thank you,

    Riyanto Jayadi

    - 显示引用文字 -

    Diego Romero

    13/11/5

    Riyanto,

    But what if you need qos with 802.11n. May you use QosWifiMacHelper wifiMac = QosWifiMacHelper::Default ();

    or 

    HtWifiMacHelper wifiMac = HtWifiMacHelper::Default ();

    Thk you!

    - 显示引用文字 -

    Riyanto Jayadi

    13/11/5

    将帖子翻译为中文  

    Diego,

    QosWifiMacHelper cannot be use for high throughput datarate like OfdmRate135MbpsBW40MHz.

    But, HtWifiMacHelper is inheritance of QosWifiMacHelper, so you able to use QOS with HtWifiMacHelper. 

    Thank you.


    On Tuesday, November 5, 2013 1:15:43 AM UTC+8, Diego Romero wrote:

    Riyanto, But what if you need qos with 802.11n. May you use QosWifiMacHelper wifiMac = QosWifiMacHelper::Default ();

    or 

    HtWifiMacHelper wifiMac = HtWifiMacHelper::Default ();

    Thk you!


    El lunes, 4 de noviembre de 2013 12:50:19 UTC-2, Riyanto Jayadi escribió:

    Larissa Marinho Eglem de Oliveira

    13/11/5

    将帖子翻译为中文  

    Can I use it with NqosWifiMacHelper? I don't wish to use OFDM.

    Best regards,

    Larissa.

    Enviado via iPad

    - 显示引用文字 -

    - 显示引用文字 -

    -- 
    You received this message because you are subscribed to the Google Groups "ns-3-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.


    To post to this group, send email to ns-3-...@googlegroups.com.
    Visit this group at http://groups.google.com/group/ns-3-users.
    For more options, visit https://groups.google.com/groups/opt_out.

    Riyanto Jayadi

    13/11/5

    将帖子翻译为中文  

    Based on my experiment with NS3.18. Yes, you can use NqosWifiMacHelper on 802.11n, but only with using datarate ERPOFDMRATE... and DSSRATE... in NS3.18But ERPOFDM teoritically only for 802.11g, is it a bug ?

    On Tue, Nov 5, 2013 at 8:07 PM, Larissa Eglem <eglem...@gmail.com> wrote:

    Can I use it with NqosWifiMacHelper? I don't wish to use OFDM.

    Best regards,

    Larissa.
     

    Larissa Marinho Eglem de Oliveira

    13/11/6

    将帖子翻译为中文  

    Thank you!

    I really needed to use DSSRATE. I'm not sure about ERPFDMRATE though.

    Best regards,

    Larissa Eglem.

    Enviado via iPad

    - 显示引用文字 -

    - 显示引用文字 -

    -- 
    You received this message because you are subscribed to the Google Groups "ns-3-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
    To post to this group, send email to ns-3-...@googlegroups.com.
    Visit this group at http://groups.google.com/group/ns-3-users.
    For more options, visit https://groups.google.com/groups/opt_out.

    Diego Romero

    13/11/7

    Dear Riyanto,

    This is a bit of my code:

    NodeContainer wifiApNode;

      wifiApNode.Create(1);

      NodeContainer wifiStaNodes;

      wifiStaNodes.Create (nWifi);

      

      YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();

      YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();

      phy.SetChannel (channel.Create ());

      WifiHelper wifi = WifiHelper::Default ();

            wifi.SetStandard (WIFI_PHY_STANDARD_80211n_2_4GHZ);

    wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", StringValue("OfdmRate24Mbps")); 

    I'm using QoS-Mac-Helper. The issue is that when I set the Phy Standard to 80211a/b or g, I get certain throughput (flowmon output), but when I switch to 80211n I get Throughput=0 !!!, and Delay= NaN (from flowmon output).

    Why could this be happening?

    My doubt is that I see the flag Ht-enabled set to False into the configuration, but I don't know if that has to do or not!!

    Any help?

    Thanks!

    Diego.

    - 显示引用文字 -

    Larissa Marinho Eglem de Oliveira

    13/11/8

    将帖子翻译为中文  

    I'm having the same problem, but I'm using NqosWifiMacHelper.

    I'm also using FlowMonitor ...

    Best regards,

    Larissa Eglem.

    Enviado via iPad

    - 显示引用文字 -

    - 显示引用文字 -

    -- 
    You received this message because you are subscribed to the Google Groups "ns-3-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
    To post to this group, send email to ns-3-...@googlegroups.com.
    Visit this group at http://groups.google.com/group/ns-3-users.
    For more options, visit https://groups.google.com/groups/opt_out.

    Riyanto Jayadi

    13/11/10

    将帖子翻译为中文  

    Dear Diego & Larrisa,

    When I try your scenarion, it give me "Can't find response rate for........" and simulation won't start. It is not like you, simulation started but no Throughput.

    Could you give your full code ? And what version NS3 ?

    Or is it already solved ?

    - 显示引用文字 -

    Larissa Marinho Eglem de Oliveira

    13/11/14

    将帖子翻译为中文  

    Dear Riyanto,

    I'm still not able to run 802.11n in ad hoc mode, I'm also getting no throughput through flowmonitor. Here is a my code as asked:

    // enable RTS/CTS

    UintegerValue ctsThr = 100; //original value:500

    Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", ctsThr);

    //non-unicast rate equal to unicast rate

    Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode", StringValue(phyMode));

    /*Desabilitar fragmentação para quadros menores que 2200 bytes*/

    Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200"));

    NS_LOG_INFO ("Create Nodes.");

    NodeContainer nodes;

    nodes.Create(quantNo);

    WifiHelper wifi;

    if(verbose)

    {

    wifi.EnableLogComponents(); //enables wifi log components

    }

    wifi.SetStandard (WIFI_PHY_STANDARD_80211n_2_4GHZ);

    YansWifiPhyHelper wifiPhy =  YansWifiPhyHelper::Default ();

    wifiPhy.SetPcapDataLinkType (YansWifiPhyHelper::DLT_IEEE802_11_RADIO); // ns-3 supports RadioTap and Prism tracing extensions for 802.11b

    //wifiPhy.Set ("TxGain", DoubleValue (0) ); // set it to zero; otherwise, gain will be added

    wifiPhy.Set ("RxGain", DoubleValue (0) ); // set it to zero; otherwise, gain will be added

    wifiPhy.Set ("TxPowerStart", DoubleValue(10)); /*changes default TxPower from 16.0206dBm to 10dBm  */

           wifiPhy.Set ("TxPowerEnd", DoubleValue(10));  /*changes default TxPower from 16.0206dBm to 10dBm */

    /*--------------Energy Threshold and Cca Threshold Configuration------------------------------------------------------------------*/

        wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue(-76.36232)); //dmax = 150m

        wifiPhy.Set ("CcaMode1Threshold", DoubleValue(-81.35987)); //dmax=200m

        /*-----------------------------------------------------------------------------------------------*/

    wifiPhy.Set("ChannelNumber",UintegerValue(1)); //main interface channel number

    YansWifiChannelHelper wifiChannel;

    wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");

    //Chooses between TwoRays and Friis Models

    if(!useTwoRay)

    {

        wifiChannel.AddPropagationLoss ("ns3::FriisPropagationLossModel","Frequency", DoubleValue (2.40e9));

    }

    else

    {

        wifiChannel.AddPropagationLoss ("ns3::TwoRayGroundPropagationLossModel","Frequency", DoubleValue (2.40e9));

    }

    //Rician Fading

    double m;

    m = (pow((k+1),2)) / (2*k+1); // fórmula apresentada no livro "Wireless Communications" (Molisch)

    wifiChannel.AddPropagationLoss ("ns3::NakagamiPropagationLossModel","m0", DoubleValue (m),"m1", DoubleValue (m),"m2", DoubleValue (m));

    wifiPhy.SetChannel (wifiChannel.Create ());

    // Add a non-QoS upper mac, and disable rate control

    NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();

    wifi.SetStandard (WIFI_PHY_STANDARD_80211n_2_4GHZ);

    wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",

                                  "DataMode",StringValue (phyMode),

                                  "ControlMode",StringValue (phyMode));

    // Set it to adhoc mode

    wifiMac.SetType ("ns3::AdhocWifiMac");

    NetDeviceContainer devices = wifi.Install(wifiPhy,wifiMac,nodes);

    //Mobility model

    MobilityHelper mobility;

    Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>(); /*Allocate positions from a deterministic

                                                                                        list specified by the user */

    //reads node's position from file

    for(int i=0;i<quantNo;i++)

    {

    int no;

    fscanf(top,"%d %lf %lf",&no,&px,&py);

    positionAlloc->Add(Vector(px,py,1.04)); //=> dcross for TwoRay = 109.277m

    }

    mobility.SetPositionAllocator(positionAlloc);

    mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");

    mobility.Install(nodes);

    // TCP/IP configuration

    InternetStackHelper internet;

    internet.Install(nodes);

    Ipv4AddressHelper ipv4;

    NS_LOG_INFO("Assign IP Addresses");

    ipv4.SetBase("10.1.2.0","255.255.255.0");

    Ipv4InterfaceContainer interface = ipv4.Assign(devices);

    //Applications

    float tempo = 0.01;

    for(int i=0; i<=quantEnlace; i++) //só fica aqui até a quantidade de enlaces

    {

    int from,to;

    fscanf(top,"%d %d",&from,&to);

    PacketSinkHelper sink("ns3::UdpSocketFactory", InetSocketAddress(interface.GetAddress(to),80));

    ApplicationContainer sinkApp = sink.Install(nodes.Get(to));

    sinkApp.Start(Seconds(tempo));

    sinkApp.Stop(Seconds(60.0));

    //install on-off application on main interface

    //MyOnOffHelper onOff("ns3::UdpSocketFactory", InetSocketAddress(interface.GetAddress(from),80));

    OnOffHelper onOff("ns3::UdpSocketFactory", InetSocketAddress(interface.GetAddress(from),80));

    onOff.SetAttribute("OnTime",StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"));

    onOff.SetAttribute("OffTime",StringValue ("ns3::ConstantRandomVariable[Constant=0.0]"));

    onOff.SetAttribute("PacketSize",UintegerValue(packetSize));

    onOff.SetAttribute("Remote",AddressValue(InetSocketAddress(interface.GetAddress(to),80)));

    ApplicationContainer udpApp = onOff.Install(nodes.Get(from));

    udpApp.Start(Seconds(tempo));

    udpApp.Stop(Seconds(60.0));

    tempo+=0.2;

    }

    //Enables the creation of packet tracking files

    AsciiTraceHelper ascii;

    wifiPhy.EnableAsciiAll(ascii.CreateFileStream("tracing/ascii/802.11n.tr"));

    //Tracks the received packets in the chosen terminal

    //Config::Connect("/NodeList/0/DeviceList/*/Phy/State/RxOk",MakeCallback(&PhyRxOkTrace));

    //PCAP files

        //wifiPhy.EnablePcap("/tracing/pcap/802.11n",devices);

       

    FlowMonitorHelper flowmon;

    Ptr<FlowMonitor> monitor = flowmon.InstallAll ();

    uint64_t rxBytesByNode[quantNo];

    int64x64_t delayMeanByNode[quantNo];

    for(int i=0; i<quantNo; i++){

    rxBytesByNode[i] = 0;

    delayMeanByNode[i] = 0;

        }

    //run simulation for 60.1 seconds

    Simulator::Stop(Seconds(60.1));

    Simulator::Run();

     //Flow Monitor Code from wifi-hidden-terminal.cc

     //Print per flow statistics

      double throughput;

      int64x64_t delay;

      monitor->CheckForLostPackets ();

      Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier> (flowmon.GetClassifier ());

      std::map<FlowId, FlowMonitor::FlowStats> stats = monitor->GetFlowStats ();

      for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator i = stats.begin (); i != stats.end (); ++i)

        {

              Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow (i->first);

              //aggregate throughput and aggregate delay

              throughput += i->second.rxBytes* 8.0 / 60.1 / 1024 / 1024; /* multipled by 8 to turn to bits, devided by 60.1 because of the time of the

                                                                           the simulation and divided twice for 1024 to give Mega bits */

              //single node throughput

              uint8_t addr[4];

              t.destinationAddress.Serialize (addr);

              int nodeid = addr[3]+0;

              rxBytesByNode[nodeid] += i->second.rxBytes;

              if (i->second.rxPackets != 0) delayMeanByNode[nodeid] += (i->second.delaySum / (i->second.rxPackets));

                  //---------------------Cmd output-----------------------------------------------------------------------//

              std::cout << "Flow " << i->first  << " (" << t.sourceAddress << " -> " << t.destinationAddress << ") ";

              std::cout << "  Tx Bytes:   " << i->second.txBytes << " ";

              std::cout << "  Rx Bytes:   " << i->second.rxBytes << " ";

              std::cout << "  Throughput: " << i->second.rxBytes * 8.0 / 10.0 / 1024 / 1024  << " Mbps ";

        }

    Simulator::Destroy();

        std::cout<<"Aggregate Throughput: "<<throughput<<"Mbps ";

    I hope we'll be able to shade some light on this matter.

    Thank you!

    Best regards,

    Larissa.



    2013/11/9 Riyanto Jayadi <riyanto...@gmail.com>

    - 显示引用文字 -

     

    -- 
    You received this message because you are subscribed to the Google Groups "ns-3-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
    To post to this group, send email to ns-3-...@googlegroups.com.
    Visit this group at http://groups.google.com/group/ns-3-users.
    For more options, visit https://groups.google.com/groups/opt_out.

    Riyanto Jayadi

    13/11/14

    将帖子翻译为中文  

    Dear Larisa,

    Something wrong on :

         OnOffHelper onOff("ns3::UdpSocketFactory", InetSocketAddress(interface.GetAddress(from),80));

    it should be 

         OnOffHelper onOff("ns3::UdpSocketFactory", InetSocketAddress(interface.GetAddress(to),80));

    Check documentation http://www.nsnam.org/docs/release/3.18/doxygen/classns3_1_1_on_off_helper.html :

    ns3::OnOffHelper::OnOffHelper (std::string  protocol, Address  address )

    address : the address of the remote node to send traffic to.

    and then  maybe disable this :

       wifiPhy.SetPcapDataLinkType (YansWifiPhyHelper::DLT_IEEE802_11_RADIO); // ns-3 supports RadioTap and Prism tracing extensions for 802.11b

    since it is for 802.11b

    Sometime you could try using another application try like UdpClientHelper or other  instead just OnOffApplication

    Riyanto Jayadi

    此帖已被删除。

    Larissa Marinho Eglem de Oliveira

    13/11/28

    将帖子翻译为中文  

    Dear Riyanto, 

    After I changed the application setting, I did got some throughput, but when I checked, the nodes were sending packets to themselves.

    The OnOff application configuration is the one I have been using before, when I was running  ns-3.13 for an IEEE 802.11b ad hoc network (and it works!).

    I think I'm not understanding how 802.11n is supposed to work in ns-3.

    I'm getting pretty lost here. 

    What I want is A-MSDU aggregation in an ad-hoc mode. I want two to send two packets as an A-MSDU.

    Using WIFI_PHY_STANDARD_80211n_2_4GHZ I see no frame aggregation or throughput. 

    When I turn on the Logging from YansWifiPhy (DEBUG_LEVEL), I get the packet dropped message due to signal power too low.

    I really can't understand why it doesn't work, even when I let all the transmission power arguments set to the default.

    Have you been able to run a scenario with A-MSDU aggregation on a NonQos Ad Hoc mode?

    I would really appreciate any help!

    Best regards,

    Larissa.

    - 显示引用文字 -

    2 条帖子已被删除。

    Naveen Sheoran

    15/7/17

    其他收件人: eglem...@gmail.com

    将帖子翻译为中文  

    Hello Larissa
       I am NAVEEN and very new to this ns3. I am seeking your suggestion and help in creating a scenario .would like to establish the adhoc networking between the nodes in 3D which behave like the UAV. for that i also would like to use the MAC layer 802.11n. please suggest me how I can implement this MAC layer protocol

    Regards
    NAVEEN

    - 显示引用文字 -

    Sebastien Deronne

    15/7/17

    将帖子翻译为中文  


    Naveen,
    Just for your information, the 802.11n MAC layer is already supported.

    Naveen Sheoran

    15/7/18

    将帖子翻译为中文  

    hello sir ,
    Yes Sir , I know but how I can use this in my programs ? how I can implement this ? will it be suitable according to the scenario what I discussed below ?
    Regards
    NAVEEN



    On Friday, July 17, 2015 at 6:19:23 PM UTC+5:30, Sebastien Deronne wrote:


    Naveen,
    Just for your information, the 802.11n MAC layer is already supported.

    Naveen Sheoran

    15/7/18

    其他收件人: eglem...@gmail.com

    将帖子翻译为中文  

    Dear Larissa

    I am new to this ns3. I used your this concept in implementing the 802.11n .can you please make me aware that what is this quantEnlac and what is it's value and the value of some other variable like rxBytesBynode and delayMeanByNode and the value of variable K which u used in this code so that i can easily understand the concept.I will be very thankful to you .



    Regards
    NAVEEN  

    On Thursday, November 14, 2013 at 2:43:56 AM UTC+5:30, Larissa Marinho Eglem de Oliveira wrote:

    - 隐藏引用文字 -

    Dear Riyanto,

    I'm still not able to run 802.11n in ad hoc mode, I'm also getting no throughput through flowmonitor. Here is a my code as asked:

    // enable RTS/CTS

    UintegerValue ctsThr = 100; //original value:500

    Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", ctsThr);

    //non-unicast rate equal to unicast rate

    Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode", StringValue(phyMode));

    /*Desabilitar fragmentação para quadros menores que 2200 bytes*/

    Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200"));

    NS_LOG_INFO ("Create Nodes.");

    NodeContainer nodes;

    nodes.Create(quantNo);

    WifiHelper wifi;

    if(verbose)

    {

    wifi.EnableLogComponents(); //enables wifi log components

    }

    wifi.SetStandard (WIFI_PHY_STANDARD_80211n_2_4GHZ);

    YansWifiPhyHelper wifiPhy =  YansWifiPhyHelper::Default ();

    wifiPhy.SetPcapDataLinkType (YansWifiPhyHelper::DLT_IEEE802_11_RADIO); // ns-3 supports RadioTap and Prism tracing extensions for 802.11b

    //wifiPhy.Set ("TxGain", DoubleValue (0) ); // set it to zero; otherwise, gain will be added

    wifiPhy.Set ("RxGain", DoubleValue (0) ); // set it to zero; otherwise, gain will be added

    wifiPhy.Set ("TxPowerStart", DoubleValue(10)); /*changes default TxPower from 16.0206dBm to 10dBm  */

           wifiPhy.Set ("TxPowerEnd", DoubleValue(10));  /*changes default TxPower from 16.0206dBm to 10dBm */

    /*--------------Energy Threshold and Cca Threshold Configuration------------------------------------------------------------------*/

        wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue(-76.36232)); //dmax = 150m

        wifiPhy.Set ("CcaMode1Threshold", DoubleValue(-81.35987)); //dmax=200m

        /*-----------------------------------------------------------------------------------------------*/

    wifiPhy.Set("ChannelNumber",UintegerValue(1)); //main interface channel number

    YansWifiChannelHelper wifiChannel;

    wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");

    //Chooses between TwoRays and Friis Models

    if(!useTwoRay)

    {

        wifiChannel.AddPropagationLoss ("ns3::FriisPropagationLossModel","Frequency", DoubleValue (2.40e9));

    }

    else

    {

        wifiChannel.AddPropagationLoss ("ns3::TwoRayGroundPropagationLossModel","Frequency", DoubleValue (2.40e9));

    }

    //Rician Fading

    double m;

    m = (pow((k+1),2)) / (2*k+1); // fórmula apresentada no livro "Wireless Communications" (Molisch)

    wifiChannel.AddPropagationLoss ("ns3::NakagamiPropagationLossModel","m0", DoubleValue (m),"m1", DoubleValue (m),"m2", DoubleValue (m));

    wifiPhy.SetChannel (wifiChannel.Create ());

    // Add a non-QoS upper mac, and disable rate control

    NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();

    wifi.SetStandard (WIFI_PHY_STANDARD_80211n_2_4GHZ);

    wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",

                                  "DataMode",StringValue (phyMode),

                                  "ControlMode",StringValue (phyMode));

    // Set it to adhoc mode

    wifiMac.SetType ("ns3::AdhocWifiMac");

    NetDeviceContainer devices = wifi.Install(wifiPhy,wifiMac,nodes);

    //Mobility model

    MobilityHelper mobility;

    Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>(); /*Allocate positions from a deterministic

                                                                                        list specified by the user */

    //reads node's position from file

    for(int i=0;i<quantNo;i++)

    {

    int no;

    fscanf(top,"%d %lf %lf",&no,&px,&py);

    positionAlloc->Add(Vector(px,py,1.04)); //=> dcross for TwoRay = 109.277m

    }

    mobility.SetPositionAllocator(positionAlloc);

    mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");

    mobility.Install(nodes);

    // TCP/IP configuration

    InternetStackHelper internet;

    internet.Install(nodes);

    Ipv4AddressHelper ipv4;

    NS_LOG_INFO("Assign IP Addresses");

    ipv4.SetBase("10.1.2.0","255.255.255.0");

    Ipv4InterfaceContainer interface = ipv4.Assign(devices);

    //Applications

    float tempo = 0.01;

    for(int i=0; i<=quantEnlace; i++) //só fica aqui até a quantidade de enlaces

    {

    int from,to;

    fscanf(top,"%d %d",&from,&to);

    PacketSinkHelper sink("ns3::UdpSocketFactory", InetSocketAddress(interface.GetAddress(to),80));

    ApplicationContainer sinkApp = sink.Install(nodes.Get(to));

    sinkApp.Start(Seconds(tempo));

    sinkApp.Stop(Seconds(60.0));

    //install on-off application on main interface

    //MyOnOffHelper onOff("ns3::UdpSocketFactory", InetSocketAddress(interface.GetAddress(from),80));

    OnOffHelper onOff("ns3::UdpSocketFactory", InetSocketAddress(interface.GetAddress(from),80));

    onOff.SetAttribute("OnTime",StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"));

    onOff.SetAttribute("OffTime",StringValue ("ns3::ConstantRandomVariable[Constant=0.0]"));

    onOff.SetAttribute("PacketSize",UintegerValue(packetSize));

    onOff.SetAttribute("Remote",AddressValue(InetSocketAddress(interface.GetAddress(to),80)));

    ApplicationContainer udpApp = onOff.Install(nodes.Get(from));

    udpApp.Start(Seconds(tempo));

    udpApp.Stop(Seconds(60.0));

    tempo+=0.2;

    }

    //Enables the creation of packet tracking files

    AsciiTraceHelper ascii;

    wifiPhy.EnableAsciiAll(ascii.CreateFileStream("tracing/ascii/802.11n.tr"));

    //Tracks the received packets in the chosen terminal

    //Config::Connect("/NodeList/0/DeviceList/*/Phy/State/RxOk",MakeCallback(&PhyRxOkTrace));

    //PCAP files

        //wifiPhy.EnablePcap("/tracing/pcap/802.11n",devices);

       

    FlowMonitorHelper flowmon;

    Ptr<FlowMonitor> monitor = flowmon.InstallAll ();

    uint64_t rxBytesByNode[quantNo];

    int64x64_t delayMeanByNode[quantNo];

    for(int i=0; i<quantNo; i++){

    rxBytesByNode[i] = 0;

    delayMeanByNode[i] = 0;

        }

    //run simulation for 60.1 seconds

    Simulator::Stop(Seconds(60.1));

    Simulator::Run();

     //Flow Monitor Code from wifi-hidden-terminal.cc

     //Print per flow statistics

      double throughput;

      int64x64_t delay;

      monitor->CheckForLostPackets ();

      Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier> (flowmon.GetClassifier ());

      std::map<FlowId, FlowMonitor::FlowStats> stats = monitor->GetFlowStats ();

      for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator i = stats.begin (); i != stats.end (); ++i)

        {

              Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow (i->first);

              //aggregate throughput and aggregate delay

              throughput += i->second.rxBytes* 8.0 / 60.1 / 1024 / 1024; /* multipled by 8 to turn to bits, devided by 60.1 because of the time of the

                                                                           the simulation and divided twice for 1024 to give Mega bits */

              //single node throughput

              uint8_t addr[4];

              t.destinationAddress.Serialize (addr);

              int nodeid = addr[3]+0;

              rxBytesByNode[nodeid] += i->second.rxBytes;

              if (i->second.rxPackets != 0) delayMeanByNode[nodeid] += (i->second.delaySum / (i->second.rxPackets));

                  //---------------------Cmd output-----------------------------------------------------------------------//

              std::cout << "Flow " << i->first  << " (" << t.sourceAddress << " -> " << t.destinationAddress << ") ";

              std::cout << "  Tx Bytes:   " << i->second.txBytes << " ";

              std::cout << "  Rx Bytes:   " << i->second.rxBytes << " ";

              std::cout << "  Throughput: " << i->second.rxBytes * 8.0 / 10.0 / 1024 / 1024  << " Mbps ";

        }

    Simulator::Destroy();

        std::cout<<"Aggregate Throughput: "<<throughput<<"Mbps ";

    I hope we'll be able to shade some light on this matter.

    Thank you!

    Best regards,

    Larissa.



    2013/11/9 Riyanto Jayadi <riyanto...@gmail.com>
    Dear Diego & Larrisa,

    When I try your scenarion, it give me "Can't find response rate for........" and simulation won't start. It is not like you, simulation started but no Throughput.

    Could you give your full code ? And what version NS3 ?

    Or is it already solved ?


    On Friday, November 8, 2013 6:23:02 AM UTC+8, Larissa Eglem wrote:

    I'm having the same problem, but I'm using NqosWifiMacHelper.

    I'm also using FlowMonitor ...

    Best regards,

    Larissa Eglem.

    Enviado via iPad


    Em 07/11/2013, às 11:49, Diego Romero <drome...@gmail.com> escreveu:
     

    Dear Riyanto,

    This is a bit of my code:

    NodeContainer wifiApNode;

      wifiApNode.Create(1);

      NodeContainer wifiStaNodes;

      wifiStaNodes.Create (nWifi);

      

      YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();

      YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();

      phy.SetChannel (channel.Create ());

      WifiHelper wifi = WifiHelper::Default ();

            wifi.SetStandard (WIFI_PHY_STANDARD_80211n_2_4GHZ);

    wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", StringValue("OfdmRate24Mbps")); 

    I'm using QoS-Mac-Helper. The issue is that when I set the Phy Standard to 80211a/b or g, I get certain throughput (flowmon output), but when I switch to 80211n I get Throughput=0 !!!, and Delay= NaN (from flowmon output).

    Why could this be happening?

    My doubt is that I see the flag Ht-enabled set to False into the configuration, but I don't know if that has to do or not!!

    Any help?

    Thanks!

    Diego.

     

    -- 
    You received this message because you are subscribed to the Google Groups "ns-3-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
    To post to this group, send email to ns-3-...@googlegroups.com.
    Visit this group at http://groups.google.com/group/ns-3-users.
    For more options, visit https://groups.google.com/groups/opt_out.
  • 相关阅读:
    js去前后空格
    IE7以上支持Fiddler 监听本地
    IE8 scriptX print 无法使用的bug
    那些相见恨晚的 JavaScript 技巧
    oracle sql
    JS人民币金额转大写程序
    div自适应高度
    .NET Remoting 使用最佳实践,(部分翻译)
    对DataTable 进行Distinct操作
    用财富的眼光看知识管理
  • 原文地址:https://www.cnblogs.com/ztguang/p/12644342.html
Copyright © 2011-2022 走看看