{'fraction_non_alphanumeric': 0.043809234639658204, 'fraction_numerical': 0.009911297143724653, 'mean_word_length': 4.166965486329, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Energy Harvesting Communications Using Dual Alternating Batteries

Practical energy harvesting (EH) based communication systems typically use a battery to temporarily store the harvested energy prior to its use for communication. The batteries can be damaged when they are repeatedly charged (discharged) after being partially discharged (charged), overcharged or deeply discharged. This motivates the cycle constraint which says that a battery must be charged (discharged) only after it is sufficiently discharged (charged). We also assume Bernoulli energy arrivals, and a half-duplex constraint due to which the batteries are not charged and discharged simultaneously. In this context, we study EH communication systems with: (a) a single-battery with capacity 2B units and (b) dual-batteries, each having capacity of B units. The aim is to obtain the best possible long-term average throughputs and throughput regions in point-to-point (P2P) channels and multiple access channels (MAC), respectively. For the P2P channel, we obtain an analytical optimal solution in the single-battery case, and propose optimal and sub-optimal power allocation policies for the dual-battery case. We extend these policies to obtain achievable throughput regions in MACs by jointly allocating rates and powers. From numerical simulations, we find that the optimal throughput in the dual-battery case is significantly higher than that in the single-battery case, although the total storage capacity in both cases is 2B units. Further, in the proposed policies, the largest throughput region in the single-battery case is contained within that of the dual-battery case.


I. INTRODUCTION
Energy harvesting (EH) from natural and man-made sources has been envisioned as a viable technique for powering emerging low-power and energy starved communication systems, including Internet of Things (IoT) devices in fifth generation (5G) networks [1]. Consequently, EH communications has been widely studied in the last few years [2]- [5]. In most of the existing studies, the proposed power allocation policies may require batteries to undergo repeated partial charge and discharge cycles. In practice, such a charging and discharging pattern affects the usable capacity of batteries. For instance, the usable capacity of many Nickel based batteries [6] and some Li-ion [7] batteries reduces at a significant rate with the number of charge/discharge cycles, especially if the battery is partially charged/discharged. This phenomenon, referred to as the memory effect or voltage depression, can be avoided by imposing the so-called cycle constraint, i.e., by discharging (charging) the battery to a lower (an upper) limit before charging (discharging) it again [8]. The lower and upper limits prevent deep discharging and overcharging, respectively, which are known to damage batteries. Further, we also note that practical batteries cannot be charged and discharged simultaneously (half-duplex constraint). Hence, in this work, we consider the design of EH communication systems under (i) the cycle constraint, and (ii) the half-duplex constraint.
Our goal in the work is to obtain power policies that maximize the long-term average throughputs and throughput regions in single-battery and dual-battery cases in a P2P channel and a MAC under constraints (i) and (ii). We assume that the throughput is a concave function of the transmit power. Due to the above constraints, in the single-battery case, when the battery is being discharged (charged), energy harvesting (transmission) is suspended, and when the battery gets empty (full), charging (transmission) starts. Hence, if the energy from the battery is utilized aggressively, the duration of transmission will be short, implying that the time duration over which energy harvesting is suspended is short. However, due to the concavity, the time-averaged throughput in an aggressive policy could be less than that with a conservative policy with a slower energy utilization. Similarly, in the dual-battery case, when a battery is being charged, the transmitter draws power from the other battery and the roles of the batteries are switched when the charging battery becomes full and the other battery gets empty. In this case, an aggressive policy leads to a lower throughput, as the working battery may get drained long before the charging battery gets full. However, a conservative policy may result in energy overflow, as the battery being discharged may not be empty when the charging battery becomes full. Between these two extremes lies the optimal solution.
Despite receiving significant attention, the impact of charging and discharging dynamics on the usable capacity of batteries has been scarcely studied in the EH communications literature [2].
In a P2P channel, the authors in [9]- [11] consider the interplay between the battery charging and discharging policy and the irreversible degradation (aging) of its storage capacity. This irreversible degradation is different from the voltage depression which can be avoided by applying the cycle constraint. In [12], the authors indirectly control the battery degradation by constraining the number of charge and discharge cycles per unit time, without modeling the impact of the number of charge and discharge cycles on the battery capacity. In [13], a Bernoulli energy arrival model assumed, where, in a slot, either an energy packet with energy quantum equal to the capacity of the battery arrives, or no energy arrives. This implies, whenever a packet of energy arrives, the battery fills up completely. In this case, when a fresh energy packet arrives, the residual energy in the battery can be thought to be discarded instantaneously before replenishing it with the energy that arrived. Hence, [13] implicitly accounts for the cycle constraint since battery has unit capacity. In multi-user settings, as in [13], references [14] and [15] implicitly assume the cycle constraint and obtain near-optimal online power allocation policies with causal knowledge of harvested powers. Different from [13]- [15], we consider a more general case where multiple energy arrivals may be needed to fill the battery. In addition to the cycle constraint, assumed in [13]- [15], we also account for the practical half-duplex constraint in the current work and study a P2P channel and a MAC. For clarity, we first present the P2P channel and then extend the results to a MAC. The main contributions of the paper are: • In a P2P channel under the single-battery case, we obtain an analytical solution to the longterm average throughput maximization problem in the online case with casual knowledge of energy arrivals. We also show that the throughput maximizing policy performs better than a competitive greedy policy from [16].
• Further, for a P2P channel under the dual-battery case, we first obtain optimal power allocations via dynamic programing and then propose non-adaptive online policies, which do not exploit knowledge of current battery states, and adaptive policies, which adapt power allocations based on battery states when a new energy arrival occurs.
• For a U-user MAC, we then derive long-term average achievable throughput regions in the single-battery and dual-battery cases, based on the online policies proposed for the P2P channel.
• From numerical simulations, we show that the performance gap between the optimal policy for an ideal system equipped with infinite capacity batteries and the proposed non-adaptive policies with finite capacity batteries decays faster than the inverse of the square root of the battery capacity. Further, the largest throughput region in the single-battery case is contained within that of the dual-battery case.
In summary, our study finds that, under the cycle and half-duplex constraints, the optimal performance in the dual-battery case is significantly better than that in the single-battery case, although the total storage capacity in both cases is the same.
The remainder of the paper is organized as follows. The system model is presented in Section II. We study P2P channel under single-battery and dual-battery cases in Section III and Section IV, respectively. We then consider a MAC in Section V. Numerical results are presented in Section VI, followed by concluding remarks in Section VII.

II. SYSTEM MODEL
In this work, we consider a P2P channel and a MAC under two cases: (a) the single-battery case, in which the transmitters are equipped with a single battery having storage capacity of 2B units, and (b) the dual-battery case, in which the transmitters are equipped with two batteries, each having storage capacity of B units, as shown in Fig. 1a and Fig. 1b, respectively. In both the cases, the transmitters are powered from EH sources. Further, the receiver is connected to the mains, and hence the receiver can always remain ON. Now, based on our discussion in the introduction, we impose the half-duplex constraint, and the cycle constraint due to which the battery must be discharged (charged) to a lower limit, C min (an upper limit, C max ) before charging (discharging) it again, with C min < C max . In this work, without loss of generality, we assume C min = 0 for both the single-battery and dual-battery cases, and C max = 2B and C max = B for the single-battery and dual battery cases, respectively. The harvested energy is stored in a battery before using it for transmission. In the single-battery case, when the battery is being charged, no transmission is carried out. When transmission occurs, the energy harvesting is suspended, as batteries cannot be charged and discharged simultaneously. Hence, in Fig. 1a, when S 1 (S 2 ) is closed, S 2 (S 1 ) will be open. On the other hand, in the dual-battery case, when a battery is being charged from the EH source, the transmitter draws power from other battery.
Hence, at any point in time, the EH source and the transmitter will be connected to a 1 (a 2 ) and EH Source a battery, 2B b Transmitter S 1 S 2 (a) In the single-battery case, at any instant of time, either the EH source is connected to a or the transmitter is connected to b.
EH Source In the dual-battery case, at any instant of time, the EH source and the transmitter will be connected to a 1 (a 2 ) and b 2 (b 1 ), respectively. b 2 (b 1 ), respectively, as shown in Fig. 1b. In the sequel, we present the energy arrival model, evolution of battery states and the throughput model adopted in the work.

A. Energy Arrival Model
We consider a time-slotted system with unit slot length. Energy arrivals in each slot are independent and identically distributed (i.i.d.) Bernoulli random variables with parameter p, where E H units of energy is harvested per arrival, i.e., the amount of energy harvested in slot i, where w.p. stands for "with probability". The harvested energy arrives continuously at a constant rate in a slot such that the total energy accumulated at the end of the slot is E H units. We also assume B and E H are related as B/E H = r for some integer r ≥ 1 and note that the average EH rate, µ = pE H .

B. Evolution of Battery States
In the single-battery case, let B i be the amount of energy stored in the battery at the start of slot i. Then, in the charging phase, the time interval over which the battery is charged, we have, Further, assuming the transmit power in slot i is P i , in the discharging (transmission) phase, the time interval over which the battery is discharged for transmission, we have, where charging phase starts when B i = 0 and the transmission phase starts when B i = 2B.
Similarly, in the dual-battery case, let B w i and B c i denote the amount of energy stored in the working and the charging battery at the start of slot i, respectively. We assume B w 1 = B and B c 1 = 0. Then, the charging and working batteries evolve as follows.
The min and max in the above equations capture the facts that the battery energy cannot exceed its capacity or become negative, respectively.

C. Throughput and an Upper-Bound
The communication is over an additive white Gaussian noise (AWGN) channel with unit noise power. We assume the throughput with average received signal-to-noise ratio of P W in a slot is given by R = 1 2 log(1 + P ) bits-per-second (bps). All the logarithms are to the base 2. Now, the long-term average throughput is defined as follows.
T lim where the expectation is over all the possible sequences of energy arrivals. Our objective is to find the optimal power policy, P 1 , P 2 , . . ., that maximizes the long-term average throughput, T in (6). In order to benchmark the proposed power allocation policies, we now present an upper-bound on T .
When the cycle and half-duplex constraints are not present, and the nodes are equipped with infinite capacity batteries, it is optimal to utilize ǫ smaller amount of power per slot on average, compared to the average harvesting rate, where ǫ > 0 can be arbitrarily small. Further, by the concavity of the rate function, it is optimal to utilize an equal amount of energy µ = pE H = Bp/r in every slot, resulting in the long-term average throughput [17]- [19], The subscript 'ub' indicates that this performance is an upper bound on the performance with any other constraints.

III. P2P CHANNEL: SINGLE-BATTERY CASE
In this section, we consider a P2P channel under the single-battery case. We first formulate the long-term average throughput maximization problem in the online case and then obtain a closedform optimal online power allocation policy. We then note that the optimal online policy allocates transmit energy based on the average energy harvesting rate and compare the performance of the optimal online policy with a competitive greedy policy from [16], which allocates energy based on the instantaneous energy arrival rate in a slot.

A. Problem Formulation
Let the number of slots required to fill the battery be L. Note that L is a random variable. The number of energy arrivals required to fill the battery of capacity 2B units is 2r. Now, since interarrival times of energy is a sequence of geometrically distributed i.i.d random variables with mean 1/p, we have, E[L] = 2r/p = 2B/(pE H ). To obtain the optimal long-term average throughput, we assume that the initial energy stored in the battery is 2B units. We then discharge and charge the battery subject to the cycle constraint. Let P 1 , . . . , P N be the transmit powers over the first N slots such that N i=1 P i = 2B. That is, the entire energy in the battery is consumed in first N slots, where N is a variable to be designed. Starting from (N + 1) th slot, the battery is charged for L slots to fill it, over which no transmission occurs. Clearly, (N + L + 1) th slot is a renewal instant. The total reward and the length of the renewal period are R i = N i=1 1 2 log(1 + P i ) bps and (N + L) slots, respectively. Hence, by renewal-reward theorem [20], from (6), the long-term average throughput in the single-battery case is equal to, where the N in the denominator accounts for the penalty due to not storing energy while transmitting. Now, to maximize the long-term average throughput, we need to solve the following optimization problem. maximize N,P 1 ,...,P N T SB (N, P 1 , . . . , P N ), We now solve (9) in the following under the online case.

B. Optimal Online Solution
We first note that, for any N, due to concavity of the logarithmic function, the numerator is maximized when the transmit powers in all the slots are the same, i.e., when P = P 1 = P 2 = . . . = P N , where P 2B/N. Hence, (9) can be reformulated as the following problem.
Note that (10) is an integer program. To solve it, we first allow N to take any positive real values and solve it. We then optimally round the solution to satisfy the integer constraint of the original problem.

1) Relaxation:
In the relaxed problem, we denote the transmit power and number of transmission slots byP andÑ , respectively. Hence, we have,Ñ = 2B/P and the objective function in (10) becomes µ log(1 +P )/(2(µ +P )), where the average EH rate, µ = pE H under the assumption that r ≥ 1, i.e., B ≥ E H . Therefore, the optimal transmit power can be obtained by solving, We present the optimal solution to (11) in the following lemma.
The optimal solution to (11) is given bỹ and the optimal long-term average throughput is given bỹ where W 0 (·) is the principal branch of the Lambert W function.
Proof. See Appendix A.
2) Rounding: From Lemma 1, clearly,Ñ * = 2B/P * . Noting thatÑ * may not be an integer, we now obtain the optimal solution to (10), with the integer constraint on N. We note that the objective function in (10) is unimodal as it is an increasing function over N ∈ [0,Ñ * ) and a decreasing function over N ∈ [Ñ * , ∞). Hence, we choose the optimal N * that satisfies the integer constraint as follows: where ⌊x⌋ is the greatest integer smaller than x and ⌈x⌉ is the smallest integer greater than x.
Hence, the maximum long-term average throughput is given by where N * is given by (14).
From Lemma 1, which gives the optimal solution to the relaxed long-term average throughput maximization problem when B ≥ E H , we note that the optimal power and throughput depend only on µ, i.e., for any B such that B ≥ E H , the optimal power and throughput remain the same. In other words, the performance with an infinite capacity battery can be obtained by using a single battery with capacity of 2B = 2E H units, in the relaxed case. Further, in the presence of integer constraints, from (14) and (15), we note that the optimal performance depends both on the mean value of the harvested energy and the battery capacity. This implies that burstiness of the energy arrivals does not impact the optimal performance.
We now compare the above policy with a competitive greedy policy in the following.

