<html><head></head><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:16px"><div id="yui_3_16_0_ym19_1_1461975815546_7609"><span>hello,</span></div><div id="yui_3_16_0_ym19_1_1461975815546_7594" dir="ltr"><span id="yui_3_16_0_ym19_1_1461975815546_7608">thank you so much <span id="yui_3_16_0_ym19_1_1461975815546_7601" style="float: none; display: inline;">Spyridon for nice explanation . I have defined random consumers and providers scenario for four nodes as below:</span></span></div><div id="yui_3_16_0_ym19_1_1461975815546_7685" dir="ltr"><span id="yui_3_16_0_ym19_1_1461975815546_7733"><span id="yui_3_16_0_ym19_1_1461975815546_7732" style="float: none; display: inline;"> NodeContainer nodes;<br id="yui_3_16_0_ym19_1_1461975815546_7686">  nodes.Create (5);</span></span></div><div id="yui_3_16_0_ym19_1_1461975815546_7811" dir="ltr"><span id="yui_3_16_0_ym19_1_1461975815546_7688"><span id="yui_3_16_0_ym19_1_1461975815546_7689" style="float: none; display: inline;">  // Connecting nodes using two links<br id="yui_3_16_0_ym19_1_1461975815546_7690">  PointToPointHelper p2p;<br id="yui_3_16_0_ym19_1_1461975815546_7691">  p2p.Install (nodes.Get (0), nodes.Get (4));<br id="yui_3_16_0_ym19_1_1461975815546_7692">  p2p.Install (nodes.Get (4), nodes.Get (2));<br id="yui_3_16_0_ym19_1_1461975815546_7693">p2p.Install (nodes.Get (3), nodes.Get (4));<br id="yui_3_16_0_ym19_1_1461975815546_7694">  p2p.Install (nodes.Get (1), nodes.Get (4));<br id="yui_3_16_0_ym19_1_1461975815546_7695">  // Install NDN stack on all nodes<br id="yui_3_16_0_ym19_1_1461975815546_7696">  ndn::StackHelper ndnHelper;<br id="yui_3_16_0_ym19_1_1461975815546_7697">ndnHelper.SetPit ("ns3::ndn::pit::Lru","PitEntryPruningTimout","20");<br id="yui_3_16_0_ym19_1_1461975815546_7698">  ndnHelper.SetDefaultRoutes (true);<br id="yui_3_16_0_ym19_1_1461975815546_7699">ndnHelper.SetContentStore("ns3::ndn::cs::Lru", "MaxSize", "1000000000");<br id="yui_3_16_0_ym19_1_1461975815546_7700">  //ndnHelper.InstallAll ();<br id="yui_3_16_0_ym19_1_1461975815546_7701">ndnHelper.Install(nodes.Get (4));<br id="yui_3_16_0_ym19_1_1461975815546_7702">ndnHelper.SetContentStore("ns3::ndn::cs::Nocache");<br id="yui_3_16_0_ym19_1_1461975815546_7703">ndnHelper.Install(nodes.Get (0));<br id="yui_3_16_0_ym19_1_1461975815546_7704">ndnHelper.Install(nodes.Get (1));<br id="yui_3_16_0_ym19_1_1461975815546_7705">ndnHelper.Install(nodes.Get (2));<br id="yui_3_16_0_ym19_1_1461975815546_7706">ndnHelper.Install(nodes.Get (3));<br id="yui_3_16_0_ym19_1_1461975815546_7707">//*****************4/27<br id="yui_3_16_0_ym19_1_1461975815546_7708">Ptr<UniformRandomVariable> x = CreateObject<UniformRandomVariable> ();<br id="yui_3_16_0_ym19_1_1461975815546_7709"> ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr");<br id="yui_3_16_0_ym19_1_1461975815546_7710"> ndn::AppHelper producerHelper ("ns3::ndn::Producer");<br id="yui_3_16_0_ym19_1_1461975815546_7713">consumerHelper.SetPrefix ("/prefix");<br id="yui_3_16_0_ym19_1_1461975815546_7714">  consumerHelper.SetAttribute ("Frequency", StringValue ("5")); // 5 interests a second<br id="yui_3_16_0_ym19_1_1461975815546_7715"> ApplicationContainer consumer[4][20];<br id="yui_3_16_0_ym19_1_1461975815546_7716">producerHelper.SetPrefix ("/prefix");<br id="yui_3_16_0_ym19_1_1461975815546_7717">  producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));<br id="yui_3_16_0_ym19_1_1461975815546_7718">ApplicationContainer producer[4][21];</span></span></div><div id="yui_3_16_0_ym19_1_1461975815546_7918" dir="ltr"><span id="yui_3_16_0_ym19_1_1461975815546_7818"><span id="yui_3_16_0_ym19_1_1461975815546_7817" style="float: none; display: inline;">for ( int i=0;i <10;i++)<br id="yui_3_16_0_ym19_1_1461975815546_7784">{<br id="yui_3_16_0_ym19_1_1461975815546_7787">int provider=x->GetInteger (0,3);<br id="yui_3_16_0_ym19_1_1461975815546_7788">int user=x->GetInteger (0,3);<br id="yui_3_16_0_ym19_1_1461975815546_7791">while( (provider)==(user)){<br id="yui_3_16_0_ym19_1_1461975815546_7793">user=x->GetInteger (0,3);<br id="yui_3_16_0_ym19_1_1461975815546_7795">}<br id="yui_3_16_0_ym19_1_1461975815546_7796"></span></span><span id="yui_3_16_0_ym19_1_1461975815546_7798"><span id="yui_3_16_0_ym19_1_1461975815546_7799" style="float: none; display: inline;"><br id="yui_3_16_0_ym19_1_1461975815546_7803">consumer[user][i]=consumerHelper.Install (nodes.Get (user)); <br id="yui_3_16_0_ym19_1_1461975815546_7804">consumer[user][i].Start(Seconds(2*i));<br id="yui_3_16_0_ym19_1_1461975815546_7805">consumer[user][i].Stop(Seconds(2*i+1));<br id="yui_3_16_0_ym19_1_1461975815546_7806">producer[provider][i]=producerHelper.Install (nodes.Get (provider));<br id="yui_3_16_0_ym19_1_1461975815546_7807">producer[provider][i].Start(Seconds(2*i));<br id="yui_3_16_0_ym19_1_1461975815546_7808">producer[provider][i].Stop(Seconds(2*i+2));<br id="yui_3_16_0_ym19_1_1461975815546_7809">std::cout <<"provideris :"<<provider<<"user is "<<user<< std::endl; // the integer random value in the range of  [0,3] <br id="yui_3_16_0_ym19_1_1461975815546_7810">}</span></span></div><div id="yui_3_16_0_ym19_1_1461975815546_7905" dir="ltr"><span><span style="float: none; display: inline;"></span></span><br></div><div id="yui_3_16_0_ym19_1_1461975815546_7904" dir="ltr"><span id="yui_3_16_0_ym19_1_1461975815546_7903"><span id="yui_3_16_0_ym19_1_1461975815546_7902" style="float: none; display: inline;">It works. however, if you think something is strange from time perspective ( start and stop time duration) or any other perspective, I will become so happy and thankful to let me know.</span></span></div><div id="yui_3_16_0_ym19_1_1461975815546_7901" dir="ltr"><span id="yui_3_16_0_ym19_1_1461975815546_7900"><span id="yui_3_16_0_ym19_1_1461975815546_7899" style="float: none; display: inline;">thanks in advance</span></span></div><div id="yui_3_16_0_ym19_1_1461975815546_7898" dir="ltr"><span id="yui_3_16_0_ym19_1_1461975815546_7897"><span id="yui_3_16_0_ym19_1_1461975815546_7896" style="float: none; display: inline;">best regards</span></span></div> <div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: times new roman, new york, times, serif; font-size: 16px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"><font face="Arial" size="2"> On Friday, April 29, 2016 6:26 AM, Spyridon (Spyros) Mastorakis <mastorakis@cs.ucla.edu> wrote:<br></font></div>  <br><br> <div class="y_msg_container"><div id="yiv0090702381"><div>Hi,<div class="yiv0090702381"><br class="yiv0090702381" clear="none"></div><div class="yiv0090702381">in your simulation scenario, every time that you call the install method for an application, this call returns a container of the applications installed. In this way, you can collect all the application instances and then generate a random number and decide which application instance to start first using the StartApplication method and a specified time point.</div><div class="yiv0090702381"><br class="yiv0090702381" clear="none"></div><div class="yiv0090702381">You can schedule any actions that you would like your application to take as NS3 events in the code of your application.</div><div class="yiv0090702381"><br class="yiv0090702381" clear="none"></div><div class="yiv0090702381">Hope that this helps.</div><div class="yiv0090702381"><br class="yiv0090702381" clear="none"><div class="yiv0090702381">
<div class="yiv0090702381"><div class="yiv0090702381"><div class="yiv0090702381"><span class="yiv0090702381" style="float: none; display: inline;">Spyridon (Spyros) Mastorakis</span><br class="yiv0090702381" clear="none"><span class="yiv0090702381" style="float: none; display: inline;">Personal Website: </span><a class="yiv0090702381" href="http://cs.ucla.edu/~mastorakis/" target="_blank" rel="nofollow" shape="rect">http://cs.ucla.edu/~mastorakis/</a><br class="yiv0090702381" clear="none"><span class="yiv0090702381" style="float: none; display: inline;">Internet Research Laboratory</span><br class="yiv0090702381" clear="none"><span class="yiv0090702381" style="float: none; display: inline;">Computer Science Department</span><br class="yiv0090702381" clear="none"><span class="yiv0090702381" style="float: none; display: inline;">UCLA</span></div><div class="yiv0090702381"><span class="yiv0090702381" style="float: none; display: inline;"><br class="yiv0090702381" clear="none"></span></div></div></div><div class="yiv0090702381"><br class="yiv0090702381" clear="none"></div></div><div class="yiv0090702381yqt3672232732" id="yiv0090702381yqt35557"><div><blockquote class="yiv0090702381" type="cite"><div class="yiv0090702381">On Apr 27, 2016, at 7:49 PM, Zeinab Rezaiefar <<a class="yiv0090702381" href="mailto:z.rezaiefar@yahoo.com" target="_blank" rel="nofollow" shape="rect" ymailto="mailto:z.rezaiefar@yahoo.com">z.rezaiefar@yahoo.com</a>> wrote:</div><br class="yiv0090702381Apple-interchange-newline" clear="none"><div class="yiv0090702381"><div class="yiv0090702381"><div class="yiv0090702381" style='font-family: "times new roman", "new york", times, serif; font-size: 16px; background-color: rgb(255, 255, 255);'><div class="yiv0090702381" id="yiv0090702381yui_3_16_0_ym19_1_1461069702816_107559" style='font-family: "times new roman", "new york", times, serif; font-size: 16px; background-color: rgb(255, 255, 255);'>  Hello every one,</div><div class="yiv0090702381" id="yiv0090702381yui_3_16_0_ym19_1_1461069702816_107594" style='font-family: "times new roman", "new york", times, serif; font-size: 16px; background-color: rgb(255, 255, 255);'>I would like to know how I can change consumer and producer randomly during simulation time. let consider we have 5 nodes and node 1 to node 4 all connect to the node 5  and then select two nodes among node 1 to node 4  as consumer and producer. I would like to know how I should schedule them that after every 1 second, the producer and consumer change while all of the users request the same content. moreover, for example user 1 sends request for the specific packet at second one and later at second 8 again this user may send request for this packet. </div><div class="yiv0090702381" id="yiv0090702381yui_3_16_0_ym19_1_1461802106711_4858" style='font-family: "times new roman", "new york", times, serif; font-size: 16px; background-color: rgb(255, 255, 255);' dir="ltr">any help will be appreciate</div><div class="yiv0090702381" id="yiv0090702381yui_3_16_0_ym19_1_1461802106711_4869" style='font-family: "times new roman", "new york", times, serif; font-size: 16px; background-color: rgb(255, 255, 255);' dir="ltr">thanks in advance</div><div class="yiv0090702381" id="yiv0090702381yui_3_16_0_ym19_1_1461802106711_4870" style='font-family: "times new roman", "new york", times, serif; font-size: 16px; background-color: rgb(255, 255, 255);' dir="ltr">regards</div><div class="yiv0090702381" id="yiv0090702381yui_3_16_0_ym19_1_1461802106711_4871" style='font-family: "times new roman", "new york", times, serif; font-size: 16px; background-color: rgb(255, 255, 255);' dir="ltr">Zeinab  </div></div></div></div></blockquote></div></div><br class="yiv0090702381" clear="none"></div></div></div><br><br></div>  </div> </div>  </div></div></body></html>