PyBaMM icon indicating copy to clipboard operation
PyBaMM copied to clipboard

Plett OCP Hysteresis Model

Open mleot opened this issue 2 years ago • 4 comments

Description

Adds the hysteresis model as outlined in Wycisk 2022, and as mentioned in #3375 and as discussed in #3376 .

This will allow for hysteresis switching to depend not on the current, but on the differential capacity change.

Fixes #3375

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.

  • [x] 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:

  • [x] No style issues: $ pre-commit run (or $ nox -s pre-commit) (see CONTRIBUTING.md for how to set this up to run automatically when committing locally, in just two lines of code)
  • [x] All tests pass: $ python run-tests.py --all (or $ nox -s tests)
  • [x] The documentation builds: $ python run-tests.py --doctest (or $ nox -s doctests)

You can run integration tests, unit tests, and doctests together at once, using $ python run-tests.py --quick (or $ nox -s quick).

Further checks:

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

mleot avatar Dec 05 '23 20:12 mleot

@tinosulzer just bumping this comment again to see if you had any ideas

On Thu, Dec 21, 2023, 1:57 PM Tanner Leo @.***> wrote:

@.**** commented on this pull request.

In pybamm/models/submodels/interface/open_circuit_potential/plett_ocp.py https://urldefense.com/v3/__https://github.com/pybamm-team/PyBaMM/pull/3593*discussion_r1434544378__;Iw!!AT_l0aBtzg!x3qeLaE3zT60iD8EYTIecj026S4nMsCDsWLbNxYnZOaxmcjc3D57li60JuItOpydhv2T4F2G_Lk32Sfwyq7eOQ$ :

  •        if domain_options["particle size"] == "distribution":
    
  •            if sto_surf.domains['primary'] == f"{domain} electrode":
    
  •                ocp_surf = ocp_surf_eq + H * h
    
  •            else:
    
  •                ocp_surf = ocp_surf_eq + H_x_av * h_x_av
    
  •        else:
    
  •            ocp_surf = ocp_surf_eq + H * h
    

So I have been able to get the DFN tests to pass and MPM tests to pass, although I realized I needed to x_average the h and H variables for the MPM, but not for the DFN with a psd. Is there any variable where I can have that logic execute automatically?

— Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/pybamm-team/PyBaMM/pull/3593*pullrequestreview-1793720164__;Iw!!AT_l0aBtzg!x3qeLaE3zT60iD8EYTIecj026S4nMsCDsWLbNxYnZOaxmcjc3D57li60JuItOpydhv2T4F2G_Lk32ScE0juZ-A$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/BBQPXVIOAN7D3URF3EVUNIDYKSWEFAVCNFSM6AAAAABAII3LR2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTOOJTG4ZDAMJWGQ__;!!AT_l0aBtzg!x3qeLaE3zT60iD8EYTIecj026S4nMsCDsWLbNxYnZOaxmcjc3D57li60JuItOpydhv2T4F2G_Lk32SeB9kzSwg$ . You are receiving this because you authored the thread.Message ID: @.***>

mleot avatar Apr 05 '24 06:04 mleot

@rtimms Okay I believe everything here is in working order. Is an example notebook necessary? What else do I need to do before it can be merged into develop?

mleot avatar Apr 17 '24 02:04 mleot

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.57%. Comparing base (fd7d1fd) to head (d8f451e). Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3593      +/-   ##
===========================================
- Coverage    99.58%   99.57%   -0.02%     
===========================================
  Files          260      261       +1     
  Lines        21358    21454      +96     
===========================================
+ Hits         21270    21363      +93     
- Misses          88       91       +3     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Apr 18 '24 17:04 codecov[bot]

Thanks for walking me through it! Hopefully the next one goes smoother!

mleot avatar May 11 '24 07:05 mleot

@all-contributors please add @mleot for code and tests

brosaplanella avatar May 14 '24 07:05 brosaplanella

@brosaplanella

I've put up a pull request to add @mleot! :tada:

allcontributors[bot] avatar May 14 '24 07:05 allcontributors[bot]

Nice addition 👍. The heat generation due to OCP hysteresis still isn't accounted for, is it?

DavidMStraub avatar Jul 30 '24 11:07 DavidMStraub

I don't think so. Do you know any references on how this should be accounted for?

brosaplanella avatar Jul 30 '24 11:07 brosaplanella

Only using terminal voltage & energy balance like in https://doi.org/10.1038/s41560-019-0410-6 ... @rtimms might be able to answer better 🙂

DavidMStraub avatar Jul 30 '24 12:07 DavidMStraub