Hi all,
I have ported some propagation loss models in NS-3 from an old release, but I have some issues with it. A note here is that in previous releases I did not have similar issues (I had tested this code back in ns-3.15).
The structure is that there is an abstract class that inherits PropagationLossModel (called WinnerLossModel) and then several others that inherit from that WinnerLossModel and implement specific models.
When I run a scenario with the use of one of these models, I get a segmentation error.
The model is instantiated as such, where WinnerB1LossModel is one of the derived classes of WinnerLossModel.
wifiChannel.AddPropagationLoss("ns3::WinnerB1LossModel",
"Frequency", DoubleValue(5.9e9),
"EffEnvironmentHeight", DoubleValue(1),
"VisibilityModel", PointerValue(&vis),
"ShadowingModel", PointerValue(&shadow));
I tracked it down to the PropagationLossModel::CalcRxPower()
Thread [1] (Suspended : Signal : EXC_BAD_ACCESS:Could not access memory)
ns3::WinnerLossModel::DoCalcRxPower() at 0x10384c356
ns3::PropagationLossModel::CalcRxPower() at propagation-loss-model.cc:76 0x1038bf5b9
ns3::YansWifiChannel::Send() at yans-wifi-channel.cc:96 0x103341e91
ns3::YansWifiPhy::SendPacket() at yans-wifi-phy.cc:579 0x10333356c
double
PropagationLossModel::CalcRxPower (double txPowerDbm,
Ptr<MobilityModel> a,
Ptr<MobilityModel> b) const
{
double self = DoCalcRxPower (txPowerDbm, a, b);
...
The issue there is that both mobility pointers are 0.
In the previous step (YansWifiChannel::Send()) which callz the CalcRxPower, the pointers are passed correctly.
Any idea why this may happen? Could it be due to the 'abstract' class of WinnerLossModel?
The only difference I have noticed with other propagation loss models is that in the TypeId, the others define a constructor, but I can not do such thing since it is an abstract class.
Could it be some other change in the API that I am not aware at this moment?
Regards,
K.