mirror of
https://gitlab.com/manzerbredes/paper-lowrate-iot.git
synced 2025-05-02 01:47:45 +00:00
Add ECOFEN
This commit is contained in:
parent
cb10ad2490
commit
32ccf612d0
7 changed files with 54 additions and 18 deletions
|
@ -6,5 +6,5 @@ void PktReceived(std::string nodeName,Ptr< const Packet > packet, const Address
|
|||
}
|
||||
|
||||
void EnergyUpdated(std::string nodeName,double oldValue, double newValue){
|
||||
NS_LOG_UNCOND("Node " << nodeName << " consumes " << newValue << "J");
|
||||
NS_LOG_UNCOND("Node " << nodeName << " consumes " << newValue-oldValue << "J");
|
||||
}
|
||||
|
|
|
@ -46,6 +46,27 @@ void setupCellEnergy(Cell cell){
|
|||
// NS_ASSERT (basicRadioModelPtr0 != NULL);
|
||||
// basicRadioModelPtr0->TraceConnectWithoutContext ("TotalEnergyConsumption", MakeCallback (&TotalEnergy));
|
||||
|
||||
|
||||
}
|
||||
|
||||
void setupCloudEnergy(CloudInfos cloudInfos){
|
||||
NodeContainer cloudNodes=cloudInfos.first;
|
||||
|
||||
// Install basic energy
|
||||
ns3::BasicNodeEnergyHelper basicNodeEnergy;
|
||||
basicNodeEnergy.Set("OnConso", ns3::DoubleValue (0.0));
|
||||
basicNodeEnergy.Set("OffConso", ns3::DoubleValue (0.0));
|
||||
basicNodeEnergy.Install (cloudNodes);
|
||||
|
||||
ns3::CompleteNetdeviceEnergyHelper completeNetdeviceEnergy;
|
||||
completeNetdeviceEnergy.Set ("OffConso", ns3::DoubleValue (0));
|
||||
completeNetdeviceEnergy.Set ("IdleConso", ns3::DoubleValue (0));
|
||||
completeNetdeviceEnergy.Set ("RecvByteEnergy", ns3::DoubleValue (10));
|
||||
completeNetdeviceEnergy.Set ("SentByteEnergy", ns3::DoubleValue (10));
|
||||
completeNetdeviceEnergy.Set ("RecvPktEnergy", ns3::DoubleValue (10));
|
||||
completeNetdeviceEnergy.Set ("SentPktEnergy", ns3::DoubleValue (10));
|
||||
completeNetdeviceEnergy.Install(cloudNodes);
|
||||
|
||||
ns3::ConsumptionLogger conso;
|
||||
conso.NodeConso(ns3::Seconds (1), ns3::Seconds(10), cloudNodes);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#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"
|
||||
|
||||
// C++ library
|
||||
#include <iostream> // Why not ?
|
||||
|
@ -62,6 +63,10 @@ void setupScenario(Cell cell, CloudInfos cloudInfos, int sensorsPktSize, int sen
|
|||
* Configure WIFI energy module for cell
|
||||
*/
|
||||
void setupCellEnergy(Cell cell);
|
||||
/*
|
||||
* Configure link/port energy using ecofen
|
||||
*/
|
||||
void setupCloudEnergy(CloudInfos cloudInfos);
|
||||
|
||||
|
||||
// ---------- callbacks.cc ----------
|
||||
|
|
|
@ -11,7 +11,7 @@ Cell createCell(uint32_t nbSensors, Ptr<ns3::Node> ap){
|
|||
sensors.Create(nbSensors);
|
||||
|
||||
// Place nodes somehow, this is required by every wireless simulation
|
||||
for (uint8_t i = 0; i < nbSensors; ++i)
|
||||
for (uint32_t i = 0; i < nbSensors; i++)
|
||||
{
|
||||
sensors.Get (i)->AggregateObject (CreateObject<ConstantPositionMobilityModel> ());
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ CloudInfos createCloud(int nbHop, uint32_t bandwidth, uint32_t latency){
|
|||
p2pDevices = pointToPoint.Install (curNodes);
|
||||
|
||||
Ipv4AddressHelper address;
|
||||
address.SetBase (("10.1."+std::to_string(i)+".0").c_str(), "255.255.255.0");
|
||||
address.SetBase (("10."+std::to_string(i+1)+".0.0").c_str(), "255.255.0.0"); // Remember: 10.0.0.0 is used by WIFI
|
||||
Ipv4InterfaceContainer p2pInterfaces;
|
||||
p2pInterfaces = address.Assign (p2pDevices);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue