Performance of RIS-aided near-field localization under beams approximation from real hardware characterization

The technology of reconfigurable intelligent surfaces (RISs) has been showing promising potential in a variety of applications relying on Beyond-5G networks. RIS can indeed provide fine channel flexibility to improve communication quality of service (QoS) or restore localization capabilities in challenging operating conditions, while conventional approaches fail (e.g., due to insufficient infrastructure, severe radio obstructions). In this paper, we tackle a general low-complexity approach for optimizing the precoders that control such reflective surfaces under hardware constraints. More specifically, it allows the approximation of any desired beam pattern using a pre-characterized lookup table of feasible complex reflection coefficients for each RIS element. The proposed method is first evaluated in terms of beam fidelity for several examples of RIS hardware prototypes. Then, by means of a theoretical bounds analysis, we examine the impact of RIS beams approximation on the performance of near-field downlink positioning in non-line-of-sight conditions, while considering several RIS phase profiles (including directional, random and localization-optimal designs). Simulation results in a canonical scenario illustrate how the introduced RIS profile optimization scheme can reliably produce the desired RIS beams under realistic hardware limitations. They also highlight its sensitivity to both the underlying hardware characteristics and the required beam kinds in relation to the specificity of RIS-aided localization applications.


Introduction
RISs, which consist of (semi-)passive controllable electromagnetic mirrors or sensing surfaces, have been identified as a key enabling technology for the upcoming sixth (6G) generation of wireless systems [1,2].They are indeed expected to reinforce both the service continuity and the QoS of communication networks, or even to locally boost their performance on demand, while limiting the need for additional costly elements of infrastructure (e.g., active (BS)).Although they were mostly intended to extend coverage under severe radio blockages, they have also shown fine capabilities to purposely shape the wireless propagation channel in a variety of location-dependent applications, such as (UE) localization (in both geometric (NF) and (FF) regimes), physical environment mapping and distributed spectrum sensing, or limitation of unintentional radio emissions (e.g., for improved communication security or reduced field exposure) [3,4].
The different unit elements of a RIS can be optimized, for instance in order to concentrate the reflected energy in the UE direction, similar to phased array systems [5].Many models have already been proposed accordingly, including phase control [1], quantized phase control [6], amplitude-dependent phase control [7], and joint amplitude and phase control [8], which all require a dedicated optimization procedure.However, as RISs are usually made of low-cost hardware, they may be naturally subject to imperfections, impairments, nonlinearity effects, dispersed characteristics, etc. [9,10].If not properly taken into account, these phenomena can significantly alter the result of the RIS optimization and hence ultimately, the RIS behavior itself, compared to the idealized case (i.e., with an unconstrained RIS profile).One unified way to address the various control models above while accounting for hardware characteristics is to use a lookup table.For a reflective RIS, the latter typically contains all the feasible complex reflection coefficients at each of the surface elements (i.e., in terms of amplitude and phase) for a certain RIS hardware.In addition, such lookup tables can account for extra coupling effects, which are very complex to model analytically otherwise.
In this paper, we present a computationally efficient method initially introduced in [11], which can optimize the configuration of a reflective RIS from an a priori imposed lookup table with the aim of approximating complex beam patterns.This method proposes a grid with a discrete set of positions (i.e., grid resolution can be increased with complexity trade-off ) and then defines an error metric to measure the similarity between the generated beams under hardware impairments and the optimal unconstrained ones.However, this grid does not directly correspond to the UE's location which is instead fixed.Although the previous approach is generic and applicable to any type of RISs or beams, as a concrete and practical study case, we herein consider applying it into the specific context of RIS-aided NF localization, which somehow requires combining particular RIS beams to reach optimality.Localization-optimal RIS phase configurations can indeed be determined through (PEB) optimization, assuming prior positional information about the UE [12,13].During the design phase, it is a common practice to make the latter assumption.This serves as a foundation for gaining fundamental insights into the system.However, in later stages, one can incorporate UE's position uncertainty.It can be achieved by extending the design to incorporate a robust solution that utilizes the same set of beams while accounting for such uncertainty.The aim is hence to improve positioning performance in (NLoS) situations, while relying on a unique RIS-reflected path (i.e., as estimated at the UE) over a sequence of (SISO) downlink transmissions [14,15] (see Fig. 1).Aiming more specifically at improving NF localization performance in [13], it has been shown that such optimization would necessitate the use of four distinct types of beams at the reflective RIS (i.e., one steering beam and its three derivatives (w.r.t.) spherical coordinates).Those four desired beams will be taken here as references into the proposed synthesis process and compared to directional or random designs.Thus, it is important to point out that the knowledge of the UE's location is not used to select a beam for a certain location but instead, the beams are designed to optimize the performance for a certain location.This is not the same as maximizing the (SNR) via directional beams.Overall, the main paper contributions are as follows: (1) Leveraging the recent results from [11,13] recalled above, we apply a low-complexity RIS beams approximation technique to RIS-aided NLoS localization with several a priori RIS design assumptions (including random, directional and localization-optimal options).(2) Accordingly, our analysis now includes not only a qualitative assessment of the fidelity of approximated RIS beams w.r.t. the desired beams (by means of a 1D/2D beam shape analysis), but also a quantitative assessment of the practical performance degradation induced by such beams approximation in comparison with their respective unconstrained configurations and that is by deriving the (FIM) and accordingly performing a PEB analysis.(3) Regarding input hardware constraints, we also extend the use of lookup tables (resulting from experimental characterization) to that of four distinct real RIS prototypes [16][17][18] and we study their impact on localization performance, via the devised theoretical lower bounds, in light of their respective design specificity.

