Underwater Communication with UAN Framework

95 views
Skip to first unread message

Gabriel Garcia

unread,
Jul 10, 2017, 6:41:53 AM7/10/17
to ns-3-users
Hi everyone,

I am begginer in ns3 and I have implemented a simple underwater acoustic ;MAC communication scenario in which my nodes are suppose to send and receive packages while they are moving underwater. To do so, I have used the UAN framework but the results were not what I expected.

My first goal is to send packages from one node to another specific node and receive them properly. However, my nodes always broadcast to all neighbours instead to the specific one that I want to. I think this happens because by default, the MAC addresses of all UanNetDevices are set to 255 (Broadcast address) when they are created. I have unsuccessfully tried to set this MAC address to be a different number so I don't know what else I can do.

This is how I have tried to modify the MAC address of each device when they are created:

Ptr<UanNetDevice> dev = CreateObject<UanNetDevice> ();
Ptr<UanMacAloha> mac = CreateObject<UanMacAloha> ();
mac->SetAddress(UanAddress::Allocate());
dev->SetMac(mac);

And this is how I send the a packet to the destination node:

Ptr<Packet> pkt = Create<Packet> (m_packetSize);
dev->Send (pkt, address, 0);

where address is a parameter defined as Address address = dev->GetAddress();

Could anyone please suggest me how can I try to fix this so I can send a packet from one UanNetDevice to another UanNetDevice chosen by its address??

Thanks in advance.

Gabriel





Narges Mehran

unread,
Jul 18, 2017, 2:43:07 PM7/18/17
to ns-3-users
Hello Gabriel,

I think in "UanMacAloha::Enqueue " function you can change the address and limit the destination.
But how did actually you set the PHY layer?

Gabriel Garcia

unread,
Jul 20, 2017, 4:47:51 AM7/20/17
to ns-3-users
Hi Narges,

thank you a lot for your reply. I had set the PHY layer but I had not included it in the post because I though with the MAC explanation was enough. The code is working now, the unique problem I had it was how I was calling the method "ConvertFrom" to get the UanAddress from the device Address. I was obtaining always 255 as UanAddress instead the correct value that my devices really got.

In case someone has the same problem this is how "ConvertFrom" should be used and everything is working as expected now.

UanAddress uAddr = UanAddress::ConvertFrom(dev->GetAddress());

Regards
Reply all
Reply to author
Forward
0 new messages