OMNet++

林群凱Wed, Aug 31, 2021 8:52 PM

簡介

OMNet++ 是什麼

  • 物件導向的模組化網路模擬離散事件的框架
  • 通用架構
  • 提供編寫的基礎和工具

OMNet++ 可以做什麼?

OMNet++ 可以用於許多領域的問題:

  • 建立有線或無線網路的模型
  • 通訊協定的模型
  • 隊列模型
  • 多處理器和分散式硬體系統
  • 驗證硬體架構
  • 評估軟體系統各個層面的效能

OMNet++ 的架構

Network Description File (.ned)

Network Configuration File (.ini)

Source File (.cc)

安裝

參考: OMNeT++ Installation Guide, How To Set Up OMNet++ in Ubuntu 20+, HHow To Install Omnet++ In Ubuntu 18.04.1
作業系統: Ubuntu 20.04

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 →
注意: 不同版本的安裝有些微差異

Version 5.6.2

需要的套件

先更新

sudo apt-get update

安裝套件

sudo apt-get install build-essential gcc g++ bison flex perl \ python python3 qt5-default libqt5opengl5-dev tcl-dev tk-dev \ libxml2-dev zlib1g-dev default-jre doxygen graphviz libwebkitgtk-3.0-0

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 →
如果出現 Package 'libwebkitgtk-3.0-0' has no installation candidate

sudo nano /etc/apt/sources.list

deb http://cz.archive.ubuntu.com/ubuntu bionic main universe 加到檔案中

sudo apt-get update

再安裝一次

安裝額外的套件

sudo apt-get install openscenegraph-plugin-osgearth libosgearth-dev sudo apt-get install openmpi-bin libopenmpi-dev

下載與解壓縮

https://omnetpp.org/download/ 下載 OMNeT++ 5.6.2 的 Linux 版本壓縮檔。

將檔案解壓縮

tar xvfz omnetpp-5.6.2-src-linux.tgz

會產生一個子資料夾 omnetpp-5.6.2 ,將其放至於你想放置的位置。

建置

到資料夾中

cd omnetpp-5.6.1

設定變數

. setenv

增加環境變數

vim ~/.bashrc

export PATH=$HOME/omnetpp-5.6.2/bin:$PATH 加到檔案中後,重啟終端機

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 →
如果是使用 zsh

source setenv vim ~/.zshrc

設定 OMNet++

./configure

執行 make

make

檢查是否成功

執行範例

cd samples/dyna ./dyna

選擇 small,就能看到範例程式

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 →

Version 5.4.1

需要的套件

先更新

sudo apt-get update

安裝套件

sudo apt-get install build-essential gcc g++ bison flex perl \python python3 qt5-default libqt5opengl5-dev tcl-dev tk-dev \libxml2-dev zlib1g-dev default-jre doxygen graphviz libwebkitgtk-1.0 openscenegraph-plugin-osgearth libosgearth-dev openmpi-bin libopenmpi-dev libpcap-dev gnome-color-chooser nemiver

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 →
如果出現 Package 'libwebkitgtk-1.0' has no installation candidate

sudo nano /etc/apt/sources.list

deb http://cz.archive.ubuntu.com/ubuntu bionic main universe 加到檔案中

sudo apt-get update

再安裝一次
也有可能需要改成 libwebkitgtk-1.0-0

下載與解壓縮

https://omnetpp.org/download/old 下載 OMNeT++ 5.4.1 的 Linux 版本壓縮檔。

將檔案解壓縮

tar xvfz omnetpp-5.4.1-src-linux.tgz

會產生一個子資料夾 omnetpp-5.4.1 ,將其放至於你想放置的位置。

建置

到資料夾中

cd omnetpp-5.4.1

設定變數

. setenv

增加環境變數

vim ~/.bashrc

export PATH=$HOME/omnetpp-5.4.1/bin:$PATH 加到檔案中後,重啟終端機

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 →
如果是使用 zsh

source setenv vim ~/.zshrc

設定 OMNet++

./configure

執行 make

make

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 →
如果在 OSG EARTH 編譯失敗,可以嘗試在設定時增加參數

./configure WITH_OSGEARTH=no

在重複執行一次

參考: Unable to compile Omnet++ in Ubuntu 16.04 - make errors

檢查是否成功

執行範例

cd samples/dyna ./dyna

選擇 small,就能看到範例程式

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 →

問題處理

Unknown Log format character '<'

參考: Unknown Log format character '<'

你可能有一個就的 .qtenvrc 在主目錄的根目錄中。 嘗試:

rm ~/.qtenvrc

.qtenvrc 包含 QTEnv 的各種全局初始化參數,包括提到的 logformat 參數。

An error has occurred. See the log file

參考: Omnet++ 5.4.1 running error on Ubuntu 18.10
  • 方法一

omnetpp-5.4.1/ide/configuration/config.ini 中貼上

