mirror of
https://gitlab.com/manzerbredes/paper-lowrate-iot.git
synced 2025-05-01 17:37:45 +00:00
Debug simulator
This commit is contained in:
parent
1da73fb609
commit
1399886f4d
10 changed files with 3232 additions and 1256 deletions
|
@ -38,6 +38,8 @@ int main(int argc, char* argv[]){
|
|||
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
|
||||
|
||||
// Run Simulations
|
||||
uint32_t nNode=ns3::NodeList::GetNNodes();
|
||||
NS_LOG_UNCOND("Starting simulation with "<< nNode << " nodes");
|
||||
Simulator::Stop (Seconds (20));
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
|
|
|
@ -22,15 +22,17 @@ void setupCellEnergy(Cell cell){
|
|||
|
||||
|
||||
// Trace
|
||||
DeviceEnergyModelContainer energyModels(edgeApDeviceModels, edgeDeviceModels);
|
||||
DeviceEnergyModelContainer::Iterator it=energyModels.Begin();
|
||||
|
||||
int i=0;
|
||||
while(it!=energyModels.End()){
|
||||
(*it)->TraceConnect ("TotalEnergyConsumption", std::to_string(i),MakeCallback (&EnergyUpdated));
|
||||
DeviceEnergyModelContainer::Iterator it=edgeDeviceModels.Begin();
|
||||
int i=1; // Node 0 will be AP, other node will have negative id (cf following while)
|
||||
// This is usefull in logs, in fact ECOFEN nodes will have positive ID and WIFI energy nodes negative id
|
||||
// AP will have id 0 in ECOFEN and WIFI (in order to combine their energy value when parsing logs
|
||||
while(it!=edgeDeviceModels.End()){
|
||||
(*it)->TraceConnect ("TotalEnergyConsumption", std::to_string(0-i),MakeCallback (&EnergyUpdated));
|
||||
it++;
|
||||
i++;
|
||||
}
|
||||
// AP will have id 0
|
||||
(*edgeApDeviceModels.Begin())->TraceConnect ("TotalEnergyConsumption", std::to_string(0),MakeCallback (&EnergyUpdated));
|
||||
|
||||
// Ptr<BasicEnergySource> basicSourcePtr0 = DynamicCast<BasicEnergySource> (wifiEdgeNodesSources.Get (0));
|
||||
// //basicSourcePtr0->TraceConnectWithoutContext ("RemainingEnergy", MakeCallback (&RemainingEnergy));
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#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"
|
||||
|
||||
// C++ library
|
||||
#include <iostream> // Why not ?
|
||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue