diff options
| author | Loic Guegan <manzerberdes@gmx.com> | 2019-04-25 09:00:11 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerberdes@gmx.com> | 2019-04-25 09:00:11 +0200 |
| commit | 1399886f4d56370d713ba3262b83df1df008d2a7 (patch) | |
| tree | f5c65d654973e806f3cf3ce0b5420e86538e81b7 /ns3-simulations/ns3-simulator/modules | |
| parent | 1da73fb60964a92442d66454265897259120582a (diff) | |
Debug simulator
Diffstat (limited to 'ns3-simulations/ns3-simulator/modules')
| -rw-r--r-- | ns3-simulations/ns3-simulator/modules/energy.cc | 14 | ||||
| -rw-r--r-- | ns3-simulations/ns3-simulator/modules/modules.hpp | 1 |
2 files changed, 9 insertions, 6 deletions
diff --git a/ns3-simulations/ns3-simulator/modules/energy.cc b/ns3-simulations/ns3-simulator/modules/energy.cc index 64d30e1..11f1c7a 100644 --- a/ns3-simulations/ns3-simulator/modules/energy.cc +++ b/ns3-simulations/ns3-simulator/modules/energy.cc @@ -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)); diff --git a/ns3-simulations/ns3-simulator/modules/modules.hpp b/ns3-simulations/ns3-simulator/modules/modules.hpp index 7945959..c47dc39 100644 --- a/ns3-simulations/ns3-simulator/modules/modules.hpp +++ b/ns3-simulations/ns3-simulator/modules/modules.hpp @@ -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 ? |
