• 沒有找到結果。

第四章 模擬與實作

第一節 模擬實驗

本節我們將針對第三章所提出的三種演算法做模擬實驗,並分別對它的效能 進行評估,演算法 1 中,我們將呈現在各種距離的情形下隨時間的成功率變化,

演算法 2-1 與 2-2 則是藉由調整 window size 和 threshold 來呈現它的偵測靈敏度和 誤判率,是一種 trade off 的問題

 The simulation Algorithm 1

以下的模擬實驗,其訊號強度採用常態分配的隨機變數,常態分配內的帄均 值與距離的關係採用 Fig.2-5 的數據來建立模組,標準差與距離的關係採用 Fig.2-6 的數據來建立模組。

Table 2. Algo.1 的模擬實驗設置(室內)

模擬實驗設置

時間槽 300

實驗次數 1000

模擬環境

Indoor

LoS 傳輸模型 𝑓𝐿(𝑥) = 1052.296−𝑥13.88 𝑔𝐿(𝑥) = 0.0083𝑥 + 3.1686 在距離=x 時的 LoS 樣本 X 分配

X~N(𝑓𝐿(𝑥), 𝑔𝐿(𝑥)) NLoS 傳輸模型 𝑓𝑁(𝑥) = 1047.999−𝑥12.993 𝑔𝑁(𝑥) = −0.0037𝑥 + 3.4442 在距離=x 時的 NLoS 樣本 X 分配

在 Table 2 這個模擬實驗中,我們假定使用者距離基地台固定距離並且不轉 動,在每個時間槽,系統都會猜測目前的傳輸狀況,x 軸代表實驗經過的時間槽,

而 y 軸的精確度便是全部模擬實驗內猜中傳輸模式的比例。Fig.4-1 實際上是 LoS 傳輸,從圖中可知,系統猜 LoS 的比例隨著接收時間增加而有略為成長,這一現 象是由於當樣本數較多時,樣本標準差會更趨近於預設的模組,所以在判別上成 功率相對增加。值得注意的是,成功率並非和距離成反比的關係,例如 Fig.4-1 中的 40 公尺其成功率則高於 20 公尺,原因則是出在 SNR 值的帄均所對應到的兩 種可能標準差,與真實標準差的差距大小,當差距過小時,則系統較不易判斷。

Fig.4-2 則是實際傳輸模式為 NLoS 的情形。

Figure 4-1.The hit percentage of the simulation Algo.1 in LoS communication.

30%

40%

50%

60%

70%

80%

0 100 200 300

hit percentage

time slot

10m LoS 20m LoS 40m LoS

Figure 4-2.The hit percentage of the simulation Algo.1 in NLoS communication.

Figure 4-3. The hit percentage of the simulation Algo.1 in LoS communication.

Figure 4-4. The hit percentage of the simulation Algo.1 in NLoS communication.

50%

60%

70%

80%

90%

100%

0 100 200 300

hit percentage

time slot

10m LoS 20m LoS 40m LoS

50%

60%

70%

80%

90%

100%

0 100 200 300

hit percentage

time slot

10m NLoS 20m NLoS 40m NLoS

 The simulation Algorithm 2-1

Table 4. Algo.2-1 的模擬實驗設置(室內)

模擬實驗設置

時間槽 400

實驗次數 10000

模擬環境

Indoor

變動時間槽 200th

LoS 傳輸模型 𝑓𝐿(𝑥) = 1052.296−𝑥13.88 𝑔𝐿(𝑥) = 0.0083𝑥 + 3.1686 在距離=x 時的 LoS 樣本 X 分配

X~N(𝑓𝐿(𝑥), 𝑔𝐿(𝑥)) NLoS 傳輸模型 𝑓𝑁(𝑥) = 1047.999−𝑥12.993 𝑔𝑁(𝑥) = −0.0037𝑥 + 3.4442 在距離=x 時的 NLoS 樣本 X 分配

X~N(𝑓𝑁(𝑥), 𝑔𝑁(𝑥))

在 Table 4 這個模擬實驗中,我們假定使用者距離基地台固定距離並且會轉動一 次,分為兩種轉動(1)LoS 轉 NLoS (2)NLoS 轉 LoS。回顧之前判斷的法則,經過 moving average 轉換後的資料中,當兩個時間槽距離一個 window size 時,其差距 大於一個 threshold 的𝜌倍,系統便判定有轉身行為出現。我們令 x 軸為 window size 的大小,分別從 4 到 40,而 y 軸代表成功命中次數之百分比,也就是當轉身行為 發生時,在轉身行為產生之前後半個 window size 大小的時間槽內,系統正確的 判斷其是(1)或(2);這邊定義誤判的規則為:當非在轉身行為產生之前後半個 window size 大小的時間槽內,若系統回報出(1)或(2),則代表此次實驗誤判,或

