Anda di halaman 1dari 4

Veins(/)

Theopensourcevehicularnetworksimulationframework.

Tutorial
LearnhowtosetupVeins.
Note: VeinsrunsonLinux,MacOSX,andWindows.Becauseoftheextensivedebuggingcapabilitiesthatit

offers,VeinsisbestbuiltandrunonLinux.
ForbuildingonLinux,somepackagesmayneedtobeinstalled.OnUbuntuLinux,thiswilllikelymean
running
sudoaptgetinstallbuildessentialgccg++bisonflexperltcldevtkdevbltlibxml2devzlib1gde
vdefaultjredoxygengraphvizlibwebkitgtk1.00openmpibinlibopenmpidevlibpcapdevautoconfaut
omakelibtoollibproj0libgdal1devlibfox1.6devlibgdaldevlibxercescdev

toinstallthem.
OnMacOSX,thiswilllikelymeaninstallingequivalentpackagesviaMacportsbyrunning
sudoportinstallbisonzlibtkbltlibxml2libtoolxercescprojgdalfox

toinstallthem.
TheOMNeT++installguide(http://omnetpp.org/doc/omnetpp/InstallGuide.pdf)hasmanyhelpfulhintsonpre
andpostconfigurationofyoursystem.
ThistutorialassumesthatyouareusingWindows7,thatyourhomedirectoryis C:\Users\user ,andthatall
necessarysoftwarewillbeinstalledin C:\Users\user\src (whichwasalreadycreated).Asidefromthepaths
givenandtheopeningoftheOMNeT++MinGWcommandlinewindowvs.aregularcommandlinewindow,
thesestepsaresimilarwhenbuildingandrunningthesimulationsonLinuxorMacOSX.

Step1:DownloadSUMO
DownloadtheSUMO0.21.0binaries(http://sumosim.org/wiki/Downloads)andunpackthem
as C:\Users\user\src\sumo0.21.0 .Thisshouldgiveyouanexecutable
C:\Users\user\src\sumo0.21.0\bin\sumo.exe .NotethatrecentversionsoftheSUMObinaries
requiretheMicrosoftVisualC++2010RedistributablePackage(x86)
(http://www.microsoft.com/download/en/details.aspx?id=5555)tobeinstalled.

Ifyouwantto(orhaveto)buildSUMOmanually,detailedinstructionsformanyplatformscanbefoundon
theInstallationInstructionsontheSUMOwebsite(http://sumosim.org/wiki/Installing).
Note: MakesureyouarerunningtherightversionofSUMOforyourVeinsinstallation.Ifyouareunsure

whichversionofSUMOyouarerunning,theoutputof sumoversion willtellyou.Youcangetaquick


overviewofsupportedSUMOversionsfromtheVeinsChangelog(http://veins.car2x.org/download/).

Step2:DownloadandbuildOMNeT++4
DownloadOMNeT++4.4forWindows(http://www.omnetpp.org/omnetpp)andunpackit
as C:\Users\user\src\omnetpp4.4 .
Note: IfyouunpackOMNeT++toadifferentfolder,makesureitcontainsnospaces.

Thisshouldgiveyouascript
C:\Users\user\src\omnetpp4.4\mingwenv.cmd

thatyoucanruntoopenaMinGWcommandlinewindow,whichcloselymimicsaLinuxenvironment.
BuildOMNeT++4byrunning
./configure

(makingsuretoexaminethesummaryforpotentialerrors)followedby
make

tostartthebuildprocess.Ifallwentwell,thiswillresultin /c/Users/user/src/omnetpp4.4/bin/omnetpp being


built.Run
omnetpp

tolaunchtheOMNeT++4IDE.Thistutorialwillassumethatyoupicked
C:\Users\user\src\omnetpp4.4\samples asyourworkspace.

Step3:DownloadandbuildtheVeinsmoduleframework
DownloadVeins3.0(/download/)andunpackitas C:\Users\user\src\veins3.0 .Import
theprojectintoyourOMNeT++IDEworkspacebyclickingFile>Import>General:
ExistingProjectsintoWorkspaceandselectingthedirectoryyouunpackedthemodule
frameworkto.
BuildthenewlyimportedprojectbychoosingProject>BuildAllintheOMNeT++4IDE.Aftertheprojectbuilt,
youarereadytorunyourfirstIVCevaluations,buttoeasedebugging,thenextstepwillensurethatSUMO
worksasitshould.

Step4:MakesureSUMOisworking
IntheOMNeT++MinGWcommandlinewindow,youshouldbeabletohaveSUMOsimulateanexample
scenariobychangingthecurrentdirectoryto /c/Users/user/src/veins3.0/examples/veins/ using
cd../veins3.0/examples/veins andrunning
/c/Users/user/src/sumo0.21.0/bin/sumo.execerlangen.sumo.cfg

tostartSUMO.Youshouldseealinesaying"Loadingconfiguration...done.",thenasimulationtimestep
counterrunningfrom0to1000anddisappearingagain.
Togetanimpressionofwhattheexamplescenariolookslike,youcanalsorunitusing sumogui.exe ,but
thisisnotrequiredforVeinstowork.

(screenshot_sumogui.png)

ExamplescenariorunningintheSUMOGUI.

Finalstep:RuntheVeinsdemoscenario
TosaveyouthetroubleofmanuallyrunningSUMOpriortoeveryOMNeT++simulation,theVeinsmodule
frameworkcomeswithasmallpythonscripttodothatforyou.IntheOMNeT++MinGWcommandline
window,run
/c/Users/user/src/veins3.0/sumolaunchd.pyvvc/c/Users/user/src/sumo0.21.0/bin/sumo.exe

tostartit.ThisscriptwillproxyTCPconnectionsbetweenOMNeT++andSUMO,startinganewcopyofthe
SUMOsimulationforeveryOMNeT++simulationconnecting.Thescriptwillwillprint Listeningonport9999
andwaitforthesimulationtostart.LeavethiswindowopenandswitchbacktotheOMNeT++4IDE.
Hint: Ifyoudon'twanttoenterthefullpathtoyoursumobinaryeverytimeyoustartthelaunchd,youcan

alsoaddittothePATHvariableofyourmingwenvironment.Todoso,openmsys/etc/profileinyourOMNeT
directoryandadd
exportPATH=$PATH:/c/Users/user/src/sumo0.21.0/bin/

IntheOMNeT++4IDE,simulatetheVeinsdemoscenariobyrightclickingon
veins3.0/examples/veins/omnetpp.ini andchoosingRunAs>OMNeT++simulation.Don'tforgettoallow
accesstoSUMOthroughanypersonalfirewallyoumightrun.Similartothelastexample,thisshouldcreate
andstartalaunchconfiguration.YoucanlaterrelaunchthisconfigurationbyclickingthegreenRunbuttonin
theOMNeT++4IDE.
IfeverythingworkedasintendedthiswillgiveyouaworkingsimulationscenariousingOMNeT++andSUMO
runninginparalleltosimulateastreamofvehiclesthatgetsinterruptedbyanaccident.
Ifyouselecttheconfigurationnamed debug whenstartingthesimulation,youwillseeawealthofdebug
outputandvisualannotationssuchasbuildingpositionsonthecanvas,albeitatmuchreducedspeed.Inthis
configuration,itisbesttoturnoffmodulenames(viathetoolbarbuttonorbypressing Ctrl+D .

GUIscreencastofinformationdissemination
viafloodingwhilebuildingsblocktransmissions.

Thisconcludestheminitutorial.IndepthinformationonhowtouseVeinsisavailableinthedocumentation,
withanswerstothemostcommonquestionsinthelistofFrequentlyAskedQuestions(FAQ)
(/documentation/faq/).

ChristophSommer(http://www.ccslabs.org/~sommer/)20062015Lastmodified:20150225

Anda mungkin juga menyukai