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

Experiment refactor #1459

Merged
merged 95 commits into from
May 26, 2021
Merged

Experiment refactor #1459

merged 95 commits into from
May 26, 2021

Conversation

valentinsulzer
Copy link
Member

Description

A loose collection of refactorings for simulating several cycles with degradation

Fixes #1018

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 May 5, 2021

Codecov Report

Merging #1459 (ad1590d) into develop (7d8ec5c) will increase coverage by 0.02%.
The diff coverage is 99.23%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1459      +/-   ##
===========================================
+ Coverage    98.32%   98.34%   +0.02%     
===========================================
  Files          294      295       +1     
  Lines        16854    17093     +239     
===========================================
+ Hits         16571    16810     +239     
  Misses         283      283              
Impacted Files Coverage Δ
...graphite_UMBL_Mohtat2020/graphite_ocp_PeymanMPM.py 100.00% <ø> (ø)
...lectrodes/NMC_UMBL_Mohtat2020/NMC_ocp_PeymanMPM.py 100.00% <ø> (ø)
pybamm/models/submodels/interface/sei/base_sei.py 100.00% <ø> (ø)
pybamm/parameters/parameter_sets.py 100.00% <ø> (ø)
pybamm/parameters/parameter_values.py 99.43% <ø> (ø)
pybamm/solvers/casadi_algebraic_solver.py 98.87% <ø> (ø)
pybamm/solvers/base_solver.py 99.18% <96.25%> (+<0.01%) ⬆️
pybamm/__init__.py 94.95% <100.00%> (ø)
pybamm/experiments/experiment.py 100.00% <100.00%> (ø)
pybamm/expression_tree/concatenations.py 98.06% <100.00%> (ø)
... and 18 more

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 7d8ec5c...ad1590d. Read the comment docs.

@valentinsulzer valentinsulzer marked this pull request as ready for review May 24, 2021 00:05
Copy link
Contributor

@rtimms rtimms left a comment

Choose a reason for hiding this comment

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

looks great, thanks @tinosulzer ! just a couple of minor comments

"id": "heavy-crisis",
"metadata": {},
"source": [
"Alternatively, we can simulate many CCCV cycles. Here we simulate either 100 cycles or until the capacity is 80% of the initial capacity, whichever is first. The capacity is calculated by the eSOH model"
Copy link
Contributor

Choose a reason for hiding this comment

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

think the next (commented out) cell can be deleted and the "References" cell after it

"n = int(l//np.sqrt(l))\n",
"m = int(np.ceil(l/n))\n",
"\n",
"fig, axes = plt.subplots(n,m,figsize=(10,10))\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

very nice notebook! I think this will be popular. It doesn't need to be for this issue, but might be good to automate this e.g. sim.plot_summary_variables()

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, though it's not too hard to plot the variables (they're just numpy arrays, unlike the outputs of a regular solution) so I like leaving customizability to the user

@@ -38,19 +38,18 @@ def test_read_strings(self):
"Run US06 (V) for 5 minutes",
"Run US06 (W) for 0.5 hours",
],
{"test": "test"}, drive_cycles={"US06": drive_cycle},
{"test": "test"},
drive_cycles={"US06": drive_cycle},
Copy link
Contributor

Choose a reason for hiding this comment

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

do we have an example anywhere of using a drive cycle in an experiment? or doesn't it actually work in a simulation yet? I'm not up to date with the progress there

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it works but need to double check

@valentinsulzer valentinsulzer merged commit fe6960c into develop May 26, 2021
@valentinsulzer valentinsulzer deleted the experiment-refactor branch May 26, 2021 15:11
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.

Electrode stoichiometry variables
2 participants