2008年3月14日 星期五

實驗五 無線網路封包傳輸遺失模型

這個實驗討論無線網路封包傳輸遺失模型,在無線通道部分採用Gilbert-Elliott模型 (GE model)
  1. J. P. Ebert, A. Willing, A Gilbert-Elliot Bit Error Model and the Efficient Use in Packet Level Simulation, Technical Report, TKN-99-002, Technical University of Berlin, March 1999.
  2. H. S. Wand, N. Moayeri, Finite state morkov channel - a useful model for radio communication channel, IEEE Trans. on Vehicular Tech., 44 (1), 163-171, Feb. 1995.
另外關於NS2的重點部分有:
  1. 如何修改現有的模組,加入自己需要的功能
  2. 如何設計具有兩個或兩個以上的位址空間的網路

作者直接修改了wireless-phy.cc 和 wireless-phy.h這兩個檔案 (class WirelessPhy),另外一種方式是由WirelessPhy衍生下一個類別,不過如過是這樣做還需要再產生相對應的Otcl linkage, 程序上是比較複雜不過可在用性與程式的擴充性會比較好。

wireless-phy.cc 和 wireless-phy.h這兩個檔案放在C:\cygwin\home\hhliu\ns-allinone-2.29\ns-2.29\mac目錄下,很容易可以找到。目錄下面有保留原始的檔案,可以拿來做比較。

加入的程式碼我可以找到的部分如下(紅色字體部分):

wireless-phy.h
wireless-phy.cc

另外關於定址的部分,Tcl程式碼如下:

#若模擬的環境,是單純的有線網路,或無線網路,定址的方是使用flat即可(default設定)
#但是若包含了有線網路和無線網路,則就需要使用hierarchial addressing的方式定址
[ref]
$ns_ node-config -addressType hierarchical

#設定有兩個domain(第一個domain是有線網路,第二個是無線網路)
AddrParams set domain_num_ 2 ; # AddrParams 是類別名稱
# Class AddrParams is used to store the topology hierarchy like number of levels of hierarchy,
# number of areas in each levellike number of domains, number of clusters and number of nodes
# in each cluster.

#每個domain各有一個cluster(每一個domain只包含一個子網路)
lappend cluster_num 1 1
AddrParams set cluster_num_ $cluster_num

#而在第一個domain,其第一個cluster中,只有一個有線網路節點#而在地二個domain,其第一個cluster中,會有兩個無線網路節點,基地台算無線節點
lappend eilastlevel 1 2
AddrParams set nodes_num_ $eilastlevel

這個部份的程式說明還是先擱置,以後再說明。

實驗結果:

Scenario 1.
PG = 0.2, loss-model = 0, comm_type = 0 (multicast)

packet loss ratio = (12350 - 12349) / 12350 = 8.1 e-5, 這個結果和課本呈現的差很多。

再跑一次,結果一樣 =.=?

Scenario 2.

packet loss ratio = (12350 - 12350) / 12350 = 0, ====> 看來問題大了

Scenario 3

packet loss ratio = (12350 - 12350) / 12350 = 0, ====> >.<"

是什麼原因造成的錯誤我先暫時不去debug了,請執行看看如果結果跟我的一樣後續再來抓bug。

沒有留言: