Adaptive role switching for fair and efficient battery usage in device-to-device communication

12
Adaptive Role Switching for Fair and Efficient Battery Usage in Device-to-Device Communication * Sacha Trifunovic, Andreea Picu, Theus Hossmann, Karin Anna Hummel <lastname>@tik.ee.ethz.ch Communication Systems Group, ETH Zurich, Switzerland By leveraging device-to-device communication, opportunistic networks promise to comple- ment infrastructure-based networks, by enabling communication in remote areas or during disaster and emergency situations, as well as by giving rise to novel applications, such as location-based sharing. Yet, to become feasible in practice and accepted by users, it is crucial that opportunistic communication be energy-efficient. Through extensive and detailed measurements and analysis, we show in this paper, that all of today’s device-to-device communication technologies suffer from two grave energy consumption problems: very expensive neighbor discovery and unfair connection mainte- nance. We consider the two most well-known technologies – Wi-Fi Direct and Bluetooth, and a third solution based on the WLAN access point mode – WLAN-Opp. We carefully de- sign a measurement setup which allows us to isolate the energy consumption of individual operations (e.g. CPU sleeping/waking up, scanning/listening for neighbors etc) for these technologies and compare the technologies based on these measurements. Our analysis reveals that neighbor discovery can quickly drain a device’s battery, depending on the re- quired scanning frequency. In addition, once a connection is established, the “host” of the connection consumes two to five times the energy needed by a “client”. To solve this unfair- ness problem, we propose a strategy that periodically alternates the hosting role among the peers. Further, we minimize the cost of the role switching operation by using the distribu- tion of the residual connection time of two peers to calculate an adaptive switching period. We examine the trade-off between fairness and switching cost on real-world connection traces and show that our scheme largely outperforms static role switching. Finally, we demonstrate that our fair role switching scheme is also effective when run on real devices. I. Introduction Today, most people carry mobile phones featuring technologies like Bluetooth or Wi-Fi Direct, that al- low device-to-device communication. Using these technologies, devices can exchange data whenever they are within mutual transmission range, thereby forming an opportunistic network [1, 2]. Such oppor- tunistic networks were proposed as a solution to fill the gaps left by the existing networking infrastructure in remote and rural areas [3], to enable communica- tion when infrastructure breaks down during natural disasters [4], or to circumvent censorship. Further- more, opportunistic networks can mitigate the pres- sure on infrastructure, caused by exponentially grow- ing traffic demands, by offloading certain traffic [5]. * This work is based on an earlier work: Slicing the Bat- tery Pie: Fair and Efficient Energy Usage in Device-to-Device Communication via Role Switching, in Chants’13, ©ACM 2013. http://doi.acm.org/10.1145/2505494.2505496 In addition, some novel applications and services, such as local social networking [6], are more naturally supported by opportunistic communication than by a fixed network infrastructure. However, to make opportunistic networking feasi- ble in practice, users must accept to contribute, de- spite their resource constrained phones. One criti- cal challenge to achieve this is minimizing the im- pact of device-to-device networking on battery life- time. Thus, studying energy consumption is crucial for the success of an opportunistic network. In par- ticular, the energy spent in the background on dis- covering opportunistic peers has been well investi- gated in the past [7, 8]. That research has mainly focused on the theoretical analysis and derivation of adaptive scanning strategies: minimizing the num- ber of required scanning operations, while detecting a maximum number of communication opportunities by adapting the scanning interval. Most approaches either try to learn the optimal scanning rate for the Mobile Computing and Communications Review, Volume 18, Number 1, January 2014 25

Transcript of Adaptive role switching for fair and efficient battery usage in device-to-device communication

Adaptive Role Switching for Fair and Efficient BatteryUsage in Device-to-Device Communication ∗

Sacha Trifunovic, Andreea Picu, Theus Hossmann, Karin Anna Hummel<lastname>@tik.ee.ethz.ch

Communication Systems Group, ETH Zurich, Switzerland

By leveraging device-to-device communication, opportunistic networks promise to comple-ment infrastructure-based networks, by enabling communication in remote areas or duringdisaster and emergency situations, as well as by giving rise to novel applications, such aslocation-based sharing. Yet, to become feasible in practice and accepted by users, it iscrucial that opportunistic communication be energy-efficient.Through extensive and detailed measurements and analysis, we show in this paper, thatall of today’s device-to-device communication technologies suffer from two grave energyconsumption problems: very expensive neighbor discovery and unfair connection mainte-nance. We consider the two most well-known technologies – Wi-Fi Direct and Bluetooth,and a third solution based on the WLAN access point mode – WLAN-Opp. We carefully de-sign a measurement setup which allows us to isolate the energy consumption of individualoperations (e.g. CPU sleeping/waking up, scanning/listening for neighbors etc) for thesetechnologies and compare the technologies based on these measurements. Our analysisreveals that neighbor discovery can quickly drain a device’s battery, depending on the re-quired scanning frequency. In addition, once a connection is established, the “host” of theconnection consumes two to five times the energy needed by a “client”. To solve this unfair-ness problem, we propose a strategy that periodically alternates the hosting role among thepeers. Further, we minimize the cost of the role switching operation by using the distribu-tion of the residual connection time of two peers to calculate an adaptive switching period.We examine the trade-off between fairness and switching cost on real-world connectiontraces and show that our scheme largely outperforms static role switching. Finally, wedemonstrate that our fair role switching scheme is also effective when run on real devices.

I. Introduction

Today, most people carry mobile phones featuringtechnologies like Bluetooth or Wi-Fi Direct, that al-low device-to-device communication. Using thesetechnologies, devices can exchange data wheneverthey are within mutual transmission range, therebyforming an opportunistic network [1, 2]. Such oppor-tunistic networks were proposed as a solution to fillthe gaps left by the existing networking infrastructurein remote and rural areas [3], to enable communica-tion when infrastructure breaks down during naturaldisasters [4], or to circumvent censorship. Further-more, opportunistic networks can mitigate the pres-sure on infrastructure, caused by exponentially grow-ing traffic demands, by offloading certain traffic [5].

∗This work is based on an earlier work: Slicing the Bat-tery Pie: Fair and Efficient Energy Usage in Device-to-DeviceCommunication via Role Switching, in Chants’13, ©ACM 2013.http://doi.acm.org/10.1145/2505494.2505496

In addition, some novel applications and services,such as local social networking [6], are more naturallysupported by opportunistic communication than by afixed network infrastructure.

However, to make opportunistic networking feasi-ble in practice, users must accept to contribute, de-spite their resource constrained phones. One criti-cal challenge to achieve this is minimizing the im-pact of device-to-device networking on battery life-time. Thus, studying energy consumption is crucialfor the success of an opportunistic network. In par-ticular, the energy spent in the background on dis-covering opportunistic peers has been well investi-gated in the past [7, 8]. That research has mainlyfocused on the theoretical analysis and derivation ofadaptive scanning strategies: minimizing the num-ber of required scanning operations, while detectinga maximum number of communication opportunitiesby adapting the scanning interval. Most approacheseither try to learn the optimal scanning rate for the

Mobile Computing and Communications Review, Volume 18, Number 1, January 2014 25

0 2 4 6 8 10Time [h]

65

70

75

80

85

90

95

100

Batte

ry [%

]

Static ClientStatic HostOptimal Fair Consumption

Figure 1: Battery depletion of an AP (host) and anassociated station (client).

current arrival rate of new peers [7], or they adaptthe scanning rate based on the current context of theuser [8].

In this paper, we go one step further and break downthe opportunistic networking functions (neighbordiscovery, connection establishment/maintenance) tosingle operations (e.g., waking up from sleep mode,performing a scan) and states (e.g., being discover-able). For these simple building blocks, we carry outextensive measurements of the respective energy con-sumption. We compare in detail the energy consumedby three technologies commonly used for device-to-device communication: the widespread Bluetooth andWi-Fi Direct1, as well as WLAN-Opp [10], a methodbased on traditional WLAN, which puts a subset ofdevices in access point (AP) mode, so that any otherdevice can connect. Since none of these technolo-gies were explicitly designed for creating opportunis-tic networks, it is essential to understand and comparetheir usage for this purpose.

In particular, we show that, for peer discovery,Bluetooth uses less than half the energy of WLAN-Opp, which in turn only uses half the energy of Wi-FiDirect. This holds across a wide range of scanningintervals, and it follows from each technology’s char-acteristics and design choices. Further, we find that,once a peer is found, all three technologies suffer fromfairness issues in the establishment and maintenanceof a connection to this peer. More precisely, of the twodevices, the one that “hosts” the connection incurs amuch higher energy cost than the “client” device. Anexample of this effect is shown in Figure 1. The fig-ure shows the battery usage of two Samsung Galaxy

1The ad-hoc part of the IEEE 802.11 standard [9] is unfortu-nately not supported on major smartphone operating systems suchas iOS and Android (unless they are rooted or jailbroken).

Nexus phones running Android 4.2 (both in airplanemode, Wi-Fi on), connected to each other via WLAN-Opp for 10 hours without transmitting data. We cansee that on one phone the battery drains much fasterthan on the other – an inequitable situation.

Based on the above insight, we propose the con-cept of fair role switching, which consists of periodi-cally alternating the hosting role between the devices.Fair role switching increases the simplest form of fair-ness, i.e., equality of energy consumption, and canalso substantially extend the battery lifetime of mobilephones. The challenge is to estimate the best switch-ing frequency that achieves a good trade-off betweenfairness and overall energy consumption for maintain-ing the connection. To address this challenge, we usethe fact that the contact duration of two devices in op-portunistic networks was found to follow a power lawdistribution [1]. We analytically derive the distribu-tion of the remaining contact duration, in function ofthe elapsed contact duration, and use this to estimate afair and efficient role switching interval. We then usetrace-driven simulation to evaluate the trade-off be-tween fairness and the energy overhead of role switch-ing. Applying our fair and efficient role switchingscheme to real contact traces shows a reduction in theenergy required for role switching by up to 85% (for anhour long contact), compared to a static role switchinginterval, while maintaining a good level of fairness.To further prove the effectiveness of our scheme weperforme a real world experiment, where we log andcompare the battery consumption of Galaxy Nexusphones while applying either no switching, switchingat fixed intervals, or our adaptive scheme that switchesaccording to the foreseen remaining contact time.

Summarizing, our work makes the following maincontributions:

• We describe an accurate measurement method,using the Monsoon Power Monitor, and presentenergy consumption readings for basic (network-ing) operations on a Galaxy Nexus phone (Sec-tion II).

• We dissect the energy consumption of the dis-covery process for Bluetooth, Wi-Fi Direct, andWLAN-Opp, and identify the most promisingenergy saving methods (Section III).

• We devise a scheme which determines the bestrole switching interval between a pair of de-vices, so as to achieve fair depletion, minimizethe number of role switches, and extend the bat-tery lifetime of the two devices (Section IV).

• We evaluate the trade-off between switchingoverhead and fairness and compare our scheme

26 Mobile Computing and Communications Review, Volume 18, Number 1, January 2014

0 5 10 15 200

500

1000

1500

Time [s]

Po

we

r [m

W]

Figure 2: A Monsoon Power Monitor measurement.

to static switching via simulation using syn-thetic and real-world contact traces. Further, wedemonstrate that our scheme is fair and efficienton real devices (Section V).

II. Energy Measurement

Due to limited battery capacity, energy-efficient op-eration is one of the most critical issues for smart-phones. Hence, measuring and modeling energy con-sumption has attracted considerable attention in theresearch community, both from the mobile phonesensing perspective [11] and the networking do-main [12, 13, 14, 15]. In this section, we introduce ourmethodology for measuring the energy consumptionof individual events (e.g., scanning) and states (e.g.,being discoverable), that are relevant for opportunis-tic networking.

II.A. Measurement Setup

Measuring the energy consumed by a single operationis a challenging problem. The operating system typ-ically provides estimates of the current state of thebattery (in percentage of the full capacity). How-ever, deducing the consumed energy for specific (net-working) operations from this information is inaccu-rate, as it is heavily influenced by background pro-cesses running on the phone, as well as the state ofthe battery, which typically loses capacity during itslifetime. To obtain a clearer picture of energy con-sumption, the state-of-the-art approach is to circum-vent the battery and directly record the power con-sumed by the phone [12, 13, 14]. For this purpose,we use the Monsoon Power Monitor [16]. The PowerMonitor replaces the battery and shows (and records),in real-time, the power that is consumed by the deviceat a resolution of 500Hz (or 2ms). For our measure-ments, we use a Samsung Galaxy Nexus smartphone,running Android 4.2. While the power consumptiondiffers among device models, experiments with a fewother phones show qualitatively similar results.