org.osgi.framework.system.packages = \
 javax.accessibility,\
 javax.activation,\
 javax.activity,\
 javax.crypto,\
 javax.crypto.interfaces,\
 javax.crypto.spec,\
 javax.imageio,\
 javax.imageio.event,\
 javax.imageio.metadata,\
 javax.imageio.plugins.bmp,\
 javax.imageio.plugins.jpeg,\
 javax.imageio.spi,\
 javax.imageio.stream,\
 javax.jws,\
 javax.jws.soap,\
 javax.lang.model,\
 javax.lang.model.element,\
 javax.lang.model.type,\
 javax.lang.model.util,\
 javax.management,\
 javax.management.loading,\
 javax.management.modelmbean,\
 javax.management.monitor,\
 javax.management.openmbean,\
 javax.management.relation,\
 javax.management.remote,\
 javax.management.remote.rmi,\
 javax.management.timer,\
 javax.naming,\
 javax.naming.directory,\
 javax.naming.event,\
 javax.naming.ldap,\
 javax.naming.spi,\
 javax.net,\
 javax.net.ssl,\
 javax.print,\
 javax.print.attribute,\
 javax.print.attribute.standard,\
 javax.print.event,\
 javax.rmi,\
 javax.rmi.CORBA,\
 javax.rmi.ssl,\
 javax.script,\
 javax.security.auth,\
 javax.security.auth.callback,\
 javax.security.auth.kerberos,\
 javax.security.auth.login,\
 javax.security.auth.spi,\
 javax.security.auth.x500,\
 javax.security.cert,\
 javax.security.sasl,\
 javax.sound.midi,\
 javax.sound.midi.spi,\
 javax.sound.sampled,\
 javax.sound.sampled.spi,\
 javax.sql,\
 javax.sql.rowset,\
 javax.sql.rowset.serial,\
 javax.sql.rowset.spi,\
 javax.swing,\
 javax.swing.border,\
 javax.swing.colorchooser,\
 javax.swing.event,\
 javax.swing.filechooser,\
 javax.swing.plaf,\
 javax.swing.plaf.basic,\
 javax.swing.plaf.metal,\
 javax.swing.plaf.multi,\
 javax.swing.plaf.nimbus,\
 javax.swing.plaf.synth,\
 javax.swing.table,\
 javax.swing.text,\
 javax.swing.text.html,\
 javax.swing.text.html.parser,\
 javax.swing.text.rtf,\
 javax.swing.tree,\
 javax.swing.undo,\
 javax.tools,\
 javax.xml,\
 javax.xml.bind,\
 javax.xml.bind.annotation,\
 javax.xml.bind.annotation.adapters,\
 javax.xml.bind.attachment,\
 javax.xml.bind.helpers,\
 javax.xml.bind.util,\
 javax.xml.crypto,\
 javax.xml.crypto.dom,\
 javax.xml.crypto.dsig,\
 javax.xml.crypto.dsig.dom,\
 javax.xml.crypto.dsig.keyinfo,\
 javax.xml.crypto.dsig.spec,\
 javax.xml.datatype,\
 javax.xml.namespace,\
 javax.xml.parsers,\
 javax.xml.soap,\
 javax.xml.stream,\
 javax.xml.stream.events,\
 javax.xml.stream.util,\
 javax.xml.transform,\
 javax.xml.transform.dom,\
 javax.xml.transform.sax,\
 javax.xml.transform.stax,\
 javax.xml.transform.stream,\
 javax.xml.validation,\
 javax.xml.ws,\
 javax.xml.ws.handler,\
 javax.xml.ws.handler.soap,\
 javax.xml.ws.http,\
 javax.xml.ws.soap,\
 javax.xml.ws.spi,\
 javax.xml.ws.spi.http,\
 javax.xml.ws.wsaddressing,\
 javax.xml.xpath,\
 org.ietf.jgss,\
 org.omg.CORBA,\
 org.omg.CORBA_2_3,\
 org.omg.CORBA_2_3.portable,\
 org.omg.CORBA.DynAnyPackage,\
 org.omg.CORBA.ORBPackage,\
 org.omg.CORBA.portable,\
 org.omg.CORBA.TypeCodePackage,\
 org.omg.CosNaming,\
 org.omg.CosNaming.NamingContextExtPackage,\
 org.omg.CosNaming.NamingContextPackage,\
 org.omg.Dynamic,\
 org.omg.DynamicAny,\
 org.omg.DynamicAny.DynAnyFactoryPackage,\
 org.omg.DynamicAny.DynAnyPackage,\
 org.omg.IOP,\
 org.omg.IOP.CodecFactoryPackage,\
 org.omg.IOP.CodecPackage,\
 org.omg.Messaging,\
 org.omg.PortableInterceptor,\
 org.omg.PortableInterceptor.ORBInitInfoPackage,\
 org.omg.PortableServer,\
 org.omg.PortableServer.CurrentPackage,\
 org.omg.PortableServer.POAManagerPackage,\
 org.omg.PortableServer.POAPackage,\
 org.omg.PortableServer.portable,\
 org.omg.PortableServer.ServantLocatorPackage,\
 org.omg.SendingContext,\
 org.omg.stub.java.rmi,\
 org.w3c.dom,\
 org.w3c.dom.bootstrap,\
 org.w3c.dom.css,\
 org.w3c.dom.events,\
 org.w3c.dom.html,\
 org.w3c.dom.ls,\
 org.w3c.dom.ranges,\
 org.w3c.dom.stylesheets,\
 org.w3c.dom.traversal,\
 org.w3c.dom.views,\
 org.w3c.dom.xpath,\
 org.xml.sax,\
 org.xml.sax.ext,\
 org.xml.sax.helpers
  • 方法二
​downgrade your java package to 1.8