Notations
Vectors and matrices are, respectively, denoted by lower-case and upper-case bold letters (e.g., x, X ).The notation [a] i is used to point at the i-th element of vector a , and similarly, [A] i,j represents the element in the i-th row and j-th column of matrix A , while i : j is used to specify all the elements between indices i and j.The Hadamard product is denoted by ⊙ , and ȧx = ∂a/∂x is the partial derivation of a w.r.t.x.Moreover, the notations (.) ⊤ , (.) * and (.) H denote the matrix transposition, conjugation, and Hermitian conjugation, respectively.Finally, (.) (r) denotes the r-th iteration in a loop and proj V (x) represents the projection of vector x onto a set V .The operator tr(X) denotes the trace of matrix X , and diag(x) denotes a diagonal matrix with diagonal elements defined by vector x .Finally, � • � is the l 2 -norm operator, and (.) ⋆ denotes the solution of an optimi- zation problem.

Related state of the art
The optimization of RIS profiles (i.e., the fine tuning of their element-wise reflection coefficients and/or phases) is a particularly challenging task in itself which can be seen as a beam design problem.This has been extensively studied for phased arrays, in both communication and radar literature [19].The main difference, however, between a reflective RIS and a phased array radar is that in order to create azimuth-and elevation-difference beams in reception via the latter, separate beamforming architectures are commonly employed [20,21], while on the other hand, a reflective RIS is only able to passively reflect the impinging signals through optimized phase control and does not produce receive beams via dedicated hardware.
In a pure RIS-aided communication context, the usual approach is to aim at increasing SNR at the receiver, relying on the estimated cascaded channel responses (i.e., between BS and RIS, and between RIS and UE), or possibly simply based on the prior UE location information (exact or more likely just estimated) [22].The corresponding problem can hence be solved out by maximizing recovery performance, based on the (DFT) and Hadamard matrices, or by leveraging location information from an external system [23].
As for RIS-aided localization specifically, a variety of control solutions have also been put forward recently, depending on the corresponding positioning strategy and operating context.In [24] for instance, based on prior UE location, simple directional reflection beams are applied at a few RISs, which are down-selected to maximize the amount of available location information (in a Fisher Information sense) while avoiding multipath interference.In [14], even simpler random RIS phase profiles are used to jointly enable downlink SISO positioning and synchronization, relying on (MC) transmissions, without necessitating prior information.In [12], RIS phases and beamformers are jointly optimized with respect to both the PEB and the (OEB) in a generic (MIMO) MC context.To overcome both the high number of real optimization variables and the problem non-convexity (resulting from the joint optimization of coupled variables), a simpler approach is then proposed that maximizes the sum of the SNRs for the central subcarrier at each BS antenna.An upper bound on the SNR is first maximized, before applying additional constant phase shifts to the RIS profile so that both direct and reflective paths are quasi-coherently summed up at each receiving antenna.
Focusing on the specific case of NF localization, many other RIS optimization schemes have been put forward, such as SNR maximization in [25,26] and DFT matrices in [27].On the other hand, a traditional randomized RIS phase design was considered in [28] to achieve bi-static localization of the RIS.In [15], random profiles are also utilized and the authors showed, theoretically, that this profile design can ensure localization continuity in NLoS conditions through direct positioning out of one single RIS-reflected path, relying on NF properties.However, random profiles are still clearly suboptimal in terms of localization performance.In [13], based on PEB optimization in the same NF NLoS context, it is shown that four distinct beams must be applied (i.e., one steering beam and its three derivatives as a function of spherical coordinates), while adjusting their relative weights (in the power or time domain, indifferently) depending on prior UE location.Finally, in [29], RIS phase design and quantization are ruled by hardware and its effect is studied on the NF focusing performance, but no practical constrained beam generation method is proposed.
Additionally, various works have considered beam design and optimization as [30] which presents a fast alignment algorithm for the phase shifts of the RIS and the transceiver beam-former, which uses a variable-width hierarchical phase-shift codebook.Another recent study [31] proposes a far-field beam-based beam training scheme, where a deep residual network is utilized to estimate the optimal near-field RIS codeword.In [32], the authors present a beamwidth adaptation technique during the beam training process, and an atomic norm channel estimation method for the cascaded channel.The paper [33] proposes the use of differential data to determine the best beam for the RIS.Furthermore, [34] explores a joint design of the reflection coefficients of multiple RISs and the precoding strategy of a single BS to optimize the tracking of the position and velocity of a single UE with an iterative block coordinate descent algorithm.
One major difficulty while optimizing RIS beams under such hardware constraints is that the latter may be difficult to handle analytically.As an example, unit-norm constraints are usually non-convex and shall necessitate specific iterative approaches [35].In some other cases, the addressable RIS configurations may be quantized [17], subject to phase-dependent amplitude variations (wanted or unwanted) [7], or only characterized experimentally as a lookup table derived from real measurements [16].Under realistic hardware limitations, RIS profile optimization can hence be performed either (1) by directly optimizing the constrained RIS configuration with respect to the considered objective (e.g., minimize the PEB in the localization context) [1,2,7,36] or (2) by carrying out an unconstrained optimization of the RIS configuration first and then determining the best approximation that could be practically supported by the RIS.These two options can be referred to as "constrain, then optimize" or "optimize, then constrain" (e.g., [13]), respectively.For the former, low-complexity numerical methods offering good fidelity with respect to the desired (i.e., unconstrained) beam patterns are still needed, which is one of the purposes of this paper.

