Dear ns3-users.
Now, I try to measure energy consumption on ns3.27.
I think the power consumption increases as the number of packets increases.
But my outputs are inversely proportional.
what is the problem ?
Thank you.
-------command & outputs----------
Command1:./waf --run "simpleRouting --numPackets=1 --rtProto=OLSR --traceNode=1"
Output: 38.4657s 31.3939(←this is totalEnergy (maybe J) )
Command2: ./waf --run "simpleRouting --numPackets=10 --rtProto=OLSR --traceNode=1"
Output: 38.4657s 31.3156
Command3: ./waf --run "simpleRouting --numPackets=100 --rtProto=OLSR --traceNode=1"
Output: 38.4657s 30.4736
Command4: ./waf --run "simpleRouting --numPackets=400 --rtProto=OLSR --traceNode=1"
Output: 39.9659s 28.8931 (←Why does it decrease?)
------------code---------------------
void // Trace function for total energy consumption at node.
NetSim::TotalEnergy (double oldValue, double totalEnergy)
{
NS_LOG_FUNCTION(this);
NS_LOG_UNCOND (Simulator::Now ().GetSeconds () <<"\t" << totalEnergy);
}
void
NetSim::TraceTotalEnergy(EnergySourceContainer e)
{
NS_LOG_FUNCTION(this);
Ptr<BasicEnergySource> basicSourcePtr = DynamicCast<BasicEnergySource> (e.Get (traceNum));
Ptr<DeviceEnergyModel> basicRadioModelPtr =
basicSourcePtr->FindDeviceEnergyModels ("ns3::WifiRadioEnergyModel").Get (0);
NS_ASSERT (basicRadioModelPtr != NULL);
basicRadioModelPtr->TraceConnectWithoutContext ("TotalEnergyConsumption",
MakeCallback (&NetSim::TotalEnergy, this));
}
void
NetSim::RunSimulation ()
{
NS_LOG_FUNCTION(this);
ConfigureSetDefault();
MakeNetworkTopology();
ConfigureDataLinkLayer();
EnergySourceContainer e = AttachEnergyModelToDevices(8200, 0.0857, 0.0528);
TraceTotalEnergy(e);
ConfigureNetworkLayer ();
ConfigureL4withDUPApp(sourceNode, sinkNode);
This is my code.
2018年12月14日金曜日 11時03分25秒 UTC+9 non: