Enable RTS/CTS?

3,800 views
Skip to first unread message

Larissa Eglem

unread,
Oct 29, 2012, 1:20:28 PM10/29/12
to ns-3-...@googlegroups.com
Hi all,

I'm trying to set a ad-hoc network that uses RTS/CTS. I configured my script as follows:

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

But I believe the RTS/CTS is not being exchanged.

While enabling all log levels from ns3::MacLow I get this line (partial):

1.026s [mac=00:00:00:00:00:02] MacLow:StartTransmission(0x91d3760, 0x91f2098, 0x91d3ab8, [send rts=0, next size=0, dur=+0.0ns, ack=none], 0x91d3b10)
1.026s [mac=00:00:00:00:00:02] MacLow:CancelAllEvents(0x91d3760)
1.026s [mac=00:00:00:00:00:02] MacLow:StartTransmission(): startTx size=64, to=ff:ff:ff:ff:ff:ff, listener=0x91d3b10
1.026s [mac=00:00:00:00:00:01.026s [mac=00:00:00:00:00:02] MacLow:StartTransmission(0x91d3760, 0x91f2098, 0x91d3ab8, [send rts=0, next size=0, dur=+0.0ns, ack=none], 0x91d3b10)
1.026s [mac=00:00:00:00:00:02] MacLow:CancelAllEvents(0x91d3760)
1.026s [mac=00:00:00:00:00:02] MacLow:StartTransmission(): startTx size=64, to=ff:ff:ff:ff:ff:ff, listener=0x91d3b10
1.026s [mac=00:00:00:00:00:02] MacLow:SendDataPacket(0x91d3760)
1.026s [mac=00:00:00:00:00:02] MacLow:ForwardDown(0x91d3760, 0x91f2120, 0x91d386c, DsssRate1Mbps)
1.026s [mac=00:00:00:00:00:02] MacLow:ForwardDown(): send DATA, to=ff:ff:ff:ff:ff:ff, size=64, mode=DsssRate1Mbps, duration=+0.0ns, seq=0x0
1.0267s [mac=00:00:00:00:00:03] MacLow:ReceiveOk(0x91d4cb0, 0x91f27c0, 396466, DsssRate1Mbps, 0)
1.0267s [mac=00:00:00:00:00:03] MacLow:ReceiveOk(): duration/id=+0.0ns
1.0267s [mac=00:00:00:00:00:03] MacLow:ReceiveOk(): rx group from=00:00:00:00:00:02
1.0267s [mac=00:00:00:00:00:01] MacLow:ReceiveOk(0x91d22e8, 0x91f26c0, 350343, DsssRate1Mbps, 0)
1.0267s [mac=00:00:00:00:00:01] MacLow:ReceiveOk(): duration/id=+0.0ns
1.0267s [mac=00:00:00:00:00:01] MacLow:ReceiveOk(): rx group from=00:00:00:00:02] MacLow:SendDataPacket(0x91d3760)
1.026s [mac=00:00:00:00:00:02] MacLow:ForwardDown(0x91d3760, 0x91f2120, 0x91d386c, DsssRate1Mbps)
1.026s [mac=00:00:00:00:00:02] MacLow:ForwardDown(): send DATA, to=ff:ff:ff:ff:ff:ff, size=64, mode=DsssRate1Mbps, duration=+0.0ns, seq=0x0
1.0267s [mac=00:00:00:00:00:03] MacLow:ReceiveOk(0x91d4cb0, 0x91f27c0, 396466, DsssRate1Mbps, 0)
1.0267s [mac=00:00:00:00:00:03] MacLow:ReceiveOk(): duration/id=+0.0ns
1.0267s [mac=00:00:00:00:00:03] MacLow:ReceiveOk(): rx group from=00:00:00:00:00:02
1.0267s [mac=00:00:00:00:00:01] MacLow:ReceiveOk(0x91d22e8, 0x91f26c0, 350343, DsssRate1Mbps, 0)
1.0267s [mac=00:00:00:00:00:01] MacLow:ReceiveOk(): duration/id=+0.0ns
1.0267s [mac=00:00:00:00:00:01] MacLow:ReceiveOk(): rx group from=00:00:00:00:02

Shouldn't the field 'rts' in MacLow::StartTransmission be different from zero?

And while debbuging my code I noticed the method MacLow::SendRtsForPacket is never called, instead it goes directly to MacLow::SendDataPacket.


