1 Introduction

IRS allow to enhance the throughput of wireless networks since all reflections have the same phase at the receiver [1,2,3,4,5]. IRS consists to adjust the phase shift of each reflector so that all reflected signals have a null phase at the receiver [6,7,8]. IRS can be employed as a reflector or a transmitter and allow significant performance enhancement of the order of 15, 21, 27 dB gain when compared to wireless systems without IRS for \(N=8, 16, 32\) reflectors. IRS have been proposed for Non Orthogonal Multiple Access [9], millimeter wave communications [10, 11] and optical communications [12]. IRS have been studied with continuous and discrete phase shifts [13,14,15,16,17,18,19]. IRS were not yet used to enhance spectrum sensing or the energy harvesting process as considered in this paper [20]. IRS was used in [21] to transmit packets to multiple users. Simultaneously Transmit and Reflect (STAR) IRS was suggested in [22] to broadcast data to users located in the transmit and reflect space of STAR-IRS. IRS using rate splitting was proposed in [23]. A survey on physical layer security using IRS was provided in [24]. IRS using beamforming was considered in [25]. IRS for millimeter wave communications was studied in [26]. Some experimental results have been performed to confirm the significant performance enhancement of wireless communication using IRS.

IRS have not been yet used to enhance the spectrum sensing process [20]. In fact, when the reflected signals have the same phase at the Secondary Source (SS), spectrum sensing will be performed with multiple signals with the same phase leading to an enhancement of detection probability. We consider that PS harvests energy using the received signals on \(n_r\) antennas from node A. The harvested energy is used to transmit data to PD. IRS is located between PS and SS so that all reflections have the same phase at SS. We show that the use of \(N=8,16\) reflectors and \(n_r=2\) antennas offers 15 and 21 dB gain when compared to spectrum sensing without IRS [20]. Spectrum sensing using IRS equipped with \(N=32\) reflectors offers 27 dB and 30 gain when compared to spectrum sensing without IRS for a number of antennas \(n_r=2\) and 3 [20]. We also suggest the use of a second IRS to increase the harvested energy. IRS is located between node A and PS to increase the harvested energy since it uses multiple received reflected signals. The use of two IRS with \(N_1=N_2=8\) reflectors offers 30 dB and 8 dB gain when compared to spectrum sensing without IRS and a single IRS.

We also derive the primary and secondary throughput when IRS is located between Primary Source PS and Primary Destination PD and between Secondary Source SS and Secondary Destination SD. The use of a single IRS with \(N=8, 16, 32\) reflectors improves the throughput by 16, 22, 28 dB gain when compared to the absence of IRS. When two IRS with 8 reflectors are used, there is 35 dB gain when compared to the absence of IRS.

We consider the use of a single IRS located between the primary and the secondary source to enhance the spectrum sensing process. In fact, spectrum sensing uses the reflected signals on IRS that have the same phase. To enhance the energy harvesting process, we added a second IRS between node A transmitting RF signals and the primary source. The primary source uses the reflected signals on the second IRS during the energy harvesting process.

Sections 2 derives the detection probability when IRS is employed as a reflector. Section 3 evaluates the detection probability when IRS is employed as a transmitter. Section 3 suggests the use of a second IRS to increase the harvested energy. Numerical results are given in Sect. 4 while conclusions are presented in last section.

2 IRS Used as a Reflector

Figure 1 depicts the system model with a Primary Source (PS) equipped with \(n_r\) receive antennas used to harvest energy using the received signal from node A. The harvested energy is employed to transmit data to Secondary Destination SD. The transmitter signal is reflected on IRS equipped with N reflectors so that all reflections have the same phase at Secondary Source SS where spectrum sensing is performed using the energy detector. IRS is placed between the Primary source PS and the secondary source SS. IRS reflected the signals of PS so that they have the same phase at SS. A Rayleigh fading channel is used during the simulations.

Fig. 1
figure 1

Spectrum sensing using IRS as a reflector

The harvested energy at PS is expressed as

