tux
unread,Jan 27, 2012, 10:00:40 AM1/27/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to omnetpp
Hi!
I'm beginning using Omnet/Mixim and I'm trying to model power
consumption of nodes. I apologize in advance if the question is too
simple.
I'm using PhyLayerBattery and the following overriden method for
drawing energy from the battery during transmission:
void SamplePhyLayer::handleUpperMessage(cMessage* msg) {
if (utility->getHostState().get() == HostState::FAILED) {
coreEV<< "host has FAILED, dropping msg " << msg->getName() <<
endl;
delete msg;
return;
}
MacPkt* pkt = static_cast<MacPkt*>(msg);
MacToPhyControlInfo* cInfo = static_cast<MacToPhyControlInfo*>(pkt-
>getControlInfo());
double current = calcTXCurrentForPacket(pkt, cInfo);
double capacity;
if(current > 0) {
BatteryAccess::drawCurrent(current, TX_ACCT);
}
else {
capacity = getParentModule()->getParentModule()-
>getSubmodule("battery")->par("capacity");
ev << "actual battery capacity: " << capacity << "\n";
BatteryAccess::drawCurrent(txCurrent, TX_ACCT);
capacity = getParentModule()->getParentModule()-
>getSubmodule("battery")->par("capacity");
ev << "actual battery capacity: " << capacity << "\n";
}
PhyLayer::handleUpperMessage(msg);
}
At runtime appears the following:
actual battery capacity: 50
host[0]::SimpleBattery: 4.236547967884 device 0 (physical layer) draw
current 17mA, activity = 2
host[0]::SimpleBattery: 4.236547967884: residual capacity = 593771
actual battery capacity: 50
So the capacity doesn't seem to change, even if I let the simulation
running. I read previous posts about this topic, and parameters
in .ini file seems properly setted (in particular publishDelta and
publishTime are positive)
**.batteryStats.debug = true
**.batteryStats.detail = true
**.batteryStats.timeSeries = true
**.battery.nominal = 50mAh
**.battery.capacity = 50mAh
**.battery.voltage = 3.3V
**.battery.resolution = 10s
**.battery.publishDelta = 0.5
**.battery.publishTime = 5s
**.battery.numDevices = 1
**.battery.debug = true
Can anyone help me in finding the problem, please? Thanks a lot in
advance.
Regards