Overall system model and localization scenario
Following [37], we first consider a single-antenna (TX), which is communicating in NLoS with a single-antenna (RX).The transmission is hence enabled through an M-element reflective RIS, over two (LoS) links (i.e., TX-RIS and RIS-RX links).In case of narrowband transmissions, and static and known RIS location, the corresponding baseband received signal is then expressed as follows [15,38]: where p TX and p RX are, respectively, the TX and RX positions, α is the complex chan- nel gain, � diag(ω) with ω ∈ C M×1 accounting for the RIS complex configuration, x is the transmitted signal of energy E s , n ∼ CN (0, N 0 ) is the additive white Gaussian noise of power spectral density N 0 , and a(•) ∈ C M×1 indicates the RIS response.Considering (1) a point p , the m-th ( m = 1, 2, . . ., M ) entry of a(p) , corresponding to the m-th RIS ele- ment located at p m , is given by 1where p RIS is the RIS center location and is the wavelength.Finally, in (1), we have used the definition b(p RX , p TX ) a(p RX ) ⊙ a(p TX ).
Figure 1 illustrates a millimeter wave (mmWave) downlink NLoS localization scenario, where a BS in p TX = p BS broadcasts a narrowband pilot signal x t ∈ C over T transmissions, with a bandwidth W, a transmit power P tx , and a total transmit energy E tot = E s MT = (P tx MT ) / W . From (1), the complex signal y t ∈ C received by a UE in p RX = p UE at time t after RIS reflection can be written as where � t = diag(ω t ) with ω t ∈ C M×1 , which can vary as a function of time.This received signal can also be vectorized over the T transmissions into y ∈ C T ×1 as follows 2where In the absence of LoS and at reasonably short RIS-UE distances and/or with large surfaces, one can leverage properties of the NF RIS response (i.e., location-dependent information conveyed by radio wavefront curvature) to estimate the position of the UE based on the observed received signals over time.Here, it is assumed that the position of the TX and the RIS, the orientation of the RIS, and the RIS profiles are known, where the RIS profiles may be optimized to improve the accuracy of estimation.

