mirror of
https://gitlab.com/manzerbredes/paper-lowrate-iot.git
synced 2025-05-01 09:27:45 +00:00
Debug+Do Simulations
This commit is contained in:
parent
79ef212a8c
commit
89d815f81e
70 changed files with 190288 additions and 312708 deletions
100
ns3-simulations/simulator/modules/modules.hpp
Normal file
100
ns3-simulations/simulator/modules/modules.hpp
Normal file
|
@ -0,0 +1,100 @@
|
|||
|
||||
|
||||
#ifndef MODULES_HPP
|
||||
#define MODULES_HPP
|
||||
|
||||
#include "ns3/command-line.h"
|
||||
#include "ns3/config.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/log.h"
|
||||
#include "ns3/yans-wifi-helper.h"
|
||||
#include "ns3/ssid.h"
|
||||
#include "ns3/mobility-helper.h"
|
||||
#include "ns3/on-off-helper.h"
|
||||
#include "ns3/yans-wifi-channel.h"
|
||||
#include "ns3/mobility-model.h"
|
||||
#include "ns3/packet-sink.h"
|
||||
#include "ns3/packet-sink-helper.h"
|
||||
#include "ns3/udp-echo-helper.h"
|
||||
#include "ns3/tcp-westwood.h"
|
||||
#include "ns3/internet-stack-helper.h"
|
||||
#include "ns3/ipv4-address-helper.h"
|
||||
#include "ns3/ipv4-global-routing-helper.h"
|
||||
#include "ns3/constant-position-mobility-model.h"
|
||||
#include "ns3/energy-module.h"
|
||||
#include "ns3/wifi-radio-energy-model-helper.h"
|
||||
#include "ns3/point-to-point-helper.h"
|
||||
#include "ns3/ecofen-module.h"
|
||||
#include "ns3/node-list.h"
|
||||
#include "ns3/flow-monitor-module.h"
|
||||
|
||||
// C++ library
|
||||
#include <iostream> // Why not ?
|
||||
#include <utility> // To use std::pair
|
||||
#include <iomanip> // To use std::setw
|
||||
|
||||
// ECOFEN
|
||||
#define ECOFEN_LOG_UNTIL 100
|
||||
#define ECOFEN_LOG_EVERY 0.1
|
||||
|
||||
// WIFI Energy Values
|
||||
#define BASICENERGYSOURCEINITIALENERGYJ 10
|
||||
#define BASICENERGYSUPPLYVOLTAGEV 3.3
|
||||
#define TXCURRENTA 0.38
|
||||
#define RXCURRENTA 0.313
|
||||
#define IDLECURRENTA 0.273
|
||||
|
||||
// Cloud Energy Values
|
||||
#define ONCONSO 0
|
||||
#define OFFCONSO 0
|
||||
#define IDLECONSO 1
|
||||
#define RECVBYTEENERGY 3.4
|
||||
#define SENTBYTEENERGY 3.4
|
||||
#define RECVPKTENERGY 192.2
|
||||
#define SENTPKTENERGY 192.2
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
// ---------- 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
|
||||
|
||||
|
||||
// ---------- 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);
|
||||
/**
|
||||
* 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);
|
||||
|
||||
|
||||
// ---------- energy.cc ----------
|
||||
/*
|
||||
* Configure WIFI energy module for cell
|
||||
*/
|
||||
void setupCellEnergy(Cell cell);
|
||||
/*
|
||||
* Configure link/port energy using ecofen
|
||||
*/
|
||||
void setupCloudEnergy(CloudInfos cloudInfos);
|
||||
|
||||
|
||||
// ---------- callbacks.cc ----------
|
||||
void PktReceived(std::string nodeName,Ptr< const Packet > packet, const Address &address);
|
||||
void EnergyUpdated(std::string nodeName,double oldValue, double newValue);
|
||||
|
||||
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue