Conversation
- Refactored `BatteryDegradationTab` to use the `BatteryDegradationTool` trait (Strategy pattern) to manage sub-tools. - Moved existing Capacity Fade logic into `CapacityFadeTool`. - Implemented `LifetimeEstimatorTool` using `PowerLawModel::cycles_to_capacity` and typed values (`Capacity`, `DepthOfDischarge`) to calculate and display expected battery lifetime. - Checked off "Lifetime Estimator" in `todo_gui.md`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Pull request overview
Implements a new “Lifetime Estimator” feature in the Battery Degradation GUI module and refactors the tab to use a strategy-style sub-tool architecture to keep the main tab manageable.
Changes:
- Introduces
BatteryDegradationTooland refactors Battery Degradation into selectable sub-tools. - Extracts existing capacity-fade UI into
CapacityFadeTool. - Adds
LifetimeEstimatorToolthat estimates lifetime (cycles/days/years) usingPowerLawModel.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| todo_gui.md | Marks “Lifetime Estimator” as completed in the roadmap. |
| math_explorer_gui/src/tabs/battery_degradation/mod.rs | Adds the tool-trait + tool selector tab wrapper (BatteryDegradationTab). |
| math_explorer_gui/src/tabs/battery_degradation/capacity_fade.rs | Refactors the existing UI into CapacityFadeTool implementing the new tool trait. |
| math_explorer_gui/src/tabs/battery_degradation/lifetime_estimator.rs | Adds the new Lifetime Estimator tool UI and model-based calculation. |
Comments suppressed due to low confidence (1)
math_explorer_gui/src/tabs/battery_degradation/capacity_fade.rs:30
self.dodis clamped to allow 0.0, but with the currentPowerLawModel(negative exponent),DepthOfDischarge::new(0.0)makesn70infinite (0.0.powf(negative)-> inf), which then propagates into plot/results. Consider enforcing a small positive minimum DoD here (e.g. 0.1) and aligning the UI slider range accordingly, or special-casing 0.0 as 'no cycling'.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| fn show(&mut self, ctx: &egui::Context) { | ||
| // Enforce valid ranges | ||
| self.target_capacity = self.target_capacity.clamp(0.1, 99.9); |
This PR implements the "Lifetime Estimator" feature within the Battery Degradation module.
To prevent
BatteryDegradationTabfrom becoming bloated, it was refactored to use the Strategy Pattern by defining aBatteryDegradationTooltrait. The existing logic was moved to aCapacityFadeTool, and a newLifetimeEstimatorToolwas added. This tool leverages thePowerLawModelfrommath_explorerto calculate the estimated battery life in years based on target capacity, DoD, and usage frequency.PR created automatically by Jules for task 5247989038705432542 started by @fderuiter