Anda di halaman 1dari 11

#Ns2supportsprotocolssuchasTCP,UDP TCP UDP #SupportstrafficsourcebehaviourslikeFTP,TELNET,CBP,VBR FTP TELNET CBR VBR #QueuemanagementDroptail,RED,CBQ DropTail RED CBQ #NShastwodifferenttypesofeventschedulersimplemented.Thesearerealtimeand nonrealtimeschedulers.Foranonrealtimescheduler,threeimplementations(List,Heapand Calendar)areavailable,eventhoughtheyarealllogicallyperformthesame.

TheCalendar nonrealtimeschedulerissetasthedefault.Thefollowingisanexampleofselectingaspecific eventscheduler: ... setns[newSimulator] $nsuseschedulerHeap ... Anotheruseofaneventscheduleristoschedulesimulationevents,suchaswhentostartan FTPapplication,whentofinishasimulationetc.Thefollowingisasimulationeventscheduling lineaddedversionoftheaboveexample.... setns[newSimulator] $nsuseschedulerHeap $nsat300.5"complete_sim" ... proccomplete_sim{}{ ... }

#FollowingsareapartiallistandbriefdescriptionofSimulatorobjectmemberfunctionsthat interfacewithschedulermemberfunctions: Simulatorinstprocnow Simulatorinstprocatargs Simulatorinstprocatnowargs Simulatorinstprocafternargs Simulatorinstprocrunargs Simulatorinstprochalt #returnscheduler'snotionofcurrenttime #scheduleexecutionofcodeatspecifiedtime #scheduleexecutionofcodeatnow #scheduleexecutionofcodeafternsecs #startscheduler #stop(pause)scheduler

#NodeandRouting Anodeisacompoundobjectcomposedofanodeentryobjectandclassifiersasshownin Figure7.TherearetwotypesofnodesinNS.Aunicastnodehasanaddressclassifierthatdoes unicastroutingandaportclassifier.Amulticastnode,inaddition,hasaclassifierthatclassify multicastpacketsfromunicastpacketsandamulticastclassifierthatperformsmulticast routing. Unicast $nsrtprototype type:Static,Session,DV,cost,multipath Multicast $nsmulticast(rightafterset$ns[newScheduler]) $nsmrtprototype type:CtrMcast,DM,ST,BST Link AlinkisanothermajorcompoundobjectinNS.Whenausercreatesalinkusingaduplexlink memberfunctionofaSimulatorobject. Tracing InNS,networkactivitiesaretracedaroundsimplexlinks.Ifthesimulatorisdirectedtotrace networkactivities(specifiedusing$nstraceallfileor$nsnamtraceallfile),Userscanalso specificallycreateatraceobjectoftypetypebetweenthegivensrcanddstnodesusingthe createtrace{typefilesrcdst}command.

Figure9.InsertingTraceObjects Wheneachinsertedtraceobject(i.e.EnqT,DeqT,DrpTandRecvT)receivesapacket,itwrites tothespecifiedtracefilewithoutconsuminganysimulationtime,andpassesthepackettothe nextnetworkobject. #Packet ANSpacketiscomposedofastackofheaders,andanoptionaldataspace(seeFigure12).

Figure12.NSPacketFormat #TraceFile

Figure13.TraceFormatExample

#WheretoFindWhat

Figure17.NSDirectoryStructure Thetcldirectoryhassubdirectories,amongwhichthelibdirectorythatcontainsOTclsource codesforthemostbasicandessentialpartsoftheNSimplementation(agent,node,link,packet, address,routing,andetc.)istheplaceoneasauserorasadeveloperwillvisitthemost. Sattelite: Satellitescanbemodelledmoreliketraditionalnsnodeswithclassifiersandroutingagents. Thefollowingaretheparametersofsatelliteconstellationsthatcancurrentlybesimulated: ThefollowingtablelistsparametersusedforexamplesimulationscriptsoftheIridium17.1and Teledesic17.2systems.

Iridium

Teledesic

Altitude Planes Satellitesperplane Inclination(deg) Interplaneseparation(deg) Seamseparation(deg) Elevationmask(deg) Intraplanephasing Interplanephasing ISLspersatellite ISLbandwidth Up/downlinkbandwidth CrossseamISLs ISLlatitudethreshold(deg)

780km 6 11 86.4 31.6 22 8.2 yes yes 4 25Mb/s 1.5Mb/s no 60

1375km 12 24 84.7 15 15 40 yes no 8 155Mb/s 1.5Mb/s yes 60

Therearetwobasickindsofsatellitenodes:geostationaryandnongeostationarysatellite nodes.Inaddition,terminalnodescanbeplacedontheEarth'ssurface. Eachofthesethreedifferenttypesofnodesisactuallyimplementedwiththesameclass SatNodeobject,butwithdifferentposition,handoffmanager,andlinkobjectsattached.The positionobjectkeepstrackofthesatellitenode'slocationinthecoordinatesystemasafunction oftheelapsedsimulationtime.Thispositioninformationisusedtodeterminelinkpropagation delaysandappropriatetimesforlinkhandoffs.Specifically,thereisoneclassofsatellitenode ClassNode/SatNode,towhichoneofthreetypesofPositionobjectsmaybeattached. Position/Sat/TermAterminalisspecifiedbyitslatitudeandlongitude.Latituderangesfrom andlongituderangesfrom Thenodegeneratorcanbeusedtocreateaterminalwithanattachedpositionobjectasfollows:

$nsnodeconfigsatNodeTypeterminal\bs (othernodeconfigcommandsgohere...) setn1[$nsnode] $n1setposition$lat$lon#indecimaldegrees Position/Sat/GeoAgeostationarysatelliteisspecifiedbyitslongitudeabovetheequator. Assimulationtimeevolves,thegeostationarysatellitemovesthroughthecoordinate systemwiththesameorbitalperiodasthatoftheEarth'srotation.Thelongituderanges from degrees.Aswedescribefurtherbelow,twoflavorsof geostationarynodesexist:``geo''(forprocessingsatellites)and``georepeater''(for bentpipesatellites).Thenodegeneratorcanbeusedtocreateageostationarysatellite withanattachedpositionobjectasfollows: $nsnodeconfigsatNodeTypegeo(or``georepeater'')\bs (othernodeconfigcommandsgohere...) setn1[$nsnode] $n1setposition$lon#indecimaldegrees #Satelliteorbitsareusuallyspecifiedinnsbythreeparameters:altitude,inclination,and longitude,withafourthparameteralphaspecifyinginitialpositionofthesatelliteintheorbit,as describedbelow. AltitudeisspecifiedinkilometersabovetheEarth'ssurface,andinclinationcanrangefrom degrees,with correspondingtopurepolarorbitsandanglesgreaterthan degreescorrespondingto``retrograde''orbits.Theascendingnodereferstothepointwherethe footprintofthesatelliteorbitaltrackcrossestheequatormovingfromsouthtonorth.Inthis simulationmodel,theparameterlongitudeofascendingnodespecifiestheearthcentric longitudeatwhichthesatellite'snadirpointcrossestheequatormovingsouthtonorth.17.3 Longitudeofascendingnodecanrangefrom degrees.Thefourthparameter, alpha,specifiestheinitialpositionofthesatellitealongthisorbit,startingfromtheascending node.Forexample,analphaof degreesindicatesthatthesatelliteisinitiallyabovethe

equatormovingfromnorthtosouth.Alphacanrangefrom degrees.Finally,afifth parameter,plane,isspecifiedwhencreatingpolarsatellitenodesallsatellitesinthesame planearegiventhesameplaneindex.Thenodegeneratorusedtocreateapolarsatellitewithan attachedpositionobjectasfollows: $nsnodeconfigsatNodeTypepolar\bs (othernodeconfigcommandsgohere...)