C. Comparison with the Competitive Greedy Policy Studied in [16]
The authors in [16] consider a slotted system with unit slot length. Further, they impose only the half-duplex constraint, and not the cycle constraint. In a slot, the harvested energy is stored for (1 − τ ) seconds and the transmission occurs over the remaining τ seconds. The long-term average throughput maximization problem considered in [16] is given by where E H is the total harvested energy in a slot. The transmit power is given by We now give the optimal solution to (16) in the following lemma.

Lemma 2. The optimal transmit power for the optimization problem in (16) is given by
the optimal transmit duration τ * = E H /(P * + E H ), and the maximum long-term average throughput, Proof. The result follows from [16], with appropriate mapping of variables followed by simplification along the lines in the proof of Lemma 1.
From the above lemma, we note the optimal performance in the greedy policy depends on both p and E H , unlike in the earlier case where the optimal performance depended only on µ, under the assumption that B ≥ E H . Noting that the denominator in (18) is an increasing function of E H , for a given µ = pE H , T greedy decreases as E H increases and p decreases.
In the following proposition, we compare the long-term average throughputs in the optimal online policy and the greedy policy. Since τ can take real values, it is meaningful to compare T greedy withT SB in (13).
Proposition 3. T greedy <T SB , for any p < 1 and E H > 0.
Proof. By definition, note that E H > µ for any p < 1 and result follows by noting that exp(·) is a strictly increasing function.
From Proposition 3, we see that the optimal online policy in Lemma 1 outperforms the competitive greedy policy in Lemma 2. We note that both the above polices can be implemented easily in practical systems.
We conclude the section by noting that the main disadvantage of the single-battery case is that energy harvesting is suspended during transmissions. This can be avoided by using an additional battery which charges up while the working battery is being discharged. Hence, in the following section, we study the two-battery case.

