Flow Monitor - ns3
Flow monitor is a powerful too that identifies the performance characteristics of networks
Flow Monitor
#flowmonitor #ns3 #nsnamcom
Already there are some examples within ns3. We will be using one example called as third.cc
and another example called as manet-routing-compare.cc
Download all the source Codes here:
https://drive.google.com/drive/folders/14B7QtvAgaiDvBtf-cn8R_mseUYorWkRN?usp=sharing
Step 1: Copy the above files from examples/tutorial/third.cc and move it to scratch/ folder
Copy manet-routing-compare.cc from examples/routing/ and move it to scratch/
Step 2: Include the code relevant for flow monitor.
There are two header files to be included
#include "ns3/flow-monitor.h"
#include "ns3/flow-monitor-helper.h"
Include the following lines above the Simulator::Stop()
// Flow monitor
PtrFlowMonitor flowMonitor;
FlowMonitorHelper flowHelper;
flowMonitor = flowHelper.InstallAll();
include the follwing line after the Simulator::Run()
flowMonitor-SerializeToXmlFile("third.xml", true, true);
Step 3: Run the example
$] ./waf --run scratch/third
Check for the third.xml file that was created using flow monitor.
To process this file, we need to search within ns3 for a parsing file.
/home/pradeepkumar/ns-allinone-3.27/ns-3.27/src/flow-monitor/examples/flowmon-parse-results.py
We can copy this file to the location where the third.xml file is created or generated. ~ns-3.27/
Step 4: PArse this file using the command given below
Parsing and plotting using python script (Matplotlib)
https://www.nsnam.com
Step 5: flow.py which was generated manually for parsing the flowmonitor xml file.
Now With Complicated Example:manet-routing-compare.cc
We will be generating file called pradeepflow.flomon in the above example
To see more about the source code and the explnation follow this link or see the descirption ()
$] ./waf --run scratch/manet-routing-compare
please follow my channel and recommend to your firends.
Тэги:
#ns2 #ns3 #pradeepkumar #nsnamcom #engineering_clinic #engineering #network_simulation #Internet_of_Things #IoT #flowmonitor #network_simulator_3