其符合上述情形的百分比。Fig.4-5 到 Fig.4-11 為 LoS 轉 NLoS 的情形,而 Fig.4-12 到 Fig.4-18 是 NLoS 轉 LoS 的情形。

LoS→NLoS

Figure 4-5.The hit percentage of the simulation Algo.2-1 with 𝜌=1

Figure 4-6.The hit percentage of the simulation Algo.2-1 with 𝜌=0.8

0%

10%

20%

30%

40%

4 10 16 22 28 34 40

10m 20m 40m

window size

h it p er ce n ta ge

30%

40%

50%

60%

70%

4 10 16 22 28 34 40

10m 20m 40m

window size

h it p e rc e n ta ge

Figure 4-7. The hit percentage of the simulation Algo.2-1 with 𝜌=0.6

Figure 4-8. The error percentage of the simulation Algo.2-1 with 𝜌=1

60%

window size

h it p er ce n ta ge

window size

e rr o r p e rc e n ta ge

Figure 4-9. The error percentage of the simulation Algo.2-1 with 𝜌=0.8

Figure 4-10. The error percentage of the simulation Algo.2-1 with 𝜌=0.6

0%

window size

er ro r p er ce n ta ge

window size

e rr o r p e rc e n ta ge

Figure 4-11. The error percentage of the simulation Algo.2-1(distance = 20m)

NLoS→LoS

Figure 4-12. The hit percentage of the simulation Algo.2-1 with 𝜌=1

0%

window size

er ro r p er ce n ta ge

window size

h it p e rc e n ta ge

Figure 4-13. The hit percentage of the simulation Algo.2-1 with 𝜌=0.8

Figure 4-14. The hit percentage of the simulation Algo.2-1 with 𝜌=0.6

30%

40%

50%

60%

70%

4 10 16 22 28 34 40

10m 20m 40m

window size

h it p er ce n ta ge

60%

70%

80%

90%

100%

4 10 16 22 28 34 40

10m 20m 40m

window size

h it p e rc e n ta ge

Figure 4-15. The error percentage of the simulation Algo.2-1 with 𝜌=1

Figure 4-16. The error percentage of the simulation Algo.2-1 with 𝜌=0.8

0%

window size

er ro r p er ce n ta ge

window size

e rr o r p e rc e n ta ge

Figure 4-17. The error percentage of the simulation Algo.2-1 with 𝜌=0.6

Figure 4-18. The error percentage of the simulation Algo.2-1(distance = 20m)

0%

window size

er ro r p er ce n ta ge

window size

e rr o r p e rc e n ta ge

Table 5. Algo.2-1 的模擬實驗設置(室外)

模擬實驗設置

時間槽 400

實驗次數 10000

模擬環境

Outdoor

變動時間槽 200th

LoS 傳輸模型 𝑓𝐿(𝑥) = 1051.47−𝑥13.132

𝑔𝐿(𝑥) = −0.0217𝑥 + 3.4465 在距離=x 時的 LoS 樣本 X 分配

X~N(𝑓𝐿(𝑥), 𝑔𝐿(𝑥)) NLoS 傳輸模型 𝑓𝑁(𝑥) = 1050.745−𝑥16.652 𝑔𝑁(𝑥) = −0.0148𝑥 + 3.6661 在距離=x 時的 NLoS 樣本 X 分配

X~N(𝑓𝑁(𝑥), 𝑔𝑁(𝑥))

在 Table 5 這個模擬實驗中,我們假定使用者距離基地台固定距離並且會轉 動一次,分為兩種轉動(1)LoS 轉 NLoS (2)NLoS 轉 LoS,並針對不同的 window size 進行成功率和錯誤率的分析。Fig.4-19 到 Fig.4-25 為 LoS 轉 NLoS 的情形,而

Fig.4-26 到 Fig.4-32 是 NLoS 轉 LoS 的情形。最後,Fig.4-25 和 Fig.4-32 則是同距

離下,對於不同的𝜌值,其誤判數值之比較。

LoS→NLoS

Figure 4-19. The hit percentage of the simulation Algo.2-1 with 𝜌=1

Figure 4-20. The hit percentage of the simulation Algo.2-1 with 𝜌=0.8

20%

30%

40%

50%

60%

70%

4 10 16 22 28 34 40

10m 20m 40m

window size

h it p er ce n ta ge

