Issue with custom propagation loss model

153 views
Skip to first unread message

Konstantinos

unread,
May 3, 2014, 8:01:21 AM5/3/14
to ns-3-...@googlegroups.com
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.

Konstantinos

unread,
May 3, 2014, 10:46:04 AM5/3/14
to ns-3-...@googlegroups.com
Even when I convert WinnerLossModel from abstract to a 'normal' class, I still get the two mobilities as 0.
I have verified that all nodes have mobilities (printed their position at t=0), so I still can't understand what's wrong here.

Konstantinos

unread,
May 3, 2014, 3:56:25 PM5/3/14
to ns-3-...@googlegroups.com
The problem was not related to PropagationLoss model itself, but in another class that it was used inside and not properly instantiated and it was giving the null pointer.  
The mobility pointers were shown as 0 in Eclipse debugger, which potentially is a bug in Eclipse and its linker (in MacOSX 10.9).

Hassan

unread,
Dec 6, 2014, 10:44:41 PM12/6/14
to ns-3-...@googlegroups.com
I am also looking into creating a custom propagation loss model. I have somewhat of a simple question regarding the txPowerDbm input variable for CalcRxPower. Is this variable related to the TxPowerStart wifiPhy attribute? If not, it looks like I'am not understanding where it comes from. I was looking for where CalcRxPower gets referenced so I can see what is being passed for txPowerDbm but couldn't find where that is. I may be just missing something.
Reply all
Reply to author
Forward
0 new messages