Performance Evaluation of ZigBee Network for Embedded Electricity Meters

KUI LIU

Masters’ Degree Project Stockholm, Sweden Sep 2009

XR-EE-RT 2009:020

Abstract ZigBeeisanemergingwirelesstechnologyforlowpower,lowdatarateandshort rangecommunicationsbetweenwirelessnodes,whichisshowingapromising future.Thisresearchprovidesanoverviewof802.15.4andZigBeestandard.Atest benchwascreatedtoevaluatetheperformanceofZigBeenetworkforelectricity metersapplications.TheresultsfromthetestshowthatZigBeesupportsalarge networksize,arangeof75mwithinlineofsight,afairlylargeeffectivedatarate thatisenoughformeteringtrafficandverylowpowerconsumptiondevices.These characteristicsareverysuitableforelectricitymetersapplicationswherecostand powerconsumptionisthemajorconcern.

2

Acknowledgements MydeepestgratitudegoesfirstandforemosttomysupervisorJimmyKjellsson,for hisconstantguidanceandencouragementandalsoforthehelpthroughoutall phasesofthisthesis;AndHenrikSandberg,forhispatienthelpandilluminating instructionthroughallthestagesofwritingthereport. IalsoowemysinceregratitudetoNiclasEricssonforthehelpofprogrammingand wonderfuladvices.IwouldalsoliketothankThomasLindh,ViktoriaFodorfrom KTHandTomasLennvallforbeingverysupportiveduringthethesiswork.Thanks alsotoKarlHenrikJohansson,JimmyKjellssonandTobiasGentzellforbeingpartof theinterviewandofferingmethisgreatopportunitytoworkwiththiswonderful group. LastmythankswouldgotomyfriendsImadeinVästerås,forallthegoodtimes spenttogether,andalsoforyourbeingsoniceandsupportiveallthetime.

3

Table of Contents

Abstract...... 2 1. Project Introduction ...... 9 1.1Motivation ...... 9 1.2ProblemFormulation ...... 10 1.3Contributions ...... 11 1.4Outline ...... 11

2. Introduction to ZigBee and Z-Stack ...... 12 2.1ZigBeeIntroduction ...... 12 2.1.1Generalintroduction ...... 12 2.1.2Operationalmode ...... 14 2.1.3ZigBeelayerstructure...... 18 2.1.4ZigBeestructure ...... 19 2.1.5ComparisonwithWiFiandBluetooth...... 19 2.2IntroductiontoZStackDevelopmentKit ...... 20

3. Packet Delay and Range Study ...... 24 3.1Testimplementationsandpreparations ...... 24 3.1.1Roundtriptime(RTT)calculation ...... 24 3.1.2Implementation...... 25 3.1.3Radiotransmissionrangefactors ...... 27 3.2Testsandresultanalysis ...... 29 3.2.1Outdoortest ...... 29 3.2.2Indoortest ...... 36 3.2.3Interferencetest ...... 40

4. Other Performance Metrics...... 42 4.1PowerConsumptionMeasurement ...... 42 4.1.1Pollingwithoutdatatransmission ...... 42 4.1.2Pollingwithdatatransmission ...... 45 4.1.3Joinandrejoinprocess...... 46 4.2Throughput...... 47 4.3NetworkSizeandAddressing ...... 48 4.4Security...... 50

5. Conclusion ...... 52 5.1ConclusionofZigBeeNetworkPerformance...... 52 5.2ComparisonwithOthers’Work ...... 52 5.3ChallengesandFutureWork ...... 52

Appendix ...... 56 [A]IntroductiontoCSMA/CA ...... 56 [B]Fullnamesofabbreviationsinframestructure ...... 58 [C]BPSKandOQPSK ...... 59 [D]Applicationlayerisfurtherdividedintothreelayers ...... 59 [E]Testenvironmentphotosandfloorplans...... 60 [F]Sometestresultnotpresentedinthethesis...... 62

4 List of Figures Figure1.1ElectricitymetersimplementedinSuvarnabhumiInternational Airport,Bangkok Figure1.2Communicationarchitectureofmeters Figure2.1ZigBeeoperationalbands Figure2.2ThreekindofZigBeenetworktopologies Figure2.3ZCandZEDbehaviorinBeaconEnabledMode Figure2.4ZCandZEDbehaviorinNonBeaconEnabledMode Figure2.5Superframestructure,eachtwoareseparatedbyabeacon Figure2.6ZigBeefourlayerstructure Figure2.7ZigBeeFramestructure Figure2.8RangeandDataRatecomparisonofZigBee,BluetoothandWiFi Figure2.9ChipconSmartRF04EBEvaluationBoardwithCC2430EM Figure2.10ChipconCC2430DBDevelopmentBoard Figure2.11CC2430DBjoystick Figure3.1Aroundtripofapacket Figure3.2PackettransmissionprocessfromZCtoZR Figure3.3Generaltestscenario Figure3.4FresnelZone Figure3.5Scenario1,asinglehopwithadistancefrom5mto85m Figure3.6ScattergramofRTTwithdistancesfrom20mto85m Figure3.7ZoominversionofscattergramofRTTfor20minFigure3. Figure3.8HistogramofRTTwithadistanceof20m,50mand75m Figure3.9AccumulativecurveofRTTfor50m,75mand85m Figure3.10ZoomedinaccumulativecurveofRTTfor50m,75mand85m Figure3.11Scenario2testwith1hop,2hopsand3hops Figure3.12Roundtriptimewith1hop,2hopsand3hops Figure3.13Scenario3testwithdifferentantennas Figure3.14EmbeddedPCBantennaVsTitanisantenna Figure3.15PerformancecomparisonwithdifferentobstaclesbetweenZCandZR Figure3.16Testscenariowithmicrowaveinterference Figure3.17TestscenariowithBluetoothinterference Figure4.1Powerconsumptionmeasurementcircuit Figure4.2Pollingwithoutdatatransmission Figure4.3Zoomedinofpart1inFigure4.2 Figure4.4Zoomedinofpart2inFigure4.2 Figure4.5Pollingwithdatatransmission Figure4.6ZoomedinversionofFigure4.5 Figure4.7Powerconsumptionofjoinprocess Figure4.8Powerconsumptionofrejoinprocess Figure4.9Maximumdatarateinonewaytransmission(fromZCtoZR)

5 Figure4.10Maximumdatarateintwowaytransmission(bothZCandZRare transmitting) Figure4.11Networkaddressassignmentexample Figure4.12AddressassignmentverificationbySNA FigureA.1UnslottedCSMA/CAalgorithmusedinnonbeaconenabledmode FigureA.2SlottedCSMA/CAalgorithmusedinbeaconenabledmode FigureB.1ZigBeeframestructure FigureD.1ZigBeeapplicationlayerstructure FigureE.1Outdoortestscenarioandenvironment FigureE.2PlanoffloorCinABBCorporateResearchofficebuilding FigureE.3PlanoffloorBinABBCorporateResearchofficebuilding FigureE.4PlanoffloorAinABBCorporateResearchofficebuilding FigureE.5FloorplaninApartmentSkalden2

6

List of Tables Table2.1ComparisonofthreeISMfrequencybands Table2.2GeneralcomparisonofZigBee,BluetoothandWiFi Table3.1Comparisonoftransmissionconditionwithadistancefrom20mto85m Table3.2Receivedpowerwithadistancefrom10mto85m Table3.3Roundtriptimewith1hop,2hopsand3hops Table3.4Comparisonoftransmissionconditionwithadistancefrom20mto115m inthecorridoroffloorC Table3.5TestresultcomparisoninfloorA,BandC Table3.6Performancecomparisonwithdifferentobstaclesinbetween Table3.7Testtheinfluenceofwooddoors Table3.8Influenceofinterferenceonpackettransmission Table4.1Descriptionandpowerconsumptionofeachstage Table4.2Cskipalgorithmexample Table4.3MACsecuritylevel TableG.1OthertestresultsinSkaldenapartment

7

Abbreviations ACK Acknowledgement ACL AccessControlList AES AdvancedEncryptionStandard APS ApplicationSubLayer BO BeaconOrder CAP ContentionAccessPeriod CFP ContentionFreePeriod CSMA/CA CarrierSenseMultipleAccesswithCollisionAvoidance FFD FullFunctionDevices GTS GuaranteeTimeSlots MAC MediumAccessControl MIC MessageIntegrityCode MTU MaximumTransportUnit NWK Network PCB PrintedCircuitBoard PHY PhysicalLayer PAN PersonalAreaNetwork RFD ReducedFunctionDevice RTT RoundTripTime SNA SensorNetworkAnalyzer SO SuperframeOrder TI TexasInstrument UART UniversalAsynchronousReceiverTransmitter WLAN WirelessLocalAreaNetwork WPAN WirelessPersonalAreaNetwork WSN WirelessSensorNetwork ZC ZigBeeCoordinator ZDK ZStackDevelopmentKit ZED ZigBeeEndDevice ZR ZigBeeRouter

8 Chapter 1 1. Project Introduction

1.1 Motivation

Submeteringofelectricityisbecomingincreasinglyimportantwhenenergy efficiencyisinfocusallovertheworld.ControlofCO 2emissionsandincreasing energypricesarethemaindriversbehindtheincreasedawarenessforenergy consumption.Measuringtheactualenergyconsumptiononindividualdevicesoron separateroomsisaveryefficientwayofunderstandingandevaluatingtheenergy efficiencyforaparticularbuilding.Electricitymetersarewidelyappliedinmany placesincludingairports,shoppingmalls,aswellaswarehousesetc.1500 electricitymetersareinstalledforcostdistributionandenergyefficiencyin SuvarnabhumiInternationalAirport,Bangkok.

Figure1.1ElectricitymetersimplementedinSuvarnabhumiInternationalAirport, Bangkok(ApicturefromGoogleImage) Moredetailedinformationaboutconsumptionisprovidedandimmediatefeedback ofusageisgivenwhichallowstheusertoturnoffthingsthatarenotneededand enablesutilitiestobetterregulatesupplyandtorefinetheirpricingstructurebased ondemandcycles. Itwouldreducethecostconsiderablytoprovidereadingfromelectricitymeters insteadofdoingitmanually.Twowaycommunicationisalsonecessaryifthemeter canalsoreceiveandactoninstructionssentfromtheutilityorconsumer.The followingfigureshowsthecurrentcommunicationarchitecturesofmeters.Different architectureisusedaccordingtotherequirements.Wiredcommunicationissuitable whendataisexchangedfrequently,whilewhencableinstallationisnotpossible, wirelesscommunicationisrequired.

9 Wired (Bus) Wireless (Radio)

Combined (Wired, wireless and legacy)

Legacy (IR)

