Error Model in NS2

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Error Model in NS2 - Presentation Transcript

    1. Error Model 林 玲 玉 695430014 通訊工程所 指導教授 : 潘仁義教授
    2. Outline
      • Error model ( 有線 )
        • 介紹
        • 範例 ( 新增 ns2 核心模組 )
        • 小結
      • Install Wireless error model (2.28 => 2.30)
      • Wireless error model
      • 小考
    3. Introduction
      • Their definitions can be found in
        • ~ ns /queue/errmodel.{cc, h}
        • ~ ns /tcl/lib/ns-errmodel.tcl
        • ~ns/tcl/lib/ns-default.tcl
      • There are several other types of error modules not being completely documented yet.
    4. Introduction
      • SRMErrorModel, PGMErrorModel
      • ErrorModel/Trace
      • MrouteErrorModel
      • ErrorModel/Periodic
      • SelectErrorModel
      • ErrorModel/TwoState
      • ErrorModel/TwoStateMarkov,
      • ErrorModel/Expo,ErrorModel/Empirical
      • ErrorModel/List
    5. Implementation
      • Error model simulates link-level error or loss
        • Loss => Dump the packet to a drop-target.
        • Error => Mark the packet’s error flag.
        • ~ns2.30/common/packet.h
    6. Implementation
      • The Error model class is derived from Connector base class.
      • It inherits some methods for hooking up objects
        • target
        • drop-target
    7. Implementation
      • In TCL
        • unit : Specify the unit of error
          • time , pkt , bits
        • ranvar : Specify the random variable for generating errors
          • Uniform Distribution
        • rate : Specify error rate
          • error rate
      • IF not specify
        • Unit : packets
        • Random distributed from 0 to 1
    8. Implementation
      • Simple example
        • set error_model [new ErrorModel]
        • $ error_model set rate_ 0.01
        • $ error_model unit pkt
        • $ error_model ranvar [new RandomVariable/Uniform]
        • $ error_model drop-target [new Agent/Null]
      • 定義好 error_model ,就可以在需要的地方插入 error 了。
    9. Implementation
      • In C++, the Error Model contains both the mechanism and policy for dropping packets.
        • recv ( ) : packet dropping mechanism
        • corrupt ( ) : packet corrupting policy
      • The Error Model only implements a simple policy based on a signal error rate, either in packets of bits.
    10. Configuration
      • To use an error model for wired networks, at first it has to be inserted into a SimpleLink object.
      • An error model can be inserted to many places.
      • Simulator::lossmodel <em> <src> <dst>
        • $ns lossmodel $error_model $n0 $n1
    11. Example
    12. Example
      • 詳細參數設定
      • 修改 myfifo 檔案裡 queue 的程式碼,在 enque 中去統計有多少的封包進入了佇列 。
    13. Example ( 新增 ns2 核心模組 )
      • 1: 把 myfifo.{cc,h} 放進 ns-allinone-2.30/ns-2.30/queue
      • 的目錄下。
      • 2: 修改 myfifo.h 和 myfifo.cc
        • 先修改 myfifo.h
        • => 把所有 DropTail & drop_tail 改成 myfifo
        • 再修改 myfifo.cc
        • => 把所有 DropTail & drop_tail & drop-tail 改成 myfifo
    14. Example ( 新增 ns2 核心模組 )
      • 3: 修改 ns-default.tcl 檔,設定初始內定值。
        • 切到 ns-allinone-2.30/ns-2.30/tcl/lib / 目錄下
        • 打開 ns-default.tcl ,並利用搜尋功能找到 Queue/DropTail
        • 把每個初始值都再設一份給 Queue/myfifo
        • 變數初始值設定
    15. Example ( 新增 ns2 核心模組 )
      • 4: 修改 Makefile ,把 myfifo.o 加入 OBJ_CC 內,並重新編譯。
        • 切到 ns-allinone-2.30/ns-2.30 目錄下的 Makefile
        • 搜尋找到 drop-tail.o
        • 在 drop-tail.o 後面加上 queue/myfifo.o
    16. Example ( 新增 ns2 核心模組 )
      • 5: 重新編譯
        • Make clean
        • Make
      • 若是沒有錯誤,會如圖所示
    17. Example ( 新增 ns2 核心模組 )
      • 6: 測試一下新安裝的模組是否可以正常的運作。
      • 把剛剛的範例 DropTail 修改成 myfifo
    18. Example-Result
      • packet loss rate = (14881 - 14568) ÷ 14881 = 0.0210
      • ~ error rate = 0.02
    19. 小結
      • 新增模組到 ns2 的核心步驟 :
      • 1. 準備好模組檔 ( 例如, a.cc 和 a.h) 。
      • 2. 若有需要做初始設定的話,修改 ns-default.tcl 檔。
      • 3. 修改 Makefile ( 把 a.o 加到 OBJ_CC 內 )
      • 4. 重新編譯
      • 5. 測試模組
    20. 安裝 Wireless Error Model
      • 環境
        • Linux core4
        • NS2-2.30
      • 網路上 release 的模組是 2.28 版本,必須找出不同的地方並修改,才可裝進 2.30 版本。
    21. 安裝 Wireless Error Model
      • 1: 安裝 noah
        • a. 修改 Makefile.in , 在以下的地方,加入下列指令
      • 在 OBJ_CC 加入 noah/noah.o
      • 在 NS_TCL_LIB 加入 tcl/mobility/noah.tcl
        • b. 在 ns-2.30 目錄下新建一個 noah 資料夾,並將 noah.h 與 noah.cc
        • 檔案放入其中
        • c. 再把 noah.tcl 放到 tcl/mobility 內
        • d. 用 vim 編輯 tcl/lib/ns-lib.tcl 檔案,在下面不同地方加入程式碼
    22. 安裝 Wireless Error Model
      • 2: 編輯完成後,回到 ns-2.30 目錄下,依序做以下指令 :
        • ./configure
        • Make clean
        • Make
        • 編譯完無錯誤即可
    23. 安裝 Wireless Error Model
      • 3: 把 forwarder.cc, forwader.h 放到 ~ns2.30/mac 的目錄下
      • 並修改 wireless-phy.cc & wireless-phy.h 。
        • 先修改 wireless-phy.h
        • 再修改 wireless-phy.cc
    24. 安裝 Wireless Error Model
    25. 安裝 Wireless Error Model
      • 4: 再把 ns-mobilenode.tcl 放到 tcl/lib 目錄下
      • 5: 修改 Makefile.in, 在 OBJ_CC 加入 mac/forwarder.o
      • 6: 依序做以下指令
        • ./configure
        • Make clean
        • Make
      • 7: 進行測試
    26. Wireless Error Model
      • 分散型遺失
        • Random uniform model
      • 連續型遺失
        • Gilbert-Elliot (GE) model
    27. Wireless Error Model
      • In NS2
      • 修改 mac/wireless-phy.cc
    28. Gilbert-Elliot (GE) model
      • In the “good” state ( G ) losses occur with low probability
      • Iin the “bad” state ( B ) they happen with high probability
      • The steady state probabilities of being in states G and B are
      • and
      • The average packet loss rate produced by the Gilbert channel is
    29. Simulation Topology (example)
    30. 執行方法 ( 以 run_ge_error 為例 )
      • $./run_ge_error
    31. Result – GE model 0.2860 0.7 0.2460 0.6 0.2060 0.5 0.1660 0.4 Simulated p (%)
    32. Reason IN steady state, The state probability in steady state,
    33. 抽考
      • error_ 設定為 0.1
    34. Reference
      • The ns Manual ( Chapter 13 Error Model)
      • NS2 教學手冊 ( NS2 Learning Guide)
        • Error Model

    + fangvvfangvv, 11 months ago

    custom

    1922 views, 0 favs, 0 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1922
      • 1922 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 51
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories