Energy Harvesting Maximization for Reconfigurable Intelligent Surfaces Using Amplitude Measurements

Energy harvesting can enable a reconfigurable intelligent surface (RIS) to self-sustain its operations without relying on external power sources. In this paper, we consider the problem of energy harvesting for RISs in the absence of coordination with the ambient RF source. We propose a series of sequential phase-alignment algorithms that maximize the received power based on only power measurements. We prove the convergence of the proposed algorithm to the optimal value for the noiseless scenario. However, for the noisy scenario, we propose a linear least squares estimator. We prove that within the class of linear estimators, the optimal set of measurement phases are equally-spaced phases. To evaluate the performance of the proposed method, we introduce a random phase update algorithm as a benchmark. Our simulation results show that the proposed algorithms outperform the random phase update method in terms of achieved power after convergence while requiring fewer measurements per phase update. Using simulations, we show that in a noiseless scenario with a discrete set of possible phase shifts for the RIS elements, the proposed method is sub-optimal, achieving a higher value than the random algorithm but not exactly the maximum feasible value that we obtained by exhaustive search.


I. INTRODUCTION
F UTURE wireless networks should provide seamless con- nectivity for the rapidly growing number of devices and services [2]- [4].If wireless networks are implemented in the same manner as before, the energy consumption would keep increasing dramatically with the traffic volume.From both carbon footprint and energy consumption perspectives, it is a necessity to develop energy-saving techniques that can be implemented in the network nodes, including low-power and zero-energy devices [5]- [7].
Traditional wireless networks have no control of the radio propagation environment.Providing connectivity for regions with low signal-to-noise ratio (SNR) comes at the cost of deploying more sophisticated transmission schemes, more radio resources such as antennas and spectrum and consequently consuming more energy [8], [9].
With the emergence of the reconfigurable intelligent surfaces (RISs), several limiting factors associated with the propagation environment can be eliminated.A RIS can manipulate the propagation environment to increase the signal strength in the desired direction and guide the electromagnetic (EM) waves toward the receiver via engineered reflections [10]- [13].The RIS is primarily envisioned for providing coverage for regions that are blocked by objects [9].
For instance, a RIS can be deployed in a city with dense buildings and poor line-of-sight (LoS) conditions, or it can also be deployed in homes, where the walls obstruct the signal path.
We can also see the concept of RIS as an alternative to traditional relays, which have similar use cases.RISs offer some unique advantages that make them a promising technology for the future of wireless communication systems.RISs can be better than traditional relays in terms of energy efficiency, as they do not require power-hungry amplifiers and can use lowpower hardware components.Moreover, RISs do not introduce significant latency into the communication system, making them well-suited for applications such as augmented reality and the Internet of things (IoT).Last but not least, RISs can be integrated into existing wireless communication systems with minimal changes, making them a cost-effective solution for improving the performance of existing networks. 1These advantages make RISs a promising technology for improving the performance of wireless communication systems [14], [15].However, RISs come with their own set of challenges, such as limited bandwidth, the risk of generating interference to some users, cumbersome configuration, and a higher cost of deployment and maintenance.Ultimately, the choice between traditional relays and RISs depends on a careful weighing of these factors and an understanding of the specific needs and goals of each situation.
In the presence of a wired power supply, RIS may not have clear benefits compared to relays and small base stations (BSs), and the respective advantages are debatable [16].However, if the RIS is self-sustainable, it opens up new deployment possibilities where there is no competition.This is where energy harvesting (EH) comes into play.By harvesting energy from radio frequency (RF) signals that are already present in the environment, the RIS can operate without relying on external power sources [17]- [19].This is particularly beneficial in situations where the RIS is deployed in remote or inaccessible locations where it can be difficult or expensive to provide a continuous power source.In [15], the authors developed a model for the RIS power consumption that is based on the number of elements and their phase resolution capability.Higher phase resolution in the RIS increases the complexity and the power consumption [20].
There are other related works.The study [21] considers a hybrid-relaying scheme empowered by a self-sustainable RIS to simultaneously improve the downlink energy transmission and uplink information transmission.The authors proposed time-switching and power-splitting schemes for RIS operation.The paper [22] proposes a novel framework for wireless power transfer (WPT) system using a RIS to improve power transfer efficiency.The proposed framework employs independent beamforming to replace conventional joint beamforming, which results in higher efficiency.In [23], a RIS-aided simultaneous terahertz information and power transfer is proposed to maximize the sum data rate of the information users while ensuring that the power harvesting requirements of energy users and the RIS are met.
In [24], the authors propose a multi-functional RIS (MF-RIS) that utilizes RF energy to support reflection and amplification of incident signals.The MF-RIS mitigates doublefading attenuation experienced by passive RISs [25].The study [26] considers an RIS-assisted simultaneous wireless information and power transfer (SWIPT) scheme that integrates the RIS with non-coherent differential chaos shift keying to compensate for energy loss.The authors analyze the bit error rate (BER) and energy shortage probability of the scheme over the multipath Rayleigh fading channel.Finally, in [27], the authors consider a RIS-assisted data transmission from a multiantenna access point (AP) to a receiver.The system operation is cyclic, and in each cycle, there are two operational phases: 1) the RIS array harvests energy from the transmitter.2) In return, RIS assists the AP to transmit its data to the receiver.
The state-of-the-art techniques consider perfect channel state information (CSI) at the RIS, which is obtained by coordination between the transmitters and the RIS.The existing solutions require extra hardware (i.e., multiple RF receivers to measure both amplitude and phase to obtain CSI) and signaling, which in turn increases the energy consumption and cost of the RIS.
We consider a different scenario, where the RIS must configure itself without any RF receivers.The proposed method makes power measurements in the EH units and uses them to maximize the harvesting power iteratively.
Our preliminary results in [1] present an amplitude-based sequential optimization of energy harvesting with RISs for the noiseless scenario using continuous phase control.In this paper, we analyze the impact of noise on the phase alignment algorithm and present a linear phase estimator that can be embedded in our proposed sequential phase alignment algorithm.We derive the optimal set of measurement phases within the class of linear estimators.Also, we formulate the problem for a discrete phase control scheme in a noiseless scenario.The main contributions of this paper, as compared to the previous works, are as follows: • We propose a series of sequential phase-alignment algorithms to maximize the received power at the harvesting unit based on power measurements, in different situations.• We prove the optimality of the proposed algorithm analytically for the noiseless scenario with continuous phase control.
• We formulate the corresponding problem for a noiseless scenario with discrete phase control and propose a heuristic sequential phase alignment algorithm inspired by the continuous phase control algorithm.• We extend the result to noisy scenarios and propose a simple linear estimator, that can be embedded in our proposed sequential phase alignment algorithm.We optimize the phase measurement configurations for the proposed linear estimator, and we prove that equally spaced phases are optimal.• Our simulation results show that the proposed algorithm greatly outperforms the benchmark random phase-update method in terms of the number of required measurements to achieve the optimum.The remainder of this paper is organized as follows.Section II describes the RIS hardware architecture, two different EH schemes in the RIS, and the phase alignment problem.Section III presents the proposed phase estimators for the received power maximization by tuning the phase of a RIS element.Section IV describes the proposed abstract model of the RIS operation and the proposed solution for continuous and discrete phase control scenarios.Simulation results are presented in Section V, while Section VI provides our conclusions.
Notations: We denote sets by upper-case script letters, e.g., S, or upper-case Greek letters, e.g., Ω.The only exceptions are the sets of natural numbers, real numbers, and complex numbers that we represent with N, R, and C, respectively.The cardinality of a set S is represented by |S|.Vectors are indicated by lower-case bold-face letters, e.g., x, and x i denotes the ith element of x.We represent matrices by upper-case bold-face letters, e.g., A, and [A] m,n indicates the element of A with row number m and column number n.The identity matrix of size n is denoted by I n .The expectation and covariance operators are represented by E(•) and Cov(•), respectively.Also, E X (•) denotes the expectation operation with respect to the random variable X.We represent random variables with upright upper-case letters, e.g., X, and we denote random vectors with upright upper-case bold-face letters, e.g., X.Also, we use p X (x) to indicate the probability density function (PDF) of a continuous random variable X at x.We use 1 to represent the all-one vector.The curled inequality indicates componentwise inequality between vectors.We also use = ∆ to indicate an equal by definition sign.With tr(•) and (•) T , we denote the trace and transpose operators.The operator diag(x) returns a square diagonal matrix with the elements of vector x on the main diagonal.We denote the imaginary unit by j = ∆ √ −1.We represent the conjugate of a complex number z with z * .However, we denote the optimal solution with the superscript ⋆, e.g., x ⋆ .Also, the operation Arg (z) returns the principal value of the argument of z that lies within the interval (−π, π], while arg (z) returns the set of all possible values of the argument of z.