IV. P2P CHANNEL: DUAL-BATTERY CASE
We now consider the P2P channel under the dual-battery case. In the sequel, we formulate the long-term average throughput maximization problem, and derive the optimal solution in the online case. We then propose non-adaptive online policies, which do not need knowledge of the current state of the batteries, based on which we propose policies that adapt the power allocation based on battery state when each new energy arrival occurs.

A. Problem Formulation
Due to the cycle constraint, which says that the working (charging) battery must be discharged (charged) completely before switching the roles of the batteries, the switching instants are renewal instants of the battery state processes. Let L k denote the length (in slots) of the k th renewal period.
Let the number of slots required for the charging battery to accumulate B units of energy in the k th renewal period be C k , which is less than or equal to L k by our design. Since the system is reset after a renewal instant and because the energy arrivals and allocations are independent across renewal intervals, L 1 , L 2 , . . . form a sequence of i.i.d. random variables. The k th renewal occurs in the S th k slot, where, where we define S 1 1. Further, due to the constraint described above, we must have, Now, to maximize the long-term average throughput defined in (6), we need to solve the following optimization problem.
subject to (20), where the constraint S i −1 k=S i−1 P k ≤ B is because the maximum total amount of energy that can be consumed in a renewal period is B.
Before we proceed to obtain the optimal solutions under various cases, we note the following.
Firstly, by renewal-reward theorem [20], from (6), the long-term average throughput is equal to, where L is the length of the renewal period, whose distribution is identical to L 1 , L 2 , . . .. The expectation is with respect to the random variable L. Secondly, the random variable C, which is the number of slots required to accumulate B units of energy, has the negative binomial distribution given by, for n ∈ {r, r + 1, . . .} and E(C) = r/p. Further, the cumulative density function (CDF) is given

