blob: 8e9e00fd0ebd132eca748e194e10d51deccd9be2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#include "modules.hpp"
void PktReceived(std::string nodeName,Ptr< const Packet > packet, const Address &address){
NS_LOG_UNCOND("Node " << nodeName << " receive a packet" << " at time " << Simulator::Now ().GetSeconds () << "s");
}
void EnergyUpdated(std::string nodeName,double oldValue, double newValue){
double currentTime=Simulator::Now ().GetSeconds ();
double energyConsumes=newValue-oldValue;
NS_LOG_UNCOND("Node " << nodeName << " consumes " << energyConsumes << "J" << " at time " << currentTime << "s");
NS_LOG_UNCOND("Node " << nodeName << " newVal " << newValue << "J" << " at time " << currentTime << "s");
NS_LOG_UNCOND("Node " << nodeName << " oldValue " << oldValue << "J" << " at time " << currentTime << "s");
}
|