深入學習one

1.Introduction

整個仿真最重要的部分就是routing和forwarding 算法的設計。在ONE中,並沒有專門去涉及底層的東西,只是簡單地可以設置data rate,radio range等等,這樣就可以產生一定的數據量。

2.The ONE Simulator

ONE是一個agent-based的
離散事件仿真器。它的重要功能就是使用不同的interfaces,routing,message handling以及application interactions來進行模擬node movement,inter-node contacts。

node根據movement models來進行移動。

messages通常來說總是unicast,只有一個source和destination host。

A.Node Capabilities

simulator裏面最基本的單元叫做node。一個node用來模擬可以作爲store-and-forward的router的
移動終端 (比如持有所要求的硬件的行人,汽車,電車等)。

每個node都模擬了一些
性能,radio interfaces,persistent storage,movement,energy consumption,message routing 和 application interactions。

關於底層的東西,這裏面都沒有怎麼涉及,只是在配置文件中設定參數,比如data rate,radio range,不過這些都跟具體的interface有關,比如藍牙或者wifi。

關於energy consumption,我暫時就不考慮了,仿真器裏面本身考慮得也很簡單。

B.Mobility Modeling

Mobility models定義了生成path的算法和規則。3種:a)random movement b) map-constrained random movement c) human behavior based movement

1)Map-Based Mobility

任意的Well Known Text (WKT)格式的地圖數據都可以用於map-based movement model

模擬人的運動使用ShortestPathMapBasedMovement(裏面可以添加感興趣的點,shop,park之類的),模擬汽車電車等等車的運動使用RouteMapMovement(這樣就可以使他們按照既定的路線走,比如說汽車不能走到商店裏,電車只能按照路軌來走)

2)Working Day Movement Model

這個Model模擬了3種主要的activities, a)Sleeping at home b)Working at the office c)going out with friends in the evening。這三種activities的轉換是依照一天的時間來的。

這個model包括3種運動的models,move alone or in groups by walk, driving or riding a bus。

最後,這個模式引入了communities and social relationships,communities是那種在同一個office工作,在同一個evening activity spot的人,或者live together。

3) Composite Movement Models

就是說有些node可以簇擁在一個地方,比如shops,parks,他們在裏面randomly運動,令一些nodes按照route來走。這樣就形成了幾團人在固定的區域運動,還有一行人或者車在他們之間或者外面隨機運動。

C.Routing

這裏先介紹6種。分爲3類,single-copy,n-copy,unlimited-copy protocols。

1) Single-copy protocol

Direct Delivery和First Contact routing protocols都是single-copy,,意思就是每個message都只能有一份copy存在於網絡中。

對於Direct Delivery協議來說,node攜帶messages直到它遇到final destination。

對於First Contact協議來說,node將messages傳遞給第一個遇到的node,這樣就造成了通過random walk來尋找destination node。

2) n-copy protocol

Spray-and-Wait,可以通過配置文件來設置一個最大能存儲或者說攜帶的copy數,在耗盡這個數字之前,都可以正常地傳遞copy。

這個地方有2個模式我不是很懂,一個是傳半個copy,一個是傳整個copy。

3)unlimited-copy protocol,一共有3個

Epidemic將messages複製給所有遇到的nodes。

PRoPHET試圖根據node 的 encouter history 估計哪個node最有可能將message送到終點。

MaxProp也是遇到就複製,但是一旦某個message被送到終點,它就會明確地刪除它們。另外,這個協議會首先考慮message hop counts和基於之前遇到的nodes的message delivery probabilities,然後排出一個順序,根據這個順序來send messages。

4)Adding Routing Protocols

所有的routing modules都從MessageRouter繼承一些基本的功能,例如 simple buffer management,對各種消息事件的回調(比如說什麼時候創建一個message,什麼時候一個message傳遞給node)。那麼一個router module必須能夠handle這些諸如上面的這些事件,並且定義一些actions來應付node comes into or leaves the node's radio range這樣的事件。


