Closed SonileKM closed 1 month ago
Hello, What are rs-example and RS LoRa? To my knowledge, they are not part of this repository. That may be where the problematic code comes from. Let me know.
First of all, please use ns-3.41 as that is the officially supported version of ns-3 by the latest version of the lorawan module. Regardless, I cannot find the statement mentioned above in the codebase, and everything seems to compile without errors by following the guide in the README. Which example are you using? (Update: @non-det-alle beat me to it :) )
Hello Alessandro, First of all thanks for responding. Allow me to also apologise for taking it for granted that the terms rs-example and RS LoRa are known. I am studying and following up the following work in the article: "Improving Reliability and Scalability of LoRaWANs Through Lightweight Scheduling", where the authors developed the RS LoRa algorithm (R for Reliability and S for Scalability). I downloaded the code from the following provided in the article: https://github.com/ networkedsystems/lora-ns I was trying to run the code in the examples folder to understand how it works and that's how the error mentioned earlier was coming up. Here is a sample of the code i was running known as rs-example.cc
//#include <ns3/log.h>
//#include
NS_LOG_COMPONENT_DEFINE ("lora");
using namespace ns3; using namespace std;
/////////////////////////////////
// Configuration
/////////////////////////////////
//std::vector <int, double> marked_list;
double length = 2000; //!< Square city with length as distance
int pktsize = 51; //!< size of packets, in bytes
int duration = 60*60;//10000; //!< Duration of the simulation
double interval = 10; // interval between packets, minutes
bool verbose = false; // enable logging (different from trace)
bool nakagami = true; // enable nakagami path loss
bool dynamic = false; // enable random moving of pan node
uint32_t nSensors = 10; // numbenir of sent packets
uint32_t nGateways = 1; // numbenir of sent packets
Ptr
uint32_t
GetClosestGateway (Ptr
/// Save that teh message has been transmitted
void
Transmitted (const Ptr
// save that a message has been received
void
Received (const Ptr
// save that a message has been uniquely received
void
ReceivedUnique (const Ptr
int
mainBody () { randT->SetAttribute("Max",DoubleValue(600)); //Enable checksum (FCS) GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
// Logging
if (verbose)
{
LogComponentEnableAll (LOG_PREFIX_TIME);
LogComponentEnableAll (LOG_PREFIX_FUNC);
}
//Create nodes
NodeContainer loraNetworkNode;
loraNetworkNode.Create (1);
NodeContainer loraCoordinatorNodes;
loraCoordinatorNodes.Create (nGateways);
NodeContainer loraDeviceNodes;
loraDeviceNodes.Create(nSensors);
NodeContainer loraBackendNodes(loraNetworkNode, loraCoordinatorNodes);
//std::cout << "Create mobility of basestations" << std::endl;
MobilityHelper mobility;
Ptr<ListPositionAllocator> basePositionList = CreateObject<
ListPositionAllocator> (); basePositionList->Add (Vector (0.0,0.0,0.0)); //network //basePositionList->Add (Vector (1000,500,50.0)); //main base station //basePositionList->Add (Vector (2000,500,50.0)); //main base station //basePositionList->Add (Vector (500,std::sqrt(3)500+500,50.0)); //main base station //basePositionList->Add (Vector (1500,std::sqrt(3)500+500,50.0)); //main base station basePositionList->Add (Vector (1000,1000,50));//std::sqrt(3)500+500,50.0)); //main base station //basePositionList->Add (Vector (2500,std::sqrt(3)500+500,50.0)); //main base station //basePositionList->Add (Vector (1000,std::sqrt(3)5002+500,50.0)); //main base station //basePositionList->Add (Vector (2000,std::sqrt(3)5002+500,50.0)); //main base station mobility.SetPositionAllocator (basePositionList); mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install(loraBackendNodes);
//Mobility nodes
std::cout << "Create mobility of nodes" << std::endl;
MobilityHelper mobility2;
Ptr<ListPositionAllocator> nodePositionList = CreateObject<
ListPositionAllocator>(); for(uint32_t nodePositionsAssigned = 0; nodePositionsAssigned < nSensors; nodePositionsAssigned++){ double x,y; do{ x = randT->GetInteger(0,length); y = randT->GetInteger(0,length); } while ((x-1000)(x-1000)+(y-1000)(y-1000) > 1000*1000); std::cout << x << "," << y << std::endl; nodePositionList->Add (Vector (x,y,1.0)); } mobility2.SetPositionAllocator (nodePositionList); mobility2.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility2.Install (loraDeviceNodes);
//Channel
std::cout << "Create channel" << std::endl;
SpectrumChannelHelper channelHelper;
channelHelper.SetChannel ("ns3::MultiModelSpectrumChannel");
if (nakagami)
{
channelHelper.AddPropagationLoss (
"ns3::OkumuraHataPropagationLossModel","Frequency",DoubleValue(868e6));
channelHelper.AddPropagationLoss (
"ns3::NakagamiPropagationLossModel","m0",DoubleValue(1),"m1",DoubleValue(1),
"m2",DoubleValue(1));
}
else
{
channelHelper.AddPropagationLoss (
"ns3::OkumuraHataPropagationLossModel","Frequency",DoubleValue(868e6));
}
channelHelper.SetPropagationDelay (
"ns3::ConstantSpeedPropagationDelayModel");
Ptr
// Configure gateways
std::cout << "Create gateways" << std::endl;
gateways = lorahelper.InstallRsGateways (loraCoordinatorNodes);
for (uint32_t i = 0; i< gateways.GetN(); i++)
gateways.Get(i)->SetAttribute ("Offset",UintegerValue(offsets[i]-1
));
// Create the nodes
std::cout << "Create nodes" << std::endl;
NetDeviceContainer loraNetDevices;
loraNetDevices = lorahelper.InstallRs (loraDeviceNodes);
for (uint32_t i = 0; i< loraNetDevices.GetN (); i++)
{
// this is a dirty workaround. Make sure to create first the
network and then the gateways loraNetDevices.Get(i)->SetAttribute ("Offset2",UintegerValue(offsets [GetClosestGateway(loraNetDevices.Get(i)->GetNode()->GetObject
Dear Matteo, Thanks so much for the advice to use ns-3.41. Here is the code for rs-example.cc that Iam trying to run.#include "ns3/non-communicating-net-device.h"
//#include <ns3/log.h>
//#include
NS_LOG_COMPONENT_DEFINE ("lora");
using namespace ns3; using namespace std;
/////////////////////////////////
// Configuration
/////////////////////////////////
//std::vector <int, double> marked_list;
double length = 2000; //!< Square city with length as distance
int pktsize = 51; //!< size of packets, in bytes
int duration = 60*60;//10000; //!< Duration of the simulation
double interval = 10; // interval between packets, minutes
bool verbose = false; // enable logging (different from trace)
bool nakagami = true; // enable nakagami path loss
bool dynamic = false; // enable random moving of pan node
uint32_t nSensors = 10; // numbenir of sent packets
uint32_t nGateways = 1; // numbenir of sent packets
Ptr
uint32_t
GetClosestGateway (Ptr
/// Save that teh message has been transmitted
void
Transmitted (const Ptr
// save that a message has been received
void
Received (const Ptr
// save that a message has been uniquely received
void
ReceivedUnique (const Ptr
int
mainBody () { randT->SetAttribute("Max",DoubleValue(600)); //Enable checksum (FCS) GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
// Logging
if (verbose)
{
LogComponentEnableAll (LOG_PREFIX_TIME);
LogComponentEnableAll (LOG_PREFIX_FUNC);
}
//Create nodes
NodeContainer loraNetworkNode;
loraNetworkNode.Create (1);
NodeContainer loraCoordinatorNodes;
loraCoordinatorNodes.Create (nGateways);
NodeContainer loraDeviceNodes;
loraDeviceNodes.Create(nSensors);
NodeContainer loraBackendNodes(loraNetworkNode, loraCoordinatorNodes);
//std::cout << "Create mobility of basestations" << std::endl;
MobilityHelper mobility;
Ptr<ListPositionAllocator> basePositionList = CreateObject<
ListPositionAllocator> (); basePositionList->Add (Vector (0.0,0.0,0.0)); //network //basePositionList->Add (Vector (1000,500,50.0)); //main base station //basePositionList->Add (Vector (2000,500,50.0)); //main base station //basePositionList->Add (Vector (500,std::sqrt(3)500+500,50.0)); //main base station //basePositionList->Add (Vector (1500,std::sqrt(3)500+500,50.0)); //main base station basePositionList->Add (Vector (1000,1000,50));//std::sqrt(3)500+500,50.0)); //main base station //basePositionList->Add (Vector (2500,std::sqrt(3)500+500,50.0)); //main base station //basePositionList->Add (Vector (1000,std::sqrt(3)5002+500,50.0)); //main base station //basePositionList->Add (Vector (2000,std::sqrt(3)5002+500,50.0)); //main base station mobility.SetPositionAllocator (basePositionList); mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install(loraBackendNodes);
//Mobility nodes
std::cout << "Create mobility of nodes" << std::endl;
MobilityHelper mobility2;
Ptr<ListPositionAllocator> nodePositionList = CreateObject<
ListPositionAllocator>(); for(uint32_t nodePositionsAssigned = 0; nodePositionsAssigned < nSensors; nodePositionsAssigned++){ double x,y; do{ x = randT->GetInteger(0,length); y = randT->GetInteger(0,length); } while ((x-1000)(x-1000)+(y-1000)(y-1000) > 1000*1000); std::cout << x << "," << y << std::endl; nodePositionList->Add (Vector (x,y,1.0)); } mobility2.SetPositionAllocator (nodePositionList); mobility2.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility2.Install (loraDeviceNodes);
//Channel
std::cout << "Create channel" << std::endl;
SpectrumChannelHelper channelHelper;
channelHelper.SetChannel ("ns3::MultiModelSpectrumChannel");
if (nakagami)
{
channelHelper.AddPropagationLoss (
"ns3::OkumuraHataPropagationLossModel","Frequency",DoubleValue(868e6));
channelHelper.AddPropagationLoss (
"ns3::NakagamiPropagationLossModel","m0",DoubleValue(1),"m1",DoubleValue(1),
"m2",DoubleValue(1));
}
else
{
channelHelper.AddPropagationLoss (
"ns3::OkumuraHataPropagationLossModel","Frequency",DoubleValue(868e6));
}
channelHelper.SetPropagationDelay (
"ns3::ConstantSpeedPropagationDelayModel");
Ptr
// Configure gateways
std::cout << "Create gateways" << std::endl;
gateways = lorahelper.InstallRsGateways (loraCoordinatorNodes);
for (uint32_t i = 0; i< gateways.GetN(); i++)
gateways.Get(i)->SetAttribute ("Offset",UintegerValue(offsets[i]-1
));
// Create the nodes
std::cout << "Create nodes" << std::endl;
NetDeviceContainer loraNetDevices;
loraNetDevices = lorahelper.InstallRs (loraDeviceNodes);
for (uint32_t i = 0; i< loraNetDevices.GetN (); i++)
{
// this is a dirty workaround. Make sure to create first the
network and then the gateways loraNetDevices.Get(i)->SetAttribute ("Offset2",UintegerValue(offsets [GetClosestGateway(loraNetDevices.Get(i)->GetNode()->GetObject
Hi @SonileKM,
Your questions are about a different codebase, please open an issue on the correct repository. We have no knowledge or affiliation with the code you are referring to.
Thanks so much Alessandro. Will do as advised.
On Thu, Jul 18, 2024 at 4:17 PM Alessandro Aimi @.***> wrote:
Closed #168 https://github.com/signetlabdei/lorawan/issues/168 as completed.
— Reply to this email directly, view it on GitHub https://github.com/signetlabdei/lorawan/issues/168#event-13556798101, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJ4QHRQAX3V2B7F5P5GIODTZM7E6LAVCNFSM6AAAAABK6KRLHSVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJTGU2TMNZZHAYTAMI . You are receiving this because you were mentioned.Message ID: @.***>
I am running example code for RS LoRa and its giving the following error:
fatal error: ns3/lora-module.h: no such file or directory. In the code there is a statement ; #include <ns3/lora-module.h>
I tried to check for this header file and associated code but i cant find it in either the ns3.40 folder or the ns-3-Dev folder. I have also tried to check online. Please help me resolve this.
Specifications