$$\begin{aligned} E=\mu \alpha T P_A\sum _{l=1}^{n_r} |f_l|^2=\mu \alpha L_0 E_A \sum _{l=1}^{n_r} |f_l|^2, \end{aligned}$$
(1)

where \(T_s\) is the symbol period, \(\mu\) is the efficiency of energy conversion, \(P_A=\frac{E_A}{T_s}\) is the power of node A, \(L_0=\frac{T}{T_s}\). The average power of channel coefficient \(f_l\) between A and l-th antenna of PS is \(E(|f_l|^2)=\frac{1}{D_1^{ple}}\) where E(X) is the expectation of X, \(D_1\) is the distance between A and PS and ple is the path loss exponent.

The transmitted energy per symbol of PS is equal to E divided by the number of transmitted symbols (\(L_0(1-\alpha )\)):

$$\begin{aligned} E_{PS}=\frac{E}{L_0(1-\alpha )}=\frac{\mu \alpha E_A}{1-\alpha }\sum _{l=1}^{n_r} |f_l|^2. \end{aligned}$$
(2)

Let \(h_q\) be the channel coefficient between PS and q-th reflector of IRS. Let \(g_q\) be the channel coefficient between q-th reflector of IRS and SS. \(h_q\) is a zero mean Gaussian random variable (r.v.) such that \(E(|h_q|^2)=\frac{1}{D_2^{ple}}\) where \(D_2\) is the distance between PS and IRS. \(g_q\) is a zero mean Gaussian r.v. such that \(E(|g_q|^2)=\frac{1}{D_3^{ple}}\) where \(D_3\) is the distance between IRS and SS.

We have \(h_q=a_qe^{-jb_q}\) where \(a_q=|h_q|\) and \(b_q\) is the phase of \(h_q\) such that \(E(a_q)=\frac{\sqrt{\pi }}{2\sqrt{D_2^{ple}}}\) and \(E(a_q^2)=E(|h_q|^2)=\frac{1}{D_2^{ple}}\) [30]. We have \(g_q=c_qe^{-jd_q}\) such that \(E(c_q)=\frac{\sqrt{\pi }}{2\sqrt{D_3^{ple}}}\) and \(E(c_q^2)=E(|g_q|^2)=\frac{1}{D_3^{ple}}\).

The phase of q-th reflector is [1]

$$\begin{aligned} \phi _q=b_q+d_q. \end{aligned}$$
(3)

The received signal SS is written as

$$\begin{aligned} r_p=s_p\sqrt{E_{PS}}\sum _{q=1}^N h_qg_qe^{j\phi _q}+n_p. \end{aligned}$$
(4)

where \(s_p\) is the p-th transmitted symbol, \(n_p\) is a Gaussian noise of variance \(N_0\).

Using (3), we obtain

$$\begin{aligned} r_p=s_p\sqrt{E_{PS}}\sum _{q=1}^N a_qc_q+n_p. \end{aligned}$$
(5)

The Signal to Noise Ratio (SNR) at SS is written as [1]

$$\begin{aligned} \gamma ^{SS}=\frac{E_{PS}}{N_0}[\sum _{q=1}^N a_qc_q]^2, \end{aligned}$$
(6)

Using (2), we obtain

$$\begin{aligned} \gamma ^{SS}=\frac{\mu \alpha E_A}{(1-\alpha )N_0}\sum _{l=1}^{n_r} |f_l|^2[\sum _{q=1}^N a_qc_q]^2, \end{aligned}$$
(7)

For a large number of reflectors (i.e. \(N\ge 8\)) and using the Central Limit Theorem (CLT), \(\sum _{q=1}^N a_qc_q\) follows a Gaussian distribution with mean \(m=\frac{N \pi }{4\sqrt{D_2^{ple}D_3^{ple}}}\) and variance \(\sigma ^2=\frac{N}{D_2^{ple}D_3^{ple}}[1-\frac{\pi ^2}{16}]\). As \([\sum _{q=1}^N a_qc_q]^2\) is non central chi-square r.v. and \(\sum _{l=1}^{n_r} |f_l|^2\) is a central chi-square r.v. Therefore, \(\gamma ^{SS}\) is the product of a non central chi-square r.v. and a central chi-square r.v. The Probability Density Function (PDF) of \(\gamma ^{SS}\) is written as [27]

