zoukankan      html  css  js  c++  java
  • NS3-新增模块和调试

    本周,应老师要求,为NS3新增lorawan-classB的模块。

    模块的github地址:https://github.com/ConstantJoe/ns3-lorawan-class-B/tree/master/lorawan

    下面是碰到的问题和经验总结。

    1.如何在NS3.29中添加模块

    To install this module, you should do as follow:
    1. Download ns-3 latest version (ns-3-27) at [ns-3 main page](https://www.nsnam.org/ns-3-27).
    2. Extract ns-allinone-3.27.tar.bz2 file.
    3. Download ns3 lora module, then copy it ./src folder inside ns-allinone-3.27 folder.
    4. Run three next statements to build source code:
    ```
    	~/ns-allinone-3.27/ns-3$ ./waf clean
    	~/ns-allinone-3.27/ns-3$ ./waf configure --enable-tests --enable-examples
    	~/ns-allinone-3.27/ns-3$ ./waf build	
    ```
    
    ## Running the tests and examples
    
    To test ns3 lora module, you run this statement:
    ```
    	~/ns-allinone-3.27/ns-3$ ./test.py -s lora-node -m -t lora-node.txt
    ```
    To run example of ns3 lora module, you run this statement:
    ```
    	~/ns-allinone-3.27/ns-3$ ./waf --run lora-example
    来源 :https://github.com/drakkar-lig/lora-ns3-module/blob/master/README.md

    2.新装模块时碰到的问题
    1.build过程中报错
               lorawan/helper/lorawan-helper.cc:215:66: error: ‘DLT_LORATAP’ is not a member of ‘ns3::PcapHelper’
    PcapHelper::DLT_LORATAP);
              因为使用的是C++编程语言,我对这方面了解很少(本科时候的欠账呀)。 一开始盲目去谷歌搜索(不得不说,谷歌在这方面是最好用的搜索引擎了)找不到相关信息。
              后来,静下心来,查看源文件   lorawan/helper/lorawan-helper.cc:, 215gg,定位到报错位置。发现作者细心的写了注释。 PcapHelper:: DLT_LORATAP, 而后定位类PcapHelper 位置 :ns-3.29/build/ns3/tracer_helper.h. 根据注释,新增DLT_LORATAP = 270 解决问题。
              经验 :报错了要去查看源文件,不盲目搜索
     
     
    2.而后使用 ./waf --run 命令运行该模块中的example
    碰到了一连串的问题,安装eclipse,在这个软件里编译和运行ns3模块,各个函数之间的依赖关系变得直观了。
    ns3联合eclipse的安装方法(亲测可用):
    http://blog.sina.com.cn/s/blog_5584ff150102yixl.html
      如果碰到找不到路径的问题,请仔细确认,是使用绝对路径还是相对路径。
      那篇博客中的在我的eclipse june 2018(4.8.0)中未找到,暂时没发现影响。

     目前实现了对example中error问题的定位,具体的错误原因还待继续确定。。。。

     
     
     
     
     
     
    具体碰到的问题:
    NS版本 3.28 ,解决方法同3.29
     问题:lorawan/helper/lorawan-helper.cc:215:66: error: ‘DLT_LORATAP’ is not a member of ‘ns3::PcapHelper’
    PcapHelper::DLT_LORATAP);
     
    解决方法 :在ns-allinone-3.28/ns-3.28/build/ns3/tracer_helper.h  line 61中新增  DLT_LORATAP = 270
     
    运行example时, 3.28和3.29有相同的问题
    不能运行的example
    0. lorawan-error-distance-plot.cc 
    问题 : 找不到该模块  解决方法 在lorawan/examples/wscript 里将该example加进去
    新问题:1. compling出错, 定位问题: lorawan-error-distance-plot.cc  line58  函数LoRaWANErrorDistanceCallback  的参数LoRaWANDataIndicationParams’ was not declared in this scope
     
     
      1, 3 有相同的问题
    1.lorawan-unconfirmed-data-up-example.cc   报错位置 :line104
     
    定位文件位置 
    /ns-allinone-3.29/ns-3.29/build/ns3/callback.h   line 1449, traced-callback.h, line=280 
     
    msg="Incompatible types. (feed to "c++filt -t" if needed)
    got=CallbackImpl<void,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,ns3::Time,ns3::LoRaWANPhyEnumeration,ns3::LoRaWANPhyEnumeration>
    expected=CallbackImpl<void,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,ns3::LoRaWANPhyEnumeration,ns3::LoRaWANPhyEnumeration>", file=./ns3/callback.h, line=1449
    msg="when connecting to phy0", file=./ns3/traced-callback.h, line=280
    terminate called without an active exception
     
    3.lorawan-simultaneous-unconfirmed-data-up-example
     
    msg="Incompatible types. (feed to "c++filt -t" if needed)
    got=CallbackImpl<void,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,ns3::Time,ns3::LoRaWANPhyEnumeration,ns3::LoRaWANPhyEnumeration>
    expected=CallbackImpl<void,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,ns3::LoRaWANPhyEnumeration,ns3::LoRaWANPhyEnumeration>", file=./ns3/callback.h, line=1449
    msg="when connecting to phy0", file=./ns3/traced-callback.h, line=280
    terminate called without an active exception
     
     
    2.  lorawan-phy-example.cc   跑到 run时 报错000
    LoRaWANPhy:LoRaWANPhy(0x7fffc91a5560, 0)
    LoRaWANPhy:ChangeTrxState(): 0x7fffc91a5560 state: 0 -> 0
    LoRaWANPhy:ChangeTrxState(): 0x7fffc91a5560 state: 0 -> 0
    LoRaWANPhy:LoRaWANPhy(0x7fffc91a5560, 0)
    LoRaWANPhy:ChangeTrxState(): 0x7fffc91a5560 state: 0 -> 0
    LoRaWANPhy:ChangeTrxState(): 0x7fffc91a5560 state: 0 -> 0
    SingleModelSpectrumChannel:SingleModelSpectrumChannel(0x562edfd9bcf0)
    SingleModelSpectrumChannel:GetTypeId()
    LoRaWANPhy:SetChannel(0x562edfda74c0, 0x562edfd9bcf0)
    LoRaWANPhy:SetChannel(0x562edfda76b0, 0x562edfd9bcf0)
    SingleModelSpectrumChannel:AddRx(0x562edfd9bcf0, 0x562edfda74c0)
    SingleModelSpectrumChannel:AddRx(0x562edfd9bcf0, 0x562edfda76b0)
    LoRaWANPhy:SetMobility(0x562edfda74c0, 0x562edfd8cb90)
    LoRaWANPhy:SetMobility(0x562edfda76b0, 0x562edfd8e510)
    LoRaWANPhy:SetSetTRXStateConfirmCallback(0x562edfda74c0)
    LoRaWANPhy:SetSetTRXStateConfirmCallback(0x562edfda76b0)
    LoRaWANPhy:SetTRXStateRequest(0x562edfda74c0, 3)
    LoRaWANPhy:SetTRXStateRequest(): Trying to set m_trxState from 0 to 3
    LoRaWANPhy:ChangeTrxState(): 0x562edfda74c0 state: 0 -> 3
    At: +0.0ns Received Set TRX Confirm: 3
    LoRaWANPhy:SetTRXStateRequest(0x562edfda76b0, 2)
    LoRaWANPhy:SetTRXStateRequest(): Trying to set m_trxState from 0 to 2
    LoRaWANPhy:ChangeTrxState(): 0x562edfda76b0 state: 0 -> 2
    At: +0.0ns Received Set TRX Confirm: 2
    LoRaWANPhy:SetPdDataIndicationCallback(0x562edfda76b0)
    At: +1000000000.0ns Sending one frame
    LoRaWANPhy:PdDataRequest(0x562edfda74c0)
    LoRaWANPhy:PdDataRequest(): 0x562edfda74c0 m_trxState = 3
    LoRaWANPhy:CalculateTxTime(0x562edfda74c0)
    LoRaWANPhy:CalculateTxTime(): 0x562edfda74c0: 12|0|10|0|16|8|663552uS
    SingleModelSpectrumChannel:StartTx(0x562edfd9bcf0, 0, +663552000.0ns, 0x562edfda74c0)
     
     
    assert failed. cond="txParams->psd", msg="NULL txPsd", file=../src/spectrum/model/single-model-spectrum-channel.cc, line=86    terminate called without an active exception
     
    定位 single-model-spectrum-channel.cc 
    void singleModelSpectrumChannel :: StartTx(Ptr(<SpectrumSignal))
     
     
     
     
    Command ['/home/zyh/softwares/ns-allinone-3.29/ns-3.29/build/src/lorawan/examples/ns3.29-lorawan-phy-example-debug'] terminated with signal SIGIOT. Run it under a debugger to get more information (./waf --run <program> --command-template="gdb --args %s <args>").http://blog.sina.com.cn/s/blog_5584ff150102yixl.html
     
  • 相关阅读:
    1.6(设计模式)过滤器模式
    1.5(设计模式)单例模式
    1.4(设计模式)原型模式
    获取第几周
    前端的一个工具函数库
    纯css实现宽度自适应,高度与宽度成比例
    网站前面的图标
    从url获取参数有中文时会出现乱码的问题
    关于ios使用jquery的on,委托事件失效
    在vue1.0遇到vuex和v-model的坑
  • 原文地址:https://www.cnblogs.com/zyhe/p/10592795.html
Copyright © 2011-2022 走看看