A sample output of a recorded experiment is shownin Figure 2: the phone is initially sleeping, then itwakes up and enters the idle state for 10 seconds, andfinally it switches back to sleep mode. The differentlevels of energy consumed during the sleep and awakestates are clearly visible. The plot also shows that thedevice requires around one second to wake up, whichmakes the actual time awake slightly longer than thedesired 10 seconds.

II.B. Measurement Method

The Monsoon Power Monitor allows us to read thepower consumed for different patterns of operations,such as waking up the CPU every 20 seconds for aduration of 10 seconds. To derive the consumed en-ergy, we integrate over time the power used for eachpattern (note that one pattern consists of several op-erations). In order to extract the energy consump-tion of individual operations, we perform indepen-dent experiments, running different patterns of oper-ations. By formulating the patterns of operations aslinear equations, we obtain a system of linear equa-tions, which we solve for the energy consumption ofa single operation. Each group of experiments is per-formed 10 times to obtain a mean and a standard de-viation (STD).

We distinguish between states (e.g., awake orasleep), which continuously use power and are hencemeasured in terms of power (Watt), and events (e.g.,discovery), which are limited in duration and mea-sured in terms of energy (Joule). Any event will hap-pen either while the device is asleep or while it isawake. The energy consumed by an event does not in-clude the energy required for maintaining basic states,i.e., being asleep or awake.

II.C. Basic Energy Consumption

The most effective way to save energy in smartphonesis to keep a device in the sleep state for as long as pos-sible. This is typically the case when the screen is off.However, applications may request to keep the CPUawake or an alarm might trigger it to wake up. Asseen in Table 1, the phone consumes nearly five timesmore power if the CPU is awake (but idle). To putthese numbers into the perspective of the battery lifeof a smartphone, the battery capacity of the GalaxyNexus is about 6.48Wh. The sleeping state consumesthus 0.16 battery-percent per hour (%/h), while an idleCPU consumes 0.87%/h.

In case background processes are running and wak-ing up the CPU frequently, we need to take into ac-

Mobile Computing and Communications Review, Volume 18, Number 1, January 2014 27

Abbr. Operation Power/Energy STD

PCPUsleep CPU sleep 10.40 mW 0.54 mW

PCPUawake CPU awake 56.15 mW 3.97 mW

ECPUwake CPU wake up 280.63 mJ 53.23 mJ

Table 1: Power and energy consumption of the basicoperations.

count the one time energy cost of waking up the CPU,which is also shown in Table 1. Considering theamount of energy it takes to wake up the CPU, thebenefit of putting the phone into sleep mode dependson the amount of time the phone will stay in sleepmode. With the tested Galaxy Nexus, the device mustsleep for at least seven seconds before waking theCPU up again, in order to achieve a gain in energy.

III. Energy-efficient Discovery

A key operation in opportunistic networking is neigh-bor discovery. As neighbor discovery is a processcontinuously running in the background, energy ef-ficiency is particularly important. By measuring theenergy consumption of the discovery process, we willanswer two questions: (i) How do the energy con-sumptions of Bluetooth, Wi-Fi Direct, and WLAN-Oppcompare to each other? (ii) How much energy is nec-essary for each of these technologies to guaranteefinding a peer within a given time T? Note that, asmentioned in the introduction, related work focusesmostly on adapting the scanning interval to the cur-rent context (e.g., [8]). Here, our goals are different.First, we want to provide a comparison between theavailable technologies, to allow an informed decisionwhen designing an opportunistic network. Second, webelieve it is important to provide a guarantee for dis-covering a peer within a certain time interval. Thus,we need to limit the maximum time between consec-utive discovery operations.

In the following, we explain the reqired operationsof the discovery process for the three technologies,i.e., Bluetooth, WLAN-Opp, and Wi-Fi Direct. Wethen compare their energy consumption depending onthe time of guaranteed discovery.

III.A. Bluetooth

Bluetooth was designed to set up a personal area net-work, to easily connect several user devices and ap-pliances with one another (e.g., a headset to a mobilephone). However, Bluetooth also allows to establish

Abbr. Operation Power/Energy STD

PBTdisc Bluetooth discoverable 2.59 mW 0.56 mW

PAPon Wi-Fi AP on 210.97 mW 11.72 mW

PDdisc Wi-Fi Direct discovery 340.89 mW 4.02 mW

EBTdisc Bluetooth discovery 2027.38 mJ 146.70 mJ

EWIFIscan Wi-Fi scan 697.47 mJ 115.07 mJ

EAPon Wi-Fi AP turn on 754.03 mJ 257.30 mJ

EDon Wi-Fi Direct turn on 633.31 mJ 115.59 mJ

Table 2: Power consumption of discovery operations.

a local network, consisting of a master serving sev-eral (up to seven) slaves. Its range and throughput aresmall compared to the IEEE 802.11a/g/n technology.2

Despite its drawbacks, Bluetooth has the big advan-tage of being a very energy-efficient ad-hoc communi-cation protocol. This is partly due to low transmissionpower (leading to a smaller transmission range), butalso to the fact that the discoverable state is extremelyenergy-efficient, as shown in Table 2. Thus, for au-tomatic discovery in opportunistic networks, a de-vice can continuously be discoverable without wast-ing much energy.

The process of actively scanning for peers naturallyconsumes much more energy. A Bluetooth scan takesabout 13 s and consumes 2027.38mJ during this time.Thus, discovery operations need to be scheduled care-fully. If we schedule discovery at regular intervals oftime tscan (i.e., two devices are guaranteed to discovereach other after tscan, and will find each other aftertscan2 on average), the power a device consumes for the

discovery process is given by:

PBT(tscan) = PCPU

sleep + PBTdisc +

EBTdisc

tscan. (1)

As we will see in Section III.D, this process is veryenergy-efficient compared to the other technologies.

III.B. WLAN-Opp

WLAN-Opp [10] provides a flexible way to setup andmaintain ad-hoc wireless connectivity, by leveragingexisting 802.11 networking technology. To communi-cate using regular Wi-Fi technology, one device mustbe in access point (AP) mode, so the peer can connectto it. In a standard setting (e.g., a public hotspot), therole of the access point is assigned to a specific device.

