Skip to content

Add battery energy integration#8

Merged
karakayahuseyin merged 8 commits into
mainfrom
feat/battery-energy-integration
Jun 21, 2026
Merged

Add battery energy integration#8
karakayahuseyin merged 8 commits into
mainfrom
feat/battery-energy-integration

Conversation

@karakayahuseyin

Copy link
Copy Markdown
Contributor

This pull request enhances the documentation and API for the RateMapBattery model, adds a new BatteryIntegrationResult type, and updates the examples to demonstrate new integration features. The changes clarify available battery simulation modes, add support for integration-based workflows, and improve API consistency and usability.

API and Type Additions:

  • Added BatteryIntegrationResult to the public API, representing the result of battery integration with final state, time histories, delivered energy, and stop reason. Includes validation logic to ensure data consistency. (pythrust/battery/state.py, pythrust/battery/__init__.py) [1] [2]

Documentation Improvements:

  • Expanded documentation in docs/battery_model.md and docs/api_reference.md to describe new point-state and integration helper methods, integration modes, and result reporting. Added method tables and example code for integration workflows. [1] [2] [3] [4]
  • Updated example documentation to reflect new integration-based state advancement and internal loss point-state support. [1] [2] [3]

Example Updates:

  • Updated examples/rate_map_battery_mission.py to use integrate_current and accumulate delivered energy using the new result type. [1] [2]
  • Updated examples/rate_map_battery_point_states.py to demonstrate the new state_at_power_loss method. [1] [2]

Minor Cleanups:

  • Minor docstring and terminology updates for clarity and consistency. [1] [2] [3]

These changes make the battery model more robust, easier to use in time-stepped and mission simulations, and better documented for users.

Closes #7

@karakayahuseyin karakayahuseyin requested a review from Copilot June 21, 2026 11:56
@karakayahuseyin karakayahuseyin self-assigned this Jun 21, 2026
@karakayahuseyin karakayahuseyin added documentation Improvements or additions to documentation feature New feature tests labels Jun 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds integration-based workflows to the RateMapBattery model so missions/endurance can be computed with time-history integration (including delivered energy, consumed charge, and stop reasons), and updates docs/examples/tests to reflect the new API.

Changes:

  • Introduces BatteryIntegrationResult as a public type for integration outputs (final state + histories + energy/charge + feasibility + stop reason).
  • Extends RateMapBattery with point-state internal-loss support plus multiple integration modes (time-based, target-DOD, and segmented power profiles) and energy knockdown helpers.
  • Updates documentation and examples to demonstrate integration-based advancement and new point-state helpers; expands tests to cover integration stop conditions.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/test_battery.py Adds coverage for BatteryIntegrationResult, state_at_power_loss, and the new integration/knockdown helper methods.
pythrust/battery/state.py Adds BatteryIntegrationResult with post-init normalization/validation of time-history data.
pythrust/battery/rate_map.py Implements state_at_power_loss and a suite of SciPy-based integrators + DOD/power helper utilities.
pythrust/battery/__init__.py Exposes BatteryIntegrationResult in the public battery API.
examples/rate_map_battery_point_states.py Demonstrates the new internal-loss point-state helper.
examples/rate_map_battery_mission.py Switches mission advancement from fixed-step step_current to integrate_current and uses delivered energy from the result.
docs/examples.md Updates example descriptions to mention integration and the new power-loss point state.
docs/battery_model.md Expands model docs with integration modes, helper tables, and usage examples.
docs/api_reference.md Adds API reference tables for point-state and integration helper methods.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pythrust/battery/rate_map.py Outdated
Comment thread pythrust/battery/rate_map.py Outdated
Comment thread pythrust/battery/rate_map.py Outdated
Comment thread pythrust/battery/rate_map.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Comment thread pythrust/battery/rate_map.py
Comment thread pythrust/battery/rate_map.py
Comment thread pythrust/battery/rate_map.py
Comment thread examples/rate_map_battery_mission.py
@karakayahuseyin karakayahuseyin merged commit 0fc241d into main Jun 21, 2026
5 checks passed
@karakayahuseyin karakayahuseyin deleted the feat/battery-energy-integration branch June 21, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation feature New feature tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add battery energy integration and knockdown factors

2 participants