Localization Performance Analysis and Algorithm Design of Reconfigurable Intelligent Surface-Assisted D2D Systems

The research on high-precision and all-scenario localization using the millimeter-wave (mmWave) band is of great urgency. Due to the characteristics of mmWave, blockages make the localization task more complex. This paper proposes a cooperative localization system among user equipment (UEs) assisted by reconfigurable intelligent surfaces (RISs), which considers device-to-device (D2D) communication. RISs are used as anchor points, and position estimation is achieved through signal exchanges between UEs. Firstly, we establish a localization model based on this system and derive the UEs’ positioning error bound (PEB) as a performance metric. Then, a UE-RIS joint beamforming design is proposed to optimize channel state information (CSI) with the objective of achieving the minimum PEB. Finally, simulation analysis demonstrates the advantages of the proposed scheme over RIS-assisted base station positioning, achieving centimeter-level accuracy with a 10 dBm lower transmission power.


Introduction
In next-generation wireless networks, achieving high-precision localization in various scenarios remains a focus of further research.Current studies primarily rely on the accurate estimation of channel parameters, such as time of arrival (TOA), direction of arrival (DoA), or received signal strength indicator (RSSI), to enable localization by establishing communication links between transmitters and receivers.Among these, DOA-based methods such as multiple signal classification (MUSIC) [1] and estimation of signal parameters using rotational invariance techniques (ESPRIT) [2] algorithms, which utilize uniform linear arrays (ULA) for parameter estimation, have many applications.The positioning model based on RSSI has also been applied in recent research [3,4].The RSSI value of radio waves during propagation is a function of the propagation distance, and this relationship can be used to estimate the distance.Utilizing RSSI based on pilot signal power for distance estimation at close range is a good choice, especially when there are no obstacles blocking the signal.
However, practical scenarios often involve obstacles between base stations (BSs) and user equipment (UEs) or mobile stations (MSs), resulting in non-line-of-sight (NLOS) situations.This becomes particularly prominent at millimeter-wave (mmWave) or higher frequencies, where signal penetration is weaker.Fortunately, with the advancements in metamaterials and radio frequency technology, reconfigurable intelligent surfaces (RISs) offer a promising solution to address NLOS localization [5].Utilizing RISs for localization in mmWave scenarios has become a pivotal area of recent research.This is supported by studies such as [6][7][8], which demonstrate the capability of achieving centimeter-level positioning accuracy, even under conditions of obstructed links.
RIS is a revolutionary technology that intelligently reconfigures the wireless propagation environment by using a large number of low-cost passive reflecting elements integrated on a plane.It significantly enhances the performance of wireless communication networks [9].RIS with multiple reflective elements provides higher beamforming (BF) gain and angular resolution, which is unmatched by ordinary scattering points.Despite the tremendous potential of RISs, from a communication design perspective, RIS faces new challenges in effectively integrating into wireless networks, such as reflection optimization, channel estimation, and deployment [9].In recent years, researchers have made lots of meaningful work on RIS-aided communication positioning.The authors in [10] analyzed the impact of RIS-reflected paths on the accuracy of position estimation, but it only considered 2D scenarios.Other authors in [11,12] investigated the Cramér-Rao lower bound for absolute position estimation in 3D scenarios assisted by RIS, and optimized RIS-reflected BF to enhance localization performance.There are also considerations of cooperative localization methods.In [13,14], adding device-to-device (D2D) links between MSs was proposed to assist localization and the authors demonstrated that cooperative communication between MSs can provide additional localization gains through numerical results.However, the studies above are all based on the localization method with the BS as the necessary anchor point.Since RISs' positions are known, it should be feasible to use RISs as anchor points for localization.In fact, the idea has been explored in [15,16].The authors in [15] involved a single UE signal which is reflected back to itself through adjusting the RIS elements.After eliminating multipath effects, UE achieved localization itself.Ref. [16] introduced a D2D link based on [15], but its core is the same as [15].In addition, the reflection design of the RIS is also a crucial aspect of positioning.Both [17,18] have conducted reflection BF designs by solely considering the RIS and utilizing discrete phase shifts.These studies have successfully demonstrated the effectiveness of such discrete phase shift designs.Hence, adopting a discrete design approach for localization is also a viable option.
Motivated by the above, this paper newly proposes a cooperative localization system among UEs with RISs as anchor points and conducts a performance analysis on this system.We consider both positioning relying solely on RIS and cooperative positioning among UEs.The proposed scheme differs significantly from previous papers in terms of details and introduces novel aspects in problem optimization.The main contributions of this paper are summarized as follows:

•
We present a cooperative localization system utilizing RISs for millimeter-wave (mmWave) multi-input multi-output (MIMO) systems.To evaluate the proposed system, we utilize the positioning error bound (PEB) of UEs as a performance metric.To accomplish this, we first calculate the Fisher information matrix (FIM) for the channel parameters.We then derive the transformation matrix between the FIMs of the channel parameters and the UEs' positions.This allows us to determine the PEB for the UEs.With the aim of reaching the optimal performance of proposed system, we set the PEB as our objective.Since the received signal is significantly influenced by the channel state information (CSI), we innovatively propose a joint BF design of the transmitter UE's BF and reflecting BF at RIS based on an alternating optimization algorithm.We illustrate our objective function and detail the algorithm steps of the proposed BF design to solve the function.

•
The simulation results illustrate that, with the proposed BF design, our localization scheme achieves markedly superior positioning performance compared to scenarios without BF design or with random BF design.Moreover, by opting for smaller RIS sizes and an optimal number of quantization resolutions, our proposed scheme achieves positioning accuracy of 10 −2 meters under the condition that signal-to-noise ratio (SNR) is 30 dB.This level of accuracy typically necessitates higher power consumption or larger RIS sizes in BS-based user localization systems.
The remainder of this paper is organized as follows.Section 2 introduces the system model, including the channel model, receiver model, and geometry relationship.Preliminary localization is presented, and the PEB is derived in Section 3. Section 4 demonstrates the optimization objective and proposes our algorithm.Section 5 shows the simulation analysis, including the impact of the antenna array size, the number of carriers, different quantization resolutions, and physical distance on PEB.There, we also conduct a comparative experiment.Conclusions are presented in Section 6.
Notations: Vectors are shown by bold lower-case letters and matrices by bold uppercase ones.j = √ −1.E[•] denotes the expectation operator.ℜ{•} represents the real part of a complex variable.All vectors are column vectors by default.Transpose and Hermitian operations are denoted by (•) T and (•) H , respectively.The Hadamard product is indicated by ⊙.

System Model
We consider a 2D localization scenario between UEs with two RISs assistance and no BS or access point, as presented in Figure 1, which can be called cooperative localization among UEs with RISs as anchors.It consists of RISs with L reflecting antenna elements in each ULA and two ULA users UE1 and UE2 with N u antennas each.More users are feasible, but we aim to simplify the model and focus on the analysis of positioning performance.Two or more RIS units are necessary because we need a sufficient number of anchor points to construct the spatial topology of the devices.This conclusion is based on geometric intuition, and no formal proof is provided.Accordingly, we build the system model.The positions of UE1 and UE2 are, respectively, given by [q x , q y ] T and [p x , p y ] T .As the system is operating in the mmWave band, near-field effects are neglected.The position of RISs, assumed to be points, are represented by [r1 x , r1 y ] T ,[r2 x , r2 y ] T .The rotation angles of the antenna arrays at UE1 and UE2 are denoted by γ q , γ p ∈ [0, π], respectively.The objective is to locate the positions of UE1 and UE2, given that the positions of RISs are fixed and known.Consider the system where the working frequency of the carrier is f c and the total bandwidth is B. In this system, each UE can control RISs and act as the transmitter for localization tasks.Thus, we assume that UE2 remains silent while UE1 transmits an Orthogonal Frequency Division Multiplexing (OFDM) signal with N subcarriers to UE2.Concurrently, UE2 receives both the direct signal from UE1 and the signal reflected from the RISs.During UE1's transmission, UE1 remains silent as well.

