Sie sind auf Seite 1von 9

58

Mano
Ihavethelight,comegetenlightened
FEB82011

ObtainingNodePositionandEnergyDynamically
inNS2.34

ToreadthisarticleinScribdgo<here(hp://www.scribd.com/doc/48500440/nsNodePosition)>
Foranalternativemethodtoobtainanodesposition,go<here>
HappytomeetyouinanotherinterestingtaskinNS2!
Thistimewewilldynamicallycalculateanodespositionandremainingenergy.Thispostisbasedonthe
valuabletipsmentioned<here(hp://elmurod.net/wps/?p=348)>byElmurodTalipov(hp://elmurod.net/wps/?
page_id=2).
Nowtothetask
Iwillbemodifyingthesamplescriptsimplewireless.tclfoundat~/nsallinone2.34/ns2.34/tcl/exandallmy
tasksinns2wouldbebasedonAODVprotocol.
1.Insimplewireless.tcl,changetheroutingprotocoltoAODV,enableEnergymodelandsettheinitialenergy
value.

(hps://getch.wordpress.com/2011/02/08/obtainingnodepositionandenergydynamicallyinns2/nodepos1/)
2.InthenodecongurationsettheEnergyModel,InitialEnergyvalue,powerspentinreceivingmode,transmit
mode,idlemodeandsleepmode.

(hps://getch.wordpress.com/2011/02/08/obtainingnodepositionandenergydynamicallyinns2/nodepos2/)
3.Nowwewillmovetothebackendcode(c++).Oureditswouldbeperformedonlyinaodv.ccandaodv.h.
4.Inaodv.h,rstincludethefollowingheaderlethatcontainstheprocedures/functionsneededtoaccessnode
postion,energyandseveralotherfunctions.
#include<mobilenode.h>
YouwillndclassAODV,somethingliketheoneshownbelow.

(hps://getch.wordpress.com/2011/02/08/obtainingnodepositionandenergydynamicallyinns2/nodepos3/)5.
Inthat,declarethefollowingvariablesinprotectedscope.

(hps://getch.wordpress.com/2011/02/08/obtainingnodepositionandenergydynamicallyinns2/nodepos4/)
Withthat,nomoreworktobedoneinaodv.h.Whatwehaveactuallydonehereistodeclarethevariablesthat
wewillusinginaodv.cctorecordanodespositionandenergy.
6.Inaodv.cc,wewillinitializethevariablesthatwehavejustdeclaredinaodv.h.ThiswedointheAODV
constructor(invokedonlyonceduringnodecreation).

(hps://getch.wordpress.com/2011/02/08/obtainingnodepositionandenergydynamicallyinns2/nodepos5/)
7.Next,weincludethecodetoaccessthefunctionsinmobilenode.h,thatfetchthenodescurrentpositionand
energy.

(hps://getch.wordpress.com/2011/02/08/obtainingnodepositionandenergydynamicallyinns2/nodepos6/)
IhaveincludedthatcodeAODV::forward()function,sothatthenodespositionandenergyareprintedeach
timeitforwardsapacket.WhereandWhenyouwantthemtobeprintedisyourchoice.Alternatively,youmay
havethecodeincludedinthefunctionofyourchoiceandhavetheoutputredirectedtoale.
8.Thatsall!Allwehavetodonowistorunsimplewireless.tcl
$nssimplewireless.tcl
andtheoutputwouldbesomethinglikethis:

(hps://getch.wordpress.com/2011/02/08/obtainingnodepositionandenergydynamicallyinns2/nodepos7/)
Ifyoundanydiscrepanciesinthispost,pleasefeelfreetodropmeamailatmicman.manoj@gmail.com.By
doingso,Youwouldbesavingthevaluabletimeofmanyresearchers.

(hps://getch.wordpress.com/2010/12/30/cognitiveradionetworksimulatorinstallation/blogger_appeal/)

ThisarticleislicensedunderGNUGENERALPUBLICLICENSE
(http://www.gnu.org/licenses/gpl.html)

Abouttheseads(https://wordpress.com/abouttheseads/)

ByManojKumarPostedinNetworkSimulator(ns)Taggednodeenergy,nodeposition,ns2

58commentsonObtainingNodePositionandEnergy
DynamicallyinNS2.34
1.PINGBACK:FindingNodePosition,VelocityandSpeedinNS2.34tutorMicman
Bharathi
FEBRUARY25,2011@10:35AM
Himanoj,
Couldyoupleasehelpmeonndingthewaitingtimeofawirelessnode.
iamcreatinganewroutingprotocolformynalyearB.Techprojectandwouldrequestyoutohelpme.
venkat
MARCH12,2011@9:55AM
hicanudothesameinopnet
rajesh
MARCH14,2011@3:05PM
canudosameformeinDSDVprotocal
manoj1987
MARCH14,2011@10:22PM
SorryBro!
Icantdoyourhomework!
manoj1987
MARCH14,2011@10:28PM

MARCH14,2011@10:28PM
IamnotfamiliarwithOpnetbrother!
Pavithra
MARCH20,2011@2:24PM
Sir,
IneedatclscripttondtheresidualenergyofnodesaftertheytransferthepacketsinAODVitriedthe
aboveprocedureigoterrorintheenergymodel..canyouplzhelpmetomakeoutthisandonemoreissue
isthatIamusingxgraph12.1andIneedtorescalexaxisvaluetohaveintegersandnodecimalssincexaxis
isnumberofnodes..canyoupleasehelpmetomakeoutthis..thanksinadvance.
shilpa
MARCH22,2011@2:32PM
hellosir,howtoputdierentinitialenergylevelstodierentnodesplsgivesuggestmea
solution..
Pragati
MARCH23,2011@12:28AM
hi,
Canuplztellmehowtoadddelayonwirelessnode
Narendra
APRIL13,2011@12:54PM
sir,
canyoutellmehowtodolocalrepairinAODVusinghandoapproach??
forthiswhereishouldeditplzsuggestmesir
rahma
MAY20,2011@1:48PM
Salam&Hello
howwecanredirecttheoutputonale??
IneedthevalueofreceivedsignalstrengthPrandthepositionofnodeeveryxsecondonseparatelytrace
le
pleasehelp,
abhi
MAY28,2011@10:40AM
hifriends..
plshelpandsaveme
iamabhinowiamdoingmyb.techprojectiwantcodeforDYNAMICROUTINGWITHSECURITY
CONSIDERATIONS.Anyonehavecodeplsreplyonce..
iwantimplementedinNS2TOOLbyusingTCLlanguage
MuhammadHammad
JUNE11,2011@10:30AM
Sir,Canugivemethecompletecodeforsimulatingzigbeeinns2.34
M.Geetha
JUNE16,2011@6:54PM
iwantns2tclcodeforaodv&aomdvprotocolusingTCP
Dongsheng
JULY22,2011@9:44AM
Hi,Manoj
Couldugivemesomehelponhowtoextractthecurrentnodesownspeed.Notjustprintonscreen.
BecauseIwanttoeachnodebeabletoknowitsspeed,positioninmyAgentsC++code.
Appreciated
Dsheng
sambiymishra
AUGUST28,2011@4:42PM
hifriends,
iamsambit,doingmymtechprojectoncooperativecachinginmanet.butifacesomeproblemslike
howtomakedynamicclusteringamongthenodesinmanet
howtospreaddataitemsinsidemanet
howtocallac++procedurefromtclscriptetc
cananyonehelpmeinthisregard.

cananyonehelpmeinthisregard.
mymailid:sambitmshr2@gmail.com
thanks
SharjeelBinAfzal
SEPTEMBER15,2011@12:56PM
hiManoj
iamfacingsomeproblemsrunningthiscode.
firstlyinthenodecongpartinthetclle,theenergyModelonline94andidlePoweronline98arebeing
consideredasinvalidcommandnames.
secondlywhenicommentthemiamnotgeingthedenedoutput(whichmeanatleastthePOSITION)in
thesimple.trle.
Kindlyhelpasap
Regards
BeroOo
SEPTEMBER16,2011@10:45AM
GreatarticleThankyouforyourhelp!
jankrisjanaki
SEPTEMBER26,2011@11:38AM
Hellosir,canutellmehowtomakeanactivenodebecomepassive?
jankrisjanaki
SEPTEMBER26,2011@11:43AM
himanoj,
howtoobtainnexthopofanodeinaodv(ns2),usinggodobject?ifnotpossibleusinggodthenhowelse?
Jerusha
OCTOBER11,2011@2:38PM
hi,
Iwantasinglenodesposition.Howihavetoaddtheconditionintheaboveprogram.Canuplztellthat
condition.
Jeru
siwar
OCTOBER20,2011@2:52AM
Hello;
itriedtoexecutethisexapmlewithoutsuccess.
Ididnotgettheinformationsintheterminal.
shoulidomakeetmakeinstallforns2aftermodifyingtheaodv.ccandadodv.h?
igetalsoenerroinvalidcommandnamewheniaddnodecongidlPower??
Anyhelpplease???????
thanksinadvanceforyourhelp.*
siwar
SharjeelBinAfzal
OCTOBER27,2011@12:46AM
HiBeroOoandeveryoneelse
cananyoneofyoupleasetellmehowthiscodeisrunningattheirend?
doweneedtoputsomechangesinitorwhatelse
ThanksandRegards
DivyaGanesh
NOVEMBER3,2011@11:26PM
HelloManojSir,
canIdothesamechangesinns2.31versioncanyoupleasehelpmesir,whatdoIneedtomodify
additionally
Thanks&Regards,
DivyaGanesh
BeroOo
NOVEMBER5,2011@11:31AM
Yes,therearesomelilechangesonthecodetowork..Contactmeonmyemailifyouwantmorehelp.

Karuppasamy.K
JANUARY9,2012@7:07PM
Iwanttoknowwhatrthecompanies(likeIBM,HCL.ect..)usingNS2fortestingordevelopingorsome
otherpurpose.
plzzztellme..
sasidhar
JANUARY31,2012@1:01PM
canusendthisobtainingnodepositionandenergyfortheDSRroutingprotocol
sasidhar
JANUARY31,2012@1:04PM
canusendthisobtainingnodepositionandenergyfortheDSRprotocol
ManojKumar
FEBRUARY6,2012@8:34PM
IdontthinkanycompanyisusingNS2foritsservices/production!
shravani
FEBRUARY23,2012@10:30AM
WearedoingourB.Techmainprojectonthetopic:loadbalancingAnApproachBasedonClusteringin
Manet.WeareplanningtodothisinNS2.Wearecompletelynewtothistopic.Andwouldliketoknowthe
detailsonthefollowing:
1.howtocreatenodesdynamicallyusingcbrp
2.selectingclusterheads
parthpatel
FEBRUARY24,2012@5:41PM
hello..monojsir..isuccessfullyaddedabovemodicationbutidontgetprintedvalueatmyterminal
window..pleasedoreply
aruvi
FEBRUARY28,2012@2:52PM
hi,
amnotgeingnodespositionandenergy
amjustgeingSORTINGLISTSDONE
NSEXISTING..
pleasehelpmeinsortingoutthis
jaya
FEBRUARY29,2012@11:30AM
hello
willupleasetellmehowanodecangoinsleepmodeandcomebacktoitsrealstate,usingAODVprotocol
inns2.35
aruvi
MARCH5,2012@9:18AM
howtoreplicatedataitemsinmobilenodesusingns2
Etuari
MARCH5,2012@3:21PM
canweassigndierentenergyvaluefordierentnodes??????????????????inns2
thenhow??????????plz.helpme
zizo
MARCH8,2012@5:10PM
onthelastcode??whatdoesmean(index)
itsnotdeclared???Howcanwedeclareit
thankyousomuch
Sathya
MARCH9,2012@11:01AM
canusuggestmehowcanitrackamobilenode.Pleasereply
sai
MARCH10,2012@11:15AM
howtondenergylevelonnode
Gem
MARCH20,2012@11:14AM

HiAll,
Idonotgettheoutputastheterminal.Cananyoneexplainhowtogettheoutput.please
Jyoti
MARCH20,2012@3:36PM
HiEveryonethisisJyotifromTechnoZonk.
WecandevelopanykindofsimulationbasedonNS2.
NS2ProjectDevelopersandNS2TrainingInIndia.Having14+yearsexperienceinNetworking,Linuxand
NetworkSimulatorover7+years.FirsttimeProfessionalNs2Reserchprojectsdevelopmentdonebyusand
deliveredmorethan300projectsaroundIndia.Alsotrainedmorethan2000studentsinns2.Havingstrong
knowledgetobringnewdomainandcreatestrongprofessionalsforthesame.
Contactus:9920118169
formoreinfooremailusonrungtajyoti@yahoo.co.in
Mary
APRIL21,2012@1:23PM
Sir,
Couldupleasetellhowtoprintthesignalstrengthofaparticularnodeinns2.Ihavealreadyprintedthepr
valuebycopyingtheprintstatementfrompropagation.cctotworayground.cc.nowplwasehelpmetoprint
prforaparticularnodesir
jitendergrover
APRIL24,2012@1:46PM
hellosir.canyoutellmeifwewanttochangepowerleveloncertainconditionhowwecandoit.
SHAHID
MAY4,2012@2:59PM
Thankyouforsharingthisitworks
gayathri
MAY6,2012@3:59AM
Hi,
Thanksforyourcode..triedthesame..iamgeingsegmentationfault..Iamverynewtons2..Canyou
pleasetellmehowtodebug?
bala
MAY11,2012@3:13PM
canutellmehownodescanbemadeastask
hamza
JULY1,2012@1:03PM
whichenergyismaxatnodes?kineticorpotential.
Mitra
JULY20,2012@7:24PM
himanoj
Immitranimsohappytonadurblogitssohandy.
thankusomuch4urawesomecode,iverunitanditdoesworkverywell
butiwanttodotheexactsamethinginmytclle
imeanndingthecurrentmobilenodepositionintclcode
willupleasehelpmeoutwithit.
iappreciateanyhelp.
latha
SEPTEMBER14,2012@7:10PM
howtocompilens2,34afteraddingenergyandpositiondetailstogetpositionandenergy.
TZS
SEPTEMBER16,2012@12:36AM
willthispieceofcodeworkonns2.28?Ihavetriedit,butithasnt.Whatcanbethepossiblealterations?
Dalia
SEPTEMBER26,2012@5:28AM
whataboutDSRprotocol??
imad
OCTOBER16,2012@4:04PM

howtocompareparticularnodewithcurrentindexvalue
forexampletocompare5nodewithindexvalue
howtochangecodeinaodv.ccle
Najma
NOVEMBER8,2013@5:06AM
Hi,
iwanttoprinttransmissionenergyandreceptionenergywithnodeIDofwheneverpacketissentand
receive.Icanprintthetransmissionandreceiveenergywheneverthisoperationisperformedinwireless
phy.ccbutunabletoprintthenodeID.IllbegratefulifanyonecanguidehowtoprintnodeIDinwireless
phy.cc.
Regards,
Najma
ramesh
NOVEMBER29,2013@1:07AM
himanojcouldyoupleasewriteanarticletoprintcurrentloadofnodedynamically.
ramesh
NOVEMBER29,2013@9:31PM
ididallchangesabovementioned.andwheniexecutemakeiamgeingbelowerrorerror:invaliduseof
incompletetypeclassMobileNode
ypos=iNode>Y();
pleasehelpme
jeya
DECEMBER12,2013@4:29PM
canutellmehowtodisableanodeonparticulartime
Hien
DECEMBER14,2013@6:27PM
hi!
Itrytorunsimplewireless.tclfollowyourconductbutIseeaerror:
invalidcommanenergyModel
socanyouhelpme?
sona
DECEMBER29,2013@5:31PM
canyouhelpmetondingHCTTprotocolforsolvingboundryproblemsincusters?
a.q
JANUARY3,2014@7:58PM
iimplementthiscodetogettheenergyofnode,makecommandwassuccessfulwithouterrorsbutwheni
compiletclleitgivesmesegmentationfault.pleasecananyonehelpmewhythiserrorandhowtoxit???

BlogatWordPress.com.

Das könnte Ihnen auch gefallen