Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 1575 discharge energy #1969

Merged
merged 8 commits into from
Mar 10, 2022
Merged

Conversation

valentinsulzer
Copy link
Member

Description

Add "Discharge energy [W.h]" as an output variable (integral of power).
Set option "calculate discharge energy" to "true" to turn on. It's false by default as calculating it can be slow.

Fixes #1575

Type of change

Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist:

  • No style issues: $ flake8
  • All tests pass: $ python run-tests.py --unit
  • The documentation builds: $ cd docs and then $ make clean; make html

You can run all three at once, using $ python run-tests.py --quick.

Further checks:

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@codecov
Copy link

codecov bot commented Mar 8, 2022

Codecov Report

Merging #1969 (7d28451) into develop (9a1f455) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #1969   +/-   ##
========================================
  Coverage    99.32%   99.32%           
========================================
  Files          346      346           
  Lines        19064    19078   +14     
========================================
+ Hits         18936    18950   +14     
  Misses         128      128           
Impacted Files Coverage Δ
...ybamm/models/full_battery_models/lead_acid/loqs.py 100.00% <ø> (ø)
pybamm/simulation.py 98.36% <ø> (ø)
...m/models/full_battery_models/base_battery_model.py 99.76% <100.00%> (ø)
pybamm/models/standard_variables.py 100.00% <100.00%> (ø)
...ubmodels/external_circuit/base_external_circuit.py 100.00% <100.00%> (ø)
...ernal_circuit/explicit_control_external_circuit.py 100.00% <100.00%> (ø)
...ernal_circuit/function_control_external_circuit.py 98.91% <100.00%> (ø)
pybamm/models/submodels/thermal/isothermal.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update abba68e...7d28451. Read the comment docs.

@TomTranter
Copy link
Contributor

@tinosulzer this is a lot of code changes just for one calculation. Did it really slow things down so much to warrant making it an option?

@valentinsulzer
Copy link
Member Author

Here are the benchmarks with the discharge energy calculation: https://github.com/pybamm-team/PyBaMM/runs/5458023045?check_suite_focus=true

It could probably be done as a post-processing step, with low overhead, but that would be a bigger change

@valentinsulzer
Copy link
Member Author

It's not that many changes? Most of them are just passing options to the external circuit submodels, which we might want to do at some point later anyway

@TomTranter
Copy link
Contributor

ok if you think might be useful anyway. I just prefer not having too many options

@valentinsulzer valentinsulzer merged commit 7cca539 into develop Mar 10, 2022
@valentinsulzer valentinsulzer deleted the issue-1575-discharge-energy branch March 10, 2022 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Discharged energy [W.h] as variable
2 participants