Channel Model
The CSI matrix for the n-th subcarrier of the UE1-RIS1-UE2 route is formulated as where and where ρ 11 and ρ 12 are the free-space path loss occurred in the UE1-RIS1 and RIS1-UE2 link.τ q,r1 and τ r1,p are ToAs of the two links.
are the antenna array steering vectors and response vectors at UE1 and UE2, respectively.The i-th entry of α T (α t1 ) and α R (α r1 ) are [α T (α t1 )] i = e j2π(i−1) d λ sin(α t1 ) and [α R (α r )] i = e j2π(i−1) d λ sin(α r1 ) , respectively.α t is the AOD of UE1, and α r is the AOA of the UE2.d is the antenna element spacing of UE, and RIS1 is the same.λ = c/ f c , with c denoting the speed of light.α in (ϕ in ) and α out (ϕ out ) are the array response vectors of the UE1-RIS1 and RIS1-UE2 links, where ϕ in is the AOA at the UE1-RIS1 link, and ϕ out is the AOD at the RIS1-UE2 link.α in,1 (ϕ in ) is represented as [α in (ϕ in,1 )] i = e j2π(i−1) d λ sin(ϕ in,1 ) , where i ∈ {0, 1, . . ., L − 1}, and α out (ϕ out,1 ) is defined similarly.Similar to (1), (2), and (3), the CSI matrix for the n-th subcarrier of the UE1-RIS2-UE2 route is formulated as where and Moreover, UE2 will also send a positioning reference signal(PRS) to UE1 after UE2 performs this.The channel state information matrix of the UE2-RIS1-UE1 route is formulated as where α H T (α r1 ) and α R (α t1 ) are the antenna array steering vectors and response vectors at UE2 and UE1, respectively.They are defined similarly as α T (α t1 ) and α R (α r1 ).Similarly, the CSI matrix G RIS2 [n] of the UE2-RIS2-UE1 route is expressed as where The CSI matrix of the UE1-UE2 route is formulated as The CSI matrix of the UE2-UE1 route is formulated as To obtain the distance of UE1 and UE2, each ULA needs to act as a single antenna (A1 and A2) to transmit signals.The CSI matrix of the A1-UE2 route is formulated as The CSI matrix of the A2-UE1 route is written as where ρ 3 is the path loss in the UE1-UE2 link, and τ u is the path delay.α T (θ t ) and α T (θ t ) are defined in the similar way as α T (α t1 ).

Receiver Model
Assume that the transmitted PRS is F is transmit BF matrix.We assume that F at UE1 is denoted as F 1 , and F at UE2 is denoted as F 2 .According to (1)-( 16), the signal y 1 [n] reflected by the RISs and the signal y 3 [n] directly transmitted from UE1 via a single antenna, both of which are received at UE2, can be expressed as The signal y 2 [n], y 4 [n] ∈ C N u ×1 received at UE1 can be similarly expressed as where n[n] ∈ C N u ×1 is the additive white Gaussian noise drawn from CN (0, 2σ 2 I), and I is the identity matrix.P is the transmit power of the PRS.

Geometry Relationship
According to the geometric description of the model, the relationship between channel parameters and geometric information can be expressed as α ti = arctan((ri y − q y )/(q x − ri x )) + γ q , (25) ϕ in,i = − arctan((ri y − q y )/(q x − ri x )), where i ∈ 1, 2, µ is the path loss exponent, and d r,q , d r,p , and d p,q are the distances between the RISs and UE1, RISs and UE2, and UE1 and UE2, respectively.

Localization and Its Performance Metric
Based on the system model established in Section 2, we can estimate the parameters required for preliminary localization using the methods mentioned in the introduction.Subsequently, precision localization is achieved by adjusting the BF direction based on the preliminary localization results.We employ PEB as the evaluation metric for localization accuracy in this scheme.In Section 4, we will utilize this metric to formulate an objective function and propose a novel joint BF algorithm to optimize this objective function.

Preliminary Localization
Before optimizing the BF, we first roughly estimate the required parameters for localization.We employ the RSSI method for distance estimation and the ESPRIT method for receiving angle estimation.y 3 [n] can also be written as: We set Then, θr , αr1 , and αr2 can be calculated by R with the aid of ESPRIT algorithm [2].θt , αt1 , and αt2 are calculated similarly.Based on the angles and distance, along with the known coordinates of the RISs, we can solve the equations in geometry relationship in Section 2. Thus, we depict the topological spatial location information between devices like Figure 1 and obtain the coordinates of the UEs.