B. Optimal Offline Policy
In the offline policy, we assume the number of slots required to completely charge the battery is known at the start of the current renewal instant, i.e., the realization of C k+1 is known at start of slot S k for k ∈ {1, 2, . . .}. Due to the concavity of 1 2 log(1 + P ) in P , it is optimal to transmit with a constant power over the C k+1 slots. Hence, when C k+1 is known, we can discharge the working battery such that it gets emptied in the same slot in which the charging battery fills up. Hence, we have L k+1 = C k+1 and we transmit at the constant power of B/L k+1 in the k th renewal. Hence, from (22) and (23), the optimal long-term average throughput is given by It is easy to numerically compute the value of T off .

C. Optimal Online Policy
We now consider the online case with only causal knowledge of renewal instants. Since the precise time when the charging battery will get full is unknown, power is allocated based only on the distribution of energy arrivals. To obtain the optimal online policy, we adopt a dynamic programming framework. We now define the relevant quantities.
Thus, when α = 1 (α = 0), the second battery is the charging (working) battery. The state space, 2) Action space and reward: The action space the system can take in state The constraint on P in (27) is due to the fact that P units are drawn from the working battery.
We recall that the reward when the system takes action P ∈ A(s) in state s ∈ S is given by is given by α ′ = α, w.p. 1, and, where we have accounted for the fact that, in a slot, the event that the transmitter harvests and stores E H units of energy in the charging battery occurs with probability p. Further, the next state s ′ = (b ′ 1 , b ′ 2 , α ′ ) ∈ S when the system takes action where we have accounted for the constraint that the role of the batteries must be switched when the working battery becomes empty and the charging battery becomes full. Finally, when the system takes action it transitions to the next state s ′ = ((1 − α)B, αB, 1 − α) with probability 1. From (28) and (29), we can easily construct the probability transition matrix, q(s ′ |P, s) for all s ∈ S and P ∈ A(s).

