Unable to access CalcRxPower()!

142 views
Skip to first unread message

Asrat Beyene

unread,
Aug 9, 2017, 9:31:24 AM8/9/17
to ns-3-users
Dear All,

Why I am getting the errors attached in the .txt file when trying to access the method


                               ppp->CalcRxPower(TxPwr, mbptr0, mbptr1);


which is defined inside PropagationLossModel class using the appropriate smart pointer as

                               Ptr<PropagationLossModel>  ppp = c.Get(0)->GetObject<PropagationLossModel>(); ?

Regards,

Asrat
wifi-adhoc-03-qos-cvmm.cc
wifiadhoc03qoscvmm02.txt

Konstantinos

unread,
Aug 9, 2017, 9:48:46 AM8/9/17
to ns-3-users
Hi,

There are several issues with your code and I do not really understand why you want to call this method at that point in the scenario.

1) The error is not in the method to calculate the RxPower, but how you try to access the propagation model
Ptr<PropagationLossModel> ppp = c.Get(0)->GetObject<PropagationLossModel>();

The object is NOT aggregated to the node, hence you can not call GetObject on the node to access it. 
If you simply want to test the propagation, you can use the example in /src/propagation/examples/main-propagation-loss.cc

2) You call this calculation only once before the simulation has actually started.
However, your node is moving, hence the distance will change and the RxPower with it.

3) You can simply use the trace sources provided with the PHY to record the RxPower of each received packet. 

Asrat Beyene

unread,
Aug 10, 2017, 11:11:31 AM8/10/17
to ns-3-...@googlegroups.com
Dear Konstantinos,

Thanks for the detailed reply.

First the code is just a testing program not the main program I am working on.

1) Yes it is aggregated by the statement on line 162 which is
          wifiPhy.SetChannel (wifiChannel.Create ());
What I am trying to do is access the instantaneous RxPwr of the channel as you said in reply 2) changes with the node's position. Based that I am going to make decisions for further processing of packets.
2) Do you mean I can not access the RxPwr unless the simulation is started? As I told you while the simulation is running i.e the node is moving where its RSSI changes too so that I will decide to use it or avoid it. That means if RSSI is good enough like -67dBm and better I will use it to transfer real-time traffic otherwise I will do something else.

3) Does that fulfil my need? Can I make decisions based on RxPwr after each packet is received? Definitely NO! I want to check the channel quality just before sending a packet through it!

I think you can understood what I am trying to achieve! And, provide me with suggestions and possibilities, as usual!

Regards,

Asrat



--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+unsubscribe@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Konstantinos

unread,
Aug 11, 2017, 4:21:05 AM8/11/17
to ns-3-users
Hi,

See comments inline.

On Thursday, August 10, 2017 at 4:11:31 PM UTC+1, Asrat Beyene wrote:
Dear Konstantinos,

Thanks for the detailed reply.

First the code is just a testing program not the main program I am working on.

1) Yes it is aggregated by the statement on line 162 which is
          wifiPhy.SetChannel (wifiChannel.Create ());

No, it is not aggregated on the node. 
See the definition of aggregation in the manual https://www.nsnam.org/docs/manual/html/object-model.html#aggregation
And, I do not say that you need to aggregate it. 
It is by design as such. As you can see, the channel, which holds the Propagation model, is set to the Phy object, not the node.
 
What I am trying to do is access the instantaneous RxPwr of the channel as you said in reply 2) changes with the node's position. Based that I am going to make decisions for further processing of packets.  
2) Do you mean I can not access the RxPwr unless the simulation is started? As I told you while the simulation is running i.e the node is moving where its RSSI changes too so that I will decide to use it or avoid it. That means if RSSI is good enough like -67dBm and better I will use it to transfer real-time traffic otherwise I will do something else.

You can access it, but it will be for t=-0, not considering the movement. The nodes will start moving after the simulation has started.
 

3) Does that fulfil my need? Can I make decisions based on RxPwr after each packet is received? Definitely NO! I want to check the channel quality just before sending a packet through it!


I understand what you want to achieve here, but you need also to understand what RxPwr is. RxPwr is the received power, i.e. you have already received something.
That's because RxPwr and especially, SNIR which in turn dictates reception or not, is not only a function of distance and Tx power.
You could estimate the RxPwr if you know (or estimate) the location of the other node and the Tx power, something you tried to do here.
But that estimation can be done simply with some maths, no need to get a pointer to the Propagation Loss model instantiated for the node. Simply create a new object as in the example in /src/propagation/examples/main-propagation-loss.cc

Even in LTE systems, when there is CSI (channel state information) and is used for scheduling, handover etc, there are some 'pilot signals' of specific messages that are transfered based on which the channel is evaluated. 

In your case you could record the RxPwr using the trace source and keep monitoring that. Then you could analyse its trend and if you see that it is dropping below a certain threshold, you could assume that the following packets would be also below that threshold, hence take the action you need.

Asrat Beyene

unread,
Aug 11, 2017, 6:54:38 AM8/11/17
to ns-3-...@googlegroups.com
Dear Konstantinos,

Your explanation is really helpful. Thanks.

Asrat


Reply all
Reply to author
Forward
0 new messages