$$\begin{aligned} p_{\gamma ^{SS}}(x)=\frac{N_0(1-\alpha )e^{-0.5(\frac{m}{\sigma })^2}D_1^{ple}}{\mu \alpha E_A\Gamma (n_r)}\sum _{q=0}^{+\infty }\frac{(\frac{m}{\sigma })^{2q}2^{\frac{-3q-n_r+1.5}{2}}}{q!\Gamma (q+0.5)} \end{aligned}$$
$$\begin{aligned} \times K_{q-n_r+0.5}(\sqrt{\frac{2xD_1^{ple}N_0(1-\alpha )}{\alpha \mu E_A}})(\frac{xD_1^{ple}N_0(1-\alpha )}{\mu \alpha E_A})^{\frac{q+n_r-1.5}{2}} \end{aligned}$$
(8)

We use [28]

$$\begin{aligned} \int _0^{y}\frac{2(CD)^{0.5C+0.5D}}{\Gamma (C)\Gamma (D)}x^{0.5C+0.5D-1}K_{C-D}(2\sqrt{CDx})dx \end{aligned}$$
$$\begin{aligned} =\frac{1}{\Gamma (C)\Gamma (D)}G_{1,3}^{2,1}\left( CDy|\begin{array}{ccc} 1 &{} &{} \\ C, &{} D, &{} 0 \end{array} \right) \end{aligned}$$
(9)

to obtain

$$\begin{aligned} \int _0^{\sqrt{x}}w^{A-1}K_B(w)dw=2^{A-2}G_{1,3}^{2,1}\left( \frac{x}{4}|\begin{array}{ccc} 1 &{} &{} \\ \frac{A+B}{2}, &{} \frac{A-B}{2}, &{} 0 \end{array} \right) \end{aligned}$$
(10)

where \(G_{n,m}^{p,l}(x)\) is the Meijer G-function.

We deduce the Cumulative Distribution Function (CDF) of \(\gamma ^{SS}\):

$$\begin{aligned} P_{\gamma ^{SS}}(x)=\frac{e^{-(\frac{m}{\sqrt{2}\sigma })^2}}{\Gamma (n_r)}\sum _{p=0}^{+\infty }\frac{(\frac{m}{\sigma })^{2p} 2^{-p}}{p!\Gamma (p+0.5)} \end{aligned}$$
$$\begin{aligned} \times G_{1,3}^{2,1}\left( \frac{N_0(1-\alpha )xD_1^{ple}}{2\mu \alpha E_A}|\begin{array}{ccc} 1 &{} &{} \\ p+0.5, &{} n_r, &{} 0 \end{array} \right) \end{aligned}$$
(11)

The detection probability at SS can be approximated by [20]

$$\begin{aligned} P_{d}\ge 1-F_{\gamma ^{SS} }(T^{0}), \end{aligned}$$
(12)

where

$$\begin{aligned} T^{0}=\int _{0}^{+\infty }P_{nd}(x )dx \end{aligned}$$
(13)

\(P_{nd}(x)=1-Q_{K}(\sqrt{2Kx},\sqrt{T})\) is the non detection probability of the energy detector using K samples and threshold T. \(Q_K(x)\) is the Marcum Q-function.

3 Spectrum Sensing Using IRS Used as Transmitter

Figure 2 shows that spectrum sensing can be performed when IRS is employed as a transmitter. IRS is placed at PS. IRS is illuminated using the antenna of primary source PS [1]. Let \(\psi _q\) be the phase of the channel coefficient \(t_q\) between the q-th reflecting element of IRS and SS. We have \(t_q=\rho _q e^{-j \psi _q}\) where \(E(|t_q|^2)=\frac{1}{D_4^{ple}}\) and \(D_4\) is the distance between PS and SS. From [30], we have \(E(\rho _q)=\frac{\sqrt{\pi }}{2\sqrt{D_4^{ple}}}\) and \(E(\rho _q^2)=\frac{1}{D_4^{ple}}\).

Fig. 2
figure 2

Spectrum sensing using IRS is a transmitter

When IRS is deployed as a transmitter, the phase of q-th reflector is written as [1]

$$\begin{aligned} \Phi _q=\psi _q+e_m, \end{aligned}$$
(14)

where \(e_m=\frac{2\pi (m-1)}{M}\), \(m=1,\ldots ,M\) is the phase of transmitted M-Phase Shift Keying symbol.

The received signal at SS is expressed as [1]

$$\begin{aligned} r_p=\sqrt{E_{PS}}\sum _{q=1}^Nt_qe^{j\Phi _q}+n_p=\sqrt{E_{PS}}e^{je_q}\sum _{q=1}^N\rho _q+n_p. \end{aligned}$$
(15)

The SNR at SS is equal to [1]

$$\begin{aligned} \gamma _2^{SS}=\frac{\mu \alpha E_A}{(1-\alpha )N_0}[\sum _{q=1}^N\rho _q ]^2\sum _{l=1}^{n_r} |f_l|^2, \end{aligned}$$
(16)

For a large number of reflectors (\(N\ge 8\)) and using the Central Limit Theorem (CLT), \(\sum _{q=1}^N\rho _q\) follows a Gaussian distribution with mean \(m_2=N\frac{\sqrt{\pi }}{2\sqrt{D_4^{ple}}}\) and variance \(\sigma _2^2=\frac{N(4-\pi )}{4D_4^{ple}}\). The CDF of \(\gamma _2^{SS}\) is given in (11) by replacing \(\frac{m^2}{\sigma ^2}\) by \(\frac{m_2^2}{\sigma _2^2}\). The detection probability is evaluated as (12).

4 Spectrum Sensing Using Two IRS

Figure 3 depicts a system model containing two IRS: \(IRS_1\) is used for increase the harvested energy with \(N_1\) reflectors. \(IRS_1\) is located between A and PS. \(IRS_2\) is located between PS and SS, it contains \(N_2\) reflectors to improve the spectrum sensing process.

Fig. 3
figure 3

Spectrum sensing using two IRS

When \(IRS_1\) is used to increase the harvested energy, the harvested energy is equal to

$$\begin{aligned} E=\mu \alpha L_0 E_A[\sum _{l=1}^{N_1}\delta _l\eta _l]^2, \end{aligned}$$
(17)

where \(\delta _l=|u_l|\), \(u_l\) is channel coefficient between A and l-th reflector of \(IRS_1\) and \(\eta _l=|v_l|\) where \(v_l\) is the channel coefficient between l-th reflector of \(IRS_1\) and PS.

For large values of \(N_1\ge 8\), \([\sum _{l=1}^{N_1}\delta _l\eta _l]\) follows a Gaussian distribution with mean \(m_3=\frac{N_1\pi }{4\sqrt{D_5^{ple}D_6^{ple}}}\) and variance \(\sigma _3^2=\frac{N_1}{D_5^{ple}D_6^{ple}}\). \(D_5\) is the distance between A and \(IRS_1\) and \(D_6\) is the distance between \(IRS_1\) and PS.

We can write the transmitted energy per symbol of PS as E given in (17) divided by the number of transmitted symbols (\(L_0(1-\alpha )\))

$$\begin{aligned} E_{PS}=\frac{E}{L_0(1-\alpha )}=\frac{\mu \alpha E_A [\sum _{l=1}^{N_1}\delta _l\eta _l]^2}{1-\alpha } \end{aligned}$$
(18)

The SNR at SS is equal to

$$\begin{aligned} \gamma _3^{SS}=\frac{E_{PS}[\sum _{q=1}^{N_2} a_qc_q]^2}{N_0} \end{aligned}$$
$$\begin{aligned} =\frac{\mu \alpha E_A}{N_0(1-\alpha )}[\sum _{l=1}^{N_1}\delta _l\eta _l]^2[\sum _{q=1}^{N_2} a_qc_q]^2. \end{aligned}$$
(19)

where \(a_q\), \(c_q\) were defined in Sect. 2 and \(N_2\) is the number of reflectors of \(IRS_2\).

