Hello All,
I am using MatrixPropagationLossModel binding with the wifi channel to set the channel loss. The code below is for setting the Loss Model binding with the wifi channel.
```c++
//Create propagation loss matrix
Ptr<MatrixPropagationLossModel> lossModel = CreateObject<MatrixPropagationLossModel>();
lossModel->SetDefaultLoss(10); // set default loss to 200 dB (no link)
wifiChannel->SetPropagationLossModel(lossModel);
wifiChannel->SetPropagationDelayModel(CreateObject<ConstantSpeedPropagationDelayModel>());
wifiPhy.SetChannel(wifiChannel);
```
But, I want to change the loss during runtime.
I created a Schedule to make changes. However, I found below code does not work during runtime. How could I change the loss during runtime?
```c++
Simulator::Schedule(Seconds(2.0), &setLoss);
```
```c++
static void setLoss() {
std::cout << "Function called at " << Simulator::Now().GetSeconds() << " seconds" << std::endl;
// set symmetric loss 0 <-> 1 to 200 dB (no link)
lossModel->SetLoss(UAVs.Get(0)->GetObject<MobilityModel>(),
UAVs.Get(1)->GetObject<MobilityModel>(),
200, true);
wifiChannel->SetPropagationLossModel(lossModel);
wifiPhy.SetChannel(wifiChannel);
return;
}
```
Anyone know how to change channel loss during runtime?
Thanks for your helps,
Boyang