Omnet++入門
- What Is OMNeT++?
OMNeT++ is an object-oriented modular discrete event network simulation framework.
安裝
- OMNet++ download (我所用的版本 : OMNet++ 5.6.2)
- 下載後解壓縮至你要的路徑
- 在 omnetpp-5.6.2/ 下可以找到
mingwenv
點開執行
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- 同個路徑下可找到
INSTALL.txt
,依照裡面指令快速安裝
- 若想更改一些設定 (如:編譯器設定,在windows上建議改PREFER_CLANG=no)
- 編譯完沒有問題使用
omnetpp
指令即可開啟IDE
- 如果想知道整個資料夾每層在做什麼 :
omnetpp-5.6.2/README
omnetpp-5.6.2/sample/
下放著一些內建好的專案,自己的專案也可放於此
- 進入IDE會先選擇你的workspace,接著左側會列出路徑下所有project,點兩下或右鍵"open project" 即可載入 project
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- 對專案右鍵>properties>Project Reference 這裡可選擇要reference的project (有時會用到別的project的功能,如inet、queueinglib…),用別人的project丟進來也要注意這裡的設定是否不一致
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
模擬
參考這篇
官方主要都是以tictoc
這個範例project做教學,讀完它18篇範例可以比較熟練omnet中基本操作
本篇說明以簡潔為主,絕不詳細,還是得去讀文件比較好 (明天一定…)
觀念
- omnet++主要以C ++、NED等等物件導向語言來開發
- NED 全名為 NEtwork Description,其實就是用來描述網路的一種語言。
- NED 可以把它看成由很多個module來組成,最底層的module稱為simple module,simple module 又可以組成 compound module,在omnet++中定義的網路由眾多的module組成。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- 一個網路模擬可以大致分成三步 :
- 構建網路(你的網路裡有哪些module) – 編寫NED檔
- 定義網路行為(每個module的行為) – 編寫C++(.cc檔)
- 其餘模擬參數設定
NED檔分析
- NED檔有兩種方式撰寫,一種是用拉的(像C#),一種是source code(推薦)
C++ file 分析(.cc)
- 每個NED檔都一個與之對應的.cc檔,在.cc中必須實現與NED中定義的module相對應的class
- 注意.cc檔中的class名稱與NED檔中的對應module名稱必須相同!!!
Define_module("module名稱")
就是在做綁定的動作
- 注意,這個例子在.cc這裡定義了每個屬於Satellite module的module會做什麼事情,表示全部人會做完這些定義的事件才繼續推動時間,所以在omnet++中這個時刻的event都發生完,時間才會繼續往下跑。
Reference
OMNet++ - tictoc中文教學
OMNeT++ Documentation
OMNeT++教程(从入门到半精通)