nyuwireless-unipd / ns3-mmwave

ns-3 module for simulating mmWave-based cellular systems. See https://ieeexplore.ieee.org/document/8344116/ (open access) as a reference.
GNU General Public License v2.0
292 stars 190 forks source link

Codebook beamforming algorithm #251

Closed lhupalo closed 1 year ago

lhupalo commented 1 year ago

Hi there,

I am using the mmwave module to perform beamforming simulations. I have introduced mobility but the algorithm implemented on MmWaveCodebookBeamforming::SetBeamformingVectorForDevice on mmwave-beamforming-model.cc is presenting quite strange results. There is two problems that I am facing:

  1. The beams indexes chosen on the algorithm are not distributed by the lobes. I mean, if the UE is in position x = 0 and y = 10, he will get a beam pair index like (1, 10), for example. In the same direction, if the UE is in position x = 0 and y = 20 the beam bair index is different, but why if the two positions are in the same direction?

  2. The beams indexes are not updating as the UE moves, even when I assigned 10ms to the attribute UpdatePeriod in MmWaveCodebookBeamforming class. The UE is not moving too fast to not be assigned with best beams. See the image below please image

Hope you could help us,

Best regards

pagmatt commented 1 year ago

Hi,

Regarding 1), I am not sure what you mean. If the channel is in LOS the beam should be consistent with the location in space of the users. Please note that this is not necessarily the case whenever the link is NLOS, as in that case there is no dominant component of the multipath which is along the geometric direction of TX and RX. Can you elaborate further please ?

In terms of 2), you need to set the UpdatePeriod of the ThreeGppChannelModel to a lower period as well. Otherwise, the channel matrix remains constant and it does not reflect the changes in the angle of arrivals and departure as you would expect, In turn, the resulting beam pairs will also remain the same.

Best, Matteo

mattia-lecci commented 1 year ago

Hi,

Regarding 1), this behavior could also be due to the 3D geometry of the problem. It is possible that with the UE in position (0, 10), the chosen beam is pointing slightly downward, whereas when the UE is in position (0, 20), the chosen beam is pointing slightly less downward.

You could verify this with some edge cases, e.g.,

Hope this helps, Best, Mattia

lhupalo commented 1 year ago

Hi,

First of all, thank you, Mattia. The first question was solved, it was really the elevation that I was not taking into account.

Regarding 2), about the Update, I understood the approach proposed by Matteo. I have assigned 10ms to the beamforming update and 1 ms to the channel update, but if you allow me to have another question related to the Codebook Beamforming algorithm structure, would help me a lot.

After reading all the papers and presentations availabe related to mmwave module, and examined the code, I guess that the codebook beamforming algorithm is something like a beam search with the following steps:

  1. For each beam it is evaluated the Average Received Power Spectral Density (AvgPsd), and stored
  2. Inside a for loop, the best beam pair indexes will be chosen to maximize the AvgPsd
  3. The beamforming vectors to transmission will be assigned according to the indexes found in step 2

Can you confirm this behavior? I got a little confused because when the power matrix is evaluated inside the method MmWaveCodebookBeamforming::ComputeBeamformingCodebookMatrix it was not clear to me the use of the codewords to evaluate each rxAvgPsd for each beam index. I suppose that happens behind the SpectrumValue instance, but really don't know.

Thank you very much for your attention!

BR

pagmatt commented 1 year ago

Yes, your understanding is correct. Every MmWaveCodebookBeamforming::UpdatePeriod the beamforming vectors to be used for a given TX and RX pair are estimated by:

  1. Trying all combinations of codewords from a predefined codebooks
  2. Computing the resulting PSD for each of them (inside the function ComputeBeamformingCodebookMatrix)
  3. Finally, picking the pair of TX and RX beamforming vectors yielding the PSD with the highest power (thus, the highest SINR as well).
lhupalo commented 1 year ago

But could you point me please how the codewords enter into the evaluation of PSD? The code below is from MmWaveCodebookBeamforming::ComputeBeamformingCodebookMatrix. The codewords are set but seems to be not used... then this matrix is used in MmWaveCodebookBeamforming::SetBeamformingVectorForDevice to select the best pair that maximize the SNR

      for (uint32_t thisIdx = 0; thisIdx < thisCodebook->GetCodebookSize (); thisIdx++)
        {
          m_antenna->SetBeamformingVector (thisCodebook->GetCodeword (thisIdx));

          for (uint32_t otherIdx = 0; otherIdx < otherCodebook->GetCodebookSize (); otherIdx++)
            {
              otherAntenna->SetBeamformingVector (otherCodebook->GetCodeword (otherIdx));

              Ptr<SpectrumValue> rxPsd = m_splm->CalcRxPowerSpectralDensity (m_txPsd, thisMob, otherMob);
              double avgRxPsd = Sum (*rxPsd) / (rxPsd->GetSpectrumModel ()->GetNumBands ());
              matrix[thisIdx].push_back (avgRxPsd);
            }
        }
pagmatt commented 1 year ago

The codewords are retrieved in the class ThreeGppSpectrumPropagationLossModel: https://github.com/nyuwireless-unipd/ns3-mmwave/blob/3dc2fddfbbccc6b8c338a33da80308df516c4ed6/src/spectrum/model/three-gpp-spectrum-propagation-loss-model.cc#L324