HanneloreSchi
unread,Oct 18, 2010, 12:18:07 PM10/18/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ns-3-users
Scenario:
+ multiple mesh nodes in proximity
+ NO data traffic on the network, only Mesh Peering frames
Problem:
One node simply stops beaconing.
I have no idea why so.
You can see, that 00:00:00:00:00:01 stops beaconing at about 2,5s and
won't send any again.
Output:
0: Mbps = 0
1: Mbps = 0
1301247280ns 00:00:00:00:00:06 is sending beacon
1321468725ns 00:00:00:00:00:05 is sending beacon
1633064088ns 00:00:00:00:00:01 is sending beacon
1670300147ns 00:00:00:00:00:02 is sending beacon
1801247280ns 00:00:00:00:00:06 is sending beacon
1821468725ns 00:00:00:00:00:05 is sending beacon
1887796932ns 00:00:00:00:00:03 is sending beacon
1970581626ns 00:00:00:00:00:04 is sending beacon
2: Mbps = 0
2133064088ns 00:00:00:00:00:01 is sending beacon
2170300147ns 00:00:00:00:00:02 is sending beacon
2301247280ns 00:00:00:00:00:06 is sending beacon
2321468725ns 00:00:00:00:00:05 is sending beacon
2387796932ns 00:00:00:00:00:03 is sending beacon
2470581626ns 00:00:00:00:00:04 is sending beacon
2670300147ns 00:00:00:00:00:02 is sending beacon
2801247280ns 00:00:00:00:00:06 is sending beacon
2821468725ns 00:00:00:00:00:05 is sending beacon
2887796932ns 00:00:00:00:00:03 is sending beacon
2970581626ns 00:00:00:00:00:04 is sending beacon
3: Mbps = 0
3132628136ns BeaconLoss -> link break to 00:00:00:00:00:01
3132628136ns BeaconLoss -> link break to 00:00:00:00:00:01
3132628156ns BeaconLoss -> link break to 00:00:00:00:00:01
3132628156ns BeaconLoss -> link break to 00:00:00:00:00:01
3132628185ns BeaconLoss -> link break to 00:00:00:00:00:01
3170300147ns 00:00:00:00:00:02 is sending beacon
3301247280ns 00:00:00:00:00:06 is sending beacon
3321468725ns 00:00:00:00:00:05 is sending beacon
3387796932ns 00:00:00:00:00:03 is sending beacon
3470581626ns 00:00:00:00:00:04 is sending beacon
3670300147ns 00:00:00:00:00:02 is sending beacon
3801247280ns 00:00:00:00:00:06 is sending beacon
3821468725ns 00:00:00:00:00:05 is sending beacon
3887796932ns 00:00:00:00:00:03 is sending beacon
3970581626ns 00:00:00:00:00:04 is sending beacon
4: Mbps = 0
4170300147ns 00:00:00:00:00:02 is sending beacon
4301247280ns 00:00:00:00:00:06 is sending beacon
4321468725ns 00:00:00:00:00:05 is sending beacon
4387796932ns 00:00:00:00:00:03 is sending beacon
4470581626ns 00:00:00:00:00:04 is sending beacon
4670300147ns 00:00:00:00:00:02 is sending beacon
4801247280ns 00:00:00:00:00:06 is sending beacon
4821468725ns 00:00:00:00:00:05 is sending beacon
4887796932ns 00:00:00:00:00:03 is sending beacon
4970581626ns 00:00:00:00:00:04 is sending beacon
5: Mbps = 0
5170300147ns 00:00:00:00:00:02 is sending beacon
5301247280ns 00:00:00:00:00:06 is sending beacon
5321468725ns 00:00:00:00:00:05 is sending beacon
5387796932ns 00:00:00:00:00:03 is sending beacon
5470581626ns 00:00:00:00:00:04 is sending beacon
5670300147ns 00:00:00:00:00:02 is sending beacon
Code Example:
#include "ns3/core-module.h"
#include "ns3/simulator-module.h"
#include "ns3/node-module.h"
#include "ns3/helper-module.h"
#include "ns3/global-routing-module.h"
#include "ns3/wifi-module.h"
#include "ns3/mesh-module.h"
#include "ns3/mobility-module.h"
#include "ns3/mesh-helper.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("TestMeshScript");
uint64_t m_bytesTotal=0;
Ptr<YansWifiChannel> ptrChannel;
NetDeviceContainer devCont;
MeshHelper mesh;
unsigned numReport=0;
void Report ()
{
unsigned n (0);
for (NetDeviceContainer::Iterator i = devCont.Begin (); i !=
devCont.End (); ++i, ++n) {
std::ostringstream os;
os << "simple-tcp-report-" << numReport << "-" << n << ".xml";
std::cerr << "Printing mesh point device #" << n << " diagnostics
to " << os.str () << "\n";
std::ofstream of;
of.open (os.str().c_str());
if (! of.is_open ()) {
std::cerr << "Error: Can't open file " << os.str() << "\n";
return;
}
mesh.Report (*i, of);
of.close ();
}
numReport++;
}
static void Throughput () // in Mbps calculated every 1s
{
const double timeunit = 1;
double mbps = (((m_bytesTotal * 8.0) / 1000000) / timeunit);
std::cerr << Simulator::Now().GetSeconds() << ": Mbps = " << mbps <<
std::endl;
Time time = Simulator::Now ();
m_bytesTotal = 0;
Simulator::Schedule (Seconds (timeunit), &Throughput);
}
void PhyRxOkTrace (std::string context, 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 ();
}
NS_LOG_DEBUG(context << " " << Simulator::Now().GetSeconds() << ": "
<< mode.GetDataRate() << " MBps");
}
int main (int argc, char *argv[])
{
const uint8_t numNodes = 6;
const uint8_t src1 = 1;
const uint8_t src2 = 5;
const uint8_t sink1 = 2;
// nodes
NodeContainer nodes;
nodes.Create(numNodes);
// PHY & channel
const uint8_t smartAntennaGain = 9;
YansWifiPhyHelper phy = YansWifiPhyHelper::Default();
YansWifiChannelHelper channel = YansWifiChannelHelper::Default();
ptrChannel = channel.Create();
phy.SetChannel(ptrChannel);
// mobility
MobilityHelper mobi;
Ptr<ListPositionAllocator> positionAlloc =
CreateObject<ListPositionAllocator> ();
const double baselen = 10.426406871192851464050661726291;
positionAlloc->Add(Vector(baselen, 0., 0.));
positionAlloc->Add(Vector(3*baselen, 0., 0.));
positionAlloc->Add(Vector(0., baselen, 0.));
positionAlloc->Add(Vector(2*baselen, baselen, 0.));
positionAlloc->Add(Vector(baselen, 2*baselen, 0.));
positionAlloc->Add(Vector(3*baselen, 2*baselen, 0.));
mobi.SetPositionAllocator(positionAlloc);
mobi.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobi.Install (nodes);
mesh = MeshHelper::Default();
mesh.SetStackInstaller("ns3::Dot11sStack");
mesh.SetRemoteStationManager("ns3::IdealWifiManager");
mesh.SetMacType("RandomStart", TimeValue(Seconds(2)));
devCont = mesh.Install(phy, nodes);
// TCP/IP stack
InternetStackHelper netStack;
netStack.Install(nodes);
// IPs
Ipv4AddressHelper addresses;
addresses.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer interfaceCont;
interfaceCont = addresses.Assign(devCont);
// Applications
// none
// HWMP report
Simulator::Schedule (Seconds(12), & Report);
//LogComponentEnable("DcfManager", LogLevel(LOG_LEVEL_DEBUG|
LOG_PREFIX_NODE|LOG_PREFIX_TIME|LOG_PREFIX_FUNC));
//LogComponentEnable("OnOffApplication", LogLevel(LOG_LEVEL_DEBUG|
LOG_PREFIX_NODE|LOG_PREFIX_TIME|LOG_PREFIX_FUNC));
//LogComponentEnable("HwmpRtable", LogLevel(LOG_LEVEL_DEBUG|
LOG_PREFIX_NODE|LOG_PREFIX_TIME|LOG_PREFIX_FUNC));
//LogComponentEnable("AirtimeLinkMetricCalculator",
LogLevel(LOG_LEVEL_DEBUG|LOG_PREFIX_TIME|LOG_PREFIX_NODE|
LOG_PREFIX_FUNC));
LogComponentEnable("Dot11sPeerManagementProtocol",
LogLevel(LOG_LEVEL_DEBUG|LOG_PREFIX_TIME|LOG_PREFIX_NODE|
LOG_PREFIX_FUNC));
LogComponentEnable("MeshWifiInterfaceMac", LogLevel(LOG_LEVEL_DEBUG|
LOG_PREFIX_TIME|LOG_PREFIX_NODE|LOG_PREFIX_FUNC));
//LogComponentEnable("DcaTxop", LogLevel(LOG_LEVEL_DEBUG|
LOG_PREFIX_TIME|LOG_PREFIX_NODE|LOG_PREFIX_FUNC));
//LogComponentEnable("HwmpProtocolMac", LogLevel(LOG_LEVEL_DEBUG|
LOG_PREFIX_TIME|LOG_PREFIX_NODE|LOG_PREFIX_FUNC));
//LogComponentEnable("HwmpProtocol", LogLevel(LOG_LEVEL_DEBUG|
LOG_PREFIX_TIME|LOG_PREFIX_NODE|LOG_PREFIX_FUNC));
//LogComponentEnable("YansWifiChannel", LogLevel(LOG_LEVEL_DEBUG|
LOG_PREFIX_TIME|LOG_PREFIX_NODE|LOG_PREFIX_FUNC));
//LogComponentEnable("WifiRemoteStationManager",
LogLevel(LOG_LEVEL_DEBUG|LOG_PREFIX_TIME|LOG_PREFIX_NODE|
LOG_PREFIX_FUNC));
//LogComponentEnable("SmartantennaCrWifiManager",
LogLevel(LOG_LEVEL_DEBUG|LOG_PREFIX_TIME|LOG_PREFIX_NODE|
LOG_PREFIX_FUNC));
//LogComponentEnable("SmartAntennaIdealWifiManager",
LogLevel(LOG_LEVEL_DEBUG|LOG_PREFIX_TIME|LOG_PREFIX_NODE|
LOG_PREFIX_FUNC));
//LogComponentEnable("PeerManagementProtocol",
LogLevel(LOG_LEVEL_DEBUG|LOG_LEVEL_LOGIC|LOG_PREFIX_TIME|
LOG_PREFIX_NODE|LOG_PREFIX_FUNC));
//LogComponentEnable("PeerManagementProtocolMac",
LogLevel(LOG_LEVEL_DEBUG|LOG_LEVEL_LOGIC|LOG_PREFIX_TIME|
LOG_PREFIX_NODE|LOG_PREFIX_FUNC));
//LogComponentEnable("TestMeshScript", LogLevel(LOG_LEVEL_DEBUG|
LOG_PREFIX_NODE|LOG_PREFIX_TIME|LOG_PREFIX_FUNC));
//LogComponentEnable("YansWifiPhy", LogLevel(LOG_LEVEL_DEBUG|
LOG_PREFIX_TIME|LOG_PREFIX_NODE|LOG_PREFIX_FUNC));
//LogComponentEnable("InterferenceHelper", LogLevel(LOG_LEVEL_DEBUG|
LOG_PREFIX_TIME|LOG_PREFIX_NODE|LOG_PREFIX_FUNC));
//LogComponentEnable("MacLow", LogLevel(LOG_LEVEL_DEBUG|
LOG_PREFIX_TIME|LOG_PREFIX_NODE|LOG_PREFIX_FUNC));
Config::Connect ("/NodeList/0/DeviceList/*/Phy/State/RxOk",
MakeCallback(&PhyRxOkTrace));
Throughput();
// pcap
//phy.EnablePcapAll("simple-tcp", false);
Simulator::Stop(Seconds(12));
Simulator::Run();
Simulator::Destroy();
}