Am I setting my script wrong?

Thank you for any help.

Best regards,
Larissa.

 

pedro chaparro

unread,
Oct 29, 2012, 1:24:14 PM10/29/12
to ns-3-...@googlegroups.com
maybe RTS/CTS is not enable, this is some old post, i hope it help u

You will just increase the threshold for 'enabling' RTS/CTS.

e.g. if you set the "rtslimit" to 1000 any packet less than this limit will be transmitted without RTS/CTS.

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


On Monday, 15 October 2012 11:07:46 UTC+1, peyman wrote:
Hi all,

I just want to disable rts/cts in adhoc network. is there any body knows that how can I disable it?
--

2012/10/29 Larissa Eglem <eglem...@gmail.com>

 

--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ns-3-users/-/rHCJSxeVhz0J.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.



--
Pedro Alonso Chaparro Valero R&D Engineer
Ciudad Politecnica de la Innovación
iTEAM - Mobile Communications Group
Polytechnic University of Valencia
C\ Camino de Vera S/N, Edificio 8G
46022 Valencia, Spain

Larissa Marinho Eglem de Oliveira

unread,
Oct 29, 2012, 1:27:22 PM10/29/12
to ns-3-...@googlegroups.com
So, if I set the RtsCtsThreshold to zero, all packets should be sent with RTS/CTS right?

2012/10/29 pedro chaparro <pdr...@gmail.com>

Larissa Marinho Eglem de Oliveira

unread,
Oct 29, 2012, 1:34:41 PM10/29/12
to ns-3-...@googlegroups.com
I tried to set the threshold to zero, but I'm still having the same problem.

2012/10/29 Larissa Marinho Eglem de Oliveira <eglem...@gmail.com>

Nicola Baldo

unread,
Oct 30, 2012, 7:55:11 AM10/30/12
to ns-3-...@googlegroups.com
Larissa, just to check, did you place the call to Config::SetDefault before any wifi device is created?
Besides, I think UintegerValue should be used instead of StringValue.
Can you please try this and let us know?

Larissa Marinho Eglem de Oliveira

unread,
Oct 30, 2012, 9:23:20 AM10/30/12
to ns-3-...@googlegroups.com
HI,

Thank you Nicola for your help. I have placed the call to Config::SetDefault after the creation of the wifi devices, although I have two calls for Config::SetDefault, since I'm using two wifi devices. In the first wifi channel I want RTS/CTS to be enabled, but not in the second channel.

I have also replaced StringValue to UintegerValue.

It still doesn't work. This is my script:

int main(int argc, char *argv[])
{
FILE *top;
//IEEE 802.11, tx rate = 1Mbps
std::string phyMode("DsssRate1Mbps");
std::string phyintervalMode("DsssRate1Mbps");
//package size in bytes
uint32_t packetSize = 1000;
bool verbose = false;
double px,py;
int quantNo;
int quantEnlace;

//in line command arguments
CommandLine cmd;
cmd.AddValue("phyMode","Wifi Phy Mode", phyMode);
cmd.AddValue("packetSize","Size of the packet to be sent", packetSize);
cmd.AddValue("verbose","Turn on all WifiNetDevice log components", verbose);
cmd.Parse(argc, argv);

/*topology file
* number of nodes |  number of enlaces  |     -
* node number      |  position x         | position y
* ...              |    ...              |    ...
* transmitter node |  receiver node
*/

//reads the topology file
top = fopen("scratch/topologia.txt","r");
fscanf(top,"%d %d",&quantNo,&quantEnlace);

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_80211b);

YansWifiPhyHelper wifiPhy =  YansWifiPhyHelper::Default ();
// set it to zero; otherwise, gain will be added
wifiPhy.Set ("RxGain", DoubleValue (0) );
// ns-3 supports RadioTap and Prism tracing extensions for 802.11b
wifiPhy.SetPcapDataLinkType (YansWifiPhyHelper::DLT_IEEE802_11_RADIO);
//main interface channel number
wifiPhy.Set("ChannelNumber",UintegerValue(1));

YansWifiChannelHelper wifiChannel;
wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
wifiChannel.AddPropagationLoss ("ns3::FriisPropagationLossModel","Lambda", DoubleValue (300000000/2.4e9));
wifiPhy.SetChannel (wifiChannel.Create ());

// Add a non-QoS upper mac, and disable rate control
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
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);

