Problems with netanim

998 views
Skip to first unread message

Bhooshi Sandeep

unread,
Feb 28, 2018, 7:05:08 PM2/28/18
to ns-3-users
Hello ,
I have a couple of issues with netanim

1) I'm using a Steady state random waypoint mobility model and trying to allocate an area of 1500x300 for simulation. I have enabled netanim in the code and when I open the .xml file using netanim, the boundaries it show are 1457x298.9. 298.9 is close enough to 300 but I'm not quite sure why I have the grid boundary at 1457. I have gone through the posts in the user group and tried to hard code the simulation boundaries as mentioned there but it didn't reflect in the netanim. The code I used to change the simulationBoundaries is below


void
AnimatorScene::setSimulationBoundaries (QPointF minPoint, QPointF maxPoint)
{
.... 

  m_sceneMinPoint = QPointF(0, 0);   
  m_sceneMaxPoint = QPointF(1500, 300);   

  setSceneRect (QRectF (m_sceneMinPoint, m_sceneMaxPoint));
}

The Steady State Random Waypoint mobility code I used is

xPos="ns3::UniformRandomVariable[Min=0|Max=1500];
yPos="ns3::UniformRandomVariable[Min=0|Max=300];

xLength =1500; yLength =300;

case STEADYSTATERANDOMWAYPOINT:
     {  
      NS_LOG_INFO ("Mobility model is STEADY-STATE-RANDOMWAYPOINT with Rectangle Position allocator.\nNode speed =  "
                   << speed <<"\nNode pause time = " << pause <<"\n");
      pos.SetTypeId ("ns3::RandomRectanglePositionAllocator");
      pos.Set ("X", StringValue (xPos));
      pos.Set ("Y", StringValue (yPos));
     
      //Ptr<PositionAllocator> taPositionAlloc1 = pos.Create ()->GetObject<PositionAllocator> ();
      adhocMobility.SetMobilityModel ("ns3::SteadyStateRandomWaypointMobilityModel",
                                      "MinSpeed", DoubleValue (double(0.01)),
                                      "MaxSpeed", DoubleValue (double(nodeSpeed)),
                                      //"MinPause", DoubleValue (pauseTime),
                                      //"MaxPause", DoubleValue (pauseTime),
                                      "MinPause", DoubleValue (double(pauseTime)),
                                      "MaxPause", DoubleValue (double(pauseTime)),
                                      "MinX", DoubleValue (double(0)),
                                      "MaxX", DoubleValue (double(xLength)),
                                      "MinY", DoubleValue (double(0.0)),
                                      "MaxY", DoubleValue (double(yLength)));
                                      //"PositionAllocator", PointerValue (taPositionAlloc1));
       }

      break;


2) The other issue I was facing was with the time slider and timing. I ran the simulation for 1000 seconds and made sure that the simulation was actually running for 1000 seconds but the netanim doesn't show animation beyond 69 seconds. Then I checked the group for similar issues and found that disabling packet trace could make it work. So I disabled packet trace and then rerun it but this time the animation was only until 112 seconds. 
I used  "void SkipPacketTracing ();" to skip packet tracing.
Also, I found out that the .xml file size is around 5.5 mb no matter the length of the simulation be 100 seconds or 1000 seconds. Is there any limit to the size of the .xml file that is being generated? Also if I'm making changes in the netanim source files the changes are not being reflected in the scenario. Am I missing something? By the way I'm using netanim 3.105 but I tried with 3.107 too but these issues persist.

Thank you for any help
Screenshot from 2018-02-28 18-34-04.png

Tommaso Pecorella

unread,
Mar 4, 2018, 12:19:37 AM3/4/18
to ns-3-users
Hi,

about the boundaries... no idea.

About the length of the animation, NetAnim stops recording when the output file gets too big. If you check in the documentation there's a way to increase this limit.

T.

Bhooshi Sandeep

unread,
Mar 5, 2018, 4:06:00 PM3/5/18
to ns-3-users
Hi Tom,
I suspected the same thing that there must have been some limit on the file size.
I tried to find a way to change the size of the xml file but I couldn't find any help in the documentation.
Is this the documentation you were referring to? https://www.nsnam.org/wiki/NetAnim_3.105
I also looked for the functions in https://www.nsnam.org/doxygen/group__netanim.html but couldn't figure out the function. Do you have any idea where I'm supposed to be looking at for changing the file size?

Thank you. 

Francisco Eduardo Balart Sanchez

unread,
Jun 10, 2018, 9:59:14 PM6/10/18
to ns-3-users
Good day Bhooshi:

  • At https://www.nsnam.org/docs/models/html/animation.html
  • Now if you check the classes wiki at: https://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html
    • you will find a very useful function
      • void ns3::AnimationInterface::SetMaxPktsPerTraceFile((uint64_t maxPktsPerFile))
    • Which is actually the current thing that stops the animation on the ns-allinone-3.25/ns-3.25/src/netanim/model/animation-interface.cc
      • void 
        AnimationInterface::CheckMaxPktsPerTraceFile ()
        {
          // Start a new trace file if the current packet count exceeded nax packets per file
          ++m_currentPktCount;
          if (m_currentPktCount <= m_maxPktsPerFile)
            {
              return;
            }
          NS_LOG_UNCOND ("Max Packets per trace file exceeded");
          StopAnimation (true);
        }

  • So on your test do the following
    •   // default max num of packets is 100000
        anim.SetMaxPktsPerTraceFile(500000);
        anim.EnablePacketMetadata (); // Optional
        anim.EnableWifiMacCounters (Seconds (0), Seconds (69)); //Optional
        anim.EnableWifiPhyCounters (Seconds (0), Seconds (69)); //Optional
        anim.EnableIpv4L3ProtocolCounters (Seconds (0), Seconds (69)); // Optional
        anim.EnableIpv4RouteTracking ("testEESOA_with_Routing_jun_02_2018_routing.xml",Seconds(0), Seconds(69), Seconds(1)); 
        Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
        Simulator::Stop (Seconds (70));
        Simulator::Run ();
        Simulator::Destroy ();

  • And you will get a very large xml file which will take a while to be parsed
    • balart40@balart40-VirtualBox:~/Desktop/balart40/ns/ns-allinone-3.25/ns-3.25$ ls -l --block-size=M le_wild_file.xml
      -rw-r--r-- 1 root root 38M jun 10 20:43 le_wild_file.xml

Hope it helps
By the way these are my specs in which this worked
  • ns3.25
  • Netanim: netanim-3.107
Best Regards

M.S. Francisco Eduardo Balart Sanchez
Reply all
Reply to author
Forward
0 new messages