mirror of
https://gitlab.com/manzerbredes/paper-lowrate-iot.git
synced 2025-05-08 15:43:33 +00:00
Debug simulator
This commit is contained in:
parent
1da73fb609
commit
1399886f4d
10 changed files with 3232 additions and 1256 deletions
|
@ -1 +0,0 @@
|
||||||
loic@lguegan.7447:1555309869
|
|
1965
ns3-simulations/logs/#ns-3_1SSI_10SPS_2SN_2NH_10LB_10LL.org#
Normal file
1965
ns3-simulations/logs/#ns-3_1SSI_10SPS_2SN_2NH_10LB_10LL.org#
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1 +0,0 @@
|
||||||
#TITLE: mer. avril 24 16:37:06 CEST 2019 ns-3 simulation
|
|
|
@ -38,6 +38,8 @@ int main(int argc, char* argv[]){
|
||||||
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
|
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
|
||||||
|
|
||||||
// Run Simulations
|
// Run Simulations
|
||||||
|
uint32_t nNode=ns3::NodeList::GetNNodes();
|
||||||
|
NS_LOG_UNCOND("Starting simulation with "<< nNode << " nodes");
|
||||||
Simulator::Stop (Seconds (20));
|
Simulator::Stop (Seconds (20));
|
||||||
Simulator::Run ();
|
Simulator::Run ();
|
||||||
Simulator::Destroy ();
|
Simulator::Destroy ();
|
||||||
|
|
|
@ -22,15 +22,17 @@ void setupCellEnergy(Cell cell){
|
||||||
|
|
||||||
|
|
||||||
// Trace
|
// Trace
|
||||||
DeviceEnergyModelContainer energyModels(edgeApDeviceModels, edgeDeviceModels);
|
DeviceEnergyModelContainer::Iterator it=edgeDeviceModels.Begin();
|
||||||
DeviceEnergyModelContainer::Iterator it=energyModels.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
|
||||||
int i=0;
|
// AP will have id 0 in ECOFEN and WIFI (in order to combine their energy value when parsing logs
|
||||||
while(it!=energyModels.End()){
|
while(it!=edgeDeviceModels.End()){
|
||||||
(*it)->TraceConnect ("TotalEnergyConsumption", std::to_string(i),MakeCallback (&EnergyUpdated));
|
(*it)->TraceConnect ("TotalEnergyConsumption", std::to_string(0-i),MakeCallback (&EnergyUpdated));
|
||||||
it++;
|
it++;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
// AP will have id 0
|
||||||
|
(*edgeApDeviceModels.Begin())->TraceConnect ("TotalEnergyConsumption", std::to_string(0),MakeCallback (&EnergyUpdated));
|
||||||
|
|
||||||
// Ptr<BasicEnergySource> basicSourcePtr0 = DynamicCast<BasicEnergySource> (wifiEdgeNodesSources.Get (0));
|
// Ptr<BasicEnergySource> basicSourcePtr0 = DynamicCast<BasicEnergySource> (wifiEdgeNodesSources.Get (0));
|
||||||
// //basicSourcePtr0->TraceConnectWithoutContext ("RemainingEnergy", MakeCallback (&RemainingEnergy));
|
// //basicSourcePtr0->TraceConnectWithoutContext ("RemainingEnergy", MakeCallback (&RemainingEnergy));
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "ns3/wifi-radio-energy-model-helper.h"
|
#include "ns3/wifi-radio-energy-model-helper.h"
|
||||||
#include "ns3/point-to-point-helper.h"
|
#include "ns3/point-to-point-helper.h"
|
||||||
#include "ns3/ecofen-module.h"
|
#include "ns3/ecofen-module.h"
|
||||||
|
#include "ns3/node-list.h"
|
||||||
|
|
||||||
// C++ library
|
// C++ library
|
||||||
#include <iostream> // Why not ?
|
#include <iostream> // Why not ?
|
||||||
|
|
Binary file not shown.
|
@ -18,7 +18,7 @@ BEGIN {
|
||||||
}
|
}
|
||||||
|
|
||||||
# For WIFI ns-3 energy model
|
# For WIFI ns-3 energy model
|
||||||
/Node [0-9]+ consumes/ {
|
/Node -?[0-9]+ consumes/ {
|
||||||
gsub("J","",$4) # Remove trailling Joule symbol
|
gsub("J","",$4) # Remove trailling Joule symbol
|
||||||
if (!($2 in energy)){
|
if (!($2 in energy)){
|
||||||
energyWIFI[$2]=$4
|
energyWIFI[$2]=$4
|
||||||
|
@ -52,7 +52,7 @@ END {
|
||||||
}
|
}
|
||||||
|
|
||||||
# CSV output
|
# CSV output
|
||||||
print("node,energy")
|
print("nodeId,energy")
|
||||||
for(key in overallEnergy){
|
for(key in overallEnergy){
|
||||||
print(key "," overallEnergy[key])
|
print(key "," overallEnergy[key])
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
: sensorsSendInterval:1 sensorsPktSize:10 sensorsNumber:2 nbHop:2 linksBandwidth:10 linksLatency:10
|
|
||||||
|
|
||||||
|
|
||||||
#+NAME: singleRun
|
#+NAME: singleRun
|
||||||
|
@ -32,16 +31,22 @@
|
||||||
simCMD="$simulator --sensorsSendInterval=${sensorsSendInterval} --sensorsPktSize=${sensorsPktSize} --sensorsNumber=${sensorsNumber} --nbHop=${nbHop} --linksBandwidth=${linksBandwidth} --linksLatency=${linksLatency} 2>&1"
|
simCMD="$simulator --sensorsSendInterval=${sensorsSendInterval} --sensorsPktSize=${sensorsPktSize} --sensorsNumber=${sensorsNumber} --nbHop=${nbHop} --linksBandwidth=${linksBandwidth} --linksLatency=${linksLatency} 2>&1"
|
||||||
log=$(bash -c "$simCMD")
|
log=$(bash -c "$simCMD")
|
||||||
|
|
||||||
|
# Compute some metrics
|
||||||
|
energyLog=$(echo "$log" | $parseEnergyScript)
|
||||||
|
totalEnergy=$(echo "$energyLog"| awk 'BEGIN{power=0;FS=","}NR!=1{power+=$2}END{print(power)}')
|
||||||
|
nbPacketCloud=$(echo "$log"|grep -c "CloudSwitch receive")
|
||||||
|
nbNodes=$(echo "$log"|awk '/Starting simul/{print($4)}')
|
||||||
|
|
||||||
|
# Save logs
|
||||||
echo -e "#+TITLE: $(date) ns-3 simulation\n" > $logFile
|
echo -e "#+TITLE: $(date) ns-3 simulation\n" > $logFile
|
||||||
echo "* Full Command" >> $logFile
|
echo "* Full Command" >> $logFile
|
||||||
echo "$simCMD" >> $logFile
|
echo "$simCMD" >> $logFile
|
||||||
echo "* Output" >> $logFile
|
echo "* Output" >> $logFile
|
||||||
echo "$log" >> $logFile
|
echo "$log" >> $logFile
|
||||||
echo "* Energy CSV" >> $logFile
|
echo "* Energy CSV (negative nodeId = WIFI, 0 = AP (Wireless+Wired), positive nodeId = ECOFEN" >> $logFile
|
||||||
echo "$log" | $parseEnergyScript >> $logFile
|
echo "$energyLog" >> $logFile
|
||||||
echo "* Metrics" >> $logFile
|
echo "* Metrics" >> $logFile
|
||||||
echo " sensorsSendInterval:${sensorsSendInterval} sensorsPktSize:${sensorsPktSize} sensorsNumber:${sensorsNumber} nbHop:${nbHop} linksBandwidth:${linksBandwidth} linksLatency:${linksLatency}" >> $logFile
|
echo " sensorsSendInterval:${sensorsSendInterval} sensorsPktSize:${sensorsPktSize} sensorsNumber:${sensorsNumber} nbHop:${nbHop} linksBandwidth:${linksBandwidth} linksLatency:${linksLatency} totalEnergy:$totalEnergy nbPacketCloud:$nbPacketCloud nbNodes:$nbNodes" >> $logFile
|
||||||
|
|
||||||
}
|
}
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue