Skip to content

bit-oh-my-god/ns3-dtn-bit

Repository files navigation

Preface

This Project is a newbie-friendly simulation for dtn on ns-3 environment, easy to use for research purples, supporting customed routing definition and scenario definition.

This project is inspirited by Lakkakorpi

Read this teg-paper if you want know about TEG(time-expanded graph)

Read this paper link if you want know about CGR

Begin

  1. Download source code, ns-allineone-3.26 under this directory(or make softlink) and make sure you can usens3

  2. Copy ./box/ns2mobilityhelper.cc to ./ns-allineone-3.26/ns-3/src/mobility/helper, this file was modified and would help us parse 3d-motion

  3. Modify your current_trace.tcl by your hand or by ./box/WriteTraceFileLib.py

  4. Set node_number and simulation_time ./box/PrepareSim.py and your-example.cc, must equal to your current_trace.tcl

       // in ./box/PrepareSim.py
       T_max = 802                #change me !!!!!!!
       teg_slice_n = 802          #change me !!!!!!!
    
       // in ns3dtn-bit-your-example.cc
       node_number_ = 5;           // change me!!
       simulation_duration_ = 802;         // change me!!!
    
  5. Run ./box/PrepareSim.py to make animation and generate teg.txt

  6. Modify ns3dtn-bit-your-example.cc to set simulation settings, see example-interface

  7. Make sure you have your teg.txt current_trace_file yourexample.cpp done. Then run ./build.sh to build(not run)

  8. Run ./run_loops.sh and would parse your result and write them into a json file

  9. Run ./box/MakeGraphByJson.py to get graph

structure of this project

  • editor tool : editor Vim do I use, if you are using YCM for code complete, remember add pull path of include to ~/.ycm_extra_config.py

  • ns3 example-interface This file defines how your scenario structed, how your network configured. Make sure that simulation time should be equal to time of teg.txt. Note that time-interval of two lines of teg.txt is exactly ** one second ** in real time, which was descripted in current_trace_file.tcl

  • ns3 and ns3-dtn-bit module The main methods for DtnApp are 1. checkbuffer - totransmit 2. receive bundle 3. sendhello - receive hello. We modify ns2-mobility-helper.cc, to support 3d-parse for us. you can find it at /box

  • jupyter and python-matplotlib There is one tutorial that I think may help you ref. This combo is used to make graph and paper, check /box/jupyter. If you want use jupyter yourself, install it on org-web, in China, you may not be able to download 0.5 G big file from the web, so it's highly recommanded to install miniconda first, and install full-package from miniconda, that's the way I did.

  • Acknoeledgement Annoucement, How does this model works.

    • transmit & send

        following graph are used to name variables in this project
        source_node         from_node               to_node           destination_node
            |                   |                       |                   |
            |                   |                       |                   |
            |                   |                       |                   |
            ()                  ()                      ()                  ()
            
            *-------------------------------------------------------------> *
                    this is called "send"
            *-----------------> * --------------------> * ----------------> *
                    this is called "transmition & retransmition"
                    note : "store and forward" is just semantic
      
        ack--->
        bundel---->     SocketSendDetail()
        anti-pkt----> 
      
        hello---->  CreateHelloBundleAndSendDetail()
      
    • If you want to modify code read code directly, everything is in content.

TODO list

  • wireless max range done by wifiChannel.AddPropagationLoss ("ns3::RangePropagationLossModel",
    "MaxRange", DoubleValue (4000.0));

  • note that ns2mobilityhelper only have ability to parse velocity 2d, extend it to support 3d done by modify it, copy /box/ns2-mobilityhelp to src/mobility/helper to use it. would support '$ns at $time $node setdest x2 y2 z2 speed' format, and this format only.

  • relative path done by config.txt

  • transmit session done by transmit_assister_

  • time extented graph like that paper done by Adob_do02 Adob_do03

  • to work :(
  • to have a life
  • CGR, main feature, implement it!
  • running log was printed twice, more specifically NS_LOG_COMPONENT was printed out twice, it's a bug, fix it! we don't want to fix this bug because jupyter parse script has depends on this bug
  • relative path for script
  • last seen neighbor, should be 1 * Hello Interval or 2 * Hello Interval
  • give some senario, and give some result parse script
  • unordered_map with tuple, bug fix
  • retransmission : For now we don't have local2neighbor retransmission. What we have is that, if one transmission session is not successed, this session would be remained, and reboot next time when routing decision is made by which transmission session producted had the same 'session value', where normally results to a new transmission session. Problem is that sprayandgood(), used for control transmit times, would block next time pkt check.
  • hello range is bigger than bundle range
  • routing decision bug
  • doing some optimal for CGR to reuse successive result, to speed up simulation time.
  • fatal bug !! CGR would fall into a deep recursive in group moving senario. This backtracking algorithm would decay into brute force in this senario, which have a complexity of O(M * logN * N!) which N is amount of nodes that can have a link to each other at same time-window, M is the amount of time-windows. This may happen, because CGR has a assumption of topology it was applied on, a topology graph with density of sparseness not density of tightness. Read 'Analysis of the contact graph routing algorithm Bounding interplanetary paths 5.6 section'