GithubHelp home page GithubHelp logo

Comments (24)

DvdMgr avatar DvdMgr commented on September 4, 2024 1

Hi! Can you fork the lorawan repository and upload these changes to a branch on your own fork? This would make it significantly easier for me to check out your changes!

from lorawan.

DvdMgr avatar DvdMgr commented on September 4, 2024

Hi!
To get the address of the recipient ED from a DL packet, you can follow these steps:

  • Make a copy of the packet (packets are usually const, so you can only work on copies)
  • De-serialize the Mac and Frame headers
  • Get the Address field of the Frame header

In short, this can be accomplished with this code:

  LoraMacHeader mHdr;
  LoraFrameHeader fHdr;
  fHdr.SetAsDownlink ();
  Ptr<Packet> myPacket = packet->Copy ();
  myPacket->RemoveHeader (mHdr);
  myPacket->RemoveHeader (fHdr);
  LoraDeviceAddress address = fHdr.GetAddress ();

As for identifying reply packet and request packet pairs, you can try matching sender addresses with the address you find with the code above.

from lorawan.

Fundoprajakta avatar Fundoprajakta commented on September 4, 2024

Hello !

Thanks for replying to the query. I will try this and respond to you.

I would like to know one more.
The packet tracker m_packettracker defined in lora-packetracker.cc/h contains all packets? Both downlink packets and uplink packets?

from lorawan.

DvdMgr avatar DvdMgr commented on September 4, 2024

The packet tracker only saves the uplink packets. The LoraPacketTracker::m_reTransmissionTracker structure, however, contains a flag indicating success of MAC packets, based on whether an ACK was correctly received in at least one of the transmission attempts.

from lorawan.

Fundoprajakta avatar Fundoprajakta commented on September 4, 2024

The idea is to get ratio of number of downlink packets sent by network server to number of packets received by end devices.
m_reTramsmissionTracker can be helpful in this goal?

from lorawan.

DvdMgr avatar DvdMgr commented on September 4, 2024

If you want PHY level statistics, I think you are better off connecting to the trace sources, and keeping the count yourself. For instance, you can connect to the StartSending trace source at the GWs, and to the ReceivedPacket trace source at the EDs. Both trace sources are provided by the LoraPhy class, which is the base for both SimpleGatewayLoraPhy and SimpleEndDeviceLoraPhy. Once you hook those trace sources to your functions, you can update your own counters and get the ratio you need at the end of the simulation.

from lorawan.

Fundoprajakta avatar Fundoprajakta commented on September 4, 2024

Hello,
I tried to create a PhyPacketData similar to m_packetTracker to record downlink packet.
Unfortunately it is not recording any packets.
below is the short code. Please let me know where I am making mistake.

`void
LoraPacketTracker::TransmissionCallbackDownlink (Ptr packet, uint32_t gwId)
{
Ptr packetCopy = packet->Copy ();
LoraMacHeader mHdr;
packetCopy->RemoveHeader (mHdr);
if (!mHdr.IsUplink ())
{
NS_LOG_INFO ("PHY packet " << packet
<< " was transmitted by gateway "
<< gwId);
// Create a packetStatus
PacketStatusDownlink status;
status.packetDownlink = packet;
status.Downlink= Simulator::Now ();
status.senderIdDownlink = gwId;

  m_packetTrackerDownlink.insert (std::pair<Ptr<Packet const>, PacketStatusDownlink> (packet, status));
}

}`

P.S : I also connected StartSending Trace source in lora-helper.cc which directs to call back TransmissionCallbackDownlink().

Thanks

from lorawan.

Fundoprajakta avatar Fundoprajakta commented on September 4, 2024

Hello!
Sure! I will do this now.
Also I created a method to calculate PER for each node.
I would appreciate, if you have a look on it and provide feedback.
It works fine for my purpose.

from lorawan.

Fundoprajakta avatar Fundoprajakta commented on September 4, 2024

Hello!
I have forked the lorawan repository and uploaded the changes.
Please check the adr branch : lora-helper.cc/h and lora-packet-tracker.cc/h file and let me know your feedback.

Thanks!

from lorawan.

DvdMgr avatar DvdMgr commented on September 4, 2024

I'm sorry for the delay - I now have some time to check this out, is this still an issue?

from lorawan.

Fundoprajakta avatar Fundoprajakta commented on September 4, 2024

Hello Thanks for responding. Yes I am still working to capture downlink packets

from lorawan.

DvdMgr avatar DvdMgr commented on September 4, 2024

I checked out the code on your adr branch and it doesn't seem to compile - can you confirm this?

from lorawan.

Fundoprajakta avatar Fundoprajakta commented on September 4, 2024

