1 / 21

實驗 ( 四 ) 學習 NS-2 的亂數產生器

實驗 ( 四 ) 學習 NS-2 的亂數產生器. 計算機網路 COMPUTER NETWORK. 實驗步驟. 了解亂數產生數定義 了解設定分佈,課本程式碼內容 學習如何使用 NSG 製作成 TCL 檔 學習如何撰寫 TCL 檔 實作應 用. 定義. 亂數產生數 種子 (seed) & 分佈 (distribution) 設定種子 set rng [new RNG] $ rng seed 1 這段須放在 TCL 檔裡. 控制. 分佈介紹 1.

Download Presentation

實驗 ( 四 ) 學習 NS-2 的亂數產生器

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 實驗(四)學習NS-2的亂數產生器 計算機網路 COMPUTERNETWORK

  2. 實驗步驟 • 了解亂數產生數定義 • 了解設定分佈,課本程式碼內容 • 學習如何使用NSG製作成TCL檔 • 學習如何撰寫TCL檔 • 實作應用

  3. 定義 • 亂數產生數 種子(seed) &分佈(distribution) • 設定種子 set rng [new RNG]$rng seed 1 這段須放在TCL檔裡 控制

  4. 分佈介紹1 • Pareto Distribution : 需提供expectation(avg_)和shaper parameterβ(shape_)參數範例程式如下: set r1 [new RandomVariable/Pareto]$r1 use-rng $rng$r1 set avg_ 10.0$r1 set shape_ 1.2

  5. 分佈介紹2 • Constant Distribution:要提供平均值(avg_)參數,範例程式如下: set r2 [new RandomVariable/Constant]$r2 use-rng $rng$r2 set avg_ 5.0

  6. 分佈介紹3 • Uniform Distribution:要提供最小值(min_)和最大值(max_)參數,範例程式如下: set r3 [new RandomVariable/Uniform]$r3 use-rng $rng$r3 set min_ 0.0$r3 set max_ 10.0

  7. 分佈介紹4 • ExponentialDistribution:要提供平均值(avg_)參數,範例程式如下: set r4 [new RandomVariable/Exponential]$r4 use-rng $rng$r4 set avg_ 5

  8. 分佈介紹5 • HypereExponentialDistribution:要提供平均值(avg_)參數,範例程式如下: • set r5 [new RandomVariable/HyperExponential]$r5 use-rng $rng$r5 set avg_ 1.0$r5 set cov_ 4.0

  9. 作業(前提工作) • Lab4_2.tcl(http://goo.gl/IbQggJ) 依程式碼裡面的註解,了解程式涵義 • 4_2.awk(http://goo.gl/WYljlJ) 用法同實驗(三)awk檔

  10. The Network Topology

  11. R1和R2是路由,當中的Link是採用DropTail的佇列管理機制,頻寬為1Mbps,傳遞延遲為10ms,S1、S2、S3到D1、D2、D3之間有三條FTP資料流,資料流起始時間由亂數決定,但限制在0~1秒之間,且每條資料流都會傳送5秒R1和R2是路由,當中的Link是採用DropTail的佇列管理機制,頻寬為1Mbps,傳遞延遲為10ms,S1、S2、S3到D1、D2、D3之間有三條FTP資料流,資料流起始時間由亂數決定,但限制在0~1秒之間,且每條資料流都會傳送5秒 • Throughput:單位時間內,所有目的節點的平均接收資料速度 • Throughput = (某段時間內,所有目的節點的平均接收資料量) ÷(統計的這段時間)

  12. 作業 • 撰寫一個TCL程式搭配AWK程式 去記錄在不同的分配下的吞吐量 並完成下幾頁表格 Ex: $ns XXXX.tcl (XXXX為你所撰寫的TCL檔) 會產生out.tr $awk –f 4_2.awk out.tr 再利用awk程式檔去跑所產生的out.tr檔 取得throughput

  13. 作業 一、在不同分配下,不同seed,Throughput(吞吐量)的差別 Pareto distribution Constant distribution

  14. 作業 Exponential distribution Uniform distribution

  15. 作業 HyperExponential distribution

  16. 作業 • 二、請把FTP的資料流的數目調整成7、12、22、32條 Pareto ditribution Constant ditribution

  17. 作業 Uniform distribution Exponential distribution

  18. Hyperexponential distribution

  19. TCL way1 way2 使用NSG2去建立網路拓譜 產生TCL檔 修改、撰寫TCL檔 作業完成 • 使用Lab4_2.tcl程式碼修改 了解Lab4_2程式碼 修改TCL檔 撰寫TCL檔(加入分佈) 作業完成

  20. HINT • Pareto Distribution $r1 set avg_ 0.1 $r1 set shape_ 5.0 • Constant Distribution $r2 set avg_ 5.0 • Uniform distribution $r3 set min_ 0.0 $r3 set max_ 1.0 • Exponential distribution $r4 set avg_ 0.1 • Hyperexponential distribution $r5 set avg_ 0.1 $r5 set cov_ 1.0

  21. 作業 • Doc檔上,須說明: • 封面(班級、學號、姓名) 檔名範例:Hw3_498410561_張建雄 • 第一題5個表格 • 第二題5格表格 • TCL程式碼 • Terminal在執行$awk結果之截圖 附一張即可 • 心得 若有問題請e-mail給助教

More Related