Figure1.2Communicationarchitectureofmeters Theproblemwithlegacyinfraredcommunicationisthat,everymeterrequiresone communicationmodule(pointtopointcommunication)whichcontributesmostto thetotalcost.Itisverymeaningfultofindasubstituteprotocolthatsupportpoint tomultipointcommunication. Therearemanywirelesstechnologiesavailableandupcomingnowadays,notonly forWirelessLocalAreaNetwork(WLAN),includingIEEE802.11basedtechnologies, butalsoforWirelessPersonalAreaNetwork(WPAN),whereZigBeeandBluetooth arethemostpopularstandards.Afteracarefulevaluationofseveralexisting technologiesofWPANin [11] ,someinterestingwirelesstechnologiesareproposed andoneofthemostinterestingtechnologiesisZigBee(Thereasonisexplainedin [11]).Someotherinterestingproprietaryprotocolsfromseveralchip manufacturerswerealsoevaluated,butthedrawbackisthatthereisonlyone provider. Itwouldbeverychallengingtocomeupwithadefiniterecommendationfora wirelesstechnology.Ononehand,therequirementsforthetechnologyarenot completelyknownatthisstage.Ontheother,theexactperformanceofthevarious wirelesstechnologiesinthescenariosenvisionedfortheelectricitymetersare unknown.Inthiscase,thereisariskthatarecommendationwhichseemsgood“on paper”turnsouttobebadinreallife,see [11] . Beforeproposingadefiniterecommendation,theperformanceoftheinteresting wirelesstechnologiesshouldbeevaluatedusingademonstratororprototype,which isthetopicofthisthesis.

1.2 Problem Formulation Asiswellknown,ZigBeeisaglobalstandarddesignedforlowdatarate,low powerconsumptionandlowcostapplications.ItusesthefreeISM(Industrial, ScientificandMedical)frequencyband,whichreducesthecosteffectively.

10 Comparedwithsomeproprietaryprotocols,therearemanysupplierswithboth hardwareandstacksolutions.Besides,itisrobustagainstinterferenceandnot difficulttotunnelotherprotocolsthroughZigBee.Therearesomedrawbacksof ZigBeestandardaswell: • InZigBeenetwork,collisionsarepossibleduetotheuseofCSMA/CA algorithm(detaileddescriptioninappendix[A] ); • Theroutingnodesmustbeawakemostofthetime,whichincreasethe powerconsumptiondramatically. • Inaddition,differentdevicesareimplementedwithdifferentcapabilities whichresultsinhighcomplexity. Themainfocusofmetersiscost;itwouldreducethecostifonecommunication modulesupportsalargenumberofmeters,oralargenetworksize.Thepower consumptionneedstobelowifthedevicesarebatterypowered.Securityisalso necessarytopreventfromchangingthemeteringdata.Dataratedoesn’thaveto behighsincethemetersonlyreportasmallamountofdatadailyorevenmonthly. Themaintaskofthisthesisworkistocreateatestbenchthatcanbeusedto evaluateperformanceofZigBeeforelectricitymetersapplications.Aseriesof performancemetricswillbestudied,whichare: • Throughput • Sizeofthenetwork • Security • Powerconsumption • Packetdelayandrange Someotherfactorsthatwouldaffecttheperformancelikethetransmitpower, interferencenode,antennatypeetc,arealsoveryinteresting.Asthetimeislimited, itissuggestedinthefuturework. 1.3 Contributions ThecontributionsofthisthesisworkincludebothafullstudyofZigBeestandard andanevaluationofperformanceofZigBeenetworkinrealenvironment.

1.4 Outline Tostartwith,anintroductiontoZigBeestandardandZStackDevelopmentKitis giveninChapter2. InChapter3,whichisthemainpart,packetdelayandrangearestudied.Atest benchisimplementedandseveralscenariosaredesignedtoevaluatethe performanceoftheZigBeenetwork.Measurementsareprocessedunderthese scenariosandresultswillbeanalyzedanddiscussed. SomeotherperformancemetricsarealsostudiedinChapter4,includingpower consumption,throughput,networksizeandsecurity. TheninChapter5,aconclusionisgivenwhetherZigBeenetworkissuitableornot forelectricitymeterapplications.

11 Chapter 2 2. Introduction to ZigBee and Z-Stack

2.1 ZigBee Introduction

2.1.1 General introduction ZigBeeisanemergingtechnologydesignedforlowdatarate,lowpower consumption,andlowcostapplications.Thename“ZigBee”comesfromthezigzag waggledancethathoneybeesusetoshareinformation,likethelocation,distance anddirectionofafoodsource.Themainapplicationareaiswirelesssensor networks(WSN),whereenergyislimited(thebatteriesshouldholdforyears), transmissionrangecanbesmall,andtransmissionratecanalsobesmall.ZigBeeis alsowidelyusedinhomeautomationandindustrialcontrol. ZigBeeandIEEE802.15.4arestandardsbasedprotocolsthatprovidethenetwork infrastructurerequiredforwirelesssensornetworkapplications.802.15.4defines thephysicalandMAClayers,andZigBeedefinesthenetworkandapplicationlayers. ZigBeenetworkhasashorttransmissionrange,usuallyfrom10mto75m,whichis highlydependentontheparticularenvironment.Humidity,interference,andalso barriersinbetweencanaffectthetransmissionrange. Frequency bands ZigBeeisidealforwirelesssensornetworksmainlybecauseoftheimplementation ofalowpowerphysicallayer(PHY).Inthisdesign,ZigBeeisallowedtooperateat threeunlicensedISMbands:868MHz(Europe),915MHz(NorthAmerica),and2.4 GHz(Worldwide).Thefollowingtableshowsacomparisonofthesethreebands: PHY Frequency Channels Modulation Bitrate Symbolrate (MHz) band(MHz) Number [C] (kb/s) (ksymbols/s) 868 868868.6 0 BPSK 20 20 915 902928 110 BPSK 40 40 2400 24002483.5 1126 OQPSK 250 62.5 Table2.1ComparisonofthreeISMfrequencybands[7] Channel 0 Channels 1-10 868MHz / 915MHz 2 PHY

868.3 MHz 902 MHz 928 MHz 2.4 GHz PHY Channels 11-26 2MHz

2.4 GHz 3MHz 2.4835 GHz Figure2.1ZigBeeoperationalbands[16]

12 ZigBee network topology Drivenbytheneedofsimplenetworkmanagementandroutingandthepossibility ofenergysaving,threekindsofnetworktopologiesarewidelyused: • Star,appliedinhomeautomation,PCperipherals,toys,gamesetc.Itis merelyusedinsmallnetworksandishighlyreliableonthecenternode. • Mesh,usedinindustrialcontrol,wirelesssensornetworksandinventory trackingetc,wherethenetworksizeisusuallylarge.Comparedwithtree topology,meshprovidesmorereliability,whichisanimportantreasonofits popularity. • ClusterTree,inspecialcaseofPeertoPeerwithmanyfullfunctiondevices (FFD,describedlater).

Star Tree Mesh

Figure2.2ThreekindofZigBeenetworktopologies Addressing mode EachnodeinaZigBeenetworkhastwoaddresses,oneisa16bitnetworkaddress assignedwhenitjoinsthenetwork.Theotherisa64bitextendedaddresswhichis globallyunique. Device class and type Thedevicesaredividedintotwoclasseswithdifferentfunctionalities,soastoallow devicestohaveasimpledesign: •Fullfunctiondevice(FFD) o Anytopology o PANcoordinatorcapable o Communicatewithanyotherdevice o Implementscompleteprotocolset •Reducedfunctiondevice(RFD) o Limitedtocertaintopologies o CannotbecomeaPANcoordinator o Communicateonlywithanetworkcoordinator o Verysimpleimplementation o Reducedprotocolset

13 Thedevicesarealsoclassifiedtothreetypes,accordingtotheroletheyplayinthe network. ZigBeeCoordinator (ZC,theblackonesinthecenteroffigure2.2,FFD) Coordinatorscanstofindanunusedchanneltostartanetwork.Itisthefirstdevice inthenetwork.TheCoordinatornodechoosesachannelandanetworkidentifier, alsocalledPAN(personalareanetwork)ID,andthenstartsthenetwork.[5] Oncethenetworkisestablished,theZCbehaveslikeaRouternode(ormayeven beremoved).Thecontinuedoperationofthenetworkdoesnotdependonthe presenceoftheZCduetothedistributednatureoftheZigBeenetwork. ZigBeeRouter (ZR,thegreyonesinfigure2.2,FFD) Routerscanstofindanactivechanneltojoin,thenpermitsotherdevicestojoin.It alsoassistsincommunicationforitschildenddevices.Ingeneral,routersare expectedtobeactiveallthetimeandthusconsumemorepowercomparedwith enddevices. ZigBeeEndDevice (ZED,thewhiteonesinfigure2.2,FFDorRFD) Asthenameimplies,EndDeviceisthe“end”ofthenetwork.Itdoesnotsupport childdevicesandwillalwaystrytojoinanexistingnetwork.Anenddevicehasno specificresponsibilityformaintainingthenetworkinfrastructure,whichsavesalot ofpowerandmemory.Thusitcanbeabatterypowerednode. 2.1.2 Operational mode AZigBeenetworkcanworkineitherbeaconenabledmodeornonbeaconenabled mode. Inbeaconenabledmode,theZCandZRtransmitbeaconsperiodicallytoconfirm theirpresencetoothernetworknodes,see [6] .Figure2.3showsthebehaviorof ZCandZED. • FromZCtoZED; o ZCannouncesinthebeaconofdatapending o Ifthedataisdestinedtoit,ZEDsendsadatarequesttoZCusingslotted CSMACA(CarrierSenseMultipleAccesswithCollisionAvoidance,described inappendix [A] ) o Afterreceivingtherequest,ZCsendsanacknowledgement(ACK)backand thensendsthedatatoZED o ZEDacknowledgesifitreceivesthedatasuccessfully • FromZEDtoZC; o ZEDlistenstobeaconmessageandthengetssynchronizedwithsuperframe structure o Aftersynchronization,ittransmitsdatausingslottedCSMACA o ZCacknowledgesofdatareceiving(optional).

14 Coordinatorto EndDevice End DevicetoCoordinator

ZC ZED ZC ZED

Beacon Beacon

Data Request Data Acknowledgement

Data Acknowledgement Acknowledgement (optional )

BeaconEnabl edMode Figure2.3ZCandZEDbehaviorinBeaconEnabledMode Infigure2.3andfigure2.4,ZCcanbereplacedbyZR.Actually,thisbehavioris betweenparentdeviceandchilddevice. Innonbeaconmode,thetransmissionfromZCtoZEDisindirect,showninfigure 2.4. • FromZCtoZED; o DataisstoredinZC o ZEDpollsZCforstoreddataperiodicallyusingunslottedCSMACA(detail descriptioninappendix [A] ) o ZCacknowledgesthepollandsendsthedatatoZED o ZEDacknowledgesofthedatareceiving • FromZEDtoZC; o ItsimplytransmitsaccordingtounslottedCSMACA

15 Coordinatorto EndDevice End DevicetoCoordinator

ZC ZED ZC ZED

Data Request Data

Acknowledgement

Acknowledgement Data (optional ) Acknowledgement

Non BeaconEnabledMode Figure2.4ZCandZEDbehaviorinNonBeaconEnabledMode

Inbeaconmode,theZCandZRarealsoallowedtosleepininactiveperiod (mentionedlater).Theparentssendbeaconperiodicallytoannouncetheir existence,whilechilddeviceslistentothebeaconandgetsynchronized.Inthis case,allthedevicesknowwhentocommunicatewitheachother.Themost importantadvantageofbeaconmodeisthatitreducesthepowerconsumptionof thesystem.

Thedrawbackisdevicescannotsimplysendoutabeaconrequesttoseewhether thereisanetworktojoin.Instead,theyhavetolistenandwaitforabeacon,which obviouslyincreasesdeploymenttime.Besides,precisetimingisrequired.Devices thatmissthebeaconforsomereasonwilllosethesynchronizationafterawhile.As aresult,thereisabrokenlinkthatwillaffectothernodesaswell.Beaconmodeis moresuitablewhentheZCisbatteryoperated,butitisnotsuitableforlarge networks,see[15] .