RIS beam approximation problem
Due to RIS hardware limitations and/or design specificity [6], all element-wise reflection coefficients are assumed to take values among a few discrete complex values only.In other words, for the m-th element of the vector ω in (1), it holds that ω m ∈ V , where V is a finite set of complex numbers, whose magnitude cannot exceed unity as the RIS is passive.For instance in [16,Table I], for a particular hardware prototype, the individual RIS element response has been experimentally characterized, and the corresponding set V has the cardinality of 14. Leveraging the model in (1), we first tackle a generic optimi- zation framework that aims at approximating any desired beam pattern for a reflective RIS, i.e.
for an arbitrary RX point p in the coverage area G .Without loss of generality, p TX is assumed to be static. ( As already alluded in the previous sections, concrete examples of usual canonical beam patterns to be synthesized in RIS-aided applications include steering beams (such as DFT beams) [38], derivative beams (e.g., difference beams just like in monopulse radar [19], MIMO radar [39], or even localization [40]), or even multiple concurrent beams [11,41].As seen in the following, localization-optimal RIS configurations may request a combination of the latter canonical beams, jointly or sequentially depending on the implementation (typically, a steering beam pointing to the UE, and its derivatives w.r.t. the three spherical coordinates).So one more goal here is to assess the theoretical performance degradation induced by such beam approximations directly at the application level (i.e., typically, in terms of PEB), beyond beam fidelity issues.

Least squares precoder design
Leveraging the approach in [35], the desired beam pattern in ( 5) is first discretized into a N G -element vector g .Each element of g corresponds to a specific point in G .N G hence refers to the number of such discrete locations sampled from G .Accord- ingly, it comes that , the RIS configuration optimization problem can be formulated as follows, like in [35, eq. ( 12)]: where s ∈ C is a normalization factor enabling to solve the scaling issue for g while designing the beam pattern [35].The optimization approach in (6) represents a RIS beam pattern synthesis problem aiming to determine the optimal RIS phase profile ω that best matches a given desired beam pattern g.
To deal with the RIS configuration problem exposed above, a simple projected gradient descent algorithm is used (see Algorithm 1), inheriting from [35,Alg. 2].First of all, one gradient descent step is performed w.r.t.scaling variable s (see Line 2 of Algorithm 1).Then, we apply an unconstrained gradient descent step w.r.t.RIS configuration (see Line 3), whose result is subsequently projected onto the set V (see Line 4) so as to satisfy the lookup table constraint in (6b).Note that β is just a design parameter that enables to adjust the step size, while max (•) refers to the largest eigenvalue of the matrix argument.Algorithm 2 summarizes the projection step.Accordingly, the complexity of Algorithm 1 (per iteration) is O(M(N G + |V|)).

Reduced-complexity solution
As the definition domain of G(p) may coincide with the full 3D space, N G can become tremendously large, and even prohibitive, resulting in very high computational complexity for Algorithm 1.To relax this burden, one can express the beams at stake in terms of spherical coordinates and redefine accordingly the optimization objective from (6), with ρ the distance, θ the azimuth angle and φ the elevation angle, all defined w.r.t. the RIS coordinates system (see Fig. 1), like in [14,Fig.1bwhere R , T , and P correspond to the discrete sets of respective spherical coordinates.
Likewise, the different RIS response vectors are also redefined, e.g., w.r.t. the azimuth: All in all, the optimization problem can now be refor- mulated as follows: (7) Just like for Algorithm 1, the optimization problem above is solved through a gradient descent step w.r.t. the scaling factor s (see Line 2 of Algorithm 3) and the vector of RIS phase shifts ω (see Line 3 of Algorithm 3), before projecting finally the updated vector into the space V (see Line 4 of Algorithm 3).In this case, it is worth noting that , which is much lower than that of the initial Algorithm 1.

FIM and PEB
In our specific localization application context, we first define the vector of UE position and channel parameters in the 3D spherical coordinates system, as After introducing the corresponding set of parameters in the Cartesian coordinates system, that is, , the Jacobian C = ∂ζ sph/ ∂ζ car is used to recompute the previous FIM as (13) Computing the FIM in the spherical domain followed by a transformation to the Cartesian domain is a better approach compared to directly calculating it in the latter.This is because the derivative beams used in the computation require access to the spherical positional variables.Finally, the best achievable positioning performance is characterized by means of the following PEB, which represents a lower bound on the accuracy of any unbiased location estimator [43, Chapter 2.4.2] where pUE stands for any unbiased estimate of p UE and we have made the dependence on the precoding matrix F explicit.
In the following, the use of this PEB is twofold.First, it is exploited as a parametric optimization objective to determine a localization-optimal RIS configuration suited to the stated downlink NF NLoS positioning problem (see the next section).Beyond, the PEB will be used also as a general performance indicator to assess and benchmark the impact of beam approximation on localization for several RIS configurations and different RIS lookup tables (see the numerical results section) (Table 1).

PEB minimization
Assuming the UE position to be known a priori, the power-constrained PEB optimization problem, as a function of the RIS configuration, is first formulated as follows Similar to [13], using the change of variable X = F F H and removing the constraint rank(X) = T [44, Chapter 7.5.2][45], it can be shown from [46, Appendix C] that the optimal matrix solution X ⋆ to the equivalent relaxed convex (SDP) problem is of the specific form (16)  where ∈ C 4×4 is a (PSD) matrix with the beam weights to be applied onto-or equiva- lently, the relative powers allocated to-the columns of U lying on its diagonal.
The columns of U can be physically interpreted as the RIS steering vector and its succes- sive derivatives with respect to the spherical coordinates, similar to that involved in (13).
Note that the space spanned by these columns could also be spanned by four orthonormalized vectors, after application of the Gram-Schmidt algorithm, so that U H U = MI 4 .This step enables us to rewrite the initial optimization constraint tr(X) = MT as tr( ) = T .After performing the transformation above (i.e., from X ∈ C M×M to ∈ C 4×4 ), and by applying Schur's compliment on 19a to eliminate the inverse of the information matrix term, an equivalent low-complexity optimization problem can be simply stated as follows Furthermore, the problem can be further relaxed by forcing to be diagonal, i.e., = diag( ) .The entries of vector can hence be viewed as relative power allocations (or equivalently, as relative transmission periods within a time-sharing approach, depending on the implementation [13]), which must be assigned to the different columns of U .In the following, we consider solving the final optimization problem (22) through CVX [47].

Localization-optimal RIS beams approximation
From (21), if p des = p UE denotes the position of one single UE to be localized (i.e., I = 1 ), it comes that four distinct desired beams must be synthesized in practice so as to optimize localization performance, as follows:

Simulation parameters
To assess the performance of the proposed beam synthesis method, we considered actual lookup tables accounting for the RIS response per unit element of distinct hardware prototypes, i.e., distinct sets of feasible complex reflection coefficients per element.These prototypes have been developed and characterized in the frame of the H2020 RISE-6G 3 project.In particular, we have considered the following sets (see Fig. 2): 1]: a first set characterizing a prototype based on a single-diode varactor, with 14 possible complex values per RIS element; • K1 [17]: a second set characterizing a prototype revisiting a transmit-array architec- ture [17] based on p-i-n diodes and enabling 1-bit phase quantization, hence with 2 possible complex values per RIS element; • K2 : a third set similar to K1 , but with 2-bit phase quantization and hence four pos- sible complex values per RIS element.
The performance obtained with each of the previous sets after beam approximation is compared with that of an idealized variant (so-called unconstrained), where the RIS complex element-wise reflection coefficients all lie on the unit circle with continuous phase values.
In our simulations, the carrier frequency was set at 5.15 GHz for V and 28 GHz for the other sets, reflecting the actual operating frequency of each RIS hardware prototype.And to make sure that the localization performance comparison is fair, we ensured that the propagation loss of the BS-RIS RIS-UE paths is equal disregarding the operating frequency effect.
In terms of addressed scenario, without loss of generality, we focus on a canonical configuration, where p TX is set to [3, 3, 0] ⊤ m and the RIS is placed at the origin, i.e., p RIS = [0, 0, 0] ⊤ m .For beam patterns visualization and beam fidelity analysis (see Figs. 3, 4, 5, 6 and 7), we first consider a desired point p des ≡ p UE located in [0, 2, 0] ⊤ m for both steering and derivative beam patterns.The 1D visualizations are intended to show the performance in terms of maximum power gain and width, allowing us to evaluate the designed beams in the desired direction, whereas the 2D illustrations showcase the beam pattern in terms of both the azimuth and elevation angles, hence focusing on the overall angular behavior, as well as on the potential presence of harmful grating lobes.These visualizations include the magnitude |G(p)| in 1D or 2D slices in spheri- cal dimensions.In Fig. 9, the PEB is evaluated as a function of the RIS-UE distance and accordingly, the UE position is set to [−r, r, r] ⊤ m where r varies between 0.2 and 10 m.However, in Fig. 10, we set the spherical coordinates of the user in a different way where the RIS-UE distance is set to a constant value ρ = 2 m , the elevation angle is also set to a constant φ = π 2 rad , whereas θ , the azimuth component, varies across the entire defined range, i.e., [0 • • • π ] rad (excluding the first and last values where the UE is co-planar with the RIS).Similarly, in Fig. 11, the range is set to ρ = 2 m , θ = π 2 rad and now the elevation angle φ varies across the [0 • • • π] rad range.For this positioning performance 3 See https:// RISE-6G.eu for more information.assessment, we compare the PEB when applying ideal localization-optimal RIS beams with those obtained via the proposed approximation method.For benchmark purposes, similar PEB evaluations are also carried out with random and directional RIS configurations where we adopted a Monte Carlo approach and we averaged the PEB over all the random trials.In the former case, the complex RIS element-wise reflection coefficients are simply drawn randomly from the corresponding set for each prototype, with no further projection.
The main simulation parameters (system model and scenario) are summarized in Table 2.

Qualitative analysis of approximated RIS beams 1D Visualization
In Figs. 3 and 4, we show approximated patterns for both 1D steering and derivative beams, as a function of the azimuth parameter θ , while maintaining the other coordi- nates at their true (i.e., desired) values.These patterns have been generated without imposing any constraint on the RIS precoder (unconstrained) or by utilizing realistic hardware limitations derived from the lookup tables (sets K1 , K2 , and V ).It is important to note that the projection onto any set can be achieved through a single step or can be improved through iterative refinement.The latter approach has been adopted to achieve a higher level of precision.
In Fig. 3, we notice at first that the main lobe of the unconstrained steering beam (red curve) has a peak of 60.2dB , which is in line with the beamforming gain offered by the considered RIS of M = 32 × 32 elements.Moreover, comparing the beam projected onto the set K1 (i.e., with 1-bit unit cells; green curve) with the unconstrained one, we see a significant loss, which can be mitigated by about 3 dB, by projecting the beam onto K2 instead (2-bit unit cells; blue curve).Furthermore, projecting the beam onto set V results in, as expected, more degradation in the beam peak value.Beyond, if we take a look at the entire beam shape across θ , we notice that constraining into real sets leaves the beam with unwanted secondary lobes, explaining also the power loss experienced at the peak of the main lobe.Table 1 summarizes the main indicators regarding beam fidelity issues, in terms of power loss in the desired direction and the presence of unwanted secondary lobes aside.It simply indicates the peak power value of the main lobe as well as the position and the peak value of the secondary lobes, across different prototypes, which are defined by the highest peaks breaking the unconstrained envelope.Fig. 2 The sets V , K1 , and K2 with the values for the RIS elements responses, as well as the unit modulus set, plotted in the complex plane Fig. 3 Steering patterns as a function of the azimuth angle θ for various beam synthesis methods under gradual RIS hardware constraints, including the realistic RIS element responses of [16,17] Figure 4 shows that the generated derivative beam patterns exhibit very similar trends to that observed with the steering ones.Additionally, as the figure displays the derivative with respect to the azimuth angle, a null is present when θ corresponds to the desired direction, as already pointed out in [40].

2D Visualization
The heatmaps in Figs. 5, 6, 7 and 8 display, as a function of the direction of departure from the RIS (i.e., of both azimuth and elevation angles) and a specified desired direction (red circle), the unconstrained steering beam, as well as its projections onto sets K1 , K2 , and V , respectively.In Fig. 5, we can see that only one main lobe is pre- sent in the desired direction, as expected.Note that this is used as a reference for comparing the beams constrained with realistic RIS hardware.
Figure 6, visualizes the beam projection onto set K1 , where the main lobe is still observed in the desired direction, even though clearly attenuated in comparison with the unconstrained beam from Fig. 5.The presence of a strong and systematic secondary grating lobe is also noted, which turns out to be a standard reflection, regardless of the desired beam direction, number of RIS elements, or inter-elements spacing.
Fig. 6 Designed RIS beam resulting from the projection to K1 (same example as in Fig. 5) Fig. 7 Designed RIS beam resulting from the projection to K2 (same example as in Fig. 5) This kind of grating lobe arises due to the severe quantization of the RIS element phase, creating some kind of spatial aliasing.However, as shown in Fig. 7, this problem of grating lobe can be mitigated after adding only one more bit of phase quantization.In this case, a higher peak value (by about +3 dB ) is also achieved for the main lobe in the desired direction, even if the levels of all the other secondary lobes remain globally high and comparable to those in the 1-bit phase quantization case.Lastly, Fig. 8 depicts the beam pattern gain resulting from the projection onto V .Regardless of the high number of quantization levels (i.e., 14) shown in Fig. 2, a secondary lobe is also sill present pointing toward a fixed unwanted direction, which corresponds to a natural specular reflection.This grating lobe comes from the fact that set V is not centered at the origin of the complex plane (see Fig. 2), but shifted and significantly down-scaled in comparison with the unit circle, due to amplitude losses.Accordingly, the 2π rad phase domain is not entirely covered by the feasible reflection coefficients per element.Indeed, given the span of valid phases observed in V (say, reflection coef- ficients experiencing attenuations lower that 5 dB), which covers less than π rad in practice (i.e., less than what would be feasible with a 1-bit quantization of the RIS element phase in K1 ), this unwanted reflection was hence expected with V too.In addi- tion to the main grating lobe, the intensity of all the secondary lobes is also generally higher throughout the entire 2D area.

Quantitative analysis of positioning performance with approximated RIS beams
In Fig. 9, we show that PEB increases globally as a function of the RIS-UE distance, as expected.We hence first note that the localization-optimal RIS phase design outperforms the random designs [13]) for both constrained and unconstrained beam patterns, whatever the considered range.Then, among the random phase designs more specifically, the performance of the so-called unconstrained beam is only slightly Fig. 8 Designed RIS beam resulting from the projection to V (same example as in Fig. 5) better than that of all the constrained beams, which are very close to each other, even if V looks slightly worse at very first sight (for the same reasons of unfavorable reflection coefficients distribution as before).Overall, this means in practice that the localization performance is not that sensitive to beam fidelity issues caused by beam patterns approximation under real hardware limitations, as long as all the feasible phases/amplitudes of the reflection coefficients are all visited within random RIS configuration designs.Regarding the localization-optimal phase design, which requires a weighed combination of four distinct beams, performance now seems much more sensitive to beam pattern approximation (and hardware impairments) than that in the random design case, while experiencing much higher performance degradation in comparison with the unconstrained case.This performance gap looks relatively constant as the RIS-UE distance increases though.Moreover, as expected, set K2 seems relatively better than K1 which is also better than V .Finally, another set of two curves related to directional RIS profile design are shown with different uncertainty sphere radii (0.5 m and 2 m).We notice that in general, the PEB of the directional design lies in between the localization-optimal and the random once.Furthermore, distributing the positions in a smaller uncertainty sphere yields a PEB close to that projected onto sets K1 and K1 in the localization-optimal design only at short distances but then degrades quickly as the RIS-UE distance increases.On the other hand, using the bigger sphere gives the opposite behavior; this is in line with the results presented in [13].
Figure 10 shows the PEB evolution as a function of the azimuth angle (i.e., the RIS-UE distance and elevation being fixed), where one can observe the same trends and ranking as before with the RIS-UE range.Whatever the setting, the PEB is also mainly better in the inner part of the spanned angular interval, illustrating typical geometric effects as Fig. 9 PEB as a function of RIS-UE distance for ideal and designed localization-optimal RIS beams, constrained by the real lookup tables/projection sets of the four characterized hardware prototypes Fig. 10 PEB as a function of RIS-UE azimuth angle for ideal and designed localization-optimal RIS beams, constrained by the real lookup tables/projection sets of the four characterized hardware prototypes Fig. 11 PEB as a function of RIS-UE elevation angle for ideal and designed localization-optimal RIS beams, constrained by the real lookup tables/projection sets of the four characterized hardware prototypes we get away from the boresight, regardless of beam approximation.Since the RIS-UE distance is short, utilizing a directional phase design with a smaller sphere yields a better performance than a bigger one which in turn almost performs as the random design.
Likewise, Fig. 11 shows similar PEB curves as a function of the elevation angle (i.e., the RIS-UE distance and azimuth being fixed), where performance is still better in the inner part of the spanned angular intervals, illustrating typical effects as we get away from the boresight.The gap between the PEB performance achieved with an unconstrained beam pattern and its constrained approximated variants seems all the more critical in those outer angular zones.