4) Optimal value function:
We consider K slots for the optimization. We obtain the optimal value function V k (s) in slot k ∈ {1, . . . , K} and state s ∈ S by solving the following Bellman equation.
The optimal online throughput is then given by We note that the optimal online throughput, T on , can also be obtained by solving the Bellman equation in the infinite horizon case with the discount factor arbitrarily close to one. Since the reward is bounded and the state space is finite, there exists an optimal stationary deterministic policy for (30), i.e., there exists a unique optimal action P * (s) in state s independent of slot indices [21]. Hence, it suffices to search only in the set of all stationary deterministic policies.

D. Non-Adaptive (NA) Online Policies
We note that the above optimal online policy, obtained via dynamic programming, adapts the transmit power in every slot based on the state of the batteries. In the non-adaptive policies, we assume the states of batteries are not estimated in every slot. However, we assume that a flag is raised when the charging battery becomes full or working battery becomes empty. Further, the energy remaining in the working battery is discarded once the charging battery accumulates B units of energy. On the other hand, if the working battery gets completely discharged before the charging battery is full, the transmitter waits without transmission till the charging battery gets full. This implies that the renewal instant is the same as the instant when the charging battery accumulates B units of energy. Hence, the renewal length, L is distributed identically as C in (23). With this setting, we obtain optimal and suboptimal power allocations in the following.
where we recallF i−1 (r, p) = ∞ n=i q n . From (21), (22) and (32), to maximize the long-term average throughput in the online case, we need to solve the following optimization problem.
Clearly, (33) is a convex optimization problem. Hence, the Karush-Kuhn-Tucker (KKT) conditions are necessary and sufficient for optimality. Based on the KKT conditions, we obtain the optimal power allocations in the following theorem.
For k = 1, 2, . . ., the optimal transmit power P * S k +i−1 is given by P The corresponding throughput under the optimal non-adaptive policy can be obtained by substituting (35) in (32) as Proof. See Appendix B.
We note the probability that the charging battery fills up in less than r slots after a renewal is zero. Hence, given a fixed amount of energy that can be consumed in the first r slots, it is intuitive that we must consume it at the constant rate in the first r slots after a renewal, as suggested by (35). We also note that under the policyP ONA , the working battery becomes fully discharged exactly after N slots. It strikes the optimal balance between discharging too early (i.e., the transmitter will remain idle till the charging battery gets full) and discharging too late (i.e., there is wastage of energy as the remaining energy in the working battery is discarded).
Since we are discarding the remaining energy in the working battery in case the charging battery becomes full before N slots and remain idle in case the charging battery takes more than N slots to become full, the optimal solution in Theorem 4 is a suboptimal online policy and clearly, we have, T ONA ≤ T ub .
2) Suboptimal Non-Adaptive (SNA) Online Policy: Based on the above ONA policy, we now propose a suboptimal policy, referred to as the Suboptimal Non-Adaptive (SNA) policy. Our motivations for proposing the SNA policy are it is simpler than the previous policies, and analytically tractable in the sense that we can use it to lower-bound the optimal long-term average throughput in the dual-battery case.
In the SNA policy, the power allocation in the i th slot after a renewal instant is given bỹ We discard the energy remaining in the working battery when the charging battery becomes full.
Hence, the power allocation policy in (37) does not violate the energy causality constraint. Let T SNA denote the long-term average throughput obtained in this strategy. We now have the following result.
Theorem 5. The long-term average throughputs in the ONA and SNA policies are bounded as, where G(r) max p − p 2r ∞ i=1 ( ∞ n=i q n ) log ( ∞ n=i q n ) and q n = n−1 n−r p r (1 − p) n−r .
Proof. See Appendix C.
We make the following remarks on the above theorem.  for j = 0 to r − 1 do ⊲ based on optimal non-adaptive policy in (35).