// TCP/IP setting

// enable RTS/CTS
UintegerValue ctsThr = 0; //original value:500
Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", ctsThr);
    //non-unicast rate equal to unicast rate
Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode", StringValue(phyMode));

//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,0.0));
}

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.1.0","255.255.255.0");
Ipv4InterfaceContainer interface = ipv4.Assign(devices);


/*Cognitive interface configuration*/

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

WifiHelper cogwifi;

cogwifi.SetStandard (WIFI_PHY_STANDARD_80211b);

//cognitive interface channel number
wifiPhy.Set("ChannelNumber",UintegerValue(6));

YansWifiChannelHelper cogwifiChannel;
cogwifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
cogwifiChannel.AddPropagationLoss ("ns3::FriisPropagationLossModel","Lambda", DoubleValue (300000000/2.4e9));
wifiPhy.SetChannel (cogwifiChannel.Create ());

// Add a non-QoS upper mac, and disable rate control
NqosWifiMacHelper cogMac = NqosWifiMacHelper::Default ();
//cognitive interface channel number
wifiPhy.Set("ChannelNumber",UintegerValue(6));
cogwifi.SetStandard (WIFI_PHY_STANDARD_80211b);
cogwifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
                          "DataMode",StringValue (phyMode),
                          "ControlMode",StringValue (phyintervalMode));

// Set it to adhoc mode
cogMac.SetType ("ns3::AdhocWifiMac","Sifs",TimeValue(NanoSeconds(26000)));

// disable RTS/CTS for every packet
UintegerValue ctsThr2 = 500000; //original value:500
Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", ctsThr2);
Config::SetDefault ("ns3::WifiRemoteStationManager::MaxSlrc", StringValue("0"));

NetDeviceContainer cogdevices = cogwifi.Install(wifiPhy,cogMac,nodes);
Ipv4InterfaceContainer coginterface = ipv4.Assign(cogdevices);
interface.Add(coginterface);

//Applications
float tempo = 0.01;
//float cogtempo = 0.03;

for(int i=0; i<quantEnlace; i++)
{
int from,to;
fscanf(top,"%d %d",&from,&to);
PacketSinkHelper sink("ns3::UdpSocketFactory", InetSocketAddress(interface.GetAddress(to),80));
//PacketSinkHelper cogsink("ns3::UdpSocketFactory", InetSocketAddress(coginterface.GetAddress(to),80));

ApplicationContainer sinkApp = sink.Install(nodes.Get(to));
//ApplicationContainer cogsinkApp = cogsink.Install(nodes.Get(to));
sinkApp.Start(Seconds(tempo));
//cogsinkApp.Start(Seconds(cogtempo));
sinkApp.Stop(Seconds(50.0));
//cogsinkApp.Stop(Seconds(51.1));

//install on-off application on main interface
MyOnOffHelper onOff("ns3::UdpSocketFactory", InetSocketAddress(interface.GetAddress(from),80));
onOff.SetAttribute("OnTime",RandomVariableValue(ConstantVariable(1.0)));
onOff.SetAttribute("OffTime",RandomVariableValue(ConstantVariable(1.0)));
onOff.SetAttribute("PacketSize",UintegerValue(packetSize));
onOff.SetAttribute("Remote",AddressValue(InetSocketAddress(interface.GetAddress(to),80)));

//install on-off application on cognitive interface
//MyOnOffHelper cogonOff("ns3::UdpSocketFactory", InetSocketAddress(coginterface.GetAddress(from),80));
//cogonOff.SetAttribute("OnTime",RandomVariableValue(ConstantVariable(1.0)));
//cogonOff.SetAttribute("OffTime",RandomVariableValue(ConstantVariable(1.0)));
//cogonOff.SetAttribute("PacketSize",UintegerValue(packetSize));
//cogonOff.SetAttribute("Remote",AddressValue(InetSocketAddress(coginterface.GetAddress(to),80)));

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

udpApp.Start(Seconds(tempo));
//cogudpApp.Start(Seconds(cogtempo));
udpApp.Stop(Seconds(50.0));
//cogudpApp.Stop(Seconds(51.1));
tempo+=0.2;
}


//Enables the creation of packet tracking files
AsciiTraceHelper ascii;
wifiPhy.EnableAsciiAll(ascii.CreateFileStream("teste1.tr"));


