[ndnSIM] (no subject)
moussaoui yehya
yehya.housseyn at hotmail.com
Wed Dec 6 01:23:04 PST 2017
thank you sir for your reply
actually i have modified the code and implement more than one producer and try to change the forwarding strategy but i get the same metrics, even i delete this instruction
ndn::StrategyChoiceHelper::Install(nodes, "/", "/localhost/nfd/strategy/best-route");
it run normally but i get the results.
BTW my scenario apply on Wireless sensor network
this is my code .. please have a look of my code:
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/applications-module.h"
#include "ns3/wifi-module.h"
#include "ns3/mobility-module.h"
#include "ns3/internet-module.h"
#include "ns3/ndnSIM-module.h"
using namespace std;
namespace ns3 {
NS_LOG_COMPONENT_DEFINE("ndn.WifiExample");
//
// DISCLAIMER: Note that this is an extremely simple example, containing just 2 wifi nodes
// communicating directly over AdHoc channel.
//
// Ptr<ndn::NetDeviceFace>
// MyNetDeviceFaceCallback (Ptr<Node> node, Ptr<ndn::L3Protocol> ndn, Ptr<NetDevice> device)
// {
// // NS_LOG_DEBUG ("Create custom network device " << node->GetId ());
// Ptr<ndn::NetDeviceFace> face = CreateObject<ndn::MyNetDeviceFace> (node, device);
// ndn->AddFace (face);
// return face;
// }
int
main(int argc, char* argv[])
{
// disable fragmentation
Config::SetDefault("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue("2200"));
Config::SetDefault("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue("2200"));
Config::SetDefault("ns3::WifiRemoteStationManager::NonUnicastMode",
StringValue("OfdmRate24Mbps"));
CommandLine cmd;
cmd.Parse(argc, argv);
//////////////////////
//////////////////////
//////////////////////
WifiHelper wifi = WifiHelper::Default();
// wifi.SetRemoteStationManager ("ns3::AarfWifiManager");
wifi.SetStandard(WIFI_PHY_STANDARD_80211a);
wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager", "DataMode",
StringValue("OfdmRate24Mbps"));
YansWifiChannelHelper wifiChannel; // = YansWifiChannelHelper::Default ();
wifiChannel.SetPropagationDelay("ns3::ConstantSpeedPropagationDelayModel");
wifiChannel.AddPropagationLoss("ns3::ThreeLogDistancePropagationLossModel");
wifiChannel.AddPropagationLoss("ns3::NakagamiPropagationLossModel");
// YansWifiPhy wifiPhy = YansWifiPhy::Default();
YansWifiPhyHelper wifiPhyHelper = YansWifiPhyHelper::Default();
wifiPhyHelper.SetChannel(wifiChannel.Create());
wifiPhyHelper.Set("TxPowerStart", DoubleValue(5));
wifiPhyHelper.Set("TxPowerEnd", DoubleValue(5));
NqosWifiMacHelper wifiMacHelper = NqosWifiMacHelper::Default();
wifiMacHelper.SetType("ns3::AdhocWifiMac");
Ptr<UniformRandomVariable> randomizer = CreateObject<UniformRandomVariable>();
randomizer->SetAttribute("Min", DoubleValue(10));
randomizer->SetAttribute("Max", DoubleValue(100));
MobilityHelper mobility;
mobility.SetPositionAllocator("ns3::RandomBoxPositionAllocator", "X", PointerValue(randomizer),
"Y", PointerValue(randomizer), "Z", PointerValue(randomizer));
mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
NodeContainer nodes;
nodes.Create(10);
////////////////
// 1. Install Wifi
NetDeviceContainer wifiNetDevices = wifi.Install(wifiPhyHelper, wifiMacHelper, nodes);
// 2. Install Mobility model
mobility.Install(nodes);
// 3. Install NDN stack
NS_LOG_INFO("Installing NDN stack");
ndn::StackHelper ndnHelper;
// ndnHelper.AddNetDeviceFaceCreateCallback (WifiNetDevice::GetTypeId (), MakeCallback
// (MyNetDeviceFaceCallback));
ndnHelper.SetOldContentStore("ns3::ndn::cs::Lru", "MaxSize", "1000");
ndnHelper.SetDefaultRoutes(true);
ndnHelper.Install(nodes);
// Set BestRoute strategy
ndn::StrategyChoiceHelper::Install(nodes, "/", "/localhost/nfd/strategy/best-route");
ndn::GlobalRoutingHelper ndnGlobalRoutingHelper;
ndnGlobalRoutingHelper.InstallAll();
// 4. Set up applications
NS_LOG_INFO("Installing Applications");
for(int i=0;i<2;i++)
{
ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");
consumerHelper.SetPrefix("/test/prefix");
consumerHelper.SetAttribute("Frequency", DoubleValue(10.0));
consumerHelper.Install(nodes.Get(i));
}
for(int i=2;i<10;i++)
{
ndn::AppHelper producerHelper("ns3::ndn::Producer");
producerHelper.SetPrefix("/");
producerHelper.SetAttribute("PayloadSize", StringValue("1200"));
producerHelper.Install(nodes.Get(i));
}
////////////////
ndn::GlobalRoutingHelper::CalculateRoutes();
Simulator::Stop(Seconds(60.0));
ndn::CsTracer::InstallAll("cs-best-route.txt", Seconds(1));
Simulator::Run();
Simulator::Destroy();
return 0;
}
} // namespace ns3
int
main(int argc, char* argv[])
{
return ns3::main(argc, argv);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20171206/68fbfa46/attachment.html>
More information about the ndnSIM
mailing list