Nonbeaconmodeistypicallyusedforsecuritysystemswhereenddevicesunits, suchasintrusionsensors,motiondetectors,andglassbreakdetectors,sleepmost ofthetime.Powerconsumptionisasymmetricinthismode,whereZCandZRhave tostayawakeandistypicallypoweredfrommainsource.However,ZEDisallowed tosleepforunlimitedperiodsoftime,enablingthemtosavepower.Thisapproach iswidelyusedinlargenetworks,see [19] .

Inthetest,thesystemisoperatinginnonbeaconenabledmode.Becausepackets aretransmittedcontinuously,ifZCandZRgotosleep,itwouldincreasethetest time.

16 Asuperframestructureisusedinbeaconmode:

Beacon Beacon

CAP CFP

GTS GTS GTS Inactive 0 1 2

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

SD= aBaseSuperframeDuration*2 SO symbols (Active)

BI= aBaseSuperframeDuration*2 BO symbols

Figure2.5Superframestructure,eachtwosuperframesareseparatedbyabeacon

Eachsuperframeconsistsofanactiveperiodfollowedbyaninactiveperiod.Two consecutivesuperframesareseparatedbyabeacon.

Eachactiveperiodconsistsof16equallengthslotsandcanfurtherbepartitioned intoacontentionaccessperiod(CAP)andacontentionfreeperiod(CFP).Slotted CSMA/CAisusedinCAP,deviceshavetocontendformediumaccess.Ifadevice requiresfixedtransmissionrate,itcanaskforguaranteetimeslots(GTSs).The maximumnumberofGTSinCFPis7andeachGTSmayoccupymorethanoneslot. [2]

Twonetworkconfigurationparametersareessentialtodeterminingthedutycycle ofanydevice:thebeaconorder(BO)andthesuperframeorder(SO). BO determineshowoftenthebeaconisbroadcasted(beaconinterval);SOdetermines theactiveperioddurationwithinthesuperframestructure.

Formulas

• aBaseSlotDuration =60symbols,whichis0.96mssincethesymbolrateis 62.5ksymbols/s. • aBaseSuperframeDuration = aBaseSlotDuratio n*16slots=960symbols= 15.36ms • Superframe Duration (SD) = aBaseSuperframeDuration*2 SO symbols (durationoftheactivepart) • Beacon Interval (BI) = aBaseSuperframeDuration*2 BO symbols(durationof thewholesuperframe)

Intheseformulas,0<=SO<=BO<=14.BO=15meansitisoperatinginnonbeacon modeandSO=BOmeansthereisnoinactiveperiod,see [8].

17 ZigBeestandardalsosupportsselfformingandselfhealing,whichmakesthe implementationandmaintenancemucheasier.Theassociationanddisassociation functionsareembeddedinitsMACsublayer.Whenanetworkstarts,ZCselectsa channelandidentifier(ID)forthePANandassignsa16bitshortaddress(network address)foradevice.Whenanewdevicejoins,itsendsanassociaterequesttoget anetworkaddress.AdeviceisconsideredorphanedifitmissesaMaxLostBeacons (defaultvalueis4).Theorphaningmechanismenablesthenetworktodetectlink ornodefailure,thustobeselfhealing,see[1] .

2.1.3 ZigBee layer structure

AllZigBeetechnologydevicesimplementlayeredstackarchitecture.TheZigBee stackusestheIEEE802.15.4Physical(PHY)andMediumAccessControl(MAC) Layers.InadditiontotheIEEElayers,theZigBeeAlliancehasdefinedasetof standardizedlayersthatsitontopoftheIEEElayersandtogethertheselayers makeuptheZigBeetechnologystackarchitecture.

Application Customer

ZigBee Application Layer (APL)

Application Framework (AF) ZigBee Device Object (ZDO) ZigBee Alliance Application Sub layer (APS)

ZigBee (NWK) 802.15.4 layer (MAC) IEEE 802.15.4 868/915 MHz 2.4 GHz Physical layer (PHY) (PHY) Figure2.6ZigBeefourlayerstructure Thelowerlayers(includingPHY/MAC,NetworkandSecuritylayers)makeupthe ZigBeestack.Theapplicationlayercanbefurtherdividedintothreelayers:ZigBee DeviceObjectlayer,ApplicationFrameworklayerandApplicationSublayer. (Detaileddescriptionisgiveninappendix [D] .) Customerscanbuilduptheirownapplicationsinapplicationlayer.Inthetests performed,anapplicationisimplementedintheapplicationlayertomeasurethe packetroundtriptime(RTT).

18 2.1.4 ZigBee frame structure

Figure2.7showsthestructureofaZigBeeframeandalsothecontentofheader andfooter.Whensendingapacket,itisfirstgeneratedintheapplicationlayerand thenaddedwithnetworkheader,MACheaderandphysicalheader.

Payload 0,5,6,10 Octe ts: 2 1 4 to 20 or 14 n 2 MAC Frame Data Address Auxiliary Data Control Sequence Information Security FCS Number Header Layer MHR MSDU MFR

Preamble Start of Frame PHY Sequence Frame Length MAC Protocol Data Unit (MPDU) Delimiter

Layer SHR PHR PSDU

PHY Protocol Data Unit (PPDU)

Figure2.7ZigBeeFramestructure(Seethefullnameoftheabbreviationsin appendix[B] .) Themaximumpayloadsizesupportedbytheapplicationlayerisbasedonthe settingsoflowerlayers.TheZigBeestandardhasdeclaredthatthemaximumPHY packetsizeis127bytes.Theactualdatarateisdependentontheprotocoloverhead added.Avarietyofheadersfrom9to25bytescanbeaddedtothepayload, dependingonaddressingfieldandsecurityheader.Ultimately,theuserdoesn’t havetoknowallthesettingsinordertogetthemaximumpayloadsize,or maximumtransportunit(MTU).AfunctiontoqueryMTUisprovidedbyAFlayer, see[5] . 2.1.5 Comparison with Wi-Fi and Bluetooth

ThetermWiFiisoftenusedasasynonymforwirelesslocalareanetwork(WLAN). Itismostlyusedfordatatransmission,withalongrangeandadatathroughputof 211Mbps. ZigBeeandBluetoothhavemuchincommon.BotharetypesofIEEE802.15 "wirelesspersonalareanetworks,"orWPANs.Theybothruninthe2.4GHz unlicensedfrequencyband,andusesmallformfactorsandlowpower. However,ZigBeeisfocusedoncontrolandautomation,exchangingsmallpackets overlargenetwork;whileBluetoothisfocusedonconnectivitybetweenlaptopsand PDA’s,aswellasmoregeneralcablereplacement.ComparedwithZigBeenetwork, largepacketsaretransmittedoversmallnetwork.Acomparisonofthesethree technologiesisalsoshowninfigure2.8andtable2.2.

19

802.11g Faster

802.11a Wi-Fi®

802.11b

Bluetooth™ Peak Data Rate Data Peak

ZigBee™ Slower

Smaller Range Larger Figure2.8RangeandDataRatecomparisonofZigBee,BluetoothandWiFi,see[3]

Thefollowingtablealsoshowsacomparisonofthesewirelessstandards: ZigBee 802.15.4 Bluetooth Wi-Fi 802.11b 802.15.1 Applications Monitoringand Cablereplacement Web,video,email control Datacapacity 250Kbps 1Mbps 11Mbps

Range(meters) 75(typically) 10100 100

Batterylife years days hours

Nodespernetwork upto65,533 8 30

Softwaresize 432 250 >1,000 (Kbytes) Table2.2GeneralcomparisonofZigBee,BluetoothandWiFi,see [3] 2.2 Introduction to Z-Stack Development Kit

ZStackisTexasInstrument’s(TI)implementationoftheZigBeespecification.As mentionedearlier,thelowerlayers(includingPHY/MAC,NetworkandSecurity layers)makeuptheZigBeestack.AuserapplicationcanbebuiltupontheZStack.

Inthisthesiswork,CC2430(ChipconproductsfromTexasInstrument)ZStack DevelopmentKit(CC2430ZDK)isusedtodevelopuserapplication.TheCC2430ZDK isdesignedtodeliverelementsforZigBeedevelopment.Itisaveryflexiblekitthat

20 canbeusedtodevelopeverythingfromsimplelightswitchestoadvancednodes withlotsofperipherals.

Acompletedevelopmentkitincludes:

• TI'sZigBeestack,ZStack • 2SmartRF04EBEvaluationBoards(Figure2.9) • 2CC2430EMEvaluationModules(Figure2.9) • 5CC2430DBDemonstrationBoards(Figure2.10) • Antennasandbatteries • IAREW8051CcompilerwithCSPYdebugger • SensorNetworkAnalyzerfromDaintree

CC2430EM

Figure2.9ChipconSmartRF04EBEvaluationBoardwithCC2430EM.Theantennais Titanisantennafromantenova ®(apicturefromTI)

21

Figure2.10ChipconCC2430DBDevelopmentBoard(apicturefromTI)

Thehardwareincludedinthekitcontainsnecessarysupporttoevaluate, demonstrate,prototypeanddevelopsoftwaretargetingvariousZigBeeapplications. TheSmartRF04EBprovidestheuserwithfunctionalitysuchasjoystick,buttons, USBport,RS232portandanLCDdisplay.Thisboardalsoincludeshardware supportforprogrammingCC2430EMsandcustommadeboards.

TheCC2430DBdemonstrationboardwillrenderitpossibletoimplementtruelow powerapplicationsthatcanlastonbatteriesforyears.CC2430EMusesTitanis antenna,providingabetterperformancethanthatinCC2430DB,whichis embeddedinthePrintedCircuitBoard(PCB).AjoystickonC2430DBoron SmartRF04EBprovidesfiveswitchesasinput.Thefiveswitchesaretriggeredwhen joystickispressedagainstapositionorpresseddown.

Switch Joystick

SW1 U400position

SW2 Rightposition

SW3 Downposition SW4 Leftposition

SW5 Pressdown

Figure2.11CC2430DBjoystick(apicturefromTI)

22 SensorNetworkAnalyzer(SNA)fromDaintreeisawellknownexperttoolfor ZigBee,whichnotonlyallowstheusertoviewthenetworkasawhole,butalsoto lookintothecontentofanindividualpacket.The2400ESensorNetworkAdapter actsasanobservationandcontrolpointenablingtheuseofSNAinlivewireless sensornetworks.Theadaptorcanalsobereplacedbyasensorboard(CC2430DB orsmartRF04EBwithCC2430EM).

23 Chapter 3 3. Packet Delay and Range Study

3.1 Test implementations and preparations

3.1.1 Round trip time (RTT) calculation AnapplicationbuiltonZstackisimplementedtomeasuretheroundtriptime(RTT) fromcoordinatortoaspecificdeviceinthenetwork.

Send a message

ACK ZC ZR/ZED RTT

Send the reply

Figure3.1Aroundtripofapacket RTTiscalculatedintheapplicationlayer.Heretheacknowledgement(ACK)issent andprocessedbyMAClayersotheapplicationlayerwon’tbeawareofit.Inthis case,theRTTiscalculatedfromsendingthemessagetoreceivingthereply.The entireprocessofpackettransmissionisshowninthefigurebelow.

ZC ZR APL APL

NWK NWK Processing Processing MAC MAC

PHY PHY

Propagating over the air Queuing

Transmitting Figure3.2PackettransmissionprocessfromZCtoZR(oneway)