2Bluetooth LE (low energy) has an even lower throughput andis optimized for small data packages (sensor state updates) andthus not practical for our scenario.

28 Mobile Computing and Communications Review, Volume 18, Number 1, January 2014

In the case of opportunistic networking, however, anydevice can be either access point or client. Therefore,the WLAN-Opp approach needs a discovery function.

In order to become discoverable, a device must be-come an AP for a certain time tdisc, while regularlyperforming Wi-Fi scans (in client mode) the rest of thetime. The scans must be frequent enough not to missanother device in AP mode, i.e., at least every tdisc.The time interval until becoming an AP (i.e., tscan) de-fines how fast a device will be discovered (guaranteedand on average).3

The energy consumptions for both the AP mode(switching on and being on) and the scanning areshown in Table 2. In contrast to Bluetooth, the CPUmust be awake to perform a Wi-Fi scan or to switch toAP mode. Both being discoverable and performing adiscovery are active processes that consume consider-able energy. The energy of the whole discovery pro-cess is given by:

PW(tscan, tdisc) = PCPU

sleep +EWIFI

scan

tdisc+

EAPon + PAP

on ⋅ tdisc

tscan.

(2)While the scanning interval tscan depends on how

fast devices must be able to discover each other (it isthus a design decision), the duration of the AP modetdisc (which also defines the time interval until the nextWi-Fi scan) can be optimized to minimize the powerconsumption PW. By setting to zero the derivative ofPW

(tscan, tdisc) with respect to tdisc, we get the optimalscan duration topt

disc, depending on the scanning intervalas follows:

toptdisc(tscan) =

¿

ÁÁÀ

EWIFIscan ⋅ tscan

PAPon

. (3)

We can now substitute tdisc in Eq. (2) with the optimalscan duration topt

disc and use this for the power consump-tion comparison in Section III.D.

III.C. Wi-Fi Direct

Wi-Fi Direct is the Wi-Fi Alliance’s new ad-hoc com-munication protocol for interconnecting smart de-vices4, by allowing to setup a “soft access point” forhigh bandwidth Wi-Fi communication. Wi-Fi Directrequires a secure pairing procedure which adds de-lay (up to two minutes). While Wi-Fi Direct couldbe used for opportunistic networking, it was designedfor different purposes and without energy efficiency

3For the sake of simplicity, we assume tscan is fixed; in a realimplementation, this interval should have a random component.

4Wi-Fi Direct today has largely replaced Wi-Fi Ad-Hoc,which was never adopted widely.

in mind. The discovery process is very costly, as seenin Table 2, and requires both devices to actively scanat the same time for a successful discovery. By de-sign, Wi-Fi Direct is, therefore, mostly suited to con-sciously connect two or more devices at a specificpoint in time, and is not optimized for a continuousdiscovery process in the background.

Since the Wi-Fi Direct specifications do not includea discovery process with duty cycling, this must bedesigned separately. Ensuring that both devices arescanning at the same time (and thus discover eachother) without requiring synchronization between thedevices is not straightforward. A simple and efficientapproach is to mimic the scheme described above forWLAN-Opp. Translated to Wi-Fi Direct, this meansto scan for a long duration tdisc every tscan (this cor-responds to being in AP mode in WLAN-Opp). Inbetween such long scans, we perform short scans ev-ery tdisc (this corresponds to scanning for an AP inWLAN-Opp). The duration of this short scan can beset to a minimum time that allows a discovery (tmin

disc).Since there is no specified minimal scan time tmin

disc toguarantee discovery in Wi-Fi Direct, we take the valueof tmin

disc = 5.5 s, the median of successful discoverytimes reported in [17].

The whole power consumption of the discoveryprocess thus comprises the sleeping CPU power PCPU

sleep,the frequent short scans, and the less frequent longscans:

PD(tscan , tdisc) = PCPU

sleep+ED

on + PDdisc ⋅ tmin

disc

tdisc+

EDon + PD

disc ⋅ tdisc

tscan.

(4)

Similar to the WLAN-Opp case, the time a deviceperforms a long scan (tdisc) defines the interval be-tween the short scans and can be optimized dependingon the interval of the long scan (tscan). The optimalduration for a long scan is thus:

toptdisc(tscan) =

¿

ÁÁÀ

(EDon + PD

disc ⋅ tmindisc) tscan

PDdisc

. (5)

III.D. Discoverability vs. Energy Con-sumption

Given the above expressions for average power con-sumption and the power measurements, we have nowall the required information to compare the three tech-nologies. Naturally, the energy consumption of alldiscovery mechanisms depends on the duty cycle in-terval tscan. A smaller time results in faster discoverybut also requires more energy. The interval tscan is the

Mobile Computing and Communications Review, Volume 18, Number 1, January 2014 29

0 100 200 300 400 500 600Scanning interval [s]

0

100

200

300

400

500

Pow

er [m

W]

Wi-Fi DirectWLAN-OppBluetooth

130

43

26

19

14

Batte

ry T

ime

[h]

(a) Power consumption vs.scanning interval.

0 100 200 300 400 500 600Scanning interval [s]

2

3

4

5

6

Pow

er [n

orm

aliz

ed to

BT

pow

er]

Wi-Fi DirectWLAN-Opp

(b) Power consumption rel-ative to Bluetooth vs. scan-ning interval.

Figure 3: Average power consumption of the discov-ery process.

time for guaranteed discovery, while two devices willdiscover each other on average after tscan

2 .The average power consumption depending on the

duty cycle interval is shown in Figure 3a. As ex-pected, Bluetooth performs best in terms of preserv-ing battery life. For example, to guarantee discov-ery within 2 min, Bluetooth consumes 0.46%/h on aGalaxy Nexus, while WLAN-Opp requires 1.33%/h,and Wi-Fi Direct requires a whopping 2.86%/h. Allin all, Bluetooth is 2.5 to 3 times more efficient thanWLAN-Opp, which is in turn twice as efficient as Wi-Fi Direct, as shown in Figure 3b, where we plot thepower consumption normalized to Bluetooth.

One of the main benefits of Bluetooth, and a reasonfor its efficiency, is that it is able to operate while thephone is asleep. Thus, if battery lifetime is the onlyconcern, Bluetooth is a good choice for opportunis-tic networking. However, if the required transmissionrange and throughput call for a Wi-Fi approach, anaccess point based scheme like WLAN-Opp has clearbenefits over Wi-Fi Direct in terms of energy con-sumption.