II. PROBLEM DESCRIPTION
This section presents 1) the RIS device architecture, 2) the EH schemes, and 3) the phase alignment problem for RIS-

A. RIS Hardware Architecture
Fig. 1 illustrates the hardware architecture of a typical RIS.The front layer consists of several metal elements that are printed on a dielectric substrate and arranged in a twodimensional array to reflect the incoming signals.The size of the elements is typically smaller than the wavelength of the signal of interest [28]- [30].For each patch element, there is a controllable circuit that is used to adjust the phase of the reflected signals and direct the signal in the desired direction.
There is a copper layer behind the dielectric substrate to reduce the RF waves leakage from the back [31], [32].There is a control circuit board that can control the reflection amplitudes and phase shifts of the patch elements.The RIS controller can communicate with the network components such as BSs via a connectivity interface to receive the reflection state configuration [9], [33], [34].Finally, the RIS requires a power supply to adjust the phases and then maintain the desired reflection state.

B. Energy Harvesting Schemes
In general, an RIS can harvest RF energy directly or indirectly from an ambient RF source.We will describe these scenarios below and later show that they lead to system models of the same kind.
1) Direct EH: The RIS elements are capable of both reflecting and receiving the incident EM waves.During the harvesting phase, the RIS operates in the reception mode, where it combines the received signals from each element with some phase shifts. 2 The RIS can use the harvested energy to fully sustain its operation or, if the energy is insufficient, it can decrease the consumption from other energy sources, as a first step toward achieving a zero-energy RIS system.The abstract model of the direct EH operation is shown in Fig. 2a. 2 There is a type of metasurface implementation called holographic beamforming that can pass the incident EM waves from one side to the other.The metamaterial can add adjustable phase shifts, similar to a phased array, but with a different implementation [35].
2) Indirect EH: The RIS is generally deployed and designed to reflect the EM waves towards a desired location (typically a receiver location).Inspired by this principle, the EH device can alternatively be deployed in front of the RIS (at a short distance), and the phases of the RIS elements can be aligned so they combine constructively at the location of the EH device.This device then can return the energy to the RIS via a cable.The concept of indirect EH is demonstrated in Fig. 2b.
The EH device is equipped with an RF power sensor to measure the power level of a signal.There are different types of RF sensors.It might be based on semiconductor devices like diodes that respond to changes in input power.The signal is then passed through an analog-to-digital converter (ADC), which converts the analog RF signal into a digital representation that can be processed by digital circuits and microcontrollers.
The indirect approach is also applicable for simultaneously transmitting and reflecting (STAR) RIS [36] as long as the harvesting unit is on one side of the RIS.

