I摘要本文主要工作是介绍OMNeT++仿真平台,并基于OMNeT++搭建Adhoc网络环境来进行仿真试验。首先是详细介绍OMNeT++仿真器的构成原理,尤其是对其NED语言和编程语法等做深入讲解,同时也对OMNeT++的移动框架(MF,MobilityFramework)组成原理进行了系统的讲解,因为它为我们提供了仿真无线移动网络所需各种基本模块,把我们从设计底层的模块结构和拓扑结构中解放出来,让我们能够把精力放在具体协议的实现上,加快了搭建仿真网络的过程,最后是进行Adhoc网络仿真环境的搭建,并在该环境中对在计算机网络中常用来检测网络连通性的Ping命令进行了仿真试验,并对抽取所需的数据进行分析。关键字网络仿真OMNeT++Adhoc网络IIAbstractThemainworkofthisthesisintroducestheOMNeT++,andorganizeaAdhocnetworkforthesimulationtestbasedonOMNeT++.Firstly,itintroducesthestructureofOMNeT++indetail,especiallyitsNEDlanguageandthesyntaxofprogram,aswellasOMNeT++’sMobileFramework(MF,MobilityFramework)principle,becauseitprovideswithbasicmodulesforwirelessandmobilenetworksimulation,andfreefromthedesigningofthebottomofthemodule’sstructureandtopological,sothat,itcanputmoreeffortsontheachievementoftherealizationoftheprotocol,speedupthesimulationprocess.Atlast,itorganizesanAdhocnetwork,andsimulatethePinginstruction,whichisalwaysusedinthecomputernetworktodetectthenetwork’sconnectivity,atthesametime,itcollectstherequireddataforanalysis.KeywordsNetworkSimulationOMNeT++AdhocNetworkIII目录摘要······················································································IAbstract····················································································II第1章绪论·············································································11.1课题背景与意义······························································11.2本文的主要工作······························································21.3本文的组织结构······························································3第2章OMNeT++基础································································42.1OMNeT++简介································································42.2OMNET++框架·······························································62.2.1OMNeT++组成························································62.2.2OMNeT++框架························································72.3OMNeT++语法································································82.3.1NED语言·······························································82.3.2简单模块算法实现和消息传递···································112.4MF移动框架································································142.4.1主机模型······························································142.4.2信道控制模块························································162.4.3基本概念······························································18第3章Adhoc网络基础····························································223.1AdHoc网络的概念························································223.2Adhoc网络特点····························································233.3Adhoc网络协议栈·························································253.4Adhoc网络的应用领域···················································26第4章Adhoc网络仿真的实现···················································294.1仿真试验·····································································294.1.1NIC模块······························································304.1.2移动模块······························································32IV4.1.3网络层模块···························································324.1.4信道控制模块························································354.1.5应用层模块···························································364.2仿真结果分析·······························································374.2.1丢包分析······························································374.2.2往返时延分析························································384.2.3数据分析······························································38结论····················································································39致谢····················································································40参考文献·················································································41附录1外文文献译文································································43附录2外文文献原文································································481第1章绪论1.1课题背景与意义由于研究方向的不同,许多领域,并不太适合采用实地试验的方式,或者是为了节省时间、资金等目的,最好采用仿真的方式。比方说电路仿真、生物仿真,还有接下来我们要谈到的网络仿真。网络仿真也被称为网络模拟,因为对各种网络仿真过程来说,其中也有“模拟”的含义,即网络仿真不但可以取代真实的应用环境得出可靠的运行结果和数据,也可以模仿一个系统过程中的某些行为和特征。顾名思义,网络模拟,就是用计算机程序对通信网络进行模型化,通过程序的运行模仿通信网络的运行过程。那么,为什么要进行通信网络的仿真呢?在网络迅速膨胀的今天,网络研究人员一方面要不断思考新的网络协议和算法,为网络发展做前瞻性的基础研究;另一方面也要研究如何利用和整合现有的资源,使网络达到最高效能。无论是哪一方面都需要对新的网络方案进行验证和分析。进行网络技术的研究一般有以下3种手段:(1)分析方法,就是对所研究的对象和所依存的网络系统进行初步分析,根据一定的限定条件和合理假设,对研究对象和系统进行描述,抽象出研究对象的数学分析模型,利用数学分析模型对问题进行求解。(2)实验方法,就是设计出研究所需要的合理硬件和软件配置环境,建立测试床和实验室,在现实的网络上实现对网络协议、网络行为和网络性能的研究。(3)仿真方法,应用网络仿真软件建立所研究的网络系统的模拟模型,在计算机上运行这个模型,并分析运行的输出结果。然而,前两种方法都存在很大的局限性。分析方法的有效性和精确性受假设限制很大。当一个系统很复杂时,就无法用一些限制性假设来对系统进2行详细描述。实验方法的局限性在于成本很高,重新配置或共享资源很难,运用起来不灵活。而仿真方法在很大程度上可以弥补前两种方法的不足。仿真方法可以根据需要设计所需的网络模型,用相对较少的时间和费用了解网络在不同条件下的各种特性,获取网络研究的丰富有效的数据。网络仿真无疑提供了一个方便、高效的验证和分析方法,因此网络仿真技术在现代通信网络设计和研究中的作用正变得越来越大[1]。无线移动网络的迅速发展,特别是Adhoc网络已成为当今无线移动网络领域研究的热点,使得我们对Adhoc网络的性能研究变得越来越重要。对于欲建的网络应用系统,网络设计者需要验证其设计方案的可行性,以有效投资建立最优网络环境;对于新提出的网络协议我们需要验证其性能;网络规模越大,网络性能的计算机仿真和性能分析工作越