Bug 2809 - Wifi doesn't fully stop when energy is depleted
Wifi doesn't fully stop when energy is depleted
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: wifi
ns-3.27
All All
: P3 normal
Assigned To: sebastien.deronne
:
Depends on: 2807
Blocks:
  Show dependency treegraph
 
Reported: 2017-10-24 17:26 UTC by Tommaso Pecorella
Modified: 2018-02-03 08:31 UTC (History)
1 user (show)

See Also:


Attachments
patch to energy examples (3.49 KB, patch)
2017-10-24 17:26 UTC, Tommaso Pecorella
Details | Diff
updated patch to energy examples (3.43 KB, patch)
2018-01-07 07:41 UTC, sebastien.deronne
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tommaso Pecorella 2017-10-24 17:26:19 UTC
Created attachment 2937 [details]
patch to energy examples

If one looks at the traces provided by the energy examples included, it is evident that there's a small issue.

When the energy is depleted, the radio is put in sleep mode (WifiPhy::SLEEP). However, there is still a small energy consumption in sleep mode. As a consequence, the energy consumption count is wrong.

There is the need for a real WifiPhy::OFF state, which should be reverted by the NotifyEnergyRecharged callback.

As a matter of fact, even without the patch in #2807, calling GetTotalEnergyConsumption at the simulation end shows the erroneous behavior: 0.8J consumed when the energy source had just 0.1J at the beginning.

The examples attached are meant to replace the existing energy examples, but I'd hold them until this bug is fixed.
Comment 1 sebastien.deronne 2017-10-29 16:24:23 UTC
Tommaso, thanks for reporting this issue.
Is somebody already planning to work on this one?
Comment 2 Tommaso Pecorella 2017-10-29 18:18:28 UTC
You're welcome.

Not me, I'm already way behind my schedule to add features to ns-3, starting from the GSoC contributions.

Cheers,

T.

(In reply to sebastien.deronne from comment #1)
> Tommaso, thanks for reporting this issue.
> Is somebody already planning to work on this one?
Comment 3 sebastien.deronne 2017-10-30 17:18:46 UTC
OK, I will see whether somebody or myself can work on this.

I guess this is a general bug though, and that not only wifi is not stopping when energy is depleted. Do you have knowledge which modules have this working correctly and which don't?
Comment 4 Tommaso Pecorella 2017-10-30 19:22:25 UTC
Since only Wi-Fi is properly handling energy depletion, I fear that no other module can be used as a guideline.

Sorry...

(In reply to sebastien.deronne from comment #3)
> OK, I will see whether somebody or myself can work on this.
> 
> I guess this is a general bug though, and that not only wifi is not stopping
> when energy is depleted. Do you have knowledge which modules have this
> working correctly and which don't?
Comment 5 sebastien.deronne 2017-11-20 16:46:38 UTC
I will work on this one asap.
Comment 6 sebastien.deronne 2017-11-29 07:35:44 UTC
I am currently working on this. 

I will first deliver some changes in the mainstream to introduce a new off state, then I'll send a review for the changes themselves.

I also wonder whether we should model the battery recharged, or whether this can be postponed? My suggestion is to postpone this.
Comment 7 sebastien.deronne 2017-12-17 09:49:39 UTC
I already pushed some more obvious changes, I will soon send a review for the logic itself.
Comment 8 sebastien.deronne 2018-01-07 07:41:57 UTC
Created attachment 2990 [details]
updated patch to energy examples

Added asserts in examples
Comment 9 sebastien.deronne 2018-01-10 11:59:33 UTC
I prepared a Rietveld issue with the code changes: http://codereview.appspot.com/332610043
Comment 10 sebastien.deronne 2018-01-19 15:57:05 UTC
Any comments on the proposal? I'd like to have this feature included in the upcoming release.
Comment 11 Tommaso Pecorella 2018-01-20 00:46:21 UTC
It seems all ok for me.

Just test it also with #2807 to be sure that energy doesn't go negative.
Afterwards, feel free to push both.

T.


(In reply to sebastien.deronne from comment #10)
> Any comments on the proposal? I'd like to have this feature included in the
> upcoming release.
Comment 12 sebastien.deronne 2018-01-20 15:39:42 UTC
Ok, thanks Tommaso.
It's still working fine (just had to handle off state in GetTotalEnergyConsumption), I will push both patches.

Note that the patch could also be later improved by handling energy recharged case.
Any idea how to reproduce an energy recharged? If I have time, I'll work soon on that case.
Comment 13 Tommaso Pecorella 2018-01-22 17:28:51 UTC
(In reply to sebastien.deronne from comment #12)
> Ok, thanks Tommaso.
> It's still working fine (just had to handle off state in
> GetTotalEnergyConsumption), I will push both patches.
> 
> Note that the patch could also be later improved by handling energy
> recharged case.
> Any idea how to reproduce an energy recharged? If I have time, I'll work
> soon on that case.

examples/energy/energy-model-with-harvesting-example.cc should do the trick.
Comment 14 sebastien.deronne 2018-02-03 08:14:13 UTC
Thanks.
I will push this, and try to find some time to handle later the energy recharged case.
Comment 15 sebastien.deronne 2018-02-03 08:31:53 UTC
pushed in changeset 13273:6437fd5d3f98