C. Problem Description for Energy Harvesting
We consider a scenario of EH from an ambient RF source3 by an RIS with no prior CSI, and there is no coordination between the RIS and the RF transmitter.We assume that the transmit power and the location of the transmitter are unknown. 4or both the considered schemes, the measured RF power by the RIS (EH device) has the following expression where z n ∈ C for each 0 ≤ n ≤ N .In (1), z n not only includes all channel gains between transmitters and the energy harvester (except the adjustable phase shift ϑ n ), but also takes into account the transmission power.Also, ϑ n ∈ [0, 2π) is the adjustable phase shift of the nth element of the RIS.The random variables W and Y represent the received noise and the measured received power, respectively [12], [37].The measured received power can be obtained from the reading of the power in the EH device. 5he key difference between the direct and indirect EH schemes is in how the parameters in (1) are selected.For all 1 ≤ n ≤ N , we have

Reflection mode
Power supply where h n ∈ C and g n ∈ C are the channel gains from the transmitter to the RIS element n and from the RIS element n to the EH device in the indirect case, respectively.The transmit power is denoted by P t .
We assume no CSI is available at the RIS controller (i.e., z n is unavailable to the RIS).This scenario is more general compared to a scenario with coordination between the transmitters and the RIS, since the transmitter might lack a protocol to reach the RIS and can even be unaware of its existence. 6he values of {z n } N n=1 depend on the geometry and propagation environment and can be estimated by measuring amplitude and phase using RF receiver circuits.Since the RIS lack such RF chains, the RIS cannot estimate the amplitudes and phases.Hence, the values of {z n } N n=1 will remain unknown to the RIS.On the other hand, with power measurement at the EH device, the RIS can measure the combined power from all elements for any feasible phase configuration.We will utilize such power measurements in this paper.The general optimization problem is to maximize the received RF power 7by finding proper phase shifts ϑ= ∆ [ϑ 1 , . . ., ϑ N ] T for the RIS.

III. PROPOSED PHASE ESTIMATION ALGORITHMS
In this section, we will explore how we can maximize the received power in (1) with respect to the RIS phase configuration ϑ.For given values of z 1 , . . ., z N , the closedform optimal phase configuration is known.However, the z-coefficients are unavailable in our setup.Hence, we will explore how we can estimate them using a sequence of power measurements.Before considering the general scheme in the next section, we start with the basic single-phase scenario, where we maximize the received power with respect to a single phase coefficient.We assume that ze jϑ is one of the terms in (1), and z 0 is the summation of all other terms.Therefore, the received power becomes where W ∼ CN 0, σ 2 and Y is a random variable due to the noise.We know that E Y 2 = z 0 + ze jϑ 2 + σ 2 .Therefore, the optimal phase shift that maximizes the mean received power is If we measure the received power for L different phase configurations from the set of measurement phases Φ = ∆ {ϕ 1 , . . ., ϕ L }, the measured received powers become where T , W l ∼ CN 0, σ 2 , and W r,l and W i,l are independent and identically distributed (i.i.d.) random variables following N 0, σ 2 /2 .We observe from (5) that the conditional distribution of Y l given the channel is non-central Chi-squared distributed with two degrees of freedom.Also, and covariance where Consequently, Y l has the conditional PDF for all 1 ≤ l ≤ L, where I 0 (•) is the zero-order modified Bessel function of the first kind.
The noncentral Chi-squared PDF is a log-concave function [38].Moreover, a composition with affine mapping preserves the concavity [39].Hence, p Y l |X (y|x) in ( 10) is log-concave with respect to x.If we conduct multiple measurements for the measurement phases from Φ, then we will have the joint PDF The log-concavity is preserved under multiplication.Hence, p Y|X (y|x) in ( 11) is log-concave with respect to x.We can estimate x using a maximum likelihood (ML) estimator [40] as where D x is the domain of feasible values for x.Notice that, in (12), we took the logarithm and reversed the sign.Since p Y|X (y|x) is log-concave with respect to x, the objective function in ( 12) becomes a convex function with respect to x.
If we denote the optimal solution to problem (12) as x, an estimate of the optimal phase shift can be calculated as It should be noted that ϑ is not the ML estimate of the optimal phase shift. 8

