Battery capacity in mixim

330 views
Skip to first unread message

tux

unread,
Jan 27, 2012, 10:00:40 AM1/27/12
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

Michael

unread,
Jan 31, 2012, 1:04:51 AM1/31/12
to omnetpp
what is the value of txCurrent?

khawla ki

unread,
May 4, 2012, 11:47:44 AM5/4/12
to omn...@googlegroups.com
hi tux ,

am a new user of omnet and mixim

am trying to find  the power consuption for each activity .

where did you find those information  ^^'

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

thks in advance
Reply all
Reply to author
Forward
0 new messages