24 AccordingtoFigure3.1andFigure3.2,RTTiscalculatedfromwhenapacketis generatedinAPLandsendtolowerlayers,tothetimeAPLreceivestheresponse fromthetargetdevice.Itconsistsoffourparts: • Processingtime,addorremoveheaders; • Queuingtime,inindirecttransmission,packetwillbeheldintheparent beforeitschildpolls.Italsoincludesthetimeforthenodetogainmedium access; • Transmissiontime,atatransmitspeed(250kbps); • Propagationtime,propagatingovertheair. Ifapacketislostduringthetransmission,retransmissionswillalsocontributeto thewholeRTT. RetransmissionisdealtbytheAPSlayer,theNWKlayerandalsotheMAClayer.If APSacknowledgementisenabled,APSlayerwillattemptsseveraltimes (configurable,defaultvalue3)beforereceivingACK.TheNWKlayeralsoperformsa numberofretries(configurable,defaultvalue2)forthenexthopmessage,once theMAClayerretriesareexhaustedforthatmessage.MAClevel acknowledgementsandretriesaredefaultandautomaticregardlessofserviceused, see [23] .MAClayerwillretry3times(configurable)beforereturningafailure statustothenetworklayer.Thetimeintervalbetweeneachattemptdependson theCSMA/CAalgorithm. Hereinthetest,APSlayeracknowledgementisdisabledthusAPSlayerwillnot retransmit;NWKlayerperforms2attemptsforthenexthopmessage,theinterval isunpredictable,dependingonthepacketlength,surroundingsanddistance betweennodes;MAClayerwillretry3timesforeachattemptbeforeannouncing failure,anddelaysarandomamountoftime(from3msto10ms)beforeeach attempt.Intheworsecase,thesenderwilltransmitatmost8timesandthe receiverwillattempt8timestorespondaswell.Accordingtothepacketscaptured bySNAinthecaseofretransmissions,thetimeouttimerissetto1sforZRand3s forZED(dependentonPOLL_RATE,inthetest,pollrateforZEDissetto1000ms). 3.1.2 Implementation Inputkeysdesigned:(switchsettingsshowninfigure2.11) • PressSW3(onlyvalidinZC):startanewmeasurementbygeneratinga prompt. • PressSW4:generateagroupbroadcast (multicast )message. Intheapplication,themeasurementstartsbygeneratingagroupbroadcast (multicast)messagefromtheZC.WhenZRorZEDreceivesthemessagefromZC, itreplieswithitsunique64bitextendedaddress;thedevicesarethennumbered asindexaccordingtotheorderofreceivingtheirresponses.ZCrecordstheindex, networkaddressandextendedaddressofthedevicesinatable. Newdevicescanalsojointhenetworkbysendingagroupbroadcastmessage. WhenZCreceivesthemulticastmessagefromadevice,itchecksifthedeviceis alreadyinthenetwork.Ifyes,itprintsouttheindexandtheroleofthedevice(ZR orZED).Otherwiseitaddsthenewjoineddeviceintothenetwork. Apromptwindowisusedtosetaseriesofparametersbytheuser: • Targetdeviceforthetest(sweepallisalsosupported)

25 • Payloadlength • Intervalbetweenpackets • Numberofpacketstotransmit • Numberofroundstorepeatthetest • Intervalbetweenrounds TheapplicationusesUART(UniversalAsynchronousReceiverTransmitter,usedfor serialcommunicationsoveracomputerorperipheraldeviceserialport)to communicatewiththecomputer.Itreadsthesettingsfromthecomputerandstarts thetest.Packetsaregeneratedbasedonthesettingsandtransmittedwitha windowsizeofone,whichmeansthatthesenderwillnotsendasecondpacket untilitreceivestheACKfromthereceiver.Atimeouttimerissetforeverypacket. IfthesenderreceivestheACKbeforetimeouttimerisfired,thetotalroundtrip timeiscalculatedaccordingtosystemclock(accuracy1ms)andprintedinthe computerthroughUART.Ifnot,apacketisconsideredlostand“timeout”isprinted. TheresultisthenprocessedbyMatlabtocheckthetransmissioncondition, includingpacketlossrateandaverageRTT.Somefiguresarealsoplottedfor analysis. Onlyonesetofcodeisimplementedanddifferentfunctionsareimplemented accordingtotheroleofthedevice,whetheritisZC,ZRorZED.Therearealso someotherfeaturesthatcanbeadded.Securitycanbeenabledtoensuremessage integrity;powersavingcanbeenabledtoallowdevicetosleepandsaveenergy. Afterthesettings,themeasurementstartsandSensorNetworkAnalyzer(SNA) alsobeginstocapturethetrafficinthenetworktomonitortheentireprocessofthe test.ThereceivedpowerofthepacketisalsorecordedbySNA. ZC Target Device

Device running SNA

Figure3.3Generaltestscenario Actuallythereceivedpowerrecordedisnotthereceivedpowerofthedevice performingthetest(ZC).OnlyoneprogramcanberunningonCC2430EM,either thetestapplicationorSNAthatcapturesthetraffic.Whenperformingthetests, twosmartRF04EBevaluationboardswithCC2430EMareplacednexttoeachother. OneofthemisrunningthetestapplicationandtheotheroneisrunningSNA.Since

26 thetwoboardsareexactlythesame,itcanbeassumedthatthereceivedsignal strengthatthetwoboardsisquiteclose.Astheoneusedforcapturingpacketonly listenstothenetwork,theydon’tinterferewitheachother. Thetestbenchcanbeusedasasimulationtooltoevaluatethetransmission conditionwheninstallingthemeters. 3.1.3 Radio transmission range factors Radiowavespropagateinastraightlineinseveraldirectionsatonce.Inavacuum, radiowavespropagateat3*10 8m/s.Thesignalgetsweakerdueto • Reflection • Refraction • Diffraction • Absorption Intheair,thesignalstrengthattenuatesasittravelsthroughthemediumbecause ofthesereasons;thereceivedsignalstrengthdecreaseswhenthedistance increases.However,itisnotdecreasinglinearlysincetheenvironmentdiversifies andisfrequentlychanging. Therearemanyfactorsthatwouldaffectradiotransmission: Transmit power Thetransmissionpoweristhekeydeterminantoftransmissionrange.Theoutput powerofCC2430radioisprogrammable,from0.6dBmto25.2dBm. Receiver sensitivity Higherreceiversensitivityleadstoalargerrange.Inordertobereceivedcorrectly, thesignalstrengthofareceivedpackethastobelargerthanreceiversensitivity. Withpacketerrorrate(PER)smallerthat1%,thereceiversensitivityis85dBmat 2.5GHzbandand92dBmat868/915MHzband. Antenna design Thetypeofantennaandtheheightofantennaalsoaffecttransmissionrange.In ordertoexcludetheundesiredinfluenceofthisfactor,theantennaisfixedtoa heightof1.5minallthetestsperformed.

27 Direct Radio Path

Transmitting Receiving Antenna Antenna Figure3.4FresnelZone Thisfigureshowsthelineofsightcondition.Radioistransmittedinazone,instead ofadirectlinebetweenthetwoantennas.Thetransmissionzoneisknownasa FresnelZone,whichisathreedimensionalellipsoidwiththetwoantennasatthe focioftheellipse(Huygens–Fresnelprinciple).ThemoreoftheFresnelZonethatis freefromobstructions,thebetterthetransmissionwillbe. IfbothantennascanbeliftedsothattherearenoobstructionsinsideoftheFresnel Zone,theradiotransmissionwillbeimproved.Thisconsiderationisparticularly importantifoneoftheantennasistobemountedclosetotheground.That positioning,ineffect,eliminatesaboutonehalfoftheFresnelZoneandreduces rangedramatically. Reflection surface Thereflectingsurfacesdonotneedtobeonadirectreflectivepath.Radiowaves donotbounceoffofreflectivesurfaceslikepoolballsbounceofftherailofthepool table.Eachradiowaveinitiatesanewomnidirectionalsphericalwaveateach reflectivesurfacethatitencounters,accordingtoHuygensFresnelprinciple.Atype ofchaoticpatternensuesthatallowssomeofthetransmittedradioenergytoreach itsfinaldestinationbyreflectedsignals.Aflatwatersurfaceisalsoagoodradio wavereflectorforthistypeofradiotransmission. Absorption surface Absorptionsurfaceshavetheoppositeeffectofreflectingsurfaces.Thesesurfaces stoptheradioenergyfromitspath.Earthandconcreteareveryeffectivein absorbingradiowaveenergy.Grassandtreesabsorbtoalessextent,butare knowntobegoodabsorbersofradioenergy. Theseabsorptionsurfacescanhaveadramaticeffectontheradiotransmission distance. Acceptable packet loss rate Themaximumtransmissionrangealsodependsontheacceptablepacketlossrate bytheusers.Asmentionedearlier,signalstrengthdecreaseswithdistance.With weakerreceivedsignal,packetlossratewillbehigher.

28 Humidity Humidityisalsoafactorthataffectsradiotransmission.Highhumiditywould decreasetheperformanceofradiotransmissiondramatically. Inordertoavoidtheundesirableinfluenceofsomefactors,someparametersare fixedinallthetests: • Humidityisrecordedinthetests; • WLANexistsinalltheindoortests(widelyusedinmostbuildings); • Transmitpowerisfixedto1.5dBm; • Theantennasofbothsenderandreceiverarefixedtoaheightof1.5m becauseinrealitythemetersarenormallymountedonthewall; • ZCisthesourceandZRispickedasthedestination,notaZED,sincethe RTTofZEDsimplyaddsthesleeptimeandthustoincreasetimeoftest. 3.2 Tests and result analysis Thetestscenariosaredesignedaccordingtotheinstallationcasesofelectricity meters.Thecommunicationoftwodevicesmayhappenintheopenairwithinline ofsight,inacorridorwithlineofsight,orindoorwithsomeobstaclesinbetween. Notethatallthedevicesarefixedtoaheightof1.5minalltestsbecausethe electricitymetersareusuallymountedagainstthewallwithacertainheight.Also notethattheresultsmayvarybyasmallamountwhenthetestisrepeated. Becausetheenvironmentisfrequentlychangingandthenumberofsamplesis limitedinthetest.Noteveryresultisanalyzedhereinthisreportbutonlythe typicalexperimentalresults.Someothertestresultsareattachedinappendix [F] . 3.2.1 Outdoor test

Test conditions: • Environment:Inatypicalparkinglot; • Temperature:810˚C; • Humidity:75.5%; • Weather:Sunnyandcloudy; • Batteryvoltage:3.12V.(NotethatCC2430canworkinawiderangeof voltage,from2.0Vto3.6V.Itwillworkproperlyifthesupplyvoltageisin thisrange.) Test settings: • Targetdeviceforthetest:Router0(pointtopointcommunication) • Payloadlength:50bytes(MTUsupportedis85bytes) • Intervalbetweenpackets:100ms • Numberofpacketstotransmit:100 • Numberofroundstorepeatthetest:20 • Intervalbetweenrounds:1000ms • Outputpower:1.5dBm • Security:Disabled • APSacknowledgement:Disabled 2000samplesarecollectedinthetest.Intheresultobtained,mostoftheRTTfalls below100msandquitefewRTTsarelargerthanthat.Inordertoshowthe distributionmoreclearly,onlythepartsfallingbelow100msareshowninthe scattergrams.