A. ML Estimator
To find the ML estimate of x, we need to solve the following convex optimization problem: where (14b) is due to the definition of x, and it is a secondorder cone constraint; that is, a convex constraint [39].Moreover, (14b) implies x T a l ≥ 0 for all 1 ≤ l ≤ L.
One can solve the problem ( 14) using standard convex optimization algorithms, such as the interior-point method, and then use (13) to estimate the phase shift. 9

B. Linear Estimator
In this section, we propose a linear least squares estimator of x.From (5), the squared difference between the received power y and the noiseless signal can be expressed 8 The optimization problem for the ML estimation of the optimal phase shift is non-convex, hence it was not considered in this analysis. 9At high SNR, one can use the approximation I 0 (x) ≈ e x / √ 2πx and substitute it in (14a).The approximation makes the optimization problem simpler and numerically tractable, as the logarithmic and exponential terms cancel each other out.as L l=1 (y l − x T a l ) 2 .Hence, the least squares estimate is obtained as where A † is the Moore-Penrose inverse of A defined as The performance of the linear estimator in (15) depends on the choice of the matrix A, which in turn is a function of the set of measurement phases Φ.Our goal is to determine the best Φ that minimizes the mean squared error (MSE) MSE = ∆ E( X − x 2 ) of the estimator.
To compute the MSE of the estimator for an arbitrary matrix A, we need to find the expected values of E X and where it can be easily demonstrated that A † 1 = [1, 0, 0] T .Thus, the linear estimator proposed in ( 15) is biased for x 1 and unbiased for x 2 and x 3 .Despite the bias in x 1 , the phase estimation is not affected as the optimal phase shift is a function of x 2 and x 3 .
Furthermore, we have where µ and Σ are defined in (7) and (8), respectively.Using ( 16) and ( 17), the MSE for a given x becomes Since the RIS doesn't know the values of z 0 and z, from the RIS perspective, x is a random variable and therefore should be denoted as X.The objective is to find a matrix A that minimizes the expected MSE with respect to X. Assuming that the random variables X 2 and X 3 are independent and follow a zero-mean symmetric distribution, 10 we can express the following for any matrix A with the structure given in (9) Therefore, where based on the definition of X in (6), we have E(X 1 ) ≥ 0. Hence, to minimize E X (MSE) with respect to A, we should minimize tr A † T A † with respect to A. We can decompose A using the singular value decomposition (SVD) as A = U DV T , where U is an L × 3 real semiunitary matrix, T is a 3 × 3 diagonal matrix with non-negative real numbers on the diagonal, V is an 3 × 3 real unitary matrix.Thus, we have To minimize the expression in (21), we state the following theorem.
Remark 1.As the covariance of the observation vector Y is a function of the parameter x (8), the conventional best linear unbiased estimator (BLUE) does not exist [41].However, one can define a modified BLUE-based estimator that, instead of minimizing the MSE, minimizes the expected MSE with respect to the parameter X.Assuming that X 2 and X 3 are independent and follow zero-mean symmetric distributions, the modified BLUE-based estimator gives the same estimates of x 2 and x 3 as (15).Therefore, the phase estimation is not affected as the optimal phase shift is a function of x 2 and x 3 .

C. Empirical RMSE of the Estimators
In the previous section, the proposed ML estimator in ( 14) was optimal for the estimation of x, but, it was sub-optimal for estimating ϑ = arg (x 2 + j x 3 ).Additionally, the linear estimator was sub-optimal for estimating ϑ as it minimizes the MSE with respect to x, not ϑ.In this section, we evaluate the root mean squared error (RMSE) of the estimations of the parameter ϑ for linear and ML estimators using Monte Carlo simulations.We consider the set of measurement phases Φ = 0, 2π 3 , 4π 3 for both estimators.For this numerical evaluation, we define the SNR as Without loss of generality, we assume that z 0 = 1.Hence, according to (4), we have ϑ = − arg (z).We explore different values for |z|, ϑ (i.e., − arg (z)), and the SNR to encompass different parameter scenarios.To calculate the RMSE, we constrain ϑ within the range −π + ϑ < ϑ ≤ π + ϑ.
As seen in Fig. 3, for the considered Φ, the RMSE of the ML and linear estimators closely track each other and vary with the actual value of the parameter ϑ.Additionally, we observe an increase in the respective RMSE values for |z| = 1, |z| = 3, and |z| = 10.
Thus, the linear and ML estimators perform similarly in terms of RMSE for the phase estimation.Additionally, the ML estimator has two drawbacks: it requires knowledge of the noise variance and its solution involves complicated modified Bessel functions.Therefore, we consider the linear estimator to develop the multi-phase control algorithm.

Remark 2. Since the proposed estimation techniques do not have any CSI or any a priori distribution of the channel values
and only consider the conditional received power distribution, they are general regardless of the channel distributions.