As \([\sum _{l=1}^{N_1}\delta _l\eta _l]^2\) and \([\sum _{q=1}^{N_2} a_qc_q]^2\) are two non central chi-square r.v., \(\gamma ^{SS}_3\) is the product of two non central chi-square r.v. The PDF of \(\gamma ^{SS}_3\) is written as [27]

$$\begin{aligned} f_{\gamma ^{SS}_3}(z)=e^{-\frac{m_3^2}{2\sigma _3^2} -\frac{m_4^2}{2\sigma _4^2}}\sum _{n=0}^{+\infty }\sum _{p=0}^{+\infty } \frac{2^{-2n-2p}(\frac{m_3}{\sigma _3})^{2p}(\frac{m_4}{\sigma _4})^{2n}}{n!p!\Gamma (n+0.5)\Gamma (p+0.5)} \end{aligned}$$
$$\begin{aligned} \times \frac{N_0(1-\alpha )}{\mu \alpha E_A}K_{p-n}(\sqrt{\frac{N_0(1-\alpha )z}{\mu \alpha E_A}})(z\frac{N_0(1-\alpha )}{\mu \alpha E_A})^{\frac{p+n-1}{2}} \end{aligned}$$
(20)

Using (10), the CDF of \(\gamma ^{SS}_3\) is expressed as

$$\begin{aligned} P_{\gamma ^{SS}_3}(z)=e^{-\frac{m_3^2}{2\sigma _3^2}-\frac{m_4^2}{2\sigma _4^2}} \sum _{n=0}^{+\infty }\sum _{p=0}^{+\infty }\frac{2^{-n-p}(\frac{m_3}{2\sigma _3})^{2p} (\frac{m_4}{2\sigma _4})^{2n}}{n!p!\Gamma (n+0.5)\Gamma (p+0.5)} \end{aligned}$$
$$\begin{aligned} \times G_{1,3}^{2,1}\left( \frac{N_0(1-\alpha )z}{\mu \alpha E_A4}|\begin{array}{ccc} 1 &{} &{} \\ p+0.5, &{} n+0.5, &{} 0 \end{array} \right) \end{aligned}$$
(21)

where \(m_4=\frac{N_2^2 \pi }{4\sqrt{D_2^{ple}D_3^{ple}}}\), \(\sigma _4^2=\frac{N_2^2}{D_2^{ple}D_3^{ple}}[1-\frac{\pi ^2}{16}]\).

The detection probability is computed using (12) and (21).

5 Numerical Results

Figure 4 depicts the detection probability at SS using the energy detector over \(K=10\) samples with threshold \(T=1\) for \(\mu =0.5\). IRS is employed as a reflector, \(ple=3\) and the distances between nodes are \(D_1=1.5\), \(D_2=1.3\), \(D_3=1.2\). When there are \(N=8,16\) reflectors and \(n_r=2\), spectrum sensing using IRS offers 15 and 21 dB gain when compared to spectrum sensing without IRS [20]. When energy harvesting uses \(n_r=3\) antennas, spectrum sensing using IRS equipped with \(N=32\) reflectors offers 27 dB and 30 gain when compared to spectrum sensing without IRS for a number of antennas \(n_r=2\) and 3 [20]. In [20], spectrum sensing does not use IRS. Besides, IRS were not used to enhance the energy harvesting process in [20].

Fig. 4
figure 4

Detection probability when IRS is deployed as a reflector

For the same parameters as Fig. 4, Fig. 5 depicts the detection probability with IRS employed as a transmitter. The distance between PS and SS is \(D_4=2.5\). When there are \(N=8, 16, 32\) reflectors and \(n_r=2\), spectrum sensing using IRS offers 16, 22 and 28 dB gain when compared to spectrum sensing without IRS [20].

Fig. 5
figure 5

Detection probability when IRS is deployed as a transmitter

Figure 6 shows that the use of two IRS with \(N_1=N_2=8\) reflectors offers 30 dB and 8 dB gain when compared to spectrum sensing without IRS and a single IRS. The distance between A and \(IRS_1\) is \(D_5\) and the distance between \(IRS_1\) and PS is \(D_6=1.5\). The other parameters are the same as Fig. 4.

