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

Can't reach codeword indexes at CodebookBeamforming #253

Closed lhupalo closed 1 year ago

lhupalo commented 1 year ago

Hello there!

I'm working with the codebook beamforming method, and my main goal is to get the codeword index both for UE and gNB, at a certain time. Ex.: (1, 20) at t = 0.123. I have a question.

I'm trying to solve my problem by creating a global structure that will contain the information and a function that will be scheduled over time that do something with these beam indexes.

But after all, I can't get these information. My codebook beamforming method is configured this way:

Ptr<MmWaveHelper> mmwaveHelper = CreateObject<MmWaveHelper> ();

mmwaveHelper->SetChannelConditionModelType ("ns3::BuildingsChannelConditionModel");

// select the beamforming model
mmwaveHelper->SetBeamformingModelType("ns3::MmWaveCodebookBeamforming");

// configure the UE antennas:
// 1. specify the path of the file containing the codebook
mmwaveHelper->SetUeBeamformingCodebookAttribute ("CodebookFilename", StringValue ("/home/luiz/tarballs/mmwave/src/mmwave/model/Codebooks/1x2.txt"));
// 2. set the antenna dimensions
mmwaveHelper->SetUePhasedArrayModelAttribute ("NumRows", UintegerValue (1));
mmwaveHelper->SetUePhasedArrayModelAttribute ("NumColumns", UintegerValue (2));

// configure the BS antennas:
// 1. specify the path of the file containing the codebook
mmwaveHelper->SetEnbBeamformingCodebookAttribute ("CodebookFilename", StringValue ("/home/luiz/tarballs/mmwave/src/mmwave/model/Codebooks/8x8.txt"));
mmwaveHelper->SetEnbPhasedArrayModelAttribute ("NumRows", UintegerValue (8));
// 2. set the antenna dimensions
mmwaveHelper->SetEnbPhasedArrayModelAttribute ("NumColumns", UintegerValue (8));

The problem that I am facing is: it seems that I am not able to reach the BeamformingCodebook information, I am getting "attempt to dereference zero pointer" message. For example:

// Get Codebook size for both UE and gNB
  int ueCBsize = ueDev.Get(0)->GetNode()->GetObject<PhasedArrayModel>()->GetObject<BeamformingCodebook>()->GetCodebookSize();

Could it be that the mmwaveHelper netDevice is different than the netDevice that i'm trying to get the information? I tried to look internally but can't find anything.

By accessing the codebook, the codebook sizes and the current beamforming vectors of the devices at specific timestep, then I can easily find which beam index are under use. It was the only way I could think of to solve it....

Could you please give me some light?

Thank you!

lhupalo commented 1 year ago

Hello guys,

To resume, I can't access some objects with the following syntax: ueDev.Get(0)->GetNode()->GetObject<>()

I have checked and the internal mmwaveHelper UE NetDevice is the same of that I'm trying to find the beamforming model.

Every time that I try to find the BeamformingModel object, it returns a null pointer.

Examples:

And so on. Could you help me please?

BR

pagmatt commented 1 year ago

Hi, Can you please be more specific in terms of what you are trying to do with the beam indexes?

lhupalo commented 1 year ago

Hi Matteo,

We are studying how a ML model trained to find the best beam pair indexes would behave within ns-3 in comparison with the exhaustive search technique implemented on mmwave. This way, we need the beam indexes at every period to build a dataset and later train and evaluate the model.

pagmatt commented 1 year ago

If my understanding is correct, you wish to obtain a beam indexes dataset to train offline a ML model which you would then later import and evaluate in ns-3 ? Would it suffice in this case to log the indexes used by each user in a text file ?

lhupalo commented 1 year ago

For now, yes. But, beacuse I'm using the ns3-gym module integration the beam index variables are inaccessible to me. Later on, I will also have to change these indexes in simulation time to evaluate the accuracy of the models (or, even to use RL).

I think that the way is creating one setter and one getter to the beam indexes. And the setter would only work if the beamforming vectors are never updated by the algorithm (UpdateTime = 0). Does it make sense?

pagmatt commented 1 year ago

Later on, I will also have to change these indexes in simulation time to evaluate the accuracy of the models (or, even to use RL).

Got it, then you definitely need something different than a simple log.

I propose to continue this discussion on a separate thread (you can reach me by email at matteo.pagin.1@phd.unipd.it ) so that we can discuss separately how we can collaborate on this