50%

60%

70%

80%

90%

100%

4 10 16 22 28 34 40

10m 20m 40m

window size

h it p e rc e n ta ge

Figure 4-21. The hit percentage of the simulation Algo.2-1 with 𝜌=0.6

Figure 4-22. The error percentage of the simulation Algo.2-1 with 𝜌=1

70%

window size

h it p er ce n ta ge

window size

e rr o r p e rc e n ta ge

Figure 4-23. The error percentage of the simulation Algo.2-1 with 𝜌=0.8

Figure 4-24. The error percentage of the simulation Algo.2-1 with 𝜌=0.6

0%

window size

er ro r p er ce n ta ge

window size

e rr o r p e rc e n ta ge

Figure 4-25. The error percentage of the simulation Algo.2-1(distance = 20m)

NLoS→LoS

Figure 4-26. The hit percentage of the simulation Algo.2-1 with 𝜌=1

0%

window size

er ro r p er ce n ta ge

window size

h it p e rc e n ta ge

Figure 4-27. The hit percentage of the simulation Algo.2-1 with 𝜌=0.8

Figure 4-28. The hit percentage of the simulation Algo.2-1 with 𝜌=0.6

50%

60%

70%

80%

90%

100%

4 10 16 22 28 34 40

10m 20m 40m

window size

h it p er ce n ta ge

80%

85%

90%

95%

100%

4 10 16 22 28 34 40

10m 20m 40m

window size

h it p e rc e n ta ge

Figure 4-29. The error percentage of the simulation Algo.2-1 with 𝜌=1

Figure 4-30. The error percentage of the simulation Algo.2-1 with 𝜌=0.8

0%

window size

er ro r p er ce n ta ge

window size

e rr o r p e rc e n ta ge

Figure 4-31. The error percentage of the simulation Algo.2-1 with 𝜌=0.6

Figure 4-32. The error percentage of the simulation Algo.2-1(distance = 20m)

0%

window size

er ro r p er ce n ta ge

window size

e rr o r p e rc e n ta ge

 The simulation Algorithm 2-2

Table 6. Algo.2-2 的模擬實驗設置(室內)

模擬實驗設置

時間槽 400

實驗次數 10000

模擬環境

Indoor

變動時間槽 200th

LoS 傳輸模型 𝑓𝐿(𝑥) = 1052.296−𝑥13.88 𝑔𝐿(𝑥) = 0.0083𝑥 + 3.1686 在距離=x 時的 LoS 樣本 X 分配

X~N(𝑓𝐿(𝑥), 𝑔𝐿(𝑥)) NLoS 傳輸模型 𝑓𝑁(𝑥) = 1047.999−𝑥12.993 𝑔𝑁(𝑥) = −0.0037𝑥 + 3.4442 在距離=x 時的 NLoS 樣本 X 分配

X~N(𝑓𝑁(𝑥), 𝑔𝑁(𝑥))

在 Table 6 這個模擬實驗中,我們假定使用者距離基地台固定距離並且會轉 動一次。這邊將原始資料經由 moving average 轉換成兩個不同 window size 大小的 資料,假設分別為 k 和 h,其中與 h>k。與 Algorithm 2-1 不同的是,成功命中的 判別區間變為轉身點往後數的 h 個時間槽中,其餘的時間槽系統若有出現(1)或(2) 的回報情形則視此次模擬實驗為誤判。

由於演算法中的𝑑 = 𝑡𝑕𝑟𝑒𝑠𝑕𝑜𝑙𝑑 ∙ (1 − 𝑘 ∙ 𝑕;1),我們將 threshold 視為可變動 的值,在下列圖中,我們分別固定(h,k)並調整 threshold 看其命中百分比和誤判百 分比。Fig.4-33 到 Fig.4-38 為 LoS 轉 NLoS 的情形,而 Fig.4-38 到 Fig.4-42 則是

LoS→NLoS

Figure 4-33. The hit percentage of the simulation Algo.2-2 with (h,k)=(80,20)

Figure 4-34. The hit percentage of the simulation Algo.2-2 with (h,k)=(120,20)

0%

hi t pe rc en tag e

0%

Figure 4-35. The error percentage of the simulation Algo.2-2 with (h,k)=(80,20)

Figure 4-36. The error percentage of the simulation Algo.2-2 with (h,k)=(120,20)

0%

Figure 4-37. The hit percentage of the simulation Algo.2-2 with threshold = 3 and k=20

Figure 4-38. The error percentage of the simulation Algo.2-2 with threshold = 3 and k=20

50%

60%

70%

80%

90%

100%

