怎样在ns3中添加一个新模块

  1. 在终端切换到ns3.37目录下,输入
./utils/create-module.py new-module

2.

$ cd new-module
$ ls
doc examples  helper  model  test  CMakeLists.txt

 3.

src/
  new-module/
    doc/
  new-module.rst
examples/
  new-module-example.cc
  CMakeLists.txt
helper/
  new-module-helper.cc
  new-module-helper.h
model/
  new-module.cc
  new-module.h
test/
  new-module-test-suite.cc
CMakeLists.txt

4.编写Cmake文件

build_lib(
  LIBNAME new-module
  SOURCE_FILES helper/new-module-helper.cc
               model/new-module.cc
  HEADER_FILES helper/new-module-helper.h
               model/new-module.h
  LIBRARIES_TO_LINK ${libcore}
  TEST_SOURCES test/new-module-test-suite.cc
)

example中的cmake 

set(source_files
  helper/adhoc-aloha-noack-ideal-phy-helper.cc
  helper/spectrum-analyzer-helper.cc
  helper/spectrum-helper.cc
  ...
)

set(header_files
  helper/adhoc-aloha-noack-ideal-phy-helper.h
  helper/spectrum-analyzer-helper.h
  helper/spectrum-helper.h
  ...
)

build_lib(
  LIBNAME spectrum
  SOURCE_FILES ${source_files}
  HEADER_FILES ${header_files}
  LIBRARIES_TO_LINK ${libpropagation}
                    ${libantenna}
  TEST_SOURCES
    test/spectrum-ideal-phy-test.cc
    test/spectrum-interference-test.cc
    test/spectrum-value-test.cc
    test/spectrum-waveform-generator-test.cc
    test/three-gpp-channel-test-suite.cc
    test/tv-helper-distribution-test.cc
    test/tv-spectrum-transmitter-test.cc
)

 5.配置和构建

$ ./ns3 configure --enable-examples --enable-tests
$ ./ns3 build
$ ./test.py

 

  • 6
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值