setn1[$nsnode] $n1setposition$alt$inc$lon$alpha$plane

Satellitelinks

Figure17.3:Maincomponentsofasatellitenetworkinterface Satellitelinksresemblewirelesslinks.Eachsatellitenodehasoneormoresatellitenetwork interfacestacks,towhichchannelsareconnectedtothephysicallayerobjectinthestack. Satellitelinksdifferfromnswirelesslinksintwomajorrespects:i)thetransmitandreceive interfacesmustbeconnectedtodifferentchannels,andii)thereisnoARPimplementation. Currently,theRadioPropagationModelisaplaceholderforuserstoaddmoredetailederror modelsifsodesiredthecurrentcodedoesnotuseapropagationmodel. NetworkinterfacescanbeaddedwiththefollowinginstprocofClassNode/SatNode:

$nodeaddinterface$type$ll$qtype$qlim$mac$mac_bw$phy Theaddinterfaceinstprocreturnsanindexvaluethatcanbeusedtoaccessthenetwork interfacestacklaterinthesimulation.Byconvention,thefirstinterfacecreatedonanodeis attachedtotheuplinkanddownlinkchannelsofasatelliteorterminal.Thefollowingparameters mustbeprovided: type:Thefollowinglinktypescanbeindicated:geoorpolarforlinksfromaterminaltoa geoorpolarsatellite,respectively,gslandgslrepeaterforlinksfromasatellitetoa terminal,andintraplane,interplane,andcrossseamISLs.Thetypefieldisusedinternally inthesimulatortoidentifythedifferenttypesoflinks,butstructurallytheyareallvery similar. ll:Thelinklayertype(classLL/Satiscurrentlytheonlyonedefined). qtype:Thequeuetype(e.g.,classQueue/DropTail).Anyqueuetypemaybeused however,ifadditionalparametersbeyondthelengthofthequeueareneeded,thenthis instprocmayneedtobemodifiedtoincludemorearguments. qlim:Thelengthoftheinterfacequeue,inpackets. mac:TheMACtype.Currently,twotypesaredefined:classMac/SatabasicMACfor linkswithonlyonereceiver(i.e.,itdoesnotdocollisiondetection),andClass Mac/Sat/UnslottedAlohaanimplementationofunslottedAloha. mac_bw:Thebandwidthofthelinkissetbythisparameter,whichcontrolsthe transmissiontimehowfasttheMACsends.Thepacketsizeusedtocalculatethe transmissiontimeisthesumofthevaluessize()inthecommonpacketheaderand LINK_HDRSIZE,whichisthesizeofanylinklayerheaders.Thedefaultvaluefor LINK_HDRSIZEis16bytes(settableinsatlink.h).Thetransmissiontimeisencodedin thepacketheaderforuseatthereceiveMAC(tosimulatewaitingforawholepacketto arrive). phy:ThephysicallayercurrentlytwoPhys(ClassPhy/SatandClassPhy/Repeater) aredefined.TheclassPhy/Satjustpasstheinformationupanddownthestackasinthe wirelesscodedescribedinChapter16,aradiopropagationmodelcouldbeattachedat thispoint.TheclassPhy/Repeaterpipesanypacketsreceivedonareceiveinterface straightthroughtoatransmitinterface. AnISLcanbeaddedbetweentwonodesusingthefollowinginstproc: $nsaddisl$ltype$node1$node2$bw$qtype$qlim Thiscreatestwochannels(oftypeChannel/Sat),andappropriatenetworkinterfacesonboth nodes,andattachesthechannelstothenetworkinterfaces.Thebandwidthofthelinkissetto bw.Thelinktype(ltype)mustbespecifiedaseitherintraplane,interplane,orcrossseam. AGSLinvolvesaddingnetworkinterfacesandachannelonboardthesatellite(thisistypically doneusingthewrappermethodsdescribedinthenextparagraph),andthendefiningthecorrect interfacesontheterrestrialnodeandattachingthemtothesatellitelink,asfollows: $nodeaddgsl$type$ll$qtype$qlim$mac$bw_up$phy\bs [$node_satellitesetdownlink_][$node_satellitesetuplink_]

