Enhance energy model - #201
Conversation
2bde98c to
1832f9a
Compare
This comment was marked as resolved.
This comment was marked as resolved.
|
Hi, thank you for the contribution. I like the general idea this PR, I'll get to reviewing it as soon as I have addressed the previous PRs in the backlog. I merged the latest changes and I have hidden your comment with test results: we have a CI pipeline to take care of that without polluting the PR msg history. In the meantime you can update this PR by fixing eventual errors detected by the CI pipeline. |
|
Merged code with recent changes from @maribu |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #201 +/- ##
===========================================
+ Coverage 84.47% 84.60% +0.13%
===========================================
Files 67 68 +1
Lines 7016 7115 +99
===========================================
+ Hits 5927 6020 +93
- Misses 1089 1095 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…g ScheduleSwitchToOff inside HandleEnergyChanged to avoid nested calls
|
I find one problem but not sure how to deal with it: I put a TODO comment in SwitchToOff function. Please let me know if you have ideas. |
|
Removed the 'Auto schedule to switch off based on remaining energy' feature. Reason: Encountered floating-point comparison issues when reaching to 0 energy, which could lead to an assert failure due to subtle inaccuracies. This removal should not affect normal use cases because the BasicEnergySource class already includes a minimum energy threshold parameter (default value: 0.1×initialEnergy). Therefore, during normal simulation runs, the energy level will not typically reach a value close enough to zero to trigger the assert issue, and the simulation will stop safely beforehand. |
|
Hello. I have considered merging this for the upcoming release but I see some problems in how the MAC layer may manage the OFF state (not your fault, they come from modeling choices of the previous developers). For example, in reality RX windows are actually managed by the PHY layer in a mode called RXSINGLE (as opposed to RXCONTINUOUS). Also the whole device should shut down (the APP and MAC too) when the battery dies. So in order to integrate and merge this, I started working on restructuring the PHY state model to actually reflect hardware modes. Unfortunately it is somewhat of a big change, so due to the current limited time I have to work on it I have decided to postpone this goal for next realease. |
|
Thanks for the detailed explanation. No problem. I’ll stay available if you need any help with this PR. |
This pull request fixes issue #200
Proposed Changes