paper-lowrate-iot/ns3-simulator/main.cc

42 lines
1.4 KiB
C++
Raw Normal View History

2019-04-12 13:52:06 +02:00
#include "modules/modules.hpp"
NS_LOG_COMPONENT_DEFINE ("WIFISensorsSimulator");
2019-04-12 14:48:47 +02:00
/**
* To get more details about functions please have a look at modules/modules.hpp
*/
2019-04-12 13:52:06 +02:00
int main(int argc, char* argv[]){
uint32_t sensorsFrequency=1;
uint32_t sensorsPktSize=150;
uint32_t sensorsNumber=2;
uint32_t nbHop=5;
CommandLine cmd;
cmd.AddValue ("sensorsSendInterval", "Number of temperature measurement per second", sensorsFrequency);
cmd.AddValue ("sensorsPktSize", "Sensor measurements packet size (bytes)", sensorsPktSize);
cmd.AddValue ("sensorsNumber", "Number of sensors", sensorsNumber);
cmd.AddValue ("nbHop", "Number of hop between AP and Cloud sensors", sensorsNumber);
cmd.Parse (argc, argv);
//LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO);
//LogComponentEnable("PacketSink", LOG_LEVEL_INFO);
2019-04-12 14:48:47 +02:00
// ---------- Setup Simulations ----------
CloudInfos cloud=createCloud(nbHop,5,2); // Create cloud P2P node chain o--o--o--o--o
Cell cell=createCell(sensorsNumber,cloud.first.Get(0)); // Use first cloud node as Access Point
setupScenario(cell,cloud,sensorsPktSize,sensorsFrequency); // Send data from Sensors to Cloud
setupCellEnergy(cell);
2019-04-12 13:52:06 +02:00
2019-04-12 14:48:47 +02:00
// Don't forget the following
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
2019-04-12 13:52:06 +02:00
2019-04-12 14:48:47 +02:00
// Run Simulations
2019-04-12 13:52:06 +02:00
Simulator::Stop (Seconds (20));
Simulator::Run ();
2019-04-12 14:48:47 +02:00
Simulator::Destroy ();
2019-04-12 13:52:06 +02:00
return(0);
}