IV. Fair Connection Maintenance

Once a node has discovered another peer, the pair5

needs to be able to communicate. To this end, allthree technologies (Bluetooth, WLAN-Opp, and Wi-Fi Direct) establish some type of host-client connec-tion. There is always one device in master or AP mode(the host), while the other is connected to it as a slaveor station (the client). As can be expected, the energyrequired to be a host or a client is not equal, resultingin an unfair battery drain for some devices. While thisis already true for the connection establishment phase,

5Though we focus here on pairwise communication, we be-lieve the results are easily extensible to group communication andplan to demonstrate this in future work.

Operation Power/Energy STD

Bluetooth connected (slave) 58.49 mW 3.29 mWBluetooth connected (master) 28.53 mW 0.05 mW

WLAN-Opp associated (station) 60.79 mW 9.74 mWWLAN-Opp associated (AP) 210.97 mW 11.72 mW

Wi-Fi Direct connected (station) 49.75 mW 3.90 mWWi-Fi Direct connected (AP) 231.92 mW 9.14 mW

Bluetooth connect (slave) 1998.11 mJ 157.77 mJBluetooth connect (master) 944.81 mJ 77.95 mJ

WLAN-Opp associate (station) 3194.32 mJ 722.81 mJWLAN-Opp associate (AP) 2626.86 mJ 366.25 mJ

Wi-Fi Direct connect (station) 3523.78 mJ 714.44 mJWi-Fi Direct connect (AP) 1654.50 mJ 395.25 mJ

Table 3: Power consumption of connection opera-tions.

it gets even worse when also accounting for connec-tion maintenance and actual traffic. The energy costof maintaining a connection among a pair of devicesfor the different technologies is shown in Table 3.

The role of the device impacts energy consump-tion for all technologies by a factor varying between 2and 5. The overall energy cost of communication in-cludes the additional one-time cost of connection es-tablishment, which also differs with the device’s role,as shown in Table 3.

Note that we consider equal resource consumptionto be fair. This simple definition of fairness may notalways be the desired or appropriate one, but is themost intuitive. We plan to extend this framework toa more generic type of fairness in future work that al-lows for interesting scenarios like maximizing grouplifetime.

IV.A. The Fairness–Efficiency Trade-off

In order to render fair the energy consumption of eachdevice, one option is to alternate the host roles in around robin fashion, at the cost of short disconnec-tions. This scheme involves an obvious trade-off be-tween fairness and overall energy efficiency. On theone hand, switching should be kept at a minimum,to avoid both disconnections and the one-time costof setting up the connection. On the other hand, theduration of the physical proximity of two devices isuncertain and a disconnection may happen before roleswitching takes place; therefore, to maintain fairness,switching must be done as often as possible. Thistrade-off is clearly visible in Figure 4 (for role switch-ing with a fixed interval): while the consumption ofboth devices that are switching is virtually the same

30 Mobile Computing and Communications Review, Volume 18, Number 1, January 2014

0 2 4 6 8 10Time [h]

65

70

75

80

85

90

95

100

Batte

ry [%

]

overhead

Static ClientStatic HostFixed Interval Role Switching (both devices)Optimal Fair Consumption

Figure 4: Battery depletion overhead of role switch-ing with a fixed interval.

(purple ‘+’), it is significantly below the optimal fairconsumption.

While, for the sake of network usability, we mustensure that disconnections are infrequent, there is alsoa minimal time tmin below which switching simplydoes not pay off from an energy perspective. Intu-itively, the energy imbalance of maintaining the con-nection should be greater than the cost of switchingthe roles. Thus, for tmin the following equation musthold:

∣tmin ⋅ PH− tmin ⋅ PC

∣ = EH+ EC , (6)

where P is the power consumed by the host (H) orclient (C), and E the energy required to switch toclient or host mode. From this, the minimal time tminis given by:

tmin =EH+ EC

∣PH− PC

. (7)

From this equation and the measured values in Ta-ble 3 we derive the following concrete values for thedifferent technologies:

Bluetooth tmin = 98 sWLAN-Opp tmin = 39 sWi-Fi Direct tmin = 28 s

Having established a basic condition for energy-efficient switching, in the following we focus on de-vising a switching heuristic aimed at achieving a goodtrade-off between the total energy consumption of thepair of devices and the fairness of how the two devicesshare this consumption.

IV.B. Adaptive Role Switching Scheme

A role switching scheme that is both fair and efficientshould minimize the number of switches, while ensur-ing that the overall energy cost is split equally betweenthe two communicating devices. If the duration ofthe communication opportunity (or contact, in oppor-tunistic networking terms) were known in advance, it

would be easy to calculate exactly the optimal numberof switches, based on the reference energy consump-tion readings from Table 3. However, in opportunis-tic networks, contacts are typically caused by nodemobility, which is, in most cases, non-deterministic.Therefore, rather than calculating a fixed number ofswitches per contact, a good role switching heuris-tic should continuously re-evaluate the remaining life-time of the contact, and produce a switching decisionbased on this and the above reference consumptionreadings.

Analyses of real world experiments with oppor-tunistic communication have shown that contact du-ration is distributed as a power law [1, 7]. Usingthis finding and reliability theory, in the following wederive in closed-form the distribution of the residualcontact duration and then use this to propose a roleswitching heuristic.

Let the contact duration X be distributed as Type IPareto distribution (a power law), which has a cumu-lative distribution function:

FX(x) = P(X ⩽ x) =⎧⎪⎪⎨⎪⎪⎩

1 − (xmx )

α, if x ⩾ xm

0, if 0 < x < xm ,(8)

where α > 0 is the power law exponent and xm >

0 is the minimum duration of a contact. Then, thedistribution FT(t) of the remaining contact duration Tis given by the probability that the contact finishes ator before time telapsed+t, given that it already lasted fortelapsed time units. Using the definition of conditionalprobability and basic algebra, and noting that telapsed >xm, we find:

FT(t) = P(T ⩽ t) = P(X ⩽ telapsed + t ∣X > telapsed)

= 1 − (

telapsed

telapsed + t)

α

. (9)

Based on this, we can use a percentile, e.g., themedian6 of the remaining contact duration to decidewhen to switch roles. Using a lower percentile resultsin a more agressive switching strategy which is fairerbut less efficient as we potentially switch more often.A higher percentile on the other hand, gives us a lessaggressive and thus more efficient but less fair switch-ing strategy. The percentiles of the remaining contactduration can be easily derived from Eq. (9) as:

tp = telapsed ⋅⎛

(

100100 − p

)

− 1⎞

(10)

where p is a percentile between 0 and 100.

6Since the distribution of the remaining contact duration isalso power law, the percentiles are better than the average, as arepresentation of the “typical” contact duration. The average mayeven be infinite, depending on the exponent α.

Mobile Computing and Communications Review, Volume 18, Number 1, January 2014 31

0 20 40 60 80 100Percentile

25262728293031323334

# o

f sav

ed ro

le s

witc

hes Wi-Fi Direct

WLAN-OppBluetooth

(a) PL trace.

0 20 40 60 80 100Percentile

0

2

4

6

8

10

12

# o

f sav

ed ro

le s

witc

hes Wi-Fi Direct

WLAN-OppBluetooth

(b) H06 trace.

0 20 40 60 80 100Percentile

0

5

10

15

20

25

30

35

# o

f sav

ed ro

le s

witc

hes Wi-Fi Direct

WLAN-OppBluetooth

(c) ETH trace.

0 20 40 60 80 100Percentile

0

1

2

3

4

5

6

# o

f sav

ed ro

le s

witc

hes Wi-Fi Direct

WLAN-OppBluetooth

(d) SF trace.

Figure 5: Saved number of role switches per contact (averaged over all contacts) depending on percentile ofremaining contact time.

0 20 40 60 80 100Percentile

01020304050607080

Ener

gy U

nfai

rnes

s [J]

Wi-Fi DirectWLAN-OppBluetooth

(a) PL trace.

0 20 40 60 80 100Percentile

0

5

10

15

20

25

Ener

gy U

nfai

rnes

s [J]

Wi-Fi DirectWLAN-OppBluetooth

(b) H06 trace.

0 20 40 60 80 100Percentile

0

5

10

15

20

25

30

35

Ener

gy U

nfai

rnes

s [J]

Wi-Fi DirectWLAN-OppBluetooth

(c) ETH trace.

0 20 40 60 80 100Percentile

0

2

4

6

8

10

12

Ener

gy U

nfai

rnes

s [J]

Wi-Fi DirectWLAN-OppBluetooth

(d) SF trace.

Figure 6: Per contact energy unfairness (difference of consumed energy) averaged over all contacts dependingon percentile of remaining contact time.

PL H06 ETH SF

# contacts 100 000 000 227 657 22 968 1 339 273α 1 1.56 2.5 2.06xm 1 1 023 5 480 1 383# nodes 78 20 536scanning interval 2min 2 s 30 s

Table 4: Contact traces.

As the percentiles of the remaining contact dura-tion increase linearly with the time already spent incontact, we can dynamically re-evaluate the switchingtime tswitch at each role change as follows:

tswitch =

⎧⎪⎪⎨⎪⎪⎩

tp2 , if tp

2 > tmin

tmin , else,(11)

where tmin is the minimum switching time for an ef-ficient operation, determined in Eq. (7).

This strategy should provide a good trade-off be-tween the energy consumption of role switching,while maintaining fairness by switching frequentlyenough during shorter contacts. We will show in Sec-tion V.A how the exact trade-off can be tweaked bychoosing different percentiles of the remaining con-tact time distribution.

V. Evaluation of Our Role SwitchingScheme

To analyze and evaluate the trade-off, we simulatethe energy consumption and fairness of our adap-tive strategy and compare the results to the ones ob-served when using a constant switching time tswitch.For this, we first use contact durations generated bythe Pareto distribution in Eq. (8) denoted PL. Then,for a more realistic evaluation, we also use the con-tacts from three different real world traces: the Haggle2006 trace (H06), the ETH trace (ETH), and the SanFrancisco taxi cab trace (SF). For all real world traces,a Pareto distribution was fitted to the set of all con-tact durations, using the maximum likelihood (ML)method described in [18]. This provides the likeliestset of parameters: minimal time xm and exponent α.The characteristics of the used datasets of contact du-rations are summarized in Table 4 and detailed in thefollowing.

PL: Power law durations were generated by invert-ing the Pareto CDF: xgen = xm (1 −U[0, 1])−

1α , where

U[0, 1] is a uniformly distributed value between 0 and1, the minimal time is set to xm = 1s, and shape is α = 1.

H06: The Haggle 2006 trace was collected duringthe three days of the Infocom conference in 2006 [19].It comprises records from 78 Bluetooth devices, witha scanning interval of 2 minutes. Since we are onlyinterested in contact durations, we used all 227 657

32 Mobile Computing and Communications Review, Volume 18, Number 1, January 2014

0 2000 4000 6000Time already in contact [s]

010002000300040005000600070008000

Med

ian

of re

mai

ning

tim

e [s

]

TraceAnalytical (MLE)

(a) PL trace.

0 1000 2000 3000Time already in contact [s]

0

500

1000

1500

2000

2500

Med

ian

of re

mai

ning

tim

e [s

]

TraceAnalytical (MLE)

(b) H06 trace.

0 2000 4000 6000 8000Time already in contact [s]

0

1000

2000

3000

4000

5000

Med

ian

of re

mai

ning

tim

e [s

]

TraceAnalytical (MLE)

(c) ETH trace.

0 2000 4000 6000Time already in contact [s]

0

500

1000

1500

2000

2500

3000

3500

Med

ian

of re

mai

ning

tim

e [s

]

TraceAnalytical (MLE)

(d) SF trace.

Figure 7: Median of the remaining contact time distribution depending on the time already in contact.

recorded contacts. The maximum likelihood param-eters for this dataset are α = 1.56 and xm = 1 023s.

ETH: The ETH trace was collected on the ETHcampus in 2005, from 20 researchers carrying a Pock-etPC [20]. Scanning was done via beacons over Wi-Fi Ad-Hoc with a 2-second interval. There are a to-tal of 22 968 recorded contacts. The maximum like-lihood parameters for this dataset are α = 2.5 andxm = 5 480s.

SF: The San Francisco taxicab trace, representingGPS position recordings for over 500 taxicabs over aperiod of a month [21]; the contacts in this trace areinferred based on a conservative transmission rangeof 30m. This results in a total of 1 339 273 inferredcontacts. The maximum likelihood parameters for thisdataset are α = 2.06 and xm = 1 383s.