29 Scenario 1 Inopenpath(lineofsight),performmeasurementswithadistancefromZCtoZR of5m,10m,20m,40m,50m,75mand85muntilthemaximumrangeisfound (withpacketlossrateof1%).ThereceivedpowerandRTTarerecorded;

ZC ZR

From 5m to 85m

Figure3.5Scenario1,asinglehopwithadistancefrom5mto85m(aphotoofthe testscenarioisattachedinappendix[E] ) Result and analysis Let’sfirsthavealookatthescattergramsofRTTfor20m,50m,75mand85mand comparethepacketlossrate.

Figure3.6ScattergramofRTTwithdistancesfrom20mto85m(Thepartinthe rectangleiszoomedinandshowninthefollowingfigure.)

30 Figure3.7ZoominversionofscattergramofRTTfor20minFigure3.6(Asthe accuracyofsystemclockis1ms,theRTTobtainedisalwaysanintegervalue.) Distance AverageRTT Packetlossrate Concentration 20m 18.0ms 0% 100% 50m 17.9ms 0% 99.95% 75m 17.9ms 0.75% 97.95% 85m 18.6ms 1.65% 95.95% Table3.1Comparisonoftransmissionconditionwithadistancefrom20mto85m (ConcentrationmeanspercentageofRTTbetweenaverage±5ms) ThereceivedsignalstrengthisalsorecordedbySNAwhenperformingthetests. Thefollowingtableshowstheaveragereceivedpowerofthepacketswithdifferent distances.Itiscalculatedbytheaverageof20samplespickedrandomlyfromall the2000samples. Distance 10m 30m 50m 75m 85m

Receivedpower 66dBm 73dBm 78dBm 84dBm 86dBm

Table3.2Receivedpowerwithadistancefrom10mto85m Asmentionedearlier,signalsattenuatealongthewayofpropagation.Withweaker receivedsignalstrength,theprobabilityofretransmissionsgetshigher.Inthiscase, RTTgetshigherandpackethasalargerchancetobelostinthetransmission.We canseefromtable3.1thatpacketlossratedoesincreasewithlongerdistance. Whenpacketlossrateisrelativelylow,andtheprobabilityofretransmissionisalso low,theaverageRTTdoesn’tchangemuchwiththeincreaseofdistance(from20m to75mintable3.1).Thereasonisthat,forthefourpartsofRTT(mentioned

31 previously),onlypropagationtimechangeswhendistancechanges.However,radio wavesarepropagatingatthespeedoflight,at3*10 8 m/s.Whendistancerises from5mto75m,thepropagationtimeonlychangesbyaround0.2s.Sothe influenceofdistanceissmallenoughtobeneglected. ItisalsonoticeablethatthereisasmalldecreaseofRTTfrom20mto50m,which resultsfromlimitednumberofsamples.Itwouldbemoreaccurateifmoresamples arecollected. From75mto85m,whensignalstrengthgetsweak,retransmissionhappensmore often.Asaresult,theRTTsdistributemorediversely,theaverageRTTraises considerablyandpacketlossrateincreasesaswell. Withapacketlossrateof1%,itcanbeconcludedthatthemaximumrangeofa singlehopisbetween75mand85m. Let’slookfurtheratthehistogramandaccumulativecurveofRTTwithdifferent distancesandseehowRTTisdistributed.

Figure3.8HistogramofRTTwithadistanceof20m,50mand75m(RTT>35msis roundedto35ms) Inthisfigure,theRTTforallthethreechartsarehighlycentralizedaround18ms. AlmostalltheRTTsfallbetween14msto21ms.There’slittledifferenceamongthe threebarcharts,exceptthattheonefor75mhasasmallportionofRTTthatis above35ms.ThatpartincludesbothlongerRTTsandpacketlosses(RTT=infinity).

32 Figure3.9AccumulativecurveofRTTfor50m,75mand85m

Figure3.10ZoomedinaccumulativecurveofRTTfor50m,75mand85m ThetwoaccumulativecurvesclearlyshowthatRTTismorediverselydistributed withalongerdistance.Thedashlinespresentthat95%,97.5%and99%ofthe RTTfallbelow20mswithadistanceof85m,75mand50m. Scenario 2 Twotestsareperformedwith2hopsand3hopsbetweenZCandZR,eachonewith adistanceof50m.

33 1 hop 2 hops 3 hops

ZC ZR ZR ZR

50m 50m 50m

Figure3.11Scenario2testwith1hop,2hopsand3hops Result and analysis Arouterinbetweenisactinglikearepeater.Itreconstructsthepacketand forwardsittothedestination,thusregeneratestheradiosignal. Howeverinthemeantime,routershavetoprocessthereceivedpacketsbefore forwardingthem.ThiswilladdmoreprocessingtimethusleadtoalargerRTT.Itis alsolearnedfromtable3.3andthefigure3.12,RTTrisesconsiderablywiththe increasingofnumberofhops.Distanceisnotafactorthatwouldcontributemuch tothewholeRTT,asmentionedbefore.

Table3.3showsthechangeofRTTwhenhopnumbervaries. HopNumber 1hop 2hops 3hops

AverageRTT 17.9ms 32.9ms 48.2ms

Table3.3Roundtriptimewith1hop,2hopsand3hops

34 Figure3.12Roundtriptimewith1hop,2hopsand3hops Scenario 3 Inscenario2,itwasfoundthatthemaximumrangeofthesecondhopisalittle smallerthanthefirsthop.ThedifferencebetweenthemisthatZChasabetter antennathanthatofZR(CC2430EMhasabetterantennathanCC2430DB).That mightbethereasonofthelongerrange.Anothersetoftestisperformedtoseethe influenceofabetterantenna. Twotestsareperformedwithadistanceof85m,onewithCC2430EMonbothsides andonewithCC2430EMononlyoneside.

ZC ZR (CC2430DB)

Test 1 85m

ZC ZR (CC2430EM) Test 2 85m

Figure3.13Scenario3testwithdifferentantennas

35 Result and analysis Theantennadoesinfluencethetestresults.Itisobviouslyshowninfigure3.14 thatthetransmissionconditionbecomesbetterwithaTitanisantenna.AverageRTT becomeslower,packetlossrateisverylowanditishighlyconcentratedaswell. Duetothelimitednumberofsamplesandfrequentlychangingenvironment,the resultfor85minthisscenarioisdifferentfromthatinscenario1(table3.1). Embedded PCB antenna Titanis antenna Figure3.14EmbeddedPCBantennaVsTitanisantenna 3.2.2 Indoor test

Test conditions: • Environment:ABBCorporateResearchofficebuilding(206) • Temperature:21˚C; • Humidity:50%; • Weather:Sunnyandcloudy; • Batteryvoltage:3.02V.(withinsupplyvoltage) Test settings: • Targetdeviceforthetest:Router0(pointtopointcommunication) • Payloadlength:50bytes • Intervalbetweenpackets:100ms • Numberofpacketstotransmit:100 • Numberofroundstorepeatthetest:20 • Intervalbetweenrounds:1000ms • Outputpower:1.5dBm • Security:Disabled • APSacknowledgement:Disabled

36 Scenario 1 Aseriesoftestsareperformedinthecorridorwithinlineofsight,withadistance from10mtothemaximumrangeandcomparetheresultwithoutdoortest.(Here thetestisdoneonfloorC,thethirdfloor.Afloorplanisattachedinappendix [E] .) Result and analysis

Distance AverageRTT Packetloss Concentration Receivedpower rate 20m 18.0ms 0% 98.7% 68dBm 50m 18.1ms 0% 99.7% 70dBm 70m 18.4ms 0.1% 94.8% 75dBm 90m 18.9ms 0.05% 93.6% 78dBm 105m 18.0ms 0.05% 97.05% 81dBm 115m 18.2ms 0.1% 96.5% 82dBm Table3.4Comparisonoftransmissionconditionwithadistancefrom20mto115m inthecorridoroffloorC Comparedwiththeresultsfromoutdoortest, • Themaximumrangeismuchlonger,morethan115m(asthetotallengthof thecorridorisaround120m,it’snotpossibletogetthemaximumrange) • Thesignalattenuatesslowlysincethereflectionfromthewallstrengthened thesignal.Thetradeoffisthatthereceivedpowerisnotasstableasin outdoorlineofsight. • TheinfluenceofdistanceonRTTisalsoneglectablewhenthepacketloss rateislow. Scenario 2 Asthefloorplanisunique,itmaybemeaningfultorepeatthesametestin differentfloorsandcomparetheresult.ThefloorplanoffloorAandBisalso attachedinappendix [E] . Notethatfromthistest,thesmartRF04EBwithCC2430EMforSNAisreplacedby 2400ESensorNetworkAdapterduetoequipmentissues.Inthiscase,thereceived signalpowerisnotthesameasthatinZC.Butitcanstillbeusedforperformance evaluationsinceonlythereferencedeviceischanged. Result and analysis Similarly,signalstrengthattenuatesveryslowlyalongwithdistanceingeneral trend.Themaximumtransmissionrangeisalsoverycloseindifferentfloors.Asthe structureofthecorridorisnotsymmetricandchangesfrequentlyalongtheway, whichaffectsthereflection,thesignalstrengthisnotdecreasinglinearlywith longerdistance.Concentrationisfluctuatingaswell,shownintable3.5. Inaddition,duetothevariationoffloorplanandfurnitureplacement,received signalstrengthalsovariesindifferentfloors.

37 Floor Distance AverageRTT Packetloss Concentration Received (Aisfirst rate power floor) A 50m 17.4ms 0% 97.55% 78dBm 70m 17.9ms 0% 96.35% 72dBm 90m 18.3ms 0% 97.75% 82dBm 100m 17.7ms 0% 97.45% 84dBm B 50m 17.7ms 0% 98.45% 65dBm 70m 18.1ms 0% 98.75% 65dBm 90m 17.3ms 0% 99.15% 67dBm 100m 17.8ms 0% 98.1% 74dBm C 50m 17.9ms 0% 95.75% 75dBm 70m 18.4ms 0.05% 94.9% 76dBm 90m 18.0ms 0% 97.35% 78dBm 100m 17.3ms 0% 98.5% 75dBm Table3.5TestresultcomparisoninfloorA,BandC(NotethatthetestinfloorCis doneasecondtime,sotheresultisdifferentfromthatshownintable3.4.) Scenario 3 Severaltestsareperformedwithdifferentdoorsinbetweenandindifferentfloors andtheresultsarecomparedtoseehowthetransmissionconditionisaffectedby differentobstacles.

Glass door/ Iron door

ZC ZR

Floor C corridor ATestwithdifferentdoorsbetweenZCandZR(thedistancebetweenthemis10m)

38 ZC

Floor C corridor

ZR

Floor B/A corridor BTestindifferentfloors(Notethattheheightofonefloorisaround3m,sothe distancebetweenthetwodevicesisaround4.5m,whichisshortercomparedwith thetestinA) Figure3.15PerformancecomparisonwithdifferentobstaclesbetweenZCandZR Result and analysis