E. Adaptive Online Policies
Here, we assume the state of the charging and working batteries, denoted by B c and B w , respectively, are known at the start of every slot. In this policy, we adapt the power allocations based on B c and B w . Recall that, by assumption, it takes r energy arrivals to fill the charging battery, starting from the empty state. Now, until the current slot, suppose that j energy arrivals have occurred since the last renewal instant, i.e., B c = jE H . Then, we need r − j more energy arrivals to fill the battery. Let C r−j be the random number of slots required for r − j energy arrivals. Then, the complementary CDF of C r−j is given byF i (r − j, p), i ∈ {1, 2, . . .}, where we recallF i (r, p) = ∞ n=i+1 q n . Now, in the adaptive policy, we target to allocate B w units of energy in the working battery based on the distribution of C r−j , along the lines in the nonadaptive policies proposed earlier. Concretely, the power allocation to i th slot after j th energy arrival in a renewal window is given byP ONA i (B w , r − j, p), whereP ONA i (·) is defined in (35).
We refer to this policy as the Optimal-Adaptive (OA) policy. Similarly, we can obtain the policy, which we refer to as the Suboptimal-Adaptive (SA) policy, by allocatingP SNA i (B w , r−j, p) units of energy to i th slot after j th energy arrival in a renewal window, whereP SNA i (·) is defined in (37).
We summarize the power allocations in these adaptive policies in Algorithm 1. In the algorithm, i j represents the index of j th energy arrival in a renewal window. Further, we represent the longterm average throughputs obtained by OA and SA policies by T OA and T SA , respectively. Since the non-adaptive policies are special cases of adaptive policies, clearly, the optimal performance of the adaptive policies are at least as well as that of the non-adaptive policies. Hence, we have T OA ≥ T ONA and T SA ≥ T SNA .

F. Constant-Power (CP) Policy
In the CP policy, the transmit power remains constant whenever transmission occurs. Our motivations for proposing this policy are the following. First, practical implementation of such a policy is simple as it does not require the knowledge of battery states. Further, prior knowledge of the optimal transmit power can enable system designers to choose appropriate system components such as power amplifiers such that optimal transmit power is in their linear operating region.
Finally, several variants of this policy, considered in [13] and references therein, are shown to perform competitively with optimal policies. Specifically, the version proposed in [18] has been shown to approach T ub asymptotically with B. Hence, this policy is also useful in benchmarking the policies studied above.
In the CP policy, we consume the energy available in the battery at a constant rate of B/(⌊rp −1 ⌋) as long as the battery is not empty, i.e., the power allocation in the i th slot after a renewal instant is given byP We discard the remaining energy in the working battery when the charging battery becomes full.
We denote the long-term average throughput of the policy by T const .

V. MAC: SINGLE-BATTERY AND DUAL-BATTERY CASES
We now consider a U-user MAC where the users communicate to a common receiver over an AWGN channel with unit noise power. Let U {1, . . . , U} represent the set of user indices.
In the single-battery and dual-battery cases, we assume the user u ∈ U is equipped with a single-battery of capacity 2B u units and with two identical batteries, each of capacity B u units, respectively. Each user applies the half-duplex constraint and the cycle constraint described in Section II. Let E u be the energy arrival process in user u. We assume the energy arrivals are i.i.d. over time and that the amount of energy harvested in slot i in user u is, We assume that B u /E Hu = r u for some r u ∈ {1, 2, . . .} and we note the average EH rate, µ u = p u E Hu at user u ∈ U. The battery evolution at each user is similar to that in the P2P channel case, described in Section II-B. Let the transmit power in user u in slot i be denoted by P ui . Then, from [14], the maximum average throughput region, averaged over all the sample paths of energy arrivals is given by Our goal is to maximize the long-term average throughput region defined as T = lim K→∞ T K .
We now present an outer bound to T in the following. When the cycle and half-duplex constraints are not present, and the capacities of the batteries are infinite, the largest throughput region for the Gaussian MAC is given by [14], where µ u is the mean energy arrival rate in user u ∈ U.
In the sequel, we propose achievable strategies in the single-battery and the dual-battery cases, based on the P2P channel studied in previous sections.

A. Single-Battery Case
In the single-battery case, for simplicity, we only consider the relaxed problem, where we allow the number of slots over which transmission occurs to take a positive real value. As in the P2P channel under the single-battery case studied in Section III, we assume that transmission occurs with a constant power at each user. Let (R u , P u ) be transmit rate and power pairs at user u ∈ U. From (11), the long-term average throughput in user u is given by Initialize {(R u , P u ), u ∈ U} to a feasible value.
We now note that each boundary point on the largest achievable throughput region is the optimal solution to max {T 1 ,...,T U }∈T U u=1 λ u T u for some (λ 1 , . . . , λ U ), where λ u ≥ 0, u ∈ U and U u=1 λ u = 1. Hence, we obtain all the boundary points on the largest achievable throughput region in this policy by solving the following problem for different instances of (λ 1 , . . . , λ U ).
Note that the above optimization problem is non-convex as (44a) is a sum of ratios. In the sequel, we transform the above problem into an equivalent convex optimization problem by applying the quadratic transform, recently developed in [22], briefly described below. Consider a concave A(x) and a convex B(x). Then, [22] shows that following optimization problems are equivalent.
We note that the optimization problem in the left-hand side is non-convex and that in the righthand side is convex. Now, applying the quadratic transform to (44), we obtain the following equivalent convex optimization problem. maximize subject to The above problem can be solved by an alternate maximization over {y u , u ∈ U} and {(R u , P u ), u ∈ U}, as shown in Algorithm 2.
Step 1 in Algorithm 2 is because, for a fixed {(R u , P u ), u ∈ U}, the optimal y * u in (46) is given by √ λ u µ u R u /(µ u + P u ). Further, the convergence of the above alternate maximization to the global optimum follows from Theorem 3 in [22].