Conclusion and future work
In this study, we presented a low-complexity technique for optimizing the complex configuration of RISs so as to create various beam patterns, while considering real hardware limitations.The proposed method utilizes a predetermined lookup table of possible RIS element reflection coefficients, characterized out of real measurements.Applying the proposed beam generation strategy into the concrete context of NF NLoS localization, the performance degradation induced by beams approximation has then been evaluated in terms of both beam fidelity and PEB, and further benchmarked for different a priori RIS control strategies (including random, directional and localization-optimal designs).First numerical simulations regarding beam fidelity emphasize the dominating influence of both phase quantization levels (and the span of practically valid phases) and power losses regarding the element-wise complex reflection coefficients on the power gain of the RIS beam peak in the desired UE direction, as well as on the existence of unwanted secondary lobes.The results show up to 50-75% peak power attenuation in the main lobe when switching from unconstrained RIS design to hardware constrained ones.Another artifact is the appearance of secondary lobes with high peak power directed in unintended directions.Other simulations performed in a canonical scenario also reveal the effects of beam synthesis and their relative power losses on the localization performance of different RIS prototypes.The PEB metric was utilized for that manner and the positioning was evaluated versus both RIS-UE distance and angles (i.e., both azimuth and elevation) to ensure that the study covers all the possible dimensions.As expected, constraining the beam synthesis to RIS designs with certain limits degrade the positioning performance across all dimensions with various RIS profile designs.In general, a gain of one order of magnitude is realized when adopting the location-optimal profile design compared with the random one.In the former, the performance varies from mm levels in NF up to m, whereas the latter starts at cm at short distances.Furthermore, utilizing a realistic constrained hardware design degrades the performance by around 40% as the UE moves away from the RIS.This degradation is still clear in the angular study with its value changing w.r.t. the RIS-UE angle.
In a practical localization scenario, it is possible to obtain prior information about the UE's location from previous time steps (e.g., a Kalman filter), from which an optimal beam design problem can be formulated.In particular, as a fundamental special case, we have considered the scenario where a single user position is known, and based on this, we have derived the structure of the beams in the RIS codebook.To accommodate position uncertainty in the codebook, robust designs can be employed, building upon the proposed design framework.This future extension allows for the incorporation of position uncertainty while maintaining the overall structure and principles of the initial design [40].
Other future works should investigate more RIS prototypes by testing their different design characteristics based on localization performance.Extending the results to stateof-the-art as well as novel localization algorithms is also a possible path where the gaps in the performance of the RIS devices can be analyzed and fixed.

Fig. 1
Fig. 1 Typical NF NLoS positioning scenario over single-input single-output downlink transmissions with one single reflective RIS and related problem geometry with respect to the RX point p , where the RIS center serves as the origin of both the spherical and Cartesian coordinates systems ]. Let p ref be the reference RX position in spherical coordinates, expressed as [ρ ref , θ ref , φ ref ] ⊤ .Then, we define the following three beam patterns each time varying only one of the spherical dimensions (instead of covering the entire 3D volume): and compute the FIM accordingly[42, Chapter 3.7].whereµ = αF ⊤ a(p UE ) refers to the noiseless part of the observation and with ȧx (p UE ) = ∂a(p UE ) / ∂x ∈ C M×1 .

Fig. 4 Fig. 5
Fig.4 Derivative beam patterns as a function of the azimuth angle θ for various beam synthesis methods under gradual RIS hardware constraints, including the realistic RIS element responses of[16,17]

Table 1
Peak Gain Distribution of Main and Secondary Lobes Across Different RIS Prototypes

Table 2
General simulation parameters