IV. PROPOSED PHASE ALIGNMENT SCHEMES
In this section, we investigate the problem of maximizing the received RF power using a dynamic sequence of power measurements.We propose a model for the RIS EH operations and we consider two different scenarios: 1. continuous phase control, where the RIS elements can add any continuous phase shifts to the incident RF signal; 2. discrete phase control, where the RIS elements can only add phase shifts from a predefined discrete set.For each scenario, we propose an algorithm to find the optimal phase of RIS elements.
A simplified model of the operation of an RIS with an EH module is shown in Fig. 4. The network entity manager can assess the network environment, including but not limited to the network demand, the SNR, and power measurements from the RIS, and determine if the RIS should function to provide connectivity or to harvest energy.Within the RIS controller, the preferred phase of each element can be determined based on its functionality, and the controller can adjust the phase of the elements accordingly.The energy harvester can be located either outside or inside the RIS surface.It sends power measurements to a phase alignment algorithm implemented in the network entity manager module.These values can be used by the network entity manager to decide whether the RIS should be in energy harvesting or data transmission mode.After reaching an appropriate phase configuration, the harvested energy can be fed back to the power supply to be used by the RIS.

A. Continuous Phase Control 1) Noiseless Scenario:
We begin by considering an ideal noiseless scheme, where the RIS is capable of adding continuous phase shifts to the incident EM waves.In the absence of   the noise, the received powers become deterministic.Therefore, there is no need to apply any phase estimation technique.In Theorem 2, we show that with three power measurements, we can determine the optimal phase shift without any error.First, we state Theorem 2, and based on that, we develop our proposed algorithm that requires no a priori CSI.
Theorem 2. Let f : R → R be a function of the form where z 0 , z ∈ C. Without knowing the explicit values of z 0 and z, the optimal variable ϑ ⋆ that maximizes f (•) can be computed based on the measurement vector T as ϑ ⋆ = arg (x 2 + jx 3 ), where x = ∆ A −1 y.The matrix A is defined as Note that ϕ 1 , ϕ 2 , ϕ 3 ∈ [0, 2π) must be selected such that det(A) = 0.
Proof.The proof is provided in Appendix B.
In general, Theorem 2 allows for the computation of the optimal phase shift using only three measurements, without requiring knowledge of the explicit expression of the function.

Algorithm 1: The proposed phase-alignment algorithm for power maximization
Input: The number of RIS elements N and the number of iterations M Output: Near-optimal phase vector ϑ ⋆ that maximizes the received power.Initialize: ϑ ← ϑ 0 , m ← 0, and e n is a vector, where the component n is 1 and all other components are 0. while m < M do m ← m + 1; for n ← 1 to N do y 1 ← the measured power for the phase configuration ϑ; y 2 ← the measured power for the phase configuration ϑ + π 2 e n ; y 3 ← the measured power for the phase configuration ϑ + πe n ; ϑ ← ϑ + arg(y 1 − y 3 + j (2y 2 − y 1 − y 3 )) e n ; end end ϑ ⋆ ← ϑ; Specifically, for the measurement phases ϕ 1 = 0, ϕ 2 = π/2, and ϕ 3 = π, a simple expression for the optimal phase shift can be obtained as follows: Algorithm 1 is a sequential, iterative phase update algorithm.At each iteration, adjusting the phase of each element requires measuring the received power for three different phase configurations.This is the minimum number of power measurements that can be used for this purpose.The algorithm updates the phase of one element using (27), then proceeds to the next element until all N elements have had their phases updated.In this algorithm, the process is repeated M times, but in practice, it can also be terminated earlier if some additional stopping criterion is satisfied.
In the inner loop of Algorithm 1, the number of operations remains constant regardless of the number of elements in the RIS (i.e., N ).Given that both the inner and outer loops iterate N and M times, respectively, the algorithm's complexity can be expressed as O(M N ).Fig. 5 presents a toy example that demonstrates the different steps of the proposed algorithm.The figure shows that, initially, the vectors are misaligned, leading to a relatively small amplitude of their sum compared to a scenario where they are aligned in the same direction.The algorithm rotates the phase of each vector to match the sum of the others.As the algorithm progresses and reaches the end of the second iteration, the vectors become almost aligned in the same direction, resulting in a nearly maximum amplitude of their sum.Proof.The proof is provided in Appendix C.