//Tracks the received packets in the chosen terminal
Config::Connect("/NodeListq2/DeviceList/*/Phy/State/RxOk",MakeCallback(&PhyRxOkTrace));
Throughput();

//PCAP files
    wifiPhy.EnablePcap("script",devices);
wifiPhy.EnablePcap("cog-script",cogdevices);


Simulator::Stop(Seconds(60));
Simulator::Run();
Simulator::Destroy();

fclose(top);

return 0;
}

Thank you again for your help!

Best regards,
Larissa. 



2012/10/30 Nicola Baldo <nba...@cttc.es>
Larissa, just to check, did you place the call to Config::SetDefault before any wifi device is created?
Besides, I think UintegerValue should be used instead of StringValue.
Can you please try this and let us know?

--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ns-3-users/-/xeef6j68WBMJ.

Larissa Marinho Eglem de Oliveira

unread,
Oct 30, 2012, 2:15:24 PM10/30/12
to ns-3-...@googlegroups.com
Hi, 

One more question, why can't I set the RTS/CTS like this:

wifi.SetRemoteStationManager ("ns3::WifiRemoteStationManager", "RtsCtsThreshold",UintegerValue(ctsThr)); 

I get the following error:

msg="Requested constructor for ns3::WifiRemoteStationManager but it does not have one.", file=../src/core/model/type-id.cc, line=198
 Thank you!

2012/10/30 Larissa Marinho Eglem de Oliveira <eglem...@gmail.com>

Vitor Carvalho

unread,
Nov 8, 2012, 12:25:53 PM11/8/12
to ns-3-...@googlegroups.com
Hi Larissa, you succeeded?

Thanks!

Larissa Marinho Eglem de Oliveira

unread,
Nov 8, 2012, 12:30:05 PM11/8/12
to ns-3-...@googlegroups.com
Yes! Thank you for asking! I actually placed the first call to Config::SetDefault before creating the nodes, and it's working now!

Thanks!

2012/11/8 Vitor Carvalho <vitorca...@gmail.com>
To view this discussion on the web visit https://groups.google.com/d/msg/ns-3-users/-/5NUVwbiq3xoJ.

Vitor Carvalho

unread,
Nov 8, 2012, 12:52:39 PM11/8/12
to ns-3-...@googlegroups.com
Can you share your file? I'm passing through a situation like yours, and I can't make it works.

Larissa Marinho Eglem de Oliveira

unread,
Nov 8, 2012, 12:54:53 PM11/8/12
to ns-3-...@googlegroups.com
Here it goes:

/*
 * // -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*-
 * script.cc
 *
 *  Created on: 14/09/2012
 *      Author: larissa
 */

#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/mobility-module.h"
#include "ns3/wifi-module.h"
#include "ns3/internet-module.h"
#include "ns3/dispatch-module.h"
#include "ns3/ipv4-interface-container.h"
#include "ns3/propagation-module.h"
#include "ns3/applications-module.h"
#include "ns3/myonoff-application.h"
#include "ns3/flow-monitor-module.h"



#include<iostream>
#include<iomanip>
#include<fstream>
#include<vector>
#include<string>
#include<ctime>
#include<cstdio>
#include<cstdlib>
#include<stdexcept>

NS_LOG_COMPONENT_DEFINE("Script");

using namespace ns3;

static uint32_t m_bytesTotal;

//method that calculates the throughput (Mbps at each 60s)
static void Throughput()
{
double mbps;
Time time;
mbps = (((m_bytesTotal*8.0)/1000000/60));
time = Simulator::Now();
m_bytesTotal = 0;
std::cout<<time.GetSeconds()<<""<<mbps<<std::endl;
Simulator::Schedule(Seconds(60),&Throughput);
}

