paper-lowrate-iot/ns3-simulations/simulator/modules/callbacks.cc

13 lines
529 B
C++
Raw Normal View History

2019-04-12 13:52:06 +02:00
#include "modules.hpp"
void PktReceived(std::string nodeName,Ptr< const Packet > packet, const Address &address){
2019-04-12 16:45:24 +02:00
NS_LOG_UNCOND("Node " << nodeName << " receive a packet" << " at time " << Simulator::Now ().GetSeconds () << "s");
2019-04-12 13:52:06 +02:00
}
void EnergyUpdated(std::string nodeName,double oldValue, double newValue){
2019-04-25 15:51:05 +02:00
double currentTime=Simulator::Now ().GetSeconds ();
double energyConsumes=newValue-oldValue;
NS_LOG_UNCOND("Node " << nodeName << " consumes " << energyConsumes << "J" << " at time " << currentTime << "s");
2019-04-12 13:52:06 +02:00
}