Skip to main content
. 2017 Sep 6;17(9):2038. doi: 10.3390/s17092038
Algorithm 2 Recursive algorithm to calculate the received signal strength at the receiver from each element in the environment.
  • 1:

    function h_func_aoa(h,tx,rx,s,sant,P,d,ki,k)

  • 2:

          if k==ki then                                             ▹ Source is TX

  • 3:

                 if ki==0 then                                       ▹ Receiver is RX

  • 4:

                        Calculate [ω, γ, drs] from (tx, rx) with (9)–(11)

  • 5:

                        Calculate signal strength Prs with (8) substituting Ps for P

  • 6:

                        if γ < FoV then

  • 7:

                              hLOS=Prs

  • 8:

                        end if

  • 9:

                 else                            ▹ Received signal strength at all points from TX

  • 10:

                        for i from 1 to N do

  • 11:

                             Calculate [ω, γ, drs] from tx,i with (9)–(11) substituting rx for the i element

  • 12:

                             Calculate signal strength Prs with (8) substituting rx for the i element and Ps for P

  • 13:

                             h_func_aoa(h,tx,rx,i,tx,Prs,d+drs,ki-1,k)

  • 14:

                        end for

  • 15:

                 end if

  • 16:

          else                                              ▹ Source is not TX

  • 17:

                 if ki==0 then                                     ▹ Receiver is RX

  • 18:

                        Calculate [α,dnm,γ, θ, ϕ] from (sant,s,rx) with (17)–(20), (23) substituting n=rx, m=s and l=sant

  • 19:

                        Calculate signal strength Pnml with (14) substituting Pml for P

  • 20:

                        if α < FoV then

  • 21:

                        h(si)=h(si)+Pnml

  • 22:

                        end if

  • 23:

                 else                         ▹ Received signal strength at all points from TX

  • 24:

                        for i from 1 to N do

  • 25:

                        Calculate [α,dnm,γ,θ,ϕ] from sant,s,i with (17)–(20), (23) substituting n=i, m=s and l=sant

  • 26:

                        Calculate signal strength Pnml with (14) substituting Pml for P

  • 27:

                        h_func_aoa(h,tx,rx,i,s,Pnml,d+dnm,ki-1,k)

  • 28:

                        end for

  • 29:

                 end if

  • 30:

          end if

  • 31:

    end function