Init final simulator source

This commit is contained in:
Loic Guegan 2019-04-12 13:52:06 +02:00
parent 23e8f7f688
commit 9272834371
7 changed files with 302 additions and 0 deletions

41
ns3-simulator/main.cc Normal file
View file

@ -0,0 +1,41 @@
#include "modules/modules.hpp"
NS_LOG_COMPONENT_DEFINE ("WIFISensorsSimulator");
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);
// Setup Simulations
CloudInfos cloud=buildEdgeAndCloud(nbHop);
Cell c=createCell(sensorsNumber,cloud.first.Get(0));
applyScenarios(c,sensorsPktSize,sensorsFrequency,cloud); // Send data from Sensors to Cloud
// setupEnergy(c);
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
// Run simulators
Simulator::Stop (Seconds (20));
Simulator::Run ();
Simulator::Destroy (); // Destroy
return(0);
}