[ndnSIM] Gnerating data with different prefixes
Salwa Abdelwahed
salwa201067 at gmail.com
Fri Apr 12 06:43:17 PDT 2024
Hello all ,
I tried to generate name prefixes by configuring consumer and equivalent
producers in an ndn-wifi topology, the delay files (app-delays-trace) and
traces (rate-trace), did not generate any thing .
I don't know if it's a prefix configuration problem or something else.
here is my code. Can someone guides me how can i proceed.
Thanks.
using namespace std;
namespace ns3 {
NS_LOG_COMPONENT_DEFINE("ndn.WifiExample");
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;
// wifi.SetRemoteStationManager ("ns3::AarfWifiManager");
wifi.SetStandard(WIFI_STANDARD_80211a);
wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager", "DataMode",
StringValue("OfdmRate24Mbps"));
YansWifiChannelHelper wifiChannel;
wifiChannel.SetPropagationDelay("ns3::ConstantSpeedPropagationDelayModel");
wifiChannel.AddPropagationLoss("ns3::ThreeLogDistancePropagationLossModel");
wifiChannel.AddPropagationLoss("ns3::NakagamiPropagationLossModel");
YansWifiPhyHelper wifiPhyHelper;
wifiPhyHelper.SetChannel(wifiChannel.Create());
wifiPhyHelper.Set("TxPowerStart", DoubleValue(5));
wifiPhyHelper.Set("TxPowerEnd", DoubleValue(5));
WifiMacHelper wifiMacHelper;
wifiMacHelper.SetType("ns3::AdhocWifiMac");
Ptr<UniformRandomVariable> randomizer =
CreateObject<UniformRandomVariable>();
randomizer->SetAttribute("Min", DoubleValue(10));
randomizer->SetAttribute("Max", DoubleValue(100));
NodeContainer nodes;
nodes.Create(2);
////////////////
// 1. Install Wifi
NetDeviceContainer wifiNetDevices = wifi.Install(wifiPhyHelper,
wifiMacHelper, nodes);
// 3. Install NDN stack
NS_LOG_INFO("Installing NDN stack");
ndn::StackHelper ndnHelper;
// ndnHelper.AddNetDeviceFaceCreateCallback (WifiNetDevice::GetTypeId (),
MakeCallback
// (MyNetDeviceFaceCallback));
ndnHelper.setPolicy("nfd::cs::lru");
ndnHelper.setCsSize(1000);
ndnHelper.SetDefaultRoutes(true);
ndnHelper.Install(nodes);
// Set BestRoute strategy
ndn::StrategyChoiceHelper::Install(nodes, "/",
"/localhost/nfd/strategy/best-route");
// 4. Set up applications
NS_LOG_INFO("Installing Applications");
ndn::AppHelper consumerHelperECG("ns3::ndn::ConsumerCbr");
consumerHelperECG.SetPrefix("/ECG");
consumerHelperECG.SetAttribute("Frequency", DoubleValue(10.0));
consumerHelperECG.Install(nodes.Get(0));
ndn::AppHelper producerHelperECG("ns3::ndn::Producer");
producerHelperECG.SetPrefix("/ECG");
producerHelperECG.SetAttribute("PayloadSize", StringValue("1200"));
producerHelperECG.Install(nodes.Get(1));
// Configurer un deuxième consommateur avec le préfixe "/EEG" sur le
premier nœud
ndn::AppHelper consumerHelperEEG("ns3::ndn::ConsumerCbr");
consumerHelperEEG.SetPrefix("/EEG"); // Utiliser le préfixe "/EEG"
consumerHelperEEG.SetAttribute("Frequency", DoubleValue(10.0));
consumerHelperEEG.Install(nodes.Get(0)); // Installer sur le premier nœud
// Configurer un deuxième producteur avec le préfixe "/EEG" sur le deuxième
nœud
ndn::AppHelper producerHelperEEG("ns3::ndn::Producer");
producerHelperEEG.SetPrefix("/EEG"); // Utiliser le préfixe "/EEG"
producerHelperEEG.SetAttribute("PayloadSize", StringValue("1200"));
producerHelperEEG.Install(nodes.Get(1)); // Installer sur le deuxième nœud
////////////////
Simulator::Stop(Seconds(30.0));
ndn::AppDelayTracer::InstallAll("app-delays-trace.csv");
ndn::L3RateTracer::InstallAll("rate-trace.csv", Seconds(0.5));
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/20240412/11960d5d/attachment-0001.htm>
More information about the ndnSIM
mailing list