Comments (24)
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.
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.
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.
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.
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.
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.
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.
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.
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.
I'm sorry for the delay - I now have some time to check this out, is this still an issue?
from lorawan.
Hello Thanks for responding. Yes I am still working to capture downlink packets
from lorawan.
I checked out the code on your adr branch and it doesn't seem to compile - can you confirm this?
from lorawan.
from lorawan.
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.
Thanks
from lorawan.
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.
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
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);
}`
running it under gdb has the following results.
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.
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.
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.
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.
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.
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.
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.
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 ();
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.
Have you tried putting the code before Simulator::Destroy ()
?
from lorawan.
Related Issues (20)
- Are the max packet sizes correct? HOT 1
- How does lorawan-energy-model-example.cc suppose to work ?
- Simulation with LoRa (without LoRaWAN stack)
- LoRa Mesh module contribution?
- Lack of maintenance + alternatives
- lorawan: Ongoing changes to the module
- Issue with LoraFrameHeader while Handling the address part in LoRaWAN MAC Layer for Multiple End Devices
- test.py failing with "Packet changed contents when going through the channel" HOT 3
- m_receiveCallback in Receive function in lora-net-device HOT 4
- Performance metrics HOT 2
- Questions about complete network example HOT 3
- lorawan module paccket indicated as lost and received successfully at the same time HOT 2
- Unable to read LoraFrameHeader for uplink messages (using gw mac) HOT 2
- Broken documentation HOT 2
- How to run a simple scenario in aloha , slotted aloha and tdma? HOT 1
- How to integrate a new model HOT 2
- Transmission disappearing when sent before second Rx window HOT 2
- onoffhelper HOT 2
- How to use NetAnim while simulating lora? HOT 2
- rs-example code HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lorawan.