V.A. Impact of Chosen Percentile

First, we derive the best percentile to be used in ourrole switching scheme. For this, we evaluate howthe percentile influences the number of saved roleswitches, i.e., the saved switching energy, as well asthe energy unfairness, measured as the amount of en-ergy one device spends more than the other, in all thetraces. This evaluation is done for every contact thatis longer than two times tmin as for shorter contactsour adaptive role switching scheme performs the sameas static switching. As seen in Figure 5, the averagenumber of role switches our scheme saves per con-tact in comparison to a static role switching schemeincreases approximately linearly with the increasingpercentile for all traces. On the other hand, in Figure 6we can see that the energy unfairness increases morethan linearly with the increasing percentile also for allthe traces. Here again, the energy unfairness is mea-sured per contact. The choice of the percentile that isused in the role switching scheme defines the trade-off between energy fairness and efficiency. While thistrade-off may vary depending on the requirements ofthe communication protocol or the situation, the 50thpercentile, i.e., the median, seems to be a reasonabletrade-off. For this case Eq. (10) results in

tmed = tp=50 = telapsed ⋅ (21α − 1) , (12)

0 500 1000 1500 2000 2500 3000 3500Contact Duration [s]

0

100

200

300

400

500

600

700

Tota

l Sw

itchi

ng E

nerg

y [J]

Wi-Fi Direct (fixed tswitch)WLAN-Opp (fixed tswitch)Bluetooth (fixed tswitch)Wi-Fi Direct (adaptive)WLAN-Opp (adaptive)Bluetooth (adaptive)

Figure 8: Energy consumed to switch roles dependingon the contact duration in the H06 trace (other tracesperform similar).

which determines the switching time defined inEq.( 11) that we will use for the following evaluation.

V.B. Analysis of Remaining Contact Du-ration in Traces

After having chosen the median as a suitable per-centile for our role switching scheme, we evaluatehow good the power law fit is in the traces, by con-firming that the median of the remaining time is ac-tually also increasing in the traces. As seen in Fig-ure 7, the median indeed increases with the time al-ready spent in contact. The red dashed line shows thetheoretical value of the median depending on the cor-responding α and the blue line is the measured value.For longer times, the measured values drift away fromthe theoretical value because there are not enoughsamples of long contacts. They are thus not shown.While the median increases for all traces, the ETHtrace shown in Figure 7c diverges from the theoreti-cal fit. We think this is due to the fixed office structurewhere the contacts are mainly determined by the loca-tion of the office, the working hours, regular breaks,and lunch time.

Mobile Computing and Communications Review, Volume 18, Number 1, January 2014 33

0 2000 4000 6000 8000 10000Switching Time [s]

0

10

20

30

40

50

60

70

Ener

gy U

nfai

rnes

s [J]

Wi-Fi Direct (fixed tswitch)WLAN-Opp (fixed tswitch)Bluetooth (fixed tswitch)Wi-Fi Direct (adaptive)WLAN-Opp (adaptive)Bluetooth (adaptive)

(a) PL trace.

0 2000 4000 6000 8000 10000Switching Time [s]

0

10

20

30

40

50

60

70

80

Ener

gy U

nfai

rnes

s [J]

Wi-Fi Direct (fixed tswitch)WLAN-Opp (fixed tswitch)Bluetooth (fixed tswitch)Wi-Fi Direct (adaptive)WLAN-Opp (adaptive)Bluetooth (adaptive)

(b) H06 trace.

0 2000 4000 6000 8000 10000Switching Time [s]

0

20

40

60

80

100

120

140

160

180

Ener

gy U

nfai

rnes

s [J]

Wi-Fi Direct (fixed tswitch)WLAN-Opp (fixed tswitch)Bluetooth (fixed tswitch)Wi-Fi Direct (adaptive)WLAN-Opp (adaptive)Bluetooth (adaptive)

(c) ETH trace.

0 2000 4000 6000 8000 10000Switching Time [s]

0

10

20

30

40

50

Ener

gy U

nfai

rnes

s [J]

Wi-Fi Direct (fixed tswitch)WLAN-Opp (fixed tswitch)Bluetooth (fixed tswitch)Wi-Fi Direct (adaptive)WLAN-Opp (adaptive)Bluetooth (adaptive)

(d) SF trace.

Figure 9: Per contact energy unfairness (difference of consumed energy) averaged over all contacts dependingon the switching time. Smaller values are fairer. Note that the fairness values for the adaptive role switchingscheme are constant as they do not depend on tswitch and are shown as a reference.

V.C. Energy Efficiency

As the remaining contact duration increases in thetraces we can now analyze the energy efficiency of ouradaptive role switching scheme. For this, we calculatethe energy required for a role switching scheme withstatic intervals, as well as the amount of energy wewould require when using an adaptive switching time.In Figure 8 we can see the resulting energy dependingon contact duration for the H06 trace and for all threetechnologies (similar outcomes were obtained for theother traces). This adaptation of the switching time al-lows us to save a considerable amount of energy, espe-cially for longer contacts. For Wi-Fi Direct, adaptiveswitching saves 85% energy in an hour long contactof the H06 trace compared to fixed interval switch-ing (tswitch = tmin). The other two technologies showslightly lower savings. To put this in perspective, thiscorresponds to a saving of at least 540 J, which is 2.3%of the battery in one hour.

V.D. Energy Fairness

The advantage of a small switching time is that it isfair. To compare the fairness of our heuristic to a

static switching scheme, we calculate the imbalanceof energy, i.e., the difference in energy consumptionof the two devices during every contact. This unfair-ness value, averaged over all contacts, is shown in Fig-ure 9 as a function of the switching time of the staticscheme. The fairness decreases with an increasingswitching time, as it allows for more and longer unbal-anced connections. We can also see that our adaptivealgorithm, depicted as the constant reference lines inFigure 9, is a good trade-off, resulting in good fairnessvalues, while saving a lot of battery power.

V.E. Real World Experiment

For a final proof of concept we implemented theWLAN-Opp approach for Android and measured itsbattery consumption.7 We performed three experi-ments, one without switching, one with static switch-ing (tswitch = tmin), and one with our efficient roleswitching scheme. As shown in Figure 10, withoutswitching the imbalance between host and client issignificant. In this case, the host consumes 4.7 times