B. Dual-Battery Case
We now consider the dual-battery case and present the following result on the inner region.
To obtain the inner region, we assume each user adopts the SNA policy in (37) individually.
Proposition 6. The long-term average throughput region, T is bounded by T inner DB ⊆ T , where, Proof. The result can be obtained by extending Theorem 5 along the lines in the proof of Theorem 1 in [14].
We now propose an achievable scheme based on the proposed ONA policy in the P2P channel case. Let R ui and P ui be the transmit rate and power in slot i of user u. Then, from (32), we recall that the long-term average throughput in user u is given by Hence, along the lines in the previous subsection, we obtain all the boundary points on the largest achievable throughput region by solving the following convex optimization problem for different instances of (λ 1 , . . . , λ U ) with U u=1 λ u = 1.
for all u ∈ U and i ∈ {1, 2, . . .}. The above problem is a convex, and hence, it can be solved efficiently using standard numerical techniques. In this policy, we note that user u transmits with power P ui and rate R ui in slot i after a renewal, independent of rates and transmit powers in other users.

VI. NUMERICAL RESULTS
In this section, we first compare the long-term average throughputs obtained in the P2P channel under single-battery and dual-battery cases. We then obtain long-term average throughput regions  in a MAC using the schemes presented in the previous section. The parameters used for our simulations are in the similar range as in [13], [15], [23].

A. Long-Term Average Throughput in a P2P Channel
In Fig. 3, we plot variation of the long-term average throughput with the battery capacity in various policies. We note that as the battery capacity increases, the performance gap between offline and online policies decreases. Further, the average throughput achieved by the ONA policy approaches the upper bound, T ub , much faster than the SNA policy, as the battery capacity B increases. We also note the long-term average throughput in the single battery case, T SB does not depend on the battery capacity. This is because, as seen in (13), the maximum long-term average throughput for the relaxed problem in (11) depends only on the average harvested power; rounding the solution introduces a negligible change in the throughput of the relaxed problem.
In Fig. 4, we plot variation of the long-term average throughput with the amount of energy harvested per arrival, E H , for B = E H (see Fig. 4a) and B = 3E H (see Fig. 4b). When B = E H , a single energy arrival completely fills up the battery. In this scenario, the system model of the current paper in the dual-battery case is identical to that in [13], and Fig. 4a is similar to Fig. 4 of [13], where ONA and SNA policies of the current paper correspond to the optimal policy and the Constant-Fraction policy of [13], respectively. In this case, the long-term average throughputs in ONA and SNA policies are at most 0.72 bits away from the upper-bound, as pointed out in the remarks on Theorem 4. In Fig. 4b, we set B = 3E H . For a given E H , note that the mean value of the harvested energy, µ = pE H , is the same in both the figures. Hence, the upper-bound remains   B ≥ E H . We also note that the performance gap of the single-battery case from the upper-bound diverges as E H increases.
In Fig. 5, we plot variation of the long-term average throughput with p, for a fixed mean harvesting rate of µ = 1, for B = 2E H (see Fig. 5a) and B = 4E H (see Fig. 5b). For the same parameters, we also present the average idle time, the fraction of the slot length over which the transmit power is zero, in Table I, and we plot the variation of the average amount of energy discarded per slot, E discarded , with p in Fig. 6. Note that the lower the value of p, the higher is the amount of energy harvested per arrival, i.e., the energy arrival becomes more bursty as p is decreased keeping µ fixed. We make the following key observations from Fig. 5, Table I and Fig. 6. Firstly, the long-term average throughputs in all the policies are significantly lower than the upper-bound when p is small and they approach the upper-bound as p is increased. This is   because, as seen from Table I,  Due to the concavity of the throughput, this leads to a degradation in the throughput. Further, as seen from Fig. 6, the average amount of energy discarded when p is small is more than that when p is larger. This also reduces the achievable throughput. For the higher values of p, the harvested energy arrives more uniformly and the power allocation can be nearly constant, and the average idle time and the average amount of energy discarded decrease. Hence, the performance improves as the p is increased. Secondly, when the battery capacity, B, is increased from 2E H to 4E H , the performance improves. This is because, average idle time and the average amount of energy discarded when B = 4E H are significantly lower than that when B = 2E H , as seen from Table I and Fig. 6, respectively. Finally, we note that some policies are more robust to burstiness than others. Specifically, performance of the OA and SA policies are better than that of ONA and SNA policies for all values of p. Moreover, the variation of OA and SA policies with p is less than that of the ONA and SA policies. Further, the CP policy is more robust than the SNA policy for the chosen values. As expected, the long-term average throughput in the single-battery case does not vary with p, as µ is kept fixed.