//method that calculates the receiver payload
void PhyRxOkTrace(std::string conntext, Ptr<const Packet>packet, double snr, WifiMode mode, enum WifiPreamble preamble)
{
Ptr<Packet> m_currentPacket;
WifiMacHeader hdr;
m_currentPacket = packet->Copy();
m_currentPacket->RemoveHeader(hdr);

if(hdr.IsData())
{
m_bytesTotal+=m_currentPacket->GetSize();
// 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"));
//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,0.0));
}

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.1.0","255.255.255.0");
Ipv4InterfaceContainer interface = ipv4.Assign(devices);


/*Cognitive interface configuration*/

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

WifiHelper cogwifi;

// disable RTS/CTS for every packet
UintegerValue ctsThr2 = 500000; //original value:500
Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", ctsThr2);
Config::SetDefault ("ns3::WifiRemoteStationManager::MaxSlrc", StringValue("0"));


cogwifi.SetStandard (WIFI_PHY_STANDARD_80211b);

// Add a non-QoS upper mac, and disable rate control
NqosWifiMacHelper cogMac = NqosWifiMacHelper::Default ();
//cognitive interface channel number
wifiPhy.Set("ChannelNumber",UintegerValue(6));

YansWifiChannelHelper cogwifiChannel;
cogwifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
cogwifiChannel.AddPropagationLoss ("ns3::FriisPropagationLossModel","Lambda", DoubleValue (300000000/2.4e9));
wifiPhy.SetChannel (cogwifiChannel.Create ());


cogwifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
                          "DataMode",StringValue (phyMode),
                          "ControlMode",StringValue (phyintervalMode));

// Set it to adhoc mode
cogMac.SetType ("ns3::AdhocWifiMac","Sifs",TimeValue(NanoSeconds(26000)));


NetDeviceContainer cogdevices = cogwifi.Install(wifiPhy,cogMac,nodes);
Ipv4InterfaceContainer coginterface = ipv4.Assign(cogdevices);
interface.Add(coginterface);

//Applications
float tempo = 0.01;

for(int i=0; i<=quantEnlace; i++)
{
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(50.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",RandomVariableValue(ConstantVariable(1.0)));
onOff.SetAttribute("OffTime",RandomVariableValue(ConstantVariable(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(50.0));
tempo+=0.2;
}


//Enables the creation of packet tracking files
AsciiTraceHelper ascii;
wifiPhy.EnableAsciiAll(ascii.CreateFileStream("teste1.tr"));


//Tracks the received packets in the chosen terminal
Config::Connect("/NodeList/*/DeviceList/*/Phy/State/RxOk",MakeCallback(&PhyRxOkTrace));
Throughput();

//PCAP files
    wifiPhy.EnablePcap("script",devices);
wifiPhy.EnablePcap("cog-script",cogdevices);

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


Simulator::Stop(Seconds(60.1));
Simulator::Run();

//Flow Monitor Code
//Print per flow statistics
 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);
         std::cout << "Flow " << i->first  << " (" << t.sourceAddress << " -> " << t.destinationAddress << ")\n";           std::cout << "  Tx Bytes:   " << i->second.txBytes << "\n";
         std::cout << "  Rx Bytes:   " << i->second.rxBytes << "\n";
         std::cout << "  Throughput: " << i->second.rxBytes * 8.0 / 10.0 / 1024 / 1024  << " Mbps\n";
   }


Simulator::Destroy();

fclose(top);

return 0;
}


Although the last part regarding flow monitor isn't working properly. I only get the flows from the 10.1.1.0 network. I also need the 192.1.1.0 network. If you have any idea on how to fix that I would appreciate a lot.

:)

2012/11/8 Vitor Carvalho <vitorca...@gmail.com>
To view this discussion on the web visit https://groups.google.com/d/msg/ns-3-users/-/dmMEUg7StWkJ.

Vitor Carvalho

unread,
Nov 8, 2012, 1:23:27 PM11/8/12
to ns-3-...@googlegroups.com
Yeah, I do not have this modules (dispatch-module.h and myonoff-application.h).
Do you know how can I see in the logs or in the "real time" output, where was set Rts?

Thanks

Larissa Marinho Eglem de Oliveira

unread,
Nov 8, 2012, 1:29:23 PM11/8/12
to ns-3-...@googlegroups.com
You can erase these modules and all the code regarding the second network :)

You can see the RTS/CTS in a trace file, for example in my code: 

//Enables the creation of packet tracking files
AsciiTraceHelper ascii;
wifiPhy.EnableAsciiAll(ascii.CreateFileStream("teste1.tr"));

If you open teste1.tr you'll be able to see lots of RTS, CTS and RTS.

You can also enable the logging in MacLow:

export 'NS_LOG=MacLow=level_all|prefix_func|prefix_time'
./waf --run ...


But all you really have to do is place the Config::SetDefault in the right place.





2012/11/8 Vitor Carvalho <vitorca...@gmail.com>
--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ns-3-users/-/kcJOlkIuxNkJ.
Reply all
Reply to author
Forward
0 new messages