Here,thetypemustbeeithergeoorpolar,andwemakeuseofthedownlink_anduplink_ instvarsofthesatellitetherefore,thesatellite'suplinkanddownlinkmustbecreatedbeforethis instprociscalled. Bydefault,thenodegeneratorforsatellitenodes(describedinSection5.3)willcreatenodesofa giventype,givethemanuplinkanddownlinkinterface,andcreateandattachan(initial)uplink anddownlinkchannel,basedontheinterfaceoptionsspecified.

Handoffs
Insatellitecommunicationsitistheprocessoftransferringsatellitecontrolresponsibilityfrom oneearthstationtoanotherwithoutlossorinterruptionofservice. Therearenolinkhandoffsinvolvinggeostationarysatellites,buttherearetwotypesoflinksto polarorbitingsatellitesthatmustbehandedoff:GSLstopolarsatellites,andcrossseamISLs.A thirdtypeoflink,interplaneISLs,arenothandedoffbutaredeactivatedathighlatitudesaswe describebelow. Eachterminalconnectedtoapolarorbitingsatelliterunsatimerthat,uponexpiry,causesthe HandoffManagertocheckwhetherthecurrentsatellitehasfallenbelowtheelevationmaskofthe terminal.Ifso,thehandoffmanagerdetachestheterminalfromthatsatellite'supanddownlinks, andsearchesthroughthelinkedlistofsatellitenodesforanotherpossiblesatellite.First,the ``next''satelliteinthecurrentorbitalplaneischeckedapointertothissatelliteisstoredinthe Positionobjectofeachpolarsatellitenodeandissetduringsimulationconfigurationusingthe Node/SatNodeinstproc``$nodeset_next$next_node.''Ifthenextsatelliteisnotsuitable,the handoffmanagersearchesthroughtheremainingsatellites.Ifitfindsasuitablepolarsatelite,it connectsitsnetworkinterfacestothatsatellite'suplinkanddownlinkchannels,andrestartsthe handofftimer.Ifitdoesnotfindasuitablesatellite,itrestartsthetimerandtriesagainlater.Ifany linkchangesoccur,theroutingagentisnotified. TheelevationmaskandhandofftimerintervalaresettableviaOTcl: HandoffManager/Termsetelevation_mask_10#degrees HandoffManager/Termsetterm_handoff_int_10#seconds Inaddition,handoffsmayberandomizedtoavoidphaseeffectsbysettingthefollowingvariable: HandoffManagersethandoff_randomization_0#0isfalse,1istrue

Routing Uponeachtopologychange,acentralizedroutinggeniedeterminestheglobalnetworktopology, computesnewroutesforallnodes,andusestheroutestobuildaforwardingtableoneach