60 80 100 120 140 160

10m 20m 40m

windows size h

h it p er ce n ta ge

0%

3%

6%

9%

12%

15%

60 80 100 120 140 160

10m 20m 40m

window size h

e rr o r p e rc e n ta ge

NLoS→LoS

Figure 4-39. The hit percentage of the simulation Algo.2-2 with (h,k)=(80,20)

Figure 4-40. The hit percentage of the simulation Algo.2-2 with (h,k)=(120,20)

0%

hi t pe rc en tag e

0%

Figure 4-41. The error percentage of the simulation Algo.2-2 with (h,k)=(80,20)

Figure 4-42. The error percentage of the simulation Algo.2-2 with (h,k)=(120,20)

0%

Table 7. Algo.2-2 的模擬實驗設置(室外)

模擬實驗設置

時間槽 400

實驗次數 10000

模擬環境

Outdoor

變動時間槽 200th

LoS 傳輸模型 𝑓𝐿(𝑥) = 1051.47−𝑥13.132

𝑔𝐿(𝑥) = −0.0217𝑥 + 3.4465 在距離=x 時的 LoS 樣本 X 分配

X~N(𝑓𝐿(𝑥), 𝑔𝐿(𝑥)) NLoS 傳輸模型 𝑓𝑁(𝑥) = 1050.745−𝑥16.652 𝑔𝑁(𝑥) = −0.0148𝑥 + 3.6661 在距離=x 時的 NLoS 樣本 X 分配

X~N(𝑓𝑁(𝑥), 𝑔𝑁(𝑥))

在 Table 7 這個模擬實驗中,我們假定使用者距離基地台固定距離並且會轉動 一次。這邊將原始資料經由 moving average 轉換成兩個不同 window size 大小的資 料,假設分別為 k 和 h,其中與 h>k。與 Table 6 唯一不同的是,我們使用的模型 由室內換成室外。Fig.4-43 到 Fig.4-48 為 LoS 轉 NLoS 的情形,而 Fig.4-49 到

Fig.4-52 則是 NLoS 轉 LoS 的情形。

LoS→NLoS

Figure 4-43. The hit percentage of the simulation Algo.2-2 with (h,k)=(80,20)

Figure 4-44. The hit percentage of the simulation Algo.2-2 with (h,k)=(120,20)

0%

Figure 4-45. The error percentage of the simulation Algo.2-2 with (h,k)=(80,20)

Figure 4-46. The error percentage of the simulation Algo.2-2 with (h,k)=(120,20)

0%

Figure 4-47. The hit percentage of the simulation Algo.2-2 with threshold = 3 and k=20

Figure 4-48. The error percentage of the simulation Algo.2-2 with threshold = 3 and k=20

60%

80%

100%

60 80 100 120 140 160

10m 20m 40m

window size h

h it p er ce n ta ge

0%

5%

10%

15%

20%

60 80 100 120 140 160

10m 20m 40m

window size h

e rr o r p e rc e n ta ge

NLoS→LoS

Figure 4-49. The hit percentage of the simulation Algo.2-2 with (h,k)=(80,20)

Figure 4-50. The hit percentage of the simulation Algo.2-2 with (h,k)=(120,20)

0%

Figure 4-51. The error percentage of the simulation Algo.2-2 with (h,k)=(80,20)

Figure 4-52. The error percentage of the simulation Algo.2-2 with (h,k)=(120,20)

0%

經過上陎相關模的擬實驗後,我們可以發現,在 Algorithm 1 中,隨著使用 者停留時間增長,我們的預測越準確,即使在不夠長的時間槽中,依然略優於隨 機猜測 50%的機率;在 Algorithm 2-1 中,可以了解到當 window size 取較大時,

可以有效的減少錯誤率,但不一定可提升命中率,當我們想提升命中率時,則必 頇取較小的𝜌值,但也必頇冒著錯誤率提高的風險,相較於 Algorithm 2-2 則較為 遜色,例如室內環境中:當我們在 20 公尺處,LoS 轉 NLoS 傳輸的情況時,

Algorithm 2-2 取 threshold=3,(h,k)=(20,120)時,命中率約為 80%,錯誤率約為

6%,為了在 Algorithm 2-1 也滿足 80%的命中率,我們取𝜌=0.6,k = 40,錯誤率 卻高達 20%,不過在反應時間的保證上,Algorithm 2-1 則略勝一籌,這個例子中,

Algorithm 2-1 反應時間可保證在轉動發生後的 20 個時間槽內,而 Algorithm 2-2

可能時間則在轉動發生後的 120 個時間槽內。

相關文件