from lorawan.

Fundoprajakta avatar Fundoprajakta commented on September 4, 2024

Hello,
I checked the repository and corrected my error.
I tried to run it again and it is comping now.

At the end of the complete-network-example.cc , include a line to see if the function for tracking downlink packet is working. It is still not working. It is displaying tracker size 0.

below is picture
image

Thanks

from lorawan.

DvdMgr avatar DvdMgr commented on September 4, 2024

It looks like the EDs in your simulation weren't requesting ACKs, so no DL messages were being sent by the GW! Adding the following line in the simulation script seems to fix the issue:

Config::SetDefault ("ns3::EndDeviceLoraMac::MType", EnumValue(LoraMacHeader::CONFIRMED_DATA_UP));

Also, I had to correct line 147 in the complete-network-example to make it compile, here's the corrected line:
helper.EnablePacketTrackingDownlink ();

from lorawan.

Prapi123 avatar Prapi123 commented on September 4, 2024

Hello,
Thanks for your time and efforts to look into the matter.

I added the line in complete-network-example to test and got below error
image

later I tried to change Mtype by accessing EndDevice Mac layer with following code below,
`for (NodeContainer::Iterator j = endDevices.Begin ();
j != endDevices.End (); ++j)
{
Ptr node = *j;
Ptr loraNetDevice = node->GetDevice (0)->GetObject ();
Ptr phy = loraNetDevice->GetPhy ();

  Ptr<LoraMac> mac = loraNetDevice->GetMac ();
  Ptr<EndDeviceLoraMac> edLoraMac = mac->GetObject<EndDeviceLoraMac> ();
  edLoraMac->SetMType (LoraMacHeader::CONFIRMED_DATA_UP);
  
}`

for this I got this error,
image

running it under gdb has the following results.
image

I made only the changes suggested by you and nothing else.

Please help me out if you know what mistake I am making.

Regards

from lorawan.

DvdMgr avatar DvdMgr commented on September 4, 2024

Strange, I don't get that error at all. I inserted the

Config::SetDefault ("ns3::EndDeviceLoraMac::MType", EnumValue (LoraMacHeader::CONFIRMED_DATA_UP));

line right after the CommandLine.Parse, can you try that?

from lorawan.

Prapi123 avatar Prapi123 commented on September 4, 2024

Hello,

I tried it, It still gives the same error as above.

Is it because of my changes in lora-helper.cc and lora-helper.h?

from lorawan.

DvdMgr avatar DvdMgr commented on September 4, 2024

I added the line on the adr branch on your repository (last change was 1 hour ago), so I should have the same code as you. Are you sure you don't have any other changes locally?

from lorawan.

Prapi123 avatar Prapi123 commented on September 4, 2024

I have master-branch repository on my local machine , only four files are different in this repository they are
lora-helper.cc , lora-helper.h, lora-packet-tracker.cc, lora-packet-tracker.h. These files are from adr-branch. which are exactly the same as in my repository.

from lorawan.

Prapi123 avatar Prapi123 commented on September 4, 2024

There is also one other issue, I just identified, when I used only adr-branch repository and tried to run test, it says the test is failed.
Previously I had master repository and 4 file that I mentioned before were from adr-branch.

from lorawan.

DvdMgr avatar DvdMgr commented on September 4, 2024

Regarding the test failures, this was because the wrong interference matrix was used - if you rebase on the latest changes, it should all work!

from lorawan.

Prapi123 avatar Prapi123 commented on September 4, 2024

Hello,

This issue is resolved and the methods created works fine for me. You can close this issue if you want.

I faced one issue while creating a method for downlink packets.
When I extracting address of endDevices. with the code below

for (NodeContainer::Iterator j = endDevices.Begin (); j != endDevices.End (); ++j) { Ptr<Node> node = *j; Ptr<LoraNetDevice> loraNetDevice = node->GetDevice (0)->GetObject<LoraNetDevice> (); Ptr<LoraMac> mac = loraNetDevice->GetMac (); Ptr<EndDeviceLoraMac> edLoraMac = mac->GetObject<EndDeviceLoraMac> (); LoraDeviceAddress edAddress = edLoraMac->GetDeviceAddress (); }
it worked only before Simulator::Run (); Simulator::Destroy ();

when the above piece of code was placed after Simulator::Run (); Simulator::Destroy ();

it gave error as
image

That is why there was some difficulties creating methods in lora-packet-tracker for downlink packet.
If possible, can you please explain me why this is happening.

Thanks

from lorawan.

DvdMgr avatar DvdMgr commented on September 4, 2024

Have you tried putting the code before Simulator::Destroy ()?

from lorawan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.