B. Long-Term Average Throughput Regions in a MAC
In Fig. 7, we present long-term average throughput regions in a two-user MAC under singlebattery and dual-battery cases for symmetric (Fig. 7a) and asymmetric (Fig. 7b) settings. In both the settings, the battery capacity and the mean value of the harvested energy remain the same with B 1 = B 2 = 100 units and µ 1 = µ 2 = 25. Further, in the symmetric case, the distribution of the energy arrivals is the same in both the users. However, in the asymmetric case, the energy arrivals are more bursty in user 2. We assume r 1 = r 2 = 2 and r 1 = 2, r 2 = 1 in the symmetric and asymmetric cases, respectively. Hence, we have, min ru (G(r u )) = 0.51 and min ru (G(r u )) = 0.72 in the symmetric and asymmetric cases, respectively.
In both the figures, as expected, we note that the largest average throughput region in the twobattery case is significantly larger than that in the single-battery case. Moreover, we note that the maximum sum-throughput occurs in the single-battery case at (0.33, 0.33) in both symmetric and asymmetric cases. However, in the two-battery case, the maximum sum throughput occurs at (0.52, 0.52) and (0.69, 0.29) in the symmetric and asymmetric cases, respectively. Since both     users have the same individual throughputs at the maximum sum-throughput point in the singlebattery case, it is more fair than the two-battery case wherein the individual data throughputs are significantly different at its maximum sum-throughput point. This is because, the optimal power allocation in the single-battery case depends only on the mean harvested energy values in both users, unlike in the dual-battery case, wherein the optimal power allocations depend on the distributions of the harvested energy in both users.
In Fig. 8, we study variation of long-term average sum-throughput, the sum of long-term average throughputs at each user, with the number of users, U, when the parameters at all the users are identical with p = 0.2 and E H = 10 (see Fig. 8a) and p = 0.8 and E H = 2.5 (see Fig.   8b). From the figures, we note that the sum-throughputs are concave function of the number of users, as in the case of ideal MAC. Moreover, the performance trends are similar to those in the P2P channel. Specifically, as the capacity of the battery, B, and p are increased for a fixed average energy harvesting rate, µ, the performance increases in the dual-battery case, but it remains unchanged in the single-battery case.

VII. CONCLUSIONS
In this work, we optimized the long-term average throughputs and throughput regions in a P2P and multiple-access communication systems under the single-battery and dual-battery cases.
In order to avoid capacity degradation of the batteries, we applied the cycle constraint, which   says that a battery must be charged (discharged) only after it is fully discharged (charged). We also applied the half-duplex constraint for the charging and discharging processes. We obtained a closed form expression for the optimal power allocation policy in the P2P channel for the single-battery case. For the dual-battery case, we first obtained optimal online policy via dynamic programming, followed by non-adaptive and adaptive policies, which do not adapt and adapt power allocations based on battery states, respectively. We then obtained throughput regions in a MAC based on the policies proposed for the P2P channel case. We numerically found that the gap between the performance of our suboptimal non-adaptive policy and the unconstrained optimal performance decreases with the battery capacity faster than the inverse of the square root of the battery capacity, in the dual-battery case. Further, the optimal throughput in the dualbattery case is significantly higher than that in the single-battery case. We also noted that the largest throughput region of the proposed multiple access policy in the single-battery case is contained within that of the dual-battery case.

A. Proof of Theorem 1
Obtaining the first order differential of the objective function in (11) and equating it to zero, the optimalP must satisfy, µ +P − (1 +P ) log(1 +P ) = 0.

B. Proof of Theorem 4
The Lagrangian of (33) is given by where λ, µ i ≥ 0 are Lagrange multipliers. Differentiating L with respect toP i , we have the following stationarity condition.
Solving for the optimal λ: Due to the total energy constraint, we have, where N is the last slot whereP i > 0. From (52) and the expression for λ * , we find that N is the largest n that satisfies n i=1F i−1 (r, p) ≤ (B + n)F n (r, p).
Hence, from (52) The transmit power in the rest of the slots is zero. Further, noting thatF i−1 (r, p) = 1 for i = 1, . . . , r, we obtain (35). We note that due to (53), the sum of the transmit powers in (55) never exceeds the battery capacity.

C. Proof of Theorem 5
We now prove the theorem along the lines in Proposition 3 of [13].