Refactoring

This commit is contained in:
Loic Guegan 2019-04-12 14:48:47 +02:00
parent 9272834371
commit cb10ad2490
5 changed files with 57 additions and 40 deletions

View file

@ -26,31 +26,48 @@
#include "ns3/point-to-point-helper.h"
// C++ library
#include <iostream>
#include <utility> // To use std::pair
#include <iomanip>
#include <iostream> // Why not ?
#include <utility> // To use std::pair
#include <iomanip> // To use std::setw
using namespace ns3;
// Data types
// ---------- Data types ----------
typedef std::pair<NodeContainer,NodeContainer> CellNodes; // Format (APNode, SensorsNodes)
typedef std::pair<NetDeviceContainer,NetDeviceContainer> CellNetDevices; // Format (APNetDev, SensorsNetDev)
typedef std::pair<CellNodes,CellNetDevices> Cell;
typedef std::pair<Ipv4Address,int> EndPoint; // Format (IP,Port)
typedef std::pair<NodeContainer,EndPoint> CloudInfos; // Format (CloudHops,CloudEndPoint), here data sent to CloudEndPoint
// via CloudHops.Get(0) will flow throw all hops until the reaching the cloud
// via CloudHops.Get(0) will flow throw all hops until the reaching the cloud
// Platform functions
// ---------- platform.cc ----------
/**
* Create a WIFI cell paltform composed of nbSensors sensors and ap as an access point
*/
Cell createCell(uint32_t nbSensors, Ptr<ns3::Node> ap);
CloudInfos buildEdgeAndCloud(int nbOp);
void applyScenarios(Cell cell,int sensorsPktSize, int sensorsSendInterval, CloudInfos cloudInfos);
// Energy functions
void setupEnergy(Cell cell);
/**
* Build P2P network composed of nbHop hops (to simulate edge->cloud communications)
* Note: Cloud Servers are not considered here and completely ignored !
*/
CloudInfos createCloud(int nbHop, uint32_t bandwidth, uint32_t latency);
/**
* Setup simulation scenario on the platforms. Sensors in cell will send packets of sensorsPktSize size every
* sensorsSensInterval second to the cloud using cloudInfos.
*/
void setupScenario(Cell cell, CloudInfos cloudInfos, int sensorsPktSize, int sensorsSendInterval);
// Callbacks
// ---------- energy.cc ----------
/*
* Configure WIFI energy module for cell
*/
void setupCellEnergy(Cell cell);
// ---------- callbacks.cc ----------
void PktReceived(std::string nodeName,Ptr< const Packet > packet, const Address &address);
void EnergyUpdated(std::string nodeName,double oldValue, double newValue);
#endif