Obstacle Distance Average Packet Concentration Received RTT lossrate power Inlineofsight 10m 18.2ms 0% 99.1% 69dBm 1glassdoor 10m 18.1ms 0% 99.8% 75dBm (around0.3cmthick) 2glassdoors 10m 18.3ms 0% 100% 78dBm 1irondoor(5cm) 10m 18.4ms 0% 100% 79dBm 2irondoors 10m 23.7ms 3.55% 48.7% 86dBm 1concretefloor 3m 17.5ms 0% 97.75% 60dBm (17cm) 2concretefloors 6m 17.1ms 0% 96.95% 85dBm Table3.6Performancecomparisonwithdifferentobstaclesinbetween(ZRloses connectionwithZCwhenthereare3concretefloorsinbetween.) Irondoorhasthemostinfluenceonsignalattenuation,followedbyconcretefloors andthenglassdoors.Thepermittivityofdifferentmaterialsonradiopropagationis studiedin [24] ,whichalsoshowsthatconcreteblockssignalthemost,andthen glassandwood(ironisnotgiven). Scenario 4 Asimilarsetoftestsareperformedinalivingenvironmentandseethedifference fromtheresultinofficebuilding.AsketchoffloorplaninSkalden2apartmentis showninappendix [E] .

39 Result and analysis Thefollowingtableshowsacomparisonofperformancewhenthetestisdonein oppositeroom,respectivelyinlineofsight,withonewooddoorinbetweenandtwo wooddoorsintheway. Obstacle Average Packet Concentration Receivedpower RTT lossrate Inlineofsight 18.1ms 0% 98.7% Around70dBm 1wooddoor(6cm) 17.7ms 0.05% 97.8% Around70dBm 2wooddoors 17.9ms 0.05% 96.85% Around70dBm Table3.7Testtheinfluenceofwooddoors(“around”meansthatthevalueis instableandfluctuatingallthetime) Asisobviouslyshowninthetable,receivedsignalstrengthremainsthesamewhen wooddoorsareintheway.Thetransmissionconditionalsoremainsfairlygood, whichmeansthattheblockageofwooddoorsisalmostneglectable. Officebuildingsareusuallyverytall,wheresecurityandstabilityisconsideredabig issue;concretewallsandfloors,ironorglassdoorsarewidelyused.Theseare greatreflectorsofradioenergyat2.4GHzfrequencyband.Whiletheresidential buildingsareconsidered“lessiron”,wherecomfortisofvitalimportance;wood doorsandfloors,andwallsmadefrombrick,stoneorevenwoodaremorecommon. Someothertestsarealsoperformedwhennodesareplacedindifferentspots.The resultisattachedinappendix [F] . 3.2.3 Interference test

Test conditions: • Environment:ApartmentSkalden2 • Temperature:22˚C; • Humidity:55%; • Weather:Sunnyandcloudy; • Batteryvoltage:2.89V.(withinthesupplyvoltagerange) Test settings: • Targetdeviceforthetest:Router0(pointtopointcommunication) • Payloadlength:50bytes • Intervalbetweenpackets:100ms • Numberofpacketstotransmit:100 • Numberofroundstorepeatthetest:20 • Intervalbetweenrounds:1000ms • Outputpower:1.5dBm • Security:Disabled • APSacknowledgement:Disabled Scenario description Interferenceisalmost“inevitable”;thereisnointerferencefreeenvironment.Tests areperformedtoseehowZigBeereactstointerferencefrommicrowaveoven, BluetoothandWLAN,sincetheyareallusingthe2.4GHzfrequencyband.

40 Microwave oven

ZC ZR

Floor C corridor Figure3.16Testscenariowithmicrowaveinterference

Sony Ericsson C902

ZC ZR

Sony Ericsson K530i

Floor C corridor Figure3.17TestscenariowithBluetoothinterference(Twocellphonesare transmittingdatawithBluetooth) Result and analysis

Table3.8showsthatBluetoothandmicrowavehasalittleinfluenceonZigBee networkperformance.Microwaveoven,BluetoothandWLANareusingthesame frequencybandwithZigBee,sothechanceofcollisiongetshigherwhenthereis interferencefromeitheroneofthem.Correspondingly,itwouldincreasethetimeto gainmediumaccessandthusmayleadtoalongerpacketdelay(RTT)oreven causetransmissiontimeoutandpacketdiscard.However,wecanalsoseethatthe influenceisverysmall,indicatingthatZigBeeisrobustagainstinterference. Scenario Average Packet Concentration Received RTT lossrate power Corridorwithout 16.6ms 0% 99.05% 62dBm interference Corridorwith Around Microwaveinterference 19.2ms 0.15% 89.95% 69dBm Oppositeroomwithout Around interference 18.1ms 0% 98.7% 70dBm Oppositeroomwith Around Bluetoothinterference 18.2ms 0.1% 97.4% 67dBm Table3.8Influenceofinterferenceonpackettransmission

41 Chapter 4 4. Other Performance Metrics

4.1 Power Consumption Measurement PowermanagementisusedbybatterypoweredZEDstominimizethepower consumptionbetweenbriefperiods,eitherduringscheduledactivityorduringa longtimesleep.Systemactivityismonitoredaftereachtaskfinishesitsprocessing. Thesystemwilldecidewhethertosleepornotaccordingtothemonitoring,see [20] . Apowerconsumptiontestwasperformedaccordingto [21] Astandalone CC2430EMisusedinthemeasurementtoexcludetheextrapowerconsumptionby theboard,thusitwouldbeclosertothetheoreticalresult.Thecircuitisconnected asfollows:

Oscilloscope SmartRF04EB withCC2430EM (ZC) Amplifier

Powersupply(3V) ─ +

Resistor10 CC2430EM (ZED) Figure4.1Powerconsumptionmeasurementcircuit(TheOscilloscopemeasuresthe voltageontheresistorandthecurrentcanbecalculatedbydividingthevoltage readfromOscilloscopeby10.) Inthepowerconsumptiontest,severalscenariosthatcanoccurtoelectricity metersinrealitylifearedesignedandthepowerconsumptionofthemismeasured. ThetestapplicationisimplementedinbothZCandZED.Alsonotethatsecurityis notenabledinallthetestsperformed. 4.1.1 Polling without data transmission

Scenario description ZEDsendspolltoZCevery500msfordatapending.Thesizeofthepollingpacket is12bytes(verifiedbySNA).

42

Result and analysis Figure4.2showsthecurrentconsumptionwhenZEDpollsZCevery500ms,but thereisnodatastoredinZCforZED.Thecurrentiscalculatedbydividingthe voltageby10.

1

500ms

2

Figure4.2Pollingwithoutdatatransmission(Thetwopartsintherectangleare zoomedinandshowninfigure4.3and4.4.Notethatthescaleofxaxisis200ms, andforyaxisitis50mv,whicharemarkedbythetwoellipsesinthefigure.Inthis case,thecurrentofonegridis50mv/10=5mA.Thescalesofthefollowingfigures areshowninthesameplace.)

1 2 3 5 7 8 9

4 6

Figure4.3Zoomedinofpart1inFigure4.2(ItshowsafullsequenceofZEDfrom wakingupandstartingtotransmit,toshuttingdownandgoingtosleepagain.The scaleofxaxisis1msandforyaxisitis50mv.Itisshowninthesameplaceasin figure4.2andsoitiswiththefollowingfigures.)

43 ZEDconsumesdifferentamountofpoweratdifferentstages.Thefollowingtable showsadetaileddescriptionoftheeventsateachstageandthecurrentand durationaswell.Thescaleofxaxisinthisfigureis1msandthatofyaxisis50mv, correspondingly5mApergrid.Notethatthepowerconsumptionisshowninthe formofchargesothatthebatterylifecanbecalculatedaccordingtothedata transmittedeachday. Stage Description Current Duration Charge (mA) (ms) (mA*ms) 1 Startupsequence.MCUinactive 7.5 0.5 3.75 moderunningon16MHzclock 2 MCUrunningon32MHzclock 12 1.6 19.2 3 CSMA/CAalgorithm.RadioinRX 31 1.5 46.5 mode. 4 SwitchfromRXtoTX. 17.5 0.2 3.5 5 Packettransmission.RadioinTX 29.5 0.6 17.7 mode. 6 SwitchfromTXtoRX. 18 0.1 1.8 7 Receptionofacknowledgement 31 1.1 34.1 fromZC.RadioinRXmode. 8 Packetprocessing.MCUrunning 12 1.1 13.2 on32MHzclock. 9 Shutdownsequence.MCU 7 0.6 4.2 runningon16MHz. Table4.1Descriptionandpowerconsumptionofeachstage(accordingto[21] ) Thetotaldurationofoneactiveperiodis7.3msandthetotalchargeis 143.95mA*ms,accordingtofigure4.3andtable4.1.Atstage5,ZEDis transmittingthepollingpacketatacertaindatarate.Thedurationofthisstageis dependentonthepacketlength.Inthiscase,thechargeoftransmitting1byteis 17.7/12=1.475mA*ms. Themaximumcurrentinthewholesequenceisaround31mA,whenthedeviceisin RXmode.Afterthepolling,ZEDgoestosleepagain,andthecurrentconsumption isshowninthezoomedinfigurebelow:

Figure4.4Zoomedinofpart2inFigure4.2(Itshowsthecurrentconsumption whenthedevicesenterssleepmode.)

44 TherearetwosleepmodesprovidedbyZStack,LITEsleepandDEEPsleep.LITE sleepisusedwhenthedeviceneedstowakeupandperformascheduledactivity (suchaspolling).DEEPsleepisusedwhenthere’snoscheduledactivityforthe device.Ifthedeviceneedstowakeup,anexternalstimulusisrequired,suchasa buttonpress.Hereinthetest,LITEsleepmodeisusedsincetheZEDispolling periodically.WhenitentersLITEsleepmode,theaveragecurrentconsumptionis lessthan20A.ThevalueisevenlessinDEEPsleepmode.

4.1.2 Polling with data transmission

Scenario description Inthisscenario,ZEDispollingZCevery500msforthedatapendingwithapacket sizeof12bytesaswell.ZCsendspacketsperiodicallytoZED,oneatatimewitha sizeof50bytes.(Itwon’tsendasecondpacketuntilreceivingthe acknowledgementfromZED.)WhenZEDreceivesapacketfromZC,itsendsan acknowledgementback. Result and analysis ThefollowingtwofiguresshowthewholeprocessoftransmissionofZED. Retransmission Figure4.5Pollingwithdatatransmission(Thepartisintherectangleisalso zoomedinandshowninthefollowingfigure.) Inpart1offigure4.6,ZEDstartsup,pollstheZC,andreceivesthedatastoredfor itandthengoestosleepagain.Adetailedeventsdescriptionisoutlinedin [21] .In part2,afterreceivingthepacketfromZC,ZEDsendsaresponsemessageback. Therearefewerstagescomparedtopart1sinceZEDsimplychecksthemedium andtransmitsthemessage.

45 1 2

Figure4.6ZoomedinversionofFigure4.5 4.1.3 Join and rejoin process

Scenario description Inarunningnetwork,it’snotuncommonforadevicetoloseassociationwithits parent.Whenthishappens,italwaystriestorejointhenetworkbygenerating beaconrequestperiodically.Whenadevicetriestojoinanetwork,itwillbroadcast beaconrequestperiodicallyuntilitfindsanavailablenetwork.Thisprocessmight aswellconsumeaconsiderableamountofpower.Henceitisalsomeaningfulto studytheenergyconsumptionofjoinprocess.Inthisscenario,ZCisfirstshut downandZEDisrestartedtoseethejoiningprocessofanenddevice. Result and analysis Figure4.7showsthepowerconsumptionofthejoinprocess.Theintervalbetween eachattemptisrandomandconfigurable.

Random interval

Figure4.7Powerconsumptionofjoinprocess(Inonecycle,theactiveperiod durationis500ms)