Fig. 6
figure 6

Detection probability when IRS is used in energy harvesting and spectrum sensing: \(N_1=N_2=8\)

Figure 7 depicts the throughput at Primary Destination PD computed as

$$\begin{aligned} Thr_{PD}=P_A(1-\alpha ) [1-PEP_{PD}]log_2(Q) \end{aligned}$$
(22)

where Q is the size of the constellation size, \(P_A\) is the probability that PS is active, \(PEP_{PD}\) is the Packet Error Probability (PEP) at PD [29]

$$\begin{aligned} PEP_{PD}\le F_{\gamma ^{PD}}(W_0), \end{aligned}$$
(23)

\(F_{\gamma ^{PD}}(x)\) is the CDF of SNR \(\gamma ^{PD}\) at PD, expressed as (11) and (21) when there is a single IRS and two IRS, and \(W_0\) is a waterfall threshold computed as [29]

$$\begin{aligned} W_0=\int _0^{+\infty }[1-SEP(w)]^{PL}dw \end{aligned}$$
(24)

SEP(w) is the Symbol Error Probability for (Q-QAM) [30]

$$\begin{aligned} SEP(w)=2\left(1-\frac{1}{\sqrt{Q}}\right)erfc\left(\sqrt{\frac{3w}{Q-1}}\right) \end{aligned}$$
(25)

and \(PL=500\) is packet length.

Figure 7 shows that the use of \(N=8, 16, 32\) reflectors offers 16, 22 and 28 dB gain when compared to conventional systems without IRS. The probability that PS is active is \(P_A=0.4\). The use of two IRS with \(N_1=N_2=8\) reflectors offers 35 dB gain when compared to previous research results [20]. We also improved the throughput by optimizing the harvesting duration \(\alpha\).

Fig. 7
figure 7

Throughput in the primary network for 64QAM modulation: \(P_a=0.4\)

Figure 8 depicts the secondary throughput at Secondary Destination (SD) for 64QAM modulation:

$$\begin{aligned} Thr_{SD}=[1-P_A][1-P_F](1-\alpha ) [1-PEP_{SD}]log_2(Q) \end{aligned}$$
(26)

where \(P_F\) is the false alarm probability, \(PEP_{SD}\) is the PEP at SD approximated by [29]

$$\begin{aligned} PEP_{SD}\le F_{\gamma ^{SD}}(W_0), \end{aligned}$$
(27)

\(F_{\gamma ^{SD}}(x)\) is the CDF of SNR \(\gamma ^{SD}\) at SD computed as (11) and (21). Figure 8 shows that the use of a single IRS with \(N=8, 16, 32\) reflectors offers 16, 22, 28 dB gain when compared to the absence of IRS. When we use 2 IRS with 8 reflectors, there is 35 dB gain when compared to the absence of IRS [20].

Fig. 8
figure 8

Throughput in secondary network for 64QAM modulation: \(P_a=0.4\)

6 Conclusions and Perspectives

In this paper, we suggested the use of Intelligent Reflecting Surfaces to improve the spectrum sensing process when the PS harvests energy on \(n_r\) receive antennas. IRS is located between PS and Secondary Source SS so that all reflections have a null phase at SS where the spectrum sensing process is performed. When there are \(N=8,16\) reflectors and \(n_r=2\) antennas, spectrum sensing using IRS offers 15 and 21 dB gain when compared to spectrum sensing without IRS [20]. Spectrum sensing using IRS equipped with \(N=32\) reflectors offers 27 dB and 30 dB gain when compared to spectrum sensing without IRS for a number of antennas \(n_r=2\) and 3 [20]. We also suggested the use of IRS to increase the harvested energy and improve the spectrum sensing process. The use of two IRS with \(N_1=N_2=8\) reflectors offers 30 dB and 8 dB gain when compared to spectrum sensing without IRS and a single IRS. We also derived the primary and secondary throughput of CRN (Cognitive Radio Networks) with energy harvesting and using IRS. As a perspective, we can study other sources of energy such as solar or wind.