node. TheroutinggenieisaclassSatRouteObjectandiscreatedandinvokedwiththefollowingOTcl commands: setsatrouteobject_[newSatRouteObject] $satrouteobject_compute_routes wherethecalltocompute_routesisperformedafterallofthelinksandnodesinthesimulator havebeeninstantiated. Tracing geographiclatitudeandlongitudeofthenodeloggingthetrace(inthecaseofasatellitenode,the latitudeandlongitudecorrespondtothenadirpointofthesatellite). Forexample,apacketonalinkfromnode66tonode26mightnormallybeloggedas: +1.00006626cbr210066.067.000 butinthesatellitesimulation,thepositioninformationisappended: +1.00006626cbr210066.067.00037.90122.3048.90120.94 Inthiscase,node66isatlatitude37.90degrees,longitude122.30degrees,whilenode26isa LEOsatellitewhosesubsatellitepointisat48.90degreeslatitude,120.94degreeslongitude (negativelatitudecorrespondstosouth,whilenegativelongitudecorrespondstowest). Toenabletracingofallsatellitelinksinthesimulator,usethefollowingcommandsbefore instantiatingnodesandlinks: setf[openout.trw] $nstraceall$f Thenusethefollowinglineafterallnodeandlinkcreation(andallerrormodelinsertion,ifany)to enabletracingofallsatellitelinks: $nstraceallsatlinks$f Specifically,thiswillputtracingaroundthelinklayerqueuesinallsatellitelinks,andwillputa receivetracebetweenthemacandthelinklayerforreceivedpackets.Toenabletracingonlyon aspecificlinkonaspecificnode,onemayusethecommand: $nodetraceinlinkqueue$f$i $nodetraceoutlinkqueue$f$i where istheindexoftheinterfacetobetraced.

WireConnection Thesatellite/wiredcodeintegrationtakesadifferentstrategy.Byselectingthenodeconfiguration

$nsnodeconfigwiredRoutingONoption,theC++routinginthesatellitecodeisturnedoff,and instead,allsatellitetopologychangesleadtoupcallsintotheOTclcode.Asaresult,thelink_ arrayinOTclismanipulatedaccordingtoalltopologychanges,andOTclbasedroutingcan occur.Thepenaltyfordoingthisisamuchlongerexecutiontimeforlargersimulations(suchas Teledesic),butforsmallersimulations,thedifferenceisnotasnoticeable. Anexamplescriptdetailingtheuseofthisnewoptionisshownin~ns/tcl/ex/satwired.tcl,anda similartestinthesatellitetestsuiteexercisesthiscode.Additionally,allofthesatelliteexample scriptsin~ns/tcl/exdirectorycanbeconvertedtoOTclroutingbyusingthe$nsnodeconfig wiredRoutingONoption.However,thereareafewcaveats: Thewiredroutingoptionforsatellitehasonlybeentestedwith(thedefault)staticrouting: $nsrtProtoStatic.Thecodetriggersaglobalroutingtableupdateuponanysatellite topologychange. Theoptiondata_driven_computation_cannotbesetto``true''whenwiredRoutingisON. Notethattheenablingordisablingofdata_driven_computation_cangivesubtle differencesinsimulationoutputsinceroutesarecomputedatdifferenttimes(while propagationdelaysarecontinuouslychanging).Thiseffectcanbeseenbytogglingthis parameterintheIridiumexamplescript~ns/tcl/ex/satiridium.tcl. Inthetracefile,whenapacketisdroppeddueto``noroutetohost''(suchaswhenthere isatopologychange),thetracelooksabitdifferentdependingonwhetherwiredRouting isturnedOFForON.Intheformercase,thereisonelineperdrop,withthedestination labelledas``2''.Inthelattercase,therearethreeevents(enque``+'',deque``'',and drop``d'')correspondingtothesamepacket,andthedestinationisshownas``1''. Inrarecases,theremaybewarningmessagesduringtheexecutionindicating``nodeout ofrange.''Thiscanoccurifanodebecomesdisconnectedinthetopologyandthen anothernodetriestosendapackettoit.Forexample,tryenablingwiredRoutinginthefile ~ns/tcl/ex/satmixed.tcl.Thisoccursbecausetheroutingtableisdynamicallysizedupon topologychange,andifanodebecomesdisconnecteditmaynothaveanyentries insertedintheroutingtable(andhencetheroutingtableisnotgrowntoaccommodateits nodenumber).Thiswarningshouldnotaffectactualtraceoutput. satmixed.tclAsimulationwithamixtureofpolarandgeostationarysatellites. satwired.tclSimilartothepreviousscript,butshowshowtoconnectwirednodestoa satellitesimulation.

Anda mungkin juga menyukai