2) Noisy Scenario:
In this section, we address the problem of phase alignment in noisy environments.We start by considering a single-phase control scenario and presenting estimators for the optimal phase shift.Subsequently, we extend this to the multiple-phase control scenario.
In Section IV-A1, we developed Algorithm 1 to address the noiseless scenario by extending the single-phase control approach to the multiple-phase control scenario.Theorem 3 proves the convergence of Algorithm 1 to the optimal solution.In the noisy scenario, a similar extension can be made.
In this section, we propose a sub-optimal sequential algorithm that aims at maximizing the mean received power.For a phase configuration ϑ = (ϑ 1 , ϑ 2 , . . ., ϑ N ), the measured received power in the presence of the noise is where W ∼ CN 0, σ 2 , and Y is the measured power and it is a random variable due to the noise.We define the average SNR per element as Algorithm 2: Linear phase-alignment algorithm for power maximization in the presence of noise Input: The number of RIS elements N , the number of iterations is M , and set of measurement phases Φ = {ϕ 1 , ϕ 2 , . . ., ϕ L }. Output: Near-optimal phase vector ϑ ⋆ that maximizes the mean received power.Initialize: ϑ ← ϑ 0 , m ← 0, and e n is a vector, where the component n is 1 and all other components are 0.
for l ← 1 to L do y l ← the measured power for the phase configuration ϑ + ϕ l e n ; end x ← A † y; ϑ ← ϑ + arg ( x 2 + j x 3 )e n ; end end ϑ ⋆ ← ϑ; In Section III, we considered the single-phase control scenario in the presence of noise.In the multi-phase control scenario with noise, we will make a similar extension as in Algorithm 1 to achieve Algorithm 2. In each iteration of this proposed algorithm, adjusting a single phase requires L measurements.The algorithm updates the phase of one element using ( 15) and ( 13), then proceeds to the next element until all N elements have had their phases updated.To adjust all the phases once, a total of L×N measurements are required.This process is repeated M times.We further simplify the solution by using optimal measurement phases in Algorithm 3, where we apply (24) for the phase update of each element.
Regarding the complexity of Algorithm 2 and Algorithm 3, the number of operations within the inner loop scales linearly with L. Furthermore, with the inner and outer loops iterating N and M times, respectively, the algorithm's complexity can be represented as O(M N L).
Algorithm 3 is computationally more efficient than Algorithm 2, as it performs the vector multiplication y T b instead of the matrix multiplication A † y.