//這裏插一句,就是router的部分其實主要是負責功能,比如創建message,傳message,刪message,存儲message等等這些功能,而application是幹什麼的呢?它主要是調用我覺得,比如要刪一條信息,點一個刪除鍵,這個東西是在application的層面上來實現的,但是,一按下這個鍵以後,這樣只是用戶知道了,剩下的工作就由router來做了。

基本上來說,可以繼承ActiveRouter,這樣就可以得到由它提供的一些功能。比如說check 是不是所有的現在在buffer中的messages都以某個neighboring node作終點;offer 一些messages給neighboring nodes;處理succesfully transferred和aborted消息傳輸;實現了FIFO和隨機順序buffer管理。

對於Epidemic,Direct Delivery,和First Contact來說,他們只需要這些功能就行。

查看文章中具體的僞代碼

更加advanced的routing moduls需要track node contacts,因此需要實現node 的discovery callback

D.Application Modeling

1)支持2種:一種是high-level modeling of unicast,還有一種是request-response interactions through message generators,詳細的說就是通過application layer framework。

2)message generator可以用於通過定義source,destination,size,服從隨機分佈的interval來創建traffic,或者從外部文件讀取。

3)application layer framework允許application modules 1) 接收消息 2)修改message,包括改變,添加,刪除任何值和屬性  3)向router傳遞信號說這個消息應該被drop掉 4)產生messages 5)在每個time step管理執行任意的actions。

4)在ONE中,messages並不能包含任何payload,都是使用name-value對,即所謂的屬性。

5)application layer framework還支持report module。根據它創建events的一些參數和類型,report modules可以監聽並且創建相關的reports

6)Adding Application Protocols

要仿真一個application,必須要創建一個application module和一個report module。

每個application module都可以從Application繼承,得到一些內置的方法。比如說調用處理incoming messages;每個time step的update;還有每個時間片產生一些消息傳遞給report module。新的application實現一些方法以適應不同的應用,並且向report module發送application events。

7)爲了創建一個"ping" application,這個application要實現update方法以在一定的時間間隔內產生ping messages。

這些messages被傳至router,並且像其它messages一樣被forwarded出去。

handle方法是爲了接收ping message並且生成一個pong message作爲迴應。

然後,每次創建或者收到ping或者pong messages的時候都會生成events。

之後,report module就可以根據這些events來計算delivery probabilities。

E.Link Layer Modeling

1)因爲ONE仿真的主要focus是network layer的建模,而link層就直接被模擬成爲了bit rate和radio range。但是,仿真器支持統一的interfaces,用來模擬擁有多個radios(bluetooth,wifi等)的nodes,或者創建具有時變性質的links(比如interference limited links)

2)
每個node都可以配置爲有多個interfaces,相同的interface可以彼此創建連接。

   bluetooth:short range but high bit rate
   cellular:longer range but lower bit rate
   backbone:長距離低速率的用於subset裏面的通信,短距離高速率的用於和其他node之間的通信

3)有一個interference-limited interface,暫時沒有清楚具體的功用,後面再看看
 

F.External Interfaces

這個仿真器很重要的一個特性就是有外部接口,使用一些外部數據源,比如說node movement,connectivity,message routing traces。



//暫時先不說這個吧,有點暈

G.Reporting and Visualization

關於GUI的部分就不說了,主要說說reporting的部分。

1)ONE裏面包含了可以創建和Graphviz兼容的report module。

2)還包含了message location report module。

3)還包含了message statistics report module。可以收集整個performance的統計數據(number of created messages,messages delivery ratio,how long messages stay in node buffers等等)

4)還包含可以繪製report module輸出的後期處理script。

H.Creating Simulation Scenarios

創建simulation scenario的過程也就是定義simulated nodes和相關的性能的過程。其中包括定義基本的參數,比如說storage capacity,transmit range,bit rate,還有選擇特定的movement model和routing model以及爲他們配置相應的參數。還有比如說simulation duration和時間粒度也需要被定義。

通過配置文本式的文件來配置,配置文件中包含了1)仿真參數(rouing,movement),2)用戶接口參數,3)event generator,4)reporting參數。
 





















 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章