7Bluetooth and Wi-Fi Direct could not be implemented due tolimitations of the Android API.

34 Mobile Computing and Communications Review, Volume 18, Number 1, January 2014

0 2 4 6 8 10Time [h]

65

70

75

80

85

90

95

100

Batte

ry [%

]

Static ClientStatic HostFixed Interval Role Switching (both devices)Adaptive Role Switching (device 1)Adaptive Role Switching (device 2)Av. Adaptive Role SwitchingOptimal Fair Consumption

Figure 10: Battery depletion of two real devices un-der (i) static role assignment, (ii) role switching witha fixed interval, (iii) and our adaptive role switchingscheme.

more energy than the client, i.e. after 10 hours thehost’s battery decreased by 34.9% as opposed to 7.5%for the client’s. The battery consumption with thestatic switching scheme is balanced among the de-vices. However, with a battery consumption of 29.5%in 10 hours it consumes 8.3% more than the optimalcase, thus nearly a third (28.3%) of the total energy isconsumed by the switching process. With the adap-tive role switching scheme we can bring the averageconsumption down to 21.6%. The energy required forthe switching process is thus reduced to 2.2% of thetotal consumed energy.

As far as the fairness is concerned, we observe thatthe potential unfairness of our adaptive role switchingscheme is generally higher than the switching schemeusing fixed intervals, however considering multiplecontacts with different durations, this will balance out.

It is important to note that this real world exper-iment was intended to provide a proof on concept.It was performed twice on two Galaxy Nexus smart-phones, not enough to derive statistics. Many factorssuch as ambient temperature and battery health maylead to varying results, yet, we expect that qualita-tively similar conclusions can be derived. Finally, thevalues in Figure 10 are not entirely consistent with themeasured energy consumption values presented in Ta-ble 3. To be able to log the battery consumption theCPU could not be put to sleep mode. Yet, without thisCPU wake lock the switching overhead would be evenmore significant than Figure 10 might suggest.

VI. Conclusions and Future Work

Energy-efficient operation is a key prerequisite foruser acceptance of opportunistic device-to-device

communication. To this end, we analyzed and pre-sented extensive energy measurements for the statesand operations of major ad-hoc wireless communica-tion technologies available for recent mobile phones,i.e., Bluetooth, Wi-Fi Direct, and WLAN-Opp, ourapproach based on traditional wireless LAN.

For peer discovery, we found that Bluetooth con-sumes less than half the energy of WLAN-Opp, whichin turn consumes only half of Wi-Fi Direct. Further,we showed that each technology is potentially unfairas the different roles of the devices required to main-tain a connection, such as being a master versus beinga slave, show different energy consumption footprints.Using our concept of fair role switching based on esti-mating the remaining contact duration as a function ofthe elapsed contact duration, we could assure fair de-pletion of batteries while reducing the energy cost ofrole switching by up to 85% in long contacts in severalreal connection traces.

VII. Acknowledgements

We thank F. Legendre for his input. This work isfunded by ETH Zurich under Research Grant ETH-20 09-1, by the EU Commission under the SCAMPI(FP7-258414) FIRE Project, and by the FP7 MarieCurie IEF program (PIEF-GA-2010-276336 MOVE-R).

References

[1] Chaintreau A, Hui P et al. Pocket switched net-works: real-world mobility and its consequencesfor opportunistic forwarding. Tech. rep., Univer-sity of Cambridge Computer Laboratory, 2005.

[2] Lenders V, May M et al. Wireless ad hoc pod-casting. ACM SIGMOBILE MC2R, 2008.

[3] Guo S, Falaki MH et al. Very low-cost internetaccess using KioskNet. ACM SIGCOMM Com-put Commun Rev, 2007.

[4] Hossmann T, Carta P et al. Twitter in disastermode: security architecture. SWID. 2011.

[5] Han B, Hui P et al. Cellular traffic offloadingthrough opportunistic communications: a casestudy. CHANTS. 2010.

[6] Pietiläinen AK, Oliver E et al. Mobiclique: mid-dleware for mobile social networking. WOSN.2009.

Mobile Computing and Communications Review, Volume 18, Number 1, January 2014 35

[7] Wang W, Srinivasan V et al. Adaptive contactprobing mechanisms for delay tolerant applica-tions. MobiCom. 2007.

[8] Wang Y, Krishnamachari B et al. Markov-optimal sensing policy for user state estimationin mobile devices. IPSN. 2010.

[9] IEEE-SA. IEEE 802.11: Wireless LAN MediumAccess Control (MAC) and Physical Layer(PHY) specifications, 2007.

[10] Trifunovic S, Distl B et al. WiFi-Opp: ad-hoc-less opportunistic networking. CHANTS. 2011.

[11] Rachuri KK, Mascolo C et al. Sociablesense: ex-ploring the trade-offs of adaptive sampling andcomputation offloading for social sensing. Mo-biCom. 2011.

[12] Balasubramanian N, Balasubramanian A et al.Energy consumption in mobile phones: a mea-surement study and implications for network ap-plications. IMC. 2009.

[13] Carroll A and Heiser G. An analysis of powerconsumption in a smartphone. USENIX. 2010.

[14] Friedman R, Kogan A et al. On power andthroughput tradeoffs of WiFi and Bluetooth insmartphones. INFOCOM. 2011.

[15] Dong M and Zhong L. Self-constructivehigh-rate system energy modeling for battery-powered mobile systems. MobiSys. 2011.

[16] Monsoon Power Monitor. URL http://www.msoon.com/LabEquipment/PowerMonitor/.

[17] Camps-Mur D, Garcia-Saavedra A et al. De-vice to device communications with WiFi Direct:overview and experimentation. IEEE WirelessCommunications Magazine, 2013.

[18] Clauset A, Shalizi C et al. Power-law distribu-tions in empirical data. SIAM Review 51, 2009.

[19] Chaintreau A, Hui P et al. Impact of Human Mo-bility on Opportunistic Forwarding Algorithms.IEEE TMC, 2007.

[20] Lenders V, Wagner J et al. Measurements froman 802.11b mobile ad hoc network. IEEE EX-PONWIRELESS. 2006.

[21] Piorkowski M, Sarafijanovic N et al. A parsimo-nious model of mobile partitioned networks withclustering. IEEE COMSNETS. 2009.

36 Mobile Computing and Communications Review, Volume 18, Number 1, January 2014