Performance Metric for Localization
PEB is used to measure the localization scheme in a good number of studies.In this section, we derive PEB as a performance metric.As in [10,14], we use a two-stage method to obtain the FIM of the positions of UE1 and UE2.Firstly, we obtain the FIM of the channel parameters η.Then, the FIM for the UEs' positions can be derived by computing a transformation matrix T that links the two FIM matrices.Finally, we use the FIM of the UEs' positions to derive the Cramér-Rao Lower bound (CRLB) and position error bound for estimating the UE positions.According to the system model described above, all channel parameters η can be stacked as We denote the unbiased estimator of η as η.And firstly, we combine all the received signals into a new vector y[n] defined as where where Based on the Cramér-Rao theorem [19,20], the mean squared error of η is bounded as where J η ∈ C 12×12 is the FIM of η, and [J −1 η ] m,m is the CRLB for the m-th parameter estimate.The(m, n)-th entry of J η is defined as where p(y[n]; η) is the likelihood function of the random vector y[n] conditioned on η and η m is the m-th entry of η.Since y[n] follows a symmetric complex normal distribution, the (m, n)-th entry for the FIM can be defined as The detailed calculation of µ[n] can be found in Appendix A. Since our aim is to recover the UEs' positions P = [q x , q y , p x , p y ] T , we can obtain the FIM J P associated with P by properly transforming J η , which is shown as follows: where the transformation matrix T ∈ C 4×12 is defined as: and the expression of [T] i can be computed according to ( 21)-(33) and found in Appendix B. Finally, we can obtain the entries of J P as follows, where m, n ∈ {0, 1, . . ., 4}.Therefore, the CRLB for estimating the UEs' positions is the trace of the inverse matrix of J P : CRLB = tr(J −1 P ).The PEB can be defined as

Optimization Objective and Solutions
According to the previous section, we know that the smaller PEB represents the better performance of the positioning system.Thus, in this section, our aim is to minimize the PEB.From Equations ( 44) and ( 45), it can be seen that PEB is mainly related to J η and T.During localization, the channel model and signal model are fixed, and T is a constant matrix.Therefore, PEB depends on the BF matrix and the reflection phase shifts at the RIS.Hence, we can minimize PEB by altering F and Ω.
Considering practical constraints, assume that the phase shift of each reflection element can only take discrete values.Let Q r represent the number of control bits for each element, and suppose that the values of the discrete phase shifts are uniformly distributed in the range (0 In addition, assume that the transmit BF matrix F = [ f 1 , . . ., f N u ] is constrained to take values from a codebook, where f k = [e jv 1 , . . ., e jv Nu ] T .We have }. Therefore, we can define an optimization objective function as Since this objective function is non-convex, the block coordinate descent (BCD) algorithm can help us, which can be found in [14,21].Hence, we propose a BCD-based joint alternative optimization as illustrated in Algorithm 1 and we call this optimization the joint BF design.In each iteration, we optimize ω i while keeping ω k fixed, where k ∈ {1, . . .i − 1, i + 1, . . ., L 2 }, and optimize v j while keeping v l fixed, where l ∈ {1, . . ., j − 1, j + 1, . . .N u }.As a result, in Ω 1 or Ω 2 , we have ωi = arg min where i ∈ {1, . . ., L }, and in F 1 or F 2 , we have vj = arg min where j ∈ {1, . . ., N u }.In order to approach the optimal solution as closely as possible, we alternate between optimizing Ω while fixing F and optimizing F while fixing Ω.We calculate minimum PEB after optimizing Ω and F. Finally, we present a concise complexity analysis of the proposed algorithm, which is pertinent given that many BCD-based algorithms undergo similar analyses.As delineated in Algorithm 1, during the i-th cycle of the t-th iteration, step 6 incurs a complexity of approximately O(N 3 u L 4 N) operations.This complexity primarily stems from the multiplication and inversion of matrices.Notably, step 9 mirrors the operations of step 6.Consequently, the total complexity of the proposed algorithm is expressed as , with T, typically less than 10 1 , representing the number of iterations for Algorithm 1.

Simulation Analysis
In this section, we analyze PEB to demonstrate the performance of the proposed system.Firstly, considering far field constraints, the position of the RISs are set at coordinates [0, 0] m and [0, 20] m, UE1 is at [20, −10] m, and UE2 is at [20,30] m.The signal-to-noise ratio (SNR) is defined as P σ 2 .If not specified, the default parameter settings are listed in Table 1.These parameter settings have taken into account the avoidance of near-field effects.The path loss exponent σ 2  −80 dBm [7] The free space noise power

Impact of the Joint BF Design
Firstly, we investigate the impact of the BF design on the transmitter and RIS on PEB.As shown in Figure 2, we compare four different cases, including (1) random F and random Ω; (2) random F and optimized Ω; (3) optimized F and random Ω; and (4) the joint optimized BF design based on the iterative solution of (46) by Algorithm 1.
The PEB performance of these four designs is depicted across various SNR levels in Figure 2. The results indicate that optimized Ω or F yields superior PEB performance compared to random Ω or F, with PEB decreasing as SNR increases.This phenomenon arises from the ability to align transmitting beams, thereby concentrating them to achieve higher transmission gains.Similarly, without optimizing the phase design of the RIS, random reflection fails to attain higher acceptance gain for the receiving antenna.Of significant note, the joint BF design at the transmitter-RIS, based on Equation (44), achieves optimal PEB for the localization scheme, enabling centimeter-level localization accuracy under the given conditions.