46 ThefollowingfigureshowstherejoinprocesswhenZEDlossesconnectionwithZC. WhenthedevicelosesconnectiontotheZC,itwilltryperiodicallytorejointhe network,witharandomintervaldependingontheconfiguration. Therejoinprocessshouldgofasterasthedevicealreadyknowswhichnetworkit wantstorejoin,whileinajoinprocessitfirsthastodothescanforanavailable networkandthenstarttheprocess.Theactiveperioddurationofbothjoinand rejoinprocesscanbeloweredbyreducingthescandurationintheapplication.

Figure4.8Powerconsumptionofrejoinprocess(Inonecycle,theactiveperiod durationis80ms)

4.2 Throughput

Asmentionedinchapter2,ZigBeesupportsamaximumovertheairdatarateof 250kbpsforthe2.4GHzband.However,inreality,theeffectivedatarateis somewhatlowerbecauseoftheprotocoloverhead.Thetheoreticalvalueof effectivedatarateiscalculatedindetailin [13] byJennicLtd. Inthroughputtest,asampleapplicationisimplementedinoneZCandoneZRto measuretheactualdatarate.Inthistest,thesendertransmitsimmediatelywhen itreceivesAF_DATA_CONFIRM_CMD,whichisreceivedasaconfirmationofadata packetsent.Whenthereceivergetsapacketfromthesender,itchecksifthesize andthecontentofthepacketarecorrectornot.Ifnot,thepacketisdiscardedand notcalculatedinreceivedbytes. ThefollowingtwofiguresshowtheresultmeasuredbySNA,notethat 1) “StreamSummary:0000:0001”meansthatPANIDis0000andsource node’snetworkaddressis0001. 2) “APSTxCum”isthemaximumtransmitrateoccurred,while“APSTxInst” Meanstheinstanttransmitrate.

47 Figure4.9Maximumdatarateinonewaytransmission(fromZCtoZR,without collision)

Figure4.10Maximumdatarateintwowaytransmission(bothZCandZRare transmitting,withcollision) Accordingtofigure4.9and4.10,theeffectivedatarateis95kbpsifonlyZCis transmitting.Whenthetwodevicesarebothtransmittingandreceiving,the effectivedataratepernodedecreasestoaround47kbpsbecauseofthecollisionsin thenetwork.Howeverthetotalthroughputofthenetworkisalmostthesame (around95kbps),whichisabouttwofifthsofthetheoreticaldatarate. 4.3 Network Size and Addressing

ThenumberofnodesinaZigBeenetworkcangoupto65533.A16bitnetwork address,whichmeansatotalof65536addresses,isassignedtoadevicewhenit joins.However,0xFFFFisabroadcastaddressforallthedevicesinthenetwork; 0xFFFDisabroadcastaddressforthedevicesthatarenotsleepingwhile0xFFFCis usedtosendamessagetoallrouters. [5] Thenetworksizeisdependentonthreeparameters:

48 • MAX_DEPTH(Lm)parameterdeterminesthemaximumdepthofthenetwork. TheZCisindepth0anditschildisindepth1andsoon. • MAX_CHILDREN(Cm)determinesthemaximumnumberofchildnodesthat aroutercanpossess. • MAX_ROUTERS(Rm)determinesthemaximumnumberofroutercapable childnodethatanodecanpossess. ThenetworkaddressisassignedaccordingtoCskipalgorithm,whichisalso dependentonthethreeparameters,see[14] TheCskipvalueofdeviceinacertain depthisdeterminedbyaformula(ThereisaslightdifferenceforZEDwithCskip>0, seethedetailedinformationin [14] ):

Formula4.1Cskipalgorithm Theparentwillassignthenetworkaddressestoitschildrenwithanintervalof Cskip.Forexample,inthetestapplication,Lm=5,Cm=20andRm=6.Accordingto theformula, Depth 0 1 2 3 4 5 Cskip 5181 861 141 21 1 0 Table4.2Cskipalgorithmexample(WithaCskipof0,thenodeisnotcapableof possessingchildrenandnormallyitisZED) Thefollowingfigureshowshowthenetworkaddressisassigned.Forexamplethe ZChasfourchildrendevices:thefirstonejoinsisassigned0x0001;thesecondone willgetanetworkaddresswithanintervalofCskip,whichis5181here.Inthis casetheaddressassignedis0x0001(hex)+5181(decimal)=0x143e(hex).The addressofthethirdandthefourthchildrenareassignedinthesameway.

ZR [Cskip=141,Addr=0x2bd9]

ZR [Cskip=861,Addr=0x3cb8] ZR [Cskip=861,Addr=0x287b]

ZC [Cskip=5181,Addr=0x0000]

ZR [Cskip=141,Addr=0x0002] ZR [Cskip=141,Addr=0x287c] ZR [Cskip=861,Addr=0x0001]

ZR [Cskip=861,Addr=0x143e]

ZR [Cskip=141,Addr=0x035f]

Figure4.11Networkaddressassignmentexample

49 ThenetworkaddressassignmentisalsoverifiedbySNA.Hereonlyone2400E sensornetworkadaptorisplacedneartheZC.Thedetectionrangeoftheadaptoris limitedduetothereceivedsignalstrengthandreceiversensitivity.Thus,onlythe topologyofthefirsthopisprovidedhere.

Figure4.12AddressassignmentverificationbySNA 4.4 Security

SecurityofZigBeenetworkishandledattheMAClayer. Name Description MAC_SEC_LEVEL_NONE Nosecurityisused. MAC_SEC_LEVEL_MIC_32 MIC_32authenticationisused. MAC_SEC_LEVEL_MIC_64 MIC_64authenticationisused. MAC_SEC_LEVEL_MIC_128 MIC_128authenticationisused MAC_SEC_LEVEL_ENC AESencryptionisused. MAC_SEC_LEVEL_ENC_MIC_32 AESencryptionandMIC_32authentication areused. MAC_SEC_LEVEL_ENC_MIC_64 AESencryptionandMIC_64authentication areused. MAC_SEC_LEVEL_ENC_MIC_128 AESencryptionandMIC_128 authenticationareused. Table4.3MACsecuritylevel[5] (The802.15.4specificationreferstothemessage authenticationcodeasamessageintegritycode(MIC)todifferentiateitfrom mediaaccesscontrol.AMICcanbeviewedasacryptographicallysecurechecksum ofamessage.AdvancedEncryptionStandard(AES)128isusedfordata encryption.) ZigBeespecificationdefineseightdifferentsecuritysuites,whichisoutlinedinTable 4.3. Auserapplicationcanchoosethetypeofsecurityprotectionbasedonits requirement.Eachoftheeightsecuritysuitesprovidesadifferentsetofsecurity propertiesandguarantees,andultimatelydifferentpacketformats.Thesesecurity

50 suitesallowthedeveloperpickandchoosethesecuritynecessaryforthe application,providingamanageabletradeoffbetweendatavolume,batterylife,and systemprocessingpowerrequirements.Theeightsecuritysuitescanbebroadly classifiedtofourtypes,accordingtothepropertiesthattheyoffer. • Nosecurity; • Encryptiononly; • Authenticationonly; • Encryptionandauthentication. Themessageauthenticationcodecanbe4,8or16byteslong.Thelongerthecode, themoresecureitissincetheadversarywillhavelowerchancetoworkoutan appropriatecodebyblindguess.Forexample,when16bytescodeisused,the chancetoforgeamessageisonly2 128 .Butthetradeoffisalargeroverheadthus lesspayloadformoreprotectionagainstauthenticationattacks. Withthesesecuritysuites,fourbasicsecurityservicesareprovidedbyMAClayer: accesscontrol,messageintegrity,messageconfidentiality,andreplayprotection. (Checkin [17] formoredetailedinformationabouttheseservices) VerificationisalsoperformedbySNA,showingthatthepayloadisencryptedorcan notbedetectedwhensecurityisused.

51 Chapter 5 5. Conclusion

5.1 Conclusion of ZigBee Network Performance

Inthisthesis,afullreviewofZigBeestandardisprovidedandatestbenchis implementedonZStackandaseriesoftestsareperformedbasedonthetest bench.Thetestbenchcanbeusedforevaluationduringinstallationandtheresults provideveryusefulstatisticswhichcanbeusedasareferenceduringinstallation. Overall,zigBeefulfillsthebasicrequirementsofelectricitymeterapplications: • ZEDscansleeptosaveenergy.Currentconsumptionislowinallthe scenarios,whichmeansthatitsupportsalongbatterylife; • ZigBeehasafairlylargetransmissionrangewithinlineofsightbothindoor andoutdoor; • Ithasaneffectivedatarateofaround100kbpswhichisenoughformetering data; • Italsosupportsalargenetworksizeandprovides8levelsofsecurityto ensuretheintegrityandconfidentialityofmeteringdata. However,itwouldbearbitrarytogiveadefiniteconclusionthatZigBeeisagood solutionforelectricitymeterssincetherearesomeotherfactorsthatneedtobe evaluated,includingtheinterferencefromBluetoothandWLAN,howsecuritywould affectthroughputandhowtransmitpoweraffectsthetransmissionconditionetc. 5.2 Comparison with Others’ Work ZigBeeisaverypopularstandardnowadaysandtheperformanceofZigBee networkisstudiedbymanypeopleoragencies.StevenMyersfromUniversityof WisconsinMadisonstudiedthemetricsincludingtransmitpower,interferencenode andantennatype,see[7] ;MatthiasLottandIngoForkelillustratedtheinfluenceof differentmaterialsonradiopropagationbyraytracingin [24] ;GangLuetalfrom UniversityofSouthernCaliforniasimulatedthethroughputindifferentcollision levels,whichisquitemeaningfulasareference,see [29].KhaledShuaibetal focusedontheinterferenceamongWLAN,BluetoothandZigBeeintheviewof throughputwhichisalsoworthwhiletoevaluate,see [30] . 5.3 Challenges and Future Work

Themainchallengeofthisworkisthatthetestresultdifferseverytime,dueto environmentchange.Itiscommontogetdifferentresultsbymerelyrepeatingthe test.Besides,unpredictedinterferencemaycomeupwhen,forexample,aperson oracarpassesbyorgoesthrough.ItalsotakestimetogettoknowZigBeeand getfamiliarwithprogrammingoverZStack. Forfuturework,itwouldbeworthwhiletostudysomeotherfactorsthatwould influencetransmissioncondition,suchasthetransmittingpower.Whensecurityis enabled,theinfluenceonthroughputandpowerconsumptionismeaningfulto studyaswell.Memoryusageisalsoanimportantissuebecausethedevicemayrun

52 intomemoryexhaustwhentheapplicationbecomesmorecomplex,ormore featuresareenabled.Additionally,itwouldbemoreuserfriendlyifagraphicuser interfaceisbuilt.

