How to put simulation scripts to project?

12 views
Skip to first unread message

Igor Plastov

unread,
Dec 19, 2025, 11:30:39 AM (2 days ago) Dec 19
to ns-3-...@googlegroups.com

NS-3 has utility create_module.py which can make a project containing several custom modules in a folder with the name of project.  I did this and  had added  "simulations"  directory with script, resulting tree:
   
my-custom-app
├── device-a
│   ├── CMakeLists.txt
│   ├── doc
│   │   └── device-a.rst
│   ├── examples
│   │   ├── CMakeLists.txt
│   │   └── device-a-example.cc
│   ├── helper
│   │   ├── device-a-helper.cc
│   │   └── device-a-helper.h
│   ├── model
│   │   ├── device-a.cc
│   │   └── device-a.h
│   └── test
│       └── device-a-test-suite.cc
├── device-b
│   ├── CMakeLists.txt
│   ├── doc
│   │   └── device-b.rst
│   ├── examples
│   │   ├── CMakeLists.txt
│   │   └── device-b-example.cc
│   ├── helper
│   │   ├── device-b-helper.cc
│   │   └── device-b-helper.h
│   ├── model
│   │   ├── device-b.cc
│   │   └── device-b.h
│   └── test
│       └── device-b-test-suite.cc
└── simulations
    ├── CMakeLists.txt
    └── run-simulation.cc

$ ./ns3 configure --enable-examples --enable-tests
and
$ ./ns3 build
are complete successfully, but
$ ./ns3 run "run-simulation"
does not find executable file since command:
$ find /home/igor/workspace_ns3.45/ns-allinone-3.45/ns-3.45/build -name "run-simulation*"
 successfully found it in the "build" directory. Answer looks like:
/home/igor/workspace_ns3.45/ns-allinone-3.45/ns-3.45/build/run-simulation

My goal is to encapsulate my custom modules and simulation scripts inside the project. What is the right way to do this?

Thanks,
Igor

-------------------------------------------------------------------------------

Tommaso Pecorella

unread,
Dec 19, 2025, 6:08:10 PM (2 days ago) Dec 19
to ns-3-users
You should have a directory like this:

contrib
└── myModule
    ├── CMakeLists.txt
    ├── doc
    │   └── myModule.rst
    ├── examples
    │   ├── CMakeLists.txt
    │   └── myModule-example.cc
    ├── helper
    │   ├── myModule-helper.cc
    │   └── myModule-helper.h
    ├── model
    │   ├── myModule.cc
    │   └── myModule.h
    └── test
        └── myModule-test-suite.cc


"device-a" and "device-b"  looks like they're two different modules (it might be ok, I'm not you).
About your simulation scripts, I'd make a 3rd module with empty directories except for the "examples" one.

OR you can collapse everything into a single module. 
Reply all
Reply to author
Forward
0 new messages