Impact of Q r and Q f
Next, we consider the impact of different phase quantization resolutions on the PEB generated by the joint BF design.As shown in Figure 3, it is evident that PEB decreases as Q r and Q f increase.However, it can also be observed that PEB growth saturates when Q r ≥ 6 or Q f ≥ 6.

Impact of L, N u , and N
Next, we consider the impact of subcarrier count design and the size design of RIS on the localization performance.As shown in Figures 4 and 5, it is obvious that with the increase of L, N u , and N, a significant reduction in PEB can be observed.This is intuitive, as a larger RIS represents more RIS reflecting elements, thereby providing more reflective links to deliver the required localization information.Having longer antennas on the UEs implies the capability to transmit and receive more link information, naturally aiding in improving localization accuracy.Similarly, a larger N implies more subcarriers, which also brings more links capable of providing measurement information.The results further indicate that by selecting an appropriately sized RIS, achieving centimeter-level localization accuracy can be easily realized with a large number of reflecting elements.

Impact of the Distance between UEs
Furthermore, the distance between UE1 and UE2 should also be considered.Constrained by the signal attenuation in free space, PEB gradually increases as the distance between devices grows larger in Figure 6.It is also noted that increasing power can partially compensate for this loss of accuracy.

Comparison
Finally, we compare the performance gap between the proposed scheme and the scheme (Comparison) that BS locates UEs with the assistance of RISs as in Figure 7.A similar model can be seen in [11] for the localization scheme used for comparison.It is essential to note that the comparative scheme under consideration lacks D2D links.Furthermore, in practical scenarios, the transmission power of the BS, at P t = 10 dBm, is significantly higher than that of the UEs.Typically, the distance d ′ between the BS and the UEs should far exceed the distance between the UEs themselves.Accordingly, we have set d ′ = 5 × d p,q .The BS is positioned at coordinates [20, −170] meters and is equipped with a single antenna, hindered by obstacles.Localization can only be achieved through reflection with the assistance of RISs.Other parameters were set to be as consistent as possible.As can be seen from Figure 8, the proposed scheme clearly outperforms the traditional RIS-assisted localization and lower power can yield improved performance.Additionally, replacing RISs with a larger size or adding more RISs can bridge the performance gap between the schemes.This demonstrates the feasibility and advantages of cooperative localization schemes.However, it should be noted that our proposed scheme requires collaborative transmission of signals among devices, whereas the comparative scheme only requires a single transmission.As a result, our scheme incurs twice the complexity.Moreover, this D2D localization scheme distributes the localization burden to UEs rather than BS, reducing the power pressure on BS.Even as a performance supplement for conventional localization schemes, it remains a viable option, as can be seen in Table 2.

Conclusions
In this paper, we proposed a system for D2D cooperative localization in mmWave MIMO systems using RISs as anchor points, without relying on BS.UEs transmit PRS to each other through RISs to achieve localization.A system model is then established based on this scheme.The PEB, which evaluates the coordinate error of the two UEs' positions, is derived, and a joint transmitter-RIS BF design algorithm based on alternating optimization is proposed to minimize the PEB.The simulation results demonstrate that the proposed algorithm significantly improves the localization performance and the proposed scheme can achieve centimeter-level localization accuracy.
In conclusion, our proposed cooperative localization scheme leveraging RISs presents a promising solution for enhancing localization accuracy and flexibility in mmWave MIMO systems.Future research directions may include further optimization algorithms and practical implementations to validate the effectiveness of our proposed scheme in realworld scenarios.

Figure 1 .
Figure 1.Localization system with one L-antenna RIS and two N u -antenna UEs.

Figure 3 .
Figure 3. PEB versus different Q r for different Q f .

Figure 4 .
Figure 4. PEB versus different SNRs for different N.

Figure 5 .
Figure 5. PEB versus different N u for different L.

Figure 6 .
Figure 6.PEB versus different d q,p between UE1 and UE2 for different P.

Figure 7 .
Figure 7. Scenario difference between ours and the comparison.