53 Bibliography [1]PaoloBaronti,PrashantPillai,VinceW.C.Chook,StefanoChessa, AlbertoGotta,Y.FunHu,“Wirelesssensornetworks:Asurveyonthe stateoftheartandthe802.15.4andZigBeestandards,”Computer Communications30(7):16551695(2007) [2]JianliangZheng,MyungJ.Lee,”WillIEEE802.15.4makeubiquitous networkingareality?,”IEEECommunicationsMagazine,June2004. [3]JoanieWexler,“BluetoothandZigBee:Theirsimilaritiesanddifferences”, March2005,StevensWaterMonitoringSystems,Inc. [4]AccutechTechNote#215,“WirelessInstrumentationFactorsAffecting TransmissionDistance”IssuedOctober,2003. [5]“ZStackDeveloper’sGuide”,TexasInstruments,Inc.SanDiego, CaliforniaUSA,DocumentNumber:F8W20060022 [6]KevinKlues,Tutorialppt“802.15.4andZigBee”,Washington UniversityinSt.Louis. [7]StevenMyers, Tutorialppt“ZigBee/IEEE802.15.4”,Universityof WisconsinMadison [8]ThomasLindh,Lecturenotes“Protocolsforwirelesssensornetworks”, KungligaTekniskaHögskolan(KTH) [9]MattMaupin,Tutorialppt“ZigBee™:WirelessControlMadeSimple”, FreescaleSemiconductor. [10]“SimpleAPIforZStack”,TexasInstruments,Inc,SanDiego,California USA,DocumentNumber:F8W20070021 [11]JimmyKjellsson,ThomasLennvall,“RadioEvaluationforElectricity Meters”departmentZCRD/SECRC/AN,ABB [12]“ApplicationNote:PowerManagementfortheCC2430DB”,Texas Instruments,Inc.SanDiego,CaliforniaUSA,DocumentNumber:F8W 20060019 [13]“ApplicationNote:JNAN1035Calculating802.15.4DataRates”Jennic Ltd,SouthYorkshire,UK [14]TaeHong,lecturenotes“ZigBeeNetworkSpecificationV1.0”,Realtime& EmbeddedSystemsLaboratory,InformationandCommunications University,Korea [15]MikhailGaleev,“HomenetworkingwithZigbee”,EmbeddedSystems Design,Embedded.com

54 [16]AdisVojvodić,“APaperonZigBee”,ComputerCommunicationand DistributedSystems,ChalmersUniversityofSweden [17] Naveen Sastry , David Wagner, “SecurityConsiderationsforIEEE802.15.4 Networks”, UniversityofCalifornia,Berkeley [18]ZigBeespecifications, http://www.specifications.nl/zigbee/zigbee_UK.php .Retrived:200906 11 [19]JanDohi,FabianDiehm,PatrickGrosa,“ZigBeeppt”,Technische UniversitätDresden,Dresden,20061114 [20]“PowerManagementfortheCC2430DB”,TexasInstruments,Inc.San Diego,CaliforniaUSA,DocumentNumberF8W20060019 [21]“MeasuringpowerconsumptionwithCC2430&ZStack”,ApplicationNote53, TexasInstruments,Inc.SanDiego,CaliforniaUSA. [22]“ZigBeeSecurity”,LowPowerRFSolutions, http://tiexpressdsp.com/images/7/7b/10__ZigBee_Security.pdf , Retrived:20090614 [23]“ZStack”, LowPowerWirelessandZigBeeNetworkingWorkshop, http://tiexpressdsp.com/images/8/8a/08__ZigBee_Stack.pdf,Retrived: 20090614 [24]MatthiasLottandIngoForkel,“AMultiWallandFloorModelforIndoor RadioPropagation”,VehicularTechnologyConference,2001 [25]“GoingGreenwithAMIandZigBeeSmartEnergy”,whitepaperfrom DaintreeNetworks [26]“GettingStartedwithZigBeeandIEEE802.15.4”,whitepaperfrom DaintreeNetworks [27]“What’ssogoodaboutmeshnetworks?”,whitepaperfromDaintree Networks [28]KarlHolger,AndreasWillig,“ProtocolsandArchitecturesforWireless SensorNetworks”,2005 [29] GangLuetal,“PerformanceEvaluationoftheIEEE802.15.4MACforLow RateLowPowerWirelessNetworks”,UniversityofSouthernCalifornia,Los Angeles [30] KhaledShuaib,etal,“PerformanceEvaluationofIEEE802.15.4:Experimental andSimulationResults”,CollegeofInformationTechnology,UAEUniversity

55 Appendix

[A] Introduction to CSMA/CA CSMA/CA,whichstandsforCarrierSenseMultipleAccess/CollisionAvoidance,isa mechanismwidelyusedinwirelesstechnologiesforastationtogainmedium access.InCSMA,astationwishingtotransmithastofirstlistentothechannelfor acertainamountoftimesoastocheckforanyactivityonthechannel.Ifthe channelissensed"idle"thenthestationispermittedtotransmit.Orelsethe stationhastodeferitstransmission. UnslottedCSMA/CAisusedtogainmediumaccessinnonbeaconenabledmode, whileslottedCSMA/CAisusedinbeaconenabledmode.Inallthetestsperformed, itoperatesinnonbeaconenabledmode,see[7] . Ineachdevice,threevariablesaredefined:NB,CWandBE. • NB,numberofbackoffs,isthenumberoftimestheCSMACAwasrequired tobackoffwhileattemptingacurrenttransmission. • CW,contentionwindowlength,whichdefinesthenumberofbackoffperiods thatneedstobeclearofactivitybeforeatransmission. • BE,backoffexponent,isrelatedtohowmanybackoffperiodsadeviceshall waitbeforeattemptingtoassessthechannel. ThefollowingtwofiguresshowtheentireprocessofunslottedandslottedCSMA/CA algorithm:

56 NB=0 BE=macMinBE

macMinBE Delay for Theminimumvalueofthe BE random (2 -1) backoffexponent(default3) unit aMaxBE Themaximumvalueofthe Perform CCA backoffexponent(default5) macMaxCSMABackoffs Y Channel idle ? Themaximumnumberof backoffsattemptedbefore failure(default4) N NB=NB+1 CCA BE=min (BE+1, aMaxBE) ClearChannelAssessment determinesthecurrentstate ofuseofawirelessmedium, aidedincontention N NB> avoidance. macMaxCSMABacko ffs

Y

Failure Success

FigureA.1UnslottedCSMA/CAalgorithmusedinnonbeaconenabledmode

57 NB=0, CW=2 Delay for random (2 BE -1) unit backoff periods Y BE = min(2, Battery life macMinBE) extension? Perform CCA on backoff N period BE = macMinBE boundary

Y Channe l idle? Locate backoff period N CW = CW -1 boundary CW=2, NB=NB+1 BE=min (BE+1, aMaxBE) N CW=0

N NB> Y macMaxCSMABackoffs ? Success Y

Failure FigureA.2SlottedCSMA/CAalgorithmusedinbeaconenabledmode [B] Full names of abbreviations in frame structure

Payload 0,5,6,10 Octets: 2 1 4 to 20 or 14 n 2 MAC Frame Data Address Auxiliary Data Control Sequence Information Security Payload FCS Number Header Layer MHR MSDU MFR

Preamble Start of Frame PHY Sequence Frame Length MAC Protocol Data Unit (MPDU) Delimiter

Layer SHR PHR PSDU

PHY Protocol Data Unit (PPDU)

FigureB.1ZigBeeframestructure

58 MHRMACHeader MSDUMACServiceDataUnit MFRMACFooter SHRSynchronizationHeader PHYPHYHeader PSDUPHYServiceDataUnit [C] BPSK and O-QPSK BPSK(binaryphaseshiftkeying)isadigitalmodulationschemeusedtomodulate orchangethephaseofareferencesignal.Itusestwophaseswhichareseparated by180°.Itonlyhasamodulationrateof1bit/symbol,soitisnotsuitableforhigh datarateapplicationswhenbandwidthislimited. ZigBeeusesamodulationschemecalledOffsetquadraturephaseshiftkeying.Itis aspecialversionofQPSKthatisusedtopreventlargeamplitudefluctuations.InO QPSKtheincomingsignalisdividedinthemodulatorintotwoportionsIandQand thentransmittedshiftedbyahalfsymbolduration. [D] Application layer is further divided into three layers • ZDO:TheZigBeeDeviceObject(ZDO)layerprovidesfunctionalityfor managingaZigBeedevice.TheZDOAPIprovidestheinterfacefor applicationendpointstomanagefunctionalityforZC,ZRandZEDwhich includescreating,discovering,andjoiningaZigBeenetwork;binding applicationendpoints;andmanagingsecurity. • AF:TheApplicationFramework(AF)interfacesupportsanEndpoints (includingtheZDO)interfacetotheunderlyingstack.TheZStackAF providesthedatastructuresandhelperfunctionsthatadeveloperrequires tobuildadevicedescriptionandistheendpointmultiplexerforincoming messages. • APS:TheApplicationSublayer(APS)APIprovidesageneralsetofsupport servicesthatareusedbyboththeZDOandthemanufacturerdefined applicationobjects. ZigBee Application Layer (APL)

Application Framework (AF) ZigBee Device Object

(ZDO)

Application Sub layer (APS)

FigureD.1ZigBeeapplicationlayerstructure

59 [E] Test environment photos and floor plans Outdoor test environment

FigureE.1Outdoortestscenarioandenvironment

Floor C plan

10m

FigureE.2PlanoffloorCinABBCorporateResearchofficebuilding (isthestartpointoftestinthecorridor,whereZCisplaced.)

60 Floor B plan

FigureE.3PlanoffloorBinABBCorporateResearchofficebuilding

Floor A plan

FigureE.4PlanoffloorAinABBCorporateResearchofficebuilding

61 Floor plan in Apartment Skalden 2 3m

5m 107 108 109 110 111 112 113

1m Corridor

106 105 104 103 102 101 Stairs

FigureE.5FloorplaninApartmentSkalden2 [F] Some test result not presented in the thesis Test conditions: • Environment:ApartmentSkalden2(floorplanshowninappendix [E] ) • Temperature:21˚C; • Humidity:55%; • Weather:Sunnyandcloudy; • Batteryvoltage:2.89V. Test settings: • Targetdeviceforthetest:Router0(pointtopointcommunication) • Payloadlength:50bytes • Intervalbetweenpackets:100ms • Numberofpacketstotransmit:100 • Numberofroundstorepeatthetest:20 • Intervalbetweenrounds:1000ms • Outputpower:1.5dBm • Security:Disabled • APSacknowledgement:Disabled

Scenario description TestsareperformedwithZCandZRplacedinoppositerooms,neighboringrooms, withoneroombetweenandalsoindifferentfloors.Anothertestisperformedwhen arouterforWLANnearZCispoweredoffandpoweredon. Nodeplacement: • Fortestinoppositerooms,nodesareplacedinthemiddleoftheroom. • Forthatinneighboringroomsandwithoneroominbetween,thenodesare mountedagainstthewallbehindthemirror(themirrorisremoved). • ForWLANrouterpoweronandpowerofftest,itisdoneinthecorridorof floor1. • Testsondifferentfloors(Floor1&2,1&3)areperformedwithnodesplacedin themiddleofthecorridor.

62 Result and analysis

Scenario AverageRTT Packet Concentration Received lossrate power Oppositerooms 18.1ms 0% 98.7% Around (104&109) 70dBm Neighboring 17.3ms 0% 97.35% 53dBm rooms(103&104) Oneroomin 17.6ms 0% 97.5% 80dBm between(107&109) Floor1&2(thefirst 18.1ms 0% 98.1% Around flooris0) 70dBm Floor1&3 18.3ms 0% 97.05% 79dBm WLANrouterpower 16.8ms 0.1% 98.6% Variesfrom on 63dBmto 81dBm WLANrouterpower 16.6ms 0% 99.05% 62dBm off TableF.1OthertestresultsinSkaldenapartment WLANalsoshowsasmallinfluenceonthetransmissionconditionaswecansee fromthetable.ButtheinterferencefromWLANisdependentonwhichchannel WLANisusing.

63