B. Discrete Phase Control
In practice, with the current technology, a RIS element can only apply a phase shift that takes a value from a finite set of possible phase shifts Ω.We define this set as Algorithm 3: Optimal linear phase-alignment algorithm for power maximization in the presence of noise Input: The number of RIS elements N , the number of iterations M , and the number of measurement phases L. Output: Near-optimal phase vector ϑ ⋆ that maximizes the mean received power.Initialize: ϑ ← ϑ 0 , m ← 0, and e n is a vector, where the component n is 1 and all other components are 0. b ← 1, e j2π/L , . . ., e j2π(L−1)/L T ; while m < M do m ← m + 1; for l ← 1 to L do y l ← the measured power for the phase configuration ϑ + 2π(l−1) The problem of finding the optimal phase-shifts for the RIS elements that maximize the received power becomes where In general, the problem (30) might have more than one solution.For instance, when the set Ω is closed under modular 2π addition, assuming ϑ ⋆ is a solution, one can easily show that all the members of the set {ϑ ⋆ + 1ω k mod 2π : 1 ≤ k ≤ |Ω|} are also solutions.
Below, we introduce a modified discrete version of the Theorem 2.
Theorem 4. Let f : Ω → R be a function with the expression , and ϑ ⋆ is the optimal continuous phase shift that is computed using Theorem 2.
Proof.The proof is provided in Appendix D.
We utilize Theorem 4 to propose the Algorithm 4 for the discrete scenario, which is a modified version of Algorithm 1.The new Algorithm 4 is a natural extension of Algorithm 1 for the discrete phase-shift scenario, but it is not necessarily optimal.
The number of operations within the inner loop of Algorithm 4 scales linearly with |Ω|.Moreover, with the inner Algorithm 4: The proposed discrete phase-alignment algorithm for power maximization Input: The number of RIS elements N , the number of iterations M , and the set of possible phase shifts Ω = ω 1 , ω 2 , . . ., ω |Ω| .Output: Near-optimal phase vector ϑ ⋆ ∈ Ω N that maximizes the received power.Initialize: ϑ ← ϑ 0 ∈ Ω N , m ← 0, and e n is an N -dimensional vector, where the component n is 1 and all other components are 0. Select three measurement phase shifts ϕ 1 , ϕ 2 , ϕ 3 ∈ Ω, such that sin (ϕ for n ← 1 to N do y 1 ← the measured power for the phase configuration ϑ + (ϕ 1 − ϑ n ) e n ; y 2 ← the measured power for the phase configuration ϑ + (ϕ 2 − ϑ n ) e n ; y 3 ← the measured power for the phase configuration ϑ and outer loops iterating N and M times, respectively, the algorithm's complexity can be expressed as O(M N |Ω|).

Theorem 5. The proposed Algorithm 4 converges as M → ∞.
Proof.The proof is provided in Appendix E.

V. PERFORMANCE EVALUATION
In this section, we evaluate the performance of our proposed algorithm and compare it to a random phase update method using Monte-Carlo simulations.We consider a RIS with 100 elements and generate random complex Gaussian distributed values with unit variance for {Z n } N n=1 .

A. Benchmark: Random Algorithm
Since there is no prior work to compare against, we use a random algorithm as the benchmark for the proposed algo-rithm.The basic concept is that, at each step, the algorithm picks a single element of the RIS sequentially and assigns a random phase value from a uniform distribution over the interval [0, 2π) in the continuous scenario or over the set Ω in the discrete scenario.In the discrete scenario, we ensure that the new random phase differs from the previously used one.The new power measurement is then compared to the previous one.If the power increases, the algorithm updates the phase and moves on to the next element.If the measured power decreases, the algorithm maintains the previous phase and proceeds to the next element.

B. Performance Evaluation
We define the normalized achieved power (NAP) as the actually received power divided by the theoretically maximum received power level.More formally, the NAP is defined as where ϑ is the used RIS phase configuration for different methods.Furthermore, the mean normalized achieved power (MNAP) is defined as MNAP = ∆ E(NAP).Fig. 6 illustrates the MNAP versus the number of power measurements for the proposed Algorithm 3 and random benchmark method under different SNR conditions.The results are applicable to both indirect and direct EH, but we stress that the former typically leads to lower SNRs due to the extra pathloss.The proposed method uses three measurements per phase update (L = 3) of each element and converges to its final value after 300 measurements (i.e., LN ), while the random one requires ten times more measurements as it has a slow convergence rate.We notice that the proposed method converges equally fast at any SNR, while the convergence rate decreases for the random method when the SNR increases.Importantly, the proposed method converges to a solution with a higher RF power than the random one.The MNAP increases with the SNR.Therefore, with three measurements per phase update, it can't reach its full potential in terms of receiving power from the ambient RF source.At low SNRs, the proposed method does not reach the maximum theoretical power.This happens because the MSE of the phase estimation does not decrease at each step, preventing the algorithm from converging to the theoretically optimal phase configuration.To overcome this issue, we can increase the number of measurements per phase update (L) in order to reduce the MSE of the phase estimation.The MNAP of the proposed method at SNR → ∞ can be regarded as a genie-aided phase update within the framework of our sequential algorithm.Moreover, with access to CSI, we can achieve MNAP = 1.Thus, it can be considered as the upper bound with genie-aided assistance.Fig. 7 shows the cumulative distribution function (CDF) of the relative achieved power for both the proposed and random algorithms, compared to the optimum in noiseless scenario.The randomness in the proposed method is due to the random channel realization, while in the random method it is due to both random channel realizations and random phase updates.We conducted 1000 simulations with randomly generated channels.The results indicate that one iteration of the proposed algorithm achieves significantly better performance than the random method achieves after ten iterations.Although the proposed algorithm still performs slightly better than the random one after fifty iterations (e.g., on the average, as also shown in Fig. 6), the latter provides a CDF curve with smaller variations.
In Fig. 8, the impact of the number of measurements per phase update (L) on the MNAP of the proposed Algorithm 3 and the random method is shown.It can be observed that as L increases, the performance improves and the RIS achieves higher power.For example, at SNR = −10 dB, the MNAP is 0.09 for the random method, while for the proposed method with L = 3, L = 10, L = 30, and L = 100, the MNAPs are 0.14, 0.31, 0.54, 0.75, respectively.The convergence to the final value of the proposed algorithm occurs after almost N L measurements.This increase in the number of measurements leads to an increase in the NAP at low SNRs but also increases the latency.Hence, there is a trade-off between the NAP and the number of measurements.For instance, at SNR = 10 dB, the NAP for the proposed method with L = 3 is 0.94.In this case, additional measurements may not be necessary as they only slightly improve the NAP.For low SNRs scenarios, if the limit is 1000 measurements, for a RIS with N = 100 elements, choosing L = 10 is more advantageous compared to L = 3, as it achieves more power.
It is worth mentioning that RIS is envisioned to be deployed in environments where the channel between the transmitter and the receiver is weak.However, we deploy RIS in a place where the channel between the transmitter and the RIS and the channel between RIS and the receiver are both strong.Hence, the low SNR from the transmitter to the receiver does not imply the low SNR from the transmitter to the RIS.On the contrary, a RIS might only be effective if it has a relatively strong channel to both the transmitter and receiver [12].Thus, the SNR can be sufficiently high to configure the RIS as proposed in this paper.
In Fig. 9, we evaluate the performance of the proposed Algorithm 4 in the absence of the noise, considering a discrete set of possible phase shifts Ω = {0, π/2, π, 3π/2}.The number of RIS elements is N = 10.We compare the NAP of the proposed method to that of the random phase update method and the maximum feasible value (calculated using a brute-force method).The error bars indicate a 95 percent confidence interval.At the beginning, the random method achieves higher power, due to having one phase update per measurement, compared to the proposed method's one phase update per three measurements (L = 3).However, as the RIS takes more measurements, the proposed method outperforms the random one.The proposed method converges to a higher value than the random algorithm, but not exactly to the maximum feasible value.Therefore, our proposed method is sub-optimal for the discrete, noiseless scenario.We did not consider a larger number of RIS elements as the number of possible phase configurations to find the maximum feasible value grows exponentially with N (i.e., |Ω| N ).
To get a sense of the amount of power a device can harvest using RIS, let's consider a scenario where an RIS surface is situated on the xy plane, with its center positioned at the origin.The elements form a grid with resolution λ/2, where we consider λ = 0.125 m (In this setup, a RIS with 256 elements occupies an area of 1 m 2 ).Furthermore, we consider an isotropic RF source with a transmit power of 1 W at [0, −3, 4] T and an EH device at [0, 1, 2] T (i.e., an example of indirect EH).We compute the channel gains between the RIS elements and the transmit and receive antennas by taking into account the near-field and polarization effects [42].
We assume the following sigmoidal function for the EH conversion efficiency.
where P sat implies the output harvesting saturation power.Constants a and b are associated with detailed circuit specifications, including factors like resistance, capacitance, and diode turn-on voltage.We adopt a = 30, b = 0.07, and P sat = 0.1 W, and the unit of the input power x is Watt [43].Fig. 10 illustrates the mean harvested power versus the number of RIS elements for the proposed Algorithm 3 and the random method (both after reaching convergence).We also considered a genie-aided scheme with available CSI.As observed, increasing the number of RIS elements (i.e., expanding the surface area) leads to an increase in harvested power until it reaches saturation.The saturation power, which is less than the saturation power of the harvesting device (i.e., 20 dBm), occurs due to the limited power that an infinitely large RIS surface can reflect toward a receiver [42].Alternatively, if the transmit power were sufficiently large, saturation could result from the harvesting device.Furthermore, an optimality gap in mean harvested power is observed between the genie-aided method and the proposed and random methods, and this gap becomes smaller at higher SNRs.
The gap in mean harvested power between the proposed method and the random method demonstrates the superiority of the proposed method.For instance, for a RIS with 1024 elements (i.e., a surface 4 m 2 ), the gap between the proposed method and random method at the SNR of −20 dB is 2.27 dB, which is significant.It is worth mentioning that the proposed method converges with less number measurements than the random method (as shown previously in Fig. 6).

VI. CONCLUSIONS
This paper has presented a method for energy harvesting at a RIS from an ambient RF source in the absence of coordination with the source.The objective was to maximize the received power by adjusting the phases of the RIS elements based only on power measurements, obtained without having a RF receiver.The proposed sequential algorithm outperformed the random phase update method in terms of achieved power after convergence, while requiring fewer measurements.Also, it is proved to converge to the optimum for the noiseless continuous phase scenario.The impact of the number of measurements per phase update on the achieved power was evaluated, showing that increasing the number of measurements leads to improved performance, although the amount of improvement depends on the SNR of the system.A higher number of measurements leads to significant improvement in received power in low SNR regimes but is unnecessary in high SNR regimes where three measurements provide a near-optimal solution.Besides, EH is beneficiary when the signal is strong and the SNR is large.For a discrete, noiseless scenario, the proposed method was found to be near-optimal, achieving a higher power than the random algorithm but not exactly the maximum feasible power.In future work, we plan to extend this study to consider more general scenarios.For example, the proposed method can be used to estimate the channel to the transmitter and thereby enable RIS configuration for data transmission without the involvement of the BS.

APPENDIX C PROOF OF THEOREM 3
We denote the phase-shift vector generated by the algorithm at iteration m up to the element n with ϑ k , where k = mN +n.We prove that for a given N , lim k→∞ f ϑ k = max ϑ f (ϑ).

APPENDIX E PROOF OF THEOREM 5
Algorithm 4 intends to maximize f (ϑ) = | N i=1 z i e jϑi | 2 with discrete phase-shifts.We denote the phase-shift vector generated by the algorithm at iteration m up to the element n with ϑ k , where k = mN + n.We will prove that the sequence f ϑ 1 , f ϑ 2 , . . .converges.
For any integer 1 ≤ n ≤ N and an integer k ≥ 1, we define

Theorem 3 .
The proposed Algorithm 1 converges to the maximum value of the function f (ϑ) = N n=1 z n e jϑn 2 as M → ∞.

Fig. 6 .Fig. 7 .
Fig.6.Mean normalized achieved power versus the number of measurements for the proposed Algorithm 3 (L = 3) and random method, and for various SNRs.

Fig. 8 .
Fig.8.Impact of the SNR on the mean normalized achieved power at ϑ ⋆ of the proposed Algorithm 3 and the random method.

Fig. 9 .
Fig.9.Mean normalized achieved power for the proposed Algorithm 4 and random method versus the number of measurements.The number of RIS elements is N = 10, and the set of possible phase shifts is Ω = {0, π/2, π, 3π/2}.The maximum feasible value for the discrete scheme is shown with the black solid line and the error bars represent the 95 percent confidence interval.

10 0 10 1 Fig. 10 .
Fig.10.Impact of the number of the RIS elements and SNR on the harvested power of the proposed Algorithm 3 and the random method (both after reaching convergence).

i=1 i =n z i e jϑ k i . Hence, we have f ϑ k = |w k n +z n e jϑ k n | 2 . 2 . 2 ≥ w k n +z n e jϑ k n 2 =
At the phase update k+1, the algorithm only updates the phase of the element n (w k+1 n = w k n ) as f ϑ k+1 = |w k n +z n e jϑ k+1 n | According to the Theorem 4, we havef ϑ k+1 = w k n +z n e jϑ k+1 n f ϑ k .(43)Therefore, f ϑ 1 , f ϑ 2 , . . .form a monotonically increasing sequence.Moreover, the maximum value of f (•) is( N n=1 |z n |) 2 , hence, the set F = ∆ f ϑ k : k ∈ N is upper bounded by ( N n=1 |z n |)2 .Therefore, according to the monotone convergence theorem[44], we have lim k→∞ f ϑ k = sup F ≤ (N n=1 |z n |) 2 .