Help Needed with Flow Monitor Integration in ns-3.37 for VR App Simulation

82 views
Skip to first unread message

Nori

unread,
Dec 6, 2024, 6:12:28 AM12/6/24
to ns-3-users

Hello everyone,

I am working on a project using ns-3.37, specifically focusing on a VR application model in the contrib/vr-app module. I am attempting to integrate the Flow Monitor to collect metrics. However, I am facing issues during compilation and linking after adding the Flow Monitor functionality. The script and the error are attached.


Thanks in advance  

errormsg.txt
script.txt

Kent Huns

unread,
Dec 6, 2024, 8:43:29 AM12/6/24
to ns-3-users
I see FlowMonitorHelper is not correctly referenced even though you include "ns3/flow-monitor-helper.h", 
but I guess we need a little more information.

Am I correct that you are modifying Flowmonitor in a way other than appending new processes to an existing function?
Let me know how the modification is carried out. New function within an existing class? New class? Is it going to override? Is it written in a new file?

At least if you wrote source code with a new name, please check its name is written in CMakeList.
And maybe this is a problem with the class definition around the new feature. (This is entirely a guess.)

Thanks

Tommaso Pecorella

unread,
Dec 7, 2024, 5:53:48 AM12/7/24
to ns-3-users
You have to modify the CMakeLists.txt file in the contrib/vr-app/examples to add the right library (libflow-monitor) to the libraries linked to your example.

... and that's why you should move the scripts you modify to the scratch directory - as suggested in the tutorial.

Nori

unread,
Dec 7, 2024, 6:25:32 AM12/7/24
to ns-3-users
Thank you all for your replies. When I modify the CMakeLists.txt, it runs correctly, but no .xml file shows, only the pcap files. Moreover, when I moved scripts to the scratch directory, I got an error, which I attached. 
errorAfterScrachFolder.txt
script.v2

Tommaso Pecorella

unread,
Dec 7, 2024, 8:16:30 AM12/7/24
to ns-3-users
Both issues seem to be generated by the use of an AI, or by disregarding to read the tutorial and the manual. Or both.

Both issues have easy solutions, that any user that did read (at least) the tutorial would spot in no time.
Please try to fix them by yourself, or you'll not learn anything and you'll be replaced by an AI (or a plain python script) before you can say "sorry".

Kent Huns

unread,
Dec 7, 2024, 11:34:38 AM12/7/24
to ns-3-users
I thought the same thing... Please be sincere even if not knowledgeable.
(I read your script first. Do I have to read v2 again without any explanation of where you rewrote it? Despite my question being ignored?)

It's fine to keep your code secret because we're all professionals.
But my first comment is based on an experience.
I once encountered a similar issue, that was not only the problem of CMakeLists in my case.
Of course, I won't share it. Good luck.


Nori

unread,
Dec 7, 2024, 1:20:35 PM12/7/24
to ns-3-users
I am really new to ns-3 and I did not read the manual well, but I did not use AI, although I do not see a problem with that. I apologize if there was a misunderstanding. In any case, the problem still exists if there is anyone who wants to help.

Tommaso Pecorella

unread,
Dec 7, 2024, 3:47:23 PM12/7/24
to ns-3-users
I'll trust you somehow. But the answers below won't be pleasant, as they'll outline a few very basic mistakes.

Problem 1: the script doesn't run from the scratch directory.
Solution 1: you gave the command "./ns3 run scratch/vr-app/examples/trace-file-burst-application-example.cc", showing that either you did mistype the script name and path, or that you copied an entire folder into the scratch directory. Using sub-folders in the scratch directory is possible, and it is explained in the manual or tutorial (I don't remember where). In any case, this is needed only if you have a script split among multiple source files. If you don't, then the script should be placed in the scratch folder directly.

Problem 2: the xml file is not generated.
Solution 2: in your script YOU wrote:
  CommandLine cmd (__FILE__);
  cmd.AddValue ("traceFolder", "The folder containing the trace.", traceFolder);
  cmd.AddValue ("traceFile", "The trace file name.", traceFile);
  cmd.AddValue ("startTime", "The start time offset of the trace [s].", startTime);
  cmd.AddValue ("simTime", "Length of simulation [s].", simTime);
  cmd.Parse (argc, argv);

[...]

    // Allow the user to override any of the defaults and the above
    // DefaultValue::Bind ()s at run-time, via command-line arguments
  bool enableFlowMonitor = false;
  cmd.AddValue("EnableMonitor", "Enable Flow Monitor", enableFlowMonitor);
  cmd.Parse(argc, argv);

probably because you did copy-paste from another example without understanding what you did (coding means you do understand, or at least you try to).

The 1st "cmd.Parse (argc, argv);" prevents the 2nd to be executed, so you don't have the option "EnableMonitor" in the command line. The default value for "enableFlowMonitor" is false, so the behavior is to not use FlowMonitor.
This is pure and simple code reading.

Furthermore, I don't see in your logs you trying to use the command line option, so even if you'd fix the coding problem by removing the first " cmd.Parse (argc, argv);", you'd not be generating the FlowMonitor logs.
The correct way (or at least one of the correct ways) would have been "/ns3 run scratch/trace-file-burst-application-example.cc -- --EnableMonitor". Also this is explained in the tutorial and manual.

See? Mistakes that would have been prevented easily, by reading the code and by reading the documentation...
Reply all
Reply to author
Forward
0 new messages